Skip to contentSkip to conversation

fsi: aspeed: Clean up defines and documentation

PATCH In review Joel Stanley 2 participants 4 messages Nov 4, 2019

Subsystems (2)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 fsi: aspeed: Clean up defines and documentation

Some of the registers lacked documetation but now can be properly named.

Rename FW to FULLWORD so no one thinks it means 'firmware'.

The "enable DMA" comment was setting the FSI access direction for DMA. As the driver does not yet use DMA it can be removed without effect.

---
 drivers/fsi/fsi-master-aspeed.c | 34 ++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/fsi/fsi-master-aspeed.c +21 -13
index 94e9b4f3418a..8da29fb9a69e 100644
@@ -63,15 +63,23 @@ static const u32 fsi_base = 0xa0000000;
 #define OPB0_FSI_ADDR	0x1c
 #define OPB0_FSI_DATA_W	0x20
 #define OPB0_STATUS	0x80
-/* half world */
-#define  STATUS_HW_ACK	BIT(0)
-/* full word */
-#define  STATUS_FW_ACK	BIT(1)
-#define  STATUS_ERR_ACK	BIT(2)
 #define OPB0_FSI_DATA_R	0x84
 
-#define OPB0_W_ENDIAN	0x4c
-#define OPB0_R_ENDIAN	0x5c
+#define OPB0_WRITE_ORDER1	0x4c
+#define OPB0_WRITE_ORDER2	0x50
+#define OPB1_WRITE_ORDER1	0x54
+#define OPB1_WRITE_ORDER2	0x58
+#define OPB0_READ_ORDER1	0x5c
+#define OPB1_READ_ORDER2	0x60
+
+#define OPB_RETRY_COUNTER	0x64
+
+/* OPBn_STATUS */
+#define  STATUS_HALFWORD_ACK	BIT(0)
+#define  STATUS_FULLWORD_ACK	BIT(1)
+#define  STATUS_ERR_ACK		BIT(2)
+#define  STATUS_RETRY		BIT(3)
+#define  STATUS_TIMEOUT		BIT(4)
 
 /* OPB_IRQ_MASK */
 #define OPB1_XFER_ACK_EN BIT(17)
@@ -575,19 +583,19 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)
 	writel(0x1, aspeed->base + OPB_CLK_SYNC);
 	writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN,
 			aspeed->base + OPB_IRQ_MASK);
-	/* TODO: Try without this */
-	writel(0x10, aspeed->base + 0x64); // Retry counter number ???
-	writel(0x0f, aspeed->base + 0xe4); // DMA Enable
+
+	/* TODO: determine an appropriate value */
+	writel(0x10, aspeed->base + OPB_RETRY_COUNTER);
 
 	writel(ctrl_base, aspeed->base + OPB_CTRL_BASE);
 	writel(fsi_base, aspeed->base + OPB_FSI_BASE);
 
 	/* Set read data order */
-	writel(0x00030b1b, aspeed->base + OPB0_R_ENDIAN);
+	writel(0x00030b1b, aspeed->base + OPB0_READ_ORDER1);
 
 	/* Set write data order */
-	writel(0x0011101b, aspeed->base + OPB0_W_ENDIAN);
-	writel(0x0c330f3f, aspeed->base + 0x50);
+	writel(0x0011101b, aspeed->base + OPB0_WRITE_ORDER1);
+	writel(0x0c330f3f, aspeed->base + OPB0_WRITE_ORDER2);
 
 	/*
 	 * Select OPB0 for all operations.
Signature · 1 line
2.24.0.rc1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Joel Stanley

Some of the registers lacked documetation but now can be properly named.

Rename FW to FULLWORD so no one thinks it means 'firmware'.

The "enable DMA" comment was setting the FSI access direction for DMA. As the driver does not yet use DMA it can be removed without effect.

This appears to go on top of my FSI series which goes on top of your other FSI that is a rework of my other FSI series. We should probably start merging these patches :D

Quoted 70 lines
---
 drivers/fsi/fsi-master-aspeed.c | 34 ++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/fsi/fsi-master-aspeed.c +21 -13
index 94e9b4f3418a..8da29fb9a69e 100644
@@ -63,15 +63,23 @@ static const u32 fsi_base = 0xa0000000;
 #define OPB0_FSI_ADDR	0x1c
 #define OPB0_FSI_DATA_W	0x20
 #define OPB0_STATUS	0x80
-/* half world */
-#define  STATUS_HW_ACK	BIT(0)
-/* full word */
-#define  STATUS_FW_ACK	BIT(1)
-#define  STATUS_ERR_ACK	BIT(2)
 #define OPB0_FSI_DATA_R	0x84
 
-#define OPB0_W_ENDIAN	0x4c
-#define OPB0_R_ENDIAN	0x5c
+#define OPB0_WRITE_ORDER1	0x4c
+#define OPB0_WRITE_ORDER2	0x50
+#define OPB1_WRITE_ORDER1	0x54
+#define OPB1_WRITE_ORDER2	0x58
+#define OPB0_READ_ORDER1	0x5c
+#define OPB1_READ_ORDER2	0x60
+
+#define OPB_RETRY_COUNTER	0x64
+
+/* OPBn_STATUS */
+#define  STATUS_HALFWORD_ACK	BIT(0)
+#define  STATUS_FULLWORD_ACK	BIT(1)
+#define  STATUS_ERR_ACK		BIT(2)
+#define  STATUS_RETRY		BIT(3)
+#define  STATUS_TIMEOUT		BIT(4)
 
 /* OPB_IRQ_MASK */
 #define OPB1_XFER_ACK_EN BIT(17)
@@ -575,19 +583,19 @@ static int fsi_master_aspeed_probe(struct 
 platform_device *pdev)
 	writel(0x1, aspeed->base + OPB_CLK_SYNC);
 	writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN,
 			aspeed->base + OPB_IRQ_MASK);
-	/* TODO: Try without this */
-	writel(0x10, aspeed->base + 0x64); // Retry counter number ???
-	writel(0x0f, aspeed->base + 0xe4); // DMA Enable
+
+	/* TODO: determine an appropriate value */
+	writel(0x10, aspeed->base + OPB_RETRY_COUNTER);
 
 	writel(ctrl_base, aspeed->base + OPB_CTRL_BASE);
 	writel(fsi_base, aspeed->base + OPB_FSI_BASE);
 
 	/* Set read data order */
-	writel(0x00030b1b, aspeed->base + OPB0_R_ENDIAN);
+	writel(0x00030b1b, aspeed->base + OPB0_READ_ORDER1);
 
 	/* Set write data order */
-	writel(0x0011101b, aspeed->base + OPB0_W_ENDIAN);
-	writel(0x0c330f3f, aspeed->base + 0x50);
+	writel(0x0011101b, aspeed->base + OPB0_WRITE_ORDER1);
+	writel(0x0c330f3f, aspeed->base + OPB0_WRITE_ORDER2);
 
 	/*

* Select OPB0 for all operations.

Signature · 1 line
2.24.0.rc1
author maintainer
#2 lore raw
Quoted 6 lines · Andrew Jeffery
Quoted 2 lines · Joel Stanley

Some of the registers lacked documetation but now can be properly named.

Quoted 8 lines
Quoted 6 lines

Rename FW to FULLWORD so no one thinks it means 'firmware'.

The "enable DMA" comment was setting the FSI access direction for DMA. As the driver does not yet use DMA it can be removed without effect.

This appears to go on top of my FSI series which goes on top of your other FSI that is a rework of my other FSI series. We should probably start merging these patches :D

They are all merged, with the exception of your alignment one.

Thanks for the review.

Quoted 72 lines
Quoted 70 lines
---
 drivers/fsi/fsi-master-aspeed.c | 34 ++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/fsi/fsi-master-aspeed.c +21 -13
index 94e9b4f3418a..8da29fb9a69e 100644
@@ -63,15 +63,23 @@ static const u32 fsi_base = 0xa0000000;
 #define OPB0_FSI_ADDR        0x1c
 #define OPB0_FSI_DATA_W      0x20
 #define OPB0_STATUS  0x80
-/* half world */
-#define  STATUS_HW_ACK       BIT(0)
-/* full word */
-#define  STATUS_FW_ACK       BIT(1)
-#define  STATUS_ERR_ACK      BIT(2)
 #define OPB0_FSI_DATA_R      0x84
 
-#define OPB0_W_ENDIAN        0x4c
-#define OPB0_R_ENDIAN        0x5c
+#define OPB0_WRITE_ORDER1    0x4c
+#define OPB0_WRITE_ORDER2    0x50
+#define OPB1_WRITE_ORDER1    0x54
+#define OPB1_WRITE_ORDER2    0x58
+#define OPB0_READ_ORDER1     0x5c
+#define OPB1_READ_ORDER2     0x60
+
+#define OPB_RETRY_COUNTER    0x64
+
+/* OPBn_STATUS */
+#define  STATUS_HALFWORD_ACK BIT(0)
+#define  STATUS_FULLWORD_ACK BIT(1)
+#define  STATUS_ERR_ACK              BIT(2)
+#define  STATUS_RETRY                BIT(3)
+#define  STATUS_TIMEOUT              BIT(4)
 
 /* OPB_IRQ_MASK */
 #define OPB1_XFER_ACK_EN BIT(17)
@@ -575,19 +583,19 @@ static int fsi_master_aspeed_probe(struct
 platform_device *pdev)
      writel(0x1, aspeed->base + OPB_CLK_SYNC);
      writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN,
                      aspeed->base + OPB_IRQ_MASK);
-     /* TODO: Try without this */
-     writel(0x10, aspeed->base + 0x64); // Retry counter number ???
-     writel(0x0f, aspeed->base + 0xe4); // DMA Enable
+
+     /* TODO: determine an appropriate value */
+     writel(0x10, aspeed->base + OPB_RETRY_COUNTER);
 
      writel(ctrl_base, aspeed->base + OPB_CTRL_BASE);
      writel(fsi_base, aspeed->base + OPB_FSI_BASE);
 
      /* Set read data order */
-     writel(0x00030b1b, aspeed->base + OPB0_R_ENDIAN);
+     writel(0x00030b1b, aspeed->base + OPB0_READ_ORDER1);
 
      /* Set write data order */
-     writel(0x0011101b, aspeed->base + OPB0_W_ENDIAN);
-     writel(0x0c330f3f, aspeed->base + 0x50);
+     writel(0x0011101b, aspeed->base + OPB0_WRITE_ORDER1);
+     writel(0x0c330f3f, aspeed->base + OPB0_WRITE_ORDER2);
 
      /*

* Select OPB0 for all operations.
--
2.24.0.rc1

#3 lore raw
Quoted 9 lines · Joel Stanley
Quoted 8 lines · Andrew Jeffery
Quoted 4 lines · Joel Stanley

Some of the registers lacked documetation but now can be properly named.

Rename FW to FULLWORD so no one thinks it means 'firmware'.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The "enable DMA" comment was setting the FSI access direction for DMA. As the driver does not yet use DMA it can be removed without effect.

This appears to go on top of my FSI series which goes on top of your other FSI that is a rework of my other FSI series. We should probably start merging these patches :D

They are all merged,

Ah, I checked the tree just now and they weren't there.

Quoted 1 line

with the exception of your alignment one.

What?! How could you not merge that masterpiece?