Skip to contentSkip to conversation

tegra: Add eDP support for nyan-big

PATCH Superseded Simon Glass 3 participants 35 messages Apr 15, 2015 – Apr 29, 2015

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v6 cover tegra: Add eDP support for nyan-big

This series adds eDP support for nyan-big so that the display works.

Nyan-big is based on tegra124.

Some support is added for new clocks to make this work. The drm_dp_helper.h file is brought in from Linux since many of the DisplayPort constants are generic. A very simple uclass is added for DisplayPort, and the Tegra driver makes use of that. The U-Boot EDID support is enhanced to read some additional information (detailed timings).

There is existing video support for Tegra20, but I don't think it works for Tegra30/114 (is this correct?). This series relies on detecting the display at run-time as I cannot find a good device tree binding for things like display depth. But if we could resolve that then it might be possible to move Tegra20 over to use the same driver, etc. There is clearly a lot in common with the display controllers - I have exploited this with the header file but not with the C file.

HDMI is not supported at present. If this is easy and there is an existing driver to follow along with then I might be able to incorporate it later.

This series is available at u-boot-dm/nyan-working

Changes in v6:
- Add a comment about tegra_dc_dp_check_sink()
- Add more debug() statements
- Add new patch to sort the uclasses
- Fix incorrect use of DP_MAIN_LINK_CHANNEL_CODING_SET register
- Improve retry logic in tegra_dc_dp_check_sink()
- Report failure when we cannot init the eDP display

Changes in v4:
- Rebase on u-boot-dm/next since this series is still pending

Changes in v3:
- Add full link training support
- Change parameters of update_display_mode()
- Fix 64-bit maths error
- Fix trainging typo
- Reorder parameters to tegra_dc_sor_attach()
- Set scramble_ena to 1 on start-up so that link training succeeds
- Simplify timouts to remove repeated multiplication by 1000
- Use real error return values in tegra_dc_dpaux_write_chunk() and others
- Use sor pointer in struct tegra_dp_priv

Changes in v2:
- Rebase on top of u-boot-dm
- Remove definition of BIT()

Simon Glass (26):
dm: core: Sort the uclasses
dm: gpio: Add error handling and a function to claim vector GPIOs
fdt: Add binding decode function for display-timings
tegra: Move the pwm into tegra-common
tegra: pwm: Allow the clock rate to be left as is
tegra: Move checkboard() into the board code
tegra: Add a board ID function
power: Export register access functions from as3722
tegra: Provide a function to allow LCD PMIC setup
tegra: Add support for setting up a as3722 PMIC
tegra: nyan-big: Add LCD PMIC init and board ID
tegra124: dts: Add host1x node to provide display information
tegra: config: Use CONFIG_LCD to detect LCD presence
tegra: clock: Add checking for invalid clock IDs
tegra: clock: Split the clock source code into a separate function
tegra124: clock: Add display clocks and functions
tegra: Move display controller header into common
video: Add drm_dp_helper.h
edid: Add a function to read detailed monitor timings
dm: video: Add a uclass for display port
tegra: dts: nyan-big: Add definitions for eDP display
tegra: video: Support serial output resource (SOR) on tegra124
tegra: video: Add Embedded DisplayPort driver
tegra: video: support eDP displays on Tegra124 devices
tegra: config: nyan-big: Enable LCD
tegra124: video: Add full link training for eDP

 arch/arm/dts/tegra124-nyan-big.dts                 |   47 +
 arch/arm/dts/tegra124.dtsi                         |   84 +
 arch/arm/include/asm/arch-tegra/clk_rst.h          |   15 +-
 arch/arm/include/asm/arch-tegra/clock.h            |   14 +
 .../include/asm/{arch-tegra20 => arch-tegra}/dc.h  |   67 +-
 arch/arm/include/asm/arch-tegra/pwm.h              |   60 +
 arch/arm/include/asm/arch-tegra/sys_proto.h        |   19 +-
 arch/arm/include/asm/arch-tegra124/clock-tables.h  |    3 +-
 arch/arm/include/asm/arch-tegra124/clock.h         |   21 +
 arch/arm/include/asm/arch-tegra124/display.h       |   58 +
 arch/arm/include/asm/arch-tegra124/pwm.h           |   14 +
 arch/arm/include/asm/arch-tegra20/display.h        |    2 +-
 arch/arm/include/asm/arch-tegra20/pwm.h            |   54 +-
 arch/arm/mach-tegra/Makefile                       |    1 +
 arch/arm/mach-tegra/board.c                        |    8 -
 arch/arm/mach-tegra/clock.c                        |   83 +-
 arch/arm/mach-tegra/{tegra20 => }/pwm.c            |    7 +-
 arch/arm/mach-tegra/tegra124/clock.c               |  141 +-
 arch/arm/mach-tegra/tegra20/Makefile               |    1 -
 arch/arm/mach-tegra/tegra20/display.c              |    2 +-
 board/nvidia/common/board.c                        |   40 +-
 board/nvidia/nyan-big/nyan-big.c                   |   34 +-
 common/edid.c                                      |  105 ++
 configs/nyan-big_defconfig                         |    2 +
 .../gpu/nvidia,tegra20-host1x.txt                  |  372 +++++
 doc/device-tree-bindings/video/display-timing.txt  |  110 ++
 drivers/gpio/gpio-uclass.c                         |   38 +-
 drivers/power/as3722.c                             |   16 +-
 drivers/video/Kconfig                              |   15 +
 drivers/video/Makefile                             |    6 +
 drivers/video/dp-uclass.c                          |   34 +
 drivers/video/tegra124/Makefile                    |   10 +
 drivers/video/tegra124/display.c                   |  472 ++++++
 drivers/video/tegra124/displayport.h               |  412 +++++
 drivers/video/tegra124/dp.c                        | 1607 ++++++++++++++++++++
 drivers/video/tegra124/sor.c                       | 1024 +++++++++++++
 drivers/video/tegra124/sor.h                       |  922 +++++++++++
 drivers/video/tegra124/tegra124-lcd.c              |   97 ++
 include/asm-generic/gpio.h                         |   15 +-
 include/configs/nyan-big.h                         |   14 +
 include/configs/tegra-common-post.h                |    2 +-
 include/displayport.h                              |   60 +
 include/dm/uclass-id.h                             |   29 +-
 include/edid.h                                     |   19 +
 include/fdtdec.h                                   |   81 +
 include/linux/drm_dp_helper.h                      |  406 +++++
 include/power/as3722.h                             |    3 +
 lib/fdtdec.c                                       |   95 ++
 48 files changed, 6599 insertions(+), 142 deletions(-)
 rename arch/arm/include/asm/{arch-tegra20 => arch-tegra}/dc.h (89%)
 create mode 100644 arch/arm/include/asm/arch-tegra/pwm.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pwm.h
 rename arch/arm/mach-tegra/{tegra20 => }/pwm.c (93%)
 create mode 100644 doc/device-tree-bindings/gpu/nvidia,tegra20-host1x.txt
 create mode 100644 doc/device-tree-bindings/video/display-timing.txt
 create mode 100644 drivers/video/dp-uclass.c
 create mode 100644 drivers/video/tegra124/Makefile
 create mode 100644 drivers/video/tegra124/display.c
 create mode 100644 drivers/video/tegra124/displayport.h
 create mode 100644 drivers/video/tegra124/dp.c
 create mode 100644 drivers/video/tegra124/sor.c
 create mode 100644 drivers/video/tegra124/sor.h
 create mode 100644 drivers/video/tegra124/tegra124-lcd.c
 create mode 100644 include/displayport.h
 create mode 100644 include/linux/drm_dp_helper.h
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v6 1/26 dm: core: Sort the uclasses

Sort uclasses into alphabetical order and tidy up the comments.

---

Changes in v6:
- Add new patch to sort the uclasses

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/dm/uclass-id.h | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
include/dm/uclass-id.h +14 -14
index fddfd35..ddcd9c6 100644
@@ -22,29 +22,29 @@ enum uclass_id {
 	UCLASS_I2C_EMUL,	/* sandbox I2C device emulator */
 	UCLASS_PCI_EMUL,	/* sandbox PCI device emulator */
 	UCLASS_USB_EMUL,	/* sandbox USB bus device emulator */
-	UCLASS_SIMPLE_BUS,
+	UCLASS_SIMPLE_BUS,	/* bus with child devices */
 
-	/* U-Boot uclasses start here */
+	/* U-Boot uclasses start here - in alphabetical order */
+	UCLASS_CROS_EC,		/* Chrome OS EC */
+	UCLASS_ETH,		/* Ethernet device */
 	UCLASS_GPIO,		/* Bank of general-purpose I/O pins */
-	UCLASS_SERIAL,		/* Serial UART */
-	UCLASS_SPI,		/* SPI bus */
-	UCLASS_SPI_GENERIC,	/* Generic SPI flash target */
-	UCLASS_SPI_FLASH,	/* SPI flash */
-	UCLASS_CROS_EC,	/* Chrome OS EC */
-	UCLASS_THERMAL,		/* Thermal sensor */
 	UCLASS_I2C,		/* I2C bus */
-	UCLASS_I2C_GENERIC,	/* Generic I2C device */
 	UCLASS_I2C_EEPROM,	/* I2C EEPROM device */
+	UCLASS_I2C_GENERIC,	/* Generic I2C device */
+	UCLASS_LPC,		/* x86 'low pin count' interface */
+	UCLASS_MASS_STORAGE,	/* Mass storage device */
 	UCLASS_MOD_EXP,		/* RSA Mod Exp device */
+	UCLASS_PCH,		/* x86 platform controller hub */
 	UCLASS_PCI,		/* PCI bus */
 	UCLASS_PCI_GENERIC,	/* Generic PCI bus device */
-	UCLASS_PCH,		/* x86 platform controller hub */
-	UCLASS_ETH,		/* Ethernet device */
-	UCLASS_LPC,		/* x86 'low pin count' interface */
+	UCLASS_SERIAL,		/* Serial UART */
+	UCLASS_SPI,		/* SPI bus */
+	UCLASS_SPI_GENERIC,	/* Generic SPI flash target */
+	UCLASS_SPI_FLASH,	/* SPI flash */
+	UCLASS_THERMAL,		/* Thermal sensor */
 	UCLASS_USB,		/* USB bus */
-	UCLASS_USB_HUB,		/* USB hub */
 	UCLASS_USB_DEV_GENERIC,	/* USB generic device */
-	UCLASS_MASS_STORAGE,	/* Mass storage device */
+	UCLASS_USB_HUB,		/* USB hub */
 
 	UCLASS_COUNT,
 	UCLASS_INVALID = -1,
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

PATCH v6 2/26 dm: gpio: Add error handling and a function to claim vector GPIOs

In reply to Simon Glass

gpio_get_values_as_int() should return an error if something goes wrong. Also provide gpio_claim_vector(), a function to request the GPIOs and set them to input mode. Otherwise callers have to do this themselves.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/gpio/gpio-uclass.c | 38 +++++++++++++++++++++++++++++++++++---
 include/asm-generic/gpio.h | 15 ++++++++++++---
 2 files changed, 47 insertions(+), 6 deletions(-)
drivers/gpio/gpio-uclass.c +35 -3
index 381868b..530bb3e 100644
@@ -495,22 +495,54 @@ int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize)
 	return 0;
 }
 
+int gpio_claim_vector(const int *gpio_num_array, const char *fmt)
+{
+	int i, ret;
+	int gpio;
+
+	for (i = 0; i < 32; i++) {
+		gpio = gpio_num_array[i];
+		if (gpio == -1)
+			break;
+		ret = gpio_requestf(gpio, fmt, i);
+		if (ret)
+			goto err;
+		ret = gpio_direction_input(gpio);
+		if (ret) {
+			gpio_free(gpio);
+			goto err;
+		}
+	}
+
+	return 0;
+err:
+	for (i--; i >= 0; i--)
+		gpio_free(gpio_num_array[i]);
+
+	return ret;
+}
+
 /*
  * get a number comprised of multiple GPIO values. gpio_num_array points to
  * the array of gpio pin numbers to scan, terminated by -1.
  */
-unsigned gpio_get_values_as_int(const int *gpio_num_array)
+int gpio_get_values_as_int(const int *gpio_list)
 {
 	int gpio;
 	unsigned bitmask = 1;
 	unsigned vector = 0;
+	int ret;
 
 	while (bitmask &&
-	       ((gpio = *gpio_num_array++) != -1)) {
-		if (gpio_get_value(gpio))
+	       ((gpio = *gpio_list++) != -1)) {
+		ret = gpio_get_value(gpio);
+		if (ret < 0)
+			return ret;
+		else if (ret)
 			vector |= bitmask;
 		bitmask <<= 1;
 	}
+
 	return vector;
 }
 
include/asm-generic/gpio.h +12 -3
index 3b96b82..4752ea4 100644
@@ -336,15 +336,24 @@ int gpio_lookup_name(const char *name, struct udevice **devp,
 		     unsigned int *offsetp, unsigned int *gpiop);
 
 /**
- * get_gpios() - Turn the values of a list of GPIOs into an integer
+ * gpio_get_values_as_int() - Turn the values of a list of GPIOs into an int
  *
  * This puts the value of the first GPIO into bit 0, the second into bit 1,
  * etc. then returns the resulting integer.
  *
  * @gpio_list: List of GPIOs to collect
- * @return resulting integer value
+ * @return resulting integer value, or -ve on error
  */
-unsigned gpio_get_values_as_int(const int *gpio_list);
+int gpio_get_values_as_int(const int *gpio_list);
+
+/**
+ * gpio_claim_vector() - claim a number of GPIOs for input
+ *
+ * @gpio_num_array:	array of gpios to claim, terminated by -1
+ * @fmt:		format string for GPIO names, e.g. "board_id%d"
+ * @return 0 if OK, -ve on error
+ */
+int gpio_claim_vector(const int *gpio_num_array, const char *fmt);
 
 /**
  * gpio_request_by_name() - Locate and request a GPIO by name
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#3 lore raw

PATCH v6 3/26 fdt: Add binding decode function for display-timings

In reply to Simon Glass

This is useful for display parameters. Add a simple decode function to read from this device tree node.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Remove definition of BIT()

 doc/device-tree-bindings/video/display-timing.txt | 110 ++++++++++++++++++++++
 include/fdtdec.h                                  |  78 +++++++++++++++
 lib/fdtdec.c                                      |  92 ++++++++++++++++++
 3 files changed, 280 insertions(+)
 create mode 100644 doc/device-tree-bindings/video/display-timing.txt
doc/device-tree-bindings/video/display-timing.txt new file +110 -0
new file mode 100644
index 0000000..e1d4a0b
@@ -0,0 +1,110 @@
+display-timing bindings
+=======================
+
+display-timings node
+--------------------
+
+required properties:
+ - none
+
+optional properties:
+ - native-mode: The native mode for the display, in case multiple modes are
+		provided. When omitted, assume the first node is the native.
+
+timing subnode
+--------------
+
+required properties:
+ - hactive, vactive: display resolution
+ - hfront-porch, hback-porch, hsync-len: horizontal display timing parameters
+   in pixels
+   vfront-porch, vback-porch, vsync-len: vertical display timing parameters in
+   lines
+ - clock-frequency: display clock in Hz
+
+optional properties:
+ - hsync-active: hsync pulse is active low/high/ignored
+ - vsync-active: vsync pulse is active low/high/ignored
+ - de-active: data-enable pulse is active low/high/ignored
+ - pixelclk-active: with
+			- active high = drive pixel data on rising edge/
+					sample data on falling edge
+			- active low  = drive pixel data on falling edge/
+					sample data on rising edge
+			- ignored     = ignored
+ - interlaced (bool): boolean to enable interlaced mode
+ - doublescan (bool): boolean to enable doublescan mode
+ - doubleclk (bool): boolean to enable doubleclock mode
+
+All the optional properties that are not bool follow the following logic:
+    <1>: high active
+    <0>: low active
+    omitted: not used on hardware
+
+There are different ways of describing the capabilities of a display. The
+devicetree representation corresponds to the one commonly found in datasheets
+for displays. If a display supports multiple signal timings, the native-mode
+can be specified.
+
+The parameters are defined as:
+
+  +----------+-------------------------------------+----------+-------+
+  |          |        ?                            |          |       |
+  |          |        |vback_porch                 |          |       |
+  |          |        ?                            |          |       |
+  +----------#######################################----------+-------+
+  |          #        ?                            #          |       |
+  |          #        |                            #          |       |
+  |  hback   #        |                            #  hfront  | hsync |
+  |   porch  #        |       hactive              #  porch   |  len  |
+  |<-------->#<-------+--------------------------->#<-------->|<----->|
+  |          #        |                            #          |       |
+  |          #        |vactive                     #          |       |
+  |          #        |                            #          |       |
+  |          #        ?                            #          |       |
+  +----------#######################################----------+-------+
+  |          |        ?                            |          |       |
+  |          |        |vfront_porch                |          |       |
+  |          |        ?                            |          |       |
+  +----------+-------------------------------------+----------+-------+
+  |          |        ?                            |          |       |
+  |          |        |vsync_len                   |          |       |
+  |          |        ?                            |          |       |
+  +----------+-------------------------------------+----------+-------+
+
+Example:
+
+	display-timings {
+		native-mode = <&timing0>;
+		timing0: 1080p24 {
+			/* 1920x1080p24 */
+			clock-frequency = <52000000>;
+			hactive = <1920>;
+			vactive = <1080>;
+			hfront-porch = <25>;
+			hback-porch = <25>;
+			hsync-len = <25>;
+			vback-porch = <2>;
+			vfront-porch = <2>;
+			vsync-len = <2>;
+			hsync-active = <1>;
+		};
+	};
+
+Every required property also supports the use of ranges, so the commonly used
+datasheet description with minimum, typical and maximum values can be used.
+
+Example:
+
+	timing1: timing {
+		/* 1920x1080p24 */
+		clock-frequency = <148500000>;
+		hactive = <1920>;
+		vactive = <1080>;
+		hsync-len = <0 44 60>;
+		hfront-porch = <80 88 95>;
+		hback-porch = <100 148 160>;
+		vfront-porch = <0 4 6>;
+		vback-porch = <0 36 50>;
+		vsync-len = <0 5 6>;
+	};
include/fdtdec.h +78 -0

82 lines not on this page · raw message

lib/fdtdec.c +92 -0

96 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

PATCH v6 4/26 tegra: Move the pwm into tegra-common

In reply to Simon Glass

This is needed for tegra124 also, so make it common and add a header file for tegra124.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/pwm.h    | 60 ++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra124/pwm.h | 14 ++++++++
 arch/arm/include/asm/arch-tegra20/pwm.h  | 54 +++-------------------------
 arch/arm/mach-tegra/Makefile             |  1 +
 arch/arm/mach-tegra/{tegra20 => }/pwm.c  |  2 +-
 arch/arm/mach-tegra/tegra20/Makefile     |  1 -
 6 files changed, 80 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra/pwm.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pwm.h
 rename arch/arm/mach-tegra/{tegra20 => }/pwm.c (97%)
arch/arm/include/asm/arch-tegra/pwm.h new file +60 -0
new file mode 100644
index 0000000..8e7397d
@@ -0,0 +1,60 @@
+/*
+ * Tegra pulse width frequency modulator definitions
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_TEGRA_PWM_H
+#define __ASM_ARCH_TEGRA_PWM_H
+
+/* This is a single PWM channel */
+struct pwm_ctlr {
+	uint control;		/* Control register */
+	uint reserved[3];	/* Space space */
+};
+
+#define PWM_NUM_CHANNELS	4
+
+/* PWM_CONTROLLER_PWM_CSR_0/1/2/3_0 */
+#define PWM_ENABLE_SHIFT	31
+#define PWM_ENABLE_MASK	(0x1 << PWM_ENABLE_SHIFT)
+
+#define PWM_WIDTH_SHIFT	16
+#define PWM_WIDTH_MASK		(0x7FFF << PWM_WIDTH_SHIFT)
+
+#define PWM_DIVIDER_SHIFT	0
+#define PWM_DIVIDER_MASK	(0x1FFF << PWM_DIVIDER_SHIFT)
+
+/**
+ * Program the PWM with the given parameters.
+ *
+ * @param channel	PWM channel to update
+ * @param rate		Clock rate to use for PWM
+ * @param pulse_width	high pulse width: 0=always low, 1=1/256 pulse high,
+ *			n = n/256 pulse high
+ * @param freq_divider	frequency divider value (1 to use rate as is)
+ */
+void pwm_enable(unsigned channel, int rate, int pulse_width, int freq_divider);
+
+/**
+ * Request a pwm channel as referenced by a device tree node.
+ *
+ * This channel can then be passed to pwm_enable().
+ *
+ * @param blob		Device tree blob
+ * @param node		Node containing reference to pwm
+ * @param prop_name	Property name of pwm reference
+ * @return channel number, if ok, else -1
+ */
+int pwm_request(const void *blob, int node, const char *prop_name);
+
+/**
+ * Set up the pwm controller, by looking it up in the fdt.
+ *
+ * @return 0 if ok, -1 if the device tree node was not found or invalid.
+ */
+int pwm_init(const void *blob);
+
+#endif	/* __ASM_ARCH_TEGRA_PWM_H */
arch/arm/include/asm/arch-tegra124/pwm.h new file +14 -0
new file mode 100644
index 0000000..3d2c432
@@ -0,0 +1,14 @@
+/*
+ * Tegra pulse width frequency modulator definitions
+ *
+ * Copyright (c) 2011 The Chromium OS Authors.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_TEGRA124_PWM_H
+#define __ASM_ARCH_TEGRA124_PWM_H
+
+#include <asm/arch-tegra/pwm.h>
+
+#endif	/* __ASM_ARCH_TEGRA124_PWM_H */
arch/arm/include/asm/arch-tegra20/pwm.h +4 -50

59 lines not on this page · raw message

arch/arm/mach-tegra/Makefile +1 -0
index 04cef0a..68eec5c 100644
@@ -12,6 +12,7 @@ obj-y += spl.o
 obj-y += cpu.o
 else
 obj-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o
+obj-$(CONFIG_PWM_TEGRA) += pwm.o
 endif
 
 obj-y += ap.o
arch/arm/mach-tegra/pwm.c renamed from arch/arm/mach-tegra/tegra20/pwm.c +1 -1
similarity index 97%
rename from arch/arm/mach-tegra/tegra20/pwm.c
rename to arch/arm/mach-tegra/pwm.c
index 5b88636..8664200 100644
@@ -1,5 +1,5 @@
 /*
- * Tegra2 pulse width frequency modulator definitions
+ * Tegra pulse width frequency modulator definitions
  *
  * Copyright (c) 2011 The Chromium OS Authors.
  *
arch/arm/mach-tegra/tegra20/Makefile +0 -1
index d48f9bb..fc3fb4a 100644
@@ -7,7 +7,6 @@
 ifdef CONFIG_SPL_BUILD
 obj-y	+= cpu.o
 else
-obj-$(CONFIG_PWM_TEGRA) += pwm.o
 obj-$(CONFIG_VIDEO_TEGRA) += display.o
 endif
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#5 lore raw

PATCH v6 5/26 tegra: pwm: Allow the clock rate to be left as is

In reply to Simon Glass

When enabling a PWM, allow the existing clock rate and source to stand unchanged.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/pwm.h | 2 +-
 arch/arm/mach-tegra/pwm.c             | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-tegra/pwm.h +1 -1
index 8e7397d..92dced4 100644
@@ -31,7 +31,7 @@ struct pwm_ctlr {
  * Program the PWM with the given parameters.
  *
  * @param channel	PWM channel to update
- * @param rate		Clock rate to use for PWM
+ * @param rate		Clock rate to use for PWM, or 0 to leave alone
  * @param pulse_width	high pulse width: 0=always low, 1=1/256 pulse high,
  *			n = n/256 pulse high
  * @param freq_divider	frequency divider value (1 to use rate as is)
arch/arm/mach-tegra/pwm.c +4 -1
index 8664200..1c38fc1 100644
@@ -24,7 +24,10 @@ void pwm_enable(unsigned channel, int rate, int pulse_width, int freq_divider)
 	assert(channel < PWM_NUM_CHANNELS);
 
 	/* TODO: Can we use clock_adjust_periph_pll_div() here? */
-	clock_start_periph_pll(PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ, rate);
+	if (rate) {
+		clock_start_periph_pll(PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ,
+				       rate);
+	}
 
 	reg = PWM_ENABLE_MASK;
 	reg |= pulse_width << PWM_WIDTH_SHIFT;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#6 lore raw

PATCH v6 6/26 tegra: Move checkboard() into the board code

In reply to Simon Glass

This is only used by Nvidia boards, so move it into nvidia/common to simplify things.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/mach-tegra/board.c |  8 --------
 board/nvidia/common/board.c | 13 +++++++++----
 2 files changed, 9 insertions(+), 12 deletions(-)
arch/arm/mach-tegra/board.c +0 -8
index 0ebaf19..222de6a 100644
@@ -98,14 +98,6 @@ int dram_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_DISPLAY_BOARDINFO
-int checkboard(void)
-{
-	printf("Board: %s\n", sysinfo.board_string);
-	return 0;
-}
-#endif	/* CONFIG_DISPLAY_BOARDINFO */
-
 static int uart_configs[] = {
 #if defined(CONFIG_TEGRA20)
  #if defined(CONFIG_TEGRA_UARTA_UAA_UAB)
board/nvidia/common/board.c +9 -4
index 018dddb..f1a9496 100644
@@ -53,10 +53,6 @@ U_BOOT_DEVICE(tegra_gpios) = {
 };
 #endif
 
-const struct tegra_sysinfo sysinfo = {
-	CONFIG_TEGRA_BOARD_STRING
-};
-
 __weak void pinmux_init(void) {}
 __weak void pin_mux_usb(void) {}
 __weak void pin_mux_spi(void) {}
@@ -85,6 +81,15 @@ static void power_det_init(void)
 #endif
 }
 
+#ifdef CONFIG_DISPLAY_BOARDINFO
+int checkboard(void)
+{
+	printf("Board: %s\n", CONFIG_TEGRA_BOARD_STRING);
+
+	return 0;
+}
+#endif	/* CONFIG_DISPLAY_BOARDINFO */
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#7 lore raw

PATCH v6 7/26 tegra: Add a board ID function

In reply to Simon Glass

Add a way of displaying a numeric board ID on start-up.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/sys_proto.h | 11 ++++++-----
 board/nvidia/common/board.c                 | 12 +++++++++++-
 2 files changed, 17 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-tegra/sys_proto.h +6 -5
index 8b3fbe1..914d8b9 100644
@@ -8,12 +8,13 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-struct tegra_sysinfo {
-	char *board_string;
-};
-
 void invalidate_dcache(void);
 
-extern const struct tegra_sysinfo sysinfo;
+/**
+ * tegra_board_id() - Get the board iD
+ *
+ * @return a board ID, or -ve on error
+ */
+int tegra_board_id(void);
 
 #endif
board/nvidia/common/board.c +11 -1
index f1a9496..b5a69df 100644
@@ -81,10 +81,20 @@ static void power_det_init(void)
 #endif
 }
 
+__weak int tegra_board_id(void)
+{
+	return -1;
+}
+
 #ifdef CONFIG_DISPLAY_BOARDINFO
 int checkboard(void)
 {
-	printf("Board: %s\n", CONFIG_TEGRA_BOARD_STRING);
+	int board_id = tegra_board_id();
+
+	printf("Board: %s", CONFIG_TEGRA_BOARD_STRING);
+	if (board_id != -1)
+		printf(", ID: %d\n", board_id);
+	printf("\n");
 
 	return 0;
 }
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#8 lore raw

PATCH v6 8/26 power: Export register access functions from as3722

In reply to Simon Glass

With the full PMIC framework we may be able to avoid this. But for now we need access to the PMIC.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/power/as3722.c | 16 +++++++++++++---
 include/power/as3722.h |  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/power/as3722.c +13 -3
index a60bb5f..c09e1de 100644
@@ -27,7 +27,7 @@
 #define  AS3722_DEVICE_ID 0x0c
 #define AS3722_ASIC_ID2 0x91
 
-static int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
+int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
 {
 	int err;
 
@@ -38,7 +38,7 @@ static int as3722_read(struct udevice *pmic, u8 reg, u8 *value)
 	return 0;
 }
 
-static int as3722_write(struct udevice *pmic, u8 reg, u8 value)
+int as3722_write(struct udevice *pmic, u8 reg, u8 value)
 {
 	int err;
 
@@ -234,6 +234,15 @@ int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
 	return 0;
 }
 
+/* Temporary function until we get the pmic framework */
+int as3722_get(struct udevice **devp)
+{
+	int bus = 0;
+	int address = 0x40;
+
+	return i2c_get_chip_for_busnum(bus, address, 1, devp);
+}
+
 int as3722_init(struct udevice **devp)
 {
 	struct udevice *pmic;
@@ -258,7 +267,8 @@ int as3722_init(struct udevice **devp)
 
 	debug("AS3722 revision %#x found on I2C bus %u, address %#x\n",
 	      revision, bus, address);
-	*devp = pmic;
+	if (devp)
+		*devp = pmic;
 
 	return 0;
 }
include/power/as3722.h +3 -0
index aa966d2..0f22482 100644
@@ -23,5 +23,8 @@ int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
 			  unsigned long flags);
 int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
 				 unsigned int level);
+int as3722_read(struct udevice *pmic, u8 reg, u8 *value);
+int as3722_write(struct udevice *pmic, u8 reg, u8 value);
+int as3722_get(struct udevice **devp);
 
 #endif /* __POWER_AS3722_H__ */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#9 lore raw

PATCH v6 9/26 tegra: Provide a function to allow LCD PMIC setup

In reply to Simon Glass

Some LCDs require a PMIC to be set up - add a function for this.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/sys_proto.h |  8 ++++++++
 board/nvidia/common/board.c                 | 10 ++++++++++
 2 files changed, 18 insertions(+)
arch/arm/include/asm/arch-tegra/sys_proto.h +8 -0
index 914d8b9..83f9f47 100644
@@ -17,4 +17,12 @@ void invalidate_dcache(void);
  */
 int tegra_board_id(void);
 
+/**
+ * tegra_lcd_pmic_init() - Set up the PMIC for a board
+ *
+ * @board_id: Board ID which may be used to select LCD type
+ * @return 0 if OK, -ve on error
+ */
+int tegra_lcd_pmic_init(int board_id);
+
 #endif
board/nvidia/common/board.c +10 -0
index b5a69df..4cc23ef 100644
@@ -100,6 +100,11 @@ int checkboard(void)
 }
 #endif	/* CONFIG_DISPLAY_BOARDINFO */
 
+__weak int tegra_lcd_pmic_init(int board_it)
+{
+	return 0;
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -107,6 +112,7 @@ int checkboard(void)
 int board_init(void)
 {
 	__maybe_unused int err;
+	__maybe_unused int board_id;
 
 	/* Do clocks and UART first so that printf() works */
 	clock_init();
@@ -147,6 +153,10 @@ int board_init(void)
 #endif
 
 #ifdef CONFIG_LCD
+	board_id = tegra_board_id();
+	err = tegra_lcd_pmic_init(board_id);
+	if (err)
+		return err;
 	tegra_lcd_check_next_stage(gd->fdt_blob, 0);
 #endif
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#10 lore raw

PATCH v6 10/26 tegra: Add support for setting up a as3722 PMIC

In reply to Simon Glass

Add support for this PMIC which is used on some Tegra124 boards.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 board/nvidia/common/board.c | 7 +++++++
 1 file changed, 7 insertions(+)
board/nvidia/common/board.c +7 -0
index 4cc23ef..131802a 100644
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <errno.h>
 #include <ns16550.h>
 #include <linux/compiler.h>
 #include <asm/io.h>
@@ -40,6 +41,7 @@
 #include <asm/arch-tegra/mmc.h>
 #endif
 #include <asm/arch-tegra/xusb-padctl.h>
+#include <power/as3722.h>
 #include <i2c.h>
 #include <spi.h>
 #include "emc.h"
@@ -145,6 +147,11 @@ int board_init(void)
 		debug("Memory controller init failed: %d\n", err);
 #  endif
 # endif /* CONFIG_TEGRA_PMU */
+#ifdef CONFIG_AS3722_POWER
+	err = as3722_init(NULL);
+	if (err && err != -ENODEV)
+		return err;
+#endif
 #endif /* CONFIG_SYS_I2C_TEGRA */
 
 #ifdef CONFIG_USB_EHCI_TEGRA
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#11 lore raw

PATCH v6 11/26 tegra: nyan-big: Add LCD PMIC init and board ID

In reply to Simon Glass

Add required setup for the LCD display, and a function to provide the board ID. This requires GPIOs to be available prior to relocation.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/dts/tegra124-nyan-big.dts |  4 ++++
 board/nvidia/nyan-big/nyan-big.c   | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
arch/arm/dts/tegra124-nyan-big.dts +4 -0
index 9367193..a50f26c 100644
@@ -310,6 +310,10 @@
 		};
 	};
 
+	gpio at 6000d000 {
+		u-boot,dm-pre-reloc;
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 
board/nvidia/nyan-big/nyan-big.c +33 -1
index d4d2496..ae8874b 100644
@@ -6,8 +6,11 @@
  */
 
 #include <common.h>
-#include <asm/arch/gpio.h>
+#include <errno.h>
+#include <asm/gpio.h>
 #include <asm/arch/pinmux.h>
+#include <power/as3722.h>
+#include <power/pmic.h>
 #include "pinmux-config-nyan-big.h"
 
 /*
@@ -25,3 +28,32 @@ void pinmux_init(void)
 	pinmux_config_drvgrp_table(nyan_big_drvgrps,
 				   ARRAY_SIZE(nyan_big_drvgrps));
 }
+
+int tegra_board_id(void)
+{
+	static const int vector[] = {GPIO_PQ3, GPIO_PT1, GPIO_PX1,
+					GPIO_PX4, -1};
+
+	gpio_claim_vector(vector, "board_id%d");
+	return gpio_get_values_as_int(vector);
+}
+
+int tegra_lcd_pmic_init(int board_id)
+{
+	struct udevice *pmic;
+	int ret;
+
+	ret = as3722_get(&pmic);
+	if (ret)
+		return -ENOENT;
+
+	if (board_id == 0)
+		as3722_write(pmic, 0x00, 0x3c);
+	else
+		as3722_write(pmic, 0x00, 0x50);
+	as3722_write(pmic, 0x12, 0x10);
+	as3722_write(pmic, 0x0c, 0x07);
+	as3722_write(pmic, 0x20, 0x10);
+
+	return 0;
+}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#12 lore raw

PATCH v6 12/26 tegra124: dts: Add host1x node to provide display information

In reply to Simon Glass

This peripheral is required to get the LCD display running. Add it to tegra124 and also bring in the binding file from Linux 3.18

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/dts/tegra124.dtsi                         |  84 +++++
 .../gpu/nvidia,tegra20-host1x.txt                  | 372 +++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 doc/device-tree-bindings/gpu/nvidia,tegra20-host1x.txt
arch/arm/dts/tegra124.dtsi +84 -0
index 9fa141d..43b7f22 100644
@@ -76,6 +76,85 @@
 		};
 	};
 
+	host1x at 50000000 {
+		compatible = "nvidia,tegra124-host1x", "simple-bus";
+		reg = <0x50000000 0x00034000>;
+		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
+			     <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
+		clocks = <&tegra_car TEGRA124_CLK_HOST1X>;
+		resets = <&tegra_car 28>;
+		reset-names = "host1x";
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		ranges = <0x54000000 0x54000000 0x01000000>;
+
+		dc at 54200000 {
+			compatible = "nvidia,tegra124-dc";
+			reg = <0x54200000 0x00040000>;
+			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA124_CLK_DISP1>,
+				 <&tegra_car TEGRA124_CLK_PLL_P>;
+			clock-names = "dc", "parent";
+			resets = <&tegra_car 27>;
+			reset-names = "dc";
+
+			nvidia,head = <0>;
+		};
+
+		dc at 54240000 {
+			compatible = "nvidia,tegra124-dc";
+			reg = <0x54240000 0x00040000>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA124_CLK_DISP2>,
+				 <&tegra_car TEGRA124_CLK_PLL_P>;
+			clock-names = "dc", "parent";
+			resets = <&tegra_car 26>;
+			reset-names = "dc";
+
+			nvidia,head = <1>;
+		};
+
+		hdmi at 54280000 {
+			compatible = "nvidia,tegra124-hdmi";
+			reg = <0x54280000 0x00040000>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA124_CLK_HDMI>,
+				 <&tegra_car TEGRA124_CLK_PLL_D2_OUT0>;
+			clock-names = "hdmi", "parent";
+			resets = <&tegra_car 51>;
+			reset-names = "hdmi";
+			status = "disabled";
+		};
+
+		sor at 54540000 {
+			compatible = "nvidia,tegra124-sor";
+			reg = <0x54540000 0x00040000>;
+			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA124_CLK_SOR0>,
+				 <&tegra_car TEGRA124_CLK_PLL_D_OUT0>,
+				 <&tegra_car TEGRA124_CLK_PLL_DP>,
+				 <&tegra_car TEGRA124_CLK_CLK_M>;
+			clock-names = "sor", "parent", "dp", "safe";
+			resets = <&tegra_car 182>;
+			reset-names = "sor";
+			status = "disabled";
+		};
+
+		dpaux: dpaux at 545c0000 {
+			compatible = "nvidia,tegra124-dpaux";
+			reg = <0x545c0000 0x00040000>;
+			interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA124_CLK_DPAUX>,
+				 <&tegra_car TEGRA124_CLK_PLL_DP>;
+			clock-names = "dpaux", "parent";
+			resets = <&tegra_car 181>;
+			reset-names = "dpaux";
+			status = "disabled";
+		};
+	};
+
 	gic: interrupt-controller at 50041000 {
 		compatible = "arm,cortex-a15-gic";
 		#interrupt-cells = <3>;
@@ -349,6 +428,11 @@
 		clocks = <&tegra_car 105>;
 	};
 
+	pmc at 7000e400 {
+		compatible = "nvidia,tegra124-pmc";
+		reg = <0x7000e400 0x400>;
+	};
+
 	padctl: padctl at 7009f000 {
 		compatible = "nvidia,tegra124-xusb-padctl";
 		reg = <0x7009f000 0x1000>;
doc/device-tree-bindings/gpu/nvidia,tegra20-host1x.txt new file +372 -0

372 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#13 lore raw

PATCH v6 13/26 tegra: config: Use CONFIG_LCD to detect LCD presence

In reply to Simon Glass

Instead of CONFIG_VIDEO_TEGRA, use CONFIG_LCD to determine whether an LCD is present. Tegra124 uses a different driver.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/configs/tegra-common-post.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/tegra-common-post.h +1 -1
index c3ad8be..46a155d 100644
@@ -34,7 +34,7 @@
 #define STDIN_KBD_USB ""
 #endif
 
-#ifdef CONFIG_VIDEO_TEGRA
+#ifdef CONFIG_LCD
 #define STDOUT_LCD ",lcd"
 #else
 #define STDOUT_LCD ""
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#14 lore raw

PATCH v6 14/26 tegra: clock: Add checking for invalid clock IDs

In reply to Simon Glass

The get_pll() function can do the wrong thing if passed values that are out of range. Add checks for this and add a function which can return a 'simple' PLL. This can be defined by SoCs with their own clocks.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/clock.h |  3 +++
 arch/arm/mach-tegra/clock.c             | 30 ++++++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-tegra/clock.h +3 -0
index 9d8114c..a641a16 100644
@@ -265,6 +265,9 @@ void clock_early_init(void);
 /* Returns a pointer to the clock source register for a peripheral */
 u32 *get_periph_source_reg(enum periph_id periph_id);
 
+/* Returns a pointer to the given 'simple' PLL */
+struct clk_pll_simple *clock_get_simple_pll(enum clock_id clkid);
+
 /**
  * Given a peripheral ID and the required source clock, this returns which
  * value should be programmed into the source mux for that peripheral.
arch/arm/mach-tegra/clock.c +26 -4
index 7c274b5..e07f11d 100644
@@ -81,9 +81,18 @@ static struct clk_pll *get_pll(enum clock_id clkid)
 			(struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
 
 	assert(clock_id_is_pll(clkid));
+	if (clkid >= (enum clock_id)TEGRA_CLK_PLLS) {
+		debug("%s: Invalid PLL\n", __func__);
+		return NULL;
+	}
 	return &clkrst->crc_pll[clkid];
 }
 
+__weak struct clk_pll_simple *clock_get_simple_pll(enum clock_id clkid)
+{
+	return NULL;
+}
+
 int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn,
 		u32 *divp, u32 *cpcon, u32 *lfcon)
 {
@@ -110,7 +119,7 @@ unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
 		u32 divp, u32 cpcon, u32 lfcon)
 {
 	struct clk_pll *pll = get_pll(clkid);
-	u32 data;
+	u32 misc_data, data;
 
 	/*
 	 * We cheat by treating all PLL (except PLLU) in the same fashion.
@@ -119,8 +128,7 @@ unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
 	 * - DCCON is always 0, doesn't conflict
 	 * - M,N, P of PLLP values are ignored for PLLP
 	 */
-	data = (cpcon << PLL_CPCON_SHIFT) | (lfcon << PLL_LFCON_SHIFT);
-	writel(data, &pll->pll_misc);
+	misc_data = (cpcon << PLL_CPCON_SHIFT) | (lfcon << PLL_LFCON_SHIFT);
 
 	data = (divm << PLL_DIVM_SHIFT) | (divn << PLL_DIVN_SHIFT) |
 			(0 << PLL_BYPASS_SHIFT) | (1 << PLL_ENABLE_SHIFT);
@@ -129,7 +137,19 @@ unsigned long clock_start_pll(enum clock_id clkid, u32 divm, u32 divn,
 		data |= divp << PLLU_VCO_FREQ_SHIFT;
 	else
 		data |= divp << PLL_DIVP_SHIFT;
-	writel(data, &pll->pll_base);
+	if (pll) {
+		writel(misc_data, &pll->pll_misc);
+		writel(data, &pll->pll_base);
+	} else {
+		struct clk_pll_simple *pll = clock_get_simple_pll(clkid);
+
+		if (!pll) {
+			debug("%s: Uknown simple PLL %d\n", __func__, clkid);
+			return 0;
+		}
+		writel(misc_data, &pll->pll_misc);
+		writel(data, &pll->pll_base);
+	}
 
 	/* calculate the stable time */
 	return timer_get_us() + CLOCK_PLL_STABLE_DELAY_US;
@@ -431,6 +451,8 @@ unsigned clock_get_rate(enum clock_id clkid)
 		return parent_rate;
 
 	pll = get_pll(clkid);
+	if (!pll)
+		return 0;
 	base = readl(&pll->pll_base);
 
 	/* Oh for bf_unpack()... */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#15 lore raw

PATCH v6 15/26 tegra: clock: Split the clock source code into a separate function

In reply to Simon Glass

Create a function which sets the source clock for a peripheral, given the number of mux bits to adjust. This can then be used more generally. For now, don't export it.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/clock.h | 11 +++++++
 arch/arm/mach-tegra/clock.c             | 51 +++++++++++++++++++--------------
 2 files changed, 40 insertions(+), 22 deletions(-)
arch/arm/include/asm/arch-tegra/clock.h +11 -0
index a641a16..04011ae 100644
@@ -156,6 +156,17 @@ void reset_cmplx_set_enable(int cpu, int which, int reset);
 void clock_ll_set_source(enum periph_id periph_id, unsigned source);
 
 /**
+ * This function is similar to clock_ll_set_source() except that it can be
+ * used for clocks with more than 2 mux bits.
+ *
+ * @param periph_id	peripheral to adjust
+ * @param mux_bits	number of mux bits for the clock
+ * @param source	source clock (0-15 depending on mux_bits)
+ */
+int clock_ll_set_source_bits(enum periph_id periph_id, int mux_bits,
+			     unsigned source);
+
+/**
  * Set the source and divisor for a peripheral clock. This sets the
  * clock rate. You need to look up the datasheet to see the meaning of the
  * source parameter as it changes for each peripheral.
arch/arm/mach-tegra/clock.c +29 -22

66 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#16 lore raw

PATCH v6 16/26 tegra124: clock: Add display clocks and functions

In reply to Simon Glass

Add functions to provide access to the display clocks on Tegra124 including setting the clock rate for an EDP display.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-tegra/clk_rst.h         |  15 ++-
 arch/arm/include/asm/arch-tegra124/clock-tables.h |   3 +-
 arch/arm/include/asm/arch-tegra124/clock.h        |  21 ++++
 arch/arm/mach-tegra/clock.c                       |   2 +
 arch/arm/mach-tegra/tegra124/clock.c              | 141 +++++++++++++++++++++-
 5 files changed, 173 insertions(+), 9 deletions(-)
arch/arm/include/asm/arch-tegra/clk_rst.h +12 -3
index 7d28e16..de50e08 100644
@@ -202,9 +202,13 @@ struct clk_rst_ctlr {
 	uint crc_reserved52[1];		/* _reserved_52, 0x554 */
 	uint crc_super_gr3d_clk_div;	/* _SUPER_GR3D_CLK_DIVIDER_0, 0x558 */
 	uint crc_spare_reg0;		/* _SPARE_REG0_0, 0x55C */
-
-	/* Tegra124 - skip to 0x600 here for new CLK_SOURCE_ regs */
-	uint crc_reserved60[40];	/* _reserved_60, 0x560 - 0x5FC */
+	u32 _rsv32[4];                  /*                    0x560-0x56c */
+	u32 crc_plld2_ss_cfg;		/* _PLLD2_SS_CFG            0x570 */
+	u32 _rsv32_1[7];		/*                      0x574-58c */
+	struct clk_pll_simple plldp;	/* _PLLDP_BASE, 0x590 _PLLDP_MISC */
+	u32 crc_plldp_ss_cfg;		/* _PLLDP_SS_CFG, 0x598 */
+	u32 _rsrv32_2[25];
+	/* Tegra124 */
 	uint crc_clk_src_x[TEGRA_CLK_SOURCES_X]; /* XUSB, etc, 0x600-0x678 */
 };
 
@@ -440,4 +444,9 @@ enum {
 #define PLLX_IDDQ_SHIFT			3
 #define PLLX_IDDQ_MASK			(1U << PLLX_IDDQ_SHIFT)
 
+/* CLK_RST_PLLDP_SS_CFG */
+#define PLLDP_SS_CFG_CLAMP		(1 << 22)
+#define PLLDP_SS_CFG_UNDOCUMENTED	(1 << 24)
+#define PLLDP_SS_CFG_DITHER		(1 << 28)
+
 #endif	/* _TEGRA_CLK_RST_H_ */
arch/arm/include/asm/arch-tegra124/clock-tables.h +2 -1
index daf9a2b..7005855 100644
@@ -25,6 +25,7 @@ enum clock_id {
 	CLOCK_ID_XCPU = CLOCK_ID_FIRST_SIMPLE,
 	CLOCK_ID_EPCI,
 	CLOCK_ID_SFROM32KHZ,
+	CLOCK_ID_DP,	/* Special for Tegra124 */
 
 	/* These are the base clocks (inputs to the Tegra SoC) */
 	CLOCK_ID_32KHZ,
@@ -424,7 +425,7 @@ enum periphc_internal_id {
 
 	/* 0x58 */
 	PERIPHC_58h,
-	PERIPHC_59h,
+	PERIPHC_SOR,
 	PERIPHC_5ah,
 	PERIPHC_5bh,
 	PERIPHC_SATAOOB,
arch/arm/include/asm/arch-tegra124/clock.h +21 -0
index 8e65086..e202cc5 100644
@@ -16,6 +16,27 @@
 #define OSC_FREQ_SHIFT          28
 #define OSC_FREQ_MASK           (0xF << OSC_FREQ_SHIFT)
 
+/* CLK_RST_CONTROLLER_CLK_SOURCE_SOR0_0 */
+#define SOR0_CLK_SEL0			(1 << 14)
+#define SOR0_CLK_SEL1			(1 << 15)
+
 int tegra_plle_enable(void);
 
+void clock_sor_enable_edp_clock(void);
+
+/**
+ * clock_set_display_rate() - Set the display clock rate
+ *
+ * @frequency: the requested PLLD frequency
+ *
+ * Return the PLLD frequenc (which may not quite what was requested), or 0
+ * on failure
+ */
+u32 clock_set_display_rate(u32 frequency);
+
+/**
+ * clock_set_up_plldp() - Set up the EDP clock ready for use
+ */
+void clock_set_up_plldp(void);
+
 #endif	/* _TEGRA124_CLOCK_H_ */
arch/arm/mach-tegra/clock.c +2 -0
index 4b58cc1..cdd5438 100644
@@ -593,6 +593,7 @@ void clock_init(void)
 	pll_rate[CLOCK_ID_MEMORY] = clock_get_rate(CLOCK_ID_MEMORY);
 	pll_rate[CLOCK_ID_PERIPH] = clock_get_rate(CLOCK_ID_PERIPH);
 	pll_rate[CLOCK_ID_CGENERAL] = clock_get_rate(CLOCK_ID_CGENERAL);
+	pll_rate[CLOCK_ID_DISPLAY] = clock_get_rate(CLOCK_ID_DISPLAY);
 	pll_rate[CLOCK_ID_OSC] = clock_get_rate(CLOCK_ID_OSC);
 	pll_rate[CLOCK_ID_SFROM32KHZ] = 32768;
 	pll_rate[CLOCK_ID_XCPU] = clock_get_rate(CLOCK_ID_XCPU);
@@ -600,6 +601,7 @@ void clock_init(void)
 	debug("PLLM = %d\n", pll_rate[CLOCK_ID_MEMORY]);
 	debug("PLLP = %d\n", pll_rate[CLOCK_ID_PERIPH]);
 	debug("PLLC = %d\n", pll_rate[CLOCK_ID_CGENERAL]);
+	debug("PLLD = %d\n", pll_rate[CLOCK_ID_DISPLAY]);
 	debug("PLLX = %d\n", pll_rate[CLOCK_ID_XCPU]);
 
 	/* Do any special system timer/TSC setup */
arch/arm/mach-tegra/tegra124/clock.c +136 -5

188 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#17 lore raw

PATCH v6 17/26 tegra: Move display controller header into common

In reply to Simon Glass

Allow this to be used by other Tegra SoCs.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .../include/asm/{arch-tegra20 => arch-tegra}/dc.h  | 63 ++++++++++++++++++----
 arch/arm/include/asm/arch-tegra20/display.h        |  2 +-
 arch/arm/mach-tegra/tegra20/display.c              |  2 +-
 3 files changed, 55 insertions(+), 12 deletions(-)
 rename arch/arm/include/asm/{arch-tegra20 => arch-tegra}/dc.h (89%)
arch/arm/include/asm/arch-tegra/dc.h renamed from arch/arm/include/asm/arch-tegra20/dc.h +53 -10
similarity index 89%
rename from arch/arm/include/asm/arch-tegra20/dc.h
rename to arch/arm/include/asm/arch-tegra/dc.h
index 20790b6..8803c11 100644
@@ -234,7 +234,7 @@ struct dc_disp_reg {
 	uint cursor_pos_ns;		/* _DISP_CURSOR_POSITION_NS_0 */
 	uint seq_ctrl;			/* _DISP_INIT_SEQ_CONTROL_0 */
 
-	/* Address 0x442 ~ 0x446 */
+	/* Address 0x443 ~ 0x446 */
 	uint spi_init_seq_data_a;	/* _DISP_SPI_INIT_SEQ_DATA_A_0 */
 	uint spi_init_seq_data_b;	/* _DISP_SPI_INIT_SEQ_DATA_B_0 */
 	uint spi_init_seq_data_c;	/* _DISP_SPI_INIT_SEQ_DATA_C_0 */
@@ -254,6 +254,11 @@ struct dc_disp_reg {
 	/* Address 0x4c0 ~ 0x4c1 */
 	uint dac_crt_ctrl;		/* _DISP_DAC_CRT_CTRL_0 */
 	uint disp_misc_ctrl;		/* _DISP_DISP_MISC_CONTROL_0 */
+
+	u32 rsvd_4c2[34];		/* 4c2 - 4e3 */
+
+	/* Address 0x4e4 */
+	u32 blend_background_color;	/* _DISP_BLEND_BACKGROUND_COLOR_0 */
 };
 
 enum dc_winc_filter_p {
@@ -289,9 +294,9 @@ struct dc_winc_reg {
 	uint v_filter_p[WINC_FILTER_COUNT];
 };
 
-/* WIN A/B/C Register 0x700 ~ 0x714*/
+/* WIN A/B/C Register 0x700 ~ 0x719*/
 struct dc_win_reg {
-	/* Address 0x700 ~ 0x714 */
+	/* Address 0x700 ~ 0x719 */
 	uint win_opt;			/* _WIN_WIN_OPTIONS_0 */
 	uint byte_swap;			/* _WIN_BYTE_SWAP_0 */
 	uint buffer_ctrl;		/* _WIN_BUFFER_CONTROL_0 */
@@ -313,11 +318,16 @@ struct dc_win_reg {
 	uint blend_2win_y;		/* _WIN_BLEND_2WIN_Y_0 */
 	uint blend_3win_xy;		/* _WIN_BLEND_3WIN_XY_0 */
 	uint hp_fetch_ctrl;		/* _WIN_HP_FETCH_CONTROL_0 */
+	uint global_alpha;		/* _WIN_GLOBAL_ALPHA */
+	uint blend_layer_ctrl;		/* _WINBUF_BLEND_LAYER_CONTROL_0 */
+	uint blend_match_select;	/* _WINBUF_BLEND_MATCH_SELECT_0 */
+	uint blend_nomatch_select;	/* _WINBUF_BLEND_NOMATCH_SELECT_0 */
+	uint blend_alpha_1bit;		/* _WINBUF_BLEND_ALPHA_1BIT_0 */
 };
 
-/* WINBUF A/B/C Register 0x800 ~ 0x80a */
+/* WINBUF A/B/C Register 0x800 ~ 0x80d */
 struct dc_winbuf_reg {
-	/* Address 0x800 ~ 0x80a */
+	/* Address 0x800 ~ 0x80d */
 	uint start_addr;		/* _WINBUF_START_ADDR_0 */
 	uint start_addr_ns;		/* _WINBUF_START_ADDR_NS_0 */
 	uint start_addr_u;		/* _WINBUF_START_ADDR_U_0 */
@@ -329,6 +339,9 @@ struct dc_winbuf_reg {
 	uint addr_v_offset;		/* _WINBUF_ADDR_V_OFFSET_0 */
 	uint addr_v_offset_ns;		/* _WINBUF_ADDR_V_OFFSET_NS_0 */
 	uint uflow_status;		/* _WINBUF_UFLOW_STATUS_0 */
+	uint buffer_surface_kind;	/* DC_WIN_BUFFER_SURFACE_KIND */
+	uint rsvd_80c;
+	uint start_addr_hi;		/* DC_WINBUF_START_ADDR_HI_0 */
 };
 
 /* Display Controller (DC_) regs */
@@ -339,16 +352,16 @@ struct dc_ctlr {
 	struct dc_com_reg com;		/* COM register 0x300 ~ 0x329 */
 	uint reserved1[0xd6];
 
-	struct dc_disp_reg disp;	/* DISP register 0x400 ~ 0x4c1 */
-	uint reserved2[0x3e];
+	struct dc_disp_reg disp;	/* DISP register 0x400 ~ 0x4e4 */
+	uint reserved2[0x1b];
 
 	struct dc_winc_reg winc;	/* Window A/B/C 0x500 ~ 0x628 */
 	uint reserved3[0xd7];
 
-	struct dc_win_reg win;		/* WIN A/B/C 0x700 ~ 0x714*/
-	uint reserved4[0xeb];
+	struct dc_win_reg win;		/* WIN A/B/C 0x700 ~ 0x719*/
+	uint reserved4[0xe6];
 
-	struct dc_winbuf_reg winbuf;	/* WINBUF A/B/C 0x800 ~ 0x80a */
+	struct dc_winbuf_reg winbuf;	/* WINBUF A/B/C 0x800 ~ 0x80d */
 };
 
 #define BIT(pos)	(1U << pos)
@@ -399,20 +412,45 @@ enum win_color_depth_id {
 #define SPI_ENABLE		BIT(24)
 #define HSPI_ENABLE		BIT(25)
 
+/* DC_CMD_STATE_ACCESS 0x040 */
+#define  READ_MUX_ASSEMBLY	(0 << 0)
+#define  READ_MUX_ACTIVE	(1 << 0)
+#define  WRITE_MUX_ASSEMBLY	(0 << 2)
+#define  WRITE_MUX_ACTIVE	(1 << 2)
+
 /* DC_CMD_STATE_CONTROL 0x041 */
 #define GENERAL_ACT_REQ		BIT(0)
 #define WIN_A_ACT_REQ		BIT(1)
 #define WIN_B_ACT_REQ		BIT(2)
 #define WIN_C_ACT_REQ		BIT(3)
+#define WIN_D_ACT_REQ		BIT(4)
+#define WIN_H_ACT_REQ		BIT(5)
+#define CURSOR_ACT_REQ		BIT(7)
 #define GENERAL_UPDATE		BIT(8)
 #define WIN_A_UPDATE		BIT(9)
 #define WIN_B_UPDATE		BIT(10)
 #define WIN_C_UPDATE		BIT(11)
+#define WIN_D_UPDATE		BIT(12)
+#define WIN_H_UPDATE		BIT(13)
+#define CURSOR_UPDATE		BIT(15)
+#define NC_HOST_TRIG		BIT(24)
 
 /* DC_CMD_DISPLAY_WINDOW_HEADER 0x042 */
 #define WINDOW_A_SELECT		BIT(4)
 #define WINDOW_B_SELECT		BIT(5)
 #define WINDOW_C_SELECT		BIT(6)
+#define	WINDOW_D_SELECT		BIT(7)
+#define	WINDOW_H_SELECT		BIT(8)
+
+/* DC_DISP_DISP_WIN_OPTIONS 0x402 */
+#define	CURSOR_ENABLE		BIT(16)
+#define	SOR_ENABLE		BIT(25)
+#define	TVO_ENABLE		BIT(28)
+#define	DSI_ENABLE		BIT(29)
+#define	HDMI_ENABLE		BIT(30)
+
+/* DC_DISP_DISP_TIMING_OPTIONS 0x405 */
+#define	VSYNC_H_POSITION(x)	((x) & 0xfff)
 
 /* DC_DISP_DISP_CLOCK_CONTROL 0x42e */
 #define SHIFT_CLK_DIVIDER_SHIFT	0
@@ -526,4 +564,9 @@ enum {
 #define V_DDA_INC_SHIFT		16
 #define V_DDA_INC_MASK		(0xFFFF << V_DDA_INC_SHIFT)
 
+struct display_timing;
+
+int display_init(void *lcdbase, int fb_bits_per_pixel,
+		 struct display_timing *timing);
+
 #endif /* __ASM_ARCH_TEGRA_DC_H */
arch/arm/include/asm/arch-tegra20/display.h +1 -1
index 6feeda3..018c9f9 100644
@@ -8,7 +8,7 @@
 #ifndef __ASM_ARCH_TEGRA_DISPLAY_H
 #define __ASM_ARCH_TEGRA_DISPLAY_H
 
-#include <asm/arch/dc.h>
+#include <asm/arch-tegra/dc.h>
 #include <fdtdec.h>
 #include <asm/gpio.h>
 
arch/arm/mach-tegra/tegra20/display.c +1 -1
index 61efed6..b7605ff 100644
@@ -10,7 +10,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch/display.h>
-#include <asm/arch/dc.h>
+#include <asm/arch-tegra/dc.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/timer.h>
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#18 lore raw

PATCH v6 18/26 video: Add drm_dp_helper.h

In reply to Simon Glass

This file (from Linux 3.17) provides defines for display port. Use it so that our naming is consistent with Linux.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/linux/drm_dp_helper.h | 405 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 405 insertions(+)
 create mode 100644 include/linux/drm_dp_helper.h
include/linux/drm_dp_helper.h new file +405 -0
new file mode 100644
index 0000000..86b06e1
@@ -0,0 +1,405 @@
+/*
+ * Copyright ? 2008 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _DRM_DP_HELPER_H_
+#define _DRM_DP_HELPER_H_
+
+/*
+ * Unless otherwise noted, all values are from the DP 1.1a spec.  Note that
+ * DP and DPCD versions are independent.  Differences from 1.0 are not noted,
+ * 1.0 devices basically don't exist in the wild.
+ *
+ * Abbreviations, in chronological order:
+ *
+ * eDP: Embedded DisplayPort version 1
+ * DPI: DisplayPort Interoperability Guideline v1.1a
+ * 1.2: DisplayPort 1.2
+ * MST: Multistream Transport - part of DP 1.2a
+ *
+ * 1.2 formally includes both eDP and DPI definitions.
+ */
+
+#define DP_AUX_I2C_WRITE		0x0
+#define DP_AUX_I2C_READ			0x1
+#define DP_AUX_I2C_STATUS		0x2
+#define DP_AUX_I2C_MOT			0x4
+#define DP_AUX_NATIVE_WRITE		0x8
+#define DP_AUX_NATIVE_READ		0x9
+
+#define DP_AUX_NATIVE_REPLY_ACK		(0x0 << 0)
+#define DP_AUX_NATIVE_REPLY_NACK	(0x1 << 0)
+#define DP_AUX_NATIVE_REPLY_DEFER	(0x2 << 0)
+#define DP_AUX_NATIVE_REPLY_MASK	(0x3 << 0)
+
+#define DP_AUX_I2C_REPLY_ACK		(0x0 << 2)
+#define DP_AUX_I2C_REPLY_NACK		(0x1 << 2)
+#define DP_AUX_I2C_REPLY_DEFER		(0x2 << 2)
+#define DP_AUX_I2C_REPLY_MASK		(0x3 << 2)
+
+/* AUX CH addresses */
+/* DPCD */
+#define DP_DPCD_REV                         0x000
+
+#define DP_MAX_LINK_RATE                    0x001
+
+#define DP_MAX_LANE_COUNT                   0x002
+# define DP_MAX_LANE_COUNT_MASK		    0x1f
+# define DP_TPS3_SUPPORTED		    (1 << 6) /* 1.2 */
+# define DP_ENHANCED_FRAME_CAP		    (1 << 7)
+
+#define DP_MAX_DOWNSPREAD                   0x003
+# define DP_NO_AUX_HANDSHAKE_LINK_TRAINING  (1 << 6)
+
+#define DP_NORP                             0x004
+
+#define DP_DOWNSTREAMPORT_PRESENT           0x005
+# define DP_DWN_STRM_PORT_PRESENT           (1 << 0)
+# define DP_DWN_STRM_PORT_TYPE_MASK         0x06
+# define DP_DWN_STRM_PORT_TYPE_DP           (0 << 1)
+# define DP_DWN_STRM_PORT_TYPE_ANALOG       (1 << 1)
+# define DP_DWN_STRM_PORT_TYPE_TMDS         (2 << 1)
+# define DP_DWN_STRM_PORT_TYPE_OTHER        (3 << 1)
+# define DP_FORMAT_CONVERSION               (1 << 3)
+# define DP_DETAILED_CAP_INFO_AVAILABLE	    (1 << 4) /* DPI */
+
+#define DP_MAIN_LINK_CHANNEL_CODING         0x006
+
+#define DP_DOWN_STREAM_PORT_COUNT	    0x007
+# define DP_PORT_COUNT_MASK		    0x0f
+# define DP_MSA_TIMING_PAR_IGNORED	    (1 << 6) /* eDP */
+# define DP_OUI_SUPPORT			    (1 << 7)
+
+#define DP_I2C_SPEED_CAP		    0x00c    /* DPI */
+# define DP_I2C_SPEED_1K		    0x01
+# define DP_I2C_SPEED_5K		    0x02
+# define DP_I2C_SPEED_10K		    0x04
+# define DP_I2C_SPEED_100K		    0x08
+# define DP_I2C_SPEED_400K		    0x10
+# define DP_I2C_SPEED_1M		    0x20
+
+#define DP_EDP_CONFIGURATION_CAP            0x00d   /* XXX 1.2? */
+#define DP_TRAINING_AUX_RD_INTERVAL         0x00e   /* XXX 1.2? */
+
+/* Multiple stream transport */
+#define DP_FAUX_CAP			    0x020   /* 1.2 */
+# define DP_FAUX_CAP_1			    (1 << 0)
+
+#define DP_MSTM_CAP			    0x021   /* 1.2 */
+# define DP_MST_CAP			    (1 << 0)
+
+#define DP_GUID				    0x030   /* 1.2 */
+
+#define DP_PSR_SUPPORT                      0x070   /* XXX 1.2? */
+# define DP_PSR_IS_SUPPORTED                1
+#define DP_PSR_CAPS                         0x071   /* XXX 1.2? */
+# define DP_PSR_NO_TRAIN_ON_EXIT            1
+# define DP_PSR_SETUP_TIME_330              (0 << 1)
+# define DP_PSR_SETUP_TIME_275              (1 << 1)
+# define DP_PSR_SETUP_TIME_220              (2 << 1)
+# define DP_PSR_SETUP_TIME_165              (3 << 1)
+# define DP_PSR_SETUP_TIME_110              (4 << 1)
+# define DP_PSR_SETUP_TIME_55               (5 << 1)
+# define DP_PSR_SETUP_TIME_0                (6 << 1)
+# define DP_PSR_SETUP_TIME_MASK             (7 << 1)
+# define DP_PSR_SETUP_TIME_SHIFT            1
+
+/*
+ * 0x80-0x8f describe downstream port capabilities, but there are two layouts
+ * based on whether DP_DETAILED_CAP_INFO_AVAILABLE was set.  If it was not,
+ * each port's descriptor is one byte wide.  If it was set, each port's is
+ * four bytes wide, starting with the one byte from the base info.  As of
+ * DP interop v1.1a only VGA defines additional detail.
+ */
+
+/* offset 0 */
+#define DP_DOWNSTREAM_PORT_0		    0x80
+# define DP_DS_PORT_TYPE_MASK		    (7 << 0)
+# define DP_DS_PORT_TYPE_DP		    0
+# define DP_DS_PORT_TYPE_VGA		    1
+# define DP_DS_PORT_TYPE_DVI		    2
+# define DP_DS_PORT_TYPE_HDMI		    3
+# define DP_DS_PORT_TYPE_NON_EDID	    4
+# define DP_DS_PORT_HPD			    (1 << 3)
+/* offset 1 for VGA is maximum megapixels per second / 8 */
+/* offset 2 */
+# define DP_DS_VGA_MAX_BPC_MASK		    (3 << 0)
+# define DP_DS_VGA_8BPC			    0
+# define DP_DS_VGA_10BPC		    1
+# define DP_DS_VGA_12BPC		    2
+# define DP_DS_VGA_16BPC		    3
+
+/* link configuration */
+#define	DP_LINK_BW_SET		            0x100
+# define DP_LINK_BW_1_62		    0x06
+# define DP_LINK_BW_2_7			    0x0a
+# define DP_LINK_BW_5_4			    0x14    /* 1.2 */
+
+#define DP_LANE_COUNT_SET	            0x101
+# define DP_LANE_COUNT_MASK		    0x0f
+# define DP_LANE_COUNT_ENHANCED_FRAME_EN    (1 << 7)
+
+#define DP_TRAINING_PATTERN_SET	            0x102
+# define DP_TRAINING_PATTERN_DISABLE	    0
+# define DP_TRAINING_PATTERN_1		    1
+# define DP_TRAINING_PATTERN_2		    2
+# define DP_TRAINING_PATTERN_3		    3	    /* 1.2 */
+# define DP_TRAINING_PATTERN_MASK	    0x3
+
+# define DP_LINK_QUAL_PATTERN_DISABLE	    (0 << 2)
+# define DP_LINK_QUAL_PATTERN_D10_2	    (1 << 2)
+# define DP_LINK_QUAL_PATTERN_ERROR_RATE    (2 << 2)
+# define DP_LINK_QUAL_PATTERN_PRBS7	    (3 << 2)
+# define DP_LINK_QUAL_PATTERN_MASK	    (3 << 2)
+
+# define DP_RECOVERED_CLOCK_OUT_EN	    (1 << 4)
+# define DP_LINK_SCRAMBLING_DISABLE	    (1 << 5)
+
+# define DP_SYMBOL_ERROR_COUNT_BOTH	    (0 << 6)
+# define DP_SYMBOL_ERROR_COUNT_DISPARITY    (1 << 6)
+# define DP_SYMBOL_ERROR_COUNT_SYMBOL	    (2 << 6)
+# define DP_SYMBOL_ERROR_COUNT_MASK	    (3 << 6)
+
+#define DP_TRAINING_LANE0_SET		    0x103
+#define DP_TRAINING_LANE1_SET		    0x104
+#define DP_TRAINING_LANE2_SET		    0x105
+#define DP_TRAINING_LANE3_SET		    0x106
+
+# define DP_TRAIN_VOLTAGE_SWING_MASK	    0x3
+# define DP_TRAIN_VOLTAGE_SWING_SHIFT	    0
+# define DP_TRAIN_MAX_SWING_REACHED	    (1 << 2)
+# define DP_TRAIN_VOLTAGE_SWING_LEVEL_0 (0 << 0)
+# define DP_TRAIN_VOLTAGE_SWING_LEVEL_1 (1 << 0)
+# define DP_TRAIN_VOLTAGE_SWING_LEVEL_2 (2 << 0)
+# define DP_TRAIN_VOLTAGE_SWING_LEVEL_3 (3 << 0)
+
+# define DP_TRAIN_PRE_EMPHASIS_MASK	    (3 << 3)
+# define DP_TRAIN_PRE_EMPH_LEVEL_0		(0 << 3)
+# define DP_TRAIN_PRE_EMPH_LEVEL_1		(1 << 3)
+# define DP_TRAIN_PRE_EMPH_LEVEL_2		(2 << 3)
+# define DP_TRAIN_PRE_EMPH_LEVEL_3		(3 << 3)
+
+# define DP_TRAIN_PRE_EMPHASIS_SHIFT	    3
+# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED  (1 << 5)
+
+#define DP_DOWNSPREAD_CTRL		    0x107
+# define DP_SPREAD_AMP_0_5		    (1 << 4)
+# define DP_MSA_TIMING_PAR_IGNORE_EN	    (1 << 7) /* eDP */
+
+#define DP_MAIN_LINK_CHANNEL_CODING_SET	    0x108
+# define DP_SET_ANSI_8B10B		    (1 << 0)
+
+#define DP_I2C_SPEED_CONTROL_STATUS	    0x109   /* DPI */
+/* bitmask as for DP_I2C_SPEED_CAP */
+
+#define DP_EDP_CONFIGURATION_SET            0x10a   /* XXX 1.2? */
+
+#define DP_MSTM_CTRL			    0x111   /* 1.2 */
+# define DP_MST_EN			    (1 << 0)
+# define DP_UP_REQ_EN			    (1 << 1)
+# define DP_UPSTREAM_IS_SRC		    (1 << 2)
+
+#define DP_PSR_EN_CFG			    0x170   /* XXX 1.2? */
+# define DP_PSR_ENABLE			    (1 << 0)
+# define DP_PSR_MAIN_LINK_ACTIVE	    (1 << 1)
+# define DP_PSR_CRC_VERIFICATION	    (1 << 2)
+# define DP_PSR_FRAME_CAPTURE		    (1 << 3)
+
+#define DP_ADAPTER_CTRL			    0x1a0
+# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE   (1 << 0)
+
+#define DP_BRANCH_DEVICE_CTRL		    0x1a1
+# define DP_BRANCH_DEVICE_IRQ_HPD	    (1 << 0)
+
+#define DP_PAYLOAD_ALLOCATE_SET		    0x1c0
+#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
+#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
+
+#define DP_SINK_COUNT			    0x200
+/* prior to 1.2 bit 7 was reserved mbz */
+# define DP_GET_SINK_COUNT(x)		    ((((x) & 0x80) >> 1) | ((x) & 0x3f))
+# define DP_SINK_CP_READY		    (1 << 6)
+
+#define DP_DEVICE_SERVICE_IRQ_VECTOR	    0x201
+# define DP_REMOTE_CONTROL_COMMAND_PENDING  (1 << 0)
+# define DP_AUTOMATED_TEST_REQUEST	    (1 << 1)
+# define DP_CP_IRQ			    (1 << 2)
+# define DP_MCCS_IRQ			    (1 << 3)
+# define DP_DOWN_REP_MSG_RDY		    (1 << 4) /* 1.2 MST */
+# define DP_UP_REQ_MSG_RDY		    (1 << 5) /* 1.2 MST */
+# define DP_SINK_SPECIFIC_IRQ		    (1 << 6)
+
+#define DP_LANE0_1_STATUS		    0x202
+#define DP_LANE2_3_STATUS		    0x203
+# define DP_LANE_CR_DONE		    (1 << 0)
+# define DP_LANE_CHANNEL_EQ_DONE	    (1 << 1)
+# define DP_LANE_SYMBOL_LOCKED		    (1 << 2)
+
+#define DP_CHANNEL_EQ_BITS (DP_LANE_CR_DONE |		\
+			    DP_LANE_CHANNEL_EQ_DONE |	\
+			    DP_LANE_SYMBOL_LOCKED)
+
+#define DP_LANE_ALIGN_STATUS_UPDATED	    0x204
+
+#define DP_INTERLANE_ALIGN_DONE		    (1 << 0)
+#define DP_DOWNSTREAM_PORT_STATUS_CHANGED   (1 << 6)
+#define DP_LINK_STATUS_UPDATED		    (1 << 7)
+
+#define DP_SINK_STATUS			    0x205
+
+#define DP_RECEIVE_PORT_0_STATUS	    (1 << 0)
+#define DP_RECEIVE_PORT_1_STATUS	    (1 << 1)
+
+#define DP_ADJUST_REQUEST_LANE0_1	    0x206
+#define DP_ADJUST_REQUEST_LANE2_3	    0x207
+# define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK  0x03
+# define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0
+# define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK   0x0c
+# define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT  2
+# define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK  0x30
+# define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4
+# define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK   0xc0
+# define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT  6
+
+#define DP_TEST_REQUEST			    0x218
+# define DP_TEST_LINK_TRAINING		    (1 << 0)
+# define DP_TEST_LINK_VIDEO_PATTERN	    (1 << 1)
+# define DP_TEST_LINK_EDID_READ		    (1 << 2)
+# define DP_TEST_LINK_PHY_TEST_PATTERN	    (1 << 3) /* DPCD >= 1.1 */
+# define DP_TEST_LINK_FAUX_PATTERN	    (1 << 4) /* DPCD >= 1.2 */
+
+#define DP_TEST_LINK_RATE		    0x219
+# define DP_LINK_RATE_162		    (0x6)
+# define DP_LINK_RATE_27		    (0xa)
+
+#define DP_TEST_LANE_COUNT		    0x220
+
+#define DP_TEST_PATTERN			    0x221
+
+#define DP_TEST_CRC_R_CR		    0x240
+#define DP_TEST_CRC_G_Y			    0x242
+#define DP_TEST_CRC_B_CB		    0x244
+
+#define DP_TEST_SINK_MISC		    0x246
+#define DP_TEST_CRC_SUPPORTED		    (1 << 5)
+
+#define DP_TEST_RESPONSE		    0x260
+# define DP_TEST_ACK			    (1 << 0)
+# define DP_TEST_NAK			    (1 << 1)
+# define DP_TEST_EDID_CHECKSUM_WRITE	    (1 << 2)
+
+#define DP_TEST_EDID_CHECKSUM		    0x261
+
+#define DP_TEST_SINK			    0x270
+#define DP_TEST_SINK_START	    (1 << 0)
+
+#define DP_PAYLOAD_TABLE_UPDATE_STATUS      0x2c0   /* 1.2 MST */
+# define DP_PAYLOAD_TABLE_UPDATED           (1 << 0)
+# define DP_PAYLOAD_ACT_HANDLED             (1 << 1)
+
+#define DP_VC_PAYLOAD_ID_SLOT_1             0x2c1   /* 1.2 MST */
+/* up to ID_SLOT_63@0x2ff */
+
+#define DP_SOURCE_OUI			    0x300
+#define DP_SINK_OUI			    0x400
+#define DP_BRANCH_OUI			    0x500
+
+#define DP_SET_POWER                        0x600
+# define DP_SET_POWER_D0                    0x1
+# define DP_SET_POWER_D3                    0x2
+# define DP_SET_POWER_MASK                  0x3
+
+#define DP_SIDEBAND_MSG_DOWN_REQ_BASE	    0x1000   /* 1.2 MST */
+#define DP_SIDEBAND_MSG_UP_REP_BASE	    0x1200   /* 1.2 MST */
+#define DP_SIDEBAND_MSG_DOWN_REP_BASE	    0x1400   /* 1.2 MST */
+#define DP_SIDEBAND_MSG_UP_REQ_BASE	    0x1600   /* 1.2 MST */
+
+#define DP_SINK_COUNT_ESI		    0x2002   /* 1.2 */
+/* 0-5 sink count */
+# define DP_SINK_COUNT_CP_READY             (1 << 6)
+
+#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0   0x2003   /* 1.2 */
+
+#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1   0x2004   /* 1.2 */
+
+#define DP_LINK_SERVICE_IRQ_VECTOR_ESI0     0x2005   /* 1.2 */
+
+#define DP_PSR_ERROR_STATUS                 0x2006  /* XXX 1.2? */
+# define DP_PSR_LINK_CRC_ERROR              (1 << 0)
+# define DP_PSR_RFB_STORAGE_ERROR           (1 << 1)
+
+#define DP_PSR_ESI                          0x2007  /* XXX 1.2? */
+# define DP_PSR_CAPS_CHANGE                 (1 << 0)
+
+#define DP_PSR_STATUS                       0x2008  /* XXX 1.2? */
+# define DP_PSR_SINK_INACTIVE               0
+# define DP_PSR_SINK_ACTIVE_SRC_SYNCED      1
+# define DP_PSR_SINK_ACTIVE_RFB             2
+# define DP_PSR_SINK_ACTIVE_SINK_SYNCED     3
+# define DP_PSR_SINK_ACTIVE_RESYNC          4
+# define DP_PSR_SINK_INTERNAL_ERROR         7
+# define DP_PSR_SINK_STATE_MASK             0x07
+
+/* DP 1.2 Sideband message defines */
+/* peer device type - DP 1.2a Table 2-92 */
+#define DP_PEER_DEVICE_NONE		0x0
+#define DP_PEER_DEVICE_SOURCE_OR_SST	0x1
+#define DP_PEER_DEVICE_MST_BRANCHING	0x2
+#define DP_PEER_DEVICE_SST_SINK		0x3
+#define DP_PEER_DEVICE_DP_LEGACY_CONV	0x4
+
+/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
+#define DP_LINK_ADDRESS			0x01
+#define DP_CONNECTION_STATUS_NOTIFY	0x02
+#define DP_ENUM_PATH_RESOURCES		0x10
+#define DP_ALLOCATE_PAYLOAD		0x11
+#define DP_QUERY_PAYLOAD		0x12
+#define DP_RESOURCE_STATUS_NOTIFY	0x13
+#define DP_CLEAR_PAYLOAD_ID_TABLE	0x14
+#define DP_REMOTE_DPCD_READ		0x20
+#define DP_REMOTE_DPCD_WRITE		0x21
+#define DP_REMOTE_I2C_READ		0x22
+#define DP_REMOTE_I2C_WRITE		0x23
+#define DP_POWER_UP_PHY			0x24
+#define DP_POWER_DOWN_PHY		0x25
+#define DP_SINK_EVENT_NOTIFY		0x30
+#define DP_QUERY_STREAM_ENC_STATUS	0x38
+
+/* DP 1.2 MST sideband nak reasons - table 2.84 */
+#define DP_NAK_WRITE_FAILURE		0x01
+#define DP_NAK_INVALID_READ		0x02
+#define DP_NAK_CRC_FAILURE		0x03
+#define DP_NAK_BAD_PARAM		0x04
+#define DP_NAK_DEFER			0x05
+#define DP_NAK_LINK_FAILURE		0x06
+#define DP_NAK_NO_RESOURCES		0x07
+#define DP_NAK_DPCD_FAIL		0x08
+#define DP_NAK_I2C_NAK			0x09
+#define DP_NAK_ALLOCATE_FAIL		0x0a
+
+#define MODE_I2C_START	1
+#define MODE_I2C_WRITE	2
+#define MODE_I2C_READ	4
+#define MODE_I2C_STOP	8
+
+/* Rest of file omitted as it is not used in U-Boot */
+
+#endif /* _DRM_DP_HELPER_H_ */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#20 lore raw

PATCH v6 19/26 edid: Add a function to read detailed monitor timings

In reply to Simon Glass

For digital displays (such as EDP LCDs) we would like to read the EDID information and use that to set display timings. Provide a function to do this.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/edid.c  | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/edid.h |  19 +++++++++++
 2 files changed, 124 insertions(+)
common/edid.c +105 -0
index df797fc..e08e420 100644
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <edid.h>
 #include <errno.h>
+#include <fdtdec.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 
@@ -65,6 +66,110 @@ int edid_get_ranges(struct edid1_info *edid, unsigned int *hmin,
 	return -1;
 }
 
+/* Set all parts of a timing entry to the same value */
+static void set_entry(struct timing_entry *entry, u32 value)
+{
+	entry->min = value;
+	entry->typ = value;
+	entry->max = value;
+}
+
+/**
+ * decode_timing() - Decoding an 18-byte detailed timing record
+ *
+ * @buf:	Pointer to EDID detailed timing record
+ * @timing:	Place to put timing
+ */
+static void decode_timing(u8 *buf, struct display_timing *timing)
+{
+	uint x_mm, y_mm;
+	unsigned int ha, hbl, hso, hspw, hborder;
+	unsigned int va, vbl, vso, vspw, vborder;
+
+	/* Edid contains pixel clock in terms of 10KHz */
+	set_entry(&timing->pixelclock, (buf[0] + (buf[1] << 8)) * 10000);
+	x_mm = (buf[12] + ((buf[14] & 0xf0) << 4));
+	y_mm = (buf[13] + ((buf[14] & 0x0f) << 8));
+	ha = (buf[2] + ((buf[4] & 0xf0) << 4));
+	hbl = (buf[3] + ((buf[4] & 0x0f) << 8));
+	hso = (buf[8] + ((buf[11] & 0xc0) << 2));
+	hspw = (buf[9] + ((buf[11] & 0x30) << 4));
+	hborder = buf[15];
+	va = (buf[5] + ((buf[7] & 0xf0) << 4));
+	vbl = (buf[6] + ((buf[7] & 0x0f) << 8));
+	vso = ((buf[10] >> 4) + ((buf[11] & 0x0c) << 2));
+	vspw = ((buf[10] & 0x0f) + ((buf[11] & 0x03) << 4));
+	vborder = buf[16];
+
+	set_entry(&timing->hactive, ha);
+	set_entry(&timing->hfront_porch, hso);
+	set_entry(&timing->hback_porch, hbl - hso - hspw);
+	set_entry(&timing->hsync_len, hspw);
+
+	set_entry(&timing->vactive, va);
+	set_entry(&timing->vfront_porch, vso);
+	set_entry(&timing->vback_porch, vbl - vso - vspw);
+	set_entry(&timing->vsync_len, vspw);
+
+	debug("Detailed mode clock %u Hz, %d mm x %d mm\n"
+	      "               %04x %04x %04x %04x hborder %x\n"
+	      "               %04x %04x %04x %04x vborder %x\n",
+	      timing->pixelclock.typ,
+	      x_mm, y_mm,
+	      ha, ha + hso, ha + hso + hspw,
+	      ha + hbl, hborder,
+	      va, va + vso, va + vso + vspw,
+	      va + vbl, vborder);
+}
+
+int edid_get_timing(u8 *buf, int buf_size, struct display_timing *timing,
+		    int *panel_bits_per_colourp)
+{
+	struct edid1_info *edid = (struct edid1_info *)buf;
+	bool timing_done;
+	int i;
+
+	if (buf_size < sizeof(*edid) || edid_check_info(edid)) {
+		debug("%s: Invalid buffer\n", __func__);
+		return -EINVAL;
+	}
+
+	if (!EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(*edid)) {
+		debug("%s: No preferred timing\n", __func__);
+		return -ENOENT;
+	}
+
+	/* Look for detailed timing */
+	timing_done = false;
+	for (i = 0; i < 4; i++) {
+		struct edid_monitor_descriptor *desc;
+
+		desc = &edid->monitor_details.descriptor[i];
+		if (desc->zero_flag_1 != 0) {
+			decode_timing((u8 *)desc, timing);
+			timing_done = true;
+			break;
+		}
+	}
+	if (!timing_done)
+		return -EINVAL;
+
+	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
+		debug("%s: Not a digital display\n", __func__);
+		return -ENOSYS;
+	}
+	if (edid->version != 1 || edid->revision < 4) {
+		debug("%s: EDID version %d.%d does not have required info\n",
+		      __func__, edid->version, edid->revision);
+		*panel_bits_per_colourp = -1;
+	} else  {
+		*panel_bits_per_colourp =
+			((edid->video_input_definition & 0x70) >> 3) + 4;
+	}
+
+	return 0;
+}
+
 /**
  * Snip the tailing whitespace/return of a string.
  *
include/edid.h +19 -0
index 18ec1d5..88b4b7d 100644
@@ -15,6 +15,9 @@
 
 #include <linux/types.h>
 
+/* Size of the EDID data */
+#define EDID_SIZE	128
+
 #define GET_BIT(_x, _pos) \
 	(((_x) >> (_pos)) & 1)
 #define GET_BITS(_x, _pos_msb, _pos_lsb) \
@@ -287,4 +290,20 @@ int edid_get_ranges(struct edid1_info *edid, unsigned int *hmin,
 		    unsigned int *hmax, unsigned int *vmin,
 		    unsigned int *vmax);
 
+struct display_timing;
+
+/**
+ * edid_get_timing() - Get basic digital display parameters
+ *
+ * @param buf		Buffer containing EDID data
+ * @param buf_size	Size of buffer in bytes
+ * @param timing	Place to put preferring timing information
+ * @param panel_bits_per_colourp	Place to put the number of bits per
+ *			colour supported by the panel. This will be set to
+ *			-1 if not available
+ * @return 0 if timings are OK, -ve on error
+ */
+int edid_get_timing(u8 *buf, int buf_size, struct display_timing *timing,
+		    int *panel_bits_per_colourp);
+
 #endif /* __EDID_H_ */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#21 lore raw

PATCH v6 20/26 dm: video: Add a uclass for display port

In reply to Simon Glass

eDP (Embedded DisplayPort) is a standard widely used in laptops to drive LCD panels. Add a uclass for this which supports a few simple operations.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/video/Kconfig     |  7 ++++++
 drivers/video/Makefile    |  4 ++++
 drivers/video/dp-uclass.c | 34 +++++++++++++++++++++++++++
 include/displayport.h     | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h    |  1 +
 5 files changed, 106 insertions(+)
 create mode 100644 drivers/video/dp-uclass.c
 create mode 100644 include/displayport.h
drivers/video/Kconfig +7 -0
index 51728b3..62af63a 100644
@@ -88,3 +88,10 @@ config VIDEO_LCD_SPI_MISO
 	hardware and LCD panel id retrieval (if the panel can report it). The
 	option takes a string in the format understood by 'name_to_gpio'
 	function, e.g. PH1 for pin 1 of port H.
+
+config DISPLAY_PORT
+	bool "Enable DisplayPort support"
+	help
+	   eDP (Embedded DisplayPort) is a standard widely used in laptops
+	   to drive LCD panels. This framework provides support for enabling
+	   these displays where supported by the video hardware.
drivers/video/Makefile +4 -0
index 22a316b..2846ac8 100644
@@ -5,6 +5,10 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+ifdef CONFIG_DM
+obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
+endif
+
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
 obj-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
drivers/video/dp-uclass.c new file +34 -0
new file mode 100644
index 0000000..17f5de9
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <displayport.h>
+#include <errno.h>
+
+int display_port_read_edid(struct udevice *dev, u8 *buf, int buf_size)
+{
+	struct dm_display_port_ops *ops = display_port_get_ops(dev);
+
+	if (!ops || !ops->read_edid)
+		return -ENOSYS;
+	return ops->read_edid(dev, buf, buf_size);
+}
+
+int display_port_enable(struct udevice *dev, int panel_bpp,
+			const struct display_timing *timing)
+{
+	struct dm_display_port_ops *ops = display_port_get_ops(dev);
+
+	if (!ops || !ops->enable)
+		return -ENOSYS;
+	return ops->enable(dev, panel_bpp, timing);
+}
+
+UCLASS_DRIVER(display_port) = {
+	.id		= UCLASS_DISPLAY_PORT,
+	.name		= "display_port",
+};
include/displayport.h new file +60 -0

60 lines not on this page · raw message

include/dm/uclass-id.h +1 -0
index ddcd9c6..b83098c 100644
@@ -26,6 +26,7 @@ enum uclass_id {
 
 	/* U-Boot uclasses start here - in alphabetical order */
 	UCLASS_CROS_EC,		/* Chrome OS EC */
+	UCLASS_DISPLAY_PORT,	/* Display port video */
 	UCLASS_ETH,		/* Ethernet device */
 	UCLASS_GPIO,		/* Bank of general-purpose I/O pins */
 	UCLASS_I2C,		/* I2C bus */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#23 lore raw

PATCH v6 21/26 tegra: dts: nyan-big: Add definitions for eDP display

In reply to Simon Glass

Add the various host1x peripherals to allow an eDP display to be connected.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/dts/tegra124-nyan-big.dts | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/dts/tegra124-nyan-big.dts +43 -0
index a50f26c..5a39e93 100644
@@ -29,6 +29,35 @@
 		reg = <0x80000000 0x80000000>;
 	};
 
+	host1x at 50000000 {
+		dc at 54200000 {
+			display-timings {
+				timing at 0 {
+					clock-frequency = <69500000>;
+					hactive = <1366>;
+					vactive = <768>;
+					hsync-len = <32>;
+					hfront-porch = <48>;
+					hback-porch = <20>;
+					vfront-porch = <3>;
+					vback-porch = <13>;
+					vsync-len = <6>;
+				};
+			};
+		};
+
+		sor at 54540000 {
+			status = "okay";
+
+			nvidia,dpaux = <&dpaux>;
+			nvidia,panel = <&panel>;
+		};
+
+		dpaux at 545c0000 {
+			status = "okay";
+		};
+	};
+
 	serial at 70006000 {
 		/* Debug connector on the bottom of the board near SD card. */
 		status = "okay";
@@ -258,6 +287,7 @@
 		compatible = "pwm-backlight";
 
 		enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
+		power-supply = <&vdd_led>;
 		pwms = <&pwm 1 1000000>;
 
 		default-brightness-level = <224>;
@@ -341,6 +371,19 @@
 		backlight = <&backlight>;
 	};
 
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		vdd_led: regulator at 5 {
+			compatible = "regulator-fixed";
+			reg = <5>;
+			regulator-name = "+VDD_LED";
+			gpio = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
+	};
+
 	sound {
 		compatible = "nvidia,tegra-audio-max98090-nyan-big",
 			     "nvidia,tegra-audio-max98090";
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#24 lore raw

PATCH v6 22/26 tegra: video: Support serial output resource (SOR) on tegra124

In reply to Simon Glass

The SOR is required for talking to eDP LCD panels. Add a driver for this which will be used by the DisplayPort driver.

---

Changes in v6:
- Add more debug() statements

Changes in v4: None
Changes in v3:
- Reorder parameters to tegra_dc_sor_attach()
- Simplify timouts to remove repeated multiplication by 1000

Changes in v2: None

 drivers/video/Makefile          |   2 +
 drivers/video/tegra124/Makefile |   7 +
 drivers/video/tegra124/sor.c    | 896 +++++++++++++++++++++++++++++++++++++++
 drivers/video/tegra124/sor.h    | 904 ++++++++++++++++++++++++++++++++++++++++
 include/fdtdec.h                |   3 +
 lib/fdtdec.c                    |   3 +
 6 files changed, 1815 insertions(+)
 create mode 100644 drivers/video/tegra124/Makefile
 create mode 100644 drivers/video/tegra124/sor.c
 create mode 100644 drivers/video/tegra124/sor.h
drivers/video/Makefile +2 -0
index 2846ac8..e228a17 100644
@@ -51,3 +51,5 @@ obj-$(CONFIG_VIDEO_VESA) += vesa_fb.o
 obj-$(CONFIG_FORMIKE) += formike.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_VIDEO_PARADE) += parade.o
+
+obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
drivers/video/tegra124/Makefile new file +7 -0
new file mode 100644
index 0000000..9aa81a5
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2014 Google, Inc
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += sor.o
drivers/video/tegra124/sor.c new file +896 -0

896 lines not on this page · raw message

drivers/video/tegra124/sor.h new file +904 -0

904 lines not on this page · raw message

include/fdtdec.h +3 -0
index 3417ef9..45f6824 100644
@@ -120,6 +120,9 @@ enum fdt_compat_id {
 	COMPAT_NVIDIA_TEGRA20_KBC,	/* Tegra20 Keyboard */
 	COMPAT_NVIDIA_TEGRA20_NAND,	/* Tegra2 NAND controller */
 	COMPAT_NVIDIA_TEGRA20_PWM,	/* Tegra 2 PWM controller */
+	COMPAT_NVIDIA_TEGRA124_DC,	/* Tegra 124 Display controller */
+	COMPAT_NVIDIA_TEGRA124_SOR,	/* Tegra 124 Serial Output Resource */
+	COMPAT_NVIDIA_TEGRA124_PMC,	/* Tegra 124 power mgmt controller */
 	COMPAT_NVIDIA_TEGRA20_DC,	/* Tegra 2 Display controller */
 	COMPAT_NVIDIA_TEGRA124_SDMMC,	/* Tegra124 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA30_SDMMC,	/* Tegra30 SDMMC controller */
lib/fdtdec.c +3 -0
index 3fbb0bd..f4c1456 100644
@@ -29,6 +29,9 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
 	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
 	COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
+	COMPAT(NVIDIA_TEGRA124_DC, "nvidia,tegra124-dc"),
+	COMPAT(NVIDIA_TEGRA124_SOR, "nvidia,tegra124-sor"),
+	COMPAT(NVIDIA_TEGRA124_PMC, "nvidia,tegra124-pmc"),
 	COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
 	COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
 	COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#26 lore raw

PATCH v6 23/26 tegra: video: Add Embedded DisplayPort driver

In reply to Simon Glass

This interface is used on laptop devices based on Tegra. Add a driver which provides access to the eDP interface. The driver uses the display port uclass.

---

Changes in v6:
- Fix incorrect use of DP_MAIN_LINK_CHANNEL_CODING_SET register

Changes in v4: None
Changes in v3:
- Fix 64-bit maths error
- Fix trainging typo
- Set scramble_ena to 1 on start-up so that link training succeeds
- Use real error return values in tegra_dc_dpaux_write_chunk() and others
- Use sor pointer in struct tegra_dp_priv

Changes in v2: None

 drivers/video/tegra124/Makefile      |    1 +
 drivers/video/tegra124/displayport.h |  184 ++++++
 drivers/video/tegra124/dp.c          | 1080 ++++++++++++++++++++++++++++++++++
 3 files changed, 1265 insertions(+)
 create mode 100644 drivers/video/tegra124/displayport.h
 create mode 100644 drivers/video/tegra124/dp.c
drivers/video/tegra124/Makefile +1 -0
index 9aa81a5..7e08ee9 100644
@@ -4,4 +4,5 @@
 # SPDX-License-Identifier:      GPL-2.0+
 #
 
+obj-y += dp.o
 obj-y += sor.o
drivers/video/tegra124/displayport.h new file +184 -0

184 lines not on this page · raw message

drivers/video/tegra124/dp.c new file +1080 -0

1,080 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#28 lore raw

PATCH v6 24/26 tegra: video: support eDP displays on Tegra124 devices

In reply to Simon Glass

Connect up the clocks and the eDP driver to make these displays work with Tegra124-based devices.

---

Changes in v6:
- Report failure when we cannot init the eDP display

Changes in v4: None
Changes in v3:
- Change parameters of update_display_mode()

Changes in v2:
- Rebase on top of u-boot-dm

 arch/arm/include/asm/arch-tegra124/display.h |  58 +++++
 drivers/video/Kconfig                        |   8 +
 drivers/video/tegra124/Makefile              |   2 +
 drivers/video/tegra124/display.c             | 358 +++++++++++++++++++++++++++
 drivers/video/tegra124/tegra124-lcd.c        |  97 ++++++++
 5 files changed, 523 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-tegra124/display.h
 create mode 100644 drivers/video/tegra124/display.c
 create mode 100644 drivers/video/tegra124/tegra124-lcd.c
arch/arm/include/asm/arch-tegra124/display.h new file +58 -0
new file mode 100644
index 0000000..ca6644a
@@ -0,0 +1,58 @@
+/*
+ *  (C) Copyright 2010
+ *  NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_TEGRA_DISPLAY_H
+#define __ASM_ARCH_TEGRA_DISPLAY_H
+
+/**
+ * Register a new display based on device tree configuration.
+ *
+ * The frame buffer can be positioned by U-Boot or overriden by the fdt.
+ * You should pass in the U-Boot address here, and check the contents of
+ * struct fdt_disp_config to see what was actually chosen.
+ *
+ * @param blob			Device tree blob
+ * @param default_lcd_base	Default address of LCD frame buffer
+ * @return 0 if ok, -1 on error (unsupported bits per pixel)
+ */
+int tegra_display_probe(const void *blob, void *default_lcd_base);
+
+/**
+ * Return the current display configuration
+ *
+ * @return pointer to display configuration, or NULL if there is no valid
+ * config
+ */
+struct fdt_disp_config *tegra_display_get_config(void);
+
+/**
+ * Perform the next stage of the LCD init if it is time to do so.
+ *
+ * LCD init can be time-consuming because of the number of delays we need
+ * while waiting for the backlight power supply, etc. This function can
+ * be called at various times during U-Boot operation to advance the
+ * initialization of the LCD to the next stage if sufficient time has
+ * passed since the last stage. It keeps track of what stage it is up to
+ * and the time that it is permitted to move to the next stage.
+ *
+ * The final call should have wait=1 to complete the init.
+ *
+ * @param blob	fdt blob containing LCD information
+ * @param wait	1 to wait until all init is complete, and then return
+ *		0 to return immediately, potentially doing nothing if it is
+ *		not yet time for the next init.
+ */
+int tegra_lcd_check_next_stage(const void *blob, int wait);
+
+/**
+ * Set up the maximum LCD size so we can size the frame buffer.
+ *
+ * @param blob	fdt blob containing LCD information
+ */
+void tegra_lcd_early_init(const void *blob);
+
+#endif /*__ASM_ARCH_TEGRA_DISPLAY_H*/
drivers/video/Kconfig +8 -0
index 62af63a..2544301 100644
@@ -95,3 +95,11 @@ config DISPLAY_PORT
 	   eDP (Embedded DisplayPort) is a standard widely used in laptops
 	   to drive LCD panels. This framework provides support for enabling
 	   these displays where supported by the video hardware.
+
+config VIDEO_TEGRA124
+	bool "Enable video support on Tegra124"
+	help
+	   Tegra124 supports many video output options including eDP and
+	   HDMI. At present only eDP is supported by U-Boot. This option
+	   enables this support which can be used on devices which
+	   have an eDP display connected.
drivers/video/tegra124/Makefile +2 -0
index 7e08ee9..52eedb0 100644
@@ -4,5 +4,7 @@
 # SPDX-License-Identifier:      GPL-2.0+
 #
 
+obj-y += display.o
 obj-y += dp.o
 obj-y += sor.o
+obj-y += tegra124-lcd.o
drivers/video/tegra124/display.c new file +358 -0

358 lines not on this page · raw message

drivers/video/tegra124/tegra124-lcd.c new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#30 lore raw

PATCH v6 25/26 tegra: config: nyan-big: Enable LCD

In reply to Simon Glass

Add the PMIC, LCD settings, PWM and also show the board info at the top of the LCD when starting up.

---

Changes in v6: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 configs/nyan-big_defconfig |  2 ++
 include/configs/nyan-big.h | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
configs/nyan-big_defconfig +2 -0
index 0d2ed51..d447ddc 100644
@@ -3,3 +3,5 @@ CONFIG_TEGRA=y
 CONFIG_TEGRA124=y
 CONFIG_TARGET_NYAN_BIG=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-nyan-big"
+CONFIG_DISPLAY_PORT=y
+CONFIG_VIDEO_TEGRA124=y
include/configs/nyan-big.h +14 -0
index 5397599..caca98b 100644
@@ -21,6 +21,8 @@
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
 
+#define CONFIG_DISPLAY_BOARDINFO_LATE
+
 /* I2C */
 #define CONFIG_SYS_I2C_TEGRA
 #define CONFIG_CMD_I2C
@@ -37,6 +39,18 @@
 #define CONFIG_SYS_MMC_ENV_PART		2
 #define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)
 
+#define CONFIG_I2C_EDID
+
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_PWM_TEGRA
+#define CONFIG_AS3722_POWER
+#define LCD_BPP				LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
+/* Align LCD to 1MB boundary */
+#define CONFIG_LCD_ALIGNMENT	MMU_SECTION_SIZE
+
 /* SPI */
 #define CONFIG_TEGRA114_SPI		/* Compatible w/ Tegra114 SPI */
 #define CONFIG_TEGRA114_SPI_CTRLS	6
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#31 lore raw

PATCH v6 26/26 tegra124: video: Add full link training for eDP

In reply to Simon Glass

Add full link training as a fallback in case the fast link training fails.

---

Changes in v6:
- Add a comment about tegra_dc_dp_check_sink()
- Improve retry logic in tegra_dc_dp_check_sink()

Changes in v4:
- Rebase on u-boot-dm/next since this series is still pending

Changes in v3:
- Add full link training support

Changes in v2:
- Rebase on top of u-boot-dm

 arch/arm/include/asm/arch-tegra/dc.h |   4 +
 drivers/video/tegra124/display.c     | 114 +++++++
 drivers/video/tegra124/displayport.h | 228 +++++++++++++
 drivers/video/tegra124/dp.c          | 623 ++++++++++++++++++++++++++++++++---
 drivers/video/tegra124/sor.c         | 160 ++++++++-
 drivers/video/tegra124/sor.h         |  18 +
 include/linux/drm_dp_helper.h        |   1 +
 7 files changed, 1084 insertions(+), 64 deletions(-)
arch/arm/include/asm/arch-tegra/dc.h +4 -0
index 8803c11..6ffb468 100644
@@ -564,6 +564,10 @@ enum {
 #define V_DDA_INC_SHIFT		16
 #define V_DDA_INC_MASK		(0xFFFF << V_DDA_INC_SHIFT)
 
+#define DC_POLL_TIMEOUT_MS		50
+#define DC_N_WINDOWS			5
+#define DC_REG_SAVE_SPACE		(DC_N_WINDOWS + 5)
+
 struct display_timing;
 
 int display_init(void *lcdbase, int fb_bits_per_pixel,
drivers/video/tegra124/display.c +114 -0

120 lines not on this page · raw message

drivers/video/tegra124/displayport.h +228 -0

259 lines not on this page · raw message

drivers/video/tegra124/dp.c +575 -48

692 lines not on this page · raw message

drivers/video/tegra124/sor.c +144 -16

187 lines not on this page · raw message

drivers/video/tegra124/sor.h +18 -0
index 7f1255c..dc8fd03 100644
@@ -848,6 +848,7 @@ struct tegra_dp_link_config {
 	u32	bits_per_pixel;
 	int	alt_scramber_reset_cap; /* true for eDP */
 	int	only_enhanced_framing;	/* enhanced_frame_en ignored */
+	int	frame_in_ms;
 
 	/* Actual configuration */
 	u8	link_bw;
@@ -868,6 +869,8 @@ struct tegra_dp_link_config {
 	u32	drive_current;
 	u32     preemphasis;
 	u32	postcursor;
+	u8	aux_rd_interval;
+	u8	tps3_supported;
 };
 
 struct tegra_dc_sor_data {
@@ -896,9 +899,24 @@ void tegra_dc_sor_set_lane_parm(struct tegra_dc_sor_data *sor,
 			const struct tegra_dp_link_config *link_cfg);
 void tegra_dc_sor_power_down_unused_lanes(struct tegra_dc_sor_data *sor,
 			const struct tegra_dp_link_config *link_cfg);
+int tegra_dc_sor_set_voltage_swing(struct tegra_dc_sor_data *sor,
+				const struct tegra_dp_link_config *link_cfg);
+int tegra_sor_precharge_lanes(struct tegra_dc_sor_data *sor,
+			      const struct tegra_dp_link_config *cfg);
+void tegra_dp_disable_tx_pu(struct tegra_dc_sor_data *sor);
+void tegra_dp_set_pe_vs_pc(struct tegra_dc_sor_data *sor, u32 mask,
+			   u32 pe_reg, u32 vs_reg, u32 pc_reg, u8 pc_supported);
 
 int tegra_dc_sor_attach(struct tegra_dc_sor_data *sor,
 			const struct tegra_dp_link_config *link_cfg,
 			const struct display_timing *timing);
+int tegra_dc_sor_detach(struct tegra_dc_sor_data *sor);
+
+void tegra_dc_sor_disable_win_short_raster(struct dc_ctlr *disp_ctrl,
+					   int *dc_reg_ctx);
+int tegra_dc_sor_general_act(struct dc_ctlr *disp_ctrl);
+void tegra_dc_sor_restore_win_and_raster(struct dc_ctlr *disp_ctrl,
+					 int *dc_reg_ctx);
+
 int tegra_dc_sor_init(struct tegra_dc_sor_data **sorp);
 #endif
include/linux/drm_dp_helper.h +1 -0
index 86b06e1..758e4a4 100644
@@ -264,6 +264,7 @@
 #define DP_LINK_STATUS_UPDATED		    (1 << 7)
 
 #define DP_SINK_STATUS			    0x205
+#define DP_SINK_STATUS_PORT0_IN_SYNC	    (1 << 0)
 
 #define DP_RECEIVE_PORT_0_STATUS	    (1 << 0)
 #define DP_RECEIVE_PORT_1_STATUS	    (1 << 1)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#33 lore raw

v6 cover tegra: Add eDP support for nyan-big

In reply to Simon Glass

Hi Tom, Jimmy,

Quoted 18 lines · Simon Glass

This series adds eDP support for nyan-big so that the display works.

Nyan-big is based on tegra124.

Some support is added for new clocks to make this work. The drm_dp_helper.h file is brought in from Linux since many of the DisplayPort constants are generic. A very simple uclass is added for DisplayPort, and the Tegra driver makes use of that. The U-Boot EDID support is enhanced to read some additional information (detailed timings).

There is existing video support for Tegra20, but I don't think it works for Tegra30/114 (is this correct?). This series relies on detecting the display at run-time as I cannot find a good device tree binding for things like display depth. But if we could resolve that then it might be possible to move Tegra20 over to use the same driver, etc. There is clearly a lot in common with the display controllers - I have exploited this with the header file but not with the C file.

Quoted 4 lines

HDMI is not supported at present. If this is easy and there is an existing driver to follow along with then I might be able to incorporate it later.

This series is available at u-boot-dm/nyan-working

Any comments on this new version please?

Quoted 122 lines

Changes in v6:
- Add a comment about tegra_dc_dp_check_sink()
- Add more debug() statements
- Add new patch to sort the uclasses
- Fix incorrect use of DP_MAIN_LINK_CHANNEL_CODING_SET register
- Improve retry logic in tegra_dc_dp_check_sink()
- Report failure when we cannot init the eDP display

Changes in v4:
- Rebase on u-boot-dm/next since this series is still pending

Changes in v3:
- Add full link training support
- Change parameters of update_display_mode()
- Fix 64-bit maths error
- Fix trainging typo
- Reorder parameters to tegra_dc_sor_attach()
- Set scramble_ena to 1 on start-up so that link training succeeds
- Simplify timouts to remove repeated multiplication by 1000
- Use real error return values in tegra_dc_dpaux_write_chunk() and others
- Use sor pointer in struct tegra_dp_priv

Changes in v2:
- Rebase on top of u-boot-dm
- Remove definition of BIT()

Simon Glass (26):
dm: core: Sort the uclasses
dm: gpio: Add error handling and a function to claim vector GPIOs
fdt: Add binding decode function for display-timings
tegra: Move the pwm into tegra-common
tegra: pwm: Allow the clock rate to be left as is
tegra: Move checkboard() into the board code
tegra: Add a board ID function
power: Export register access functions from as3722
tegra: Provide a function to allow LCD PMIC setup
tegra: Add support for setting up a as3722 PMIC
tegra: nyan-big: Add LCD PMIC init and board ID
tegra124: dts: Add host1x node to provide display information
tegra: config: Use CONFIG_LCD to detect LCD presence
tegra: clock: Add checking for invalid clock IDs
tegra: clock: Split the clock source code into a separate function
tegra124: clock: Add display clocks and functions
tegra: Move display controller header into common
video: Add drm_dp_helper.h
edid: Add a function to read detailed monitor timings
dm: video: Add a uclass for display port
tegra: dts: nyan-big: Add definitions for eDP display
tegra: video: Support serial output resource (SOR) on tegra124
tegra: video: Add Embedded DisplayPort driver
tegra: video: support eDP displays on Tegra124 devices
tegra: config: nyan-big: Enable LCD
tegra124: video: Add full link training for eDP

 arch/arm/dts/tegra124-nyan-big.dts                 |   47 +
 arch/arm/dts/tegra124.dtsi                         |   84 +
 arch/arm/include/asm/arch-tegra/clk_rst.h          |   15 +-
 arch/arm/include/asm/arch-tegra/clock.h            |   14 +
 .../include/asm/{arch-tegra20 => arch-tegra}/dc.h  |   67 +-
 arch/arm/include/asm/arch-tegra/pwm.h              |   60 +
 arch/arm/include/asm/arch-tegra/sys_proto.h        |   19 +-
 arch/arm/include/asm/arch-tegra124/clock-tables.h  |    3 +-
 arch/arm/include/asm/arch-tegra124/clock.h         |   21 +
 arch/arm/include/asm/arch-tegra124/display.h       |   58 +
 arch/arm/include/asm/arch-tegra124/pwm.h           |   14 +
 arch/arm/include/asm/arch-tegra20/display.h        |    2 +-
 arch/arm/include/asm/arch-tegra20/pwm.h            |   54 +-
 arch/arm/mach-tegra/Makefile                       |    1 +
 arch/arm/mach-tegra/board.c                        |    8 -
 arch/arm/mach-tegra/clock.c                        |   83 +-
 arch/arm/mach-tegra/{tegra20 => }/pwm.c            |    7 +-
 arch/arm/mach-tegra/tegra124/clock.c               |  141 +-
 arch/arm/mach-tegra/tegra20/Makefile               |    1 -
 arch/arm/mach-tegra/tegra20/display.c              |    2 +-
 board/nvidia/common/board.c                        |   40 +-
 board/nvidia/nyan-big/nyan-big.c                   |   34 +-
 common/edid.c                                      |  105 ++
 configs/nyan-big_defconfig                         |    2 +
 .../gpu/nvidia,tegra20-host1x.txt                  |  372 +++++
 doc/device-tree-bindings/video/display-timing.txt  |  110 ++
 drivers/gpio/gpio-uclass.c                         |   38 +-
 drivers/power/as3722.c                             |   16 +-
 drivers/video/Kconfig                              |   15 +
 drivers/video/Makefile                             |    6 +
 drivers/video/dp-uclass.c                          |   34 +
 drivers/video/tegra124/Makefile                    |   10 +
 drivers/video/tegra124/display.c                   |  472 ++++++
 drivers/video/tegra124/displayport.h               |  412 +++++
 drivers/video/tegra124/dp.c                        | 1607 ++++++++++++++++++++
 drivers/video/tegra124/sor.c                       | 1024 +++++++++++++
 drivers/video/tegra124/sor.h                       |  922 +++++++++++
 drivers/video/tegra124/tegra124-lcd.c              |   97 ++
 include/asm-generic/gpio.h                         |   15 +-
 include/configs/nyan-big.h                         |   14 +
 include/configs/tegra-common-post.h                |    2 +-
 include/displayport.h                              |   60 +
 include/dm/uclass-id.h                             |   29 +-
 include/edid.h                                     |   19 +
 include/fdtdec.h                                   |   81 +
 include/linux/drm_dp_helper.h                      |  406 +++++
 include/power/as3722.h                             |    3 +
 lib/fdtdec.c                                       |   95 ++
 48 files changed, 6599 insertions(+), 142 deletions(-)
 rename arch/arm/include/asm/{arch-tegra20 => arch-tegra}/dc.h (89%)
 create mode 100644 arch/arm/include/asm/arch-tegra/pwm.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pwm.h
 rename arch/arm/mach-tegra/{tegra20 => }/pwm.c (93%)
 create mode 100644 doc/device-tree-bindings/gpu/nvidia,tegra20-host1x.txt
 create mode 100644 doc/device-tree-bindings/video/display-timing.txt
 create mode 100644 drivers/video/dp-uclass.c
 create mode 100644 drivers/video/tegra124/Makefile
 create mode 100644 drivers/video/tegra124/display.c
 create mode 100644 drivers/video/tegra124/displayport.h
 create mode 100644 drivers/video/tegra124/dp.c
 create mode 100644 drivers/video/tegra124/sor.c
 create mode 100644 drivers/video/tegra124/sor.h
 create mode 100644 drivers/video/tegra124/tegra124-lcd.c
 create mode 100644 include/displayport.h
 create mode 100644 include/linux/drm_dp_helper.h
Quoted 3 lines

--
2.2.0.rc0.207.ga3a616c

Regards,
Simon

#34 lore raw

v6 cover tegra: Add eDP support for nyan-big

I had a problem with the first patch in the V6 patchset (uclass-id.h sorted list), but after I fixed that it all applied to u-boot-tegra/master OK. Just need to find time to test it on my Nyan, unless someone else can say that they've done that and it's good-to-go.

Tom

Quoted 163 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Monday, April 27, 2015 8:03 PM
To: U-Boot Mailing List
Cc: Jimmy Zhang; Tom Warren; Stephen Warren; Simon Glass; Stephen Warren; Marek Vasut; Pavel Herrmann; Lukasz Majewski; Jerry Van Baren; Anatolij Gustschin
Subject: Re: [PATCH v6 0/26] tegra: Add eDP support for nyan-big

Hi Tom, Jimmy,

Quoted 9 lines · Simon Glass

This series adds eDP support for nyan-big so that the display works.

Nyan-big is based on tegra124.

Some support is added for new clocks to make this work. The drm_dp_helper.h file is brought in from Linux since many of the DisplayPort constants are generic. A very simple uclass is added for DisplayPort, and the Tegra driver makes use of that. The U-Boot EDID support is enhanced to read some additional information (detailed

timings).

Quoted 10 lines

There is existing video support for Tegra20, but I don't think it works for
Tegra30/114 (is this correct?). This series relies on detecting the display at run-time as I cannot find a good device tree binding for things like display depth. But if we could resolve that then it might be possible to move Tegra20 over to use the same driver, etc. There is clearly a lot in common with the display controllers - I have exploited this with the header file but not with the C file.

Quoted 2 lines

HDMI is not supported at present. If this is easy and there is an existing driver to follow along with then I might be able to incorporate it

later.

Quoted 2 lines

This series is available at u-boot-dm/nyan-working

Any comments on this new version please?

Quoted 123 lines

Changes in v6:
- Add a comment about tegra_dc_dp_check_sink()
- Add more debug() statements
- Add new patch to sort the uclasses
- Fix incorrect use of DP_MAIN_LINK_CHANNEL_CODING_SET register
- Improve retry logic in tegra_dc_dp_check_sink()
- Report failure when we cannot init the eDP display

Changes in v4:
- Rebase on u-boot-dm/next since this series is still pending

Changes in v3:
- Add full link training support
- Change parameters of update_display_mode()
- Fix 64-bit maths error
- Fix trainging typo
- Reorder parameters to tegra_dc_sor_attach()
- Set scramble_ena to 1 on start-up so that link training succeeds
- Simplify timouts to remove repeated multiplication by 1000
- Use real error return values in tegra_dc_dpaux_write_chunk() and others
- Use sor pointer in struct tegra_dp_priv

Changes in v2:
- Rebase on top of u-boot-dm
- Remove definition of BIT()

Simon Glass (26):
dm: core: Sort the uclasses
dm: gpio: Add error handling and a function to claim vector GPIOs
fdt: Add binding decode function for display-timings
tegra: Move the pwm into tegra-common
tegra: pwm: Allow the clock rate to be left as is
tegra: Move checkboard() into the board code
tegra: Add a board ID function
power: Export register access functions from as3722
tegra: Provide a function to allow LCD PMIC setup
tegra: Add support for setting up a as3722 PMIC
tegra: nyan-big: Add LCD PMIC init and board ID
tegra124: dts: Add host1x node to provide display information
tegra: config: Use CONFIG_LCD to detect LCD presence
tegra: clock: Add checking for invalid clock IDs
tegra: clock: Split the clock source code into a separate function
tegra124: clock: Add display clocks and functions
tegra: Move display controller header into common
video: Add drm_dp_helper.h
edid: Add a function to read detailed monitor timings
dm: video: Add a uclass for display port
tegra: dts: nyan-big: Add definitions for eDP display
tegra: video: Support serial output resource (SOR) on tegra124
tegra: video: Add Embedded DisplayPort driver
tegra: video: support eDP displays on Tegra124 devices
tegra: config: nyan-big: Enable LCD
tegra124: video: Add full link training for eDP

 arch/arm/dts/tegra124-nyan-big.dts                 |   47 +
 arch/arm/dts/tegra124.dtsi                         |   84 +
 arch/arm/include/asm/arch-tegra/clk_rst.h          |   15 +-
 arch/arm/include/asm/arch-tegra/clock.h            |   14 +
 .../include/asm/{arch-tegra20 => arch-tegra}/dc.h  |   67 +-
 arch/arm/include/asm/arch-tegra/pwm.h              |   60 +
 arch/arm/include/asm/arch-tegra/sys_proto.h        |   19 +-
 arch/arm/include/asm/arch-tegra124/clock-tables.h  |    3 +-
 arch/arm/include/asm/arch-tegra124/clock.h         |   21 +
 arch/arm/include/asm/arch-tegra124/display.h       |   58 +
 arch/arm/include/asm/arch-tegra124/pwm.h           |   14 +
 arch/arm/include/asm/arch-tegra20/display.h        |    2 +-
 arch/arm/include/asm/arch-tegra20/pwm.h            |   54 +-
 arch/arm/mach-tegra/Makefile                       |    1 +
 arch/arm/mach-tegra/board.c                        |    8 -
 arch/arm/mach-tegra/clock.c                        |   83 +-
 arch/arm/mach-tegra/{tegra20 => }/pwm.c            |    7 +-
 arch/arm/mach-tegra/tegra124/clock.c               |  141 +-
 arch/arm/mach-tegra/tegra20/Makefile               |    1 -
 arch/arm/mach-tegra/tegra20/display.c              |    2 +-
 board/nvidia/common/board.c                        |   40 +-
 board/nvidia/nyan-big/nyan-big.c                   |   34 +-
 common/edid.c                                      |  105 ++
 configs/nyan-big_defconfig                         |    2 +
 .../gpu/nvidia,tegra20-host1x.txt                  |  372 +++++
 doc/device-tree-bindings/video/display-timing.txt  |  110 ++
 drivers/gpio/gpio-uclass.c                         |   38 +-
 drivers/power/as3722.c                             |   16 +-
 drivers/video/Kconfig                              |   15 +
 drivers/video/Makefile                             |    6 +
 drivers/video/dp-uclass.c                          |   34 +
 drivers/video/tegra124/Makefile                    |   10 +
 drivers/video/tegra124/display.c                   |  472 ++++++
 drivers/video/tegra124/displayport.h               |  412 +++++
 drivers/video/tegra124/dp.c                        | 1607 ++++++++++++++++++++
 drivers/video/tegra124/sor.c                       | 1024 +++++++++++++
 drivers/video/tegra124/sor.h                       |  922 +++++++++++
 drivers/video/tegra124/tegra124-lcd.c              |   97 ++
 include/asm-generic/gpio.h                         |   15 +-
 include/configs/nyan-big.h                         |   14 +
 include/configs/tegra-common-post.h                |    2 +-
 include/displayport.h                              |   60 +
 include/dm/uclass-id.h                             |   29 +-
 include/edid.h                                     |   19 +
 include/fdtdec.h                                   |   81 +
 include/linux/drm_dp_helper.h                      |  406 +++++
 include/power/as3722.h                             |    3 +
 lib/fdtdec.c                                       |   95 ++
 48 files changed, 6599 insertions(+), 142 deletions(-)  rename
arch/arm/include/asm/{arch-tegra20 => arch-tegra}/dc.h (89%)  create
mode 100644 arch/arm/include/asm/arch-tegra/pwm.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pwm.h
 rename arch/arm/mach-tegra/{tegra20 => }/pwm.c (93%)  create mode
100644 doc/device-tree-bindings/gpu/nvidia,tegra20-host1x.txt
 create mode 100644 doc/device-tree-bindings/video/display-timing.txt
 create mode 100644 drivers/video/dp-uclass.c  create mode 100644
drivers/video/tegra124/Makefile  create mode 100644
drivers/video/tegra124/display.c  create mode 100644
drivers/video/tegra124/displayport.h
 create mode 100644 drivers/video/tegra124/dp.c  create mode 100644
drivers/video/tegra124/sor.c  create mode 100644
drivers/video/tegra124/sor.h  create mode 100644
drivers/video/tegra124/tegra124-lcd.c
 create mode 100644 include/displayport.h  create mode 100644

include/linux/drm_dp_helper.h

Quoted 6 lines
Quoted 3 lines

--
2.2.0.rc0.207.ga3a616c

Regards,
Simon

--
nvpublic