Skip to contentSkip to conversation

fsi: Add AST2600 FSI master

PATCH In review Joel Stanley 2 participants 6 messages Nov 1, 2019 – Nov 27, 2019

Subsystems (4)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

cover fsi: Add AST2600 FSI master

This adds support for the FSI master included in the ASPEED AST2600 BMC SoC.

(It doesn't include Andrew's endian fix from today, those will be merged as follow ups)

Joel Stanley (3):
dt-bindings: fsi: Add description of FSI master
fsi: Add ast2600 master driver
fsi: aspeed: Add trace points

 .../bindings/fsi/fsi-master-aspeed.txt        |  24 +
 drivers/fsi/Kconfig                           |   6 +
 drivers/fsi/Makefile                          |   1 +
 drivers/fsi/fsi-master-aspeed.c               | 550 ++++++++++++++++++
 include/trace/events/fsi_master_aspeed.h      |  77 +++
 5 files changed, 658 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt
 create mode 100644 drivers/fsi/fsi-master-aspeed.c
 create mode 100644 include/trace/events/fsi_master_aspeed.h
Signature · 1 line
2.24.0.rc1
author maintainer
#1 lore raw

cover fsi: Add AST2600 FSI master

This adds support for the FSI master included in the ASPEED AST2600 BMC SoC.

The driver has been tested on hardware for most operations. Future enhancements include robust error recovery, DMA support and interrupt support.

This patch doesn't include Andrew's endian fix from today, but we can merge that as a follow up.

Please review!

Joel Stanley (3):
dt-bindings: fsi: Add description of FSI master
fsi: Add ast2600 master driver
fsi: aspeed: Add trace points

 .../bindings/fsi/fsi-master-aspeed.txt        |  24 +
 drivers/fsi/Kconfig                           |   6 +
 drivers/fsi/Makefile                          |   1 +
 drivers/fsi/fsi-master-aspeed.c               | 550 ++++++++++++++++++
 include/trace/events/fsi_master_aspeed.h      |  77 +++
 5 files changed, 658 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt
 create mode 100644 drivers/fsi/fsi-master-aspeed.c
 create mode 100644 include/trace/events/fsi_master_aspeed.h
Signature · 1 line
2.24.0.rc1
author maintainer
#2 lore raw

PATCH 1/3 dt-bindings: fsi: Add description of FSI master

In reply to Joel Stanley

This describes the FSI master present in the AST2600.

---
 .../bindings/fsi/fsi-master-aspeed.txt        | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt
Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt new file +24 -0
new file mode 100644
index 000000000000..c804897fa936
@@ -0,0 +1,24 @@
+Device-tree bindings for AST2600 FSI master
+-------------------------------------------
+
+The AST2600 contains two identical FSI masters. They share a clock and have a
+separate interrupt line and output pins.
+
+Required properties:
+ - compatible: "aspeed,ast2600-fsi-master"
+ - reg: base address and length
+ - clocks: phandle and clock number
+ - interrupts: platform dependant interrupt description
+ - pinctrl-0: phandle to pinctrl node
+ - pinctrl-names: pinctrl state
+
+Examples:
+
+    fsi-master {
+        compatible = "aspeed,ast2600-fsi-master", "fsi-master";
+        reg = <0x1e79b000 0x94>;
+	interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_fsi1_default>;
+	clocks = <&syscon ASPEED_CLK_GATE_FSICLK>;
+    };
Signature · 1 line
2.24.0.rc1
author maintainer
#4 lore raw

PATCH 2/3 fsi: Add ast2600 master driver

In reply to Joel Stanley

The ast2600 BMC has a pair of FSI masters in it, behind an AHB to OPB bridge.

---
 drivers/fsi/Kconfig             |   6 +
 drivers/fsi/Makefile            |   1 +
 drivers/fsi/fsi-master-aspeed.c | 528 ++++++++++++++++++++++++++++++++
 3 files changed, 535 insertions(+)
 create mode 100644 drivers/fsi/fsi-master-aspeed.c
drivers/fsi/Kconfig +6 -0
index c612db7a914a..12e8c4a04fb1 100644
@@ -53,6 +53,12 @@ config FSI_MASTER_AST_CF
 	lines driven by the internal ColdFire coprocessor. This requires
 	the corresponding machine specific ColdFire firmware to be available.
 
+config FSI_MASTER_ASPEED
+	tristate "FSI ASPEED master"
+	help
+	 This option enables a FSI master that is present behind an OPB bridge
+	 in the AST2600.
+
 config FSI_SCOM
 	tristate "SCOM FSI client device driver"
 	---help---
drivers/fsi/Makefile +1 -0
index e4a2ff043c32..da218a1ad8e1 100644
@@ -2,6 +2,7 @@
 
 obj-$(CONFIG_FSI) += fsi-core.o
 obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o
+obj-$(CONFIG_FSI_MASTER_ASPEED) += fsi-master-aspeed.o
 obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o
 obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o
 obj-$(CONFIG_FSI_SCOM) += fsi-scom.o
drivers/fsi/fsi-master-aspeed.c new file +528 -0

528 lines not on this page · raw message

Signature · 1 line
2.24.0.rc1
author maintainer
#5 lore raw

PATCH 3/3 fsi: aspeed: Add trace points

In reply to Joel Stanley

These trace points help with debugging the FSI master. They show the low level reads, writes and error states of the master.

---
 drivers/fsi/fsi-master-aspeed.c          | 22 +++++++
 include/trace/events/fsi_master_aspeed.h | 77 ++++++++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 include/trace/events/fsi_master_aspeed.h
drivers/fsi/fsi-master-aspeed.c +22 -0
index 5bb7a778075e..be1f2449b77a 100644
@@ -67,6 +67,9 @@ static const u32 fsi_base = 0xa0000000;
 #define XFER_HALFWORD	(BIT(0))
 #define XFER_BYTE	(0)
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fsi_master_aspeed.h>
+
 #define FSI_LINK_ENABLE_SETUP_TIME	10	/* in mS */
 
 #define DEFAULT_DIVISOR			14
@@ -92,6 +95,8 @@ static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr,
 
 	status = readl(base + OPB0_STATUS);
 
+	trace_fsi_master_aspeed_opb_write(addr, val, transfer_size, status, reg);
+
 	/* Return error when poll timed out */
 	if (ret)
 		return ret;
@@ -139,6 +144,10 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr,
 
 	result = readl(base + OPB0_FSI_DATA_R);
 
+	trace_fsi_master_aspeed_opb_read(addr, transfer_size, result,
+			readl(base + OPB0_STATUS),
+			reg);
+
 	/* Return error when poll timed out */
 	if (ret)
 		return ret;
@@ -186,6 +195,19 @@ static int check_errors(struct fsi_master_aspeed *aspeed, int err)
 {
 	int ret;
 
+	if (trace_fsi_master_aspeed_opb_error_enabled()) {
+		__be32 mresp0, mstap0, mesrb0;
+
+		opb_readl(aspeed, ctrl_base + FSI_MRESP0, &mresp0);
+		opb_readl(aspeed, ctrl_base + FSI_MSTAP0, &mstap0);
+		opb_readl(aspeed, ctrl_base + FSI_MESRB0, &mesrb0);
+
+		trace_fsi_master_aspeed_opb_error(
+				be32_to_cpu(mresp0),
+				be32_to_cpu(mstap0),
+				be32_to_cpu(mesrb0));
+	};
+
 	if (err == -EIO) {
 		/* Check MAEB (0x70) ? */
 
include/trace/events/fsi_master_aspeed.h new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.24.0.rc1