[PATCH linux dev-5.3 4/7] fsi: aspeed: Only select OPB0 once

Joel Stanley joel at jms.id.au
Fri Oct 25 12:03:48 AEDT 2019


The driver can leve OPB0 selected to save a AHB write per OPB operation.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
 drivers/fsi/fsi-master-aspeed.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c
index d2c01956663f..58b090e2cf46 100644
--- a/drivers/fsi/fsi-master-aspeed.c
+++ b/drivers/fsi/fsi-master-aspeed.c
@@ -197,7 +197,6 @@ static u32 opb_write(void __iomem *base, uint32_t addr, uint32_t val,
 	if (xfer_size < 0)
 		return xfer_size;
 
-	writel(0x1, base + OPB0_SELECT);
 	writel(CMD_WRITE, base + OPB0_RW);
 	writel(xfer_size, base + OPB0_XFER_SIZE);
 	writel(addr, base + OPB0_FSI_ADDR);
@@ -233,7 +232,6 @@ static int opb_read(void __iomem *base, uint32_t addr, size_t size, u32 *out)
 	if (xfer_size < 0)
 		return xfer_size;
 
-	writel(0x1, base + OPB0_SELECT);
 	writel(CMD_READ, base + OPB0_RW);
 	writel(xfer_size, base + OPB0_XFER_SIZE);
 	writel(addr, base + OPB0_FSI_ADDR);
@@ -596,6 +594,13 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)
 	writel(0x0011bb1b, aspeed->base + OPB0_W_ENDIAN);
 	writel(0xffaa5500, aspeed->base + 0x50);
 
+	/*
+	 * Select OPB0 for all operations.
+	 * Will need to be reworked when enabling DMA or anything that uses
+	 * OPB1.
+	 */
+	writel(0x1, aspeed->base + OPB0_SELECT);
+
 	rc = opb_read(aspeed->base, ctrl_base + FSI_MVER, 4, &raw);
 	if (rc) {
 		dev_err(&pdev->dev, "failed to read hub version\n");
-- 
2.23.0



More information about the openbmc mailing list