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/wl12xx.h>
17 #include "common-board-devices.h"
18 #include "dss-common.h"
22 const char *compatible;
27 * Create alias for USB host PHY clock.
28 * Remove this when clock phandle can be provided via DT
30 static void __init __used legacy_init_ehci_clk(char *clkname)
34 ret = clk_add_alias("main_clk", NULL, clkname, NULL);
36 pr_err("%s:Failed to add main_clk alias to %s :%d\n",
37 __func__, clkname, ret);
40 #if IS_ENABLED(CONFIG_WL12XX)
42 static struct wl12xx_platform_data wl12xx __initdata;
44 static void __init __used legacy_init_wl12xx(unsigned ref_clock,
50 wl12xx.board_ref_clock = ref_clock;
51 wl12xx.board_tcxo_clock = tcxo_clock;
52 wl12xx.irq = gpio_to_irq(gpio);
54 res = wl12xx_set_platform_data(&wl12xx);
56 pr_err("error setting wl12xx data: %d\n", res);
61 static inline void legacy_init_wl12xx(unsigned ref_clock,
68 #ifdef CONFIG_ARCH_OMAP3
69 static void __init hsmmc2_internal_input_clk(void)
73 reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
74 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
75 omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
78 static void __init omap3_igep0020_legacy_init(void)
80 omap3_igep2_display_init_of();
82 #endif /* CONFIG_ARCH_OMAP3 */
84 #ifdef CONFIG_ARCH_OMAP4
85 static void __init omap4_sdp_legacy_init(void)
87 omap_4430sdp_display_init_of();
88 legacy_init_wl12xx(WL12XX_REFCLOCK_26,
89 WL12XX_TCXOCLOCK_26, 53);
92 static void __init omap4_panda_legacy_init(void)
94 omap4_panda_display_init_of();
95 legacy_init_ehci_clk("auxclk3_ck");
96 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
100 #ifdef CONFIG_SOC_OMAP5
101 static void __init omap5_uevm_legacy_init(void)
103 legacy_init_ehci_clk("auxclk1_ck");
107 static struct pdata_init pdata_quirks[] __initdata = {
108 #ifdef CONFIG_ARCH_OMAP3
109 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
110 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
111 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
113 #ifdef CONFIG_ARCH_OMAP4
114 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
115 { "ti,omap4-panda", omap4_panda_legacy_init, },
117 #ifdef CONFIG_SOC_OMAP5
118 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
123 void __init pdata_quirks_init(void)
125 struct pdata_init *quirks = pdata_quirks;
127 while (quirks->compatible) {
128 if (of_machine_is_compatible(quirks->compatible)) {