hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/arch/arm/mach-imx/cpu-imx31.c
....@@ -1,15 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * MX31 CPU type detection
34 *
45 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117
128 #include <linux/module.h>
9
+#include <linux/of_address.h>
1310 #include <linux/io.h>
1411
1512 #include "common.h"
....@@ -36,10 +33,17 @@
3633
3734 static int mx31_read_cpu_rev(void)
3835 {
36
+ void __iomem *iim_base;
37
+ struct device_node *np;
3938 u32 i, srev;
4039
40
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim");
41
+ iim_base = of_iomap(np, 0);
42
+ of_node_put(np);
43
+ BUG_ON(!iim_base);
44
+
4145 /* read SREV register from IIM module */
42
- srev = imx_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
46
+ srev = imx_readl(iim_base + MXC_IIMSREV);
4347 srev &= 0xff;
4448
4549 for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)