forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/arm/mach-imx/cpu-imx27.c
....@@ -1,20 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
34 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation; either version 2
8
- * of the License, or (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software
16
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- * MA 02110-1301, USA.
185 */
196
207 /*
....@@ -22,6 +9,7 @@
229 */
2310
2411 #include <linux/io.h>
12
+#include <linux/of_address.h>
2513 #include <linux/module.h>
2614
2715 #include "hardware.h"
....@@ -30,16 +18,24 @@
3018 static int mx27_cpu_partnumber;
3119
3220 #define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */
21
+#define SYSCTRL_OFFSET 0x800 /* Offset from CCM base address */
3322
3423 static int mx27_read_cpu_rev(void)
3524 {
25
+ void __iomem *ccm_base;
26
+ struct device_node *np;
3627 u32 val;
28
+
29
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
30
+ ccm_base = of_iomap(np, 0);
31
+ of_node_put(np);
32
+ BUG_ON(!ccm_base);
3733 /*
3834 * now we have access to the IO registers. As we need
3935 * the silicon revision very early we read it here to
4036 * avoid any further hooks
4137 */
42
- val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID));
38
+ val = imx_readl(ccm_base + SYSCTRL_OFFSET + SYS_CHIP_ID);
4339
4440 mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);
4541