xref: /linux/arch/arm/mach-omap2/pdata-quirks.c (revision 0af3e1a491dde06dfcb0b063d5b543dfebded0f9)
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,
9219feeee5SSuman Anna 	.device_enable = omap_device_enable,
9319feeee5SSuman Anna 	.device_idle = omap_device_idle,
94910f1678SSuman Anna };
95910f1678SSuman Anna 
96*0af3e1a4SSuman Anna static struct iommu_platform_data omap3_iommu_isp_pdata = {
97*0af3e1a4SSuman Anna 	.device_enable = omap_device_enable,
98*0af3e1a4SSuman Anna 	.device_idle = omap_device_idle,
99*0af3e1a4SSuman Anna };
100*0af3e1a4SSuman Anna 
1010f0cfc69STony Lindgren static int omap3_sbc_t3730_twl_callback(struct device *dev,
1020f0cfc69STony Lindgren 					   unsigned gpio,
1030f0cfc69STony Lindgren 					   unsigned ngpio)
1040f0cfc69STony Lindgren {
1050f0cfc69STony Lindgren 	int res;
1060f0cfc69STony Lindgren 
1070f0cfc69STony Lindgren 	res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
108d234e423SDmitry Lifshitz 			       "wlan pwr");
1090f0cfc69STony Lindgren 	if (res)
1100f0cfc69STony Lindgren 		return res;
1110f0cfc69STony Lindgren 
1120f0cfc69STony Lindgren 	gpio_export(gpio, 0);
1130f0cfc69STony Lindgren 
1140f0cfc69STony Lindgren 	return 0;
1150f0cfc69STony Lindgren }
1160f0cfc69STony Lindgren 
117b62d91e5SDmitry Lifshitz static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
118b62d91e5SDmitry Lifshitz {
119b62d91e5SDmitry Lifshitz 	int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
120b62d91e5SDmitry Lifshitz 
121b62d91e5SDmitry Lifshitz 	if (err) {
122b62d91e5SDmitry Lifshitz 		pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
123b62d91e5SDmitry Lifshitz 			hub_name, err);
124b62d91e5SDmitry Lifshitz 		return;
125b62d91e5SDmitry Lifshitz 	}
126b62d91e5SDmitry Lifshitz 
127b62d91e5SDmitry Lifshitz 	gpio_export(gpio, 0);
128b62d91e5SDmitry Lifshitz 
129b62d91e5SDmitry Lifshitz 	udelay(10);
130b62d91e5SDmitry Lifshitz 	gpio_set_value(gpio, 1);
131b62d91e5SDmitry Lifshitz 	msleep(1);
132b62d91e5SDmitry Lifshitz }
133b62d91e5SDmitry Lifshitz 
1340f0cfc69STony Lindgren static void __init omap3_sbc_t3730_twl_init(void)
1350f0cfc69STony Lindgren {
1360f0cfc69STony Lindgren 	twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
1370f0cfc69STony Lindgren }
1380f0cfc69STony Lindgren 
1390f0cfc69STony Lindgren static void __init omap3_sbc_t3730_legacy_init(void)
1400f0cfc69STony Lindgren {
141b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
1420f0cfc69STony Lindgren }
1430f0cfc69STony Lindgren 
14440ecc02eSDmitry Lifshitz static void __init omap3_sbc_t3530_legacy_init(void)
14540ecc02eSDmitry Lifshitz {
146b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
14740ecc02eSDmitry Lifshitz }
14840ecc02eSDmitry Lifshitz 
149f734a9b3SSekhar Nori static struct ti_st_plat_data wilink_pdata = {
150d565b5f4SEnric Balletbo i Serra 	.nshutdown_gpio = 137,
151d565b5f4SEnric Balletbo i Serra 	.dev_name = "/dev/ttyO1",
152d565b5f4SEnric Balletbo i Serra 	.flow_cntrl = 1,
153d565b5f4SEnric Balletbo i Serra 	.baud_rate = 300000,
154d565b5f4SEnric Balletbo i Serra };
155d565b5f4SEnric Balletbo i Serra 
156d565b5f4SEnric Balletbo i Serra static struct platform_device wl18xx_device = {
157d565b5f4SEnric Balletbo i Serra 	.name	= "kim",
158d565b5f4SEnric Balletbo i Serra 	.id	= -1,
159d565b5f4SEnric Balletbo i Serra 	.dev	= {
160d565b5f4SEnric Balletbo i Serra 		.platform_data = &wilink_pdata,
161d565b5f4SEnric Balletbo i Serra 	}
162d565b5f4SEnric Balletbo i Serra };
163d565b5f4SEnric Balletbo i Serra 
164485fa126SAdam Ford static struct ti_st_plat_data wilink7_pdata = {
165485fa126SAdam Ford 	.nshutdown_gpio = 162,
166485fa126SAdam Ford 	.dev_name = "/dev/ttyO1",
167485fa126SAdam Ford 	.flow_cntrl = 1,
168a3ac3507SAdam Ford 	.baud_rate = 3000000,
169485fa126SAdam Ford };
170485fa126SAdam Ford 
171485fa126SAdam Ford static struct platform_device wl128x_device = {
172485fa126SAdam Ford 	.name	= "kim",
173485fa126SAdam Ford 	.id	= -1,
174485fa126SAdam Ford 	.dev	= {
175485fa126SAdam Ford 		.platform_data = &wilink7_pdata,
176485fa126SAdam Ford 	}
177485fa126SAdam Ford };
178485fa126SAdam Ford 
179d565b5f4SEnric Balletbo i Serra static struct platform_device btwilink_device = {
180d565b5f4SEnric Balletbo i Serra 	.name	= "btwilink",
181d565b5f4SEnric Balletbo i Serra 	.id	= -1,
182d565b5f4SEnric Balletbo i Serra };
183d565b5f4SEnric Balletbo i Serra 
184d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0020_rev_f_legacy_init(void)
18515c9887eSJavier Martinez Canillas {
186d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
187d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
188d565b5f4SEnric Balletbo i Serra }
189d565b5f4SEnric Balletbo i Serra 
190d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0030_rev_g_legacy_init(void)
191d565b5f4SEnric Balletbo i Serra {
192d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
193d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
19415c9887eSJavier Martinez Canillas }
19579b39f79STony Lindgren 
19679b39f79STony Lindgren static void __init omap3_evm_legacy_init(void)
19779b39f79STony Lindgren {
1985b7610f2STony Lindgren 	hsmmc2_internal_input_clk();
19979b39f79STony Lindgren }
20071900314STony Lindgren 
20171900314STony Lindgren static void am35xx_enable_emac_int(void)
20271900314STony Lindgren {
20371900314STony Lindgren 	u32 v;
20471900314STony Lindgren 
20571900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
20671900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
20771900314STony Lindgren 	      AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
20871900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
20971900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
21071900314STony Lindgren }
21171900314STony Lindgren 
21271900314STony Lindgren static void am35xx_disable_emac_int(void)
21371900314STony Lindgren {
21471900314STony Lindgren 	u32 v;
21571900314STony Lindgren 
21671900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
21771900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
21871900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
21971900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
22071900314STony Lindgren }
22171900314STony Lindgren 
22271900314STony Lindgren static struct emac_platform_data am35xx_emac_pdata = {
22371900314STony Lindgren 	.interrupt_enable	= am35xx_enable_emac_int,
22471900314STony Lindgren 	.interrupt_disable	= am35xx_disable_emac_int,
22571900314STony Lindgren };
22671900314STony Lindgren 
227fb45105aSDmitry Lifshitz static void __init am35xx_emac_reset(void)
22871900314STony Lindgren {
22971900314STony Lindgren 	u32 v;
23071900314STony Lindgren 
23171900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
23271900314STony Lindgren 	v &= ~AM35XX_CPGMACSS_SW_RST;
23371900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
23471900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
23571900314STony Lindgren }
236deff82e6SSebastian Reichel 
237fb45105aSDmitry Lifshitz static struct gpio cm_t3517_wlan_gpios[] __initdata = {
238fb45105aSDmitry Lifshitz 	{ 56,	GPIOF_OUT_INIT_HIGH,	"wlan pwr" },
239fb45105aSDmitry Lifshitz 	{ 4,	GPIOF_OUT_INIT_HIGH,	"xcvr noe" },
240fb45105aSDmitry Lifshitz };
241fb45105aSDmitry Lifshitz 
242fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_wifi_init(void)
243fb45105aSDmitry Lifshitz {
244fb45105aSDmitry Lifshitz 	int err = gpio_request_array(cm_t3517_wlan_gpios,
245fb45105aSDmitry Lifshitz 				ARRAY_SIZE(cm_t3517_wlan_gpios));
246fb45105aSDmitry Lifshitz 	if (err) {
247fb45105aSDmitry Lifshitz 		pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
248fb45105aSDmitry Lifshitz 		return;
249fb45105aSDmitry Lifshitz 	}
250fb45105aSDmitry Lifshitz 
251fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[0].gpio, 0);
252fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[1].gpio, 0);
253fb45105aSDmitry Lifshitz 
254fb45105aSDmitry Lifshitz 	msleep(100);
255fb45105aSDmitry Lifshitz 	gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
256fb45105aSDmitry Lifshitz }
257fb45105aSDmitry Lifshitz 
258fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_legacy_init(void)
259fb45105aSDmitry Lifshitz {
260b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
261b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
262fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
263fb45105aSDmitry Lifshitz 	hsmmc2_internal_input_clk();
264fb45105aSDmitry Lifshitz 	omap3_sbc_t3517_wifi_init();
265fb45105aSDmitry Lifshitz }
266fb45105aSDmitry Lifshitz 
267fb45105aSDmitry Lifshitz static void __init am3517_evm_legacy_init(void)
268fb45105aSDmitry Lifshitz {
269fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
270fb45105aSDmitry Lifshitz }
271f83ccb93SLinus Torvalds 
27214c0a5b4SSebastian Reichel static struct platform_device omap3_rom_rng_device = {
27314c0a5b4SSebastian Reichel 	.name		= "omap3-rom-rng",
27414c0a5b4SSebastian Reichel 	.id		= -1,
27514c0a5b4SSebastian Reichel 	.dev	= {
27614c0a5b4SSebastian Reichel 		.platform_data	= rx51_secure_rng_call,
27714c0a5b4SSebastian Reichel 	},
27814c0a5b4SSebastian Reichel };
27914c0a5b4SSebastian Reichel 
280deff82e6SSebastian Reichel static void __init nokia_n900_legacy_init(void)
281deff82e6SSebastian Reichel {
282deff82e6SSebastian Reichel 	hsmmc2_internal_input_clk();
28310c1f7d3STony Lindgren 	mmc_pdata[0].name = "external";
28410c1f7d3STony Lindgren 	mmc_pdata[1].name = "internal";
285deff82e6SSebastian Reichel 
286deff82e6SSebastian Reichel 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
287deff82e6SSebastian Reichel 		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
288deff82e6SSebastian Reichel 			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
289deff82e6SSebastian Reichel 			/* set IBE to 1 */
290deff82e6SSebastian Reichel 			rx51_secure_update_aux_cr(BIT(6), 0);
291deff82e6SSebastian Reichel 		} else {
2923d0cb73eSJoe Perches 			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
2933d0cb73eSJoe Perches 			pr_warn("Thumb binaries may crash randomly without this workaround\n");
294deff82e6SSebastian Reichel 		}
29514c0a5b4SSebastian Reichel 
296448f8bc6SAaro Koskinen 		pr_info("RX-51: Registering OMAP3 HWRNG device\n");
29714c0a5b4SSebastian Reichel 		platform_device_register(&omap3_rom_rng_device);
298deff82e6SSebastian Reichel 	}
299deff82e6SSebastian Reichel }
30063dd5bc0SStefan Roese 
30163dd5bc0SStefan Roese static void __init omap3_tao3530_legacy_init(void)
30263dd5bc0SStefan Roese {
30363dd5bc0SStefan Roese 	hsmmc2_internal_input_clk();
304faf4bd47SAaro Koskinen }
305fc53e2ccSGrazvydas Ignotas 
306485fa126SAdam Ford static void __init omap3_logicpd_torpedo_init(void)
307485fa126SAdam Ford {
308485fa126SAdam Ford 	omap3_gpio126_127_129();
309485fa126SAdam Ford 	platform_device_register(&wl128x_device);
310485fa126SAdam Ford 	platform_device_register(&btwilink_device);
311485fa126SAdam Ford }
312485fa126SAdam Ford 
313f9d50fefSGrazvydas Ignotas /* omap3pandora legacy devices */
314f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_IRQ_GPIO		21
315f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_NRESET_GPIO	23
316f9d50fefSGrazvydas Ignotas 
317fc53e2ccSGrazvydas Ignotas static struct platform_device pandora_backlight = {
318fc53e2ccSGrazvydas Ignotas 	.name	= "pandora-backlight",
319fc53e2ccSGrazvydas Ignotas 	.id	= -1,
320fc53e2ccSGrazvydas Ignotas };
321fc53e2ccSGrazvydas Ignotas 
322f9d50fefSGrazvydas Ignotas static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
323f9d50fefSGrazvydas Ignotas 	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
324f9d50fefSGrazvydas Ignotas };
325f9d50fefSGrazvydas Ignotas 
326f9d50fefSGrazvydas Ignotas static struct regulator_init_data pandora_vmmc3 = {
327f9d50fefSGrazvydas Ignotas 	.constraints = {
328f9d50fefSGrazvydas Ignotas 		.valid_ops_mask		= REGULATOR_CHANGE_STATUS,
329f9d50fefSGrazvydas Ignotas 	},
330f9d50fefSGrazvydas Ignotas 	.num_consumer_supplies	= ARRAY_SIZE(pandora_vmmc3_supply),
331f9d50fefSGrazvydas Ignotas 	.consumer_supplies	= pandora_vmmc3_supply,
332f9d50fefSGrazvydas Ignotas };
333f9d50fefSGrazvydas Ignotas 
334f9d50fefSGrazvydas Ignotas static struct fixed_voltage_config pandora_vwlan = {
335f9d50fefSGrazvydas Ignotas 	.supply_name		= "vwlan",
336f9d50fefSGrazvydas Ignotas 	.microvolts		= 1800000, /* 1.8V */
337f9d50fefSGrazvydas Ignotas 	.startup_delay		= 50000, /* 50ms */
338f9d50fefSGrazvydas Ignotas 	.init_data		= &pandora_vmmc3,
339f9d50fefSGrazvydas Ignotas };
340f9d50fefSGrazvydas Ignotas 
341f9d50fefSGrazvydas Ignotas static struct platform_device pandora_vwlan_device = {
342f9d50fefSGrazvydas Ignotas 	.name		= "reg-fixed-voltage",
343f9d50fefSGrazvydas Ignotas 	.id		= 1,
344f9d50fefSGrazvydas Ignotas 	.dev = {
345f9d50fefSGrazvydas Ignotas 		.platform_data = &pandora_vwlan,
346f9d50fefSGrazvydas Ignotas 	},
347f9d50fefSGrazvydas Ignotas };
348f9d50fefSGrazvydas Ignotas 
349efdfeb07SLinus Walleij static struct gpiod_lookup_table pandora_vwlan_gpiod_table = {
350efdfeb07SLinus Walleij 	.dev_id = "reg-fixed-voltage.1",
351efdfeb07SLinus Walleij 	.table = {
352efdfeb07SLinus Walleij 		/*
353efdfeb07SLinus Walleij 		 * As this is a low GPIO number it should be at the first
354efdfeb07SLinus Walleij 		 * GPIO bank.
355efdfeb07SLinus Walleij 		 */
356efdfeb07SLinus Walleij 		GPIO_LOOKUP("gpio-0-31", PANDORA_WIFI_NRESET_GPIO,
357efdfeb07SLinus Walleij 			    NULL, GPIO_ACTIVE_HIGH),
358efdfeb07SLinus Walleij 		{ },
359efdfeb07SLinus Walleij 	},
360efdfeb07SLinus Walleij };
361efdfeb07SLinus Walleij 
362f9d50fefSGrazvydas Ignotas static void pandora_wl1251_init_card(struct mmc_card *card)
363f9d50fefSGrazvydas Ignotas {
364f9d50fefSGrazvydas Ignotas 	/*
365f9d50fefSGrazvydas Ignotas 	 * We have TI wl1251 attached to MMC3. Pass this information to
366f9d50fefSGrazvydas Ignotas 	 * SDIO core because it can't be probed by normal methods.
367f9d50fefSGrazvydas Ignotas 	 */
368f9d50fefSGrazvydas Ignotas 	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
369f9d50fefSGrazvydas Ignotas 		card->quirks |= MMC_QUIRK_NONSTD_SDIO;
370f9d50fefSGrazvydas Ignotas 		card->cccr.wide_bus = 1;
371f9d50fefSGrazvydas Ignotas 		card->cis.vendor = 0x104c;
372f9d50fefSGrazvydas Ignotas 		card->cis.device = 0x9066;
373f9d50fefSGrazvydas Ignotas 		card->cis.blksize = 512;
374f9d50fefSGrazvydas Ignotas 		card->cis.max_dtr = 24000000;
375f9d50fefSGrazvydas Ignotas 		card->ocr = 0x80;
376f9d50fefSGrazvydas Ignotas 	}
377f9d50fefSGrazvydas Ignotas }
378f9d50fefSGrazvydas Ignotas 
379f9d50fefSGrazvydas Ignotas static struct omap2_hsmmc_info pandora_mmc3[] = {
380f9d50fefSGrazvydas Ignotas 	{
381f9d50fefSGrazvydas Ignotas 		.mmc		= 3,
382f9d50fefSGrazvydas Ignotas 		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
383f9d50fefSGrazvydas Ignotas 		.init_card	= pandora_wl1251_init_card,
384f9d50fefSGrazvydas Ignotas 	},
385f9d50fefSGrazvydas Ignotas 	{}	/* Terminator */
386f9d50fefSGrazvydas Ignotas };
387f9d50fefSGrazvydas Ignotas 
388f9d50fefSGrazvydas Ignotas static void __init pandora_wl1251_init(void)
389f9d50fefSGrazvydas Ignotas {
390f9d50fefSGrazvydas Ignotas 	struct wl1251_platform_data pandora_wl1251_pdata;
391f9d50fefSGrazvydas Ignotas 	int ret;
392f9d50fefSGrazvydas Ignotas 
393f9d50fefSGrazvydas Ignotas 	memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
394f9d50fefSGrazvydas Ignotas 
395f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.power_gpio = -1;
396f9d50fefSGrazvydas Ignotas 
397f9d50fefSGrazvydas Ignotas 	ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
398f9d50fefSGrazvydas Ignotas 	if (ret < 0)
399f9d50fefSGrazvydas Ignotas 		goto fail;
400f9d50fefSGrazvydas Ignotas 
401f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
402f9d50fefSGrazvydas Ignotas 	if (pandora_wl1251_pdata.irq < 0)
403f9d50fefSGrazvydas Ignotas 		goto fail_irq;
404f9d50fefSGrazvydas Ignotas 
405f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.use_eeprom = true;
406f9d50fefSGrazvydas Ignotas 	ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
407f9d50fefSGrazvydas Ignotas 	if (ret < 0)
408f9d50fefSGrazvydas Ignotas 		goto fail_irq;
409f9d50fefSGrazvydas Ignotas 
410f9d50fefSGrazvydas Ignotas 	return;
411f9d50fefSGrazvydas Ignotas 
412f9d50fefSGrazvydas Ignotas fail_irq:
413f9d50fefSGrazvydas Ignotas 	gpio_free(PANDORA_WIFI_IRQ_GPIO);
414f9d50fefSGrazvydas Ignotas fail:
415f9d50fefSGrazvydas Ignotas 	pr_err("wl1251 board initialisation failed\n");
416f9d50fefSGrazvydas Ignotas }
417f9d50fefSGrazvydas Ignotas 
418fc53e2ccSGrazvydas Ignotas static void __init omap3_pandora_legacy_init(void)
419fc53e2ccSGrazvydas Ignotas {
420fc53e2ccSGrazvydas Ignotas 	platform_device_register(&pandora_backlight);
421efdfeb07SLinus Walleij 	gpiod_add_lookup_table(&pandora_vwlan_gpiod_table);
422f9d50fefSGrazvydas Ignotas 	platform_device_register(&pandora_vwlan_device);
423f9d50fefSGrazvydas Ignotas 	omap_hsmmc_init(pandora_mmc3);
424f9d50fefSGrazvydas Ignotas 	omap_hsmmc_late_init(pandora_mmc3);
425f9d50fefSGrazvydas Ignotas 	pandora_wl1251_init();
426fc53e2ccSGrazvydas Ignotas }
427faf4bd47SAaro Koskinen #endif /* CONFIG_ARCH_OMAP3 */
428faf4bd47SAaro Koskinen 
42967eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
430910f1678SSuman Anna static struct iommu_platform_data omap4_iommu_pdata = {
431910f1678SSuman Anna 	.reset_name = "mmu_cache",
432910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
433910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
43419feeee5SSuman Anna 	.device_enable = omap_device_enable,
43519feeee5SSuman Anna 	.device_idle = omap_device_idle,
436910f1678SSuman Anna };
4373e7a3185STony Lindgren #endif
4383e7a3185STony Lindgren 
4396da74c54SDave Gerlach #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
4406da74c54SDave Gerlach static struct wkup_m3_platform_data wkup_m3_data = {
4416da74c54SDave Gerlach 	.reset_name = "wkup_m3",
4426da74c54SDave Gerlach 	.assert_reset = omap_device_assert_hardreset,
4436da74c54SDave Gerlach 	.deassert_reset = omap_device_deassert_hardreset,
4446da74c54SDave Gerlach };
4456da74c54SDave Gerlach #endif
4466da74c54SDave Gerlach 
4473e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
4483e7a3185STony Lindgren static void __init omap5_uevm_legacy_init(void)
4493e7a3185STony Lindgren {
4503e7a3185STony Lindgren }
4513e7a3185STony Lindgren #endif
4523e7a3185STony Lindgren 
453fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
454fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1;
455fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2;
456fc66ce0bSSekhar Nori static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3;
457fc66ce0bSSekhar Nori 
458fc66ce0bSSekhar Nori static void __init dra7x_evm_mmc_quirk(void)
459fc66ce0bSSekhar Nori {
460fc66ce0bSSekhar Nori 	if (omap_rev() == DRA752_REV_ES1_1 || omap_rev() == DRA752_REV_ES1_0) {
461fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc1.version = "rev11";
462fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc1.max_freq = 96000000;
463fc66ce0bSSekhar Nori 
464fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc2.version = "rev11";
465fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc2.max_freq = 48000000;
466fc66ce0bSSekhar Nori 
467fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc3.version = "rev11";
468fc66ce0bSSekhar Nori 		dra7_hsmmc_data_mmc3.max_freq = 48000000;
469fc66ce0bSSekhar Nori 	}
470fc66ce0bSSekhar Nori }
471fc66ce0bSSekhar Nori #endif
472fc66ce0bSSekhar Nori 
4732b2f7defSTony Lindgren static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk)
4742b2f7defSTony Lindgren {
4752b2f7defSTony Lindgren 	struct clockdomain *clkdm = NULL;
4762b2f7defSTony Lindgren 	struct clk_hw_omap *hwclk;
4772b2f7defSTony Lindgren 
4782b2f7defSTony Lindgren 	hwclk = to_clk_hw_omap(__clk_get_hw(clk));
4792b2f7defSTony Lindgren 	if (hwclk && hwclk->clkdm_name)
4802b2f7defSTony Lindgren 		clkdm = clkdm_lookup(hwclk->clkdm_name);
4812b2f7defSTony Lindgren 
4822b2f7defSTony Lindgren 	return clkdm;
4832b2f7defSTony Lindgren }
4842b2f7defSTony Lindgren 
4852b2f7defSTony Lindgren /**
4862b2f7defSTony Lindgren  * ti_sysc_clkdm_init - find clockdomain based on clock
4872b2f7defSTony Lindgren  * @fck: device functional clock
4882b2f7defSTony Lindgren  * @ick: device interface clock
4892b2f7defSTony Lindgren  * @dev: struct device
4902b2f7defSTony Lindgren  *
4912b2f7defSTony Lindgren  * Populate clockdomain based on clock. It is needed for
4922b2f7defSTony Lindgren  * clkdm_deny_idle() and clkdm_allow_idle() for blocking clockdomain
4932b2f7defSTony Lindgren  * clockdomain idle during reset, enable and idle.
4942b2f7defSTony Lindgren  *
4952b2f7defSTony Lindgren  * Note that we assume interconnect driver manages the clocks
4962b2f7defSTony Lindgren  * and do not need to populate oh->_clk for dynamically
4972b2f7defSTony Lindgren  * allocated modules.
4982b2f7defSTony Lindgren  */
4992b2f7defSTony Lindgren static int ti_sysc_clkdm_init(struct device *dev,
5002b2f7defSTony Lindgren 			      struct clk *fck, struct clk *ick,
5012b2f7defSTony Lindgren 			      struct ti_sysc_cookie *cookie)
5022b2f7defSTony Lindgren {
5032783d063STony Lindgren 	if (!IS_ERR(fck))
5042b2f7defSTony Lindgren 		cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
5052b2f7defSTony Lindgren 	if (cookie->clkdm)
5062b2f7defSTony Lindgren 		return 0;
5072783d063STony Lindgren 	if (!IS_ERR(ick))
5082b2f7defSTony Lindgren 		cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
5092b2f7defSTony Lindgren 	if (cookie->clkdm)
5102b2f7defSTony Lindgren 		return 0;
5112b2f7defSTony Lindgren 
5122b2f7defSTony Lindgren 	return -ENODEV;
5132b2f7defSTony Lindgren }
5142b2f7defSTony Lindgren 
5152b2f7defSTony Lindgren static void ti_sysc_clkdm_deny_idle(struct device *dev,
5162b2f7defSTony Lindgren 				    const struct ti_sysc_cookie *cookie)
5172b2f7defSTony Lindgren {
5182b2f7defSTony Lindgren 	if (cookie->clkdm)
5192b2f7defSTony Lindgren 		clkdm_deny_idle(cookie->clkdm);
5202b2f7defSTony Lindgren }
5212b2f7defSTony Lindgren 
5222b2f7defSTony Lindgren static void ti_sysc_clkdm_allow_idle(struct device *dev,
5232b2f7defSTony Lindgren 				     const struct ti_sysc_cookie *cookie)
5242b2f7defSTony Lindgren {
5252b2f7defSTony Lindgren 	if (cookie->clkdm)
5262b2f7defSTony Lindgren 		clkdm_allow_idle(cookie->clkdm);
5272b2f7defSTony Lindgren }
5282b2f7defSTony Lindgren 
529ef70b0bdSTony Lindgren static int ti_sysc_enable_module(struct device *dev,
530ef70b0bdSTony Lindgren 				 const struct ti_sysc_cookie *cookie)
531ef70b0bdSTony Lindgren {
532ef70b0bdSTony Lindgren 	if (!cookie->data)
533ef70b0bdSTony Lindgren 		return -EINVAL;
534ef70b0bdSTony Lindgren 
535ef70b0bdSTony Lindgren 	return omap_hwmod_enable(cookie->data);
536ef70b0bdSTony Lindgren }
537ef70b0bdSTony Lindgren 
538ef70b0bdSTony Lindgren static int ti_sysc_idle_module(struct device *dev,
539ef70b0bdSTony Lindgren 			       const struct ti_sysc_cookie *cookie)
540ef70b0bdSTony Lindgren {
541ef70b0bdSTony Lindgren 	if (!cookie->data)
542ef70b0bdSTony Lindgren 		return -EINVAL;
543ef70b0bdSTony Lindgren 
544ef70b0bdSTony Lindgren 	return omap_hwmod_idle(cookie->data);
545ef70b0bdSTony Lindgren }
546ef70b0bdSTony Lindgren 
547ef70b0bdSTony Lindgren static int ti_sysc_shutdown_module(struct device *dev,
548ef70b0bdSTony Lindgren 				   const struct ti_sysc_cookie *cookie)
549ef70b0bdSTony Lindgren {
550ef70b0bdSTony Lindgren 	if (!cookie->data)
551ef70b0bdSTony Lindgren 		return -EINVAL;
552ef70b0bdSTony Lindgren 
553ef70b0bdSTony Lindgren 	return omap_hwmod_shutdown(cookie->data);
554ef70b0bdSTony Lindgren }
555ef70b0bdSTony Lindgren 
556ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[];
557ef70b0bdSTony Lindgren 
558ef70b0bdSTony Lindgren static struct ti_sysc_platform_data ti_sysc_pdata = {
559ef70b0bdSTony Lindgren 	.auxdata = omap_auxdata_lookup,
5602b2f7defSTony Lindgren 	.init_clockdomain = ti_sysc_clkdm_init,
5612b2f7defSTony Lindgren 	.clkdm_deny_idle = ti_sysc_clkdm_deny_idle,
5622b2f7defSTony Lindgren 	.clkdm_allow_idle = ti_sysc_clkdm_allow_idle,
563695eea3dSTony Lindgren 	.init_module = omap_hwmod_init_module,
564ef70b0bdSTony Lindgren 	.enable_module = ti_sysc_enable_module,
565ef70b0bdSTony Lindgren 	.idle_module = ti_sysc_idle_module,
566ef70b0bdSTony Lindgren 	.shutdown_module = ti_sysc_shutdown_module,
567ef70b0bdSTony Lindgren };
568ef70b0bdSTony Lindgren 
56930a69ef7STony Lindgren static struct pcs_pdata pcs_pdata;
57030a69ef7STony Lindgren 
57130a69ef7STony Lindgren void omap_pcs_legacy_init(int irq, void (*rearm)(void))
57230a69ef7STony Lindgren {
57330a69ef7STony Lindgren 	pcs_pdata.irq = irq;
57430a69ef7STony Lindgren 	pcs_pdata.rearm = rearm;
57530a69ef7STony Lindgren }
57630a69ef7STony Lindgren 
577036582f7STony Lindgren /*
578dad12d11STony Lindgren  * GPIOs for TWL are initialized by the I2C bus and need custom
579dad12d11STony Lindgren  * handing until DSS has device tree bindings.
580dad12d11STony Lindgren  */
581dad12d11STony Lindgren void omap_auxdata_legacy_init(struct device *dev)
582dad12d11STony Lindgren {
583dad12d11STony Lindgren 	if (dev->platform_data)
584dad12d11STony Lindgren 		return;
585dad12d11STony Lindgren 
586dad12d11STony Lindgren 	if (strcmp("twl4030-gpio", dev_name(dev)))
587dad12d11STony Lindgren 		return;
588dad12d11STony Lindgren 
589dad12d11STony Lindgren 	dev->platform_data = &twl_gpio_auxdata;
590dad12d11STony Lindgren }
591dad12d11STony Lindgren 
592558eb0bfSPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
593c26c84c9SPeter Ujfalusi static struct omap_mcbsp_platform_data mcbsp_pdata;
594c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void)
595c26c84c9SPeter Ujfalusi {
596c26c84c9SPeter Ujfalusi 	omap3_mcbsp_init_pdata_callback(&mcbsp_pdata);
597c26c84c9SPeter Ujfalusi }
598c26c84c9SPeter Ujfalusi #else
599c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void) {}
600c26c84c9SPeter Ujfalusi #endif
601c26c84c9SPeter Ujfalusi 
602dad12d11STony Lindgren /*
603036582f7STony Lindgren  * Few boards still need auxdata populated before we populate
604036582f7STony Lindgren  * the dev entries in of_platform_populate().
605036582f7STony Lindgren  */
606036582f7STony Lindgren static struct pdata_init auxdata_quirks[] __initdata = {
607fa590c92STony Lindgren #ifdef CONFIG_SOC_OMAP2420
608fa590c92STony Lindgren 	{ "nokia,n800", omap2420_n8x0_legacy_init, },
609fa590c92STony Lindgren 	{ "nokia,n810", omap2420_n8x0_legacy_init, },
610fa590c92STony Lindgren 	{ "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
611fa590c92STony Lindgren #endif
6120f0cfc69STony Lindgren #ifdef CONFIG_ARCH_OMAP3
6130f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
6140f0cfc69STony Lindgren #endif
615036582f7STony Lindgren 	{ /* sentinel */ },
616036582f7STony Lindgren };
617036582f7STony Lindgren 
618d060b405STony Lindgren struct omap_sr_data __maybe_unused omap_sr_pdata[OMAP_SR_NR];
619d060b405STony Lindgren 
620ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[] = {
621036582f7STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
622036582f7STony Lindgren 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
623e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
624e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
625036582f7STony Lindgren #endif
62630a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP3
627910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
628910f1678SSuman Anna 		       &omap3_iommu_pdata),
629*0af3e1a4SSuman Anna 	OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu",
630*0af3e1a4SSuman Anna 		       &omap3_iommu_isp_pdata),
631d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
632d060b405STony Lindgren 		       "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
633d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
634d060b405STony Lindgren 		       "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
63510c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
63610c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
63771900314STony Lindgren 	/* Only on am3517 */
63871900314STony Lindgren 	OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
63971900314STony Lindgren 	OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
64071900314STony Lindgren 		       &am35xx_emac_pdata),
641c26c84c9SPeter Ujfalusi 	/* McBSP modules with sidetone core */
642558eb0bfSPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
643c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
644c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata),
645c26c84c9SPeter Ujfalusi #endif
64630a69ef7STony Lindgren #endif
6476da74c54SDave Gerlach #ifdef CONFIG_SOC_AM33XX
6486da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
6496da74c54SDave Gerlach 		       &wkup_m3_data),
6506da74c54SDave Gerlach #endif
651dbbe9770SKeerthy #ifdef CONFIG_SOC_AM43XX
6526da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
6536da74c54SDave Gerlach 		       &wkup_m3_data),
654dbbe9770SKeerthy #endif
65567eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
656910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
657910f1678SSuman Anna 		       &omap4_iommu_pdata),
658910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
659910f1678SSuman Anna 		       &omap4_iommu_pdata),
660d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000,
661d060b405STony Lindgren 		       "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]),
662d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000,
663d060b405STony Lindgren 		       "4a0dd000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
664d060b405STony Lindgren 	OF_DEV_AUXDATA("ti,omap4-smartreflex-mpu", 0x4a0d9000,
665d060b405STony Lindgren 		       "4a0d9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
66630a69ef7STony Lindgren #endif
667fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
668fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x4809c000, "4809c000.mmc",
669fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc1),
670fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480b4000, "480b4000.mmc",
671fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc2),
672fc66ce0bSSekhar Nori 	OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480ad000, "480ad000.mmc",
673fc66ce0bSSekhar Nori 		       &dra7_hsmmc_data_mmc3),
674fc66ce0bSSekhar Nori #endif
675d4f414e5STony Lindgren 	/* Common auxdata */
676ef70b0bdSTony Lindgren 	OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
677d4f414e5STony Lindgren 	OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
6788651bd8cSTony Lindgren 	{ /* sentinel */ },
6798651bd8cSTony Lindgren };
6808651bd8cSTony Lindgren 
681036582f7STony Lindgren /*
682036582f7STony Lindgren  * Few boards still need to initialize some legacy devices with
683036582f7STony Lindgren  * platform data until the drivers support device tree.
684036582f7STony Lindgren  */
6856a08e1e6STony Lindgren static struct pdata_init pdata_quirks[] __initdata = {
686faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
687fb45105aSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, },
68840ecc02eSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, },
6890f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
690deff82e6SSebastian Reichel 	{ "nokia,omap3-n900", nokia_n900_legacy_init, },
691faf4bd47SAaro Koskinen 	{ "nokia,omap3-n9", hsmmc2_internal_input_clk, },
692faf4bd47SAaro Koskinen 	{ "nokia,omap3-n950", hsmmc2_internal_input_clk, },
693d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
694d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
695485fa126SAdam Ford 	{ "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, },
69679b39f79STony Lindgren 	{ "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
69771900314STony Lindgren 	{ "ti,am3517-evm", am3517_evm_legacy_init, },
69863dd5bc0SStefan Roese 	{ "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
699fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
700fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
701faf4bd47SAaro Koskinen #endif
7023e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
7033e7a3185STony Lindgren 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
7043e7a3185STony Lindgren #endif
705fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX
706fc66ce0bSSekhar Nori 	{ "ti,dra7-evm", dra7x_evm_mmc_quirk, },
707fc66ce0bSSekhar Nori #endif
7086a08e1e6STony Lindgren 	{ /* sentinel */ },
7096a08e1e6STony Lindgren };
7106a08e1e6STony Lindgren 
711036582f7STony Lindgren static void pdata_quirks_check(struct pdata_init *quirks)
7126a08e1e6STony Lindgren {
7136a08e1e6STony Lindgren 	while (quirks->compatible) {
7146a08e1e6STony Lindgren 		if (of_machine_is_compatible(quirks->compatible)) {
7156a08e1e6STony Lindgren 			if (quirks->fn)
7166a08e1e6STony Lindgren 				quirks->fn();
7176a08e1e6STony Lindgren 		}
7186a08e1e6STony Lindgren 		quirks++;
7196a08e1e6STony Lindgren 	}
7206a08e1e6STony Lindgren }
721036582f7STony Lindgren 
72231957609SUwe Kleine-König void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
723036582f7STony Lindgren {
72457df5380STony Lindgren 	/*
72557df5380STony Lindgren 	 * We still need this for omap2420 and omap3 PM to work, others are
72657df5380STony Lindgren 	 * using drivers/misc/sram.c already.
72757df5380STony Lindgren 	 */
72857df5380STony Lindgren 	if (of_machine_is_compatible("ti,omap2420") ||
72957df5380STony Lindgren 	    of_machine_is_compatible("ti,omap3"))
730036582f7STony Lindgren 		omap_sdrc_init(NULL, NULL);
73157df5380STony Lindgren 
732c26c84c9SPeter Ujfalusi 	if (of_machine_is_compatible("ti,omap3"))
733c26c84c9SPeter Ujfalusi 		omap3_mcbsp_init();
734036582f7STony Lindgren 	pdata_quirks_check(auxdata_quirks);
735036582f7STony Lindgren 	of_platform_populate(NULL, omap_dt_match_table,
736036582f7STony Lindgren 			     omap_auxdata_lookup, NULL);
737036582f7STony Lindgren 	pdata_quirks_check(pdata_quirks);
738036582f7STony Lindgren }
739