[U-Boot] [PATCH v3 08/18] tegra: Add SOC support for display/lcd

Thierry Reding thierry.reding at avionic-design.de
Thu Jul 19 09:37:07 CEST 2012


On Thu, Jul 12, 2012 at 08:25:08AM -0700, Simon Glass wrote:
> From: Wei Ni <wni at nvidia.com>
> 
> Add support for the LCD peripheral at the Tegra2 SOC level. A separate
> LCD driver will use this functionality to configure the display.
> 
> Mayuresh Kulkarni:
> - changes to remove bitfields and clean up for submission
> 
> Simon Glass:
> - simplify code, move clock control into here, clean-up
> 
> Signed-off-by: Mayuresh Kulkarni <mkulkarni at nvidia.com>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v3:
> - Add probe function to read in fdt parameters in display driver
> - Separate display driver and LCD driver more in fdt
> 
>  arch/arm/cpu/armv7/tegra2/Makefile         |    2 +-
>  arch/arm/cpu/armv7/tegra2/display.c        |  389 ++++++++++++++++++++
>  arch/arm/include/asm/arch-tegra2/dc.h      |  544 ++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-tegra2/display.h |  152 ++++++++
>  include/fdtdec.h                           |    1 +
>  lib/fdtdec.c                               |    1 +
>  6 files changed, 1088 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/cpu/armv7/tegra2/display.c
>  create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h
>  create mode 100644 arch/arm/include/asm/arch-tegra2/display.h
> 
[...]
> diff --git a/arch/arm/cpu/armv7/tegra2/display.c b/arch/arm/cpu/armv7/tegra2/display.c
[...]
> +int setup_window(struct disp_ctl_win *win, struct fdt_disp_config *config)
> +{
> +	win->x = 0;
> +	win->y = 0;
> +	win->w = config->width;
> +	win->h = config->height;
> +	win->out_x = 0;
> +	win->out_y = 0;
> +	win->out_w = config->width;
> +	win->out_h = config->height;
> +	win->phys_addr = config->frame_buffer;
> +	win->stride = config->width * (1 << config->log2_bpp) / 8;
> +	debug("%s: depth = %d\n", __func__, config->log2_bpp);
> +	switch (config->log2_bpp) {
> +	case 5:
> +	case 24:

What's the 24 doing here?

[...]
> +static int tegra_display_decode_config(const void *blob,
> +				       struct fdt_disp_config *config)
> +{
> +	int front, back, ref;
> +	int node, rgb;
> +	int bpp, bit;
> +
> +	node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA20_DC);
> +	if (node < 0) {
> +		debug("%s: Cannot find display controller node in fdt\n",
> +		      __func__);
> +		return node;
> +	}
> +	config->disp = (struct disp_ctlr *)fdtdec_get_addr(blob, node, "reg");
> +	if (!config->disp) {
> +		debug("%s: No display controller address\n", __func__);
> +		return -1;
> +	}
> +
> +	rgb = fdt_subnode_offset(blob, node, "rgb");
> +
> +	config->frame_buffer = fdtdec_get_addr(blob, rgb,
> +					       "nvidia,frame-buffer");
> +	config->width = fdtdec_get_int(blob, rgb, "xres", -1);
> +	config->height = fdtdec_get_int(blob, rgb, "yres", -1);
> +	bpp = fdtdec_get_int(blob, rgb, "nvidia,bits-per-pixel", -1);
> +	bit = ffs(bpp) - 1;
> +	if (bpp == (1 << bit))
> +		config->log2_bpp = bit;
> +	else
> +		config->log2_bpp = bpp;
> +	config->bpp = bpp;
> +	config->pixel_clock = fdtdec_get_int(blob, rgb, "clock", 0);
> +	if (!config->pixel_clock || bpp == -1 ||
> +			config->width == -1 || config->height == -1) {
> +		debug("%s: Pixel parameters missing\n", __func__);
> +		return -FDT_ERR_NOTFOUND;
> +	}
> +
> +	/* Use a ref-to-sync of 1 always, and take this from the front porch */
> +	back = fdtdec_get_int(blob, rgb, "left-margin", -1);
> +	front = fdtdec_get_int(blob, rgb, "right-margin", -1);
> +	ref = fdtdec_get_int(blob, rgb, "hsync-len", -1);
> +	if ((back | front | ref) == -1) {
> +		debug("%s: Horizontal parameters missing\n", __func__);
> +		return -FDT_ERR_NOTFOUND;
> +	}
> +	config->horiz_timing[FDT_LCD_TIMING_REF_TO_SYNC] = 11;

The comment above says this should be 1.

> +	config->horiz_timing[FDT_LCD_TIMING_SYNC_WIDTH] = ref;
> +	config->horiz_timing[FDT_LCD_TIMING_BACK_PORCH] = back;
> +	config->horiz_timing[FDT_LCD_TIMING_FRONT_PORCH] = front -
> +		config->horiz_timing[FDT_LCD_TIMING_REF_TO_SYNC];
> +	debug_timing("horiz", config->horiz_timing);
> +
> +	back = fdtdec_get_int(blob, rgb, "upper-margin", -1);
> +	front = fdtdec_get_int(blob, rgb, "lower-margin", -1);
> +	ref = fdtdec_get_int(blob, rgb, "vsync-len", -1);
> +	if ((back | front | ref) == -1) {
> +		debug("%s: Vertical parameters missing\n", __func__);
> +		return -FDT_ERR_NOTFOUND;
> +	}
> +	config->vert_timing[FDT_LCD_TIMING_REF_TO_SYNC] = 1;
> +	config->vert_timing[FDT_LCD_TIMING_SYNC_WIDTH] = ref;
> +	config->vert_timing[FDT_LCD_TIMING_BACK_PORCH] = back;
> +	config->vert_timing[FDT_LCD_TIMING_FRONT_PORCH] = front -
> +		config->vert_timing[FDT_LCD_TIMING_REF_TO_SYNC];
> +	debug_timing("vert", config->horiz_timing);

This should probably be config->vert_timing.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120719/4e7a7949/attachment.pgp>


More information about the U-Boot mailing list