2 * Legacy platform_data quirks
4 * Copyright (C) 2013 Texas Instruments
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #include <linux/clk.h>
11 #include <linux/gpio.h>
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/of_platform.h>
15 #include <linux/wl12xx.h>
18 #include "common-board-devices.h"
19 #include "dss-common.h"
23 const char *compatible;
28 * Create alias for USB host PHY clock.
29 * Remove this when clock phandle can be provided via DT
31 static void __init __used legacy_init_ehci_clk(char *clkname)
35 ret = clk_add_alias("main_clk", NULL, clkname, NULL);
37 pr_err("%s:Failed to add main_clk alias to %s :%d\n",
38 __func__, clkname, ret);
41 #if IS_ENABLED(CONFIG_WL12XX)
43 static struct wl12xx_platform_data wl12xx __initdata;
45 static void __init __used legacy_init_wl12xx(unsigned ref_clock,
51 wl12xx.board_ref_clock = ref_clock;
52 wl12xx.board_tcxo_clock = tcxo_clock;
53 wl12xx.irq = gpio_to_irq(gpio);
55 res = wl12xx_set_platform_data(&wl12xx);
57 pr_err("error setting wl12xx data: %d\n", res);
62 static inline void legacy_init_wl12xx(unsigned ref_clock,
69 #ifdef CONFIG_ARCH_OMAP3
70 static void __init hsmmc2_internal_input_clk(void)
74 reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
75 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
76 omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
79 static void __init omap3_igep0020_legacy_init(void)
81 omap3_igep2_display_init_of();
83 #endif /* CONFIG_ARCH_OMAP3 */
85 #ifdef CONFIG_ARCH_OMAP4
86 static void __init omap4_sdp_legacy_init(void)
88 omap_4430sdp_display_init_of();
89 legacy_init_wl12xx(WL12XX_REFCLOCK_26,
90 WL12XX_TCXOCLOCK_26, 53);
93 static void __init omap4_panda_legacy_init(void)
95 omap4_panda_display_init_of();
96 legacy_init_ehci_clk("auxclk3_ck");
97 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
101 #ifdef CONFIG_SOC_OMAP5
102 static void __init omap5_uevm_legacy_init(void)
104 legacy_init_ehci_clk("auxclk1_ck");
108 struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
112 static struct pdata_init pdata_quirks[] __initdata = {
113 #ifdef CONFIG_ARCH_OMAP3
114 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
115 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
116 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
118 #ifdef CONFIG_ARCH_OMAP4
119 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
120 { "ti,omap4-panda", omap4_panda_legacy_init, },
122 #ifdef CONFIG_SOC_OMAP5
123 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
128 void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
130 struct pdata_init *quirks = pdata_quirks;
132 omap_sdrc_init(NULL, NULL);
133 of_platform_populate(NULL, omap_dt_match_table,
134 omap_auxdata_lookup, NULL);
136 while (quirks->compatible) {
137 if (of_machine_is_compatible(quirks->compatible)) {