fsi: aspeed: CFAM reset support
Subsystems (3)
Joel Stanley
maintainercover fsi: aspeed: CFAM reset support
See patch 1 for a description.
v2: Fix levels
Joel Stanley (3):
fsi: aspeed: Support CFAM reset GPIO
ARM: dts: aspeed: rainier: Add CFAM reset GPIO
ARM: dts: aspeed: tacoma: Add CFAM reset GPIO
arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 6 +++ arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 1 + drivers/fsi/fsi-master-aspeed.c | 43 ++++++++++++++++++++ 3 files changed, 50 insertions(+)
Signature · 1 line
2.27.0
Joel Stanley
maintainerPATCH 1/3 fsi: aspeed: Support CFAM reset GPIO
Systems have a line for restting the remote CFAM. This is not part of the FSI master, but is associated with it, so it makes sense to include it in the master driver.
This exposes a sysfs interface to reset the cfam, abstracting away the direction and polarity of the GPIO, as well as the timing of the reset pulse. Userspace will be blocked until the reset pulse is finished.
The reset is hard coded to be in the range of (900, 1000) us. It was observed with a scope to regularly be just over 1ms.
If the device tree property is not preset the driver will silently continue.
---
v2: Releasing the reset should set it to 0
--- drivers/fsi/fsi-master-aspeed.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/fsi/fsi-master-aspeed.c +43 -0
@@ -22,6 +22,7 @@ struct fsi_master_aspeed {struct device *dev;void __iomem *base;struct clk *clk; +struct gpio_desc *cfam_reset_gpio; };#define to_fsi_master_aspeed (m) \
@@ -429,6 +430,43 @@ static int aspeed_master_init(struct fsi_master_aspeed *aspeed)return 0 ; } +static ssize_t cfam_reset_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct fsi_master_aspeed *aspeed =dev_get_drvdata (dev); + +gpiod_set_value (aspeed->cfam_reset_gpio,1 ); +usleep_range (900 ,1000 ); +gpiod_set_value (aspeed->cfam_reset_gpio,0 ); + +return count; +} + +static DEVICE_ATTR(cfam_reset, 0200, NULL, cfam_reset_store); + +static int setup_cfam_reset (struct fsi_master_aspeed *aspeed) +{ +struct device *dev = aspeed->dev; +struct gpio_desc *gpio; +int rc; + + gpio =devm_gpiod_get_optional (dev,"cfam-reset" ,GPIOD_OUT_LOW ); +if (IS_ERR (gpio)) +return PTR_ERR (gpio); +if (!gpio) +return 0 ; + + aspeed->cfam_reset_gpio = gpio; + + rc =device_create_file (dev, &dev_attr_cfam_reset); +if (rc) { +devm_gpiod_put (dev, gpio); +return rc; + } + +return 0 ; +} +static int tacoma_cabled_fsi_fixup (struct device *dev) {struct gpio_desc *routing_gpio, *mux_gpio;
@@ -511,6 +549,11 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)return rc; } + rc =setup_cfam_reset (aspeed); +if (rc) { +dev_err (&pdev->dev,"CFAM reset GPIO setup failed\n" ); + } +writel (0x1 , aspeed->base +OPB_CLK_SYNC );writel (OPB1_XFER_ACK_EN |OPB0_XFER_ACK_EN , aspeed->base +OPB_IRQ_MASK );
Signature · 1 line
2.27.0
Re: [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO
Quoted 8 lines · Joel Stanley
Systems have a line for restting the remote CFAM. This is not part of the FSI master, but is associated with it, so it makes sense to include it in the master driver.
This exposes a sysfs interface to reset the cfam, abstracting away the direction and polarity of the GPIO, as well as the timing of the reset pulse. Userspace will be blocked until the reset pulse is finished.
Quoted 7 lines
The reset is hard coded to be in the range of (900, 1000) us. It was observed with a scope to regularly be just over 1ms.
If the device tree property is not preset the driver will silently continue.
Signed-off-by Joel Stanley <[email protected]>
Joel Stanley
maintainerPATCH 2/3 ARM: dts: aspeed: rainier: Add CFAM reset GPIO
In reply to Joel StanleyThe GPIO on Q0 is used for resetting the CFAM of the processor that the ASPEED master is connected to.
The signal is wired as active high on the first pass systems.
---
v2: Fix polarity
--- arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts +6 -0
@@ -126,6 +126,12 @@ #address-cells = <2>; #size-cells = <0>; + /* + * CFAM Reset is supposed to be active low but pass1 hardware is wired + * active high. + */ + cfam-reset-gpios = <&gpio0 ASPEED_GPIO(Q, 0) GPIO_ACTIVE_HIGH>; + cfam@0,0 { reg = <0 0>; #address-cells = <1>;
Signature · 1 line
2.27.0
Re: [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add CFAM reset GPIO
Quoted 6 lines · Joel Stanley
The GPIO on Q0 is used for resetting the CFAM of the processor that the ASPEED master is connected to.
The signal is wired as active high on the first pass systems.
Signed-off-by Joel Stanley <[email protected]>
Joel Stanley
maintainerPATCH 3/3 ARM: dts: aspeed: tacoma: Add CFAM reset GPIO
In reply to Joel StanleyThe GPIO on Q0 is used for resetting the CFAM of the processor that the ASPEED master is connected to.
--- arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts +1 -0
@@ -185,6 +185,7 @@ fsi-routing-gpios = <&gpio0 ASPEED_GPIO(Q, 7) GPIO_ACTIVE_HIGH>; fsi-mux-gpios = <&gpio0 ASPEED_GPIO(B, 0) GPIO_ACTIVE_HIGH>; + cfam-reset-gpios = <&gpio0 ASPEED_GPIO(Q, 0) GPIO_ACTIVE_LOW>; cfam@0,0 { reg = <0 0>;
Signature · 1 line
2.27.0
Re: [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: Add CFAM reset GPIO
Quoted 4 lines · Joel Stanley
The GPIO on Q0 is used for resetting the CFAM of the processor that the ASPEED master is connected to.
Signed-off-by Joel Stanley <[email protected]>