[PATCH linux dev-5.4 14/16] soc: aspeed: xdma: Add root complex reset

Eddie James eajames at linux.ibm.com
Wed Mar 18 09:13:34 AEDT 2020


The PCI root complex must be taken out of reset in order for XDMA to
work.

Signed-off-by: Eddie James <eajames at linux.ibm.com>
---
 arch/arm/boot/dts/aspeed-g6.dtsi |  3 ++-
 drivers/soc/aspeed/aspeed-xdma.c | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
index cb511e0b1046..a22287186079 100644
--- a/arch/arm/boot/dts/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed-g6.dtsi
@@ -344,7 +344,8 @@
 				compatible = "aspeed,ast2600-xdma";
 				reg = <0x1e6e7000 0x100>;
 				clocks = <&syscon ASPEED_CLK_GATE_BCLK>;
-				resets = <&syscon ASPEED_RESET_DEV_XDMA>;
+				resets = <&syscon ASPEED_RESET_DEV_XDMA>, <&syscon ASPEED_RESET_RC_XDMA>;
+				reset-names = "dev", "rc";
 				interrupts-extended = <&gic GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
 						      <&scu_ic0 ASPEED_AST2600_SCU_IC0_PCIE_PERST_LO_TO_HI>;
 				pcie-device = "bmc";
diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c
index ad29fdf30b06..6bc1357445bc 100644
--- a/drivers/soc/aspeed/aspeed-xdma.c
+++ b/drivers/soc/aspeed/aspeed-xdma.c
@@ -207,6 +207,7 @@ struct aspeed_xdma {
 	void __iomem *base;
 	struct clk *clock;
 	struct reset_control *reset;
+	struct reset_control *reset_rc;
 
 	/* file_lock serializes reads of current_client */
 	struct mutex file_lock;
@@ -863,6 +864,12 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
 		return PTR_ERR(ctx->reset);
 	}
 
+	ctx->reset_rc = devm_reset_control_get_exclusive(dev, "rc");
+	if (IS_ERR(ctx->reset_rc)) {
+		dev_dbg(dev, "Failed to request reset RC control.\n");
+		ctx->reset_rc = NULL;
+	}
+
 	ctx->pool = devm_gen_pool_create(dev, ilog2(PAGE_SIZE), -1, NULL);
 	if (!ctx->pool) {
 		dev_err(dev, "Failed to setup genalloc pool.\n");
@@ -902,6 +909,15 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
+	if (ctx->reset_rc) {
+		rc = reset_control_deassert(ctx->reset_rc);
+		if (rc) {
+			dev_err(dev, "Failed to clear the RC reset.\n");
+			return rc;
+		}
+		msleep(XDMA_RESET_TIME_MS);
+	}
+
 	rc = clk_prepare_enable(ctx->clock);
 	if (rc) {
 		dev_err(dev, "Failed to enable the clock.\n");
@@ -973,6 +989,9 @@ static int aspeed_xdma_remove(struct platform_device *pdev)
 	reset_control_assert(ctx->reset);
 	clk_disable_unprepare(ctx->clock);
 
+	if (ctx->reset_rc)
+		reset_control_assert(ctx->reset_rc);
+
 	return 0;
 }
 
-- 
2.24.0



More information about the openbmc mailing list