diff options
Diffstat (limited to 'arch/arm/mach-omap2/pdata-quirks.c')
-rw-r--r-- | arch/arm/mach-omap2/pdata-quirks.c | 108 |
1 files changed, 101 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 10c71450cf63..5aaf720211f4 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/davinci_emac.h> | ||
11 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
@@ -16,6 +17,7 @@ | |||
16 | 17 | ||
17 | #include <linux/platform_data/pinctrl-single.h> | 18 | #include <linux/platform_data/pinctrl-single.h> |
18 | 19 | ||
20 | #include "am35xx.h" | ||
19 | #include "common.h" | 21 | #include "common.h" |
20 | #include "common-board-devices.h" | 22 | #include "common-board-devices.h" |
21 | #include "dss-common.h" | 23 | #include "dss-common.h" |
@@ -26,6 +28,9 @@ struct pdata_init { | |||
26 | void (*fn)(void); | 28 | void (*fn)(void); |
27 | }; | 29 | }; |
28 | 30 | ||
31 | struct of_dev_auxdata omap_auxdata_lookup[]; | ||
32 | static struct twl4030_gpio_platform_data twl_gpio_auxdata; | ||
33 | |||
29 | /* | 34 | /* |
30 | * Create alias for USB host PHY clock. | 35 | * Create alias for USB host PHY clock. |
31 | * Remove this when clock phandle can be provided via DT | 36 | * Remove this when clock phandle can be provided via DT |
@@ -68,6 +73,15 @@ static inline void legacy_init_wl12xx(unsigned ref_clock, | |||
68 | } | 73 | } |
69 | #endif | 74 | #endif |
70 | 75 | ||
76 | #ifdef CONFIG_MACH_NOKIA_N8X0 | ||
77 | static void __init omap2420_n8x0_legacy_init(void) | ||
78 | { | ||
79 | omap_auxdata_lookup[0].platform_data = n8x0_legacy_init(); | ||
80 | } | ||
81 | #else | ||
82 | #define omap2420_n8x0_legacy_init NULL | ||
83 | #endif | ||
84 | |||
71 | #ifdef CONFIG_ARCH_OMAP3 | 85 | #ifdef CONFIG_ARCH_OMAP3 |
72 | static void __init hsmmc2_internal_input_clk(void) | 86 | static void __init hsmmc2_internal_input_clk(void) |
73 | { | 87 | { |
@@ -92,6 +106,42 @@ static void __init omap3_zoom_legacy_init(void) | |||
92 | { | 106 | { |
93 | legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162); | 107 | legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162); |
94 | } | 108 | } |
109 | |||
110 | static void am35xx_enable_emac_int(void) | ||
111 | { | ||
112 | u32 v; | ||
113 | |||
114 | v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
115 | v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR | | ||
116 | AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR); | ||
117 | omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
118 | omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */ | ||
119 | } | ||
120 | |||
121 | static void am35xx_disable_emac_int(void) | ||
122 | { | ||
123 | u32 v; | ||
124 | |||
125 | v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
126 | v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR); | ||
127 | omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
128 | omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */ | ||
129 | } | ||
130 | |||
131 | static struct emac_platform_data am35xx_emac_pdata = { | ||
132 | .interrupt_enable = am35xx_enable_emac_int, | ||
133 | .interrupt_disable = am35xx_disable_emac_int, | ||
134 | }; | ||
135 | |||
136 | static void __init am3517_evm_legacy_init(void) | ||
137 | { | ||
138 | u32 v; | ||
139 | |||
140 | v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); | ||
141 | v &= ~AM35XX_CPGMACSS_SW_RST; | ||
142 | omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET); | ||
143 | omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ | ||
144 | } | ||
95 | #endif /* CONFIG_ARCH_OMAP3 */ | 145 | #endif /* CONFIG_ARCH_OMAP3 */ |
96 | 146 | ||
97 | #ifdef CONFIG_ARCH_OMAP4 | 147 | #ifdef CONFIG_ARCH_OMAP4 |
@@ -125,10 +175,45 @@ void omap_pcs_legacy_init(int irq, void (*rearm)(void)) | |||
125 | pcs_pdata.rearm = rearm; | 175 | pcs_pdata.rearm = rearm; |
126 | } | 176 | } |
127 | 177 | ||
178 | /* | ||
179 | * GPIOs for TWL are initialized by the I2C bus and need custom | ||
180 | * handing until DSS has device tree bindings. | ||
181 | */ | ||
182 | void omap_auxdata_legacy_init(struct device *dev) | ||
183 | { | ||
184 | if (dev->platform_data) | ||
185 | return; | ||
186 | |||
187 | if (strcmp("twl4030-gpio", dev_name(dev))) | ||
188 | return; | ||
189 | |||
190 | dev->platform_data = &twl_gpio_auxdata; | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * Few boards still need auxdata populated before we populate | ||
195 | * the dev entries in of_platform_populate(). | ||
196 | */ | ||
197 | static struct pdata_init auxdata_quirks[] __initdata = { | ||
198 | #ifdef CONFIG_SOC_OMAP2420 | ||
199 | { "nokia,n800", omap2420_n8x0_legacy_init, }, | ||
200 | { "nokia,n810", omap2420_n8x0_legacy_init, }, | ||
201 | { "nokia,n810-wimax", omap2420_n8x0_legacy_init, }, | ||
202 | #endif | ||
203 | { /* sentinel */ }, | ||
204 | }; | ||
205 | |||
128 | struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | 206 | struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { |
207 | #ifdef CONFIG_MACH_NOKIA_N8X0 | ||
208 | OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL), | ||
209 | #endif | ||
129 | #ifdef CONFIG_ARCH_OMAP3 | 210 | #ifdef CONFIG_ARCH_OMAP3 |
130 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), | 211 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), |
131 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), | 212 | OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), |
213 | /* Only on am3517 */ | ||
214 | OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), | ||
215 | OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", | ||
216 | &am35xx_emac_pdata), | ||
132 | #endif | 217 | #endif |
133 | #ifdef CONFIG_ARCH_OMAP4 | 218 | #ifdef CONFIG_ARCH_OMAP4 |
134 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), | 219 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), |
@@ -137,13 +222,19 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | |||
137 | { /* sentinel */ }, | 222 | { /* sentinel */ }, |
138 | }; | 223 | }; |
139 | 224 | ||
225 | /* | ||
226 | * Few boards still need to initialize some legacy devices with | ||
227 | * platform data until the drivers support device tree. | ||
228 | */ | ||
140 | static struct pdata_init pdata_quirks[] __initdata = { | 229 | static struct pdata_init pdata_quirks[] __initdata = { |
141 | #ifdef CONFIG_ARCH_OMAP3 | 230 | #ifdef CONFIG_ARCH_OMAP3 |
231 | { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, | ||
142 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, | 232 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, |
143 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, | 233 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, |
144 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, | 234 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, |
145 | { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, | 235 | { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, |
146 | { "ti,omap3-zoom3", omap3_zoom_legacy_init, }, | 236 | { "ti,omap3-zoom3", omap3_zoom_legacy_init, }, |
237 | { "ti,am3517-evm", am3517_evm_legacy_init, }, | ||
147 | #endif | 238 | #endif |
148 | #ifdef CONFIG_ARCH_OMAP4 | 239 | #ifdef CONFIG_ARCH_OMAP4 |
149 | { "ti,omap4-sdp", omap4_sdp_legacy_init, }, | 240 | { "ti,omap4-sdp", omap4_sdp_legacy_init, }, |
@@ -155,14 +246,8 @@ static struct pdata_init pdata_quirks[] __initdata = { | |||
155 | { /* sentinel */ }, | 246 | { /* sentinel */ }, |
156 | }; | 247 | }; |
157 | 248 | ||
158 | void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) | 249 | static void pdata_quirks_check(struct pdata_init *quirks) |
159 | { | 250 | { |
160 | struct pdata_init *quirks = pdata_quirks; | ||
161 | |||
162 | omap_sdrc_init(NULL, NULL); | ||
163 | of_platform_populate(NULL, omap_dt_match_table, | ||
164 | omap_auxdata_lookup, NULL); | ||
165 | |||
166 | while (quirks->compatible) { | 251 | while (quirks->compatible) { |
167 | if (of_machine_is_compatible(quirks->compatible)) { | 252 | if (of_machine_is_compatible(quirks->compatible)) { |
168 | if (quirks->fn) | 253 | if (quirks->fn) |
@@ -172,3 +257,12 @@ void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) | |||
172 | quirks++; | 257 | quirks++; |
173 | } | 258 | } |
174 | } | 259 | } |
260 | |||
261 | void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) | ||
262 | { | ||
263 | omap_sdrc_init(NULL, NULL); | ||
264 | pdata_quirks_check(auxdata_quirks); | ||
265 | of_platform_populate(NULL, omap_dt_match_table, | ||
266 | omap_auxdata_lookup, NULL); | ||
267 | pdata_quirks_check(pdata_quirks); | ||
268 | } | ||