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

Matt Spinler mspinler at linux.vnet.ibm.com
Thu Jul 27 03:52:41 AEST 2017



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.

> +
> +		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.
> +		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