[PATCH linux dev-5.4 13/16] soc: aspeed: xdma: Add memory controller configuration
Eddie James
eajames at linux.ibm.com
Wed Mar 18 09:13:33 AEDT 2020
Performing DMA requires configuring the memory protection register.
Signed-off-by: Eddie James <eajames at linux.ibm.com>
---
arch/arm/boot/dts/aspeed-g5.dtsi | 3 ++-
arch/arm/boot/dts/aspeed-g6.dtsi | 6 ++++++
drivers/soc/aspeed/aspeed-xdma.c | 16 ++++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
index 1a6a12d2a489..6df572b4d88a 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
@@ -49,7 +49,7 @@
};
edac: sdram at 1e6e0000 {
- compatible = "aspeed,ast2500-sdram-edac";
+ compatible = "aspeed,ast2500-sdram-edac", "syscon";
reg = <0x1e6e0000 0x174>;
interrupts = <0>;
status = "disabled";
@@ -270,6 +270,7 @@
interrupts-extended = <&vic 6>, <&scu_ic ASPEED_AST2500_SCU_IC_PCIE_RESET_LO_TO_HI>;
pcie-device = "bmc";
aspeed,scu = <&syscon>;
+ sdmc = <&edac>;
status = "disabled";
};
diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
index e2a429a3a396..cb511e0b1046 100644
--- a/arch/arm/boot/dts/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed-g6.dtsi
@@ -289,6 +289,11 @@
status = "disabled";
};
+ sdmc: sdram at 1e6e0000 {
+ compatible = "syscon";
+ reg = <0x1e6e0000 0xb8>;
+ };
+
apb {
compatible = "simple-bus";
#address-cells = <1>;
@@ -344,6 +349,7 @@
<&scu_ic0 ASPEED_AST2600_SCU_IC0_PCIE_PERST_LO_TO_HI>;
pcie-device = "bmc";
aspeed,scu = <&syscon>;
+ sdmc = <&sdmc>;
status = "disabled";
};
diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c
index 8c6408ff253b..ad29fdf30b06 100644
--- a/drivers/soc/aspeed/aspeed-xdma.c
+++ b/drivers/soc/aspeed/aspeed-xdma.c
@@ -50,6 +50,11 @@
#define SCU_AST2600_BMC_CLASS_REV 0xc4c
#define SCU_BMC_CLASS_REV_XDMA 0xff000001
+#define SDMC_REMAP 0x008
+#define SDMC_AST2500_REMAP_PCIE BIT(16)
+#define SDMC_AST2500_REMAP_XDMA BIT(17)
+#define SDMC_AST2600_REMAP_XDMA BIT(18)
+
#define XDMA_CMDQ_SIZE PAGE_SIZE
#define XDMA_NUM_CMDS \
(XDMA_CMDQ_SIZE / sizeof(struct aspeed_xdma_cmd))
@@ -184,6 +189,7 @@ struct aspeed_xdma_chip {
u32 control;
u32 scu_bmc_class;
u32 scu_pcie_conf;
+ u32 sdmc_remap;
unsigned int queue_entry_size;
struct aspeed_xdma_regs regs;
struct aspeed_xdma_status_bits status_bits;
@@ -805,6 +811,7 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
int irq;
int pcie_irq;
u32 memory[2];
+ struct regmap *sdmc;
struct aspeed_xdma *ctx;
struct device *dev = &pdev->dev;
const void *md = of_device_get_match_data(dev);
@@ -884,6 +891,13 @@ static int aspeed_xdma_probe(struct platform_device *pdev)
return rc;
}
+ sdmc = syscon_regmap_lookup_by_phandle(dev->of_node, "sdmc");
+ if (!IS_ERR(sdmc))
+ regmap_update_bits(sdmc, SDMC_REMAP, ctx->chip->sdmc_remap,
+ ctx->chip->sdmc_remap);
+ else
+ dev_err(dev, "Unable to configure memory controller.\n");
+
rc = aspeed_xdma_init_scu(ctx, dev);
if (rc)
return rc;
@@ -968,6 +982,7 @@ static const struct aspeed_xdma_chip aspeed_ast2500_xdma_chip = {
XDMA_AST2500_CTRL_DS_TIMEOUT | XDMA_AST2500_CTRL_DS_CHECK_ID,
.scu_bmc_class = SCU_AST2500_BMC_CLASS_REV,
.scu_pcie_conf = SCU_AST2500_PCIE_CONF,
+ .sdmc_remap = SDMC_AST2500_REMAP_PCIE | SDMC_AST2500_REMAP_XDMA,
.queue_entry_size = XDMA_AST2500_QUEUE_ENTRY_SIZE,
.regs = {
.bmc_cmdq_addr = XDMA_AST2500_BMC_CMDQ_ADDR,
@@ -990,6 +1005,7 @@ static const struct aspeed_xdma_chip aspeed_ast2600_xdma_chip = {
XDMA_AST2600_CTRL_DS_DIRTY | XDMA_AST2600_CTRL_DS_SIZE_256,
.scu_bmc_class = SCU_AST2600_BMC_CLASS_REV,
.scu_pcie_conf = SCU_AST2600_PCIE_CONF,
+ .sdmc_remap = SDMC_AST2600_REMAP_XDMA,
.queue_entry_size = XDMA_AST2600_QUEUE_ENTRY_SIZE,
.regs = {
.bmc_cmdq_addr = XDMA_AST2600_BMC_CMDQ_ADDR,
--
2.24.0
More information about the openbmc
mailing list