blob: 648d9573aaea7af3bdb16e99ee269032c6ecb813 [file] [log] [blame]
Tony Lindgren6a08e1e2013-09-25 15:44:39 -07001/*
2 * Legacy platform_data quirks
3 *
4 * Copyright (C) 2013 Texas Instruments
5 *
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.
9 */
10#include <linux/clk.h>
11#include <linux/init.h>
12#include <linux/kernel.h>
13
14#include "common.h"
15#include "common-board-devices.h"
16#include "dss-common.h"
17
18struct pdata_init {
19 const char *compatible;
20 void (*fn)(void);
21};
22
Tony Lindgren3e7a3182013-09-25 15:44:39 -070023/*
24 * Create alias for USB host PHY clock.
25 * Remove this when clock phandle can be provided via DT
26 */
27static void __init __used legacy_init_ehci_clk(char *clkname)
28{
29 int ret;
30
31 ret = clk_add_alias("main_clk", NULL, clkname, NULL);
32 if (ret)
33 pr_err("%s:Failed to add main_clk alias to %s :%d\n",
34 __func__, clkname, ret);
35}
36
37#ifdef CONFIG_ARCH_OMAP4
38static void __init omap4_sdp_legacy_init(void)
39{
40 omap_4430sdp_display_init_of();
41}
42
43static void __init omap4_panda_legacy_init(void)
44{
45 omap4_panda_display_init_of();
46 legacy_init_ehci_clk("auxclk3_ck");
47}
48#endif
49
50#ifdef CONFIG_SOC_OMAP5
51static void __init omap5_uevm_legacy_init(void)
52{
53 legacy_init_ehci_clk("auxclk1_ck");
54}
55#endif
56
Tony Lindgren6a08e1e2013-09-25 15:44:39 -070057static struct pdata_init pdata_quirks[] __initdata = {
Tony Lindgren3e7a3182013-09-25 15:44:39 -070058#ifdef CONFIG_ARCH_OMAP4
59 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
60 { "ti,omap4-panda", omap4_panda_legacy_init, },
61#endif
62#ifdef CONFIG_SOC_OMAP5
63 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
64#endif
Tony Lindgren6a08e1e2013-09-25 15:44:39 -070065 { /* sentinel */ },
66};
67
68void __init pdata_quirks_init(void)
69{
70 struct pdata_init *quirks = pdata_quirks;
71
72 while (quirks->compatible) {
73 if (of_machine_is_compatible(quirks->compatible)) {
74 if (quirks->fn)
75 quirks->fn();
76 break;
77 }
78 quirks++;
79 }
80}