]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/beagle/0001-OMAP3-beagle-add-support-for-beagleboard-xM-revision.patch
995aecff5f459b276b11320d25a6973cd7fc413d
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / beagle / 0001-OMAP3-beagle-add-support-for-beagleboard-xM-revision.patch
1 From 928887fcbb4d82f6d16f6cfa16a06f5ff5261786 Mon Sep 17 00:00:00 2001
2 From: Fernandes, Joel A <joelagnel@ti.com>
3 Date: Tue, 7 Jun 2011 15:54:45 -0500
4 Subject: [PATCH 1/5] OMAP3: beagle: add support for beagleboard xM revision C
6 OMAP3: beagle: add support for beagleboard xM revision C
8 The USB enable GPIO has been in beagleboard xM revision C.
9 The USER button has been moved since beagleboard xM.
10 Also, board specific initialization has been moved to beagle_config struct
11 and initialized in omap3_beagle_init_rev. Default values in struct are for xMC.
13 Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
14 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
15 ---
16  arch/arm/mach-omap2/board-omap3beagle.c |   78 ++++++++++++++++++++-----------
17  1 files changed, 51 insertions(+), 27 deletions(-)
19 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
20 index 34f8411..32f5f89 100644
21 --- a/arch/arm/mach-omap2/board-omap3beagle.c
22 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
23 @@ -60,7 +60,8 @@
24   *     AXBX    = GPIO173, GPIO172, GPIO171: 1 1 1
25   *     C1_3    = GPIO173, GPIO172, GPIO171: 1 1 0
26   *     C4      = GPIO173, GPIO172, GPIO171: 1 0 1
27 - *     XM      = GPIO173, GPIO172, GPIO171: 0 0 0
28 + *     XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0
29 + *     XMC = GPIO173, GPIO172, GPIO171: 0 1 0
30   */
31  enum {
32         OMAP3BEAGLE_BOARD_UNKN = 0,
33 @@ -68,14 +69,26 @@ enum {
34         OMAP3BEAGLE_BOARD_C1_3,
35         OMAP3BEAGLE_BOARD_C4,
36         OMAP3BEAGLE_BOARD_XM,
37 +       OMAP3BEAGLE_BOARD_XMC,
38  };
39  
40  static u8 omap3_beagle_version;
41  
42 -static u8 omap3_beagle_get_rev(void)
43 -{
44 -       return omap3_beagle_version;
45 -}
46 +/*
47 + * Board-specific configuration
48 + * Defaults to BeagleBoard-xMC
49 + */
50 +static struct {
51 +       int mmc1_gpio_wp;
52 +       int usb_pwr_level;
53 +       int reset_gpio;
54 +       int usr_button_gpio;
55 +} beagle_config = {
56 +       .mmc1_gpio_wp = -EINVAL,
57 +       .usb_pwr_level = GPIOF_OUT_INIT_LOW,
58 +       .reset_gpio = 129,
59 +       .usr_button_gpio = 4,
60 +};
61  
62  static struct gpio omap3_beagle_rev_gpios[] __initdata = {
63         { 171, GPIOF_IN, "rev_id_0"    },
64 @@ -110,18 +123,32 @@ static void __init omap3_beagle_init_rev(void)
65         case 7:
66                 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
67                 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
68 +               beagle_config.mmc1_gpio_wp = 29;
69 +               beagle_config.reset_gpio = 170;
70 +               beagle_config.usr_button_gpio = 7;
71                 break;
72         case 6:
73                 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
74                 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
75 +               beagle_config.mmc1_gpio_wp = 23;
76 +               beagle_config.reset_gpio = 170;
77 +               beagle_config.usr_button_gpio = 7;
78                 break;
79         case 5:
80                 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
81                 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
82 +               beagle_config.mmc1_gpio_wp = 23;
83 +               beagle_config.reset_gpio = 170;
84 +               beagle_config.usr_button_gpio = 7;
85                 break;
86         case 0:
87 -               printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
88 +               printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n");
89                 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
90 +               beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH;
91 +               break;
92 +       case 2:
93 +               printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n");
94 +               omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC;
95                 break;
96         default:
97                 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
98 @@ -225,7 +252,7 @@ static struct omap2_hsmmc_info mmc[] = {
99         {
100                 .mmc            = 1,
101                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
102 -               .gpio_wp        = 29,
103 +               .gpio_wp        = -EINVAL,
104         },
105         {}      /* Terminator */
106  };
107 @@ -243,17 +270,11 @@ static struct gpio_led gpio_leds[];
108  static int beagle_twl_gpio_setup(struct device *dev,
109                 unsigned gpio, unsigned ngpio)
110  {
111 -       int r, usb_pwr_level;
113 -       if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
114 -               mmc[0].gpio_wp = -EINVAL;
115 -       } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
116 -               (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
117 -               omap_mux_init_gpio(23, OMAP_PIN_INPUT);
118 -               mmc[0].gpio_wp = 23;
119 -       } else {
120 -               omap_mux_init_gpio(29, OMAP_PIN_INPUT);
121 -       }
122 +       int r;
124 +       if (beagle_config.mmc1_gpio_wp != -EINVAL)
125 +               omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
126 +       mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp;
127         /* gpio + 0 is "mmc0_cd" (input/IRQ) */
128         mmc[0].gpio_cd = gpio + 0;
129         omap2_hsmmc_init(mmc);
130 @@ -263,9 +284,8 @@ static int beagle_twl_gpio_setup(struct device *dev,
131          * high / others active low)
132          * DVI reset GPIO is different between beagle revisions
133          */
134 -       if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
135 -               usb_pwr_level = GPIOF_OUT_INIT_HIGH;
136 -               beagle_dvi_device.reset_gpio = 129;
137 +       /* Valid for all -xM revisions */
138 +       if (cpu_is_omap3630()) {
139                 /*
140                  * gpio + 1 on Xm controls the TFP410's enable line (active low)
141                  * gpio + 2 control varies depending on the board rev as below:
142 @@ -283,8 +303,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
143                         pr_err("%s: unable to configure DVI_LDO_EN\n",
144                                 __func__);
145         } else {
146 -               usb_pwr_level = GPIOF_OUT_INIT_LOW;
147 -               beagle_dvi_device.reset_gpio = 170;
148                 /*
149                  * REVISIT: need ehci-omap hooks for external VBUS
150                  * power switch and overcurrent detect
151 @@ -292,8 +310,10 @@ static int beagle_twl_gpio_setup(struct device *dev,
152                 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
153                         pr_err("%s: unable to configure EHCI_nOC\n", __func__);
154         }
155 +       beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
156  
157 -       gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR");
158 +       gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
159 +                       "nEN_USB_PWR");
160  
161         /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
162         gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
163 @@ -404,7 +424,8 @@ static struct platform_device leds_gpio = {
164  static struct gpio_keys_button gpio_buttons[] = {
165         {
166                 .code                   = BTN_EXTRA,
167 -               .gpio                   = 7,
168 +               /* Dynamically assigned depending on board */
169 +               .gpio                   = -EINVAL,
170                 .desc                   = "user",
171                 .wakeup                 = 1,
172         },
173 @@ -468,8 +489,8 @@ static void __init beagle_opp_init(void)
174                 return;
175         }
176  
177 -       /* Custom OPP enabled for XM */
178 -       if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
179 +       /* Custom OPP enabled for all xM versions */
180 +       if (cpu_is_omap3630()) {
181                 struct omap_hwmod *mh = omap_hwmod_lookup("mpu");
182                 struct omap_hwmod *dh = omap_hwmod_lookup("iva");
183                 struct device *dev;
184 @@ -509,6 +530,9 @@ static void __init omap3_beagle_init(void)
185         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
186         omap3_beagle_init_rev();
187         omap3_beagle_i2c_init();
189 +       gpio_buttons[0].gpio = beagle_config.usr_button_gpio;
191         platform_add_devices(omap3_beagle_devices,
192                         ARRAY_SIZE(omap3_beagle_devices));
193         omap_display_init(&beagle_dss_data);
194 -- 
195 1.6.6.1