Message ID | 20210629073520.318514-3-joel@jms.id.au |
---|---|
State | New |
Headers | show |
Series | soc: aspeed: Reenable devices | expand |
On Tue, 2021-06-29 at 17:05 +0930, Joel Stanley wrote: > Recent builds of the vendor u-boot tree disable features of the > BMC that may allow unwanted access if not correctly configured. This > includes the PCIe DMA (XDMA) functionality. > > The bit to "un-disable" it is in the SCU. It does not appear to > matter > when it is cleared, as long as it is cleared before attempting a > transfer. Thanks! Reviewed-by: Eddie James <eajames@linux.ibm.com> > > Signed-off-by: Joel Stanley <joel@jms.id.au> > --- > drivers/soc/aspeed/aspeed-xdma.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/aspeed/aspeed-xdma.c > b/drivers/soc/aspeed/aspeed-xdma.c > index e6b4744bda64..48cfe30c90ad 100644 > --- a/drivers/soc/aspeed/aspeed-xdma.c > +++ b/drivers/soc/aspeed/aspeed-xdma.c > @@ -34,6 +34,9 @@ > #define SCU_AST2600_MISC_CTRL 0x0c0 > #define SCU_AST2600_MISC_CTRL_XDMA_BMC BIT(8) > > +#define SCU_AST2600_DEBUG_CTRL 0x0c8 > +#define DEBUG_CTRL_XDMA_DISABLE BIT(2) > + > #define SCU_AST2500_PCIE_CONF 0x180 > #define SCU_AST2600_PCIE_CONF 0xc20 > #define SCU_PCIE_CONF_VGA_EN BIT(0) > @@ -831,10 +834,15 @@ static int aspeed_xdma_init_scu(struct > aspeed_xdma *ctx, struct device *dev) > regmap_update_bits(scu, ctx->chip->scu_pcie_conf, bmc | > vga, > selection); > > - if (ctx->chip->scu_misc_ctrl) > + if (ctx->chip->scu_misc_ctrl) { > regmap_update_bits(scu, ctx->chip- > >scu_misc_ctrl, > SCU_AST2600_MISC_CTRL_XDMA_B > MC, > SCU_AST2600_MISC_CTRL_XDMA_B > MC); > + > + /* Allow XDMA to be used on AST2600 */ > + regmap_update_bits(scu, SCU_AST2600_DEBUG_CTRL, > + DEBUG_CTRL_XDMA_DISABLE, 0); > + } > } else { > dev_warn(dev, "Unable to configure PCIe: %ld; > continuing.\n", > PTR_ERR(scu));
diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c index e6b4744bda64..48cfe30c90ad 100644 --- a/drivers/soc/aspeed/aspeed-xdma.c +++ b/drivers/soc/aspeed/aspeed-xdma.c @@ -34,6 +34,9 @@ #define SCU_AST2600_MISC_CTRL 0x0c0 #define SCU_AST2600_MISC_CTRL_XDMA_BMC BIT(8) +#define SCU_AST2600_DEBUG_CTRL 0x0c8 +#define DEBUG_CTRL_XDMA_DISABLE BIT(2) + #define SCU_AST2500_PCIE_CONF 0x180 #define SCU_AST2600_PCIE_CONF 0xc20 #define SCU_PCIE_CONF_VGA_EN BIT(0) @@ -831,10 +834,15 @@ static int aspeed_xdma_init_scu(struct aspeed_xdma *ctx, struct device *dev) regmap_update_bits(scu, ctx->chip->scu_pcie_conf, bmc | vga, selection); - if (ctx->chip->scu_misc_ctrl) + if (ctx->chip->scu_misc_ctrl) { regmap_update_bits(scu, ctx->chip->scu_misc_ctrl, SCU_AST2600_MISC_CTRL_XDMA_BMC, SCU_AST2600_MISC_CTRL_XDMA_BMC); + + /* Allow XDMA to be used on AST2600 */ + regmap_update_bits(scu, SCU_AST2600_DEBUG_CTRL, + DEBUG_CTRL_XDMA_DISABLE, 0); + } } else { dev_warn(dev, "Unable to configure PCIe: %ld; continuing.\n", PTR_ERR(scu));
Recent builds of the vendor u-boot tree disable features of the BMC that may allow unwanted access if not correctly configured. This includes the PCIe DMA (XDMA) functionality. The bit to "un-disable" it is in the SCU. It does not appear to matter when it is cleared, as long as it is cleared before attempting a transfer. Signed-off-by: Joel Stanley <joel@jms.id.au> --- drivers/soc/aspeed/aspeed-xdma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)