Patchwork [U-Boot,3/8] pxa_lcd: allow L_BIAS line to be unused

login
register
mail settings
Submitter Mike Dunn
Date April 7, 2013, 4:41 p.m.
Message ID <1365352865-2137-4-git-send-email-mikedunn@newsguy.com>
Download mbox | patch
Permalink /patch/234521/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

Mike Dunn - April 7, 2013, 4:41 p.m.
This patch adds a config option CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes the
lcd controller initialization code to leave as an ordinary gpio the line that is
typically configured as the lcd L_BIAS alternate function (this is the gpio 77
line).

For some reason (I don't have a datasheet), the lcd device on the palmtreo680
board does not use the L_BIAS line.  PalmOS does not configure the gpio 77 line
for the L_BIAS alternate function, and if it is configured as such, the lcd does
not work.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---

This is a little ugly, I know, but I didn't want to try and get too fancy.

 drivers/video/pxa_lcd.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
Marek Vasut - April 8, 2013, 5:28 a.m.
Dear Mike Dunn,

> This patch adds a config option CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes
> the lcd controller initialization code to leave as an ordinary gpio the
> line that is typically configured as the lcd L_BIAS alternate function
> (this is the gpio 77 line).
> 
> For some reason (I don't have a datasheet), the lcd device on the
> palmtreo680 board does not use the L_BIAS line.  PalmOS does not configure
> the gpio 77 line for the L_BIAS alternate function, and if it is
> configured as such, the lcd does not work.
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>

The other option would be to pull the GPIO setup from the driver. That'd be the 
best.

Best regards,
Marek Vasut
Mike Dunn - April 9, 2013, 5:02 p.m.
On 04/07/2013 10:28 PM, Marek Vasut wrote:
> Dear Mike Dunn,
> 
>> This patch adds a config option CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes
>> the lcd controller initialization code to leave as an ordinary gpio the
>> line that is typically configured as the lcd L_BIAS alternate function
>> (this is the gpio 77 line).
>>
>> For some reason (I don't have a datasheet), the lcd device on the
>> palmtreo680 board does not use the L_BIAS line.  PalmOS does not configure
>> the gpio 77 line for the L_BIAS alternate function, and if it is
>> configured as such, the lcd does not work.
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> 
> The other option would be to pull the GPIO setup from the driver. That'd be the 
> best.


Well, there's a lot of shared code in pxafb_setup_gpio() that handles pin
configuration for all possible interface widths.

But after looking at this problem some more, I realized that the board-specific
lcd_enable() is called after the pxa driver's initialization, so the board code
can undo the L_BIAS pin configuration.  Not elegant, but better than the ugly
#ifdefs.

Thanks,
Mike

Patch

diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c
index fd848ef..29f62e9 100644
--- a/drivers/video/pxa_lcd.c
+++ b/drivers/video/pxa_lcd.c
@@ -478,8 +478,13 @@  static void pxafb_setup_gpio (vidinfo_t *vid)
 
 		/* bits 74-77 */
 		writel(readl(GPDR2) | (0xf << 10), GPDR2);
+#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS
+		writel((readl(GAFR2_L) & ~(0xff << 20)) | (0x2a << 20),
+		       GAFR2_L);
+#else
 		writel((readl(GAFR2_L) & ~(0xff << 20)) | (0xaa << 20),
-			GAFR2_L);
+		       GAFR2_L);
+#endif
 	}
 
 	/* 8 bit interface */
@@ -497,8 +502,13 @@  static void pxafb_setup_gpio (vidinfo_t *vid)
 
 		/* bits 74-77 */
 		writel(readl(GPDR2) | (0xf << 10), GPDR2);
+#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS
+		writel((readl(GAFR2_L) & ~(0xff << 20)) | (0x2a << 20),
+		       GAFR2_L);
+#else
 		writel((readl(GAFR2_L) & ~(0xff << 20)) | (0xaa << 20),
-			GAFR2_L);
+		       GAFR2_L);
+#endif
 	}
 
 	/* 16 bit interface */
@@ -511,7 +521,11 @@  static void pxafb_setup_gpio (vidinfo_t *vid)
 
 		writel((readl(GAFR1_U) & ~(0xfff << 20)) | (0xaaa << 20),
 			GAFR1_U);
+#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS
+		writel((readl(GAFR2_L) & 0xf0000000) | 0x02aaaaaa, GAFR2_L);
+#else
 		writel((readl(GAFR2_L) & 0xf0000000) | 0x0aaaaaaa, GAFR2_L);
+#endif
 	}
 	else
 	{