Skip to contentSkip to conversation

*** Add AST2600 GFX node ***

PATCH In review tommy-huang 2 participants 8 messages Sep 28, 2021 – Oct 4, 2021

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

cover *** Add AST2600 GFX node ***

Add AST2600 GFX support first.

Joel Stanley (5):
ARM: dts: aspeed: Add GFX node to AST2600
ARM: dts: aspeed: ast2600-evb: Enable GFX device drm/aspeed: Add AST2600 support
HACK: drm/aspeed: INTR_STS hadndling
HACK: drm/aspeed: Paramterise modes

tommy-huang (1):
dt-bindings: gpu: Add ASPEED GFX bindings document

 .../devicetree/bindings/gpu/aspeed-gfx.txt     |  1 +
 arch/arm/boot/dts/aspeed-ast2600-evb.dts       | 13 +++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi               | 11 +++++++++++
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c        | 18 +++++++++++++-----
 4 files changed, 38 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/6 ARM: dts: aspeed: Add GFX node to AST2600

From: Joel Stanley <[email protected]>

The GFX device is present in the AST2600 SoC.

---
 arch/arm/boot/dts/aspeed-g6.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/aspeed-g6.dtsi +11 -0
index 1b47be1704f8..e38c3742761b 100644
@@ -351,6 +351,17 @@
 				quality = <100>;
 			};
 
+			gfx: display at 1e6e6000 {
+				compatible = "aspeed,ast2600-gfx", "aspeed,ast2500-gfx", "syscon";
+				reg = <0x1e6e6000 0x1000>;
+				reg-io-width = <4>;
+				clocks = <&syscon ASPEED_CLK_GATE_D1CLK>;
+				resets = <&syscon ASPEED_RESET_GRAPHICS>;
+				syscon = <&syscon>;
+				status = "disabled";
+				interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+			};
+
 			xdma: xdma at 1e6e7000 {
 				compatible = "aspeed,ast2600-xdma";
 				reg = <0x1e6e7000 0x100>;
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/6 ARM: dts: aspeed: ast2600-evb: Enable GFX device

In reply to tommy-huang

From: Joel Stanley <[email protected]>

Enable the GFX device with a framebuffer memory region.

---
 arch/arm/boot/dts/aspeed-ast2600-evb.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/aspeed-ast2600-evb.dts +13 -0
index b7eb552640cb..195ccd1952da 100644
@@ -23,6 +23,19 @@
 		reg = <0x80000000 0x80000000>;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		gfx_memory: framebuffer {
+			size = <0x01000000>;
+			alignment = <0x01000000>;
+			compatible = "shared-dma-pool";
+			reusable;
+		};
+	};
+
 	vcc_sdhci0: regulator-vcc-sdhci0 {
 		compatible = "regulator-fixed";
 		regulator-name = "SDHCI0 Vcc";
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/6 drm/aspeed: Add AST2600 support

In reply to tommy-huang

From: Joel Stanley <[email protected]>

The values for the threshold and scan line size come from the ASPEED SDK.

The DAC register is SCUC0 in the AST2600 datasheet. It has the same layout as the previous generations.

---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +7 -0
index b53fee6f1c17..ea9cb0a4f16c 100644
@@ -79,9 +79,16 @@ static const struct aspeed_gfx_config ast2500_config = {
 	.scan_line_max = 128,
 };
 
+static const struct aspeed_gfx_config ast2600_config = {
+	.dac_reg = 0xc0,
+	.throd_val = CRT_THROD_LOW(0x50) | CRT_THROD_HIGH(0x70),
+	.scan_line_max = 128,
+};
+
 static const struct of_device_id aspeed_gfx_match[] = {
 	{ .compatible = "aspeed,ast2400-gfx", .data = &ast2400_config },
 	{ .compatible = "aspeed,ast2500-gfx", .data = &ast2500_config },
+	{ .compatible = "aspeed,ast2600-gfx", .data = &ast2600_config },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, aspeed_gfx_match);
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/6 HACK: drm/aspeed: INTR_STS hadndling

In reply to tommy-huang

From: Joel Stanley <[email protected]>

The 2600 uses this register differently. THis is a TODO to come up with a method of handling that.

---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +2 -1
index ea9cb0a4f16c..33095477cc03 100644
@@ -126,7 +126,8 @@ static irqreturn_t aspeed_gfx_irq_handler(int irq, void *data)
 
 	if (reg & CRT_CTRL_VERTICAL_INTR_STS) {
 		drm_crtc_handle_vblank(&priv->pipe.crtc);
-		writel(reg, priv->base + CRT_CTRL1);
+		/* TODO */
+		writel(CRT_CTRL_VERTICAL_INTR_STS, priv->base + CRT_STATUS);
 		return IRQ_HANDLED;
 	}
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/6 HACK: drm/aspeed: Paramterise modes

In reply to tommy-huang

From: Joel Stanley <[email protected]>

The AST2600 will run at 1024x868.

---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +4 -4
index 33095477cc03..11a44b08bd3f 100644
@@ -99,7 +99,7 @@ static const struct drm_mode_config_funcs aspeed_gfx_mode_config_funcs = {
 	.atomic_commit		= drm_atomic_helper_commit,
 };
 
-static int aspeed_gfx_setup_mode_config(struct drm_device *drm)
+static int aspeed_gfx_setup_mode_config(struct drm_device *drm, int width, int height)
 {
 	int ret;
 
@@ -109,8 +109,8 @@ static int aspeed_gfx_setup_mode_config(struct drm_device *drm)
 
 	drm->mode_config.min_width = 0;
 	drm->mode_config.min_height = 0;
-	drm->mode_config.max_width = 800;
-	drm->mode_config.max_height = 600;
+	drm->mode_config.max_width = width;
+	drm->mode_config.max_height = height;
 	drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs;
 
 	return ret;
@@ -201,7 +201,7 @@ static int aspeed_gfx_load(struct drm_device *drm)
 	writel(0, priv->base + CRT_CTRL1);
 	writel(0, priv->base + CRT_CTRL2);
 
-	ret = aspeed_gfx_setup_mode_config(drm);
+	ret = aspeed_gfx_setup_mode_config(drm, 800, 600);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/6 dt-bindings: gpu: Add ASPEED GFX bindings document

In reply to tommy-huang

Add ast2600-gfx description for gfx driver.

---
 Documentation/devicetree/bindings/gpu/aspeed-gfx.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/aspeed-gfx.txt +1 -0
index 958bdf962339..29ecf119cef2 100644
@@ -3,6 +3,7 @@ Device tree configuration for the GFX display device on the ASPEED SoCs
 Required properties:
   - compatible
     * Must be one of the following:
+      + aspeed,ast2600-gfx
       + aspeed,ast2500-gfx
       + aspeed,ast2400-gfx
     * In addition, the ASPEED pinctrl bindings require the 'syscon' property to
Signature · 1 line
2.17.1