Skip to content

Commit 94b2bec

Browse files
fabioestevamShawn Guo
authored andcommitted
ARM: imx27: Retrieve the SYSCTRL base address from devicetree
Now that imx27 has been converted to a devicetree-only platform, retrieve the SYSCTRL base address from devicetree. To keep devicetree compatibilty the SYSCTRL base address will be retrieved from the CCM base address plus an 0x800 offset. This is not a problem as the imx27.dtsi describes the CCM register range as 0x1000. Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent f92c710 commit 94b2bec

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

arch/arm/mach-imx/cpu-imx27.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <linux/io.h>
12+
#include <linux/of_address.h>
1213
#include <linux/module.h>
1314

1415
#include "hardware.h"
@@ -17,16 +18,23 @@ static int mx27_cpu_rev = -1;
1718
static int mx27_cpu_partnumber;
1819

1920
#define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */
21+
#define SYSCTRL_OFFSET 0x800 /* Offset from CCM base address */
2022

2123
static int mx27_read_cpu_rev(void)
2224
{
25+
void __iomem *ccm_base;
26+
struct device_node *np;
2327
u32 val;
28+
29+
np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
30+
ccm_base = of_iomap(np, 0);
31+
BUG_ON(!ccm_base);
2432
/*
2533
* now we have access to the IO registers. As we need
2634
* the silicon revision very early we read it here to
2735
* avoid any further hooks
2836
*/
29-
val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID));
37+
val = imx_readl(ccm_base + SYSCTRL_OFFSET + SYS_CHIP_ID);
3038

3139
mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);
3240

0 commit comments

Comments
 (0)