]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.3.7/beagleboard/0001-ARM-OMAP-Cleanup-Beagleboard-DVI-reset-gpio.patch
linux: Add kernel version 3.3.7 for beagleboard
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.3.7 / beagleboard / 0001-ARM-OMAP-Cleanup-Beagleboard-DVI-reset-gpio.patch
1 From 457318d7eff18258b4ef11fb4e4b924d2b5b5bb0 Mon Sep 17 00:00:00 2001
2 From: Russ Dill <Russ.Dill@ti.com>
3 Date: Tue, 8 May 2012 19:49:06 -0700
4 Subject: [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
6 This removes several boot warnings from board-omap3beagle.c:
8  - gpio_request: gpio--22 (DVI reset) status -22
9  - Unable to get DVI reset GPIO
11 There is a combination of leftover code and revision confusion.
12 Additionally, xM support is currently a hack.
14 For original Beagleboard this removes the double initialization of GPIO
15 170, properly configures it as an output, and wraps the initialization
16 in an if block so that xM does not attempt to request it.
18 For Beagleboard xM it removes reference to GPIO 129 which was part
19 of rev A1 and A2 designs, but never functioned. It then properly assigns
20 beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
21 hack of initializing it high. Additionally, it uses
22 gpio_set_value_cansleep since this GPIO is connected through i2c.
24 Unfortunately, there is no way to tell the difference between xM A2 and
25 A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
26 GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
27 problems created by this fix.
29 v3
30  - Change patch title to include 'ARM: OMAP:'
31  - Actually rename reset_gpio to dvi_reset_gpio
33 v2
34  - Rename reset_gpio to dvi_reset_gpio to self document
35  - Use gpio_set_value_cansleep since TWL gpio can sleep
36  - Use gpio_is_valid instead of -EINVAL check
38 Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.
40 Upstream-Status: Submitted
41     * This patch has been submitted for the 3.5 kernel and is
42       being reworked for upstream acceptance.
44 Signed-off-by: Russ Dill <Russ.Dill@ti.com>
45 ---
46  arch/arm/mach-omap2/board-omap3beagle.c |   49 ++++++++++++++++--------------
47  1 files changed, 26 insertions(+), 23 deletions(-)
49 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
50 index 7ffcd28..c9322ac 100644
51 --- a/arch/arm/mach-omap2/board-omap3beagle.c
52 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
53 @@ -81,12 +81,12 @@ static u8 omap3_beagle_version;
54  static struct {
55         int mmc1_gpio_wp;
56         int usb_pwr_level;
57 -       int reset_gpio;
58 +       int dvi_reset_gpio;
59         int usr_button_gpio;
60  } beagle_config = {
61         .mmc1_gpio_wp = -EINVAL,
62         .usb_pwr_level = GPIOF_OUT_INIT_LOW,
63 -       .reset_gpio = 129,
64 +       .dvi_reset_gpio = -EINVAL,
65         .usr_button_gpio = 4,
66  };
67  
68 @@ -124,21 +124,21 @@ static void __init omap3_beagle_init_rev(void)
69                 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
70                 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
71                 beagle_config.mmc1_gpio_wp = 29;
72 -               beagle_config.reset_gpio = 170;
73 +               beagle_config.dvi_reset_gpio = 170;
74                 beagle_config.usr_button_gpio = 7;
75                 break;
76         case 6:
77                 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
78                 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
79                 beagle_config.mmc1_gpio_wp = 23;
80 -               beagle_config.reset_gpio = 170;
81 +               beagle_config.dvi_reset_gpio = 170;
82                 beagle_config.usr_button_gpio = 7;
83                 break;
84         case 5:
85                 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
86                 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
87                 beagle_config.mmc1_gpio_wp = 23;
88 -               beagle_config.reset_gpio = 170;
89 +               beagle_config.dvi_reset_gpio = 170;
90                 beagle_config.usr_button_gpio = 7;
91                 break;
92         case 0:
93 @@ -192,7 +192,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
94  static int beagle_enable_dvi(struct omap_dss_device *dssdev)
95  {
96         if (gpio_is_valid(dssdev->reset_gpio))
97 -               gpio_set_value(dssdev->reset_gpio, 1);
98 +               gpio_set_value_cansleep(dssdev->reset_gpio, 1);
99  
100         return 0;
101  }
102 @@ -200,7 +200,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
103  static void beagle_disable_dvi(struct omap_dss_device *dssdev)
104  {
105         if (gpio_is_valid(dssdev->reset_gpio))
106 -               gpio_set_value(dssdev->reset_gpio, 0);
107 +               gpio_set_value_cansleep(dssdev->reset_gpio, 0);
108  }
109  
110  static struct panel_dvi_platform_data dvi_panel = {
111 @@ -238,12 +238,17 @@ static struct omap_dss_board_info beagle_dss_data = {
112  
113  static void __init beagle_display_init(void)
114  {
115 -       int r;
117 -       r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
118 -                            "DVI reset");
119 -       if (r < 0)
120 -               printk(KERN_ERR "Unable to get DVI reset GPIO\n");
121 +       if (gpio_is_valid(beagle_config.dvi_reset_gpio)) {
122 +               int r;
124 +               omap_mux_init_gpio(beagle_config.dvi_reset_gpio, OMAP_PIN_OUTPUT);
125 +               r = gpio_request_one(beagle_config.dvi_reset_gpio,
126 +                                    GPIOF_OUT_INIT_LOW, "DVI reset");
127 +               if (r < 0)
128 +                       printk(KERN_ERR "Unable to get DVI reset GPIO\n");
129 +               else
130 +                       beagle_dvi_device.reset_gpio = beagle_config.dvi_reset_gpio;
131 +       }
132  }
133  
134  #include "sdram-micron-mt46h32m32lf-6.h"
135 @@ -272,7 +277,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
136  {
137         int r;
138  
139 -       if (beagle_config.mmc1_gpio_wp != -EINVAL)
140 +       if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
141                 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
142         mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp;
143         /* gpio + 0 is "mmc0_cd" (input/IRQ) */
144 @@ -297,11 +302,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
145                 if (r)
146                         pr_err("%s: unable to configure nDVI_PWR_EN\n",
147                                 __func__);
148 -               r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
149 -                                    "DVI_LDO_EN");
151 +               r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
152 +                                    "DVI_PU");
153                 if (r)
154 -                       pr_err("%s: unable to configure DVI_LDO_EN\n",
155 -                               __func__);
156 +                       pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
157 +               else
158 +                       beagle_dvi_device.reset_gpio = gpio + 2;
160         } else {
161                 /*
162                  * REVISIT: need ehci-omap hooks for external VBUS
163 @@ -310,7 +318,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
164                 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
165                         pr_err("%s: unable to configure EHCI_nOC\n", __func__);
166         }
167 -       beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
168  
169         gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
170                         "nEN_USB_PWR");
171 @@ -532,10 +539,6 @@ static void __init omap3_beagle_init(void)
172         omap_sdrc_init(mt46h32m32lf6_sdrc_params,
173                                   mt46h32m32lf6_sdrc_params);
174  
175 -       omap_mux_init_gpio(170, OMAP_PIN_INPUT);
176 -       /* REVISIT leave DVI powered down until it's needed ... */
177 -       gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
179         usb_musb_init(NULL);
180         usbhs_init(&usbhs_bdata);
181         omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
182 -- 
183 1.7.0.4