linux-3.0: fixes
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / omap4 / 0001-OMAP-Fix-linking-error-in-twl-common.c-for-OMAP2-3-4.patch
1 From 7c2058baa279fd309e2773858bc6f176f884ef5c Mon Sep 17 00:00:00 2001
2 From: Peter Ujfalusi <peter.ujfalusi@ti.com>
3 Date: Wed, 17 Aug 2011 16:02:55 +0200
4 Subject: [PATCH] OMAP: Fix linking error in twl-common.c for OMAP2/3/4 only builds
6 Commit b22f954 (OMAP4: Move common twl6030 configuration to twl-common)
7 caused compile failures for code for OMAP arch which is not selected by
8 the config.
10 Fixes issues like:
11 With CONFIG_ARCH_OMAP3=y and CONFIG_ARCH_OMAP4=n, I'm getting this:
13 arch/arm/mach-omap2/built-in.o:(.data+0xf99c): undefined reference to `omap4430_phy_init'
14 arch/arm/mach-omap2/built-in.o:(.data+0xf9a0): undefined reference to `omap4430_phy_exit'
15 arch/arm/mach-omap2/built-in.o:(.data+0xf9a4): undefined reference to `omap4430_phy_power'
16 arch/arm/mach-omap2/built-in.o:(.data+0xf9a8): undefined reference to `omap4430_phy_set_clk'
17 arch/arm/mach-omap2/built-in.o:(.data+0xf9ac): undefined reference to `omap4430_phy_suspend'
19 Fix the problem by moving the code to ifdef sections for omap3 and omap4.
21 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
22 [tony@atomide.com: updated comments]
23 Signed-off-by: Tony Lindgren <tony@atomide.com>
24 ---
25  arch/arm/mach-omap2/twl-common.c |   77 ++++++++++++++++++++------------------
26  1 files changed, 41 insertions(+), 36 deletions(-)
28 diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
29 index 3aaa46f..58409c0 100644
30 --- a/arch/arm/mach-omap2/twl-common.c
31 +++ b/arch/arm/mach-omap2/twl-common.c
32 @@ -48,14 +48,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
33         omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
34  }
35  
36 -static struct twl4030_usb_data omap4_usb_pdata = {
37 -       .phy_init       = omap4430_phy_init,
38 -       .phy_exit       = omap4430_phy_exit,
39 -       .phy_power      = omap4430_phy_power,
40 -       .phy_set_clock  = omap4430_phy_set_clk,
41 -       .phy_suspend    = omap4430_phy_suspend,
42 -};
43 -
44 +#if defined(CONFIG_ARCH_OMAP3)
45  static struct twl4030_usb_data omap3_usb_pdata = {
46         .usb_mode       = T2_USB_MODE_ULPI,
47  };
48 @@ -122,6 +115,45 @@ static struct regulator_init_data omap3_vpll2_idata = {
49         .consumer_supplies              = omap3_vpll2_supplies,
50  };
51  
52 +void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
53 +                                 u32 pdata_flags, u32 regulators_flags)
54 +{
55 +       if (!pmic_data->irq_base)
56 +               pmic_data->irq_base = TWL4030_IRQ_BASE;
57 +       if (!pmic_data->irq_end)
58 +               pmic_data->irq_end = TWL4030_IRQ_END;
59 +
60 +       /* Common platform data configurations */
61 +       if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
62 +               pmic_data->usb = &omap3_usb_pdata;
63 +
64 +       if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
65 +               pmic_data->bci = &omap3_bci_pdata;
66 +
67 +       if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
68 +               pmic_data->madc = &omap3_madc_pdata;
69 +
70 +       if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->codec)
71 +               pmic_data->codec = &omap3_codec_pdata;
72 +
73 +       /* Common regulator configurations */
74 +       if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
75 +               pmic_data->vdac = &omap3_vdac_idata;
76 +
77 +       if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
78 +               pmic_data->vpll2 = &omap3_vpll2_idata;
79 +}
80 +#endif /* CONFIG_ARCH_OMAP3 */
81 +
82 +#if defined(CONFIG_ARCH_OMAP4)
83 +static struct twl4030_usb_data omap4_usb_pdata = {
84 +       .phy_init       = omap4430_phy_init,
85 +       .phy_exit       = omap4430_phy_exit,
86 +       .phy_power      = omap4430_phy_power,
87 +       .phy_set_clock  = omap4430_phy_set_clk,
88 +       .phy_suspend    = omap4430_phy_suspend,
89 +};
90 +
91  static struct regulator_init_data omap4_vdac_idata = {
92         .constraints = {
93                 .min_uV                 = 1800000,
94 @@ -274,31 +306,4 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
95                 pmic_data->clk32kg = &omap4_clk32kg_idata;
96  }
97  
98 -void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
99 -                                 u32 pdata_flags, u32 regulators_flags)
100 -{
101 -       if (!pmic_data->irq_base)
102 -               pmic_data->irq_base = TWL4030_IRQ_BASE;
103 -       if (!pmic_data->irq_end)
104 -               pmic_data->irq_end = TWL4030_IRQ_END;
106 -       /* Common platform data configurations */
107 -       if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
108 -               pmic_data->usb = &omap3_usb_pdata;
110 -       if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
111 -               pmic_data->bci = &omap3_bci_pdata;
113 -       if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
114 -               pmic_data->madc = &omap3_madc_pdata;
116 -       if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->codec)
117 -               pmic_data->codec = &omap3_codec_pdata;
119 -       /* Common regulator configurations */
120 -       if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
121 -               pmic_data->vdac = &omap3_vdac_idata;
123 -       if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
124 -               pmic_data->vpll2 = &omap3_vpll2_idata;
125 -}
126 +#endif /* CONFIG_ARCH_OMAP4 */
127 -- 
128 1.6.6.1