xref: /linux/arch/arm/mach-omap2/pdata-quirks.c (revision 19feeee5c5af114f3cb8ad2772680b7a1d16f043)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
26a08e1e6STony Lindgren /*
36a08e1e6STony Lindgren  * Legacy platform_data quirks
46a08e1e6STony Lindgren  *
56a08e1e6STony Lindgren  * Copyright (C) 2013 Texas Instruments
66a08e1e6STony Lindgren  */
76a08e1e6STony Lindgren #include <linux/clk.h>
871900314STony Lindgren #include <linux/davinci_emac.h>
95f0a2c69STony Lindgren #include <linux/gpio.h>
10efdfeb07SLinus Walleij #include <linux/gpio/machine.h>
116a08e1e6STony Lindgren #include <linux/init.h>
126a08e1e6STony Lindgren #include <linux/kernel.h>
138651bd8cSTony Lindgren #include <linux/of_platform.h>
14d565b5f4SEnric Balletbo i Serra #include <linux/ti_wilink_st.h>
15f9d50fefSGrazvydas Ignotas #include <linux/wl12xx.h>
16f9d50fefSGrazvydas Ignotas #include <linux/mmc/card.h>
17f9d50fefSGrazvydas Ignotas #include <linux/mmc/host.h>
18d060b405STony Lindgren #include <linux/power/smartreflex.h>
19f9d50fefSGrazvydas Ignotas #include <linux/regulator/machine.h>
20f9d50fefSGrazvydas Ignotas #include <linux/regulator/fixed.h>
216a08e1e6STony Lindgren 
2230a69ef7STony Lindgren #include <linux/platform_data/pinctrl-single.h>
2310c1f7d3STony Lindgren #include <linux/platform_data/hsmmc-omap.h>
24910f1678SSuman Anna #include <linux/platform_data/iommu-omap.h>
25ef70b0bdSTony Lindgren #include <linux/platform_data/ti-sysc.h>
266da74c54SDave Gerlach #include <linux/platform_data/wkup_m3.h>
27c26c84c9SPeter Ujfalusi #include <linux/platform_data/asoc-ti-mcbsp.h>
2830a69ef7STony Lindgren 
292b2f7defSTony Lindgren #include "clockdomain.h"
306a08e1e6STony Lindgren #include "common.h"
316a08e1e6STony Lindgren #include "common-board-devices.h"
32faf4bd47SAaro Koskinen #include "control.h"
33910f1678SSuman Anna #include "omap_device.h"
34deff82e6SSebastian Reichel #include "omap-secure.h"
35deff82e6SSebastian Reichel #include "soc.h"
36f9d50fefSGrazvydas Ignotas #include "hsmmc.h"
376a08e1e6STony Lindgren 
3810c1f7d3STony Lindgren static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
3910c1f7d3STony Lindgren 
406a08e1e6STony Lindgren struct pdata_init {
416a08e1e6STony Lindgren 	const char *compatible;
426a08e1e6STony Lindgren 	void (*fn)(void);
436a08e1e6STony Lindgren };
446a08e1e6STony Lindgren 
45f734a9b3SSekhar Nori static struct of_dev_auxdata omap_auxdata_lookup[];
46dad12d11STony Lindgren static struct twl4030_gpio_platform_data twl_gpio_auxdata;
47fa590c92STony Lindgren 
48fa590c92STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
49fa590c92STony Lindgren static void __init omap2420_n8x0_legacy_init(void)
50fa590c92STony Lindgren {
51fa590c92STony Lindgren 	omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
52fa590c92STony Lindgren }
53fa590c92STony Lindgren #else
54fa590c92STony Lindgren #define omap2420_n8x0_legacy_init	NULL
55fa590c92STony Lindgren #endif
56fa590c92STony Lindgren 
57faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
58b96b332fSTony Lindgren /*
59b96b332fSTony Lindgren  * Configures GPIOs 126, 127 and 129 to 1.8V mode instead of 3.0V
60b96b332fSTony Lindgren  * mode for MMC1 in case bootloader did not configure things.
61b96b332fSTony Lindgren  * Note that if the pins are used for MMC1, pbias-regulator
62b96b332fSTony Lindgren  * manages the IO voltage.
63b96b332fSTony Lindgren  */
64b96b332fSTony Lindgren static void __init omap3_gpio126_127_129(void)
65b96b332fSTony Lindgren {
66b96b332fSTony Lindgren 	u32 reg;
67b96b332fSTony Lindgren 
68b96b332fSTony Lindgren 	reg = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
69b96b332fSTony Lindgren 	reg &= ~OMAP343X_PBIASLITEVMODE1;
70b96b332fSTony Lindgren 	reg |= OMAP343X_PBIASLITEPWRDNZ1;
71b96b332fSTony Lindgren 	omap_ctrl_writel(reg, OMAP343X_CONTROL_PBIAS_LITE);
72b96b332fSTony Lindgren 	if (cpu_is_omap3630()) {
73b96b332fSTony Lindgren 		reg = omap_ctrl_readl(OMAP34XX_CONTROL_WKUP_CTRL);
74b96b332fSTony Lindgren 		reg |= OMAP36XX_GPIO_IO_PWRDNZ;
75b96b332fSTony Lindgren 		omap_ctrl_writel(reg, OMAP34XX_CONTROL_WKUP_CTRL);
76b96b332fSTony Lindgren 	}
77b96b332fSTony Lindgren }
78b96b332fSTony Lindgren 
79faf4bd47SAaro Koskinen static void __init hsmmc2_internal_input_clk(void)
80faf4bd47SAaro Koskinen {
81faf4bd47SAaro Koskinen 	u32 reg;
82faf4bd47SAaro Koskinen 
83faf4bd47SAaro Koskinen 	reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
84faf4bd47SAaro Koskinen 	reg |= OMAP2_MMCSDIO2ADPCLKISEL;
85faf4bd47SAaro Koskinen 	omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
86faf4bd47SAaro Koskinen }
8715c9887eSJavier Martinez Canillas 
88910f1678SSuman Anna static struct iommu_platform_data omap3_iommu_pdata = {
89910f1678SSuman Anna 	.reset_name = "mmu",
90910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
91910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
92*19feeee5SSuman Anna 	.device_enable = omap_device_enable,
93*19feeee5SSuman Anna 	.device_idle = omap_device_idle,
94910f1678SSuman Anna };
95910f1678SSuman Anna 
960f0cfc69STony Lindgren static int omap3_sbc_t3730_twl_callback(struct device *dev,
970f0cfc69STony Lindgren 					   unsigned gpio,
980f0cfc69STony Lindgren 					   unsigned ngpio)
990f0cfc69STony Lindgren {
1000f0cfc69STony Lindgren 	int res;
1010f0cfc69STony Lindgren 
1020f0cfc69STony Lindgren 	res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
103d234e423SDmitry Lifshitz 			       "wlan pwr");
1040f0cfc69STony Lindgren 	if (res)
1050f0cfc69STony Lindgren 		return res;
1060f0cfc69STony Lindgren 
1070f0cfc69STony Lindgren 	gpio_export(gpio, 0);
1080f0cfc69STony Lindgren 
1090f0cfc69STony Lindgren 	return 0;
1100f0cfc69STony Lindgren }
1110f0cfc69STony Lindgren 
112b62d91e5SDmitry Lifshitz static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
113b62d91e5SDmitry Lifshitz {
114b62d91e5SDmitry Lifshitz 	int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
115b62d91e5SDmitry Lifshitz 
116b62d91e5SDmitry Lifshitz 	if (err) {
117b62d91e5SDmitry Lifshitz 		pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
118b62d91e5SDmitry Lifshitz 			hub_name, err);
119b62d91e5SDmitry Lifshitz 		return;
120b62d91e5SDmitry Lifshitz 	}
121b62d91e5SDmitry Lifshitz 
122b62d91e5SDmitry Lifshitz 	gpio_export(gpio, 0);
123b62d91e5SDmitry Lifshitz 
124b62d91e5SDmitry Lifshitz 	udelay(10);
125b62d91e5SDmitry Lifshitz 	gpio_set_value(gpio, 1);
126b62d91e5SDmitry Lifshitz 	msleep(1);
127b62d91e5SDmitry Lifshitz }
128b62d91e5SDmitry Lifshitz 
1290f0cfc69STony Lindgren static void __init omap3_sbc_t3730_twl_init(void)
1300f0cfc69STony Lindgren {
1310f0cfc69STony Lindgren 	twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
1320f0cfc69STony Lindgren }
1330f0cfc69STony Lindgren 
1340f0cfc69STony Lindgren static void __init omap3_sbc_t3730_legacy_init(void)
1350f0cfc69STony Lindgren {
136b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
1370f0cfc69STony Lindgren }
1380f0cfc69STony Lindgren 
13940ecc02eSDmitry Lifshitz static void __init omap3_sbc_t3530_legacy_init(void)
14040ecc02eSDmitry Lifshitz {
141b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
14240ecc02eSDmitry Lifshitz }
14340ecc02eSDmitry Lifshitz 
144f734a9b3SSekhar Nori static struct ti_st_plat_data wilink_pdata = {
145d565b5f4SEnric Balletbo i Serra 	.nshutdown_gpio = 137,
146d565b5f4SEnric Balletbo i Serra 	.dev_name = "/dev/ttyO1",
147d565b5f4SEnric Balletbo i Serra 	.flow_cntrl = 1,
148d565b5f4SEnric Balletbo i Serra 	.baud_rate = 300000,
149d565b5f4SEnric Balletbo i Serra };
150d565b5f4SEnric Balletbo i Serra 
151d565b5f4SEnric Balletbo i Serra static struct platform_device wl18xx_device = {
152d565b5f4SEnric Balletbo i Serra 	.name	= "kim",
153d565b5f4SEnric Balletbo i Serra 	.id	= -1,
154d565b5f4SEnric Balletbo i Serra 	.dev	= {
155d565b5f4SEnric Balletbo i Serra 		.platform_data = &wilink_pdata,
156d565b5f4SEnric Balletbo i Serra 	}
157d565b5f4SEnric Balletbo i Serra };
158d565b5f4SEnric Balletbo i Serra 
159485fa126SAdam Ford static struct ti_st_plat_data wilink7_pdata = {
160485fa126SAdam Ford 	.nshutdown_gpio = 162,
161485fa126SAdam Ford 	.dev_name = "/dev/ttyO1",
162485fa126SAdam Ford 	.flow_cntrl = 1,
163a3ac3507SAdam Ford 	.baud_rate = 3000000,
164485fa126SAdam Ford };
165485fa126SAdam Ford 
166485fa126SAdam Ford static struct platform_device wl128x_device = {
167485fa126SAdam Ford 	.name	= "kim",
168485fa126SAdam Ford 	.id	= -1,
169485fa126SAdam Ford 	.dev	= {
170485fa126SAdam Ford 		.platform_data = &wilink7_pdata,
171485fa126SAdam Ford 	}
172485fa126SAdam Ford };
173485fa126SAdam Ford 
174d565b5f4SEnric Balletbo i Serra static struct platform_device btwilink_device = {
175d565b5f4SEnric Balletbo i Serra 	.name	= "btwilink",
176d565b5f4SEnric Balletbo i Serra 	.id	= -1,
177d565b5f4SEnric Balletbo i Serra };
178d565b5f4SEnric Balletbo i Serra 
179d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0020_rev_f_legacy_init(void)
18015c9887eSJavier Martinez Canillas {
181d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
182d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
183d565b5f4SEnric Balletbo i Serra }
184d565b5f4SEnric Balletbo i Serra 
185d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0030_rev_g_legacy_init(void)
186d565b5f4SEnric Balletbo i Serra {
187d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
188d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
18915c9887eSJavier Martinez Canillas }
19079b39f79STony Lindgren 
19179b39f79STony Lindgren static void __init omap3_evm_legacy_init(void)
19279b39f79STony Lindgren {
1935b7610f2STony Lindgren 	hsmmc2_internal_input_clk();
19479b39f79STony Lindgren }
19571900314STony Lindgren 
19671900314STony Lindgren static void am35xx_enable_emac_int(void)
19771900314STony Lindgren {
19871900314STony Lindgren 	u32 v;
19971900314STony Lindgren 
20071900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
20171900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
20271900314STony Lindgren 	      AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
20371900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
20471900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
20571900314STony Lindgren }
20671900314STony Lindgren 
20771900314STony Lindgren static void am35xx_disable_emac_int(void)
20871900314STony Lindgren {
20971900314STony Lindgren 	u32 v;
21071900314STony Lindgren 
21171900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
21271900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
21371900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
21471900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
21571900314STony Lindgren }
21671900314STony Lindgren 
21771900314STony Lindgren static struct emac_platform_data am35xx_emac_pdata = {
21871900314STony Lindgren 	.interrupt_enable	= am35xx_enable_emac_int,
21971900314STony Lindgren 	.interrupt_disable	= am35xx_disable_emac_int,
22071900314STony Lindgren };
22171900314STony Lindgren 
222fb45105aSDmitry Lifshitz static void __init am35xx_emac_reset(void)
22371900314STony Lindgren {
22471900314STony Lindgren 	u32 v;
22571900314STony Lindgren 
22671900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
22771900314STony Lindgren 	v &= ~AM35XX_CPGMACSS_SW_RST;
22871900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
22971900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
23071900314STony Lindgren }
231deff82e6SSebastian Reichel 
232fb45105aSDmitry Lifshitz static struct gpio cm_t3517_wlan_gpios[] __initdata = {
233fb45105aSDmitry Lifshitz 	{ 56,	GPIOF_OUT_INIT_HIGH,	"wlan pwr" },
234fb45105aSDmitry Lifshitz 	{ 4,	GPIOF_OUT_INIT_HIGH,	"xcvr noe" },
235fb45105aSDmitry Lifshitz };
236fb45105aSDmitry Lifshitz 
237fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_wifi_init(void)
238fb45105aSDmitry Lifshitz {
239fb45105aSDmitry Lifshitz 	int err = gpio_request_array(cm_t3517_wlan_gpios,
240fb45105aSDmitry Lifshitz 				ARRAY_SIZE(cm_t3517_wlan_gpios));
241fb45105aSDmitry Lifshitz 	if (err) {
242fb45105aSDmitry Lifshitz 		pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
243fb45105aSDmitry Lifshitz 		return;
244fb45105aSDmitry Lifshitz 	}
245fb45105aSDmitry Lifshitz 
246fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[0].gpio, 0);
247fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[1].gpio, 0);
248fb45105aSDmitry Lifshitz 
249fb45105aSDmitry Lifshitz 	msleep(100);
250fb45105aSDmitry Lifshitz 	gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
251fb45105aSDmitry Lifshitz }
252fb45105aSDmitry Lifshitz 
253fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_legacy_init(void)
254fb45105aSDmitry Lifshitz {
255b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
256b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
257fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
258fb45105aSDmitry Lifshitz 	hsmmc2_internal_input_clk();
259fb45105aSDmitry Lifshitz 	omap3_sbc_t3517_wifi_init();
260fb45105aSDmitry Lifshitz }
261fb45105aSDmitry Lifshitz 
262fb45105aSDmitry Lifshitz static void __init am3517_evm_legacy_init(void)
263fb45105aSDmitry Lifshitz {
264fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
265fb45105aSDmitry Lifshitz }
266f83ccb93SLinus Torvalds 
26714c0a5b4SSebastian Reichel static struct platform_device omap3_rom_rng_device = {
26814c0a5b4SSebastian Reichel 	.name		= "omap3-rom-rng",
26914c0a5b4SSebastian Reichel 	.id		= -1,
27014c0a5b4SSebastian Reichel 	.dev	= {
27114c0a5b4SSebastian Reichel 		.platform_data	= rx51_secure_rng_call,
27214c0a5b4SSebastian Reichel 	},
27314c0a5b4SSebastian Reichel };
27414c0a5b4SSebastian Reichel 
275deff82e6SSebastian Reichel static void __init nokia_n900_legacy_init(void)
276deff82e6SSebastian Reichel {
277deff82e6SSebastian Reichel 	hsmmc2_internal_input_clk();
27810c1f7d3STony Lindgren 	mmc_pdata[0].name = "external";
27910c1f7d3STony Lindgren 	mmc_pdata[1].name = "internal";
280deff82e6SSebastian Reichel 
281deff82e6SSebastian Reichel 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
282deff82e6SSebastian Reichel 		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
283deff82e6SSebastian Reichel 			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
284deff82e6SSebastian Reichel 			/* set IBE to 1 */
285deff82e6SSebastian Reichel 			rx51_secure_update_aux_cr(BIT(6), 0);
286deff82e6SSebastian Reichel 		} else {
2873d0cb73eSJoe Perches 			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
2883d0cb73eSJoe Perches 			pr_warn("Thumb binaries may crash randomly without this workaround\n");
289deff82e6SSebastian Reichel 		}
29014c0a5b4SSebastian Reichel 
291448f8bc6SAaro Koskinen 		pr_info("RX-51: Registering OMAP3 HWRNG device\n");
29214c0a5b4SSebastian Reichel 		platform_device_register(&omap3_rom_rng_device);
293deff82e6SSebastian Reichel 	}
294deff82e6SSebastian Reichel }
29563dd5bc0SStefan Roese 
29663dd5bc0SStefan Roese static void __init omap3_tao3530_legacy_init(void)
29763dd5bc0SStefan Roese {
29863dd5bc0SStefan Roese 	hsmmc2_internal_input_clk();
299faf4bd47SAaro Koskinen }
300fc53e2ccSGrazvydas Ignotas 
301485fa126SAdam Ford static void __init omap3_logicpd_torpedo_init(void)
302485fa126SAdam Ford {
303485fa126SAdam Ford 	omap3_gpio126_127_129();
304485fa126SAdam Ford 	platform_device_register(&wl128x_device);
305485fa126SAdam Ford 	platform_device_register(&btwilink_device);
306485fa126SAdam Ford }
307485fa126SAdam Ford 
308f9d50fefSGrazvydas Ignotas /* omap3pandora legacy devices */
309f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_IRQ_GPIO		21
310f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_NRESET_GPIO	23
311f9d50fefSGrazvydas Ignotas 
312fc53e2ccSGrazvydas Ignotas static struct platform_device pandora_backlight = {
313fc53e2ccSGrazvydas Ignotas 	.name	= "pandora-backlight",
314fc53e2ccSGrazvydas Ignotas 	.id	= -1,
315fc53e2ccSGrazvydas Ignotas };
316fc53e2ccSGrazvydas Ignotas 
317f9d50fefSGrazvydas Ignotas static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
318f9d50fefSGrazvydas Ignotas 	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
319f9d50fefSGrazvydas Ignotas };
320f9d50fefSGrazvydas Ignotas 
321f9d50fefSGrazvydas Ignotas static struct regulator_init_data pandora_vmmc3 = {
322f9d50fefSGrazvydas Ignotas 	.constraints = {
323f9d50fefSGrazvydas Ignotas 		.valid_ops_mask		= REGULATOR_CHANGE_STATUS,
324f9d50fefSGrazvydas Ignotas 	},
325f9d50fefSGrazvydas Ignotas 	.num_consumer_supplies	= ARRAY_SIZE(pandora_vmmc3_supply),
326f9d50fefSGrazvydas Ignotas 	.consumer_supplies	= pandora_vmmc3_supply,
327f9d50fefSGrazvydas Ignotas };
328f9d50fefSGrazvydas Ignotas 
329f9d50fefSGrazvydas Ignotas static struct fixed_voltage_config pandora_vwlan = {
330f9d50fefSGrazvydas Ignotas 	.supply_name		= "vwlan",
331f9d50fefSGrazvydas Ignotas 	.microvolts		= 1800000, /* 1.8V */
332f9d50fefSGrazvydas Ignotas 	.startup_delay		= 50000, /* 50ms */
333f9d50fefSGrazvydas Ignotas 	.init_data		= &pandora_vmmc3,
334f9d50fefSGrazvydas Ignotas };
335f9d50fefSGrazvydas Ignotas 
336f9d50fefSGrazvydas Ignotas static struct platform_device pandora_vwlan_device = {
337f9d50fefSGrazvydas Ignotas 	.name		= "reg-fixed-voltage",
338f9d50fefSGrazvydas Ignotas 	.id		= 1,
339f9d50fefSGrazvydas Ignotas 	.dev = {
340f9d50fefSGrazvydas Ignotas 		.platform_data = &pandora_vwlan,
341f9d50fefSGrazvydas Ignotas 	},
342f9d50fefSGrazvydas Ignotas };
343f9d50fefSGrazvydas Ignotas 
344efdfeb07SLinus Walleij static struct gpiod_lookup_table pandora_vwlan_gpiod_table = {
345efdfeb07SLinus Walleij 	.dev_id = "reg-fixed-voltage.1",
346efdfeb07SLinus Walleij 	.table = {
347efdfeb07SLinus Walleij 		/*
348efdfeb07SLinus Walleij 		 * As this is a low GPIO number it should be at the first
349efdfeb07SLinus Walleij 		 * GPIO bank.
350efdfeb07SLinus Walleij 		 */
351efdfeb07SLinus Walleij 		GPIO_LOOKUP("gpio-0-31", PANDORA_WIFI_NRESET_GPIO,
352efdfeb07SLinus Walleij 			    NULL, GPIO_ACTIVE_HIGH),
353efdfeb07SLinus Walleij 		{ },
354efdfeb07SLinus Walleij 	},
355efdfeb07SLinus Walleij };
356efdfeb07SLinus Walleij 
357f9d50fefSGrazvydas Ignotas static void pandora_wl1251_init_card(struct mmc_card *card)
358f9d50fefSGrazvydas Ignotas {
359f9d50fefSGrazvydas Ignotas 	/*
360f9d50fefSGrazvydas Ignotas 	 * We have TI wl1251 attached to MMC3. Pass this information to
361f9d50fefSGrazvydas Ignotas 	 * SDIO core because it can't be probed by normal methods.
362f9d50fefSGrazvydas Ignotas 	 */
363f9d50fefSGrazvydas Ignotas 	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
364f9d50fefSGrazvydas Ignotas 		card->quirks |= MMC_QUIRK_NONSTD_SDIO;
365f9d50fefSGrazvydas Ignotas 		card->cccr.wide_bus = 1;
366f9d50fefSGrazvydas Ignotas 		card->cis.vendor = 0x104c;
367f9d50fefSGrazvydas Ignotas 		card->cis.device = 0x9066;
368f9d50fefSGrazvydas Ignotas 		card->cis.blksize = 512;
369f9d50fefSGrazvydas Ignotas 		card->cis.max_dtr = 24000000;
370f9d50fefSGrazvydas Ignotas 		card->ocr = 0x80;
371f9d50fefSGrazvydas Ignotas 	}
372f9d50fefSGrazvydas Ignotas }
373f9d50fefSGrazvydas Ignotas 
374f9d50fefSGrazvydas Ignotas static struct omap2_hsmmc_info pandora_mmc3[] = {
375f9d50fefSGrazvydas Ignotas 	{
376f9d50fefSGrazvydas Ignotas 		.mmc		= 3,
377f9d50fefSGrazvydas Ignotas 		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
378f9d50fefSGrazvydas Ignotas 		.init_card	= pandora_wl1251_init_card,
379f9d50fefSGrazvydas Ignotas 	},
380f9d50fefSGrazvydas Ignotas 	{}	/* Terminator */
381f9d50fefSGrazvydas Ignotas };
382f9d50fefSGrazvydas Ignotas 
383f9d50fefSGrazvydas Ignotas static void __init pandora_wl1251_init(void)
384f9d50fefSGrazvydas Ignotas {
385f9d50fefSGrazvydas Ignotas 	struct wl1251_platform_data pandora_wl1251_pdata;
386f9d50fefSGrazvydas Ignotas 	int ret;
387f9d50fefSGrazvydas Ignotas 
388f9d50fefSGrazvydas Ignotas 	memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
389f9d50fefSGrazvydas Ignotas 
390f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.power_gpio = -1;
391f9d50fefSGrazvydas Ignotas 
392f9d50fefSGrazvydas Ignotas 	ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
393f9d50fefSGrazvydas Ignotas 	if (ret < 0)
394f9d50fefSGrazvydas Ignotas 		goto fail;
395f9d50fefSGrazvydas Ignotas 
396f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
397f9d50fefSGrazvydas Ignotas 	if (pandora_wl1251_pdata.irq < 0)
398f9d50fefSGrazvydas Ignotas 		goto fail_irq;
399f9d50fefSGrazvydas Ignotas 
400f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.use_eeprom = true;
401f9d50fefSGrazvydas Ignotas 	ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
402f9d50fefSGrazvydas Ignotas 	if (ret < 0)
403f9d50fefSGrazvydas Ignotas 		goto fail_irq;
404f9d50fefSGrazvydas Ignotas 
405f9d50fefSGrazvydas Ignotas 	return;
406f9d50fefSGrazvydas Ignotas 
407f9d50fefSGrazvydas Ignotas fail_irq:
408f9d50fefSGrazvydas Ignotas 	gpio_free(PANDORA_WIFI_IRQ_GPIO);
409f9d50fefSGrazvydas Ignotas fail:
410f9d50fefSGrazvydas Ignotas 	pr_err("wl1251 board initialisation failed\n");
411f9d50fefSGrazvydas Ignotas }
412f9d50fefSGrazvydas Ignotas 
413fc53e2ccSGrazvydas Ignotas static void __init omap3_pandora_legacy_init(void)
414fc53e2ccSGrazvydas Ignotas {
415fc53e2ccSGrazvydas Ignotas 	platform_device_register(&pandora_backlight);
416efdfeb07SLinus Walleij 	gpiod_add_lookup_table(&pandora_vwlan_gpiod_table);
417f9d50fefSGrazvydas Ignotas 	platform_device_register(&pandora_vwlan_device);
418f9d50fefSGrazvydas Ignotas 	omap_hsmmc_init(pandora_mmc3);
419f9d50fefSGrazvydas Ignotas 	omap_hsmmc_late_init(pandora_mmc3);
420f9d50fefSGrazvydas Ignotas 	pandora_wl1251_init();
421fc53e2ccSGrazvydas Ignotas }
422faf4bd47SAaro Koskinen #endif /* CONFIG_ARCH_OMAP3 */
423faf4bd47SAaro Koskinen 
42467eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
425910f1678SSuman Anna static struct iommu_platform_data omap4_iommu_pdata = {
426910f1678SSuman Anna 	.reset_name = "mmu_cache",
427910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
428910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
429*19feeee5SSuman Anna 	.device_enable = omap_device_enable,
430*19feeee5SSuman Anna 	.device_idle = omap_device_idle,
431910f1678SSuman Anna };
4323e7a3185STony Lindgren #endif
4333e7a3185STony Lindgren 
4346da74c54SDave Gerlach #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
4356da74c54SDave Gerlach static struct wkup_m3_platform_data wkup_m3_data = {
4366da74c54SDave Gerlach 	.reset_name = "wkup_m3",
4376da74c54SDave Gerlach 	.assert_reset = omap_device_assert_hardreset,
4386da74c54SDave Gerlach 	.deassert_reset = omap_device_deassert_hardreset,
4396da74c54SDave Gerlach };
4406da74c54SDave Gerlach #endif
4416da74c54SDave Gerlach 
4423e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
4433e7a3185STony Lindgren static void __init omap5_uevm_legacy_init(void)
4443e7a3185STony Lindgren {
4453e7a3185STony Lindgren }
4463e7a3185STony Lindgren #endif
4473e7a3185STony Lindgren 
448fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
449fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1;
450fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2;
451fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3;
452fc66ce0bSSekhar Nori 
453fc66ce0bSSekhar Nori static void __init dra7x_evm_mmc_quirk(void)
454fc66ce0bSSekhar Nori {
455fc66ce0bSSekhar Nori 	if (omap_rev() == DRA752_REV_ES1_1 || omap_rev() == DRA752_REV_ES1_0) {
456fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc1.version = "rev11";
457fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc1.max_freq = 96000000;
458fc66ce0bSSekhar Nori 
459fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc2.version = "rev11";
460fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc2.max_freq = 48000000;
461fc66ce0bSSekhar Nori 
462fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc3.version = "rev11";
463fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc3.max_freq = 48000000;
464fc66ce0bSSekhar Nori 	}
465fc66ce0bSSekhar Nori }
466fc66ce0bSSekhar Nori #endif
467fc66ce0bSSekhar Nori 
4682b2f7defSTony Lindgren static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk)
4692b2f7defSTony Lindgren {
4702b2f7defSTony Lindgren 	struct clockdomain *clkdm = NULL;
4712b2f7defSTony Lindgren 	struct clk_hw_omap *hwclk;
4722b2f7defSTony Lindgren 
4732b2f7defSTony Lindgren 	hwclk = to_clk_hw_omap(__clk_get_hw(clk));
4742b2f7defSTony Lindgren 	if (hwclk && hwclk->clkdm_name)
4752b2f7defSTony Lindgren 		clkdm = clkdm_lookup(hwclk->clkdm_name);
4762b2f7defSTony Lindgren 
4772b2f7defSTony Lindgren 	return clkdm;
4782b2f7defSTony Lindgren }
4792b2f7defSTony Lindgren 
4802b2f7defSTony Lindgren /**
4812b2f7defSTony Lindgren  * ti_sysc_clkdm_init - find clockdomain based on clock
4822b2f7defSTony Lindgren  * @fck: device functional clock
4832b2f7defSTony Lindgren  * @ick: device interface clock
4842b2f7defSTony Lindgren  * @dev: struct device
4852b2f7defSTony Lindgren  *
4862b2f7defSTony Lindgren  * Populate clockdomain based on clock. It is needed for
4872b2f7defSTony Lindgren  * clkdm_deny_idle() and clkdm_allow_idle() for blocking clockdomain
4882b2f7defSTony Lindgren  * clockdomain idle during reset, enable and idle.
4892b2f7defSTony Lindgren  *
4902b2f7defSTony Lindgren  * Note that we assume interconnect driver manages the clocks
4912b2f7defSTony Lindgren  * and do not need to populate oh->_clk for dynamically
4922b2f7defSTony Lindgren  * allocated modules.
4932b2f7defSTony Lindgren  */
4942b2f7defSTony Lindgren static int ti_sysc_clkdm_init(struct device *dev,
4952b2f7defSTony Lindgren 			      struct clk *fck, struct clk *ick,
4962b2f7defSTony Lindgren 			      struct ti_sysc_cookie *cookie)
4972b2f7defSTony Lindgren {
4982783d063STony Lindgren 	if (!IS_ERR(fck))
4992b2f7defSTony Lindgren 		cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
5002b2f7defSTony Lindgren 	if (cookie->clkdm)
5012b2f7defSTony Lindgren 		return 0;
5022783d063STony Lindgren 	if (!IS_ERR(ick))
5032b2f7defSTony Lindgren 		cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
5042b2f7defSTony Lindgren 	if (cookie->clkdm)
5052b2f7defSTony Lindgren 		return 0;
5062b2f7defSTony Lindgren 
5072b2f7defSTony Lindgren 	return -ENODEV;
5082b2f7defSTony Lindgren }
5092b2f7defSTony Lindgren 
5102b2f7defSTony Lindgren static void ti_sysc_clkdm_deny_idle(struct device *dev,
5112b2f7defSTony Lindgren 				    const struct ti_sysc_cookie *cookie)
5122b2f7defSTony Lindgren {
5132b2f7defSTony Lindgren 	if (cookie->clkdm)
5142b2f7defSTony Lindgren 		clkdm_deny_idle(cookie->clkdm);
5152b2f7defSTony Lindgren }
5162b2f7defSTony Lindgren 
5172b2f7defSTony Lindgren static void ti_sysc_clkdm_allow_idle(struct device *dev,
5182b2f7defSTony Lindgren 				     const struct ti_sysc_cookie *cookie)
5192b2f7defSTony Lindgren {
5202b2f7defSTony Lindgren 	if (cookie->clkdm)
5212b2f7defSTony Lindgren 		clkdm_allow_idle(cookie->clkdm);
5222b2f7defSTony Lindgren }
5232b2f7defSTony Lindgren 
524ef70b0bdSTony Lindgren static int ti_sysc_enable_module(struct device *dev,
525ef70b0bdSTony Lindgren 				 const struct ti_sysc_cookie *cookie)
526ef70b0bdSTony Lindgren {
527ef70b0bdSTony Lindgren 	if (!cookie->data)
528ef70b0bdSTony Lindgren 		return -EINVAL;
529ef70b0bdSTony Lindgren 
530ef70b0bdSTony Lindgren 	return omap_hwmod_enable(cookie->data);
531ef70b0bdSTony Lindgren }
532ef70b0bdSTony Lindgren 
533ef70b0bdSTony Lindgren static int ti_sysc_idle_module(struct device *dev,
534ef70b0bdSTony Lindgren 			       const struct ti_sysc_cookie *cookie)
535ef70b0bdSTony Lindgren {
536ef70b0bdSTony Lindgren 	if (!cookie->data)
537ef70b0bdSTony Lindgren 		return -EINVAL;
538ef70b0bdSTony Lindgren 
539ef70b0bdSTony Lindgren 	return omap_hwmod_idle(cookie->data);
540ef70b0bdSTony Lindgren }
541ef70b0bdSTony Lindgren 
542ef70b0bdSTony Lindgren static int ti_sysc_shutdown_module(struct device *dev,
543ef70b0bdSTony Lindgren 				   const struct ti_sysc_cookie *cookie)
544ef70b0bdSTony Lindgren {
545ef70b0bdSTony Lindgren 	if (!cookie->data)
546ef70b0bdSTony Lindgren 		return -EINVAL;
547ef70b0bdSTony Lindgren 
548ef70b0bdSTony Lindgren 	return omap_hwmod_shutdown(cookie->data);
549ef70b0bdSTony Lindgren }
550ef70b0bdSTony Lindgren 
551ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[];
552ef70b0bdSTony Lindgren 
553ef70b0bdSTony Lindgren static struct ti_sysc_platform_data ti_sysc_pdata = {
554ef70b0bdSTony Lindgren 	.auxdata = omap_auxdata_lookup,
5552b2f7defSTony Lindgren 	.init_clockdomain = ti_sysc_clkdm_init,
5562b2f7defSTony Lindgren 	.clkdm_deny_idle = ti_sysc_clkdm_deny_idle,
5572b2f7defSTony Lindgren 	.clkdm_allow_idle = ti_sysc_clkdm_allow_idle,
558695eea3dSTony Lindgren 	.init_module = omap_hwmod_init_module,
559ef70b0bdSTony Lindgren 	.enable_module = ti_sysc_enable_module,
560ef70b0bdSTony Lindgren 	.idle_module = ti_sysc_idle_module,
561ef70b0bdSTony Lindgren 	.shutdown_module = ti_sysc_shutdown_module,
562ef70b0bdSTony Lindgren };
563ef70b0bdSTony Lindgren 
56430a69ef7STony Lindgren static struct pcs_pdata pcs_pdata;
56530a69ef7STony Lindgren 
56630a69ef7STony Lindgren void omap_pcs_legacy_init(int irq, void (*rearm)(void))
56730a69ef7STony Lindgren {
56830a69ef7STony Lindgren 	pcs_pdata.irq = irq;
56930a69ef7STony Lindgren 	pcs_pdata.rearm = rearm;
57030a69ef7STony Lindgren }
57130a69ef7STony Lindgren 
572036582f7STony Lindgren /*
573dad12d11STony Lindgren  * GPIOs for TWL are initialized by the I2C bus and need custom
574dad12d11STony Lindgren  * handing until DSS has device tree bindings.
575dad12d11STony Lindgren  */
576dad12d11STony Lindgren void omap_auxdata_legacy_init(struct device *dev)
577dad12d11STony Lindgren {
578dad12d11STony Lindgren 	if (dev->platform_data)
579dad12d11STony Lindgren 		return;
580dad12d11STony Lindgren 
581dad12d11STony Lindgren 	if (strcmp("twl4030-gpio", dev_name(dev)))
582dad12d11STony Lindgren 		return;
583dad12d11STony Lindgren 
584dad12d11STony Lindgren 	dev->platform_data = &twl_gpio_auxdata;
585dad12d11STony Lindgren }
586dad12d11STony Lindgren 
587558eb0bfSPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
588c26c84c9SPeter Ujfalusi static struct omap_mcbsp_platform_data mcbsp_pdata;
589c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void)
590c26c84c9SPeter Ujfalusi {
591c26c84c9SPeter Ujfalusi 	omap3_mcbsp_init_pdata_callback(&mcbsp_pdata);
592c26c84c9SPeter Ujfalusi }
593c26c84c9SPeter Ujfalusi #else
594c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void) {}
595c26c84c9SPeter Ujfalusi #endif
596c26c84c9SPeter Ujfalusi 
597dad12d11STony Lindgren /*
598036582f7STony Lindgren  * Few boards still need auxdata populated before we populate
599036582f7STony Lindgren  * the dev entries in of_platform_populate().
600036582f7STony Lindgren  */
601036582f7STony Lindgren static struct pdata_init auxdata_quirks[] __initdata = {
602fa590c92STony Lindgren #ifdef CONFIG_SOC_OMAP2420
603fa590c92STony Lindgren 	{ "nokia,n800", omap2420_n8x0_legacy_init, },
604fa590c92STony Lindgren 	{ "nokia,n810", omap2420_n8x0_legacy_init, },
605fa590c92STony Lindgren 	{ "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
606fa590c92STony Lindgren #endif
6070f0cfc69STony Lindgren #ifdef CONFIG_ARCH_OMAP3
6080f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
6090f0cfc69STony Lindgren #endif
610036582f7STony Lindgren 	{ /* sentinel */ },
611036582f7STony Lindgren };
612036582f7STony Lindgren 
613d060b405STony Lindgren struct omap_sr_data __maybe_unused omap_sr_pdata[OMAP_SR_NR];
614d060b405STony Lindgren 
615ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[] = {
616036582f7STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
617036582f7STony Lindgren 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
618e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
619e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
620036582f7STony Lindgren #endif
62130a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP3
622910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
623910f1678SSuman Anna 		       &omap3_iommu_pdata),
624d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
625d060b405STony Lindgren 		       "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
626d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
627d060b405STony Lindgren 		       "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
62810c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
62910c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
63071900314STony Lindgren 	/* Only on am3517 */
63171900314STony Lindgren 	OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
63271900314STony Lindgren 	OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
63371900314STony Lindgren 		       &am35xx_emac_pdata),
634c26c84c9SPeter Ujfalusi 	/* McBSP modules with sidetone core */
635558eb0bfSPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
636c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
637c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata),
638c26c84c9SPeter Ujfalusi #endif
63930a69ef7STony Lindgren #endif
6406da74c54SDave Gerlach #ifdef CONFIG_SOC_AM33XX
6416da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
6426da74c54SDave Gerlach 		       &wkup_m3_data),
6436da74c54SDave Gerlach #endif
644dbbe9770SKeerthy #ifdef CONFIG_SOC_AM43XX
6456da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
6466da74c54SDave Gerlach 		       &wkup_m3_data),
647dbbe9770SKeerthy #endif
64867eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
649910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
650910f1678SSuman Anna 		       &omap4_iommu_pdata),
651910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
652910f1678SSuman Anna 		       &omap4_iommu_pdata),
653d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000,
654d060b405STony Lindgren 		       "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]),
655d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000,
656d060b405STony Lindgren 		       "4a0dd000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
657d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-mpu", 0x4a0d9000,
658d060b405STony Lindgren 		       "4a0d9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
65930a69ef7STony Lindgren #endif
660fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
661fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x4809c000, "4809c000.mmc",
662fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc1),
663fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480b4000, "480b4000.mmc",
664fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc2),
665fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480ad000, "480ad000.mmc",
666fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc3),
667fc66ce0bSSekhar Nori #endif
668d4f414e5STony Lindgren 	/* Common auxdata */
669ef70b0bdSTony Lindgren 	OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
670d4f414e5STony Lindgren 	OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
6718651bd8cSTony Lindgren 	{ /* sentinel */ },
6728651bd8cSTony Lindgren };
6738651bd8cSTony Lindgren 
674036582f7STony Lindgren /*
675036582f7STony Lindgren  * Few boards still need to initialize some legacy devices with
676036582f7STony Lindgren  * platform data until the drivers support device tree.
677036582f7STony Lindgren  */
6786a08e1e6STony Lindgren static struct pdata_init pdata_quirks[] __initdata = {
679faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
680fb45105aSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, },
68140ecc02eSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, },
6820f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
683deff82e6SSebastian Reichel 	{ "nokia,omap3-n900", nokia_n900_legacy_init, },
684faf4bd47SAaro Koskinen 	{ "nokia,omap3-n9", hsmmc2_internal_input_clk, },
685faf4bd47SAaro Koskinen 	{ "nokia,omap3-n950", hsmmc2_internal_input_clk, },
686d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
687d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
688485fa126SAdam Ford 	{ "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, },
68979b39f79STony Lindgren 	{ "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
69071900314STony Lindgren 	{ "ti,am3517-evm", am3517_evm_legacy_init, },
69163dd5bc0SStefan Roese 	{ "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
692fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
693fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
694faf4bd47SAaro Koskinen #endif
6953e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
6963e7a3185STony Lindgren 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
6973e7a3185STony Lindgren #endif
698fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
699fc66ce0bSSekhar Nori 	{ "ti,dra7-evm", dra7x_evm_mmc_quirk, },
700fc66ce0bSSekhar Nori #endif
7016a08e1e6STony Lindgren 	{ /* sentinel */ },
7026a08e1e6STony Lindgren };
7036a08e1e6STony Lindgren 
704036582f7STony Lindgren static void pdata_quirks_check(struct pdata_init *quirks)
7056a08e1e6STony Lindgren {
7066a08e1e6STony Lindgren 	while (quirks->compatible) {
7076a08e1e6STony Lindgren 		if (of_machine_is_compatible(quirks->compatible)) {
7086a08e1e6STony Lindgren 			if (quirks->fn)
7096a08e1e6STony Lindgren 				quirks->fn();
7106a08e1e6STony Lindgren 		}
7116a08e1e6STony Lindgren 		quirks++;
7126a08e1e6STony Lindgren 	}
7136a08e1e6STony Lindgren }
714036582f7STony Lindgren 
71531957609SUwe Kleine-König void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
716036582f7STony Lindgren {
71757df5380STony Lindgren 	/*
71857df5380STony Lindgren 	 * We still need this for omap2420 and omap3 PM to work, others are
71957df5380STony Lindgren 	 * using drivers/misc/sram.c already.
72057df5380STony Lindgren 	 */
72157df5380STony Lindgren 	if (of_machine_is_compatible("ti,omap2420") ||
72257df5380STony Lindgren 	    of_machine_is_compatible("ti,omap3"))
723036582f7STony Lindgren 		omap_sdrc_init(NULL, NULL);
72457df5380STony Lindgren 
725c26c84c9SPeter Ujfalusi 	if (of_machine_is_compatible("ti,omap3"))
726c26c84c9SPeter Ujfalusi 		omap3_mcbsp_init();
727036582f7STony Lindgren 	pdata_quirks_check(auxdata_quirks);
728036582f7STony Lindgren 	of_platform_populate(NULL, omap_dt_match_table,
729036582f7STony Lindgren 			     omap_auxdata_lookup, NULL);
730036582f7STony Lindgren 	pdata_quirks_check(pdata_quirks);
731036582f7STony Lindgren }
732