All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-5.4 0/3] fsi: aspeed: CFAM reset support
@ 2020-07-24  2:30 Joel Stanley
  2020-07-24  2:30 ` [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joel Stanley @ 2020-07-24  2:30 UTC (permalink / raw)
  To: openbmc, Andrew Jeffery

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(+)

-- 
2.27.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO
  2020-07-24  2:30 [PATCH linux dev-5.4 0/3] fsi: aspeed: CFAM reset support Joel Stanley
@ 2020-07-24  2:30 ` Joel Stanley
  2020-07-24  2:39   ` Andrew Jeffery
  2020-07-24  2:30 ` [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add " Joel Stanley
  2020-07-24  2:30 ` [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: " Joel Stanley
  2 siblings, 1 reply; 7+ messages in thread
From: Joel Stanley @ 2020-07-24  2:30 UTC (permalink / raw)
  To: openbmc, Andrew Jeffery

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.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
v2: Releasing the reset should set it to 0
---
 drivers/fsi/fsi-master-aspeed.c | 43 +++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c
index b44f71f1f0a8..ef21362095f8 100644
--- a/drivers/fsi/fsi-master-aspeed.c
+++ b/drivers/fsi/fsi-master-aspeed.c
@@ -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);
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add CFAM reset GPIO
  2020-07-24  2:30 [PATCH linux dev-5.4 0/3] fsi: aspeed: CFAM reset support Joel Stanley
  2020-07-24  2:30 ` [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
@ 2020-07-24  2:30 ` Joel Stanley
  2020-07-24  2:40   ` Andrew Jeffery
  2020-07-24  2:30 ` [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: " Joel Stanley
  2 siblings, 1 reply; 7+ messages in thread
From: Joel Stanley @ 2020-07-24  2:30 UTC (permalink / raw)
  To: openbmc, Andrew Jeffery

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 <joel@jms.id.au>
---
v2: Fix polarity
---
 arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
index 0b5c6cc1c66a..18e0b22d5e48 100644
--- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
@@ -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>;
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: Add CFAM reset GPIO
  2020-07-24  2:30 [PATCH linux dev-5.4 0/3] fsi: aspeed: CFAM reset support Joel Stanley
  2020-07-24  2:30 ` [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
  2020-07-24  2:30 ` [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add " Joel Stanley
@ 2020-07-24  2:30 ` Joel Stanley
  2020-07-24  2:41   ` Andrew Jeffery
  2 siblings, 1 reply; 7+ messages in thread
From: Joel Stanley @ 2020-07-24  2:30 UTC (permalink / raw)
  To: openbmc, Andrew Jeffery

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 <joel@jms.id.au>
---
 arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
index 96a45014b7e5..59f30c6c22d1 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
@@ -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>;
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO
  2020-07-24  2:30 ` [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
@ 2020-07-24  2:39   ` Andrew Jeffery
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Jeffery @ 2020-07-24  2:39 UTC (permalink / raw)
  To: Joel Stanley, openbmc



On Fri, 24 Jul 2020, at 12:00, Joel Stanley wrote:
> 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.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add CFAM reset GPIO
  2020-07-24  2:30 ` [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add " Joel Stanley
@ 2020-07-24  2:40   ` Andrew Jeffery
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Jeffery @ 2020-07-24  2:40 UTC (permalink / raw)
  To: Joel Stanley, openbmc



On Fri, 24 Jul 2020, at 12:00, Joel Stanley wrote:
> 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 <joel@jms.id.au>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: Add CFAM reset GPIO
  2020-07-24  2:30 ` [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: " Joel Stanley
@ 2020-07-24  2:41   ` Andrew Jeffery
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Jeffery @ 2020-07-24  2:41 UTC (permalink / raw)
  To: Joel Stanley, openbmc



On Fri, 24 Jul 2020, at 12:00, Joel Stanley wrote:
> 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 <joel@jms.id.au>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-24  2:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24  2:30 [PATCH linux dev-5.4 0/3] fsi: aspeed: CFAM reset support Joel Stanley
2020-07-24  2:30 ` [PATCH linux dev-5.4 1/3] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
2020-07-24  2:39   ` Andrew Jeffery
2020-07-24  2:30 ` [PATCH linux dev-5.4 2/3] ARM: dts: aspeed: rainier: Add " Joel Stanley
2020-07-24  2:40   ` Andrew Jeffery
2020-07-24  2:30 ` [PATCH linux dev-5.4 3/3] ARM: dts: aspeed: tacoma: " Joel Stanley
2020-07-24  2:41   ` Andrew Jeffery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.