All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node
@ 2020-03-26 20:13 Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory Eddie James
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Eddie James @ 2020-03-26 20:13 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Switch the XDMA driver and devicetree bindings over to use a reserved memory
node for the memory used by the XDMA engine.

Eddie James (4):
  soc: aspeed: xdma: Switch to reserved memory
  dt-bindings: soc: xdma: Switch to reserved memory node
  ARM: dts: Aspeed: Tacoma: Add reserved memory for XDMA
  ARM: dts: Aspeed: Witherspoon: Add reserved memory for XDMA

 .../devicetree/bindings/soc/aspeed/xdma.txt        |  6 ++---
 arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts        |  8 +++++--
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts   |  8 +++++--
 drivers/soc/aspeed/aspeed-xdma.c                   | 26 ++++++++++++++--------
 4 files changed, 32 insertions(+), 16 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory
  2020-03-26 20:13 [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node Eddie James
@ 2020-03-26 20:14 ` Eddie James
  2020-03-30  1:35   ` Andrew Jeffery
  2020-03-26 20:14 ` [PATCH linux dev-5.4 2/4] dt-bindings: soc: xdma: Switch to reserved memory node Eddie James
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Eddie James @ 2020-03-26 20:14 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Use a reserved memory node with no-map for the memory used by the XDMA
engine. This replaces the memory property previously used to access the
reserved VGA memory space.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/soc/aspeed/aspeed-xdma.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c
index 5d97919..470fe6d 100644
--- a/drivers/soc/aspeed/aspeed-xdma.c
+++ b/drivers/soc/aspeed/aspeed-xdma.c
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/poll.h>
 #include <linux/regmap.h>
@@ -845,10 +846,11 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
 	int rc;
 	int irq;
 	int pcie_irq;
-	u32 memory[2];
 	struct regmap *sdmc;
 	struct aspeed_xdma *ctx;
+	struct reserved_mem *mem;
 	struct device *dev = &pdev->dev;
+	struct device_node *memory_region;
 	const void *md = of_device_get_match_data(dev);
 
 	if (!md)
@@ -910,19 +912,25 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	rc = of_property_read_u32_array(dev->of_node, "memory", memory, 2);
-	if (rc) {
-		dev_err(dev, "Unable to get memory space.\n");
-		return rc;
+	memory_region = of_parse_phandle(dev->of_node, "memory-region", 0);
+	if (!memory_region) {
+		dev_err(dev, "Unable to get memory-region.\n");
+		return -ENOMEM;
 	}
 
-	ctx->mem_phys = memory[0];
-	ctx->mem_size = memory[1];
+	mem = of_reserved_mem_lookup(memory_region);
+	if (!mem) {
+		dev_err(dev, "Unable to find reserved memory.\n");
+		return -ENOMEM;
+	}
+
+	ctx->mem_phys = mem->base;
+	ctx->mem_size = mem->size;
 
 	ctx->mem_virt = devm_ioremap(dev, ctx->mem_phys, ctx->mem_size);
-	if (IS_ERR(ctx->mem_virt)) {
+	if (!ctx->mem_virt) {
 		dev_err(dev, "Failed to map memory space.\n");
-		return PTR_ERR(ctx->mem_virt);
+		return -ENOMEM;
 	}
 
 	rc = gen_pool_add_virt(ctx->pool, (unsigned long)ctx->mem_virt,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH linux dev-5.4 2/4] dt-bindings: soc: xdma: Switch to reserved memory node
  2020-03-26 20:13 [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory Eddie James
@ 2020-03-26 20:14 ` Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 3/4] ARM: dts: Aspeed: Tacoma: Add reserved memory for XDMA Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 4/4] ARM: dts: Aspeed: Witherspoon: " Eddie James
  3 siblings, 0 replies; 6+ messages in thread
From: Eddie James @ 2020-03-26 20:14 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Change the memory property to the more standard memory-region node.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 Documentation/devicetree/bindings/soc/aspeed/xdma.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/aspeed/xdma.txt b/Documentation/devicetree/bindings/soc/aspeed/xdma.txt
index 074bda5..da62975 100644
--- a/Documentation/devicetree/bindings/soc/aspeed/xdma.txt
+++ b/Documentation/devicetree/bindings/soc/aspeed/xdma.txt
@@ -17,8 +17,8 @@ Required properties:
 			  specifies the PCI-E reset or PERST interrupt.
  - aspeed,scu		: a phandle to the syscon node for the system control
 			  unit of the SOC
- - memory		: contains the address and size of the memory area to
-			  be used by the XDMA engine for DMA operations
+ - memory-region	: a phandle to the reserved memory region to be used by
+			  the XDMA engine for DMA operations
 
 Optional properties:
  - pcie-device		: should be either "bmc" or "vga", corresponding to
@@ -36,5 +36,5 @@ Example:
         interrupts-extended = <&vic 6>, <&scu_ic ASPEED_AST2500_SCU_IC_PCIE_RESET_LO_TO_HI>;
         aspeed,scu = <&syscon>;
         pcie-device = "bmc";
-        memory = <0x9f000000 0x01000000>;
+        memory-region = <&vga_memory>;
     };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH linux dev-5.4 3/4] ARM: dts: Aspeed: Tacoma: Add reserved memory for XDMA
  2020-03-26 20:13 [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 2/4] dt-bindings: soc: xdma: Switch to reserved memory node Eddie James
@ 2020-03-26 20:14 ` Eddie James
  2020-03-26 20:14 ` [PATCH linux dev-5.4 4/4] ARM: dts: Aspeed: Witherspoon: " Eddie James
  3 siblings, 0 replies; 6+ messages in thread
From: Eddie James @ 2020-03-26 20:14 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Use a no-map reserved memory node for use by the XDMA engine.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
index 194a482..2cd903f 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
@@ -29,6 +29,11 @@
 			no-map;
 			reg = <0xb8000000 0x4000000>; /* 64M */
 		};
+
+		vga_memory: region@bf000000 {
+			no-map;
+			reg = <0xbf000000 0x01000000>;	/* 16M */
+		};
 	};
 
 	gpio-keys {
@@ -807,6 +812,5 @@
 
 &xdma {
 	status = "okay";
-	/* 1G DRAM with 8M VRAM which is reserved at the top. */
-	memory = <0xbf800000 0x00800000>;
+	memory-region = <&vga_memory>;
 };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH linux dev-5.4 4/4] ARM: dts: Aspeed: Witherspoon: Add reserved memory for XDMA
  2020-03-26 20:13 [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node Eddie James
                   ` (2 preceding siblings ...)
  2020-03-26 20:14 ` [PATCH linux dev-5.4 3/4] ARM: dts: Aspeed: Tacoma: Add reserved memory for XDMA Eddie James
@ 2020-03-26 20:14 ` Eddie James
  3 siblings, 0 replies; 6+ messages in thread
From: Eddie James @ 2020-03-26 20:14 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Use a no-map reserved memory node for use by the XDMA engine.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
index da9e379..ce445fe 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
@@ -27,6 +27,11 @@
 			reg = <0x98000000 0x04000000>; /* 64M */
 		};
 
+		vga_memory: region@9f000000 {
+			no-map;
+			reg = <0x9f000000 0x01000000>; /* 16M */
+		};
+
 		gfx_memory: framebuffer {
 			size = <0x01000000>;
 			alignment = <0x01000000>;
@@ -746,8 +751,7 @@
 
 &xdma {
 	status = "okay";
-	/* 512M DRAM with 16M VRAM which is reserved at the top. */
-	memory = <0x9f000000 0x01000000>;
+	memory-region = <&vga_memory>;
 };
 
 #include "ibm-power9-dual.dtsi"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory
  2020-03-26 20:14 ` [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory Eddie James
@ 2020-03-30  1:35   ` Andrew Jeffery
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Jeffery @ 2020-03-30  1:35 UTC (permalink / raw)
  To: Eddie James, openbmc



On Fri, 27 Mar 2020, at 06:44, Eddie James wrote:
> Use a reserved memory node with no-map for the memory used by the XDMA
> engine. This replaces the memory property previously used to access the
> reserved VGA memory space.

Great. Can you refresh the upstream patch series (apologies if you already have)?

Acked-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-30  1:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 20:13 [PATCH linux dev-5.4 0/4] Aspeed: xdma: Switch to reserved memory node Eddie James
2020-03-26 20:14 ` [PATCH linux dev-5.4 1/4] soc: aspeed: xdma: Switch to reserved memory Eddie James
2020-03-30  1:35   ` Andrew Jeffery
2020-03-26 20:14 ` [PATCH linux dev-5.4 2/4] dt-bindings: soc: xdma: Switch to reserved memory node Eddie James
2020-03-26 20:14 ` [PATCH linux dev-5.4 3/4] ARM: dts: Aspeed: Tacoma: Add reserved memory for XDMA Eddie James
2020-03-26 20:14 ` [PATCH linux dev-5.4 4/4] ARM: dts: Aspeed: Witherspoon: " Eddie James

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.