xref: /linux/arch/arm/mach-omap2/pdata-quirks.c (revision c26c84c92ba8907402faaab760dc0e4ecec89dd0)
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>
16d565b5f4SEnric Balletbo i Serra #include <linux/ti_wilink_st.h>
17f9d50fefSGrazvydas Ignotas #include <linux/wl12xx.h>
18f9d50fefSGrazvydas Ignotas #include <linux/mmc/card.h>
19f9d50fefSGrazvydas Ignotas #include <linux/mmc/host.h>
20f9d50fefSGrazvydas Ignotas #include <linux/regulator/machine.h>
21f9d50fefSGrazvydas Ignotas #include <linux/regulator/fixed.h>
226a08e1e6STony Lindgren 
2330a69ef7STony Lindgren #include <linux/platform_data/pinctrl-single.h>
2410c1f7d3STony Lindgren #include <linux/platform_data/hsmmc-omap.h>
25910f1678SSuman Anna #include <linux/platform_data/iommu-omap.h>
266da74c54SDave Gerlach #include <linux/platform_data/wkup_m3.h>
2720437f79SNeil Armstrong #include <linux/platform_data/pwm_omap_dmtimer.h>
288453c5caSTony Lindgren #include <linux/platform_data/media/ir-rx51.h>
29*c26c84c9SPeter Ujfalusi #include <linux/platform_data/asoc-ti-mcbsp.h>
3020437f79SNeil Armstrong #include <plat/dmtimer.h>
3130a69ef7STony Lindgren 
326a08e1e6STony Lindgren #include "common.h"
336a08e1e6STony Lindgren #include "common-board-devices.h"
346a08e1e6STony Lindgren #include "dss-common.h"
35faf4bd47SAaro Koskinen #include "control.h"
36910f1678SSuman Anna #include "omap_device.h"
378453c5caSTony Lindgren #include "omap-pm.h"
38deff82e6SSebastian Reichel #include "omap-secure.h"
39deff82e6SSebastian Reichel #include "soc.h"
40f9d50fefSGrazvydas Ignotas #include "hsmmc.h"
416a08e1e6STony Lindgren 
4210c1f7d3STony Lindgren static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
4310c1f7d3STony Lindgren 
446a08e1e6STony Lindgren struct pdata_init {
456a08e1e6STony Lindgren 	const char *compatible;
466a08e1e6STony Lindgren 	void (*fn)(void);
476a08e1e6STony Lindgren };
486a08e1e6STony Lindgren 
49f734a9b3SSekhar Nori static struct of_dev_auxdata omap_auxdata_lookup[];
50dad12d11STony Lindgren static struct twl4030_gpio_platform_data twl_gpio_auxdata;
51fa590c92STony Lindgren 
52fa590c92STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
53fa590c92STony Lindgren static void __init omap2420_n8x0_legacy_init(void)
54fa590c92STony Lindgren {
55fa590c92STony Lindgren 	omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
56fa590c92STony Lindgren }
57fa590c92STony Lindgren #else
58fa590c92STony Lindgren #define omap2420_n8x0_legacy_init	NULL
59fa590c92STony Lindgren #endif
60fa590c92STony Lindgren 
61faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
62b96b332fSTony Lindgren /*
63b96b332fSTony Lindgren  * Configures GPIOs 126, 127 and 129 to 1.8V mode instead of 3.0V
64b96b332fSTony Lindgren  * mode for MMC1 in case bootloader did not configure things.
65b96b332fSTony Lindgren  * Note that if the pins are used for MMC1, pbias-regulator
66b96b332fSTony Lindgren  * manages the IO voltage.
67b96b332fSTony Lindgren  */
68b96b332fSTony Lindgren static void __init omap3_gpio126_127_129(void)
69b96b332fSTony Lindgren {
70b96b332fSTony Lindgren 	u32 reg;
71b96b332fSTony Lindgren 
72b96b332fSTony Lindgren 	reg = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
73b96b332fSTony Lindgren 	reg &= ~OMAP343X_PBIASLITEVMODE1;
74b96b332fSTony Lindgren 	reg |= OMAP343X_PBIASLITEPWRDNZ1;
75b96b332fSTony Lindgren 	omap_ctrl_writel(reg, OMAP343X_CONTROL_PBIAS_LITE);
76b96b332fSTony Lindgren 	if (cpu_is_omap3630()) {
77b96b332fSTony Lindgren 		reg = omap_ctrl_readl(OMAP34XX_CONTROL_WKUP_CTRL);
78b96b332fSTony Lindgren 		reg |= OMAP36XX_GPIO_IO_PWRDNZ;
79b96b332fSTony Lindgren 		omap_ctrl_writel(reg, OMAP34XX_CONTROL_WKUP_CTRL);
80b96b332fSTony Lindgren 	}
81b96b332fSTony Lindgren }
82b96b332fSTony Lindgren 
83faf4bd47SAaro Koskinen static void __init hsmmc2_internal_input_clk(void)
84faf4bd47SAaro Koskinen {
85faf4bd47SAaro Koskinen 	u32 reg;
86faf4bd47SAaro Koskinen 
87faf4bd47SAaro Koskinen 	reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
88faf4bd47SAaro Koskinen 	reg |= OMAP2_MMCSDIO2ADPCLKISEL;
89faf4bd47SAaro Koskinen 	omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
90faf4bd47SAaro Koskinen }
9115c9887eSJavier Martinez Canillas 
92910f1678SSuman Anna static struct iommu_platform_data omap3_iommu_pdata = {
93910f1678SSuman Anna 	.reset_name = "mmu",
94910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
95910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
96910f1678SSuman Anna };
97910f1678SSuman Anna 
980f0cfc69STony Lindgren static int omap3_sbc_t3730_twl_callback(struct device *dev,
990f0cfc69STony Lindgren 					   unsigned gpio,
1000f0cfc69STony Lindgren 					   unsigned ngpio)
1010f0cfc69STony Lindgren {
1020f0cfc69STony Lindgren 	int res;
1030f0cfc69STony Lindgren 
1040f0cfc69STony Lindgren 	res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
105d234e423SDmitry Lifshitz 			       "wlan pwr");
1060f0cfc69STony Lindgren 	if (res)
1070f0cfc69STony Lindgren 		return res;
1080f0cfc69STony Lindgren 
1090f0cfc69STony Lindgren 	gpio_export(gpio, 0);
1100f0cfc69STony Lindgren 
1110f0cfc69STony Lindgren 	return 0;
1120f0cfc69STony Lindgren }
1130f0cfc69STony Lindgren 
114b62d91e5SDmitry Lifshitz static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
115b62d91e5SDmitry Lifshitz {
116b62d91e5SDmitry Lifshitz 	int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
117b62d91e5SDmitry Lifshitz 
118b62d91e5SDmitry Lifshitz 	if (err) {
119b62d91e5SDmitry Lifshitz 		pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
120b62d91e5SDmitry Lifshitz 			hub_name, err);
121b62d91e5SDmitry Lifshitz 		return;
122b62d91e5SDmitry Lifshitz 	}
123b62d91e5SDmitry Lifshitz 
124b62d91e5SDmitry Lifshitz 	gpio_export(gpio, 0);
125b62d91e5SDmitry Lifshitz 
126b62d91e5SDmitry Lifshitz 	udelay(10);
127b62d91e5SDmitry Lifshitz 	gpio_set_value(gpio, 1);
128b62d91e5SDmitry Lifshitz 	msleep(1);
129b62d91e5SDmitry Lifshitz }
130b62d91e5SDmitry Lifshitz 
1310f0cfc69STony Lindgren static void __init omap3_sbc_t3730_twl_init(void)
1320f0cfc69STony Lindgren {
1330f0cfc69STony Lindgren 	twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
1340f0cfc69STony Lindgren }
1350f0cfc69STony Lindgren 
1360f0cfc69STony Lindgren static void __init omap3_sbc_t3730_legacy_init(void)
1370f0cfc69STony Lindgren {
138b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
1390f0cfc69STony Lindgren }
1400f0cfc69STony Lindgren 
14140ecc02eSDmitry Lifshitz static void __init omap3_sbc_t3530_legacy_init(void)
14240ecc02eSDmitry Lifshitz {
143b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
14440ecc02eSDmitry Lifshitz }
14540ecc02eSDmitry Lifshitz 
146f734a9b3SSekhar Nori static struct ti_st_plat_data wilink_pdata = {
147d565b5f4SEnric Balletbo i Serra 	.nshutdown_gpio = 137,
148d565b5f4SEnric Balletbo i Serra 	.dev_name = "/dev/ttyO1",
149d565b5f4SEnric Balletbo i Serra 	.flow_cntrl = 1,
150d565b5f4SEnric Balletbo i Serra 	.baud_rate = 300000,
151d565b5f4SEnric Balletbo i Serra };
152d565b5f4SEnric Balletbo i Serra 
153d565b5f4SEnric Balletbo i Serra static struct platform_device wl18xx_device = {
154d565b5f4SEnric Balletbo i Serra 	.name	= "kim",
155d565b5f4SEnric Balletbo i Serra 	.id	= -1,
156d565b5f4SEnric Balletbo i Serra 	.dev	= {
157d565b5f4SEnric Balletbo i Serra 		.platform_data = &wilink_pdata,
158d565b5f4SEnric Balletbo i Serra 	}
159d565b5f4SEnric Balletbo i Serra };
160d565b5f4SEnric Balletbo i Serra 
161485fa126SAdam Ford static struct ti_st_plat_data wilink7_pdata = {
162485fa126SAdam Ford 	.nshutdown_gpio = 162,
163485fa126SAdam Ford 	.dev_name = "/dev/ttyO1",
164485fa126SAdam Ford 	.flow_cntrl = 1,
165485fa126SAdam Ford 	.baud_rate = 300000,
166485fa126SAdam Ford };
167485fa126SAdam Ford 
168485fa126SAdam Ford static struct platform_device wl128x_device = {
169485fa126SAdam Ford 	.name	= "kim",
170485fa126SAdam Ford 	.id	= -1,
171485fa126SAdam Ford 	.dev	= {
172485fa126SAdam Ford 		.platform_data = &wilink7_pdata,
173485fa126SAdam Ford 	}
174485fa126SAdam Ford };
175485fa126SAdam Ford 
176d565b5f4SEnric Balletbo i Serra static struct platform_device btwilink_device = {
177d565b5f4SEnric Balletbo i Serra 	.name	= "btwilink",
178d565b5f4SEnric Balletbo i Serra 	.id	= -1,
179d565b5f4SEnric Balletbo i Serra };
180d565b5f4SEnric Balletbo i Serra 
181d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0020_rev_f_legacy_init(void)
18215c9887eSJavier Martinez Canillas {
183d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
184d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
185d565b5f4SEnric Balletbo i Serra }
186d565b5f4SEnric Balletbo i Serra 
187d565b5f4SEnric Balletbo i Serra static void __init omap3_igep0030_rev_g_legacy_init(void)
188d565b5f4SEnric Balletbo i Serra {
189d565b5f4SEnric Balletbo i Serra 	platform_device_register(&wl18xx_device);
190d565b5f4SEnric Balletbo i Serra 	platform_device_register(&btwilink_device);
19115c9887eSJavier Martinez Canillas }
19279b39f79STony Lindgren 
19379b39f79STony Lindgren static void __init omap3_evm_legacy_init(void)
19479b39f79STony Lindgren {
1955b7610f2STony Lindgren 	hsmmc2_internal_input_clk();
19679b39f79STony Lindgren }
19771900314STony Lindgren 
19871900314STony Lindgren static void am35xx_enable_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 	      AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
20571900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
20671900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
20771900314STony Lindgren }
20871900314STony Lindgren 
20971900314STony Lindgren static void am35xx_disable_emac_int(void)
21071900314STony Lindgren {
21171900314STony Lindgren 	u32 v;
21271900314STony Lindgren 
21371900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
21471900314STony Lindgren 	v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
21571900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
21671900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
21771900314STony Lindgren }
21871900314STony Lindgren 
21971900314STony Lindgren static struct emac_platform_data am35xx_emac_pdata = {
22071900314STony Lindgren 	.interrupt_enable	= am35xx_enable_emac_int,
22171900314STony Lindgren 	.interrupt_disable	= am35xx_disable_emac_int,
22271900314STony Lindgren };
22371900314STony Lindgren 
224fb45105aSDmitry Lifshitz static void __init am35xx_emac_reset(void)
22571900314STony Lindgren {
22671900314STony Lindgren 	u32 v;
22771900314STony Lindgren 
22871900314STony Lindgren 	v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
22971900314STony Lindgren 	v &= ~AM35XX_CPGMACSS_SW_RST;
23071900314STony Lindgren 	omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
23171900314STony Lindgren 	omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
23271900314STony Lindgren }
233deff82e6SSebastian Reichel 
234fb45105aSDmitry Lifshitz static struct gpio cm_t3517_wlan_gpios[] __initdata = {
235fb45105aSDmitry Lifshitz 	{ 56,	GPIOF_OUT_INIT_HIGH,	"wlan pwr" },
236fb45105aSDmitry Lifshitz 	{ 4,	GPIOF_OUT_INIT_HIGH,	"xcvr noe" },
237fb45105aSDmitry Lifshitz };
238fb45105aSDmitry Lifshitz 
239fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_wifi_init(void)
240fb45105aSDmitry Lifshitz {
241fb45105aSDmitry Lifshitz 	int err = gpio_request_array(cm_t3517_wlan_gpios,
242fb45105aSDmitry Lifshitz 				ARRAY_SIZE(cm_t3517_wlan_gpios));
243fb45105aSDmitry Lifshitz 	if (err) {
244fb45105aSDmitry Lifshitz 		pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
245fb45105aSDmitry Lifshitz 		return;
246fb45105aSDmitry Lifshitz 	}
247fb45105aSDmitry Lifshitz 
248fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[0].gpio, 0);
249fb45105aSDmitry Lifshitz 	gpio_export(cm_t3517_wlan_gpios[1].gpio, 0);
250fb45105aSDmitry Lifshitz 
251fb45105aSDmitry Lifshitz 	msleep(100);
252fb45105aSDmitry Lifshitz 	gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
253fb45105aSDmitry Lifshitz }
254fb45105aSDmitry Lifshitz 
255fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_legacy_init(void)
256fb45105aSDmitry Lifshitz {
257b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
258b62d91e5SDmitry Lifshitz 	omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
259fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
260fb45105aSDmitry Lifshitz 	hsmmc2_internal_input_clk();
261fb45105aSDmitry Lifshitz 	omap3_sbc_t3517_wifi_init();
262fb45105aSDmitry Lifshitz }
263fb45105aSDmitry Lifshitz 
264fb45105aSDmitry Lifshitz static void __init am3517_evm_legacy_init(void)
265fb45105aSDmitry Lifshitz {
266fb45105aSDmitry Lifshitz 	am35xx_emac_reset();
267fb45105aSDmitry Lifshitz }
268f83ccb93SLinus Torvalds 
26914c0a5b4SSebastian Reichel static struct platform_device omap3_rom_rng_device = {
27014c0a5b4SSebastian Reichel 	.name		= "omap3-rom-rng",
27114c0a5b4SSebastian Reichel 	.id		= -1,
27214c0a5b4SSebastian Reichel 	.dev	= {
27314c0a5b4SSebastian Reichel 		.platform_data	= rx51_secure_rng_call,
27414c0a5b4SSebastian Reichel 	},
27514c0a5b4SSebastian Reichel };
27614c0a5b4SSebastian Reichel 
2778453c5caSTony Lindgren static struct platform_device rx51_lirc_device;
2788453c5caSTony Lindgren 
279deff82e6SSebastian Reichel static void __init nokia_n900_legacy_init(void)
280deff82e6SSebastian Reichel {
281deff82e6SSebastian Reichel 	hsmmc2_internal_input_clk();
28210c1f7d3STony Lindgren 	mmc_pdata[0].name = "external";
28310c1f7d3STony Lindgren 	mmc_pdata[1].name = "internal";
284deff82e6SSebastian Reichel 
285deff82e6SSebastian Reichel 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
286deff82e6SSebastian Reichel 		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
287deff82e6SSebastian Reichel 			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
288deff82e6SSebastian Reichel 			/* set IBE to 1 */
289deff82e6SSebastian Reichel 			rx51_secure_update_aux_cr(BIT(6), 0);
290deff82e6SSebastian Reichel 		} else {
2913d0cb73eSJoe Perches 			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
2923d0cb73eSJoe Perches 			pr_warn("Thumb binaries may crash randomly without this workaround\n");
293deff82e6SSebastian Reichel 		}
29414c0a5b4SSebastian Reichel 
295448f8bc6SAaro Koskinen 		pr_info("RX-51: Registering OMAP3 HWRNG device\n");
29614c0a5b4SSebastian Reichel 		platform_device_register(&omap3_rom_rng_device);
29714c0a5b4SSebastian Reichel 
298deff82e6SSebastian Reichel 	}
2998453c5caSTony Lindgren 
3008453c5caSTony Lindgren 	platform_device_register(&rx51_lirc_device);
301deff82e6SSebastian Reichel }
30263dd5bc0SStefan Roese 
30363dd5bc0SStefan Roese static void __init omap3_tao3530_legacy_init(void)
30463dd5bc0SStefan Roese {
30563dd5bc0SStefan Roese 	hsmmc2_internal_input_clk();
306faf4bd47SAaro Koskinen }
307fc53e2ccSGrazvydas Ignotas 
308485fa126SAdam Ford static void __init omap3_logicpd_torpedo_init(void)
309485fa126SAdam Ford {
310485fa126SAdam Ford 	omap3_gpio126_127_129();
311485fa126SAdam Ford 	platform_device_register(&wl128x_device);
312485fa126SAdam Ford 	platform_device_register(&btwilink_device);
313485fa126SAdam Ford }
314485fa126SAdam Ford 
315f9d50fefSGrazvydas Ignotas /* omap3pandora legacy devices */
316f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_IRQ_GPIO		21
317f9d50fefSGrazvydas Ignotas #define PANDORA_WIFI_NRESET_GPIO	23
318f9d50fefSGrazvydas Ignotas 
319fc53e2ccSGrazvydas Ignotas static struct platform_device pandora_backlight = {
320fc53e2ccSGrazvydas Ignotas 	.name	= "pandora-backlight",
321fc53e2ccSGrazvydas Ignotas 	.id	= -1,
322fc53e2ccSGrazvydas Ignotas };
323fc53e2ccSGrazvydas Ignotas 
324f9d50fefSGrazvydas Ignotas static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
325f9d50fefSGrazvydas Ignotas 	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
326f9d50fefSGrazvydas Ignotas };
327f9d50fefSGrazvydas Ignotas 
328f9d50fefSGrazvydas Ignotas static struct regulator_init_data pandora_vmmc3 = {
329f9d50fefSGrazvydas Ignotas 	.constraints = {
330f9d50fefSGrazvydas Ignotas 		.valid_ops_mask		= REGULATOR_CHANGE_STATUS,
331f9d50fefSGrazvydas Ignotas 	},
332f9d50fefSGrazvydas Ignotas 	.num_consumer_supplies	= ARRAY_SIZE(pandora_vmmc3_supply),
333f9d50fefSGrazvydas Ignotas 	.consumer_supplies	= pandora_vmmc3_supply,
334f9d50fefSGrazvydas Ignotas };
335f9d50fefSGrazvydas Ignotas 
336f9d50fefSGrazvydas Ignotas static struct fixed_voltage_config pandora_vwlan = {
337f9d50fefSGrazvydas Ignotas 	.supply_name		= "vwlan",
338f9d50fefSGrazvydas Ignotas 	.microvolts		= 1800000, /* 1.8V */
339f9d50fefSGrazvydas Ignotas 	.gpio			= PANDORA_WIFI_NRESET_GPIO,
340f9d50fefSGrazvydas Ignotas 	.startup_delay		= 50000, /* 50ms */
341f9d50fefSGrazvydas Ignotas 	.enable_high		= 1,
342f9d50fefSGrazvydas Ignotas 	.init_data		= &pandora_vmmc3,
343f9d50fefSGrazvydas Ignotas };
344f9d50fefSGrazvydas Ignotas 
345f9d50fefSGrazvydas Ignotas static struct platform_device pandora_vwlan_device = {
346f9d50fefSGrazvydas Ignotas 	.name		= "reg-fixed-voltage",
347f9d50fefSGrazvydas Ignotas 	.id		= 1,
348f9d50fefSGrazvydas Ignotas 	.dev = {
349f9d50fefSGrazvydas Ignotas 		.platform_data = &pandora_vwlan,
350f9d50fefSGrazvydas Ignotas 	},
351f9d50fefSGrazvydas Ignotas };
352f9d50fefSGrazvydas Ignotas 
353f9d50fefSGrazvydas Ignotas static void pandora_wl1251_init_card(struct mmc_card *card)
354f9d50fefSGrazvydas Ignotas {
355f9d50fefSGrazvydas Ignotas 	/*
356f9d50fefSGrazvydas Ignotas 	 * We have TI wl1251 attached to MMC3. Pass this information to
357f9d50fefSGrazvydas Ignotas 	 * SDIO core because it can't be probed by normal methods.
358f9d50fefSGrazvydas Ignotas 	 */
359f9d50fefSGrazvydas Ignotas 	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
360f9d50fefSGrazvydas Ignotas 		card->quirks |= MMC_QUIRK_NONSTD_SDIO;
361f9d50fefSGrazvydas Ignotas 		card->cccr.wide_bus = 1;
362f9d50fefSGrazvydas Ignotas 		card->cis.vendor = 0x104c;
363f9d50fefSGrazvydas Ignotas 		card->cis.device = 0x9066;
364f9d50fefSGrazvydas Ignotas 		card->cis.blksize = 512;
365f9d50fefSGrazvydas Ignotas 		card->cis.max_dtr = 24000000;
366f9d50fefSGrazvydas Ignotas 		card->ocr = 0x80;
367f9d50fefSGrazvydas Ignotas 	}
368f9d50fefSGrazvydas Ignotas }
369f9d50fefSGrazvydas Ignotas 
370f9d50fefSGrazvydas Ignotas static struct omap2_hsmmc_info pandora_mmc3[] = {
371f9d50fefSGrazvydas Ignotas 	{
372f9d50fefSGrazvydas Ignotas 		.mmc		= 3,
373f9d50fefSGrazvydas Ignotas 		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
374f9d50fefSGrazvydas Ignotas 		.gpio_cd	= -EINVAL,
375f9d50fefSGrazvydas Ignotas 		.gpio_wp	= -EINVAL,
376f9d50fefSGrazvydas Ignotas 		.init_card	= pandora_wl1251_init_card,
377f9d50fefSGrazvydas Ignotas 	},
378f9d50fefSGrazvydas Ignotas 	{}	/* Terminator */
379f9d50fefSGrazvydas Ignotas };
380f9d50fefSGrazvydas Ignotas 
381f9d50fefSGrazvydas Ignotas static void __init pandora_wl1251_init(void)
382f9d50fefSGrazvydas Ignotas {
383f9d50fefSGrazvydas Ignotas 	struct wl1251_platform_data pandora_wl1251_pdata;
384f9d50fefSGrazvydas Ignotas 	int ret;
385f9d50fefSGrazvydas Ignotas 
386f9d50fefSGrazvydas Ignotas 	memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
387f9d50fefSGrazvydas Ignotas 
388f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.power_gpio = -1;
389f9d50fefSGrazvydas Ignotas 
390f9d50fefSGrazvydas Ignotas 	ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
391f9d50fefSGrazvydas Ignotas 	if (ret < 0)
392f9d50fefSGrazvydas Ignotas 		goto fail;
393f9d50fefSGrazvydas Ignotas 
394f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
395f9d50fefSGrazvydas Ignotas 	if (pandora_wl1251_pdata.irq < 0)
396f9d50fefSGrazvydas Ignotas 		goto fail_irq;
397f9d50fefSGrazvydas Ignotas 
398f9d50fefSGrazvydas Ignotas 	pandora_wl1251_pdata.use_eeprom = true;
399f9d50fefSGrazvydas Ignotas 	ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
400f9d50fefSGrazvydas Ignotas 	if (ret < 0)
401f9d50fefSGrazvydas Ignotas 		goto fail_irq;
402f9d50fefSGrazvydas Ignotas 
403f9d50fefSGrazvydas Ignotas 	return;
404f9d50fefSGrazvydas Ignotas 
405f9d50fefSGrazvydas Ignotas fail_irq:
406f9d50fefSGrazvydas Ignotas 	gpio_free(PANDORA_WIFI_IRQ_GPIO);
407f9d50fefSGrazvydas Ignotas fail:
408f9d50fefSGrazvydas Ignotas 	pr_err("wl1251 board initialisation failed\n");
409f9d50fefSGrazvydas Ignotas }
410f9d50fefSGrazvydas Ignotas 
411fc53e2ccSGrazvydas Ignotas static void __init omap3_pandora_legacy_init(void)
412fc53e2ccSGrazvydas Ignotas {
413fc53e2ccSGrazvydas Ignotas 	platform_device_register(&pandora_backlight);
414f9d50fefSGrazvydas Ignotas 	platform_device_register(&pandora_vwlan_device);
415f9d50fefSGrazvydas Ignotas 	omap_hsmmc_init(pandora_mmc3);
416f9d50fefSGrazvydas Ignotas 	omap_hsmmc_late_init(pandora_mmc3);
417f9d50fefSGrazvydas Ignotas 	pandora_wl1251_init();
418fc53e2ccSGrazvydas Ignotas }
419faf4bd47SAaro Koskinen #endif /* CONFIG_ARCH_OMAP3 */
420faf4bd47SAaro Koskinen 
42167eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
422910f1678SSuman Anna static struct iommu_platform_data omap4_iommu_pdata = {
423910f1678SSuman Anna 	.reset_name = "mmu_cache",
424910f1678SSuman Anna 	.assert_reset = omap_device_assert_hardreset,
425910f1678SSuman Anna 	.deassert_reset = omap_device_deassert_hardreset,
426910f1678SSuman Anna };
4273e7a3185STony Lindgren #endif
4283e7a3185STony Lindgren 
4296da74c54SDave Gerlach #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
4306da74c54SDave Gerlach static struct wkup_m3_platform_data wkup_m3_data = {
4316da74c54SDave Gerlach 	.reset_name = "wkup_m3",
4326da74c54SDave Gerlach 	.assert_reset = omap_device_assert_hardreset,
4336da74c54SDave Gerlach 	.deassert_reset = omap_device_deassert_hardreset,
4346da74c54SDave Gerlach };
4356da74c54SDave Gerlach #endif
4366da74c54SDave Gerlach 
4373e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
4383e7a3185STony Lindgren static void __init omap5_uevm_legacy_init(void)
4393e7a3185STony Lindgren {
4403e7a3185STony Lindgren }
4413e7a3185STony Lindgren #endif
4423e7a3185STony Lindgren 
44330a69ef7STony Lindgren static struct pcs_pdata pcs_pdata;
44430a69ef7STony Lindgren 
44530a69ef7STony Lindgren void omap_pcs_legacy_init(int irq, void (*rearm)(void))
44630a69ef7STony Lindgren {
44730a69ef7STony Lindgren 	pcs_pdata.irq = irq;
44830a69ef7STony Lindgren 	pcs_pdata.rearm = rearm;
44930a69ef7STony Lindgren }
45030a69ef7STony Lindgren 
451036582f7STony Lindgren /*
452dad12d11STony Lindgren  * GPIOs for TWL are initialized by the I2C bus and need custom
453dad12d11STony Lindgren  * handing until DSS has device tree bindings.
454dad12d11STony Lindgren  */
455dad12d11STony Lindgren void omap_auxdata_legacy_init(struct device *dev)
456dad12d11STony Lindgren {
457dad12d11STony Lindgren 	if (dev->platform_data)
458dad12d11STony Lindgren 		return;
459dad12d11STony Lindgren 
460dad12d11STony Lindgren 	if (strcmp("twl4030-gpio", dev_name(dev)))
461dad12d11STony Lindgren 		return;
462dad12d11STony Lindgren 
463dad12d11STony Lindgren 	dev->platform_data = &twl_gpio_auxdata;
464dad12d11STony Lindgren }
465dad12d11STony Lindgren 
46620437f79SNeil Armstrong /* Dual mode timer PWM callbacks platdata */
46720437f79SNeil Armstrong #if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
4688453c5caSTony Lindgren static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
46920437f79SNeil Armstrong 	.request_by_node = omap_dm_timer_request_by_node,
4708453c5caSTony Lindgren 	.request_specific = omap_dm_timer_request_specific,
4718453c5caSTony Lindgren 	.request = omap_dm_timer_request,
4728453c5caSTony Lindgren 	.set_source = omap_dm_timer_set_source,
4738453c5caSTony Lindgren 	.get_irq = omap_dm_timer_get_irq,
4748453c5caSTony Lindgren 	.set_int_enable = omap_dm_timer_set_int_enable,
4758453c5caSTony Lindgren 	.set_int_disable = omap_dm_timer_set_int_disable,
47620437f79SNeil Armstrong 	.free = omap_dm_timer_free,
47720437f79SNeil Armstrong 	.enable = omap_dm_timer_enable,
47820437f79SNeil Armstrong 	.disable = omap_dm_timer_disable,
47920437f79SNeil Armstrong 	.get_fclk = omap_dm_timer_get_fclk,
48020437f79SNeil Armstrong 	.start = omap_dm_timer_start,
48120437f79SNeil Armstrong 	.stop = omap_dm_timer_stop,
48220437f79SNeil Armstrong 	.set_load = omap_dm_timer_set_load,
48320437f79SNeil Armstrong 	.set_match = omap_dm_timer_set_match,
48420437f79SNeil Armstrong 	.set_pwm = omap_dm_timer_set_pwm,
48520437f79SNeil Armstrong 	.set_prescaler = omap_dm_timer_set_prescaler,
4868453c5caSTony Lindgren 	.read_counter = omap_dm_timer_read_counter,
48720437f79SNeil Armstrong 	.write_counter = omap_dm_timer_write_counter,
4888453c5caSTony Lindgren 	.read_status = omap_dm_timer_read_status,
4898453c5caSTony Lindgren 	.write_status = omap_dm_timer_write_status,
49020437f79SNeil Armstrong };
49120437f79SNeil Armstrong #endif
49220437f79SNeil Armstrong 
4938453c5caSTony Lindgren static struct lirc_rx51_platform_data __maybe_unused rx51_lirc_data = {
4948453c5caSTony Lindgren 	.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
4958453c5caSTony Lindgren 	.pwm_timer = 9, /* Use GPT 9 for CIR */
4968453c5caSTony Lindgren #if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
4978453c5caSTony Lindgren 	.dmtimer = &pwm_dmtimer_pdata,
4988453c5caSTony Lindgren #endif
4998453c5caSTony Lindgren };
5008453c5caSTony Lindgren 
5018453c5caSTony Lindgren static struct platform_device __maybe_unused rx51_lirc_device = {
5028453c5caSTony Lindgren 	.name           = "lirc_rx51",
5038453c5caSTony Lindgren 	.id             = -1,
5048453c5caSTony Lindgren 	.dev            = {
5058453c5caSTony Lindgren 		.platform_data = &rx51_lirc_data,
5068453c5caSTony Lindgren 	},
5078453c5caSTony Lindgren };
5088453c5caSTony Lindgren 
509*c26c84c9SPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
510*c26c84c9SPeter Ujfalusi static struct omap_mcbsp_platform_data mcbsp_pdata;
511*c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void)
512*c26c84c9SPeter Ujfalusi {
513*c26c84c9SPeter Ujfalusi 	omap3_mcbsp_init_pdata_callback(&mcbsp_pdata);
514*c26c84c9SPeter Ujfalusi }
515*c26c84c9SPeter Ujfalusi #else
516*c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void) {}
517*c26c84c9SPeter Ujfalusi #endif
518*c26c84c9SPeter Ujfalusi 
519dad12d11STony Lindgren /*
520036582f7STony Lindgren  * Few boards still need auxdata populated before we populate
521036582f7STony Lindgren  * the dev entries in of_platform_populate().
522036582f7STony Lindgren  */
523036582f7STony Lindgren static struct pdata_init auxdata_quirks[] __initdata = {
524fa590c92STony Lindgren #ifdef CONFIG_SOC_OMAP2420
525fa590c92STony Lindgren 	{ "nokia,n800", omap2420_n8x0_legacy_init, },
526fa590c92STony Lindgren 	{ "nokia,n810", omap2420_n8x0_legacy_init, },
527fa590c92STony Lindgren 	{ "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
528fa590c92STony Lindgren #endif
5290f0cfc69STony Lindgren #ifdef CONFIG_ARCH_OMAP3
5300f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
5310f0cfc69STony Lindgren #endif
532036582f7STony Lindgren 	{ /* sentinel */ },
533036582f7STony Lindgren };
534036582f7STony Lindgren 
535f734a9b3SSekhar Nori static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
536036582f7STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0
537036582f7STony Lindgren 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
538e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
539e92ce89cSFelipe Balbi 	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
540036582f7STony Lindgren #endif
54130a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP3
542910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
543910f1678SSuman Anna 		       &omap3_iommu_pdata),
54410c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
54510c1f7d3STony Lindgren 	OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
54671900314STony Lindgren 	/* Only on am3517 */
54771900314STony Lindgren 	OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
54871900314STony Lindgren 	OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
54971900314STony Lindgren 		       &am35xx_emac_pdata),
550*c26c84c9SPeter Ujfalusi 	/* McBSP modules with sidetone core */
551*c26c84c9SPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
552*c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
553*c26c84c9SPeter Ujfalusi 	OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata),
554*c26c84c9SPeter Ujfalusi #endif
55530a69ef7STony Lindgren #endif
5566da74c54SDave Gerlach #ifdef CONFIG_SOC_AM33XX
5576da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
5586da74c54SDave Gerlach 		       &wkup_m3_data),
5596da74c54SDave Gerlach #endif
560dbbe9770SKeerthy #ifdef CONFIG_SOC_AM43XX
5616da74c54SDave Gerlach 	OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
5626da74c54SDave Gerlach 		       &wkup_m3_data),
563dbbe9770SKeerthy #endif
56420437f79SNeil Armstrong #if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
56520437f79SNeil Armstrong 	OF_DEV_AUXDATA("ti,omap-dmtimer-pwm", 0, NULL, &pwm_dmtimer_pdata),
56620437f79SNeil Armstrong #endif
56767eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
568910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
569910f1678SSuman Anna 		       &omap4_iommu_pdata),
570910f1678SSuman Anna 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
571910f1678SSuman Anna 		       &omap4_iommu_pdata),
57230a69ef7STony Lindgren #endif
573d4f414e5STony Lindgren 	/* Common auxdata */
574d4f414e5STony Lindgren 	OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
5758651bd8cSTony Lindgren 	{ /* sentinel */ },
5768651bd8cSTony Lindgren };
5778651bd8cSTony Lindgren 
578036582f7STony Lindgren /*
579036582f7STony Lindgren  * Few boards still need to initialize some legacy devices with
580036582f7STony Lindgren  * platform data until the drivers support device tree.
581036582f7STony Lindgren  */
5826a08e1e6STony Lindgren static struct pdata_init pdata_quirks[] __initdata = {
583faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3
584fb45105aSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, },
58540ecc02eSDmitry Lifshitz 	{ "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, },
5860f0cfc69STony Lindgren 	{ "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
587deff82e6SSebastian Reichel 	{ "nokia,omap3-n900", nokia_n900_legacy_init, },
588faf4bd47SAaro Koskinen 	{ "nokia,omap3-n9", hsmmc2_internal_input_clk, },
589faf4bd47SAaro Koskinen 	{ "nokia,omap3-n950", hsmmc2_internal_input_clk, },
590d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
591d565b5f4SEnric Balletbo i Serra 	{ "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
592485fa126SAdam Ford 	{ "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, },
59379b39f79STony Lindgren 	{ "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
59471900314STony Lindgren 	{ "ti,am3517-evm", am3517_evm_legacy_init, },
59563dd5bc0SStefan Roese 	{ "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
596fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
597fc53e2ccSGrazvydas Ignotas 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
598faf4bd47SAaro Koskinen #endif
5993e7a3185STony Lindgren #ifdef CONFIG_SOC_OMAP5
6003e7a3185STony Lindgren 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
6013e7a3185STony Lindgren #endif
6026a08e1e6STony Lindgren 	{ /* sentinel */ },
6036a08e1e6STony Lindgren };
6046a08e1e6STony Lindgren 
605036582f7STony Lindgren static void pdata_quirks_check(struct pdata_init *quirks)
6066a08e1e6STony Lindgren {
6076a08e1e6STony Lindgren 	while (quirks->compatible) {
6086a08e1e6STony Lindgren 		if (of_machine_is_compatible(quirks->compatible)) {
6096a08e1e6STony Lindgren 			if (quirks->fn)
6106a08e1e6STony Lindgren 				quirks->fn();
6116a08e1e6STony Lindgren 			break;
6126a08e1e6STony Lindgren 		}
6136a08e1e6STony Lindgren 		quirks++;
6146a08e1e6STony Lindgren 	}
6156a08e1e6STony Lindgren }
616036582f7STony Lindgren 
61731957609SUwe Kleine-König void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
618036582f7STony Lindgren {
61957df5380STony Lindgren 	/*
62057df5380STony Lindgren 	 * We still need this for omap2420 and omap3 PM to work, others are
62157df5380STony Lindgren 	 * using drivers/misc/sram.c already.
62257df5380STony Lindgren 	 */
62357df5380STony Lindgren 	if (of_machine_is_compatible("ti,omap2420") ||
62457df5380STony Lindgren 	    of_machine_is_compatible("ti,omap3"))
625036582f7STony Lindgren 		omap_sdrc_init(NULL, NULL);
62657df5380STony Lindgren 
627*c26c84c9SPeter Ujfalusi 	if (of_machine_is_compatible("ti,omap3"))
628*c26c84c9SPeter Ujfalusi 		omap3_mcbsp_init();
629036582f7STony Lindgren 	pdata_quirks_check(auxdata_quirks);
630036582f7STony Lindgren 	of_platform_populate(NULL, omap_dt_match_table,
631036582f7STony Lindgren 			     omap_auxdata_lookup, NULL);
632036582f7STony Lindgren 	pdata_quirks_check(pdata_quirks);
633036582f7STony Lindgren }
634