Skip to contentSkip to conversation

Add DM/DTS support for omap video driver

PATCH Superseded Dario Binacchi 4 participants 18 messages Feb 16, 2020 – Feb 17, 2020

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add DM/DTS support for omap video driver

Changes:
- Fix coding style
- Refactor some parts of the driver
- Add support for driver model and device-tree
- Update the boards device-tree
- Add device-tree binding documentation

Changes for v2:
- Use the GENMASK macro to manage bitfield mask
- Move clock enabling sequence of LCD module to arch/arm/mach-omap2/
- Create a Kconfig symbol for CONFIG_AM335X_LCD
- Move 'u-boot,dm-pre-reloc' property to *-u-boot.dtsi file for boards that support Linux
- Add a patch to fix the pixel-per-line bitfield setting
- Add a patch to fix building errors for brxre1 board in case of CONFIG_DM_VIDEO is enabled

Changes in v2:
- Use GENMASK macro too

Dario Binacchi (13):
video: omap: use BIT() and GENMASK() macros
video: omap: add missing bitfield masks
video: omap: fix coding style on use of spaces
video: omap: fix bitfields order
video: omap: rename LCD controller registers
video: omap: fix debug message
video: omap: add loop exit conditions to the dpll setup
video: omap: create two routines to set the pixel clock rate
video: omap: add support for DM/DTS
arm: dts: am335x: add 'u-boot,dm-pre-reloc' to panel
fdt: video: omap: add framebuffer and panel bindings
video: omap: fix pixel-per-line bitfield setting
board: brxre1: fix building errors

 arch/arm/dts/am335x-brppt1-mmc.dts            |   2 +
 arch/arm/dts/am335x-brppt1-nand.dts           |   2 +
 arch/arm/dts/am335x-brppt1-spi.dts            |   2 +
 arch/arm/dts/am335x-brsmarc1.dts              |   1 +
 arch/arm/dts/am335x-brxre1.dts                |   2 +
 arch/arm/dts/am335x-evm-u-boot.dtsi           |   4 +
 arch/arm/dts/am335x-evm.dts                   |   2 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi         |  10 +
 arch/arm/dts/am335x-evmsk.dts                 |   2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi      |   4 +
 arch/arm/dts/am335x-guardian.dts              |   2 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi        |   4 +
 arch/arm/dts/am335x-pdu001.dts                |   2 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi         |  10 +
 arch/arm/dts/am335x-pxm50.dts                 |   2 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi           |  10 +
 arch/arm/dts/am335x-rut.dts                   |   2 +-
 arch/arm/dts/da850-evm-u-boot.dtsi            |   4 +
 arch/arm/dts/da850-evm.dts                    |   2 +-
 arch/arm/mach-omap2/am33xx/clock_am33xx.c     |   4 +
 board/BuR/common/br_resetc.c                  |   2 +-
 board/BuR/common/bur_common.h                 |   3 +
 board/BuR/common/common.c                     |   2 +-
 .../video/tilcdc/panel.txt                    |  66 ++
 .../video/tilcdc/tilcdc.txt                   |  82 +++
 drivers/video/Kconfig                         |   6 +
 drivers/video/am335x-fb.c                     | 567 +++++++++++++++---
 drivers/video/am335x-fb.h                     |  16 +-
 include/configs/brxre1.h                      |   2 +
 29 files changed, 712 insertions(+), 107 deletions(-)
 create mode 100644 arch/arm/dts/am335x-evmsk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-pxm50-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-rut-u-boot.dtsi
 create mode 100644 doc/device-tree-bindings/video/tilcdc/panel.txt
 create mode 100644 doc/device-tree-bindings/video/tilcdc/tilcdc.txt
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 1/13 video: omap: use BIT() and GENMASK() macros

Use the standard BIT() and GENMASK() macros for bitfield definitions.

---

Changes in v2:
- Use GENMASK macro too

 drivers/video/am335x-fb.c | 36 ++++++++++++++++++------------------
 drivers/video/am335x-fb.h | 12 ++++++------
 2 files changed, 24 insertions(+), 24 deletions(-)
drivers/video/am335x-fb.c +18 -18
index 51c1af587f..7065d57148 100644
@@ -27,11 +27,11 @@
 
 /* LCD Control Register */
 #define LCD_CLK_DIVISOR(x)			((x) << 8)
-#define LCD_RASTER_MODE				0x01
+#define LCD_RASTER_MODE				BIT(0)
 /* LCD Clock Enable Register */
-#define LCD_CORECLKEN				(0x01 << 0)
-#define LCD_LIDDCLKEN				(0x01 << 1)
-#define LCD_DMACLKEN				(0x01 << 2)
+#define LCD_CORECLKEN				BIT(0)
+#define LCD_LIDDCLKEN				BIT(1)
+#define LCD_DMACLKEN				BIT(2)
 /* LCD DMA Control Register */
 #define LCD_DMA_BURST_SIZE(x)			((x) << 4)
 #define LCD_DMA_BURST_1				0x0
@@ -40,28 +40,28 @@
 #define LCD_DMA_BURST_8				0x3
 #define LCD_DMA_BURST_16			0x4
 /* LCD Timing_0 Register */
-#define LCD_HBPLSB(x)				((((x)-1) & 0xFF) << 24)
-#define LCD_HFPLSB(x)				((((x)-1) & 0xFF) << 16)
-#define LCD_HSWLSB(x)				((((x)-1) & 0x3F) << 10)
-#define LCD_HORLSB(x)				(((((x) >> 4)-1) & 0x3F) << 4)
+#define LCD_HBPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 24)
+#define LCD_HFPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 16)
+#define LCD_HSWLSB(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
+#define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
 #define LCD_HORMSB(x)				(((((x) >> 4)-1) & 0x40) >> 4)
 /* LCD Timing_1 Register */
 #define LCD_VBP(x)				((x) << 24)
 #define LCD_VFP(x)				((x) << 16)
 #define LCD_VSW(x)				(((x)-1) << 10)
-#define LCD_VERLSB(x)				(((x)-1) & 0x3FF)
+#define LCD_VERLSB(x)				(((x) - 1) & GENMASK(9, 0))
 /* LCD Timing_2 Register */
-#define LCD_HSWMSB(x)				((((x)-1) & 0x3C0) << 21)
-#define LCD_VERMSB(x)				((((x)-1) & 0x400) << 16)
-#define LCD_HBPMSB(x)				((((x)-1) & 0x300) >> 4)
-#define LCD_HFPMSB(x)				((((x)-1) & 0x300) >> 8)
-#define LCD_INVMASK(x)				((x) & 0x3F00000)
+#define LCD_HSWMSB(x)			((((x) - 1) & GENMASK(9, 6)) << 21)
+#define LCD_VERMSB(x)				((((x) - 1) & BIT(10)) << 16)
+#define LCD_HBPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 4)
+#define LCD_HFPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 8)
+#define LCD_INVMASK(x)				((x) & GENMASK(25, 20))
 /* LCD Raster Ctrl Register */
-#define LCD_TFT_24BPP_MODE			(1 << 25)
-#define LCD_TFT_24BPP_UNPACK			(1 << 26)
+#define LCD_TFT_24BPP_MODE			BIT(25)
+#define LCD_TFT_24BPP_UNPACK			BIT(26)
 #define LCD_PALMODE_RAWDATA			(0x02 << 20)
-#define LCD_TFT_MODE				(0x01 << 7)
-#define LCD_RASTER_ENABLE			(0x01 << 0)
+#define LCD_TFT_MODE				BIT(7)
+#define LCD_RASTER_ENABLE			BIT(0)
 
 
 /* Macro definitions */
drivers/video/am335x-fb.h +6 -6
index f5883c02dd..ad9b015e09 100644
@@ -7,7 +7,7 @@
 #ifndef AM335X_FB_H
 #define AM335X_FB_H
 
-#define HSVS_CONTROL	(0x01 << 25)	/*
+#define HSVS_CONTROL		BIT(25)	/*
 					 * 0 = lcd_lp and lcd_fp are driven on
 					 * opposite edges of pixel clock than
 					 * the lcd_pixel_o
@@ -17,7 +17,7 @@
 					 * Matrix displays the edge timing is
 					 * fixed
 					 */
-#define HSVS_RISEFALL	(0x01 << 24)	/*
+#define HSVS_RISEFALL		BIT(24)	/*
 					 * 0 = lcd_lp and lcd_fp are driven on
 					 * the rising edge of pixel clock (bit
 					 * 25 must be set to 1)
@@ -25,19 +25,19 @@
 					 * the falling edge of pixel clock (bit
 					 * 25 must be set to 1)
 					 */
-#define DE_INVERT	(0x01 << 23)	/*
+#define DE_INVERT		BIT(23)	/*
 					 * 0 = DE is low-active
 					 * 1 = DE is high-active
 					 */
-#define PXCLK_INVERT	(0x01 << 22)	/*
+#define PXCLK_INVERT		BIT(22)	/*
 					 * 0 = pix-clk is high-active
 					 * 1 = pic-clk is low-active
 					 */
-#define HSYNC_INVERT	(0x01 << 21)	/*
+#define HSYNC_INVERT		BIT(21)	/*
 					 * 0 = HSYNC is active high
 					 * 1 = HSYNC is avtive low
 					 */
-#define VSYNC_INVERT	(0x01 << 20)	/*
+#define VSYNC_INVERT		BIT(20)	/*
 					 * 0 = VSYNC is active high
 					 * 1 = VSYNC is active low
 					 */
Signature · 1 line
2.24.0
#2 lore raw

PATCH v2 2/13 video: omap: add missing bitfield masks

In reply to Dario Binacchi

Add, if missing, the bitfield masks in the setting macros of the LCD controller registers.

- Use GENMASK macro

---

Changes in v2: None

 drivers/video/am335x-fb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/video/am335x-fb.c +5 -5
index 7065d57148..4fd3b7f65a 100644
@@ -26,14 +26,14 @@
 #define LCDC_FMAX				200000000
 
 /* LCD Control Register */
-#define LCD_CLK_DIVISOR(x)			((x) << 8)
+#define LCD_CLK_DIVISOR(x)			(((x) & GENMASK(7, 0)) << 8)
 #define LCD_RASTER_MODE				BIT(0)
 /* LCD Clock Enable Register */
 #define LCD_CORECLKEN				BIT(0)
 #define LCD_LIDDCLKEN				BIT(1)
 #define LCD_DMACLKEN				BIT(2)
 /* LCD DMA Control Register */
-#define LCD_DMA_BURST_SIZE(x)			((x) << 4)
+#define LCD_DMA_BURST_SIZE(x)			(((x) & GENMASK(2, 0)) << 4)
 #define LCD_DMA_BURST_1				0x0
 #define LCD_DMA_BURST_2				0x1
 #define LCD_DMA_BURST_4				0x2
@@ -46,9 +46,9 @@
 #define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
 #define LCD_HORMSB(x)				(((((x) >> 4)-1) & 0x40) >> 4)
 /* LCD Timing_1 Register */
-#define LCD_VBP(x)				((x) << 24)
-#define LCD_VFP(x)				((x) << 16)
-#define LCD_VSW(x)				(((x)-1) << 10)
+#define LCD_VBP(x)				(((x) & GENMASK(7, 0)) << 24)
+#define LCD_VFP(x)				(((x) & GENMASK(7, 0)) << 16)
+#define LCD_VSW(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
 #define LCD_VERLSB(x)				(((x) - 1) & GENMASK(9, 0))
 /* LCD Timing_2 Register */
 #define LCD_HSWMSB(x)			((((x) - 1) & GENMASK(9, 6)) << 21)
Signature · 1 line
2.24.0
#3 lore raw

PATCH v2 3/13 video: omap: fix coding style on use of spaces

In reply to Dario Binacchi

Use one space around (on each side of) the binary '-' operator.

---

Changes in v2: None

 drivers/video/am335x-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/am335x-fb.c +1 -1
index 4fd3b7f65a..92e37bd1e0 100644
@@ -44,7 +44,7 @@
 #define LCD_HFPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 16)
 #define LCD_HSWLSB(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
 #define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
-#define LCD_HORMSB(x)				(((((x) >> 4)-1) & 0x40) >> 4)
+#define LCD_HORMSB(x)				(((((x) >> 4) - 1) & 0x40) >> 4)
 /* LCD Timing_1 Register */
 #define LCD_VBP(x)				(((x) & GENMASK(7, 0)) << 24)
 #define LCD_VFP(x)				(((x) & GENMASK(7, 0)) << 16)
Signature · 1 line
2.24.0
#4 lore raw

PATCH v2 4/13 video: omap: fix bitfields order

In reply to Dario Binacchi

Arrange the bitfields of each register in the ascending order.

---

Changes in v2: None

 drivers/video/am335x-fb.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/video/am335x-fb.c +14 -15
index 92e37bd1e0..648ce508cc 100644
@@ -26,8 +26,8 @@
 #define LCDC_FMAX				200000000
 
 /* LCD Control Register */
-#define LCD_CLK_DIVISOR(x)			(((x) & GENMASK(7, 0)) << 8)
 #define LCD_RASTER_MODE				BIT(0)
+#define LCD_CLK_DIVISOR(x)			(((x) & GENMASK(7, 0)) << 8)
 /* LCD Clock Enable Register */
 #define LCD_CORECLKEN				BIT(0)
 #define LCD_LIDDCLKEN				BIT(1)
@@ -40,29 +40,28 @@
 #define LCD_DMA_BURST_8				0x3
 #define LCD_DMA_BURST_16			0x4
 /* LCD Timing_0 Register */
-#define LCD_HBPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 24)
-#define LCD_HFPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 16)
-#define LCD_HSWLSB(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
-#define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
 #define LCD_HORMSB(x)				(((((x) >> 4) - 1) & 0x40) >> 4)
+#define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
+#define LCD_HSWLSB(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
+#define LCD_HFPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 16)
+#define LCD_HBPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 24)
 /* LCD Timing_1 Register */
-#define LCD_VBP(x)				(((x) & GENMASK(7, 0)) << 24)
-#define LCD_VFP(x)				(((x) & GENMASK(7, 0)) << 16)
-#define LCD_VSW(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
 #define LCD_VERLSB(x)				(((x) - 1) & GENMASK(9, 0))
+#define LCD_VSW(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
+#define LCD_VFP(x)				(((x) & GENMASK(7, 0)) << 16)
+#define LCD_VBP(x)				(((x) & GENMASK(7, 0)) << 24)
 /* LCD Timing_2 Register */
-#define LCD_HSWMSB(x)			((((x) - 1) & GENMASK(9, 6)) << 21)
-#define LCD_VERMSB(x)				((((x) - 1) & BIT(10)) << 16)
-#define LCD_HBPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 4)
 #define LCD_HFPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 8)
+#define LCD_HBPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 4)
 #define LCD_INVMASK(x)				((x) & GENMASK(25, 20))
+#define LCD_VERMSB(x)				((((x) - 1) & BIT(10)) << 16)
+#define LCD_HSWMSB(x)			((((x) - 1) & GENMASK(9, 6)) << 21)
 /* LCD Raster Ctrl Register */
+#define LCD_RASTER_ENABLE			BIT(0)
+#define LCD_TFT_MODE				BIT(7)
+#define LCD_PALMODE_RAWDATA			(0x02 << 20)
 #define LCD_TFT_24BPP_MODE			BIT(25)
 #define LCD_TFT_24BPP_UNPACK			BIT(26)
-#define LCD_PALMODE_RAWDATA			(0x02 << 20)
-#define LCD_TFT_MODE				BIT(7)
-#define LCD_RASTER_ENABLE			BIT(0)
-
 
 /* Macro definitions */
 #define FBSIZE(x)	((x->hactive * x->vactive * x->bpp) >> 3)
Signature · 1 line
2.24.0
#5 lore raw

PATCH v2 5/13 video: omap: rename LCD controller registers

In reply to Dario Binacchi

Add more clarity by prefixing the name of the register to the bitfields.

---

Changes in v2: None

 drivers/video/am335x-fb.c | 107 +++++++++++++++++++-------------------
 1 file changed, 54 insertions(+), 53 deletions(-)
drivers/video/am335x-fb.c +54 -53
index 648ce508cc..9f488f656e 100644
@@ -26,42 +26,42 @@
 #define LCDC_FMAX				200000000
 
 /* LCD Control Register */
-#define LCD_RASTER_MODE				BIT(0)
-#define LCD_CLK_DIVISOR(x)			(((x) & GENMASK(7, 0)) << 8)
+#define LCDC_CTRL_RASTER_MODE			BIT(0)
+#define LCDC_CTRL_CLK_DIVISOR(x)		(((x) & GENMASK(7, 0)) << 8)
 /* LCD Clock Enable Register */
-#define LCD_CORECLKEN				BIT(0)
-#define LCD_LIDDCLKEN				BIT(1)
-#define LCD_DMACLKEN				BIT(2)
+#define LCDC_CLKC_ENABLE_CORECLKEN		BIT(0)
+#define LCDC_CLKC_ENABLE_LIDDCLKEN		BIT(1)
+#define LCDC_CLKC_ENABLE_DMACLKEN		BIT(2)
 /* LCD DMA Control Register */
-#define LCD_DMA_BURST_SIZE(x)			(((x) & GENMASK(2, 0)) << 4)
-#define LCD_DMA_BURST_1				0x0
-#define LCD_DMA_BURST_2				0x1
-#define LCD_DMA_BURST_4				0x2
-#define LCD_DMA_BURST_8				0x3
-#define LCD_DMA_BURST_16			0x4
+#define LCDC_DMA_CTRL_BURST_SIZE(x)		(((x) & GENMASK(2, 0)) << 4)
+#define LCDC_DMA_CTRL_BURST_1			0x0
+#define LCDC_DMA_CTRL_BURST_2			0x1
+#define LCDC_DMA_CTRL_BURST_4			0x2
+#define LCDC_DMA_CTRL_BURST_8			0x3
+#define LCDC_DMA_CTRL_BURST_16			0x4
 /* LCD Timing_0 Register */
-#define LCD_HORMSB(x)				(((((x) >> 4) - 1) & 0x40) >> 4)
-#define LCD_HORLSB(x)		(((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
-#define LCD_HSWLSB(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
-#define LCD_HFPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 16)
-#define LCD_HBPLSB(x)			((((x) - 1) & GENMASK(7, 0)) << 24)
+#define LCDC_RASTER_TIMING_0_HORMSB(x)		(((((x) >> 4) - 1) & 0x40) >> 4)
+#define LCDC_RASTER_TIMING_0_HORLSB(x) (((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
+#define LCDC_RASTER_TIMING_0_HSWLSB(x)	((((x) - 1) & GENMASK(5, 0)) << 10)
+#define LCDC_RASTER_TIMING_0_HFPLSB(x)	((((x) - 1) & GENMASK(7, 0)) << 16)
+#define LCDC_RASTER_TIMING_0_HBPLSB(x)	((((x) - 1) & GENMASK(7, 0)) << 24)
 /* LCD Timing_1 Register */
-#define LCD_VERLSB(x)				(((x) - 1) & GENMASK(9, 0))
-#define LCD_VSW(x)			((((x) - 1) & GENMASK(5, 0)) << 10)
-#define LCD_VFP(x)				(((x) & GENMASK(7, 0)) << 16)
-#define LCD_VBP(x)				(((x) & GENMASK(7, 0)) << 24)
+#define LCDC_RASTER_TIMING_1_VERLSB(x)		(((x) - 1) & GENMASK(9, 0))
+#define LCDC_RASTER_TIMING_1_VSW(x)	((((x) - 1) & GENMASK(5, 0)) << 10)
+#define LCDC_RASTER_TIMING_1_VFP(x)		(((x) & GENMASK(7, 0)) << 16)
+#define LCDC_RASTER_TIMING_1_VBP(x)		(((x) & GENMASK(7, 0)) << 24)
 /* LCD Timing_2 Register */
-#define LCD_HFPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 8)
-#define LCD_HBPMSB(x)			((((x) - 1) & GENMASK(9, 8)) >> 4)
-#define LCD_INVMASK(x)				((x) & GENMASK(25, 20))
-#define LCD_VERMSB(x)				((((x) - 1) & BIT(10)) << 16)
-#define LCD_HSWMSB(x)			((((x) - 1) & GENMASK(9, 6)) << 21)
+#define LCDC_RASTER_TIMING_2_HFPMSB(x)	((((x) - 1) & GENMASK(9, 8)) >> 8)
+#define LCDC_RASTER_TIMING_2_HBPMSB(x)	((((x) - 1) & GENMASK(9, 8)) >> 4)
+#define LCDC_RASTER_TIMING_2_INVMASK(x)		((x) & GENMASK(25, 20))
+#define LCDC_RASTER_TIMING_2_VERMSB(x)		((((x) - 1) & BIT(10)) << 16)
+#define LCDC_RASTER_TIMING_2_HSWMSB(x)	((((x) - 1) & GENMASK(9, 6)) << 21)
 /* LCD Raster Ctrl Register */
-#define LCD_RASTER_ENABLE			BIT(0)
-#define LCD_TFT_MODE				BIT(7)
-#define LCD_PALMODE_RAWDATA			(0x02 << 20)
-#define LCD_TFT_24BPP_MODE			BIT(25)
-#define LCD_TFT_24BPP_UNPACK			BIT(26)
+#define LCDC_RASTER_CTRL_ENABLE			BIT(0)
+#define LCDC_RASTER_CTRL_TFT_MODE		BIT(7)
+#define LCDC_RASTER_CTRL_PALMODE_RAWDATA	(0x02 << 20)
+#define LCDC_RASTER_CTRL_TFT_24BPP_MODE		BIT(25)
+#define LCDC_RASTER_CTRL_TFT_24BPP_UNPACK	BIT(26)
 
 /* Macro definitions */
 #define FBSIZE(x)	((x->hactive * x->vactive * x->bpp) >> 3)
@@ -131,10 +131,10 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 	case 16:
 		break;
 	case 32:
-		raster_ctrl |= LCD_TFT_24BPP_UNPACK;
+		raster_ctrl |= LCDC_RASTER_CTRL_TFT_24BPP_UNPACK;
 		/* fallthrough */
 	case 24:
-		raster_ctrl |= LCD_TFT_24BPP_MODE;
+		raster_ctrl |= LCDC_RASTER_CTRL_TFT_24BPP_MODE;
 		break;
 	default:
 		pr_err("am335x-fb: invalid bpp value: %d\n", panel->bpp);
@@ -198,34 +198,35 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 
 	debug("am335x-fb: wait for stable power ...\n");
 	mdelay(panel->pup_delay);
-	lcdhw->clkc_enable = LCD_CORECLKEN | LCD_LIDDCLKEN | LCD_DMACLKEN;
+	lcdhw->clkc_enable = LCDC_CLKC_ENABLE_CORECLKEN |
+		LCDC_CLKC_ENABLE_LIDDCLKEN | LCDC_CLKC_ENABLE_DMACLKEN;
 	lcdhw->raster_ctrl = 0;
-	lcdhw->ctrl = LCD_CLK_DIVISOR(best_d) | LCD_RASTER_MODE;
+	lcdhw->ctrl = LCDC_CTRL_CLK_DIVISOR(best_d) | LCDC_CTRL_RASTER_MODE;
 	lcdhw->lcddma_fb0_base = gd->fb_base;
 	lcdhw->lcddma_fb0_ceiling = gd->fb_base + FBSIZE(panel);
 	lcdhw->lcddma_fb1_base = gd->fb_base;
 	lcdhw->lcddma_fb1_ceiling = gd->fb_base + FBSIZE(panel);
-	lcdhw->lcddma_ctrl = LCD_DMA_BURST_SIZE(LCD_DMA_BURST_16);
-
-	lcdhw->raster_timing0 = LCD_HORLSB(panel->hactive) |
-				LCD_HORMSB(panel->hactive) |
-				LCD_HFPLSB(panel->hfp) |
-				LCD_HBPLSB(panel->hbp) |
-				LCD_HSWLSB(panel->hsw);
-	lcdhw->raster_timing1 = LCD_VBP(panel->vbp) |
-				LCD_VFP(panel->vfp) |
-				LCD_VSW(panel->vsw) |
-				LCD_VERLSB(panel->vactive);
-	lcdhw->raster_timing2 = LCD_HSWMSB(panel->hsw) |
-				LCD_VERMSB(panel->vactive) |
-				LCD_INVMASK(panel->pol) |
-				LCD_HBPMSB(panel->hbp) |
-				LCD_HFPMSB(panel->hfp) |
+	lcdhw->lcddma_ctrl = LCDC_DMA_CTRL_BURST_SIZE(LCDC_DMA_CTRL_BURST_16);
+
+	lcdhw->raster_timing0 = LCDC_RASTER_TIMING_0_HORLSB(panel->hactive) |
+				LCDC_RASTER_TIMING_0_HORMSB(panel->hactive) |
+				LCDC_RASTER_TIMING_0_HFPLSB(panel->hfp) |
+				LCDC_RASTER_TIMING_0_HBPLSB(panel->hbp) |
+				LCDC_RASTER_TIMING_0_HSWLSB(panel->hsw);
+	lcdhw->raster_timing1 = LCDC_RASTER_TIMING_1_VBP(panel->vbp) |
+				LCDC_RASTER_TIMING_1_VFP(panel->vfp) |
+				LCDC_RASTER_TIMING_1_VSW(panel->vsw) |
+				LCDC_RASTER_TIMING_1_VERLSB(panel->vactive);
+	lcdhw->raster_timing2 = LCDC_RASTER_TIMING_2_HSWMSB(panel->hsw) |
+				LCDC_RASTER_TIMING_2_VERMSB(panel->vactive) |
+				LCDC_RASTER_TIMING_2_INVMASK(panel->pol) |
+				LCDC_RASTER_TIMING_2_HBPMSB(panel->hbp) |
+				LCDC_RASTER_TIMING_2_HFPMSB(panel->hfp) |
 				0x0000FF00;	/* clk cycles for ac-bias */
 	lcdhw->raster_ctrl =	raster_ctrl |
-				LCD_PALMODE_RAWDATA |
-				LCD_TFT_MODE |
-				LCD_RASTER_ENABLE;
+				LCDC_RASTER_CTRL_PALMODE_RAWDATA |
+				LCDC_RASTER_CTRL_TFT_MODE |
+				LCDC_RASTER_CTRL_ENABLE;
 
 	debug("am335x-fb: waiting picture to be stable.\n.");
 	mdelay(panel->pon_delay);
Signature · 1 line
2.24.0
#6 lore raw

PATCH v2 6/13 video: omap: fix debug message

In reply to Dario Binacchi

"DISP" -> "DIV"

---

Changes in v2: None

 drivers/video/am335x-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/am335x-fb.c +1 -1
index 9f488f656e..bbe965af84 100644
@@ -179,7 +179,7 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 			}
 		}
 	}
-	debug("%s: PLL: best error %d Hz (M %d, N %d, DISP %d)\n",
+	debug("%s: PLL: best error %d Hz (M %d, N %d, DIV %d)\n",
 	      __func__, err_r, dpll_disp.m, dpll_disp.n, best_d);
 	do_setup_dpll(&dpll_disp_regs, &dpll_disp);
 
Signature · 1 line
2.24.0
#7 lore raw

PATCH v2 7/13 video: omap: add loop exit conditions to the dpll setup

In reply to Dario Binacchi

In case of null error, round rate is equal to target rate, so it is useless to continue to search the DPLL setup parameters to get the desidered pixel clock rate.

---

Changes in v2: None

 drivers/video/am335x-fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/am335x-fb.c +3 -1
index bbe965af84..684223f275 100644
@@ -160,7 +160,7 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 	err = panel->pxl_clk;
 	err_r = err;
 
-	for (d = 2; d < 255; d++) {
+	for (d = 2; err_r && d < 255; d++) {
 		for (m = 2; m < 2047; m++) {
 			if ((V_OSCK * m) < (panel->pxl_clk * d))
 				continue;
@@ -176,6 +176,8 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 				dpll_disp.m = m;
 				dpll_disp.n = n;
 				best_d = d;
+				if (err_r == 0)
+					break;
 			}
 		}
 	}
Signature · 1 line
2.24.0
#8 lore raw

PATCH v2 8/13 video: omap: create two routines to set the pixel clock rate

In reply to Dario Binacchi

Created in preparation to support driver-model, they can also be called from legacy code. In this way, code duplication is avoided.

- Use GENMASK macro for clock divisor mask

---

Changes in v2: None

 drivers/video/am335x-fb.c | 130 ++++++++++++++++++++++++++++----------
 1 file changed, 97 insertions(+), 33 deletions(-)
drivers/video/am335x-fb.c +97 -33
index 684223f275..c426ff8aec 100644
@@ -16,6 +16,7 @@
 #include <asm/arch/omap.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/err.h>
 #include <lcd.h>
 #include "am335x-fb.h"
 
@@ -26,6 +27,7 @@
 #define LCDC_FMAX				200000000
 
 /* LCD Control Register */
+#define LCDC_CTRL_CLK_DIVISOR_MASK		GENMASK(15, 8)
 #define LCDC_CTRL_RASTER_MODE			BIT(0)
 #define LCDC_CTRL_CLK_DIVISOR(x)		(((x) & GENMASK(7, 0)) << 8)
 /* LCD Clock Enable Register */
@@ -98,10 +100,95 @@ struct am335x_lcdhw {
 	unsigned int		clkc_reset;		/* 0x70 */
 };
 
+struct dpll_data {
+	unsigned long rounded_rate;
+	u16 rounded_m;
+	u8 rounded_n;
+	u8 rounded_div;
+};
+
 static struct am335x_lcdhw *lcdhw = (void *)LCD_CNTL_BASE;
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/**
+ * am335x_dpll_round_rate() - Round a target rate for an OMAP DPLL
+ *
+ * @dpll_data: struct dpll_data pointer for the DPLL
+ * @rate:      New DPLL clock rate
+ * @return rounded rate and the computed m, n and div values in the dpll_data
+ *         structure, or -ve error code.
+ */
+static ulong am335x_dpll_round_rate(struct dpll_data *dd, ulong rate)
+{
+	unsigned int m, n, d;
+	unsigned long rounded_rate;
+	int err, err_r;
+
+	dd->rounded_rate = -EFAULT;
+	err = rate;
+	err_r = err;
+
+	for (d = 2; err && d < 255; d++) {
+		for (m = 2; m < 2047; m++) {
+			if ((V_OSCK * m) < (rate * d))
+				continue;
+
+			n = (V_OSCK * m) / (rate * d);
+			if (n > 127)
+				break;
+
+			if (((V_OSCK * m) / n) > LCDC_FMAX)
+				break;
+
+			rounded_rate = (V_OSCK * m) / n / d;
+			err = abs(rounded_rate - rate);
+			if (err < err_r) {
+				err_r = err;
+				dd->rounded_rate = rounded_rate;
+				dd->rounded_m = m;
+				dd->rounded_n = n;
+				dd->rounded_div = d;
+				if (err == 0)
+					break;
+			}
+		}
+	}
+
+	debug("DPLL display: best error %d Hz (M %d, N %d, DIV %d)\n",
+	      err_r, dd->rounded_m, dd->rounded_n, dd->rounded_div);
+
+	return dd->rounded_rate;
+}
+
+/**
+ * am335x_fb_set_pixel_clk_rate() - Set pixel clock rate.
+ *
+ * @am335x_lcdhw: Base address of the LCD controller registers.
+ * @rate:         New clock rate in Hz.
+ * @return new rate, or -ve error code.
+ */
+static ulong am335x_fb_set_pixel_clk_rate(struct am335x_lcdhw *regs, ulong rate)
+{
+	struct dpll_params dpll_disp = { 1, 0, 1, -1, -1, -1, -1 };
+	struct dpll_data dd;
+	ulong round_rate;
+	u32 reg;
+
+	round_rate = am335x_dpll_round_rate(&dd, rate);
+	if (IS_ERR_VALUE(round_rate))
+		return round_rate;
+
+	dpll_disp.m = dd.rounded_m;
+	dpll_disp.n = dd.rounded_n;
+	do_setup_dpll(&dpll_disp_regs, &dpll_disp);
+
+	reg = readl(&regs->ctrl) & ~LCDC_CTRL_CLK_DIVISOR_MASK;
+	reg |= LCDC_CTRL_CLK_DIVISOR(dd.rounded_div);
+	writel(reg, &regs->ctrl);
+	return round_rate;
+}
+
 int lcd_get_size(int *line_length)
 {
 	*line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
@@ -111,11 +198,9 @@ int lcd_get_size(int *line_length)
 int am335xfb_init(struct am335x_lcdpanel *panel)
 {
 	u32 raster_ctrl = 0;
-
 	struct cm_dpll *const cmdpll = (struct cm_dpll *)CM_DPLL;
-	struct dpll_params dpll_disp = { 1, 0, 1, -1, -1, -1, -1 };
-	unsigned int m, n, d, best_d = 2;
-	int err = 0, err_r = 0;
+	ulong rate;
+	u32 reg;
 
 	if (gd->fb_base == 0) {
 		printf("ERROR: no valid fb_base stored in GLOBAL_DATA_PTR!\n");
@@ -156,34 +241,9 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 	debug("using frambuffer at 0x%08x with size %d.\n",
 	      (unsigned int)gd->fb_base, FBSIZE(panel));
 
-	/* setup display pll for requested clock frequency */
-	err = panel->pxl_clk;
-	err_r = err;
-
-	for (d = 2; err_r && d < 255; d++) {
-		for (m = 2; m < 2047; m++) {
-			if ((V_OSCK * m) < (panel->pxl_clk * d))
-				continue;
-			n = (V_OSCK * m) / (panel->pxl_clk * d);
-			if (n > 127)
-				break;
-			if (((V_OSCK * m) / n) > LCDC_FMAX)
-				break;
-
-			err = abs((V_OSCK * m) / n / d - panel->pxl_clk);
-			if (err < err_r) {
-				err_r = err;
-				dpll_disp.m = m;
-				dpll_disp.n = n;
-				best_d = d;
-				if (err_r == 0)
-					break;
-			}
-		}
-	}
-	debug("%s: PLL: best error %d Hz (M %d, N %d, DIV %d)\n",
-	      __func__, err_r, dpll_disp.m, dpll_disp.n, best_d);
-	do_setup_dpll(&dpll_disp_regs, &dpll_disp);
+	rate = am335x_fb_set_pixel_clk_rate(lcdhw, panel->pxl_clk);
+	if (IS_ERR_VALUE(rate))
+		return rate;
 
 	/* clock source for LCDC from dispPLL M2 */
 	writel(0x0, &cmdpll->clklcdcpixelclk);
@@ -203,7 +263,11 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 	lcdhw->clkc_enable = LCDC_CLKC_ENABLE_CORECLKEN |
 		LCDC_CLKC_ENABLE_LIDDCLKEN | LCDC_CLKC_ENABLE_DMACLKEN;
 	lcdhw->raster_ctrl = 0;
-	lcdhw->ctrl = LCDC_CTRL_CLK_DIVISOR(best_d) | LCDC_CTRL_RASTER_MODE;
+
+	reg = lcdhw->ctrl & LCDC_CTRL_CLK_DIVISOR_MASK;
+	reg |= LCDC_CTRL_RASTER_MODE;
+	lcdhw->ctrl = reg;
+
 	lcdhw->lcddma_fb0_base = gd->fb_base;
 	lcdhw->lcddma_fb0_ceiling = gd->fb_base + FBSIZE(panel);
 	lcdhw->lcddma_fb1_base = gd->fb_base;
Signature · 1 line
2.24.0
#9 lore raw

PATCH v2 9/13 video: omap: add support for DM/DTS

In reply to Dario Binacchi

Update the driver to support the device tree and the driver model. Timings and panel parameters are now loaded from the device tree.

The DM code replaces the am335x_lcdpanel structure with tilcdc_panel_info taken from the linux kernel, as well the management of additional parameters not covered in the legacy code. In addition, the am335x_lcdpanel structure contains parameters and operations that were probably a requirement of the board for which this driver was developed and which, however, were not developed in the linux kernel. All this led to rewrite th DM controller initialization code, except for the pixel clock setting that is executed in a function created in a previous patch with code taken from the legacy am335xfb_init.

The patch has been tested on a custom board with u-boot 2018.11-rc2 and the following device-tree configuration:

	panel {
		compatible = "ti,tilcdc,panel";
		pinctrl-names = "default";
		pinctrl-0 = <&lcd_enable_pins>;
		enable-gpios = <&gpio0 31 0>;
		backlight = <&backlight>;
		status = "okay";
		u-boot,dm-pre-reloc;
		panel-info {
			ac-bias           = <255>;
			ac-bias-intrpt    = <0>;
			dma-burst-sz      = <16>;
			bpp               = <16>;
			fdd               = <0x80>;
			sync-edge         = <0>;
			sync-ctrl         = <1>;
			raster-order      = <0>;
			fifo-th           = <0>;
		};
		display-timings {
			native-mode = <&timing0>;
			timing0: 800x480 {
				hactive         = <800>;
				vactive         = <480>;
				hback-porch     = <46>;
				hfront-porch    = <210>;
				hsync-len       = <20>;
				vback-porch     = <23>;
				vfront-porch    = <22>;
				vsync-len       = <10>;
				clock-frequency = <33000000>;
				hsync-active    = <0>;
				vsync-active    = <0>;
			};
		};
	};

- Move clock enabling sequence to arch/arm/mach-omap2/
- Create a Kconfig symbol for CONFIG_AM335X_LCD

---

Changes in v2: None

 arch/arm/mach-omap2/am33xx/clock_am33xx.c |   4 +
 drivers/video/Kconfig                     |   6 +
 drivers/video/am335x-fb.c                 | 337 +++++++++++++++++++++-
 drivers/video/am335x-fb.h                 |   4 +
 4 files changed, 341 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/am33xx/clock_am33xx.c +4 -0
index f2cd496607..2427933c8b 100644
@@ -226,6 +226,10 @@ void enable_basic_clocks(void)
 		&cmper->usb0clkctrl,
 		&cmper->emiffwclkctrl,
 		&cmper->emifclkctrl,
+#if CONFIG_IS_ENABLED(AM335X_LCD)
+		&cmper->lcdclkctrl,
+		&cmper->lcdcclkstctrl,
+#endif
 		0
 	};
 
drivers/video/Kconfig +6 -0
index 4c93369702..7c5012a67f 100644
@@ -473,6 +473,12 @@ config ATMEL_HLCD
 	help
 	   HLCDC supports video output to an attached LCD panel.
 
+config AM335X_LCD
+	bool "Enable AM335x video support"
+	depends on DM_VIDEO
+	help
+	   Supports video output to an attached LCD panel.
+
 config LOGICORE_DP_TX
 	bool "Enable Logicore DP TX driver"
 	depends on DISPLAY
drivers/video/am335x-fb.c +327 -10

394 lines not on this page · raw message

drivers/video/am335x-fb.h +4 -0
index ad9b015e09..c9f92bc389 100644
@@ -7,6 +7,8 @@
 #ifndef AM335X_FB_H
 #define AM335X_FB_H
 
+#if !CONFIG_IS_ENABLED(DM_VIDEO)
+
 #define HSVS_CONTROL		BIT(25)	/*
 					 * 0 = lcd_lp and lcd_fp are driven on
 					 * opposite edges of pixel clock than
@@ -68,4 +70,6 @@ struct am335x_lcdpanel {
 
 int am335xfb_init(struct am335x_lcdpanel *panel);
 
+#endif  /* CONFIG_DM_VIDEO */
+
 #endif  /* AM335X_FB_H */
Signature · 1 line
2.24.0
#10 lore raw

PATCH v2 10/13 arm: dts: am335x: add 'u-boot, dm-pre-reloc' to panel

In reply to Dario Binacchi

Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel" compatible node. In this way the video-uclass module can allocate the amount of memory needed to be assigned to the frame buffer. In the case of the boards that support Linux, the addition of the property in the *-u-boot.dtsi file still required changing its dts file adding a label to the panel node in order to be referenced.

- Change subject line in: arm: dts: am335x:
- Move 'u-boot,dm-pre-reloc' property in *-u-boot.dtsi files for boards tha support Linux
- Ran building tests with CONFIG_AM335X_LCD enabled and disabled for following configurations:

    - brxre1_defconfig           --> success
    - am335x_guardian_defconfig  --> success
    - am335x_evm_defconfig       --> success
    - da850evm_defconfig         --> failure with CONFIG_AM335X_LCD enabled

Enabling CONFIG_AM335X_LCD causes building errors even without applying the patch. The driver has never been enabled on the da850 and must be adapted for this platform.

---

Changes in v2: None

 arch/arm/dts/am335x-brppt1-mmc.dts       |  2 ++
 arch/arm/dts/am335x-brppt1-nand.dts      |  2 ++
 arch/arm/dts/am335x-brppt1-spi.dts       |  2 ++
 arch/arm/dts/am335x-brsmarc1.dts         |  1 +
 arch/arm/dts/am335x-brxre1.dts           |  2 ++
 arch/arm/dts/am335x-evm-u-boot.dtsi      |  4 ++++
 arch/arm/dts/am335x-evm.dts              |  2 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-evmsk.dts            |  2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi |  4 ++++
 arch/arm/dts/am335x-guardian.dts         |  2 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi   |  4 ++++
 arch/arm/dts/am335x-pdu001.dts           |  2 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-pxm50.dts            |  2 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi      | 10 ++++++++++
 arch/arm/dts/am335x-rut.dts              |  2 +-
 arch/arm/dts/da850-evm-u-boot.dtsi       |  4 ++++
 arch/arm/dts/da850-evm.dts               |  2 +-
 19 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/am335x-evmsk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-pxm50-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-rut-u-boot.dtsi
arch/arm/dts/am335x-brppt1-mmc.dts +2 -0
index 9be34d9da0..6f919711f0 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-nand.dts +2 -0
index 11bd5c551c..9d4340f591 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-spi.dts +2 -0
index 01ab74be5e..c078af8fba 100644
@@ -54,6 +54,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brsmarc1.dts +1 -0
index a63fc2da22..7e9516e8f8 100644
@@ -59,6 +59,7 @@
 		/*backlight = <&tps_bl>; */
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
+		u-boot,dm-pre-reloc;
 
 		panel-info {
 			ac-bias		= <255>;
arch/arm/dts/am335x-brxre1.dts +2 -0
index 33d8ab78d8..6091a12fb7 100644
@@ -79,6 +79,8 @@
 
 		backlight = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-evm-u-boot.dtsi +4 -0
index b6b97ed16d..fc0250bd24 100644
@@ -8,6 +8,10 @@
 	status = "disabled";
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &usb0 {
 	dr_mode = "peripheral";
 };
arch/arm/dts/am335x-evm.dts +1 -1
index 0bda4d4429..4aa8c78003 100644
@@ -104,7 +104,7 @@
 		default-brightness-level = <8>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-evmsk-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..1105ec471f
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-evmsk U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-evmsk.dts +1 -1
index 5762967cf7..1fff1095c9 100644
@@ -166,7 +166,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default>;
arch/arm/dts/am335x-guardian-u-boot.dtsi +4 -0
index 156b9b0e83..77d6e90598 100644
@@ -22,6 +22,10 @@
 	u-boot,dm-pre-reloc;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &rtc {
 	clocks = <&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>;
 	clock-names = "int-clk";
arch/arm/dts/am335x-guardian.dts +1 -1
index 5ed2133e78..bd3c890a37 100644
@@ -62,7 +62,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default &lcd_disen_pins>;
arch/arm/dts/am335x-pdu001-u-boot.dtsi +4 -0
index 84a07bdef4..301959a361 100644
@@ -44,3 +44,7 @@
 &mmc2_pins {
 	u-boot,dm-pre-reloc;
 };
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pdu001.dts +1 -1
index ae43d61f4e..c7f512852e 100644
@@ -49,7 +49,7 @@
 		regulator-boot-on;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-pxm50-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..f69fd384ac
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-pxm50 U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pxm50.dts +1 -1
index f4e66d29d5..dcd3f6732f 100644
@@ -16,7 +16,7 @@
 	model = "PXM2/PXM50";
 	compatible = "ti,am335x-evm", "ti,am33xx";
 
-		panel {
+		panel: panel {
 			compatible = "ti,tilcdc,panel";
 			backlight = <&backlight0>;
 			pinctrl-names = "default";
arch/arm/dts/am335x-rut-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..b351eba6ee
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-rut U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-rut.dts +1 -1
index 145247344f..0278bb4dcd 100644
@@ -86,7 +86,7 @@
 		reg = <0x80000000 0x10000000>; /* 256 MB */
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins_s0>;
arch/arm/dts/da850-evm-u-boot.dtsi +4 -0
index aa42d30c72..a3c9ab19b9 100644
@@ -28,6 +28,10 @@
 	u-boot,dm-spl;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &serial2 {
 	u-boot,dm-spl;
 };
arch/arm/dts/da850-evm.dts +1 -1
index f04bc3e153..b1b1158411 100644
@@ -42,7 +42,7 @@
 		default-brightness-level = <7>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins>;
Signature · 1 line
2.24.0
#11 lore raw

PATCH v2 10/13 arm: dts: am335x: add 'u-boot, dm-pre-reloc' to panel

Quoted 15 lines · Dario Binacchi

Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel" compatible node. In this way the video-uclass module can allocate the amount of memory needed to be assigned to the frame buffer. In the case of the boards that support Linux, the addition of the property in the *-u-boot.dtsi file still required changing its dts file adding a label to the panel node in order to be referenced.

- Change subject line in: arm: dts: am335x:
- Move 'u-boot,dm-pre-reloc' property in *-u-boot.dtsi files for boards tha support Linux
- Ran building tests with CONFIG_AM335X_LCD enabled and disabled for following configurations:

Quoted 9 lines
    - brxre1_defconfig           --> success
    - am335x_guardian_defconfig  --> success
    - am335x_evm_defconfig       --> success
    - da850evm_defconfig         --> failure with CONFIG_AM335X_LCD enabled

Enabling CONFIG_AM335X_LCD causes building errors even without applying the patch. The driver has never been enabled on the da850 and must be adapted for this platform.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200216/f6e4a29b/attachment.sig>
#12 lore raw

PATCH v2 10/13 arm: dts: am335x: add 'u-boot,dm-pre-reloc' to panel

In reply to Dario Binacchi
Quoted 218 lines · Dario Binacchi

Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel" compatible node. In this way the video-uclass module can allocate the amount of memory needed to be assigned to the frame buffer. In the case of the boards that support Linux, the addition of the property in the *-u-boot.dtsi file still required changing its dts file adding a label to the panel node in order to be referenced.

- Change subject line in: arm: dts: am335x:
- Move 'u-boot,dm-pre-reloc' property in *-u-boot.dtsi files for boards tha support Linux
- Ran building tests with CONFIG_AM335X_LCD enabled and disabled for following configurations:

    - brxre1_defconfig           --> success
    - am335x_guardian_defconfig  --> success
    - am335x_evm_defconfig       --> success
    - da850evm_defconfig         --> failure with CONFIG_AM335X_LCD enabled

Enabling CONFIG_AM335X_LCD causes building errors even without applying the patch. The driver has never been enabled on the da850 and must be adapted for this platform.

---

Changes in v2: None

 arch/arm/dts/am335x-brppt1-mmc.dts       |  2 ++
 arch/arm/dts/am335x-brppt1-nand.dts      |  2 ++
 arch/arm/dts/am335x-brppt1-spi.dts       |  2 ++
 arch/arm/dts/am335x-brsmarc1.dts         |  1 +
 arch/arm/dts/am335x-brxre1.dts           |  2 ++
 arch/arm/dts/am335x-evm-u-boot.dtsi      |  4 ++++
 arch/arm/dts/am335x-evm.dts              |  2 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-evmsk.dts            |  2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi |  4 ++++
 arch/arm/dts/am335x-guardian.dts         |  2 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi   |  4 ++++
 arch/arm/dts/am335x-pdu001.dts           |  2 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-pxm50.dts            |  2 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi      | 10 ++++++++++
 arch/arm/dts/am335x-rut.dts              |  2 +-
 arch/arm/dts/da850-evm-u-boot.dtsi       |  4 ++++
 arch/arm/dts/da850-evm.dts               |  2 +-
 19 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/am335x-evmsk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-pxm50-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-rut-u-boot.dtsi
arch/arm/dts/am335x-brppt1-mmc.dts +2 -0
index 9be34d9da0..6f919711f0 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-nand.dts +2 -0
index 11bd5c551c..9d4340f591 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-spi.dts +2 -0
index 01ab74be5e..c078af8fba 100644
@@ -54,6 +54,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brsmarc1.dts +1 -0
index a63fc2da22..7e9516e8f8 100644
@@ -59,6 +59,7 @@
 		/*backlight = <&tps_bl>; */
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
+		u-boot,dm-pre-reloc;
 
 		panel-info {
 			ac-bias		= <255>;
arch/arm/dts/am335x-brxre1.dts +2 -0
index 33d8ab78d8..6091a12fb7 100644
@@ -79,6 +79,8 @@
 
 		backlight = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-evm-u-boot.dtsi +4 -0
index b6b97ed16d..fc0250bd24 100644
@@ -8,6 +8,10 @@
 	status = "disabled";
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &usb0 {
 	dr_mode = "peripheral";
 };
arch/arm/dts/am335x-evm.dts +1 -1
index 0bda4d4429..4aa8c78003 100644
@@ -104,7 +104,7 @@
 		default-brightness-level = <8>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-evmsk-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..1105ec471f
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-evmsk U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-evmsk.dts +1 -1
index 5762967cf7..1fff1095c9 100644
@@ -166,7 +166,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default>;
arch/arm/dts/am335x-guardian-u-boot.dtsi +4 -0
index 156b9b0e83..77d6e90598 100644
@@ -22,6 +22,10 @@
 	u-boot,dm-pre-reloc;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &rtc {
 	clocks = <&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>;
 	clock-names = "int-clk";
arch/arm/dts/am335x-guardian.dts +1 -1
index 5ed2133e78..bd3c890a37 100644
@@ -62,7 +62,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default &lcd_disen_pins>;
arch/arm/dts/am335x-pdu001-u-boot.dtsi +4 -0
index 84a07bdef4..301959a361 100644
@@ -44,3 +44,7 @@
 &mmc2_pins {
 	u-boot,dm-pre-reloc;
 };
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pdu001.dts +0 -0
index ae43d61f4e..c7f512852e 100644

arch/arm/dts/am335x-pdu001.dts line 52

Quoted 5 lines
arch/arm/dts/am335x-pdu001.dts +1 -1
@@ -49,7 +49,7 @@
 		regulator-boot-on;
 	};
 
-	panel {
+	panel: panel {

This introduces another difference between the LINUX and and the U-Boot DTS file. Not sure but instead of referencing a label can't we use this in the *-u-boot.dtsi?

/ {
	panel {
		u-boot,dm-pre-reloc;
		};
	};
Quoted 82 lines
arch/arm/dts/am335x-pdu001.dts +0 -0
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-pxm50-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..f69fd384ac
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-pxm50 U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pxm50.dts +1 -1
index f4e66d29d5..dcd3f6732f 100644
@@ -16,7 +16,7 @@
 	model = "PXM2/PXM50";
 	compatible = "ti,am335x-evm", "ti,am33xx";
 
-		panel {
+		panel: panel {
 			compatible = "ti,tilcdc,panel";
 			backlight = <&backlight0>;
 			pinctrl-names = "default";
arch/arm/dts/am335x-rut-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..b351eba6ee
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-rut U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-rut.dts +1 -1
index 145247344f..0278bb4dcd 100644
@@ -86,7 +86,7 @@
 		reg = <0x80000000 0x10000000>; /* 256 MB */
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins_s0>;
arch/arm/dts/da850-evm-u-boot.dtsi +4 -0
index aa42d30c72..a3c9ab19b9 100644
@@ -28,6 +28,10 @@
 	u-boot,dm-spl;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &serial2 {
 	u-boot,dm-spl;
 };
arch/arm/dts/da850-evm.dts +0 -0
index f04bc3e153..b1b1158411 100644

arch/arm/dts/da850-evm.dts line 48

Quoted 8 lines
arch/arm/dts/da850-evm.dts +1 -1
@@ -42,7 +42,7 @@
 		default-brightness-level = <7>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins>;

--
Felix

#13 lore raw

PATCH v2 10/13 arm: dts: am335x: add 'u-boot,dm-pre-reloc' to panel

Quoted 234 lines

Il 17 febbraio 2020 alle 11.56 Felix Brack <[email protected]> ha scritto:

Quoted 218 lines · Dario Binacchi

Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel" compatible node. In this way the video-uclass module can allocate the amount of memory needed to be assigned to the frame buffer. In the case of the boards that support Linux, the addition of the property in the *-u-boot.dtsi file still required changing its dts file adding a label to the panel node in order to be referenced.

- Change subject line in: arm: dts: am335x:
- Move 'u-boot,dm-pre-reloc' property in *-u-boot.dtsi files for boards tha support Linux
- Ran building tests with CONFIG_AM335X_LCD enabled and disabled for following configurations:

    - brxre1_defconfig           --> success
    - am335x_guardian_defconfig  --> success
    - am335x_evm_defconfig       --> success
    - da850evm_defconfig         --> failure with CONFIG_AM335X_LCD enabled

Enabling CONFIG_AM335X_LCD causes building errors even without applying the patch. The driver has never been enabled on the da850 and must be adapted for this platform.

---

Changes in v2: None

 arch/arm/dts/am335x-brppt1-mmc.dts       |  2 ++
 arch/arm/dts/am335x-brppt1-nand.dts      |  2 ++
 arch/arm/dts/am335x-brppt1-spi.dts       |  2 ++
 arch/arm/dts/am335x-brsmarc1.dts         |  1 +
 arch/arm/dts/am335x-brxre1.dts           |  2 ++
 arch/arm/dts/am335x-evm-u-boot.dtsi      |  4 ++++
 arch/arm/dts/am335x-evm.dts              |  2 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-evmsk.dts            |  2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi |  4 ++++
 arch/arm/dts/am335x-guardian.dts         |  2 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi   |  4 ++++
 arch/arm/dts/am335x-pdu001.dts           |  2 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi    | 10 ++++++++++
 arch/arm/dts/am335x-pxm50.dts            |  2 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi      | 10 ++++++++++
 arch/arm/dts/am335x-rut.dts              |  2 +-
 arch/arm/dts/da850-evm-u-boot.dtsi       |  4 ++++
 arch/arm/dts/da850-evm.dts               |  2 +-
 19 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/am335x-evmsk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-pxm50-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-rut-u-boot.dtsi
arch/arm/dts/am335x-brppt1-mmc.dts +2 -0
index 9be34d9da0..6f919711f0 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-nand.dts +2 -0
index 11bd5c551c..9d4340f591 100644
@@ -53,6 +53,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brppt1-spi.dts +2 -0
index 01ab74be5e..c078af8fba 100644
@@ -54,6 +54,8 @@
 		bkl-pwm = <&pwmbacklight>;
 		bkl-tps = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-brsmarc1.dts +1 -0
index a63fc2da22..7e9516e8f8 100644
@@ -59,6 +59,7 @@
 		/*backlight = <&tps_bl>; */
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
+		u-boot,dm-pre-reloc;
 
 		panel-info {
 			ac-bias		= <255>;
arch/arm/dts/am335x-brxre1.dts +2 -0
index 33d8ab78d8..6091a12fb7 100644
@@ -79,6 +79,8 @@
 
 		backlight = <&tps_bl>;
 
+		u-boot,dm-pre-reloc;
+
 		panel-info {
 			ac-bias		= <255>;
 			ac-bias-intrpt	= <0>;
arch/arm/dts/am335x-evm-u-boot.dtsi +4 -0
index b6b97ed16d..fc0250bd24 100644
@@ -8,6 +8,10 @@
 	status = "disabled";
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &usb0 {
 	dr_mode = "peripheral";
 };
arch/arm/dts/am335x-evm.dts +1 -1
index 0bda4d4429..4aa8c78003 100644
@@ -104,7 +104,7 @@
 		default-brightness-level = <8>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-evmsk-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..1105ec471f
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-evmsk U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-evmsk.dts +1 -1
index 5762967cf7..1fff1095c9 100644
@@ -166,7 +166,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default>;
arch/arm/dts/am335x-guardian-u-boot.dtsi +4 -0
index 156b9b0e83..77d6e90598 100644
@@ -22,6 +22,10 @@
 	u-boot,dm-pre-reloc;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &rtc {
 	clocks = <&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>;
 	clock-names = "int-clk";
arch/arm/dts/am335x-guardian.dts +1 -1
index 5ed2133e78..bd3c890a37 100644
@@ -62,7 +62,7 @@
 		};
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default", "sleep";
 		pinctrl-0 = <&lcd_pins_default &lcd_disen_pins>;
arch/arm/dts/am335x-pdu001-u-boot.dtsi +4 -0
index 84a07bdef4..301959a361 100644
@@ -44,3 +44,7 @@
 &mmc2_pins {
 	u-boot,dm-pre-reloc;
 };
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pdu001.dts +0 -0
index ae43d61f4e..c7f512852e 100644

arch/arm/dts/am335x-pdu001.dts line 52

Quoted 5 lines
arch/arm/dts/am335x-pdu001.dts +1 -1
@@ -49,7 +49,7 @@
 		regulator-boot-on;
 	};
 
-	panel {
+	panel: panel {

This introduces another difference between the LINUX and and the U-Boot DTS file. Not sure but instead of referencing a label can't we use this in the *-u-boot.dtsi?

Quoted 6 lines
/ {
	panel {
		u-boot,dm-pre-reloc;
		};
	};

Yes, you are right.

I built am335x_guardian_defconfig with your suggestion.
dtc -I dtb -O dts -o /tmp/am335x-guardian.dts arch/arm/dts/am335x-guardian.dtb

      panel {
                compatible = "ti,tilcdc,panel";
                pinctrl-names = "default", "sleep";
                pinctrl-0 = <0x48 0x49>;
                pinctrl-1 = <0x4a>;
                u-boot,dm-pre-reloc;

                display-timings {

...

Quoted 93 lines
Quoted 82 lines
arch/arm/dts/am335x-pdu001.dts +0 -0
 		compatible = "ti,tilcdc,panel";
 		status = "okay";
 		pinctrl-names = "default";
arch/arm/dts/am335x-pxm50-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..f69fd384ac
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-pxm50 U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-pxm50.dts +1 -1
index f4e66d29d5..dcd3f6732f 100644
@@ -16,7 +16,7 @@
 	model = "PXM2/PXM50";
 	compatible = "ti,am335x-evm", "ti,am33xx";
 
-		panel {
+		panel: panel {
 			compatible = "ti,tilcdc,panel";
 			backlight = <&backlight0>;
 			pinctrl-names = "default";
arch/arm/dts/am335x-rut-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..b351eba6ee
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am335x-rut U-Boot Additions
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+&panel {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/am335x-rut.dts +1 -1
index 145247344f..0278bb4dcd 100644
@@ -86,7 +86,7 @@
 		reg = <0x80000000 0x10000000>; /* 256 MB */
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins_s0>;
arch/arm/dts/da850-evm-u-boot.dtsi +4 -0
index aa42d30c72..a3c9ab19b9 100644
@@ -28,6 +28,10 @@
 	u-boot,dm-spl;
 };
 
+&panel {
+	u-boot,dm-pre-reloc;
+};
+
 &serial2 {
 	u-boot,dm-spl;
 };
arch/arm/dts/da850-evm.dts +0 -0
index f04bc3e153..b1b1158411 100644

arch/arm/dts/da850-evm.dts line 48

Quoted 8 lines
arch/arm/dts/da850-evm.dts +1 -1
@@ -42,7 +42,7 @@
 		default-brightness-level = <7>;
 	};
 
-	panel {
+	panel: panel {
 		compatible = "ti,tilcdc,panel";
 		pinctrl-names = "default";
 		pinctrl-0 = <&lcd_pins>;

--
Felix

#14 lore raw

PATCH v2 11/13 fdt: video: omap: add framebuffer and panel bindings

In reply to Dario Binacchi

Add device-tree binding documentation for ti framebuffer and generic panel output driver.

---

Changes in v2: None

 .../video/tilcdc/panel.txt                    | 66 +++++++++++++++
 .../video/tilcdc/tilcdc.txt                   | 82 +++++++++++++++++++
 2 files changed, 148 insertions(+)
 create mode 100644 doc/device-tree-bindings/video/tilcdc/panel.txt
 create mode 100644 doc/device-tree-bindings/video/tilcdc/tilcdc.txt
doc/device-tree-bindings/video/tilcdc/panel.txt new file +66 -0
new file mode 100644
index 0000000000..808216310e
@@ -0,0 +1,66 @@
+Device-Tree bindings for tilcdc DRM generic panel output driver
+
+Required properties:
+ - compatible: value should be "ti,tilcdc,panel".
+ - panel-info: configuration info to configure LCDC correctly for the panel
+   - ac-bias: AC Bias Pin Frequency
+   - ac-bias-intrpt: AC Bias Pin Transitions per Interrupt
+   - dma-burst-sz: DMA burst size
+   - bpp: Bits per pixel
+   - fdd: FIFO DMA Request Delay
+   - sync-edge: Horizontal and Vertical Sync Edge: 0=rising 1=falling
+   - sync-ctrl: Horizontal and Vertical Sync: Control: 0=ignore
+   - raster-order: Raster Data Order Select: 1=Most-to-least 0=Least-to-most
+   - fifo-th: DMA FIFO threshold
+ - display-timings: typical videomode of lcd panel.  Multiple video modes
+   can be listed if the panel supports multiple timings, but the 'native-mode'
+   should be the preferred/default resolution.  Refer to
+   Documentation/devicetree/bindings/display/panel/display-timing.txt for display
+   timing binding details.
+
+Optional properties:
+- backlight: phandle of the backlight device attached to the panel
+- enable-gpios: GPIO pin to enable or disable the panel
+
+Recommended properties:
+ - pinctrl-names, pinctrl-0: the pincontrol settings to configure
+   muxing properly for pins that connect to TFP410 device
+
+Example:
+
+	/* Settings for CDTech_S035Q01 / LCD3 cape: */
+	lcd3 {
+		compatible = "ti,tilcdc,panel";
+		pinctrl-names = "default";
+		pinctrl-0 = <&bone_lcd3_cape_lcd_pins>;
+		backlight = <&backlight>;
+		enable-gpios = <&gpio3 19 0>;
+
+		panel-info {
+			ac-bias           = <255>;
+			ac-bias-intrpt    = <0>;
+			dma-burst-sz      = <16>;
+			bpp               = <16>;
+			fdd               = <0x80>;
+			sync-edge         = <0>;
+			sync-ctrl         = <1>;
+			raster-order      = <0>;
+			fifo-th           = <0>;
+		};
+		display-timings {
+			native-mode = <&timing0>;
+			timing0: 320x240 {
+				hactive         = <320>;
+				vactive         = <240>;
+				hback-porch     = <21>;
+				hfront-porch    = <58>;
+				hsync-len       = <47>;
+				vback-porch     = <11>;
+				vfront-porch    = <23>;
+				vsync-len       = <2>;
+				clock-frequency = <8000000>;
+				hsync-active    = <0>;
+				vsync-active    = <0>;
+			};
+		};
+	};
doc/device-tree-bindings/video/tilcdc/tilcdc.txt new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.24.0
#15 lore raw

PATCH v2 12/13 video: omap: fix pixel-per-line bitfield setting

In reply to Dario Binacchi

Fix the macro to set the pplmsb field (bit 3) of the RASTER_TIMING_0 register. It is used in order to support up to 2048 pixels per line.

---

Changes in v2: None

 drivers/video/am335x-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/am335x-fb.c +1 -1
index 30543a945b..eb5add2a20 100644
@@ -43,7 +43,7 @@
 #define LCDC_DMA_CTRL_BURST_16			0x4
 #define LCDC_DMA_CTRL_FIFO_TH(x)		(((x) & GENMASK(2, 0)) << 8)
 /* LCD Timing_0 Register */
-#define LCDC_RASTER_TIMING_0_HORMSB(x)		(((((x) >> 4) - 1) & 0x40) >> 4)
+#define LCDC_RASTER_TIMING_0_HORMSB(x)	((((x) - 1) & BIT(10)) >> 7)
 #define LCDC_RASTER_TIMING_0_HORLSB(x) (((((x) >> 4) - 1) & GENMASK(5, 0)) << 4)
 #define LCDC_RASTER_TIMING_0_HSWLSB(x)	((((x) - 1) & GENMASK(5, 0)) << 10)
 #define LCDC_RASTER_TIMING_0_HFPLSB(x)	((((x) - 1) & GENMASK(7, 0)) << 16)
Signature · 1 line
2.24.0
#16 lore raw

PATCH v2 13/13 board: brxre1: fix building errors

In reply to Dario Binacchi

Fix building errors if CONFIG_DM_VIDEO is enabled. This is the only u-boot board that enables CONFIG_AM335X_LCD and from which I started to develop the version of the frame buffer driver that supports the driver model.

---

Changes in v2: None

 board/BuR/common/br_resetc.c  | 2 +-
 board/BuR/common/bur_common.h | 3 +++
 board/BuR/common/common.c     | 2 +-
 include/configs/brxre1.h      | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)
board/BuR/common/br_resetc.c +1 -1
index c0e7fb65b2..70ad8322ef 100644
@@ -22,7 +22,7 @@
 #define BMODE_PME		12
 #define BMODE_DIAG		15
 
-#ifdef CONFIG_LCD
+#if CONFIG_IS_ENABLED(LCD) && !CONFIG_IS_ENABLED(DM_VIDEO)
 #include <lcd.h>
 #define LCD_SETCURSOR(x, y)	lcd_position_cursor(x, y)
 #define LCD_PUTS(x)		lcd_puts(x)
board/BuR/common/bur_common.h +3 -0
index 2591bf4bb3..618cebc1a5 100644
@@ -11,9 +11,12 @@
 #ifndef _BUR_COMMON_H_
 #define _BUR_COMMON_H_
 
+#if !CONFIG_IS_ENABLED(DM_VIDEO)
 #include <../../../drivers/video/am335x-fb.h>
 
 int load_lcdtiming(struct am335x_lcdpanel *panel);
+#endif
+
 void br_summaryscreen(void);
 void pmicsetup(u32 mpupll, unsigned int bus);
 void enable_uart0_pin_mux(void);
board/BuR/common/common.c +1 -1
index 148fc9075e..de8d455c27 100644
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* --------------------------------------------------------------------------*/
 #if defined(CONFIG_LCD) && defined(CONFIG_AM335X_LCD) && \
-	!defined(CONFIG_SPL_BUILD)
+	!defined(CONFIG_DM_VIDEO) && !defined(CONFIG_SPL_BUILD)
 #include <asm/arch/hardware.h>
 #include <asm/arch/cpu.h>
 #include <asm/gpio.h>
include/configs/brxre1.h +2 -0
index ea15912c90..006663373b 100644
@@ -14,7 +14,9 @@
 #include <configs/bur_cfg_common.h>
 #include <configs/bur_am335x_common.h>
 /* ------------------------------------------------------------------------- */
+#if !defined(CONFIG_AM335X_LCD)
 #define CONFIG_AM335X_LCD
+#endif
 #define LCD_BPP				LCD_COLOR32
 
 /* memory */
Signature · 1 line
2.24.0
#17 lore raw

v2 cover Add DM/DTS support for omap video driver

In reply to Dario Binacchi
Quoted 18 lines · Dario Binacchi

Changes:
- Fix coding style
- Refactor some parts of the driver
- Add support for driver model and device-tree
- Update the boards device-tree
- Add device-tree binding documentation

Changes for v2:
- Use the GENMASK macro to manage bitfield mask
- Move clock enabling sequence of LCD module to arch/arm/mach-omap2/
- Create a Kconfig symbol for CONFIG_AM335X_LCD
- Move 'u-boot,dm-pre-reloc' property to *-u-boot.dtsi file for boards that support Linux
- Add a patch to fix the pixel-per-line bitfield setting
- Add a patch to fix building errors for brxre1 board in case of CONFIG_DM_VIDEO is enabled

Quoted 2 lines

Changes in v2:
- Use GENMASK macro too

There are many places where Change log appeared in commit log. I fixed all of them locally and pushed the patches to next. If no further comments seen, will send PR to Tom when next merge window opens.

Thanks and regards,
Lokesh