diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-09-28 05:16:05 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-09-28 07:41:01 -0400 |
commit | ddd5f51bf661f49fb5f2be371ff1cf9cfe5fa98b (patch) | |
tree | c381f21c5534c79819cf28424d9c7c38e1ad3095 /arch/arm | |
parent | 742b6c6f3e15331cec4ab420a639d5239ef2a02a (diff) |
arm/imx: change mxc_init_l2x0() to an imx31/35 specific call
The mxc_init_l2x0() should really be an imx31/35 specific call.
The patch removes early_initcall from mxc_init_l2x0() and get imx31
and imx35 soc specific function calls mxc_init_l2x0(), so that it's
not necessarily to be called for all imx socs when we build single
image for multiple imx socs.
Thus the function can be renamed to imx3_init_l2x0() and put into
mm-imx3.c. It also changes the return type from integer to void.
From what I see, the integer was picked just to satisfy early_initcall
prototype.
With the patch 'ARM: l2x0: add empty l2x0_of_init' applied, the code
compiles even without CONFIG_CACHE_L2X0 enabled.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/cache-l2x0.c | 56 | ||||
-rw-r--r-- | arch/arm/mach-imx/mm-imx3.c | 38 |
3 files changed, 38 insertions, 57 deletions
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 8ec4a4ca1489..0aa86d22236b 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile | |||
@@ -10,7 +10,6 @@ obj-$(CONFIG_MACH_MX27) += clock-imx27.o mm-imx27.o ehci-imx27.o | |||
10 | 10 | ||
11 | obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o | 11 | obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o |
12 | obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o | 12 | obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o |
13 | obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o | ||
14 | 13 | ||
15 | # Support for CMOS sensor interface | 14 | # Support for CMOS sensor interface |
16 | obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o | 15 | obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o |
diff --git a/arch/arm/mach-imx/cache-l2x0.c b/arch/arm/mach-imx/cache-l2x0.c deleted file mode 100644 index 69d1322add3c..000000000000 --- a/arch/arm/mach-imx/cache-l2x0.c +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009-2010 Pengutronix | ||
3 | * Sascha Hauer <s.hauer@pengutronix.de> | ||
4 | * Juergen Beisert <j.beisert@pengutronix.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it under | ||
7 | * the terms of the GNU General Public License version 2 as published by the | ||
8 | * Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/err.h> | ||
13 | #include <linux/kernel.h> | ||
14 | |||
15 | #include <asm/hardware/cache-l2x0.h> | ||
16 | |||
17 | #include <mach/hardware.h> | ||
18 | |||
19 | static int mxc_init_l2x0(void) | ||
20 | { | ||
21 | void __iomem *l2x0_base; | ||
22 | void __iomem *clkctl_base; | ||
23 | |||
24 | if (!cpu_is_mx31() && !cpu_is_mx35()) | ||
25 | return 0; | ||
26 | |||
27 | /* | ||
28 | * First of all, we must repair broken chip settings. There are some | ||
29 | * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These | ||
30 | * misconfigured CPUs will run amok immediately when the L2 cache gets enabled. | ||
31 | * Workaraound is to setup the correct register setting prior enabling the | ||
32 | * L2 cache. This should not hurt already working CPUs, as they are using the | ||
33 | * same value. | ||
34 | */ | ||
35 | #define L2_MEM_VAL 0x10 | ||
36 | |||
37 | clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096); | ||
38 | if (clkctl_base != NULL) { | ||
39 | writel(0x00000515, clkctl_base + L2_MEM_VAL); | ||
40 | iounmap(clkctl_base); | ||
41 | } else { | ||
42 | pr_err("L2 cache: Cannot fix timing. Trying to continue without\n"); | ||
43 | } | ||
44 | |||
45 | l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096); | ||
46 | if (IS_ERR(l2x0_base)) { | ||
47 | printk(KERN_ERR "remapping L2 cache area failed with %ld\n", | ||
48 | PTR_ERR(l2x0_base)); | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | l2x0_init(l2x0_base, 0x00030024, 0x00000000); | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | arch_initcall(mxc_init_l2x0); | ||
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index e06eed12a7b0..ffa33b4dedde 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | 22 | ||
23 | #include <asm/pgtable.h> | 23 | #include <asm/pgtable.h> |
24 | #include <asm/hardware/cache-l2x0.h> | ||
24 | #include <asm/mach/map.h> | 25 | #include <asm/mach/map.h> |
25 | 26 | ||
26 | #include <mach/common.h> | 27 | #include <mach/common.h> |
@@ -29,6 +30,39 @@ | |||
29 | #include <mach/iomux-v3.h> | 30 | #include <mach/iomux-v3.h> |
30 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
31 | 32 | ||
33 | void imx3_init_l2x0(void) | ||
34 | { | ||
35 | void __iomem *l2x0_base; | ||
36 | void __iomem *clkctl_base; | ||
37 | |||
38 | /* | ||
39 | * First of all, we must repair broken chip settings. There are some | ||
40 | * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These | ||
41 | * misconfigured CPUs will run amok immediately when the L2 cache gets enabled. | ||
42 | * Workaraound is to setup the correct register setting prior enabling the | ||
43 | * L2 cache. This should not hurt already working CPUs, as they are using the | ||
44 | * same value. | ||
45 | */ | ||
46 | #define L2_MEM_VAL 0x10 | ||
47 | |||
48 | clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096); | ||
49 | if (clkctl_base != NULL) { | ||
50 | writel(0x00000515, clkctl_base + L2_MEM_VAL); | ||
51 | iounmap(clkctl_base); | ||
52 | } else { | ||
53 | pr_err("L2 cache: Cannot fix timing. Trying to continue without\n"); | ||
54 | } | ||
55 | |||
56 | l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096); | ||
57 | if (IS_ERR(l2x0_base)) { | ||
58 | printk(KERN_ERR "remapping L2 cache area failed with %ld\n", | ||
59 | PTR_ERR(l2x0_base)); | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | l2x0_init(l2x0_base, 0x00030024, 0x00000000); | ||
64 | } | ||
65 | |||
32 | static struct map_desc mx31_io_desc[] __initdata = { | 66 | static struct map_desc mx31_io_desc[] __initdata = { |
33 | imx_map_entry(MX31, X_MEMC, MT_DEVICE), | 67 | imx_map_entry(MX31, X_MEMC, MT_DEVICE), |
34 | imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED), | 68 | imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED), |
@@ -102,6 +136,8 @@ void __init imx31_soc_init(void) | |||
102 | { | 136 | { |
103 | int to_version = mx31_revision() >> 4; | 137 | int to_version = mx31_revision() >> 4; |
104 | 138 | ||
139 | imx3_init_l2x0(); | ||
140 | |||
105 | mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); | 141 | mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); |
106 | mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); | 142 | mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); |
107 | mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); | 143 | mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); |
@@ -154,6 +190,8 @@ void __init imx35_soc_init(void) | |||
154 | { | 190 | { |
155 | int to_version = mx35_revision() >> 4; | 191 | int to_version = mx35_revision() >> 4; |
156 | 192 | ||
193 | imx3_init_l2x0(); | ||
194 | |||
157 | /* i.mx35 has the i.mx31 type gpio */ | 195 | /* i.mx35 has the i.mx31 type gpio */ |
158 | mxc_register_gpio("imx31-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); | 196 | mxc_register_gpio("imx31-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); |
159 | mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); | 197 | mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); |