All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement
@ 2017-07-27 10:16 Andrew Jeffery
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-27 10:16 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, mspinler, msbarth, openbmc

Hello,

v3 corrects some glaring flaws in v2 that I'm going to blame on hacking too
late at night. Critically:

* Use the right bit patterns to select push-pull vs open-drain, active-high vs
  active low.
* Fix some wording in the bindings.
* Specify the external signal pulse as active-high in the devicetree.

Matt(s): Please test and report back. I'll send the patches upstream if they're
fit-for-purpose.

Cheers,

Andrew

Andrew Jeffery (4):
  ARM: aspeed: Request WDTRST1 pinctrl function
  dt-bindings: watchdog: aspeed: External reset signal properties
  watchdog: aspeed: Support configuration of external signal properties
  ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull

 .../devicetree/bindings/watchdog/aspeed-wdt.txt    | 10 +++++-
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts   |  5 +++
 drivers/watchdog/aspeed_wdt.c                      | 42 ++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)

-- 
2.11.0

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

* [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function
  2017-07-27 10:16 [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
@ 2017-07-27 10:16 ` Andrew Jeffery
  2017-07-31 20:24   ` Matt Spinler
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-27 10:16 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, mspinler, msbarth, openbmc

On Witherspoon, the Aspeed SoC's WDTRST1 pin is wired to the FAULT pin
on the MAX31785 fan controller, which drives the fans to 100% PWM duty
when asserted. The pulse generated by the watchdog is latched to ensure
the fans stay at full speed across the BMC reboot. The latch is reset
when the BMC transitions through the chassis-poweron systemd target.

The SoC's WDTRST1 pinctrl function needs to be requested for
aspeed,external-signal to be effective, otherwise the pin is not
associated with the watchdog controller.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
index d9649013ee78..c28222c17d03 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
@@ -488,6 +488,9 @@
 &wdt1 {
 	aspeed,reset-type = "none";
 	aspeed,external-signal;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_wdtrst1_default>;
 };
 
 &wdt2 {
-- 
2.11.0

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

* [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties
  2017-07-27 10:16 [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
@ 2017-07-27 10:16 ` Andrew Jeffery
  2017-07-28  1:41   ` Joel Stanley
  2017-07-31 20:24   ` Matt Spinler
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external " Andrew Jeffery
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull Andrew Jeffery
  3 siblings, 2 replies; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-27 10:16 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, mspinler, msbarth, openbmc

For the AST2500 and compatible watchdog controllers the external reset
signal can be configured for push-pull or open-drain drive types, and in
the case of open-drain driving, active low or high.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
index f526b003b2e0..7aa885f620ef 100644
--- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
@@ -36,10 +36,18 @@ Optional properties:
  - aspeed,interrupt:	If property is present then interrupt CPU.
 			If not specified then don't interrupt CPU.
 
+ - aspeed,alt-boot:    If property is present then boot from alternate block.
  - aspeed,external-signal: If property is present then signal is sent to
 			external reset counter (only WDT1 and WDT2). If not
 			specified no external signal is sent.
- - aspeed,alt-boot:    If property is present then boot from alternate block.
+ - aspeed,ext-pulse-duration: External signal pulse duration in microseconds
+
+Optional properties for AST2500-compatible watchdogs:
+ - aspeed,ext-push-pull: If aspeed,external-signal is present, set the pin's
+			 drive type to push-pull. The default is open-drain.
+ - aspeed,ext-active-high: If aspeed,external-signal is present and and the pin
+			   is configured as push-pull, then set the pulse
+			   polarity to active-high. The default is active-low.
 
 Example:
 
-- 
2.11.0

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

* [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external signal properties
  2017-07-27 10:16 [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
@ 2017-07-27 10:16 ` Andrew Jeffery
  2017-07-31 20:24   ` Matt Spinler
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull Andrew Jeffery
  3 siblings, 1 reply; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-27 10:16 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, mspinler, msbarth, openbmc

Add support for configuring the drive strength and polarity on the
AST2500, and the pulse duration on both the AST2400 and AST2500.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/watchdog/aspeed_wdt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index d29f75e90bb6..334e43f0164b 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -42,6 +42,14 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
 #define   WDT_CTRL_WDT_INTR		BIT(2)
 #define   WDT_CTRL_RESET_SYSTEM		BIT(1)
 #define   WDT_CTRL_ENABLE		BIT(0)
+#define WDT_RESET_WIDTH		0x18
+#define   WDT_RESET_WIDTH_ACTIVE_HIGH	BIT(31)
+#define     WDT_ACTIVE_HIGH_MAGIC	(0xA5 << 24)
+#define     WDT_ACTIVE_LOW_MAGIC	(0x5A << 24)
+#define   WDT_RESET_WIDTH_PUSH_PULL	BIT(30)
+#define     WDT_PUSH_PULL_MAGIC		(0xA8 << 24)
+#define     WDT_OPEN_DRAIN_MAGIC	(0x8A << 24)
+#define   WDT_RESET_WIDTH_DURATION	0xFFF
 
 #define WDT_RESTART_MAGIC	0x4755
 
@@ -152,6 +160,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device_node *np;
 	const char *reset_type;
+	u32 duration;
 	int ret;
 
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
@@ -204,6 +213,39 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 		set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
 	}
 
+	if (of_device_is_compatible(np, "aspeed,ast2500-wdt")) {
+		u32 reg = readl(wdt->base + WDT_RESET_WIDTH);
+
+		reg &= WDT_RESET_WIDTH_DURATION;
+		if (of_property_read_bool(np, "aspeed,ext-push-pull"))
+			reg |= WDT_PUSH_PULL_MAGIC;
+		else
+			reg |= WDT_OPEN_DRAIN_MAGIC;
+
+		writel(reg, wdt->base + WDT_RESET_WIDTH);
+
+		reg &= WDT_RESET_WIDTH_DURATION;
+		if (of_property_read_bool(np, "aspeed,ext-active-high"))
+			reg |= WDT_ACTIVE_HIGH_MAGIC;
+		else
+			reg |= WDT_ACTIVE_LOW_MAGIC;
+
+		writel(reg, wdt->base + WDT_RESET_WIDTH);
+	}
+
+	if (!of_property_read_u32(np, "aspeed,ext-pulse-duration", &duration)) {
+		if (duration > WDT_RESET_WIDTH_DURATION) {
+			dev_err(&pdev->dev, "Invalid reset width\n");
+			return -EINVAL;
+		}
+
+		/*
+		 * The watchdog is always configured with a 1MHz source, so
+		 * there is no need to scale the microsecond value.
+		 */
+		writel(duration, wdt->base + WDT_RESET_WIDTH);
+	}
+
 	ret = watchdog_register_device(&wdt->wdd);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register\n");
-- 
2.11.0

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

* [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull
  2017-07-27 10:16 [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
                   ` (2 preceding siblings ...)
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external " Andrew Jeffery
@ 2017-07-27 10:16 ` Andrew Jeffery
  2017-07-31 20:25   ` Matt Spinler
  3 siblings, 1 reply; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-27 10:16 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, mspinler, msbarth, openbmc

Fix the drive and polarity of WDTRST1 with respect to the latch design
which assert the FAULT pin on the MAX31785 across a BMC reset. This
ensures the fan outputs are ramped to 100% PWM duty.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
index c28222c17d03..6a7ab9648984 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
@@ -488,6 +488,8 @@
 &wdt1 {
 	aspeed,reset-type = "none";
 	aspeed,external-signal;
+	aspeed,ext-push-pull;
+	aspeed,ext-active-high;
 
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_wdtrst1_default>;
-- 
2.11.0

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

* Re: [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
@ 2017-07-28  1:41   ` Joel Stanley
  2017-07-28  1:47     ` Andrew Jeffery
  2017-07-31 20:24   ` Matt Spinler
  1 sibling, 1 reply; 12+ messages in thread
From: Joel Stanley @ 2017-07-28  1:41 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: Matt Spinler, msbarth, OpenBMC Maillist

On Thu, Jul 27, 2017 at 7:46 PM, Andrew Jeffery <andrew@aj.id.au> wrote:
> For the AST2500 and compatible watchdog controllers the external reset
> signal can be configured for push-pull or open-drain drive types, and in
> the case of open-drain driving, active low or high.

In addition to this we should document the pinctrl phandle: the fact
that it exists, but more importantly how that interacts with the
hardware.

>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> index f526b003b2e0..7aa885f620ef 100644
> --- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> @@ -36,10 +36,18 @@ Optional properties:
>   - aspeed,interrupt:   If property is present then interrupt CPU.
>                         If not specified then don't interrupt CPU.
>
> + - aspeed,alt-boot:    If property is present then boot from alternate block.
>   - aspeed,external-signal: If property is present then signal is sent to
>                         external reset counter (only WDT1 and WDT2). If not
>                         specified no external signal is sent.
> - - aspeed,alt-boot:    If property is present then boot from alternate block.
> + - aspeed,ext-pulse-duration: External signal pulse duration in microseconds
> +
> +Optional properties for AST2500-compatible watchdogs:
> + - aspeed,ext-push-pull: If aspeed,external-signal is present, set the pin's
> +                        drive type to push-pull. The default is open-drain.
> + - aspeed,ext-active-high: If aspeed,external-signal is present and and the pin
> +                          is configured as push-pull, then set the pulse
> +                          polarity to active-high. The default is active-low.
>
>  Example:
>
> --
> 2.11.0
>

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

* Re: [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties
  2017-07-28  1:41   ` Joel Stanley
@ 2017-07-28  1:47     ` Andrew Jeffery
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Jeffery @ 2017-07-28  1:47 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Matt Spinler, msbarth, OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 2643 bytes --]

On Fri, 2017-07-28 at 11:11 +0930, Joel Stanley wrote:
> > On Thu, Jul 27, 2017 at 7:46 PM, Andrew Jeffery <andrew@aj.id.au> wrote:
> > For the AST2500 and compatible watchdog controllers the external reset
> > signal can be configured for push-pull or open-drain drive types, and in
> > the case of open-drain driving, active low or high.
> 
> In addition to this we should document the pinctrl phandle: the fact
> that it exists, but more importantly how that interacts with the
> hardware.

Yeah that's a good suggestion. I'll make a separate patch augmenting
Chris' words for aspeed,external-signal, and I'll hold off on resending
the series until I get some feedback from Matt Spinler on whether it's
fit for purpose.

> 
> > 
> > > > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > ---
> >  Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> > index f526b003b2e0..7aa885f620ef 100644
> > --- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> > +++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> > @@ -36,10 +36,18 @@ Optional properties:
> >   - aspeed,interrupt:   If property is present then interrupt CPU.
> >                         If not specified then don't interrupt CPU.
> > 
> > + - aspeed,alt-boot:    If property is present then boot from alternate block.
> >   - aspeed,external-signal: If property is present then signal is sent to
> >                         external reset counter (only WDT1 and WDT2). If not
> >                         specified no external signal is sent.
> > - - aspeed,alt-boot:    If property is present then boot from alternate block.
> > + - aspeed,ext-pulse-duration: External signal pulse duration in microseconds
> > +
> > +Optional properties for AST2500-compatible watchdogs:
> > + - aspeed,ext-push-pull: If aspeed,external-signal is present, set the pin's
> > +                        drive type to push-pull. The default is open-drain.
> > + - aspeed,ext-active-high: If aspeed,external-signal is present and and the pin
> > +                          is configured as push-pull, then set the pulse
> > +                          polarity to active-high. The default is active-low.
> > 
> >  Example:
> > 
> > --
> > 2.11.0
> > 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
@ 2017-07-31 20:24   ` Matt Spinler
  2017-08-01  0:14     ` Joel Stanley
  0 siblings, 1 reply; 12+ messages in thread
From: Matt Spinler @ 2017-07-31 20:24 UTC (permalink / raw)
  To: Andrew Jeffery, joel; +Cc: msbarth, openbmc

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

Tested-by: Matt Spinler   mspinler@linux.vnet.ibm.com


On 7/27/2017 5:16 AM, Andrew Jeffery wrote:
> On Witherspoon, the Aspeed SoC's WDTRST1 pin is wired to the FAULT pin
> on the MAX31785 fan controller, which drives the fans to 100% PWM duty
> when asserted. The pulse generated by the watchdog is latched to ensure
> the fans stay at full speed across the BMC reboot. The latch is reset
> when the BMC transitions through the chassis-poweron systemd target.
>
> The SoC's WDTRST1 pinctrl function needs to be requested for
> aspeed,external-signal to be effective, otherwise the pin is not
> associated with the watchdog controller.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
> ---
>   arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> index d9649013ee78..c28222c17d03 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> @@ -488,6 +488,9 @@
>   &wdt1 {
>   	aspeed,reset-type = "none";
>   	aspeed,external-signal;
> +
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_wdtrst1_default>;
>   };
>
>   &wdt2 {


[-- Attachment #2: Type: text/html, Size: 1927 bytes --]

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

* Re: [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
  2017-07-28  1:41   ` Joel Stanley
@ 2017-07-31 20:24   ` Matt Spinler
  1 sibling, 0 replies; 12+ messages in thread
From: Matt Spinler @ 2017-07-31 20:24 UTC (permalink / raw)
  To: Andrew Jeffery, joel; +Cc: msbarth, openbmc

[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]

Tested-by: Matt Spinler mspinler@linux.vnet.ibm.com


On 7/27/2017 5:16 AM, Andrew Jeffery wrote:
> For the AST2500 and compatible watchdog controllers the external reset
> signal can be configured for push-pull or open-drain drive types, and in
> the case of open-drain driving, active low or high.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>   Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> index f526b003b2e0..7aa885f620ef 100644
> --- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
> @@ -36,10 +36,18 @@ Optional properties:
>    - aspeed,interrupt:	If property is present then interrupt CPU.
>   			If not specified then don't interrupt CPU.
>
> + - aspeed,alt-boot:    If property is present then boot from alternate block.
>    - aspeed,external-signal: If property is present then signal is sent to
>   			external reset counter (only WDT1 and WDT2). If not
>   			specified no external signal is sent.
> - - aspeed,alt-boot:    If property is present then boot from alternate block.
> + - aspeed,ext-pulse-duration: External signal pulse duration in microseconds
> +
> +Optional properties for AST2500-compatible watchdogs:
> + - aspeed,ext-push-pull: If aspeed,external-signal is present, set the pin's
> +			 drive type to push-pull. The default is open-drain.
> + - aspeed,ext-active-high: If aspeed,external-signal is present and and the pin
> +			   is configured as push-pull, then set the pulse
> +			   polarity to active-high. The default is active-low.
>
>   Example:
>


[-- Attachment #2: Type: text/html, Size: 2316 bytes --]

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

* Re: [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external signal properties
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external " Andrew Jeffery
@ 2017-07-31 20:24   ` Matt Spinler
  0 siblings, 0 replies; 12+ messages in thread
From: Matt Spinler @ 2017-07-31 20:24 UTC (permalink / raw)
  To: Andrew Jeffery, joel; +Cc: msbarth, openbmc

[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]

Tested-by: Matt Spinler mspinler@linux.vnet.ibm.com


On 7/27/2017 5:16 AM, Andrew Jeffery wrote:
> Add support for configuring the drive strength and polarity on the
> AST2500, and the pulse duration on both the AST2400 and AST2500.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>   drivers/watchdog/aspeed_wdt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 42 insertions(+)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index d29f75e90bb6..334e43f0164b 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -42,6 +42,14 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
>   #define   WDT_CTRL_WDT_INTR		BIT(2)
>   #define   WDT_CTRL_RESET_SYSTEM		BIT(1)
>   #define   WDT_CTRL_ENABLE		BIT(0)
> +#define WDT_RESET_WIDTH		0x18
> +#define   WDT_RESET_WIDTH_ACTIVE_HIGH	BIT(31)
> +#define     WDT_ACTIVE_HIGH_MAGIC	(0xA5 << 24)
> +#define     WDT_ACTIVE_LOW_MAGIC	(0x5A << 24)
> +#define   WDT_RESET_WIDTH_PUSH_PULL	BIT(30)
> +#define     WDT_PUSH_PULL_MAGIC		(0xA8 << 24)
> +#define     WDT_OPEN_DRAIN_MAGIC	(0x8A << 24)
> +#define   WDT_RESET_WIDTH_DURATION	0xFFF
>
>   #define WDT_RESTART_MAGIC	0x4755
>
> @@ -152,6 +160,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
>   	struct resource *res;
>   	struct device_node *np;
>   	const char *reset_type;
> +	u32 duration;
>   	int ret;
>
>   	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
> @@ -204,6 +213,39 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
>   		set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
>   	}
>
> +	if (of_device_is_compatible(np, "aspeed,ast2500-wdt")) {
> +		u32 reg = readl(wdt->base + WDT_RESET_WIDTH);
> +
> +		reg &= WDT_RESET_WIDTH_DURATION;
> +		if (of_property_read_bool(np, "aspeed,ext-push-pull"))
> +			reg |= WDT_PUSH_PULL_MAGIC;
> +		else
> +			reg |= WDT_OPEN_DRAIN_MAGIC;
> +
> +		writel(reg, wdt->base + WDT_RESET_WIDTH);
> +
> +		reg &= WDT_RESET_WIDTH_DURATION;
> +		if (of_property_read_bool(np, "aspeed,ext-active-high"))
> +			reg |= WDT_ACTIVE_HIGH_MAGIC;
> +		else
> +			reg |= WDT_ACTIVE_LOW_MAGIC;
> +
> +		writel(reg, wdt->base + WDT_RESET_WIDTH);
> +	}
> +
> +	if (!of_property_read_u32(np, "aspeed,ext-pulse-duration", &duration)) {
> +		if (duration > WDT_RESET_WIDTH_DURATION) {
> +			dev_err(&pdev->dev, "Invalid reset width\n");
> +			return -EINVAL;
> +		}
> +
> +		/*
> +		 * The watchdog is always configured with a 1MHz source, so
> +		 * there is no need to scale the microsecond value.
> +		 */
> +		writel(duration, wdt->base + WDT_RESET_WIDTH);
> +	}
> +
>   	ret = watchdog_register_device(&wdt->wdd);
>   	if (ret) {
>   		dev_err(&pdev->dev, "failed to register\n");


[-- Attachment #2: Type: text/html, Size: 3238 bytes --]

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

* Re: [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull
  2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull Andrew Jeffery
@ 2017-07-31 20:25   ` Matt Spinler
  0 siblings, 0 replies; 12+ messages in thread
From: Matt Spinler @ 2017-07-31 20:25 UTC (permalink / raw)
  To: Andrew Jeffery, joel; +Cc: msbarth, openbmc

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Tested-by: Matt Spinler mspinler@linux.vnet.ibm.com


On 7/27/2017 5:16 AM, Andrew Jeffery wrote:
> Fix the drive and polarity of WDTRST1 with respect to the latch design
> which assert the FAULT pin on the MAX31785 across a BMC reset. This
> ensures the fan outputs are ramped to 100% PWM duty.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
> ---
>   arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> index c28222c17d03..6a7ab9648984 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> @@ -488,6 +488,8 @@
>   &wdt1 {
>   	aspeed,reset-type = "none";
>   	aspeed,external-signal;
> +	aspeed,ext-push-pull;
> +	aspeed,ext-active-high;
>
>   	pinctrl-names = "default";
>   	pinctrl-0 = <&pinctrl_wdtrst1_default>;


[-- Attachment #2: Type: text/html, Size: 1636 bytes --]

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

* Re: [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function
  2017-07-31 20:24   ` Matt Spinler
@ 2017-08-01  0:14     ` Joel Stanley
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Stanley @ 2017-08-01  0:14 UTC (permalink / raw)
  To: Matt Spinler; +Cc: Andrew Jeffery, msbarth, OpenBMC Maillist

On Tue, Aug 1, 2017 at 5:54 AM, Matt Spinler
<mspinler@linux.vnet.ibm.com> wrote:
>
>
> On 7/27/2017 5:16 AM, Andrew Jeffery wrote:
>
> On Witherspoon, the Aspeed SoC's WDTRST1 pin is wired to the FAULT pin
> on the MAX31785 fan controller, which drives the fans to 100% PWM duty
> when asserted. The pulse generated by the watchdog is latched to ensure
> the fans stay at full speed across the BMC reboot. The latch is reset
> when the BMC transitions through the chassis-poweron systemd target.
>
> The SoC's WDTRST1 pinctrl function needs to be requested for
> aspeed,external-signal to be effective, otherwise the pin is not
> associated with the watchdog controller.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>

> Tested-by: Matt Spinler   mspinler@linux.vnet.ibm.com

Applied to dev-4.10.

Thanks for the testing Matt!

Cheers,

Joel

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

end of thread, other threads:[~2017-08-01  0:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 10:16 [PATCH linux dev-4.10 v3 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
2017-07-31 20:24   ` Matt Spinler
2017-08-01  0:14     ` Joel Stanley
2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
2017-07-28  1:41   ` Joel Stanley
2017-07-28  1:47     ` Andrew Jeffery
2017-07-31 20:24   ` Matt Spinler
2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 3/4] watchdog: aspeed: Support configuration of external " Andrew Jeffery
2017-07-31 20:24   ` Matt Spinler
2017-07-27 10:16 ` [PATCH linux dev-4.10 v3 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull Andrew Jeffery
2017-07-31 20:25   ` Matt Spinler

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.