Skip to contentSkip to conversation

Make ARC PGU usable on sim platforms

PATCH In review Alexey Brodkin 2 participants 6 messages Jun 10, 2016 – Jun 13, 2016

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

v2 cover Make ARC PGU usable on sim platforms

Initially ARC PGU required real encoder/trnasmitter to exist. That was fine for real HW such as ARC SDP boards.

But on some simulaiton platroms like ARC VDK or nSIM OSCI we have model of the same ARC PGU and ability to output video data in a virtual LCD.

To make ARC PGU driver usable in those virtual platforms we need to istantiate virtual encoder instead of a real one. And that all is done in the first patch of the series.

Subsequent patches just update configs of both VDK and nSIM OSCI boards with enabling ARC PGU driver and adding required fixups in their DT descriptions.

Changes v1 -> v2:
* Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default best encoder

Alexey Brodkin (2):
ARCv2: [vdk] Enable ARC PGU on HS38 VDK
ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms

Ruud Derwig (1):
drm/arcpgu: Make ARC PGU usable on simulation platforms

 arch/arc/boot/dts/nsimosci.dts             |  14 +++-
 arch/arc/boot/dts/nsimosci_hs.dts          |  14 +++-
 arch/arc/boot/dts/nsimosci_hs_idu.dts      |  14 +++-
 arch/arc/boot/dts/vdk_axs10x_mb.dtsi       |  13 ++-
 arch/arc/boot/dts/vdk_hs38_smp.dts         |   2 +-
 arch/arc/configs/nsimosci_defconfig        |   3 +-
 arch/arc/configs/nsimosci_hs_defconfig     |   3 +-
 arch/arc/configs/nsimosci_hs_smp_defconfig |   3 +-
 arch/arc/configs/vdk_hs38_smp_defconfig    |   7 +-
 drivers/gpu/drm/arc/Makefile               |   2 +-
 drivers/gpu/drm/arc/arcpgu.h               |   1 +
 drivers/gpu/drm/arc/arcpgu_drv.c           |  15 ++--
 drivers/gpu/drm/arc/arcpgu_sim.c           | 128 +++++++++++++++++++++++++++++
 13 files changed, 189 insertions(+), 30 deletions(-)
 create mode 100644 drivers/gpu/drm/arc/arcpgu_sim.c
Signature · 1 line
2.5.5
#1 lore raw

PATCH v2 1/3 drm/arcpgu: Make ARC PGU usable on simulation platforms

From: Ruud Derwig <[email protected]>

In case of simulation there's no real encoder/transmitter device because in the model's virtual LCD we're rendering whatever appears in frame-buffer memory.

---

Changes v1 -> v2:
* Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default best encoder

 drivers/gpu/drm/arc/Makefile     |   2 +-
 drivers/gpu/drm/arc/arcpgu.h     |   1 +
 drivers/gpu/drm/arc/arcpgu_drv.c |  15 ++---
 drivers/gpu/drm/arc/arcpgu_sim.c | 128 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 138 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/arc/arcpgu_sim.c
drivers/gpu/drm/arc/Makefile +1 -1
index d48fda7..73de56a 100644
@@ -1,2 +1,2 @@
-arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
drivers/gpu/drm/arc/arcpgu.h +1 -0
index 86574b6..329ac75 100644
@@ -43,6 +43,7 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
 
 int arc_pgu_setup_crtc(struct drm_device *dev);
 int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
+int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
 struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
 	unsigned int preferred_bpp, unsigned int num_crtc,
 	unsigned int max_conn_count);
drivers/gpu/drm/arc/arcpgu_drv.c +8 -7
index 7675bbc..07c1bde 100644
@@ -149,15 +149,16 @@ static int arcpgu_load(struct drm_device *drm)
 
 	/* find the encoder node and initialize it */
 	encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0);
-	if (!encoder_node) {
-		dev_err(drm->dev, "failed to get an encoder slave node\n");
-		return -ENODEV;
+	if (encoder_node) {
+		ret = arcpgu_drm_hdmi_init(drm, encoder_node);
+		if (ret < 0)
+			return ret;
+	} else {
+		ret = arcpgu_drm_sim_init(drm, 0);
+		if (ret < 0)
+			return ret;
 	}
 
-	ret = arcpgu_drm_hdmi_init(drm, encoder_node);
-	if (ret < 0)
-		return ret;
-
 	drm_mode_config_reset(drm);
 	drm_kms_helper_poll_init(drm);
 
drivers/gpu/drm/arc/arcpgu_sim.c new file +128 -0

128 lines not on this page · raw message

Signature · 1 line
2.5.5
#4 lore raw

PATCH v2 2/3 ARCv2: [vdk] Enable ARC PGU on HS38 VDK

In reply to Alexey Brodkin

With required ARC PGU updates that allow it to be used on simulation platforms we may finally utilize ARC PGU in HS38 VDK with modern Linux kernels.

---

No changes in v2.

 arch/arc/boot/dts/vdk_axs10x_mb.dtsi    | 13 +++++++++----
 arch/arc/boot/dts/vdk_hs38_smp.dts      |  2 +-
 arch/arc/configs/vdk_hs38_smp_defconfig |  7 ++-----
 3 files changed, 12 insertions(+), 10 deletions(-)
arch/arc/boot/dts/vdk_axs10x_mb.dtsi +9 -4
index 45cd665..99498a4 100644
@@ -23,6 +23,11 @@
 				#clock-cells = <0>;
 			};
 
+			pguclk: pguclk {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <25175000>;
+			};
 		};
 
 		ethernet@0x18000 {
@@ -75,11 +80,11 @@
 		};
 
 /* PGU output directly sent to virtual LCD screen; hdmi controller not modelled */
-		pgu@0x17000 {
-			compatible = "snps,arcpgufb";
+		pgu@17000 {
+			compatible = "snps,arcpgu";
 			reg = <0x17000 0x400>;
-			clock-frequency = <51000000>; /* PGU'clock is initated in init function */
-			/* interrupts = <5>;   PGU interrupts not used, this vector is used for ps2 below */
+			clocks = <&pguclk>;
+			clock-names = "pxlclk";
 		};
 
 /* VDK has additional ps2 keyboard/mouse interface integrated in LCD screen model */
arch/arc/boot/dts/vdk_hs38_smp.dts +1 -1
index 031a5bc..2ba60c39 100644
@@ -16,6 +16,6 @@
 	compatible = "snps,axs103";
 
 	chosen {
-		bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0";
+		bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0 video=640x480-24";
 	};
 };
arch/arc/configs/vdk_hs38_smp_defconfig +2 -5
index 52ec315..969b206 100644
@@ -63,12 +63,9 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_ARCPGU_RGB888=y
-CONFIG_ARCPGU_DISPTYPE=0
-# CONFIG_VGA_CONSOLE is not set
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
Signature · 1 line
2.5.5
#5 lore raw

PATCH v2 3/3 ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms

In reply to Alexey Brodkin

With required ARC PGU updates that allow it to be used on simulation platforms we may finally utilize ARC PGU in nSIM OSCI virtual platforms with modern Linux kernels.

---

No changes in v2.

 arch/arc/boot/dts/nsimosci.dts             | 14 +++++++++++---
 arch/arc/boot/dts/nsimosci_hs.dts          | 14 +++++++++++---
 arch/arc/boot/dts/nsimosci_hs_idu.dts      | 14 +++++++++++---
 arch/arc/configs/nsimosci_defconfig        |  3 ++-
 arch/arc/configs/nsimosci_hs_defconfig     |  3 ++-
 arch/arc/configs/nsimosci_hs_smp_defconfig |  3 ++-
 6 files changed, 39 insertions(+), 12 deletions(-)
arch/arc/boot/dts/nsimosci.dts +11 -3
index b5b060a..37c416d 100644
@@ -20,7 +20,7 @@
 		/* this is for console on PGU */
 		/* bootargs = "console=tty0 consoleblank=0"; */
 		/* this is for console on serial */
-		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
 	};
 
 	aliases {
@@ -58,9 +58,17 @@
 			no-loopback-test = <1>;
 		};
 
-		pgu0: pgu@f9000000 {
-			compatible = "snps,arcpgufb";
+		pguclk: pguclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <25175000>;
+		};
+
+		pgu@f9000000 {
+			compatible = "snps,arcpgu";
 			reg = <0xf9000000 0x400>;
+			clocks = <&pguclk>;
+			clock-names = "pxlclk";
 		};
 
 		ps2: ps2@f9001000 {
arch/arc/boot/dts/nsimosci_hs.dts +11 -3
index 325e730..f2a22c4 100644
@@ -20,7 +20,7 @@
 		/* this is for console on PGU */
 		/* bootargs = "console=tty0 consoleblank=0"; */
 		/* this is for console on serial */
-		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
 	};
 
 	aliases {
@@ -58,9 +58,17 @@
 			no-loopback-test = <1>;
 		};
 
-		pgu0: pgu@f9000000 {
-			compatible = "snps,arcpgufb";
+		pguclk: pguclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <25175000>;
+		};
+
+		pgu@f9000000 {
+			compatible = "snps,arcpgu";
 			reg = <0xf9000000 0x400>;
+			clocks = <&pguclk>;
+			clock-names = "pxlclk";
 		};
 
 		ps2: ps2@f9001000 {
arch/arc/boot/dts/nsimosci_hs_idu.dts +11 -3
index ee03d71..34457a5 100644
@@ -18,7 +18,7 @@
 
 	chosen {
 		/* this is for console on serial */
-		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblan=0 debug";
+		bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblan=0 debug video=640x480-24";
 	};
 
 	aliases {
@@ -77,9 +77,17 @@
 			no-loopback-test = <1>;
 		};
 
-		pgu0: pgu@f9000000 {
-			compatible = "snps,arcpgufb";
+		pguclk: pguclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <25175000>;
+		};
+
+		pgu@f9000000 {
+			compatible = "snps,arcpgu";
 			reg = <0xf9000000 0x400>;
+			clocks = <&pguclk>;
+			clock-names = "pxlclk";
 		};
 
 		ps2: ps2@f9001000 {
arch/arc/configs/nsimosci_defconfig +2 -1
index 42bafa5..98cf209 100644
@@ -58,7 +58,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 # CONFIG_HID is not set
arch/arc/configs/nsimosci_hs_defconfig +2 -1
index 4bb60c1..ddf8b96 100644
@@ -57,7 +57,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 # CONFIG_HID is not set
arch/arc/configs/nsimosci_hs_smp_defconfig +2 -1
index 7e88f4c..ceb9074 100644
@@ -70,7 +70,8 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 # CONFIG_HID is not set
Signature · 1 line
2.5.5
#2 lore raw

Re: [PATCH 1/3 v2] drm/arcpgu: Make ARC PGU usable on simulation platforms

In reply to Alexey Brodkin

Hi Daniel,

Quoted 6 lines · Alexey Brodkin

From: Ruud Derwig <[email protected]>

In case of simulation there's no real encoder/transmitter device because in the model's virtual LCD  we're rendering whatever appears in frame-buffer memory.

Quoted 7 lines

---

Changes v1 -> v2:
 * Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default best encoder

If that version looks good to you could you please provide your Ack?

-Alexey

Acked-by
#3 lore raw

Re: [PATCH 1/3 v2] drm/arcpgu: Make ARC PGU usable on simulation platforms

Quoted 13 lines · Alexey Brodkin

Hi Daniel,

Quoted 10 lines · Alexey Brodkin

From: Ruud Derwig <rderwig at synopsys.com>

In case of simulation there's no real encoder/transmitter device because in the model's virtual LCD??we're rendering whatever appears in frame-buffer memory.

Signed-off-by Ruud Derwig <rderwig at synopsys.com>
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Quoted 5 lines
Quoted 3 lines

Changes v1 -> v2:
?* Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default ???best encoder

If that version looks good to you could you please provide your Ack?

I just do drive-by comments on driver submissions, review/merge rules are up to each driver maintainer mostly. But for the warm and fuzzy feeling I'm happy to ack ;-)

Acked-by Daniel Vetter <daniel.vetter at ffwll.ch>
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch