xref: /linux/arch/arm/mach-omap2/pdata-quirks.c (revision d565b5f4e50bfbb93408afb0502176021759bcd2)
16a08e1e6STony Lindgren /*
26a08e1e6STony Lindgren  * Legacy platform_data quirks
36a08e1e6STony Lindgren  *
46a08e1e6STony Lindgren  * Copyright (C) 2013 Texas Instruments
56a08e1e6STony Lindgren  *
66a08e1e6STony Lindgren  * This program is free software; you can redistribute it and/or modify
76a08e1e6STony Lindgren  * it under the terms of the GNU General Public License version 2 as
86a08e1e6STony Lindgren  * published by the Free Software Foundation.
96a08e1e6STony Lindgren  */
106a08e1e6STony Lindgren #include <linux/clk.h>
1171900314STony Lindgren #include <linux/davinci_emac.h>
125f0a2c69STony Lindgren #include <linux/gpio.h>
136a08e1e6STony Lindgren #include <linux/init.h>
146a08e1e6STony Lindgren #include <linux/kernel.h>
158651bd8cSTony Lindgren #include <linux/of_platform.h>
16*d565b5f4SEnric Balletbo i Serra #include <linux/ti_wilink_st.h>
175f0a2c69STony Lindgren #include <linux/wl12xx.h>
186a08e1e6STony Lindgren 
1930a69ef7STony Lindgren #include <linux/platform_data/pinctrl-single.h>
20910f1678SSuman Anna #include <linux/platform_data/iommu-omap.h>
2130a69ef7STony Lindgren 
2271900314STony Lindgren #include "am35xx.h"
236a08e1e6STony Lindgren #include "common.h"
246a08e1e6STony Lindgren #include "common-board-devices.h"
256a08e1e6STony Lindgren #include "dss-common.h"
26faf4bd47SAaro Koskinen #include "control.h"
27910f1678SSuman Anna #include "omap_device.h"
28deff82e6SSebastian Reichel #include "omap-secure.h"
29deff82e6SSebastian Reichel #include "soc.h"
306a08e1e6STony Lindgren 
316a08e1e6STony Lindgren struct pdata_init {
326a08e1e6STony Lindgren 	const char *compatible;
336a08e1e6STony Lindgren 	void (*fn)(void);
346a08e1e6STony Lindgren };
356a08e1e6STony Lindgren 
36fa590c92STony Lindgren struct of_dev_auxdata omap_auxdata_lookup[];
37dad12d11STony Lindgren static struct twl4030_gpio_platform_data twl_gpio_auxdata;
38fa590c92STony Lindgren 
395f0a2c69STony Lindgren #if IS_ENABLED(CONFIG_WL12XX)
405f0a2c69STony Lindgren 
415f0a2c69STony Lindgren static struct wl12xx_platform_data wl12xx __initdata;
425f0a2c69STony Lindgren 
435f0a2c69STony Lindgren static void __init __used legacy_init_wl12xx(unsigned ref_clock,
445f0a2c69STony Lindgren 					     unsigned tcxo_clock,
455f0a2c69STony Lindgren 					     int gpio)
465f0a2c69STony Lindgren {
475f0a2c69STony Lindgren 	int res;
485f0a2c69STony Lindgren 
495f0a2c69STony Lindgren 	wl12xx.board_ref_clock = ref_clock;
505f0a2c69STony Lindgren 	wl12xx.board_tcxo_clock = tcxo_clock;
515f0a2c69STony Lindgren 	wl12xx.irq = gpio_to_irq(gpio);
525f0a2c69STony Lindgren 
535f0a2c69STony Lindgren 	res = wl12xx_set_platform_data(&wl12xx);
545f0a2c69STony Lindgren 	if (res) {
555f0a2c69STony Lindgren 		pr_err("error setting wl12xx data: %d\n", res);
565f0a2c69STony Lindgren 		return;
575f0a2c69STony Lindgren 	}
585f0a2c69STony Lindgren }
595f0a2c69STony Lindgren #else
605f0a2c69STony Lindgren static inline void legacy_init_wl12xx(unsigned ref_clock,
615f0a2c69STony Lindgren 				      unsigned tcxo_clock,
625f0a2c69STony Lindgren 				      int gpio)
635f0a2c69STony Lindgren {
645f0a2c69STony Lindgren }
655f0a2c69STony Lindgren #endif
665f0a2c69STony Lindgren 
67fa590c92STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
68fa590c92STony Lindgren static void __init omap2420_n8x0_legacy_init(void)
69fa590c92STony Lindgren {
70fa590c92STony Lindgren 	omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
71fa590c92STony Lindgren }
72fa590c92STony Lindgren #else
73fa590c92STony Lindgren #define omap2420_n8x0_legacy_init	NULL
74fa590c92STony Lindgren #endif
75fa590c92STony Lindgren 
76faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
77faf4bd47SAaro Koskinen static void __init hsmmc2_internal_input_clk(void)
78faf4bd47SAaro Koskinen {
79faf4bd47SAaro Koskinen 	u32 reg;
80faf4bd47SAaro Koskinen 
81faf4bd47SAaro Koskinen 	reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
82faf4bd47SAaro Koskinen 	reg |= OMAP2_MMCSDIO2ADPCLKISEL;
83faf4bd47SAaro Koskinen 	omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
84faf4bd47SAaro Koskinen }
8515c9887eSJavier Martinez Canillas 
86910f1678SSuman Anna static struct iommu_platform_data omap3_iommu_pdata = {
87910f1678SSuman Anna 	.reset_name = "mmu",
88910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
89910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
90910f1678SSuman Anna };
91910f1678SSuman Anna 
920f0cfc69STony Lindgren static int omap3_sbc_t3730_twl_callback(struct device *dev,
930f0cfc69STony Lindgren 					   unsigned gpio,
940f0cfc69STony Lindgren 					   unsigned ngpio)
950f0cfc69STony Lindgren {
960f0cfc69STony Lindgren 	int res;
970f0cfc69STony Lindgren 
980f0cfc69STony Lindgren 	res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
99d234e423SDmitry Lifshitz 			       "wlan pwr");
1000f0cfc69STony Lindgren 	if (res)
1010f0cfc69STony Lindgren 		return res;
1020f0cfc69STony Lindgren 
1030f0cfc69STony Lindgren 	gpio_export(gpio, 0);
1040f0cfc69STony Lindgren 
1050f0cfc69STony Lindgren 	return 0;
1060f0cfc69STony Lindgren }
1070f0cfc69STony Lindgren 
108b62d91e5SDmitry Lifshitz static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
109b62d91e5SDmitry Lifshitz {
110b62d91e5SDmitry Lifshitz 	int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
111b62d91e5SDmitry Lifshitz 
112b62d91e5SDmitry Lifshitz 	if (err) {
113b62d91e5SDmitry Lifshitz 		pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
114b62d91e5SDmitry Lifshitz 			hub_name, err);
115b62d91e5SDmitry Lifshitz 		return;
116b62d91e5SDmitry Lifshitz 	}
117b62d91e5SDmitry Lifshitz 
118b62d91e5SDmitry Lifshitz 	gpio_export(gpio, 0);
119b62d91e5SDmitry Lifshitz 
120b62d91e5SDmitry Lifshitz 	udelay(10);
121b62d91e5SDmitry Lifshitz 	gpio_set_value(gpio, 1);
122b62d91e5SDmitry Lifshitz 	msleep(1);
123b62d91e5SDmitry Lifshitz }
124b62d91e5SDmitry Lifshitz 
1250f0cfc69STony Lindgren static void __init omap3_sbc_t3730_twl_init(void)
1260f0cfc69STony Lindgren {
1270f0cfc69STony Lindgren 	twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
1280f0cfc69STony Lindgren }
1290f0cfc69STony Lindgren 
1300f0cfc69STony Lindgren static void __init omap3_sbc_t3730_legacy_init(void)
1310f0cfc69STony Lindgren {
132b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
1330f0cfc69STony Lindgren 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
1340f0cfc69STony Lindgren 	omap_ads7846_init(1, 57, 0, NULL);
1350f0cfc69STony Lindgren }
1360f0cfc69STony Lindgren 
13740ecc02eSDmitry Lifshitz static void __init omap3_sbc_t3530_legacy_init(void)
13840ecc02eSDmitry Lifshitz {
139b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
14040ecc02eSDmitry Lifshitz 	omap_ads7846_init(1, 57, 0, NULL);
14140ecc02eSDmitry Lifshitz }
14240ecc02eSDmitry Lifshitz 
143*d565b5f4SEnric Balletbo i Serra struct ti_st_plat_data wilink_pdata = {
144*d565b5f4SEnric Balletbo i Serra 	.nshutdown_gpio = 137,
145*d565b5f4SEnric Balletbo i Serra 	.dev_name = "/dev/ttyO1",
146*d565b5f4SEnric Balletbo i Serra 	.flow_cntrl = 1,
147*d565b5f4SEnric Balletbo i Serra 	.baud_rate = 300000,
148*d565b5f4SEnric Balletbo i Serra };
149*d565b5f4SEnric Balletbo i Serra 
150*d565b5f4SEnric Balletbo i Serra static struct platform_device wl18xx_device = {
151*d565b5f4SEnric Balletbo i Serra 	.name	= "kim",
152*d565b5f4SEnric Balletbo i Serra 	.id	= -1,
153*d565b5f4SEnric Balletbo i Serra 	.dev	= {
154*d565b5f4SEnric Balletbo i Serra 		.platform_data = &wilink_pdata,
155*d565b5f4SEnric Balletbo i Serra 	}
156*d565b5f4SEnric Balletbo i Serra };
157*d565b5f4SEnric Balletbo i Serra 
158*d565b5f4SEnric Balletbo i Serra static struct platform_device btwilink_device = {
159*d565b5f4SEnric Balletbo i Serra 	.name	= "btwilink",
160*d565b5f4SEnric Balletbo i Serra 	.id	= -1,
161*d565b5f4SEnric Balletbo i Serra };
162*d565b5f4SEnric Balletbo i Serra 
163*d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0020_rev_f_legacy_init(void)
16415c9887eSJavier Martinez Canillas {
165*d565b5f4SEnric Balletbo i Serra 	legacy_init_wl12xx(0, 0, 177);
166*d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
167*d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
168*d565b5f4SEnric Balletbo i Serra }
169*d565b5f4SEnric Balletbo i Serra 
170*d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0030_rev_g_legacy_init(void)
171*d565b5f4SEnric Balletbo i Serra {
172*d565b5f4SEnric Balletbo i Serra 	legacy_init_wl12xx(0, 0, 136);
173*d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
174*d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
17515c9887eSJavier Martinez Canillas }
17679b39f79STony Lindgren 
17779b39f79STony Lindgren static void __init omap3_evm_legacy_init(void)
17879b39f79STony Lindgren {
17979b39f79STony Lindgren 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 149);
18079b39f79STony Lindgren }
18179b39f79STony Lindgren 
18279b39f79STony Lindgren static void __init omap3_zoom_legacy_init(void)
18379b39f79STony Lindgren {
18479b39f79STony Lindgren 	legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
18579b39f79STony Lindgren }
18671900314STony Lindgren 
18771900314STony Lindgren static void am35xx_enable_emac_int(void)
18871900314STony Lindgren {
18971900314STony Lindgren 	u32 v;
19071900314STony Lindgren 
19171900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
19271900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
19371900314STony Lindgren 	      AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
19471900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
19571900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
19671900314STony Lindgren }
19771900314STony Lindgren 
19871900314STony Lindgren static void am35xx_disable_emac_int(void)
19971900314STony Lindgren {
20071900314STony Lindgren 	u32 v;
20171900314STony Lindgren 
20271900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
20371900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
20471900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
20571900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
20671900314STony Lindgren }
20771900314STony Lindgren 
20871900314STony Lindgren static struct emac_platform_data am35xx_emac_pdata = {
20971900314STony Lindgren 	.interrupt_enable	= am35xx_enable_emac_int,
21071900314STony Lindgren 	.interrupt_disable	= am35xx_disable_emac_int,
21171900314STony Lindgren };
21271900314STony Lindgren 
213fb45105aSDmitry Lifshitz static void __init am35xx_emac_reset(void)
21471900314STony Lindgren {
21571900314STony Lindgren 	u32 v;
21671900314STony Lindgren 
21771900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
21871900314STony Lindgren 	v &= ~AM35XX_CPGMACSS_SW_RST;
21971900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
22071900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
22171900314STony Lindgren }
222deff82e6SSebastian Reichel 
223fb45105aSDmitry Lifshitz static struct gpio cm_t3517_wlan_gpios[] __initdata = {
224fb45105aSDmitry Lifshitz 	{ 56,	GPIOF_OUT_INIT_HIGH,	"wlan pwr" },
225fb45105aSDmitry Lifshitz 	{ 4,	GPIOF_OUT_INIT_HIGH,	"xcvr noe" },
226fb45105aSDmitry Lifshitz };
227fb45105aSDmitry Lifshitz 
228fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_wifi_init(void)
229fb45105aSDmitry Lifshitz {
230fb45105aSDmitry Lifshitz 	int err = gpio_request_array(cm_t3517_wlan_gpios,
231fb45105aSDmitry Lifshitz 				ARRAY_SIZE(cm_t3517_wlan_gpios));
232fb45105aSDmitry Lifshitz 	if (err) {
233fb45105aSDmitry Lifshitz 		pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
234fb45105aSDmitry Lifshitz 		return;
235fb45105aSDmitry Lifshitz 	}
236fb45105aSDmitry Lifshitz 
237fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[0].gpio, 0);
238fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[1].gpio, 0);
239fb45105aSDmitry Lifshitz 
240fb45105aSDmitry Lifshitz 	msleep(100);
241fb45105aSDmitry Lifshitz 	gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
242fb45105aSDmitry Lifshitz }
243fb45105aSDmitry Lifshitz 
244fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_legacy_init(void)
245fb45105aSDmitry Lifshitz {
246b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
247b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
248fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
249fb45105aSDmitry Lifshitz 	hsmmc2_internal_input_clk();
250fb45105aSDmitry Lifshitz 	omap3_sbc_t3517_wifi_init();
251fb45105aSDmitry Lifshitz 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 145);
252fb45105aSDmitry Lifshitz 	omap_ads7846_init(1, 57, 0, NULL);
253fb45105aSDmitry Lifshitz }
254fb45105aSDmitry Lifshitz 
255fb45105aSDmitry Lifshitz static void __init am3517_evm_legacy_init(void)
256fb45105aSDmitry Lifshitz {
257fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
258fb45105aSDmitry Lifshitz }
259f83ccb93SLinus Torvalds 
26014c0a5b4SSebastian Reichel static struct platform_device omap3_rom_rng_device = {
26114c0a5b4SSebastian Reichel 	.name		= "omap3-rom-rng",
26214c0a5b4SSebastian Reichel 	.id		= -1,
26314c0a5b4SSebastian Reichel 	.dev	= {
26414c0a5b4SSebastian Reichel 		.platform_data	= rx51_secure_rng_call,
26514c0a5b4SSebastian Reichel 	},
26614c0a5b4SSebastian Reichel };
26714c0a5b4SSebastian Reichel 
268deff82e6SSebastian Reichel static void __init nokia_n900_legacy_init(void)
269deff82e6SSebastian Reichel {
270deff82e6SSebastian Reichel 	hsmmc2_internal_input_clk();
271deff82e6SSebastian Reichel 
272deff82e6SSebastian Reichel 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
273deff82e6SSebastian Reichel 		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
274deff82e6SSebastian Reichel 			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
275deff82e6SSebastian Reichel 			/* set IBE to 1 */
276deff82e6SSebastian Reichel 			rx51_secure_update_aux_cr(BIT(6), 0);
277deff82e6SSebastian Reichel 		} else {
2783d0cb73eSJoe Perches 			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
2793d0cb73eSJoe Perches 			pr_warn("Thumb binaries may crash randomly without this workaround\n");
280deff82e6SSebastian Reichel 		}
28114c0a5b4SSebastian Reichel 
28214c0a5b4SSebastian Reichel 		pr_info("RX-51: Registring OMAP3 HWRNG device\n");
28314c0a5b4SSebastian Reichel 		platform_device_register(&omap3_rom_rng_device);
28414c0a5b4SSebastian Reichel 
285deff82e6SSebastian Reichel 	}
286271d4c6bSTony Lindgren 
287271d4c6bSTony Lindgren 	/* Only on some development boards */
288271d4c6bSTony Lindgren 	gpio_request_one(164, GPIOF_OUT_INIT_LOW, "smc91x reset");
289deff82e6SSebastian Reichel }
29063dd5bc0SStefan Roese 
29163dd5bc0SStefan Roese static void __init omap3_tao3530_legacy_init(void)
29263dd5bc0SStefan Roese {
29363dd5bc0SStefan Roese 	hsmmc2_internal_input_clk();
294faf4bd47SAaro Koskinen }
295faf4bd47SAaro Koskinen #endif /* CONFIG_ARCH_OMAP3 */
296faf4bd47SAaro Koskinen 
2973e7a3185STony Lindgren #ifdef CONFIG_ARCH_OMAP4
2983e7a3185STony Lindgren static void __init omap4_sdp_legacy_init(void)
2993e7a3185STony Lindgren {
3005f0a2c69STony Lindgren 	legacy_init_wl12xx(WL12XX_REFCLOCK_26,
3015f0a2c69STony Lindgren 			   WL12XX_TCXOCLOCK_26, 53);
3023e7a3185STony Lindgren }
3033e7a3185STony Lindgren 
3043e7a3185STony Lindgren static void __init omap4_panda_legacy_init(void)
3053e7a3185STony Lindgren {
3065f0a2c69STony Lindgren 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
3073e7a3185STony Lindgren }
30895eb894eSJoachim Eastwood 
30995eb894eSJoachim Eastwood static void __init var_som_om44_legacy_init(void)
31095eb894eSJoachim Eastwood {
31195eb894eSJoachim Eastwood 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 41);
31295eb894eSJoachim Eastwood }
3133e7a3185STony Lindgren #endif
3143e7a3185STony Lindgren 
31567eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
316910f1678SSuman Anna static struct iommu_platform_data omap4_iommu_pdata = {
317910f1678SSuman Anna 	.reset_name = "mmu_cache",
318910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
319910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
320910f1678SSuman Anna };
3213e7a3185STony Lindgren #endif
3223e7a3185STony Lindgren 
32390f4f01bSImre Kaloz #ifdef CONFIG_SOC_AM33XX
32490f4f01bSImre Kaloz static void __init am335x_evmsk_legacy_init(void)
32590f4f01bSImre Kaloz {
32690f4f01bSImre Kaloz 	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 31);
32790f4f01bSImre Kaloz }
32890f4f01bSImre Kaloz #endif
32990f4f01bSImre Kaloz 
3303e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
3313e7a3185STony Lindgren static void __init omap5_uevm_legacy_init(void)
3323e7a3185STony Lindgren {
3333e7a3185STony Lindgren }
3343e7a3185STony Lindgren #endif
3353e7a3185STony Lindgren 
33630a69ef7STony Lindgren static struct pcs_pdata pcs_pdata;
33730a69ef7STony Lindgren 
33830a69ef7STony Lindgren void omap_pcs_legacy_init(int irq, void (*rearm)(void))
33930a69ef7STony Lindgren {
34030a69ef7STony Lindgren 	pcs_pdata.irq = irq;
34130a69ef7STony Lindgren 	pcs_pdata.rearm = rearm;
34230a69ef7STony Lindgren }
34330a69ef7STony Lindgren 
344036582f7STony Lindgren /*
345dad12d11STony Lindgren  * GPIOs for TWL are initialized by the I2C bus and need custom
346dad12d11STony Lindgren  * handing until DSS has device tree bindings.
347dad12d11STony Lindgren  */
348dad12d11STony Lindgren void omap_auxdata_legacy_init(struct device *dev)
349dad12d11STony Lindgren {
350dad12d11STony Lindgren 	if (dev->platform_data)
351dad12d11STony Lindgren 		return;
352dad12d11STony Lindgren 
353dad12d11STony Lindgren 	if (strcmp("twl4030-gpio", dev_name(dev)))
354dad12d11STony Lindgren 		return;
355dad12d11STony Lindgren 
356dad12d11STony Lindgren 	dev->platform_data = &twl_gpio_auxdata;
357dad12d11STony Lindgren }
358dad12d11STony Lindgren 
359dad12d11STony Lindgren /*
360036582f7STony Lindgren  * Few boards still need auxdata populated before we populate
361036582f7STony Lindgren  * the dev entries in of_platform_populate().
362036582f7STony Lindgren  */
363036582f7STony Lindgren static struct pdata_init auxdata_quirks[] __initdata = {
364fa590c92STony Lindgren #ifdef CONFIG_SOC_OMAP2420
365fa590c92STony Lindgren 	{ "nokia,n800", omap2420_n8x0_legacy_init, },
366fa590c92STony Lindgren 	{ "nokia,n810", omap2420_n8x0_legacy_init, },
367fa590c92STony Lindgren 	{ "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
368fa590c92STony Lindgren #endif
3690f0cfc69STony Lindgren #ifdef CONFIG_ARCH_OMAP3
3700f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
3710f0cfc69STony Lindgren #endif
372036582f7STony Lindgren 	{ /* sentinel */ },
373036582f7STony Lindgren };
374036582f7STony Lindgren 
3758651bd8cSTony Lindgren struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
376036582f7STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
377036582f7STony Lindgren 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
378e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
379e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
380036582f7STony Lindgren #endif
38130a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP3
38230a69ef7STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
3834b416368STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-padconf", 0x480025a0, "480025a0.pinmux", &pcs_pdata),
38430a69ef7STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
385910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
386910f1678SSuman Anna 		       &omap3_iommu_pdata),
38771900314STony Lindgren 	/* Only on am3517 */
38871900314STony Lindgren 	OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
38971900314STony Lindgren 	OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
39071900314STony Lindgren 		       &am35xx_emac_pdata),
39130a69ef7STony Lindgren #endif
39230a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP4
39330a69ef7STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
39430a69ef7STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
39530a69ef7STony Lindgren #endif
396874fef7dSNishanth Menon #ifdef CONFIG_SOC_OMAP5
397874fef7dSNishanth Menon 	OF_DEV_AUXDATA("ti,omap5-padconf", 0x4a002840, "4a002840.pinmux", &pcs_pdata),
398874fef7dSNishanth Menon 	OF_DEV_AUXDATA("ti,omap5-padconf", 0x4ae0c840, "4ae0c840.pinmux", &pcs_pdata),
399874fef7dSNishanth Menon #endif
400b0a3d0daSNishanth Menon #ifdef CONFIG_SOC_DRA7XX
401b0a3d0daSNishanth Menon 	OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata),
402b0a3d0daSNishanth Menon #endif
403dbbe9770SKeerthy #ifdef CONFIG_SOC_AM43XX
404dbbe9770SKeerthy 	OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
405dbbe9770SKeerthy #endif
40667eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
407910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
408910f1678SSuman Anna 		       &omap4_iommu_pdata),
409910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
410910f1678SSuman Anna 		       &omap4_iommu_pdata),
4116a08e1e6STony Lindgren #endif
4126a08e1e6STony Lindgren 	{ /* sentinel */ },
4138651bd8cSTony Lindgren };
4146a08e1e6STony Lindgren 
415036582f7STony Lindgren /*
416036582f7STony Lindgren  * Few boards still need to initialize some legacy devices with
417036582f7STony Lindgren  * platform data until the drivers support device tree.
418036582f7STony Lindgren  */
4196a08e1e6STony Lindgren static struct pdata_init pdata_quirks[] __initdata = {
4206a08e1e6STony Lindgren #ifdef CONFIG_ARCH_OMAP3
421fb45105aSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, },
42240ecc02eSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, },
4230f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
424deff82e6SSebastian Reichel 	{ "nokia,omap3-n900", nokia_n900_legacy_init, },
4256a08e1e6STony Lindgren 	{ "nokia,omap3-n9", hsmmc2_internal_input_clk, },
4266a08e1e6STony Lindgren 	{ "nokia,omap3-n950", hsmmc2_internal_input_clk, },
427*d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
428*d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
42979b39f79STony Lindgren 	{ "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
43079b39f79STony Lindgren 	{ "ti,omap3-zoom3", omap3_zoom_legacy_init, },
43171900314STony Lindgren 	{ "ti,am3517-evm", am3517_evm_legacy_init, },
43263dd5bc0SStefan Roese 	{ "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
4336a08e1e6STony Lindgren #endif
4346a08e1e6STony Lindgren #ifdef CONFIG_ARCH_OMAP4
4356a08e1e6STony Lindgren 	{ "ti,omap4-sdp", omap4_sdp_legacy_init, },
4366a08e1e6STony Lindgren 	{ "ti,omap4-panda", omap4_panda_legacy_init, },
43795eb894eSJoachim Eastwood 	{ "variscite,var-dvk-om44", var_som_om44_legacy_init, },
43895eb894eSJoachim Eastwood 	{ "variscite,var-stk-om44", var_som_om44_legacy_init, },
4396a08e1e6STony Lindgren #endif
44090f4f01bSImre Kaloz #ifdef CONFIG_SOC_AM33XX
44190f4f01bSImre Kaloz 	{ "ti,am335x-evmsk", am335x_evmsk_legacy_init, },
44290f4f01bSImre Kaloz #endif
4436a08e1e6STony Lindgren #ifdef CONFIG_SOC_OMAP5
4446a08e1e6STony Lindgren 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
4456a08e1e6STony Lindgren #endif
4466a08e1e6STony Lindgren 	{ /* sentinel */ },
4476a08e1e6STony Lindgren };
4486a08e1e6STony Lindgren 
449036582f7STony Lindgren static void pdata_quirks_check(struct pdata_init *quirks)
4506a08e1e6STony Lindgren {
4516a08e1e6STony Lindgren 	while (quirks->compatible) {
4526a08e1e6STony Lindgren 		if (of_machine_is_compatible(quirks->compatible)) {
4536a08e1e6STony Lindgren 			if (quirks->fn)
4546a08e1e6STony Lindgren 				quirks->fn();
4556a08e1e6STony Lindgren 			break;
4566a08e1e6STony Lindgren 		}
4576a08e1e6STony Lindgren 		quirks++;
4586a08e1e6STony Lindgren 	}
4596a08e1e6STony Lindgren }
460036582f7STony Lindgren 
46131957609SUwe Kleine-König void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
462036582f7STony Lindgren {
463036582f7STony Lindgren 	omap_sdrc_init(NULL, NULL);
464036582f7STony Lindgren 	pdata_quirks_check(auxdata_quirks);
465036582f7STony Lindgren 	of_platform_populate(NULL, omap_dt_match_table,
466036582f7STony Lindgren 			     omap_auxdata_lookup, NULL);
467036582f7STony Lindgren 	pdata_quirks_check(pdata_quirks);
468036582f7STony Lindgren }
469