diff mbox

[U-Boot,05/13] colibri_t20: add LCD display support

Message ID 5ad67d5eeeb894c8dcaea44d9280f39117548928.1436170106.git.marcel.ziswiler@toradex.com
State Superseded
Delegated to: Tom Warren
Headers show

Commit Message

Marcel Ziswiler July 6, 2015, 8:20 a.m. UTC
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Add LCD display support defaulting to VESA VGA resolution. Different
resolutions configurable via device-tree.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---
 arch/arm/dts/tegra20-colibri.dts        | 29 +++++++++++++++++++++++++++++
 board/toradex/colibri_t20/colibri_t20.c | 18 ++++++++++++++++++
 include/configs/colibri_t20.h           | 10 ++++++++++
 3 files changed, 57 insertions(+)

Comments

Simon Glass July 6, 2015, 4:38 p.m. UTC | #1
Hi Marcel,

On 6 July 2015 at 02:20, Marcel Ziswiler <marcel@ziswiler.com> wrote:
> From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> Add LCD display support defaulting to VESA VGA resolution. Different
> resolutions configurable via device-tree.
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> ---
>  arch/arm/dts/tegra20-colibri.dts        | 29 +++++++++++++++++++++++++++++
>  board/toradex/colibri_t20/colibri_t20.c | 18 ++++++++++++++++++
>  include/configs/colibri_t20.h           | 10 ++++++++++
>  3 files changed, 57 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Please see below.

>
> diff --git a/arch/arm/dts/tegra20-colibri.dts b/arch/arm/dts/tegra20-colibri.dts
> index 257ca27..ae40bad 100644
> --- a/arch/arm/dts/tegra20-colibri.dts
> +++ b/arch/arm/dts/tegra20-colibri.dts
> @@ -17,6 +17,17 @@
>                 sdhci0 = "/sdhci@c8000600";
>         };
>
> +       host1x {
> +               status = "okay";
> +               dc@54200000 {
> +                       status = "okay";
> +                       rgb {
> +                               status = "okay";
> +                               nvidia,panel = <&lcd_panel>;
> +                       };
> +               };
> +       };
> +
>         usb@c5000000 {
>                 dr_mode = "otg";
>         };
> @@ -46,4 +57,22 @@
>                 cd-gpios = <&gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_LOW>;
>                 bus-width = <4>;
>         };
> +
> +       lcd_panel: panel {
> +               clock = <25175000>;
> +               xres = <640>;
> +               yres = <480>;
> +               left-margin = <48>;     /* horizontal back porch */
> +               right-margin = <16>;    /* horizontal front porch */
> +               hsync-len = <96>;
> +               lower-margin = <11>;    /* vertical front porch */
> +               upper-margin = <31>;    /* vertical back porch */
> +               vsync-len = <2>;
> +               hsync-active-high;
> +               vsync-active-high;
> +               nvidia,bits-per-pixel = <16>;
> +               nvidia,pwm = <&pwm 2 0>;
> +               nvidia,backlight-enable-gpios = <&gpio TEGRA_GPIO(T, 4) GPIO_ACTIVE_HIGH>;
> +               nvidia,panel-timings = <0 0 0 0>;
> +       };
>  };
> diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
> index 7210a8a..81d344c 100644
> --- a/board/toradex/colibri_t20/colibri_t20.c
> +++ b/board/toradex/colibri_t20/colibri_t20.c
> @@ -75,3 +75,21 @@ void pin_mux_usb(void)
>         pinmux_tristate_disable(PMUX_PINGRP_SPIG);
>  }
>  #endif
> +
> +#ifdef CONFIG_VIDEO_TEGRA
> +/*
> + * Routine: pin_mux_display
> + * Description: setup the pin muxes/tristate values for the LCD interface)
> + */
> +void pin_mux_display(void)
> +{
> +       /*
> +        * Manually untristate BL_ON (PT4 - SODIMM 71) as specified through
> +        * device-tree
> +        */
> +       pinmux_tristate_disable(PMUX_PINGRP_DTA);
> +
> +       pinmux_set_func(PMUX_PINGRP_SDC, PMUX_FUNC_PWM);
> +       pinmux_tristate_disable(PMUX_PINGRP_SDC);
> +}

I wonder why this code doesn't go in funcmux_select()? It has a
parameter to select the variant.

Regards,
Simon
Marcel Ziswiler July 7, 2015, 8:54 a.m. UTC | #2
Hi Simon

On Mon, 2015-07-06 at 10:38 -0600, Simon Glass wrote:

> I wonder why this code doesn't go in funcmux_select()? It has a
> parameter to select the variant.

Yeah, but I believe Tegra 2 aka T20 with its rather special pin group
arrangement has never really been properly converted to using
funcmux_select() other than for DISP, KBC, NDFLASH, SDMMC, SPI and USB.

As a matter of fact even the Tegra video driver uses pinmux_set_func()
which BTW is hard-coded to a specific PWM in there!

[user@host u-boot] $ cat drivers/video/tegra.c | grep PWM
	STAGE_PWM,
		debug("%s: Unable to request PWM channel\n", __func__);
	case STAGE_PWM:
		/* Enable PWM at 15/16 high, 32768 Hz with divider 1 */
		pinmux_set_func(PMUX_PINGRP_GPU, PMUX_FUNC_PWM);
diff mbox

Patch

diff --git a/arch/arm/dts/tegra20-colibri.dts b/arch/arm/dts/tegra20-colibri.dts
index 257ca27..ae40bad 100644
--- a/arch/arm/dts/tegra20-colibri.dts
+++ b/arch/arm/dts/tegra20-colibri.dts
@@ -17,6 +17,17 @@ 
 		sdhci0 = "/sdhci@c8000600";
 	};
 
+	host1x {
+		status = "okay";
+		dc@54200000 {
+			status = "okay";
+			rgb {
+				status = "okay";
+				nvidia,panel = <&lcd_panel>;
+			};
+		};
+	};
+
 	usb@c5000000 {
 		dr_mode = "otg";
 	};
@@ -46,4 +57,22 @@ 
 		cd-gpios = <&gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_LOW>;
 		bus-width = <4>;
 	};
+
+	lcd_panel: panel {
+		clock = <25175000>;
+		xres = <640>;
+		yres = <480>;
+		left-margin = <48>;	/* horizontal back porch */
+		right-margin = <16>;	/* horizontal front porch */
+		hsync-len = <96>;
+		lower-margin = <11>;	/* vertical front porch */
+		upper-margin = <31>;	/* vertical back porch */
+		vsync-len = <2>;
+		hsync-active-high;
+		vsync-active-high;
+		nvidia,bits-per-pixel = <16>;
+		nvidia,pwm = <&pwm 2 0>;
+		nvidia,backlight-enable-gpios = <&gpio TEGRA_GPIO(T, 4) GPIO_ACTIVE_HIGH>;
+		nvidia,panel-timings = <0 0 0 0>;
+	};
 };
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index 7210a8a..81d344c 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -75,3 +75,21 @@  void pin_mux_usb(void)
 	pinmux_tristate_disable(PMUX_PINGRP_SPIG);
 }
 #endif
+
+#ifdef CONFIG_VIDEO_TEGRA
+/*
+ * Routine: pin_mux_display
+ * Description: setup the pin muxes/tristate values for the LCD interface)
+ */
+void pin_mux_display(void)
+{
+	/*
+	 * Manually untristate BL_ON (PT4 - SODIMM 71) as specified through
+	 * device-tree
+	 */
+	pinmux_tristate_disable(PMUX_PINGRP_DTA);
+
+	pinmux_set_func(PMUX_PINGRP_SDC, PMUX_FUNC_PWM);
+	pinmux_tristate_disable(PMUX_PINGRP_SDC);
+}
+#endif
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index b22e82a..fce1411 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -47,6 +47,16 @@ 
 /* General networking support */
 #define CONFIG_CMD_DHCP
 
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_PWM_TEGRA
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPP				LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES	10
+#define CONFIG_CMD_BMP
+#define CONFIG_LCD_LOGO
+
 /* NAND support */
 #define CONFIG_CMD_NAND
 #define CONFIG_TEGRA_NAND