[PATCH linux dev-4.10 v2 3/4] watchdog: aspeed: Support external signal drive and polarity bindings

Andrew Jeffery andrew at aj.id.au
Thu Jul 27 06:51:04 AEST 2017



On Thu, Jul 27, 2017, at 03:22, Matt Spinler wrote:
> 
> 
> On 7/26/2017 11:08 AM, Andrew Jeffery wrote:
> > These bindings are optional, and only relevant on the AST2500 and
> > compatible watchdog controllers.
> >
> > Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> > ---
> >   drivers/watchdog/aspeed_wdt.c | 21 +++++++++++++++++++++
> >   1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> > index d29f75e90bb6..9a07ef176054 100644
> > --- a/drivers/watchdog/aspeed_wdt.c
> > +++ b/drivers/watchdog/aspeed_wdt.c
> > @@ -42,6 +42,9 @@ 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_RESET_WIDTH_PUSHPULL	BIT(30)
> >
> >   #define WDT_RESTART_MAGIC	0x4755
> >
> > @@ -204,6 +207,24 @@ 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 from = readl(wdt->base + WDT_RESET_WIDTH);
> > +		u32 to = from;
> > +
> > +		if (of_property_read_bool(np, "aspeed,ext-push-pull"))
> > +			to |= WDT_RESET_WIDTH_PUSHPULL;
> > +		else
> > +			to &= ~WDT_RESET_WIDTH_PUSHPULL;
>  From the spec:
> 
> To set this bit to value ’1’, write bit[31:24] = 0xA8.
> To set this bit to value ’0’, write bit[31:24] = 0x8A.

Oof. Yeah, clearly I should have gone to bed earlier. I tested the patch
under qemu but forgot to model that behaviour.

> 
> > +
> > +		if (of_property_read_bool(np, "aspeed,ext-active-high"))
> > +			to |= WDT_RESET_WIDTH_ACTIVE_HIGH;
> > +		else
> > +			to &= ~WDT_RESET_WIDTH_ACTIVE_HIGH;
> > +
> And again here:
> To set this bit to value ’1’, write bit[31:24] = 0xA5.
> To set this bit to value ’0’, write bit[31:24] = 0x5A.
> For others value, this bit will keep old value without change.

As above.

Sorry about that.

Andrew

> > +		if (from != to)
> > +			writel(to, wdt->base + WDT_RESET_WIDTH);
> > +	}
> > +
> >   	ret = watchdog_register_device(&wdt->wdd);
> >   	if (ret) {
> >   		dev_err(&pdev->dev, "failed to register\n");
> 


More information about the openbmc mailing list