Skip to contentSkip to conversation

tegra: Add display driver and LCD support for Seaboard

PATCH Superseded Simon Glass 7 participants 34 messages Jan 15, 2012 – Jul 24, 2012 1 message not in the archive

Subsystems (4)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover tegra: Add display driver and LCD support for Seaboard

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

 README                                          |   16 +
 arch/arm/cpu/armv7/cache_v7.c                   |   11 +
 arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
 arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
 arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
 arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
 arch/arm/dts/tegra20.dtsi                       |   25 +
 arch/arm/include/asm/arch-tegra2/dc.h           |  544 +++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
 arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
 arch/arm/include/asm/system.h                   |   30 ++
 arch/arm/lib/cache-cp15.c                       |   62 +++-
 board/nvidia/common/board.c                     |   21 +-
 board/nvidia/dts/tegra2-seaboard.dts            |   21 +
 common/cmd_echo.c                               |    3 +-
 common/lcd.c                                    |   85 +++-
 doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
 drivers/video/Makefile                          |    1 +
 drivers/video/tegra.c                           |  388 ++++++++++++++++
 include/configs/seaboard.h                      |   12 +-
 include/configs/tegra2-common.h                 |    1 +
 include/fdtdec.h                                |   17 +
 include/lcd.h                                   |   11 +
 lib/fdtdec.c                                    |   15 +-
 24 files changed, 1862 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/display.c
 create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h
 create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt
 create mode 100644 drivers/video/tegra.c
Signature · 1 line
1.7.7.3

A message that is not in the archive (sent off-list or not yet received): 1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#2 lore raw

PATCH 1/17 fdt: Add function to look up a phandle's register address

This is a commonly-used requirement, so add a function to support it easily.

---
 include/fdtdec.h |   13 +++++++++++++
 lib/fdtdec.c     |   11 +++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
include/fdtdec.h +13 -0
index e705124..81ce3f6 100644
@@ -239,6 +239,19 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id);
 int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
 
 /**
+ * Look up a phandle and follow it to its node. Then return the register
+ * address of that node as a pointer. This can be used to access the
+ * peripheral directly.
+ *
+ * @param blob		FDT blob
+ * @param node		node to examine
+ * @param prop_name	name of property to find
+ * @return pointer to node's register address
+ */
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+		const char *prop_name);
+
+/**
  * Look up a property in a node and return its contents in an integer
  * array of given length. The property must have at least enough data for
  * the array (4*count bytes). It may have more, but this will be ignored.
lib/fdtdec.c +11 -0
index 48abf02..bcb2343 100644
@@ -311,6 +311,17 @@ int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name)
 	return lookup;
 }
 
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+		const char *prop_name)
+{
+	int lookup;
+
+	lookup = fdtdec_lookup_phandle(blob, node, prop_name);
+	if (lookup < 0)
+		return NULL;
+	return (void *)fdtdec_get_addr(blob, lookup, "reg");
+}
+
 /**
  * Look up a property in a node and check that it has a minimum length.
  *
Signature · 1 line
1.7.7.3
#3 lore raw

PATCH 2/17 fdt: Add header guard to fdtdec.h

In reply to a message not in the archive

This makes it easier to include this header from other headers.

---
 include/fdtdec.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/fdtdec.h +3 -0
index 81ce3f6..f60c969 100644
@@ -19,6 +19,8 @@
  * MA 02111-1307 USA
  */
 
+#ifndef __fdtdec_h
+#define __fdtdec_h
 
 /*
  * This file contains convenience functions for decoding useful and
@@ -371,3 +373,4 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
  */
 const u8 *fdtdec_locate_byte_array(const void *blob, int node,
 			     const char *prop_name, int count);
+#endif
Signature · 1 line
1.7.7.3
#4 lore raw

PATCH 3/17 fdt: Correct GPIO name access in fdtdec

In reply to a message not in the archive

This was missing an fdt32_to_cpu() call so got the name pointer wrong. If the GPIO module looks at it, this would cause a problem.

---
 lib/fdtdec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
lib/fdtdec.c +2 -1
index bcb2343..f7d0c95 100644
@@ -418,7 +418,7 @@ static int fdtdec_decode_gpios(const void *blob, int node,
 	}
 
 	/* We will use the name to tag the GPIO */
-	name = fdt_string(blob, prop->nameoff);
+	name = fdt_string(blob, fdt32_to_cpu(prop->nameoff));
 	cell = (u32 *)prop->data;
 	len /= sizeof(u32) * 3;		/* 3 cells per GPIO record */
 	if (len > max_count) {
@@ -444,6 +444,7 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name,
 
 	debug("%s: %s\n", __func__, prop_name);
 	gpio->gpio = FDT_GPIO_NONE;
+	gpio->name = NULL;
 	err = fdtdec_decode_gpios(blob, node, prop_name, gpio, 1);
 	return err == 1 ? 0 : err;
 }
Signature · 1 line
1.7.7.3
#5 lore raw

PATCH 5/17 tegra: fdt: Add LCD definitions for Tegra

In reply to a message not in the archive

Add LCD definitions and also a proposed binding for LCD displays.

The PWFM is in progress on the device-tree-discuss list, so only a very basic binding is offered here.

---
 arch/arm/dts/tegra20.dtsi                       |   25 ++++++
 doc/device-tree-bindings/video/nvidia-video.txt |   92 +++++++++++++++++++++++
 2 files changed, 117 insertions(+), 0 deletions(-)
 create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt
arch/arm/dts/tegra20.dtsi +25 -0
index 3d435aa..85c8bf6 100644
@@ -221,4 +221,29 @@
 		compatible = "nvidia,tegra20-kbc";
 		reg = <0x7000e200 0x0078>;
 	};
+
+	pwfm0: pwm@7000a000 {
+		compatible = "nvidia,tegra20-pwfm";
+		reg = <0x7000a000 0x4>;
+	};
+
+	pwfm1: pwm@7000a010 {
+		compatible = "nvidia,tegra20-pwfm";
+		reg = <0x7000a010 0x4>;
+	};
+
+	pwfm2: pwm@7000a020 {
+		compatible = "nvidia,tegra20-pwfm";
+		reg = <0x7000a020 0x4>;
+	};
+
+	pwfm3: pwm@7000a030 {
+		compatible = "nvidia,tegra20-pwfm";
+		reg = <0x7000a030 0x4>;
+	};
+
+	display1: display@0x54200000 {
+		compatible = "nvidia,tegra20-display";
+		reg = <0x54200000 0x40000>;
+	};
 };
doc/device-tree-bindings/video/nvidia-video.txt new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#6 lore raw

PATCH 15/17 tegra: fdt: Add LCD definitions for Seaboard

In reply to a message not in the archive

The Seaboard has a 1366x768 16bpp LCD. The backlight is controlled by one of the PWMs.

---
 board/nvidia/dts/tegra2-seaboard.dts |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
board/nvidia/dts/tegra2-seaboard.dts +21 -0
index b847215..710b254 100644
@@ -210,4 +210,25 @@
 				 00  00  00  11  00  00  00  00
 				 00  00  00  00  00  00  00  00];
 	};
+
+	display@0x54200000 {
+		pwfm = <&pwfm2>;
+		frame-buffer = <0x2f680000>;
+		backlight-enable-gpio = <&gpio 28 0>;		/* PD4 */
+		lvds-shutdown-gpio = <&gpio 10 0>;		/* PB2 */
+		backlight-vdd-gpio = <&gpio 176 0>;		/* PW0 */
+		panel-vdd-gpio = <&gpio 22 0>;			/* PC6 */
+		panel-timings = <4 203 17 15>;
+
+		lcd {
+			compatible = "generic,lcd";
+			width = <1366>;
+			height = <768>;
+			bits-per-pixel = <16>;
+			pixel-clock = <70600000>;
+
+			horiz-timing = <11 58 58 58>;
+			vert-timing = <1 4 4 4>;
+		};
+	};
 };
Signature · 1 line
1.7.7.3
#7 lore raw

PATCH 4/17 tegra: Add display support to funcmux

In reply to Simon Glass

Add support for a default pin mapping for display1.

---
 arch/arm/cpu/armv7/tegra2/funcmux.c |   39 +++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/tegra2/funcmux.c +39 -0
index a5ff890..edddf03 100644
@@ -25,6 +25,31 @@
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 
+/*
+ * The PINMUX macro is used to set up pinmux tables.
+ */
+#define PINMUX(grp, mux, pupd, tri)                   \
+	{PINGRP_##grp, PMUX_FUNC_##mux, PMUX_PULL_##pupd, PMUX_TRI_##tri}
+
+struct pingroup_config disp1_default[] = {
+	PINMUX(LDI,   DISPA,      NORMAL,    NORMAL),
+	PINMUX(LHP0,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LHP1,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LHP2,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LHS,   DISPA,      NORMAL,    NORMAL),
+	PINMUX(LM0,   RSVD4,      NORMAL,    NORMAL),
+	PINMUX(LPP,   DISPA,      NORMAL,    NORMAL),
+	PINMUX(LPW0,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LPW1,  RSVD4,      NORMAL,    TRISTATE),
+	PINMUX(LPW2,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LSC0,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LSPI,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LVP1,  DISPA,      NORMAL,    NORMAL),
+	PINMUX(LVS,   DISPA,      NORMAL,    NORMAL),
+	PINMUX(SLXD,  SPDIF,      NORMAL,    NORMAL),
+};
+
+
 int funcmux_select(enum periph_id id, int config)
 {
 	int bad_config = config != FUNCMUX_DEFAULT;
@@ -179,6 +204,20 @@ int funcmux_select(enum periph_id id, int config)
 			break;
 		}
 
+	case PERIPH_ID_DISP1:
+		if (config == FUNCMUX_DEFAULT) {
+			int i;
+
+			for (i = PINGRP_LD0; i <= PINGRP_LD17; i++) {
+				pinmux_set_func(i, PMUX_FUNC_DISPA);
+				pinmux_tristate_disable(i);
+				pinmux_set_pullupdown(i, PMUX_PULL_NORMAL);
+			}
+			pinmux_config_table(disp1_default,
+					    ARRAY_SIZE(disp1_default));
+		}
+		break;
+
 	default:
 		debug("%s: invalid periph_id %d", __func__, id);
 		return -1;
Signature · 1 line
1.7.7.3
#8 lore raw

PATCH 4/17 tegra: Add display support to funcmux

arch/arm/cpu/armv7/tegra2/funcmux.c line 34

Quoted 4 lines · On Saturday 14 January 2012 19:47:16 Simon Glass wrote:
arch/arm/cpu/armv7/tegra2/funcmux.c +1 -0
 
+struct pingroup_config disp1_default[] = {

const ? although it looks like we need to fix pinmux_config_table() first ... -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/9219da05/attachment.pgp>

#9 lore raw

PATCH 4/17 tegra: Add display support to funcmux

Hi Mike,

Quoted 10 lines · Mike Frysinger

arch/arm/cpu/armv7/tegra2/funcmux.c line 34

Quoted 4 lines · On Saturday 14 January 2012 19:47:16 Simon Glass wrote:
arch/arm/cpu/armv7/tegra2/funcmux.c +1 -0
 
+struct pingroup_config disp1_default[] = {

const ? although it looks like we need to fix pinmux_config_table() first
...
-mike

done

(With everything except NAND on Tegra in I am trying to get back to this now.)

Regards,
Simon

#10 lore raw

PATCH 6/17 tegra: Add support for PWFM

In reply to Simon Glass

The pulse width/frequency modulation peripheral supports generating a repeating pulse. It is useful for controlling LCD brightness.

---
 arch/arm/cpu/armv7/tegra2/Makefile      |    1 +
 arch/arm/cpu/armv7/tegra2/pwfm.c        |   40 +++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/pwfm.h |   54 +++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h
arch/arm/cpu/armv7/tegra2/Makefile +1 -0
index 08c4137..9779e9e 100644
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += pwfm.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/tegra2/pwfm.c new file +40 -0
new file mode 100644
index 0000000..cdb0cbe
@@ -0,0 +1,40 @@
+/*
+ * Tegra2 pulse width frequency modulator definitions
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/pwfm.h>
+
+void pwfm_enable(struct pwfm_ctlr *pwfm, int rate, int pulse_width,
+		int freq_divider)
+{
+	u32 reg;
+
+	/* TODO: Can we use clock_adjust_periph_pll_div() here? */
+	clock_start_periph_pll(PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ, rate);
+
+	reg = PWFM_ENABLE_MASK;
+	reg |= pulse_width << PWFM_WIDTH_SHIFT;
+	reg |= freq_divider << PWFM_DIVIDER_SHIFT;
+	writel(reg, &pwfm->control);
+}
arch/arm/include/asm/arch-tegra2/pwfm.h new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#11 lore raw

PATCH 7/17 tegra: Add SOC support for display/lcd

In reply to Simon Glass

From: Wei Ni <[email protected]>

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

---
 arch/arm/cpu/armv7/tegra2/Makefile         |    2 +-
 arch/arm/cpu/armv7/tegra2/display.c        |  271 ++++++++++++++
 arch/arm/include/asm/arch-tegra2/dc.h      |  544 ++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/display.h |  133 +++++++
 4 files changed, 949 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
arch/arm/cpu/armv7/tegra2/Makefile +1 -1
index 9779e9e..413f8c9 100644
@@ -39,7 +39,7 @@ COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
-COBJS-$(CONFIG_VIDEO_TEGRA) += pwfm.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += display.o pwfm.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/tegra2/display.c new file +271 -0

271 lines not on this page · raw message

arch/arm/include/asm/arch-tegra2/dc.h new file +544 -0

544 lines not on this page · raw message

arch/arm/include/asm/arch-tegra2/display.h new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#12 lore raw

PATCH 8/17 tegra: Add LCD driver

In reply to Simon Glass

This driver supports driving a single LCD and providing a U-Boot console on it.

---
 drivers/video/Makefile |    1 +
 drivers/video/tegra.c  |  379 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/fdtdec.h       |    1 +
 lib/fdtdec.c           |    1 +
 4 files changed, 382 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/tegra.c
drivers/video/Makefile +1 -0
index 6252f6a..ff043a1 100644
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o videomodes.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += tegra.o
 COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 
 COBJS	:= $(sort $(COBJS-y))
drivers/video/tegra.c new file +379 -0

379 lines not on this page · raw message

include/fdtdec.h +1 -0
index f60c969..d8bc80e 100644
@@ -66,6 +66,7 @@ enum fdt_compat_id {
 	COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra2 memory timing table */
 	COMPAT_NVIDIA_TEGRA20_NAND,	/* Tegra2 NAND controller */
 	COMPAT_NVIDIA_TEGRA20_KBC,	/* Tegra2 Keyboard */
+	COMPAT_NVIDIA_TEGRA20_DISPLAY,	/* Tegra 2 Display controller */
 
 	COMPAT_COUNT,
 };
lib/fdtdec.c +1 -0
index f7d0c95..82dcbbd 100644
@@ -44,6 +44,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
 	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
 	COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
+	COMPAT(NVIDIA_TEGRA20_DISPLAY, "nvidia,tegra20-display"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
Signature · 1 line
1.7.7.3
#13 lore raw

PATCH 9/17 tegra: Add LCD support to Nvidia boards

In reply to Simon Glass

Add calls to the LCD driver from Nvidia board code.

---
 board/nvidia/common/board.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
board/nvidia/common/board.c +20 -1
index 04990bf..1c3387d 100644
@@ -28,6 +28,7 @@
 #include <asm/arch/sys_proto.h>
 
 #include <asm/arch/board.h>
+#include <asm/arch/display.h>
 #include <asm/arch/clk_rst.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/emc.h>
@@ -78,6 +79,9 @@ static void power_det_init(void)
  */
 int board_init(void)
 {
+#ifdef CONFIG_VIDEO_TEGRA2
+	tegra_lcd_check_next_stage(gd->blob, 0);
+#endif
 	/* Do clocks and UART first so that printf() works */
 	clock_init();
 	clock_verify();
@@ -114,6 +118,9 @@ int board_init(void)
 
 	board_usb_init(gd->fdt_blob);
 #endif
+#if defined(CONFIG_VIDEO_TEGRA)
+	tegra_lcd_check_next_stage(gd->fdt_blob, 0);
+#endif
 
 #ifdef CONFIG_TEGRA2_LP0
 	/* prepare the WB code to LP0 location */
@@ -134,6 +141,18 @@ int board_early_init_f(void)
 #else
 	gpio_config_uart();
 #endif
-	return 0;
+#if defined(CONFIG_VIDEO_TEGRA)
+	tegra_lcd_early_init(gd->fdt_blob);
+#endif
+return 0;
 }
 #endif	/* EARLY_INIT */
+
+int board_late_init(void)
+{
+#ifdef CONFIG_VIDEO_TEGRA
+	/* Make sure we finish initing the LCD */
+	tegra_lcd_check_next_stage(gd->fdt_blob, 1);
+#endif
+	return 0;
+}
Signature · 1 line
1.7.7.3
#14 lore raw

PATCH 10/17 arm: Add control over cachability of memory regions

In reply to Simon Glass

Add support for adjusting the cachability of an L1 section by updating the MMU. The mmu_set_region_dcache() function allows drivers to make these changes after the MMU is set up.

It is implemented only for ARMv7 at present.

This is needed for LCD support, where we want to make the LCD frame buffer write-through (or off) rather than write-back.

---
 arch/arm/cpu/armv7/cache_v7.c |   11 +++++++
 arch/arm/include/asm/system.h |   30 ++++++++++++++++++++
 arch/arm/lib/cache-cp15.c     |   62 +++++++++++++++++++++++++++++++++-------
 3 files changed, 92 insertions(+), 11 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +11 -0
index 1b4e808..5f6d039 100644
@@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
 	v7_inval_tlb();
 }
 
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+	flush_dcache_range(start, stop);
+	v7_inval_tlb();
+}
+
 /*
  * Flush range from all levels of d-cache/unified-cache used:
  * Affects the range [start, start + size - 1]
@@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
 void  flush_cache(unsigned long start, unsigned long size)
 {
 }
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+}
+
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
 
 #ifndef CONFIG_SYS_ICACHE_OFF
arch/arm/include/asm/system.h +30 -0
index 2b28a26..f52a4fc 100644
@@ -75,6 +75,36 @@ static inline void set_cr(unsigned int val)
 	isb();
 }
 
+/* options available for data cache on each page */
+enum dcache_option {
+	DCACHE_OFF,
+	DCACHE_WRITETHROUGH,
+	DCACHE_WRITEBACK,
+};
+
+/* Size of an MMU section */
+enum {
+	MMU_SECTION_SHIFT	= 20,
+	MMU_SECTION_SIZE	= 1 << MMU_SECTION_SHIFT,
+};
+
+/**
+ * Change the cache settings for a region.
+ *
+ * \param start		start address of memory region to change
+ * \param size		size of memory region to change
+ * \param option	dcache option to select
+ */
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option option);
+
+/**
+ * Register an update to the page tables, and flush the TLB
+ *
+ * \param start		start address of update in page table
+ * \param stop		stop address of update in page table
+ */
+void mmu_page_table_flush(unsigned long start, unsigned long stop);
+
 #endif /* __ASSEMBLY__ */
 
 #define arch_align_stack(x) (x)
arch/arm/lib/cache-cp15.c +51 -11

100 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#15 lore raw

PATCH 10/17 arm: Add control over cachability of memory regions

Hi Simon,

Le 15/01/2012 01:47, Simon Glass a ?crit :

Quoted 21 lines

Add support for adjusting the cachability of an L1 section by updating the MMU. The mmu_set_region_dcache() function allows drivers to make these changes after the MMU is set up.

It is implemented only for ARMv7 at present.

This is needed for LCD support, where we want to make the LCD frame buffer write-through (or off) rather than write-back.

---
  arch/arm/cpu/armv7/cache_v7.c |   11 +++++++
  arch/arm/include/asm/system.h |   30 ++++++++++++++++++++
  arch/arm/lib/cache-cp15.c     |   62 +++++++++++++++++++++++++++++++++-------
  3 files changed, 92 insertions(+), 11 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +0 -0
index 1b4e808..5f6d039 100644

arch/arm/cpu/armv7/cache_v7.c void arm_init_before_mmu(void) · line 303

Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c +4 -0
@@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
  	v7_inval_tlb();
  }
 
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+	flush_dcache_range(start, stop);
+	v7_inval_tlb();

If that means "invalidate", then spell it out.

Quoted 143 lines
arch/arm/cpu/armv7/cache_v7.c +7 -0
+}
+
  /*
   * Flush range from all levels of d-cache/unified-cache used:
   * Affects the range [start, start + size - 1]
@@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
  void  flush_cache(unsigned long start, unsigned long size)
  {
  }
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+}
+
  #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
 
  #ifndef CONFIG_SYS_ICACHE_OFF
arch/arm/include/asm/system.h +30 -0
index 2b28a26..f52a4fc 100644
@@ -75,6 +75,36 @@ static inline void set_cr(unsigned int val)
  	isb();
  }
 
+/* options available for data cache on each page */
+enum dcache_option {
+	DCACHE_OFF,
+	DCACHE_WRITETHROUGH,
+	DCACHE_WRITEBACK,
+};
+
+/* Size of an MMU section */
+enum {
+	MMU_SECTION_SHIFT	= 20,
+	MMU_SECTION_SIZE	= 1<<  MMU_SECTION_SHIFT,
+};
+
+/**
+ * Change the cache settings for a region.
+ *
+ * \param start		start address of memory region to change
+ * \param size		size of memory region to change
+ * \param option	dcache option to select
+ */
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option option);
+
+/**
+ * Register an update to the page tables, and flush the TLB
+ *
+ * \param start		start address of update in page table
+ * \param stop		stop address of update in page table
+ */
+void mmu_page_table_flush(unsigned long start, unsigned long stop);
+
  #endif /* __ASSEMBLY__ */
 
  #define arch_align_stack(x) (x)
arch/arm/lib/cache-cp15.c +49 -8
index e6c3eae..facb1a7 100644
@@ -26,12 +26,6 @@
 
  #if !(defined(CONFIG_SYS_ICACHE_OFF)&&  defined(CONFIG_SYS_DCACHE_OFF))
 
-#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-#define CACHE_SETUP	0x1a
-#else
-#define CACHE_SETUP	0x1e
-#endif
-
  DECLARE_GLOBAL_DATA_PTR;
 
  void __arm_init_before_mmu(void)
@@ -50,9 +44,52 @@ static void cp_delay (void)
  	asm volatile("" : : : "memory");
  }
 
-static inline void dram_bank_mmu_setup(int bank)
+void set_section_dcache(int section, enum dcache_option option)
  {
+	u32 value = section<<  MMU_SECTION_SHIFT | (3<<  10);
  	u32 *page_table = (u32 *)gd->tlb_addr;
+
+	switch (option) {
+	case DCACHE_WRITETHROUGH:
+		value |= 0x1a;
+		break;
+
+	case DCACHE_WRITEBACK:
+		value |= 0x1e;
+		break;
+
+	case DCACHE_OFF:
+		value |= 0x12;
+		break;
+	}
+
+	page_table[section] = value;
+}
+
+void __mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+	debug("%s: Warning: not implemented\n", __func__);
+}
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+	__attribute__((weak, alias("__mmu_page_table_flush")));
+
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option option)
+{
+	u32 *page_table = (u32 *)gd->tlb_addr;
+	u32 upto, end;
+
+	end = ALIGN(start + size, MMU_SECTION_SIZE)>>  MMU_SECTION_SHIFT;
+	start = start>>  MMU_SECTION_SHIFT;
+	debug("mmu_set_region_dcache start=%x, size=%x, option=%d\n",
+	      start, size, option);
+	for (upto = start; upto<  end; upto++)
+		set_section_dcache(upto, option);
+	mmu_page_table_flush((u32)&page_table[start], (u32)&page_table[end]);
+}
+
+static inline void dram_bank_mmu_setup(int bank)
+{
  	bd_t *bd = gd->bd;
  	int	i;
 
@@ -60,21 +97,24 @@ static inline void dram_bank_mmu_setup(int bank)
  	for (i = bd->bi_dram[bank].start>>  20;
  	     i<  (bd->bi_dram[bank].start + bd->bi_dram[bank].size)>>  20;
  	     i++) {
-		page_table[i] = i<<  20 | (3<<  10) | CACHE_SETUP;
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+		set_section_dcache(i, DCACHE_WRITETHROUGH);
+#else
+		set_section_dcache(i, DCACHE_WRITEBACK);
+#endif
  	}
  }
 
  /* to activate the MMU we need to set up virtual memory: use 1M areas */

arch/arm/lib/cache-cp15.c static inline void dram_bank_mmu_setup(int bank) · line 77

Quoted 10 lines
arch/arm/lib/cache-cp15.c +0 -2
  static inline void mmu_setup(void)
  {
-	u32 *page_table = (u32 *)gd->tlb_addr;
  	int i;
  	u32 reg;
 
  	arm_init_before_mmu();
  	/* Set up an identity-mapping for all 4GB, rw for everyone */
  	for (i = 0; i<  4096; i++)
-		page_table[i] = i<<  20 | (3<<  10) | 0x12;

Maybe give names to some of the magic numbers here (and in other places where they appear).

arch/arm/lib/cache-cp15.c static inline void mmu_setup(void) · line 128

Quoted 13 lines
arch/arm/lib/cache-cp15.c +2 -1
+		set_section_dcache(i, DCACHE_OFF);
 
  	for (i = 0; i<  CONFIG_NR_DRAM_BANKS; i++) {
  		dram_bank_mmu_setup(i);
@@ -82,7 +122,7 @@ static inline void mmu_setup(void)
 
  	/* Copy the page table address to cp15 */
  	asm volatile("mcr p15, 0, %0, c2, c0, 0"
-		     : : "r" (page_table) : "memory");
+		     : : "r" (gd->tlb_addr) : "memory");
  	/* Set the access control to all-supervisor */
  	asm volatile("mcr p15, 0, %0, c3, c0, 0"
  		     : : "r" (~0));

Amicalement,

Signature · 1 line
Albert.
#16 lore raw

PATCH 10/17 arm: Add control over cachability of memory regions

Hi Albert,

Quoted 29 lines · Albert ARIBAUD

Hi Simon,

Le 15/01/2012 01:47, Simon Glass a ?crit :

Quoted 25 lines

Add support for adjusting the cachability of an L1 section by updating the MMU. The mmu_set_region_dcache() function allows drivers to make these changes after the MMU is set up.

It is implemented only for ARMv7 at present.

This is needed for LCD support, where we want to make the LCD frame buffer write-through (or off) rather than write-back.

---

?arch/arm/cpu/armv7/cache_v7.c | ? 11 +++++++
?arch/arm/include/asm/system.h | ? 30 ++++++++++++++++++++
?arch/arm/lib/cache-cp15.c ? ? | ? 62

+++++++++++++++++++++++++++++++++-------
?3 files changed, 92 insertions(+), 11 deletions(-)

arch/arm/cpu/armv7/cache_v7.c +0 -0
index 1b4e808..5f6d039 100644
@@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
 ? ? ? ?v7_inval_tlb();
 ?}
 
Quoted 7 lines

arch/arm/cpu/armv7/cache_v7.c void arm_init_before_mmu(void)

Quoted 4 lines
arch/arm/cpu/armv7/cache_v7.c +4 -0
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+ ? ? ? flush_dcache_range(start, stop);
+ ? ? ? v7_inval_tlb();

If that means "invalidate", then spell it out.

Are you asking for a patch to rename v7_inval_tlb()? That is an existing function - I agree it is a bit cryptic.

Quoted 154 lines
Quoted 154 lines
arch/arm/cpu/armv7/cache_v7.c +2 -0
+}
+

?/*
? * Flush range from all levels of d-cache/unified-cache used:
? * Affects the range [start, start + size - 1]

arch/arm/cpu/armv7/cache_v7.c +5 -0
@@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
 ?void ?flush_cache(unsigned long start, unsigned long size)
 ?{
 ?}
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+}
+

?#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */

?#ifndef CONFIG_SYS_ICACHE_OFF

arch/arm/include/asm/system.h +30 -0
index 2b28a26..f52a4fc 100644
@@ -75,6 +75,36 @@ static inline void set_cr(unsigned int val)
 ? ? ? ?isb();
 ?}
 
+/* options available for data cache on each page */
+enum dcache_option {
+ ? ? ? DCACHE_OFF,
+ ? ? ? DCACHE_WRITETHROUGH,
+ ? ? ? DCACHE_WRITEBACK,
+};
+
+/* Size of an MMU section */
+enum {
+ ? ? ? MMU_SECTION_SHIFT ? ? ? = 20,
+ ? ? ? MMU_SECTION_SIZE ? ? ? ?= 1<< ?MMU_SECTION_SHIFT,
+};
+
+/**
+ * Change the cache settings for a region.
+ *
+ * \param start ? ? ? ? ? ? ? ?start address of memory region to change
+ * \param size ? ? ? ? size of memory region to change
+ * \param option ? ? ? dcache option to select
+ */
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option
 option);
+
+/**
+ * Register an update to the page tables, and flush the TLB
+ *
+ * \param start ? ? ? ? ? ? ? ?start address of update in page table
+ * \param stop ? ? ? ? stop address of update in page table
+ */
+void mmu_page_table_flush(unsigned long start, unsigned long stop);
+

?#endif /* __ASSEMBLY__ */

?#define arch_align_stack(x) (x)

arch/arm/lib/cache-cp15.c +0 -6
index e6c3eae..facb1a7 100644
@@ -26,12 +26,6 @@
 
 ?#if !(defined(CONFIG_SYS_ICACHE_OFF)&& ?defined(CONFIG_SYS_DCACHE_OFF))
 
 
-#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-#define CACHE_SETUP ? ?0x1a
-#else
-#define CACHE_SETUP ? ?0x1e
-#endif
-
 ?DECLARE_GLOBAL_DATA_PTR;
 

?void __arm_init_before_mmu(void)

arch/arm/lib/cache-cp15.c +44 -1
@@ -50,9 +44,52 @@ static void cp_delay (void)
 ? ? ? ?asm volatile("" : : : "memory");
 ?}
 
-static inline void dram_bank_mmu_setup(int bank)
+void set_section_dcache(int section, enum dcache_option option)
 ?{
+ ? ? ? u32 value = section<< ?MMU_SECTION_SHIFT | (3<< ?10);
 ? ? ? ?u32 *page_table = (u32 *)gd->tlb_addr;
+
+ ? ? ? switch (option) {
+ ? ? ? case DCACHE_WRITETHROUGH:
+ ? ? ? ? ? ? ? value |= 0x1a;
+ ? ? ? ? ? ? ? break;
+
+ ? ? ? case DCACHE_WRITEBACK:
+ ? ? ? ? ? ? ? value |= 0x1e;
+ ? ? ? ? ? ? ? break;
+
+ ? ? ? case DCACHE_OFF:
+ ? ? ? ? ? ? ? value |= 0x12;
+ ? ? ? ? ? ? ? break;
+ ? ? ? }
+
+ ? ? ? page_table[section] = value;
+}
+
+void __mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+ ? ? ? debug("%s: Warning: not implemented\n", __func__);
+}
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+ ? ? ? __attribute__((weak, alias("__mmu_page_table_flush")));
+
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option
 option)
+{
+ ? ? ? u32 *page_table = (u32 *)gd->tlb_addr;
+ ? ? ? u32 upto, end;
+
+ ? ? ? end = ALIGN(start + size, MMU_SECTION_SIZE)>> ?MMU_SECTION_SHIFT;
+ ? ? ? start = start>> ?MMU_SECTION_SHIFT;
+ ? ? ? debug("mmu_set_region_dcache start=%x, size=%x, option=%d\n",
+ ? ? ? ? ? ? start, size, option);
+ ? ? ? for (upto = start; upto< ?end; upto++)
+ ? ? ? ? ? ? ? set_section_dcache(upto, option);
+ ? ? ? mmu_page_table_flush((u32)&page_table[start],
 (u32)&page_table[end]);
+}
+
+static inline void dram_bank_mmu_setup(int bank)
+{
 ? ? ? ?bd_t *bd = gd->bd;

? ? ? ?int ? ? i;

arch/arm/lib/cache-cp15.c +5 -1
@@ -60,21 +97,24 @@ static inline void dram_bank_mmu_setup(int bank)
 ? ? ? ?for (i = bd->bi_dram[bank].start>> ?20;
 ? ? ? ? ? ? i< ?(bd->bi_dram[bank].start + bd->bi_dram[bank].size)>> ?20;
 ? ? ? ? ? ? i++) {
- ? ? ? ? ? ? ? page_table[i] = i<< ?20 | (3<< ?10) | CACHE_SETUP;
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+ ? ? ? ? ? ? ? set_section_dcache(i, DCACHE_WRITETHROUGH);
+#else
+ ? ? ? ? ? ? ? set_section_dcache(i, DCACHE_WRITEBACK);
+#endif
 ? ? ? ?}
 ?}
 

?/* to activate the MMU we need to set up virtual memory: use 1M areas */ ?static inline void mmu_setup(void)
?{
- ? ? ? u32 *page_table = (u32 *)gd->tlb_addr;
? ? ? ?int i;
? ? ? ?u32 reg;

Quoted 8 lines
Quoted 4 lines

? ? ? ?arm_init_before_mmu();
? ? ? ?/* Set up an identity-mapping for all 4GB, rw for everyone */ ? ? ? ?for (i = 0; i< ?4096; i++)
- ? ? ? ? ? ? ? page_table[i] = i<< ?20 | (3<< ?10) | 0x12;

Maybe give names to some of the magic numbers here (and in other places where they appear).

OK - this line is actually being removed but I will add constants for the values in set_section_dcache().

Quoted 8 lines
Quoted 8 lines

+ ? ? ? ? ? ? ? set_section_dcache(i, DCACHE_OFF);

? ? ? ?for (i = 0; i< ?CONFIG_NR_DRAM_BANKS; i++) { ? ? ? ? ? ? ? ?dram_bank_mmu_setup(i);

arch/arm/lib/cache-cp15.c +0 -0
@@ -82,7 +122,7 @@ static inline void mmu_setup(void)
 
Quoted 12 lines
Quoted 7 lines

? ? ? ?/* Copy the page table address to cp15 */ ? ? ? ?asm volatile("mcr p15, 0, %0, c2, c0, 0"
- ? ? ? ? ? ? ? ? ? ?: : "r" (page_table) : "memory");
+ ? ? ? ? ? ? ? ? ? ?: : "r" (gd->tlb_addr) : "memory"); ? ? ? ?/* Set the access control to all-supervisor */ ? ? ? ?asm volatile("mcr p15, 0, %0, c3, c0, 0" ? ? ? ? ? ? ? ? ? ? : : "r" (~0));

Amicalement,
--
Albert.

Regards,
Simon

#17 lore raw

PATCH 11/17 lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU

In reply to Simon Glass

We want to make the display section-aligned on ARM so that we can easily turn off data caching for this.

Is this useful for other architectures? We could perhaps generalise it by adding the ability to specify the alignment size, but at least for ARM it is easier to have it be an architecture feature set by the MMU's system.h header.

---
 README        |   10 ++++++++++
 common/lcd.c  |   25 ++++++++++++++++++++-----
 include/lcd.h |    3 +++
 3 files changed, 33 insertions(+), 5 deletions(-)
README +10 -0
index 7adf7c7..d0b891f 100644
@@ -1380,6 +1380,16 @@ The following options need to be configured:
 		Normally display is black on white background; define
 		CONFIG_SYS_WHITE_ON_BLACK to get it inverted.
 
+
+		CONFIG_ALIGN_LCD_TO_SECTION
+
+		Normally the LCD is page-aligned (tyically 4KB). If this is
+		defined then the LCD will be aligned to MMU_SECTION_SIZE
+		instead. This is useful for architectures where it is cheaper
+		to change data cache settings on a per-section basis (such as
+		ARM). Only enabled on ARM at present.
+
+
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
 		If this option is set, the environment is checked for
common/lcd.c +20 -5
index bf1a6a9..be69d0d 100644
@@ -35,6 +35,9 @@
 #include <stdarg.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
+#ifdef CONFIG_ARM
+#include <asm/system.h>
+#endif
 #if defined(CONFIG_POST)
 #include <post.h>
 #endif
@@ -330,6 +333,12 @@ static void test_pattern (void)
 /* ** GENERIC Initialization Routines					*/
 /************************************************************************/
 
+int lcd_get_size(int *line_length)
+{
+	*line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+	return *line_length * panel_info.vl_row;
+}
+
 int drv_lcd_init (void)
 {
 	struct stdio_dev lcddev;
@@ -337,7 +346,7 @@ int drv_lcd_init (void)
 
 	lcd_base = (void *)(gd->fb_base);
 
-	lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
+	lcd_get_size(&lcd_line_length);
 
 	lcd_init (lcd_base);		/* LCD initialization */
 
@@ -449,15 +458,21 @@ static int lcd_init (void *lcdbase)
 ulong lcd_setmem (ulong addr)
 {
 	ulong size;
-	int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
+	int line_length;
 
 	debug ("LCD panel info: %d x %d, %d bit/pix\n",
 		panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) );
 
-	size = line_length * panel_info.vl_row;
+	size = lcd_get_size(&line_length);
 
-	/* Round up to nearest full page */
-	size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+	/* Round up to nearest full page, or MMU section if defined */
+#ifdef CONFIG_ALIGN_LCD_TO_SECTION
+	size = ALIGN(size, MMU_SECTION_SIZE);
+	addr = ALIGN(addr - MMU_SECTION_SIZE + 1, MMU_SECTION_SIZE);
+#else
+	size = ALIGN(size, PAGE_SIZE);
+	addr = ALIGN(addr - PAGE_SIZE + 1, PAGE_SIZE);
+#endif
 
 	/* Allocate pages for the frame buffer. */
 	addr -= size;
include/lcd.h +3 -0
index d95feeb..148bb54 100644
@@ -217,6 +217,9 @@ int	lcd_display_bitmap(ulong bmp_image, int x, int y);
 /* Allow boards to customize the information displayed */
 void lcd_show_board_info(void);
 
+/* Return the size of the LCD frame buffer, and the line length */
+int lcd_get_size(int *line_length);
+
 /************************************************************************/
 /* ** BITMAP DISPLAY SUPPORT						*/
 /************************************************************************/
Signature · 1 line
1.7.7.3
#18 lore raw

PATCH 11/17 lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU

Quoted 7 lines · On Saturday 14 January 2012 19:47:23 Simon Glass wrote:

We want to make the display section-aligned on ARM so that we can easily turn off data caching for this.

Is this useful for other architectures? We could perhaps generalise it by adding the ability to specify the alignment size, but at least for ARM it is easier to have it be an architecture feature set by the MMU's system.h header.

seems like a generally useful thing, but the exact alignment is a bit hackish. so perhaps the CONFIG knob should instead be the size you want to align things to ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/68675d80/attachment.pgp>

#19 lore raw

PATCH 11/17 lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU

Hi Mike,

Quoted 9 lines · Mike Frysinger
Quoted 7 lines · On Saturday 14 January 2012 19:47:23 Simon Glass wrote:

We want to make the display section-aligned on ARM so that we can easily turn off data caching for this.

Is this useful for other architectures? We could perhaps generalise it by adding the ability to specify the alignment size, but at least for ARM it is easier to have it be an architecture feature set by the MMU's system.h header.

Quoted 6 lines

seems like a generally useful thing, but the exact alignment is a bit hackish.
so perhaps the CONFIG knob should instead be the size you want to align things
to ?

OK I will do that.

Quoted 2 lines

-mike

Regards,
Simon

#20 lore raw

PATCH 12/17 lcd: Add support for flushing LCD fb from dcache after update

In reply to Simon Glass

This provides an option for the LCD to flush the dcache after each update (puts, scroll or clear).

---
 common/cmd_echo.c |    3 ++-
 common/lcd.c      |   44 +++++++++++++++++++++++++++++++++++++-------
 include/lcd.h     |    8 ++++++++
 3 files changed, 47 insertions(+), 8 deletions(-)
common/cmd_echo.c +2 -1
index 43a6da5..12efbab 100644
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 	}
 
+	/* Use puts() so that the LCD sees it as a new line */
 	if (putnl)
-		putc('\n');
+		puts("\n");
 
 	return 0;
 }
common/lcd.c +37 -7

92 lines not on this page · raw message

include/lcd.h +8 -0
index 148bb54..ab3e79d 100644
@@ -56,6 +56,14 @@ extern void lcd_initcolregs (void);
 /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
 extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
 
+/**
+ * Set whether we need to flush the dcache when changing the LCD image. This
+ * defaults to off.
+ *
+ * @param flush		non-zero to flush cache after update, 0 to skip
+ */
+void lcd_set_flush_dcache(int flush);
+
 #if defined CONFIG_MPC823
 /*
  * LCD controller stucture for MPC823 CPU
Signature · 1 line
1.7.7.3
#21 lore raw

PATCH 12/17 lcd: Add support for flushing LCD fb from dcache after update

common/cmd_echo.c int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * · line 52

Quoted 13 lines · On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
common/cmd_echo.c +2 -1
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *
 const argv[]) }
 	}
 
+	/* Use puts() so that the LCD sees it as a new line */
 	if (putnl)
-		putc('\n');
+		puts("\n");
 
 	return 0;
 }

this sounds like a hack for a broken LCD core and so the fix should be somewhere in there

common/lcd.c

Quoted 4 lines
common/lcd.c +1 -0
 
+static char lcd_flush_dcache;

seems like it'd be better as a CONFIG knob

common/lcd.c static int lcd_getfgcolor (void); · line 114

Quoted 5 lines
common/lcd.c +5 -0
+	/*
+	 * flush_dcache_range() is declared in common.h but it seems that some
+	 * architectures do not actually implement it. Is there a way to find
+	 * out whether it exists? For now, ARM is safe.
+	 */

if those arches don't implement this func, then the failure is on their head. people should feel free to use the cache api we expose in common.h.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/bf47057f/attachment.pgp>

#22 lore raw

PATCH 12/17 lcd: Add support for flushing LCD fb from dcache after update

Hi Mike,

Quoted 12 lines · Mike Frysinger
Quoted 11 lines · On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
common/cmd_echo.c +2 -1
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *
 const argv[]) }
 ? ? ? }
 
+ ? ? /* Use puts() so that the LCD sees it as a new line */
 ? ? ? if (putnl)
- ? ? ? ? ? ? putc('\n');
+ ? ? ? ? ? ? puts("\n");
 
Quoted 5 lines

common/cmd_echo.c int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * · line 52

Quoted 2 lines
common/cmd_echo.c +0 -0
 ? ? ? return 0;
 ?}

this sounds like a hack for a broken LCD core and so the fix should be somewhere in there

Well it's actually that I don't want to flush after every character (it slows things down a lot) so puts is a good place to look. I suppose we could flush after every newline we see in lcd_putc().

Quoted 7 lines

common/lcd.c

Quoted 5 lines
common/lcd.c +1 -0
 
+static char lcd_flush_dcache;

seems like it'd be better as a CONFIG knob

OK, will see if I can do that.

Quoted 9 lines
Quoted 6 lines

+ ? ? /*
+ ? ? ?* flush_dcache_range() is declared in common.h but it seems that some
+ ? ? ?* architectures do not actually implement it. Is there a way to find
+ ? ? ?* out whether it exists? For now, ARM is safe.
+ ? ? ?*/

if those arches don't implement this func, then the failure is on their head. people should feel free to use the cache api we expose in common.h.

I sort-of agree, except that I saw masses of failures. I will look a bit harder.

Regards,
Simon

Quoted 1 line

-mike

#23 lore raw

PATCH 12/17 lcd: Add support for flushing LCD fb from dcache after update

Quoted 13 lines · On Saturday 14 January 2012 20:57:25 Simon Glass wrote:
Quoted 12 lines · Mike Frysinger
Quoted 11 lines · On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
common/cmd_echo.c +2 -1
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char
 * const argv[]) }
      }
 
+     /* Use puts() so that the LCD sees it as a new line */
      if (putnl)
-             putc('\n');
+             puts("\n");
 
Quoted 8 lines
Quoted 5 lines

common/cmd_echo.c int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 52

Quoted 2 lines
common/cmd_echo.c +0 -0
      return 0;
 }

this sounds like a hack for a broken LCD core and so the fix should be somewhere in there

Well it's actually that I don't want to flush after every character (it slows things down a lot)

right, but ...

Quoted 1 line

so puts is a good place to look

most puts() that i've seen are simple loops that call putc()

Quoted 1 line

I suppose we could flush after every newline we see in lcd_putc().

that would be the right way to go i think
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/f59220b9/attachment.pgp>

#24 lore raw

PATCH 12/17 lcd: Add support for flushing LCD fb from dcache after update

Hi Mike,

Quoted 26 lines · Mike Frysinger
Quoted 5 lines · On Saturday 14 January 2012 20:57:25 Simon Glass wrote:
Quoted 4 lines · Mike Frysinger

common/cmd_echo.c int do_echo(cmd_tbl_t *cmdtp, int flag, int argc,

Quoted 3 lines · On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
common/cmd_echo.c +0 -0
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc,

char

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
common/cmd_echo.c +2 -1
 * const argv[]) }
      }
 
+     /* Use puts() so that the LCD sees it as a new line */
      if (putnl)
-             putc('\n');
+             puts("\n");
 
Quoted 8 lines
Quoted 5 lines

common/cmd_echo.c int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 52

Quoted 2 lines
common/cmd_echo.c +0 -0
      return 0;
 }

this sounds like a hack for a broken LCD core and so the fix should be somewhere in there

Well it's actually that I don't want to flush after every character (it slows things down a lot)

right, but ...

Quoted 8 lines
Quoted 1 line

so puts is a good place to look

most puts() that i've seen are simple loops that call putc()

Quoted 1 line

I suppose we could flush after every newline we see in lcd_putc().

that would be the right way to go i think

Yes indeed, will fix.

Quoted 2 lines

-mike

Regards,
Simon

#25 lore raw

PATCH 13/17 tegra: Align LCD frame buffer to section boundary

In reply to Simon Glass

For tegra we want to enable the cache for the LCD. This is easier if we can avoid using L2 page tages, so align the LCD to a section boundary.

---
 include/configs/tegra2-common.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/tegra2-common.h +1 -0
index 97ac6cd..ff4d90d 100644
@@ -44,6 +44,7 @@
 #define CONFIG_SYS_CACHELINE_SIZE	32
 
 #define CONFIG_ARCH_CPU_INIT		/* Fire up the A9 core */
+#define CONFIG_ALIGN_LCD_TO_SECTION	/* Align LCD to 1MB boundary */
 
 #include <asm/arch/tegra2.h>		/* get chip and board defs */
 
Signature · 1 line
1.7.7.3
#26 lore raw

PATCH 14/17 tegra: Support control of cache settings for LCD

In reply to Simon Glass

Add support for selecting the required cache mode for the LCD:
off, write-through or write-back.

---
 drivers/video/tegra.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/video/tegra.c +9 -0
index 7622d2d..f244cc1 100644
@@ -175,6 +175,15 @@ void lcd_ctrl_init(void *lcdbase)
 		return;
 	}
 
+	/* For write-through or cache off, change the LCD memory region */
+	if (!(config.cache_type & FDT_LCD_CACHE_WRITE_BACK))
+		mmu_set_region_dcache(config.frame_buffer, size,
+			config.cache_type & FDT_LCD_CACHE_WRITE_THROUGH ?
+				DCACHE_WRITETHROUGH : DCACHE_OFF);
+
+	/* Enable flushing after LCD writes if requested */
+	lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH);
+
 	debug("LCD frame buffer at %p\n", lcd_base);
 }
 
Signature · 1 line
1.7.7.3
#27 lore raw

PATCH 16/17 lcd: Add CONSOLE_SCROLL_LINES option to speed console

In reply to Simon Glass

When the cursor position gets to the end of the LCD console we normally scroll by one line. This adds an option to increase that value.

Console scrolling is often slow, and if a large amount of output is being sent, increasing this option to 10 or so will speed things up considerably.

---
 README       |    6 ++++++
 common/lcd.c |   16 +++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
README +6 -0
index d0b891f..c2f6699 100644
@@ -1389,6 +1389,12 @@ The following options need to be configured:
 		to change data cache settings on a per-section basis (such as
 		ARM). Only enabled on ARM at present.
 
+		CONSOLE_SCROLL_LINES
+
+		When the console need to be scrolled, this is the number of
+		lines to scroll by. It defaults to 1. Increasing this makes
+		the console jump but can help speed up operation when scrolling
+		is slow.
 
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
common/lcd.c +13 -3
index 707f785..b6da10e 100644
@@ -130,12 +130,23 @@ void lcd_set_flush_dcache(int flush)
 
 static void console_scrollup (void)
 {
+	int rows = 1;
+
+#ifdef CONSOLE_SCROLL_LINES
+	rows = CONSOLE_SCROLL_LINES;
+#endif
 	/* Copy up rows ignoring the first one */
-	memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
+	memcpy(CONSOLE_ROW_FIRST,
+	       lcd_console_address + CONSOLE_ROW_SIZE * rows,
+	       CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
 
 	/* Clear the last one */
-	memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+	memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
+		COLOR_MASK(lcd_color_bg),
+	       CONSOLE_ROW_SIZE * rows);
+
 	lcd_sync();
+	console_row -= rows;
 }
 
 /*----------------------------------------------------------------------*/
@@ -165,7 +176,6 @@ static inline void console_newline (void)
 	if (console_row >= CONSOLE_ROWS) {
 		/* Scroll everything up */
 		console_scrollup () ;
-		--console_row;
 	}
 }
 
Signature · 1 line
1.7.7.3
#28 lore raw

PATCH 17/17 tegra: Enable display/lcd support on Seaboard

In reply to Simon Glass

From: Mayuresh Kulkarni <[email protected]>

Enable the Seaboard's 16bpp LCD and use it as the console.

---
 include/configs/seaboard.h |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
include/configs/seaboard.h +10 -2
index fe60b38..09c4196 100644
@@ -64,6 +64,7 @@
 #define CONFIG_SYS_BOARD_ODMDATA	0x300d8011 /* lp1, 1GB */
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT		/* Make sure LCD init is complete */
 
 /* SPI */
 #define CONFIG_TEGRA2_SPI
@@ -123,6 +124,13 @@
 
 #undef TEGRA2_DEVICE_SETTINGS
 #define TEGRA2_DEVICE_SETTINGS	"stdin=serial,tegra-kbc\0" \
-					"stdout=serial\0" \
-					"stderr=serial\0"
+					"stdout=serial,lcd\0" \
+					"stderr=serial,lcd\0"
+
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPP				LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONSOLE_SCROLL_LINES		10
 #endif /* __CONFIG_H */
Signature · 1 line
1.7.7.3
#29 lore raw

cover tegra: Add display driver and LCD support for Seaboard

In reply to Simon Glass
Quoted 67 lines · Simon Glass

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

  README                                          |   16 +
  arch/arm/cpu/armv7/cache_v7.c                   |   11 +
  arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
  arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
  arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
  arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
  arch/arm/dts/tegra20.dtsi                       |   25 +
  arch/arm/include/asm/arch-tegra2/dc.h           |  544 +++++++++++++++++++++++
  arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
  arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
  arch/arm/include/asm/system.h                   |   30 ++
  arch/arm/lib/cache-cp15.c                       |   62 +++-
  board/nvidia/common/board.c                     |   21 +-
  board/nvidia/dts/tegra2-seaboard.dts            |   21 +
  common/cmd_echo.c                               |    3 +-
  common/lcd.c                                    |   85 +++-
  doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
  drivers/video/Makefile                          |    1 +
  drivers/video/tegra.c                           |  388 ++++++++++++++++
  include/configs/seaboard.h                      |   12 +-
  include/configs/tegra2-common.h                 |    1 +
  include/fdtdec.h                                |   17 +
  include/lcd.h                                   |   11 +
  lib/fdtdec.c                                    |   15 +-
  24 files changed, 1862 insertions(+), 31 deletions(-)
Quoted 8 lines

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

Hi Simon,

I have added your patch sources manually into the "Prepare v2012.04-rc1 release", because I got errors at apply. Also I added a device tree source file for Harmony.

I tested the device tree source file for Harmony and your patch sources on our Harmony hardware and generated a new patch file:

http://poeggi.dotsec.net/nvidia/uboot-lvds-init-patch/0001-Add-display-driver-and-LCD-support-for-Harmony-board.patch

I hope it's all okay, this my first patch release.

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

Greetings
Christian

Changes:

- Add device tree source file for Harmony board
- Add bug fix in display.c
- Patch based on the "Prepare v2012.04-rc1" release

---
  README                                          |    7 +
  arch/arm/cpu/armv7/cache_v7.c                   |   11 +
  arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
  arch/arm/cpu/armv7/tegra2/display.c             |  282 ++++++++++++
  arch/arm/cpu/armv7/tegra2/funcmux.c             |   41 ++
  arch/arm/cpu/armv7/tegra2/pwfm.c                |   45 ++
  arch/arm/dts/tegra20.dtsi                       |   26 ++
  arch/arm/include/asm/arch-tegra2/dc.h           |  544 
+++++++++++++++++++++++
  arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
  arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
  arch/arm/include/asm/system.h                   |   30 ++
  arch/arm/lib/cache-cp15.c                       |   61 +++-
  board/nvidia/common/board.c                     |   20 +
  board/nvidia/dts/tegra2-harmony.dts             |   97 ++++
  board/nvidia/dts/tegra2-seaboard.dts            |   21 +
  common/cmd_echo.c                               |    2 +-
  common/lcd.c                                    |   86 +++-
  doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
  drivers/video/Makefile                          |    1 +
  drivers/video/tegra.c                           |  397 +++++++++++++++++
  dts/Makefile                                    |    2 +-
  include/configs/harmony.h                       |   39 ++-
  include/configs/tegra2-common.h                 |  218 +++++++++-
  include/fdtdec.h                                |   19 +-
  include/lcd.h                                   |   12 +
  lib/fdtdec.c                                    |   12 +
  26 files changed, 2206 insertions(+), 47 deletions(-)

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 board/nvidia/dts/tegra2-harmony.dts create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

#30 lore raw

cover tegra: Add display driver and LCD support for Seaboard

Hi Christian,

Quoted 88 lines · Christian Kroehnert
Quoted 69 lines · Simon Glass

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

  README                                          |   16 +
  arch/arm/cpu/armv7/cache_v7.c                   |   11 +
  arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
  arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
  arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
  arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
  arch/arm/dts/tegra20.dtsi                       |   25 +
  arch/arm/include/asm/arch-tegra2/dc.h           |  544
+++++++++++++++++++++++
  arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
  arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
  arch/arm/include/asm/system.h                   |   30 ++
  arch/arm/lib/cache-cp15.c                       |   62 +++-
  board/nvidia/common/board.c                     |   21 +-
  board/nvidia/dts/tegra2-seaboard.dts            |   21 +
  common/cmd_echo.c                               |    3 +-
  common/lcd.c                                    |   85 +++-
  doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
  drivers/video/Makefile                          |    1 +
  drivers/video/tegra.c                           |  388 ++++++++++++++++
  include/configs/seaboard.h                      |   12 +-
  include/configs/tegra2-common.h                 |    1 +
  include/fdtdec.h                                |   17 +
  include/lcd.h                                   |   11 +
  lib/fdtdec.c                                    |   15 +-
  24 files changed, 1862 insertions(+), 31 deletions(-)
Quoted 8 lines

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

Hi Simon,

I have added your patch sources manually into the "Prepare v2012.04-rc1 release", because I got errors at apply. Also I added a device tree source file for Harmony.

I tested the device tree source file for Harmony and your patch sources on our Harmony hardware and generated a new patch file:

Quoted 6 lines

http://poeggi.dotsec.net/nvidia/uboot-lvds-init-patch/0001-Add-display-driver-and-LCD-support-for-Harmony-board.patch

I hope it's all okay, this my first patch release.

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

I see this code:

	u32 m_value;

	m_value = readl(0x54202e04);
	m_value &= ~0x2;
	writel(m_value, 0x54202e04);

What register are you actually writing here? I can't find it in my manual, but maybe I just haven't seen that address.

Also I notice you have changed the memorypriorites:

writel(0x00202020, &disp->mem_high_pri); writel(0x00010101, &disp->mem_high_pri_timer);

Does that make a difference in your system?

Regards,
Simon

Quoted 59 lines

Greetings
Christian

Changes:

- Add device tree source file for Harmony board
- Add bug fix in display.c
- Patch based on the "Prepare v2012.04-rc1" release

---
 README                                          |    7 +
 arch/arm/cpu/armv7/cache_v7.c                   |   11 +
 arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
 arch/arm/cpu/armv7/tegra2/display.c             |  282 ++++++++++++
 arch/arm/cpu/armv7/tegra2/funcmux.c             |   41 ++
 arch/arm/cpu/armv7/tegra2/pwfm.c                |   45 ++
 arch/arm/dts/tegra20.dtsi                       |   26 ++
 arch/arm/include/asm/arch-tegra2/dc.h           |  544
+++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
 arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
 arch/arm/include/asm/system.h                   |   30 ++
 arch/arm/lib/cache-cp15.c                       |   61 +++-
 board/nvidia/common/board.c                     |   20 +
 board/nvidia/dts/tegra2-harmony.dts             |   97 ++++
 board/nvidia/dts/tegra2-seaboard.dts            |   21 +
 common/cmd_echo.c                               |    2 +-
 common/lcd.c                                    |   86 +++-
 doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
 drivers/video/Makefile                          |    1 +
 drivers/video/tegra.c                           |  397 +++++++++++++++++
 dts/Makefile                                    |    2 +-
 include/configs/harmony.h                       |   39 ++-
 include/configs/tegra2-common.h                 |  218 +++++++++-
 include/fdtdec.h                                |   19 +-
 include/lcd.h                                   |   12 +
 lib/fdtdec.c                                    |   12 +
 26 files changed, 2206 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/display.c
 create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h
 create mode 100644 board/nvidia/dts/tegra2-harmony.dts
 create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt
 create mode 100644 drivers/video/tegra.c

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#31 lore raw

cover tegra: Add display driver and LCD support for Seaboard

Quoted 101 lines · Simon Glass

Hi Christian,

Quoted 88 lines · Christian Kroehnert
Quoted 69 lines · Simon Glass

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

  README                                          |   16 +
  arch/arm/cpu/armv7/cache_v7.c                   |   11 +
  arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
  arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
  arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
  arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
  arch/arm/dts/tegra20.dtsi                       |   25 +
  arch/arm/include/asm/arch-tegra2/dc.h           |  544
+++++++++++++++++++++++
  arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
  arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
  arch/arm/include/asm/system.h                   |   30 ++
  arch/arm/lib/cache-cp15.c                       |   62 +++-
  board/nvidia/common/board.c                     |   21 +-
  board/nvidia/dts/tegra2-seaboard.dts            |   21 +
  common/cmd_echo.c                               |    3 +-
  common/lcd.c                                    |   85 +++-
  doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
  drivers/video/Makefile                          |    1 +
  drivers/video/tegra.c                           |  388 ++++++++++++++++
  include/configs/seaboard.h                      |   12 +-
  include/configs/tegra2-common.h                 |    1 +
  include/fdtdec.h                                |   17 +
  include/lcd.h                                   |   11 +
  lib/fdtdec.c                                    |   15 +-
  24 files changed, 1862 insertions(+), 31 deletions(-)
Quoted 8 lines

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

Hi Simon,

I have added your patch sources manually into the "Prepare v2012.04-rc1 release", because I got errors at apply. Also I added a device tree source file for Harmony.

I tested the device tree source file for Harmony and your patch sources on our Harmony hardware and generated a new patch file:

Quoted 6 lines

http://poeggi.dotsec.net/nvidia/uboot-lvds-init-patch/0001-Add-display-driver-and-LCD-support-for-Harmony-board.patch

I hope it's all okay, this my first patch release.

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

I see this code:

Quoted 8 lines
	u32 m_value;

	m_value = readl(0x54202e04);
	m_value &= ~0x2;
	writel(m_value, 0x54202e04);

What register are you actually writing here? I can't find it in my manual, but maybe I just haven't seen that address.

At the time I did look for that register as well but couldn't find anything. But I believe that we saw the garbled display issue that has been mentioned in another thread. If I remember correctly this particular register write was the fix for it.

But I wasn't very much involved at the time, so maybe Christian can clarify. However I was going to test your newest version of the LCD patch series on our hardware and see if the issue is still there.

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/20120717/8e1ef6bf/attachment.pgp>

#32 lore raw

cover tegra: Add display driver and LCD support for Seaboard

+Tom, Stephen

Quoted 111 lines · Thierry Reding
Quoted 101 lines · Simon Glass

Hi Christian,

Quoted 88 lines · Christian Kroehnert
Quoted 69 lines · Simon Glass

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

  README                                          |   16 +
  arch/arm/cpu/armv7/cache_v7.c                   |   11 +
  arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
  arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
  arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
  arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
  arch/arm/dts/tegra20.dtsi                       |   25 +
  arch/arm/include/asm/arch-tegra2/dc.h           |  544
+++++++++++++++++++++++
  arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
  arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
  arch/arm/include/asm/system.h                   |   30 ++
  arch/arm/lib/cache-cp15.c                       |   62 +++-
  board/nvidia/common/board.c                     |   21 +-
  board/nvidia/dts/tegra2-seaboard.dts            |   21 +
  common/cmd_echo.c                               |    3 +-
  common/lcd.c                                    |   85 +++-
  doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
  drivers/video/Makefile                          |    1 +
  drivers/video/tegra.c                           |  388 ++++++++++++++++
  include/configs/seaboard.h                      |   12 +-
  include/configs/tegra2-common.h                 |    1 +
  include/fdtdec.h                                |   17 +
  include/lcd.h                                   |   11 +
  lib/fdtdec.c                                    |   15 +-
  24 files changed, 1862 insertions(+), 31 deletions(-)
Quoted 8 lines

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

Hi Simon,

I have added your patch sources manually into the "Prepare v2012.04-rc1 release", because I got errors at apply. Also I added a device tree source file for Harmony.

I tested the device tree source file for Harmony and your patch sources on our Harmony hardware and generated a new patch file:

Quoted 6 lines

http://poeggi.dotsec.net/nvidia/uboot-lvds-init-patch/0001-Add-display-driver-and-LCD-support-for-Harmony-board.patch

I hope it's all okay, this my first patch release.

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

I see this code:

Quoted 8 lines
      u32 m_value;

      m_value = readl(0x54202e04);
      m_value &= ~0x2;
      writel(m_value, 0x54202e04);

What register are you actually writing here? I can't find it in my manual, but maybe I just haven't seen that address.

Quoted 8 lines

At the time I did look for that register as well but couldn't find anything. But I believe that we saw the garbled display issue that has been mentioned in another thread. If I remember correctly this particular register write was the fix for it.

But I wasn't very much involved at the time, so maybe Christian can clarify. However I was going to test your newest version of the LCD patch series on our hardware and see if the issue is still there.

Does anyone know what this register is for? I am reluctant to add this code to the patch without at least a comment.

Quoted 2 lines

Thierry

Regards,
Simon

#33 lore raw

cover tegra: Add display driver and LCD support for Seaboard

Am 18.07.2012 08:51, schrieb Simon Glass:

Quoted 124 lines

+Tom, Stephen

Quoted 111 lines · Thierry Reding
Quoted 101 lines · Simon Glass

Hi Christian,

Quoted 88 lines · Christian Kroehnert
Quoted 69 lines · Simon Glass

This series adds support for the Tegra2x's display peripheral. This supports the LCD display on Seaboard and we use this to enable console output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after each call puts(). This dramatically increases performance (around 10x). This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This speeds up scrolling output considerably, particularly commands like 'printenv' which display a lot of output. This requires a new CONFIG and a change to the console_scrollup() function.

Mayuresh Kulkarni (1):
tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
fdt: Add function to look up a phandle's register address
fdt: Add header guard to fdtdec.h
fdt: Correct GPIO name access in fdtdec
tegra: Add display support to funcmux
tegra: fdt: Add LCD definitions for Tegra
tegra: Add support for PWFM
tegra: Add LCD driver
tegra: Add LCD support to Nvidia boards
arm: Add control over cachability of memory regions
lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
lcd: Add support for flushing LCD fb from dcache after update
tegra: Align LCD frame buffer to section boundary
tegra: Support control of cache settings for LCD
tegra: fdt: Add LCD definitions for Seaboard
lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
tegra: Add SOC support for display/lcd

   README                                          |   16 +
   arch/arm/cpu/armv7/cache_v7.c                   |   11 +
   arch/arm/cpu/armv7/tegra2/Makefile              |    1 +
   arch/arm/cpu/armv7/tegra2/display.c             |  271 +++++++++++
   arch/arm/cpu/armv7/tegra2/funcmux.c             |   39 ++
   arch/arm/cpu/armv7/tegra2/pwfm.c                |   40 ++
   arch/arm/dts/tegra20.dtsi                       |   25 +
   arch/arm/include/asm/arch-tegra2/dc.h           |  544
+++++++++++++++++++++++
   arch/arm/include/asm/arch-tegra2/display.h      |  133 ++++++
   arch/arm/include/asm/arch-tegra2/pwfm.h         |   54 +++
   arch/arm/include/asm/system.h                   |   30 ++
   arch/arm/lib/cache-cp15.c                       |   62 +++-
   board/nvidia/common/board.c                     |   21 +-
   board/nvidia/dts/tegra2-seaboard.dts            |   21 +
   common/cmd_echo.c                               |    3 +-
   common/lcd.c                                    |   85 +++-
   doc/device-tree-bindings/video/nvidia-video.txt |   92 ++++
   drivers/video/Makefile                          |    1 +
   drivers/video/tegra.c                           |  388 ++++++++++++++++
   include/configs/seaboard.h                      |   12 +-
   include/configs/tegra2-common.h                 |    1 +
   include/fdtdec.h                                |   17 +
   include/lcd.h                                   |   11 +
   lib/fdtdec.c                                    |   15 +-
   24 files changed, 1862 insertions(+), 31 deletions(-)
Quoted 8 lines

create mode 100644 arch/arm/cpu/armv7/tegra2/display.c create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h create mode 100644 arch/arm/include/asm/arch-tegra2/display.h create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt create mode 100644 drivers/video/tegra.c

Hi Simon,

I have added your patch sources manually into the "Prepare v2012.04-rc1 release", because I got errors at apply. Also I added a device tree source file for Harmony.

I tested the device tree source file for Harmony and your patch sources on our Harmony hardware and generated a new patch file:

Quoted 6 lines

http://poeggi.dotsec.net/nvidia/uboot-lvds-init-patch/0001-Add-display-driver-and-LCD-support-for-Harmony-board.patch

I hope it's all okay, this my first patch release.

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

I see this code:

Quoted 8 lines
       u32 m_value;

       m_value = readl(0x54202e04);
       m_value &= ~0x2;
       writel(m_value, 0x54202e04);

What register are you actually writing here? I can't find it in my manual, but maybe I just haven't seen that address.

Quoted 8 lines

At the time I did look for that register as well but couldn't find anything. But I believe that we saw the garbled display issue that has been mentioned in another thread. If I remember correctly this particular register write was the fix for it.

But I wasn't very much involved at the time, so maybe Christian can clarify. However I was going to test your newest version of the LCD patch series on our hardware and see if the issue is still there.

Quoted 9 lines

Does anyone know what this register is for? I am reluctant to add this code to the patch without at least a comment.

Quoted 2 lines

Thierry

Regards,
Simon

Also in our manual this register is not documented. The garbed images emerged when the tempature of ARM processor was high (after 2min standby and then a reboot) or if I cool it down with ice spay before the boot up. So when I didn't cleared this register, I got garbled images. I don't have the device here, on which I have tested, so I can reproduce it. Thierry have tested it on a other device with the newest version of the LCD patch and he can't reproduce the garbed images.

Best regards
Christian

#34 lore raw

cover tegra: Add display driver and LCD support for Seaboard

In reply to Simon Glass
Quoted 9 lines · Simon Glass

+Tom, Stephen

Quoted 5 lines · Thierry Reding
Quoted 4 lines · Simon Glass

Hi Christian,

On Thu, Apr 19, 2012 at 2:41 PM, Christian Kroehnert <[email protected]> wrote:

...

Quoted 19 lines
Quoted 19 lines
Quoted 5 lines
Quoted 2 lines

In the display.c source file I implemented a bug fix, because I get garbled images on the LCD without this fix.

I see this code:

Quoted 8 lines
      u32 m_value;

      m_value = readl(0x54202e04);
      m_value &= ~0x2;
      writel(m_value, 0x54202e04);

What register are you actually writing here? I can't find it in my manual, but maybe I just haven't seen that address.

At the time I did look for that register as well but couldn't find anything. But I believe that we saw the garbled display issue that has been mentioned in another thread. If I remember correctly this particular register write was the fix for it.

Quoted 6 lines
Quoted 3 lines

But I wasn't very much involved at the time, so maybe Christian can clarify. However I was going to test your newest version of the LCD patch series on our hardware and see if the issue is still there.

Does anyone know what this register is for? I am reluctant to add this code to the patch without at least a comment.

That address is an alias for DC_WIN_A_BYTE_SWAP_0 (offset 0x701), which is documented in the TRM. It seems unlikely this was solve the issue at hand, if I remember it correctly.