* [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot
@ 2018-03-15 16:02 Eddie James
2018-03-16 5:18 ` Joel Stanley
2018-03-16 5:27 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Eddie James @ 2018-03-15 16:02 UTC (permalink / raw)
To: linux-watchdog; +Cc: linux-kernel, joel, wim, linux, Milton Miller, Eddie James
From: Milton Miller <miltonm@us.ibm.com>
Allow the device tree to specify a watchdog to fallover to
the alternate boot source.
The aspeeed watchdog can set a latch directing flash chip select 0 to
chip select 1, allowing boot from an alternate media if the watchdog
is not reset in time. On the ast2400 bank 1 also goes to flash bank 1,
while on the ast2500 the chip selects are swapped.
Also clear the secondary boot bit during the machine restart operation.
Otherwise, the system will switch to the alternate boot after every
reboot, which is not desired.
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
---
Changes since v1:
* Disable secondary boot before the restart operation.
drivers/watchdog/aspeed_wdt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index d1987d6..a5b8eb2 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -46,6 +46,7 @@ struct aspeed_wdt_config {
#define WDT_RELOAD_VALUE 0x04
#define WDT_RESTART 0x08
#define WDT_CTRL 0x0C
+#define WDT_CTRL_BOOT_SECONDARY BIT(7)
#define WDT_CTRL_RESET_MODE_SOC (0x00 << 5)
#define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5)
#define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5)
@@ -158,6 +159,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
{
struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
+ wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
mdelay(1000);
@@ -245,6 +247,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
}
if (of_property_read_bool(np, "aspeed,external-signal"))
wdt->ctrl |= WDT_CTRL_WDT_EXT;
+ if (of_property_read_bool(np, "aspeed,alt-boot"))
+ wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
/*
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot
2018-03-15 16:02 [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot Eddie James
@ 2018-03-16 5:18 ` Joel Stanley
2018-03-16 5:27 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Joel Stanley @ 2018-03-16 5:18 UTC (permalink / raw)
To: Eddie James
Cc: LINUXWATCHDOG, Linux Kernel Mailing List, Wim Van Sebroeck,
Guenter Roeck, Milton Miller
On Fri, Mar 16, 2018 at 2:32 AM, Eddie James <eajames@linux.vnet.ibm.com> wrote:
> From: Milton Miller <miltonm@us.ibm.com>
>
> Allow the device tree to specify a watchdog to fallover to
> the alternate boot source.
>
> The aspeeed watchdog can set a latch directing flash chip select 0 to
> chip select 1, allowing boot from an alternate media if the watchdog
> is not reset in time. On the ast2400 bank 1 also goes to flash bank 1,
> while on the ast2500 the chip selects are swapped.
>
> Also clear the secondary boot bit during the machine restart operation.
> Otherwise, the system will switch to the alternate boot after every
> reboot, which is not desired.
>
> Signed-off-by: Milton Miller <miltonm@us.ibm.com>
> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
That will do.
Reviewed-by: Joel Stanley <joel@jms.id.au>
Cheers,
Joel
> ---
> Changes since v1:
> * Disable secondary boot before the restart operation.
>
> drivers/watchdog/aspeed_wdt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index d1987d6..a5b8eb2 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -46,6 +46,7 @@ struct aspeed_wdt_config {
> #define WDT_RELOAD_VALUE 0x04
> #define WDT_RESTART 0x08
> #define WDT_CTRL 0x0C
> +#define WDT_CTRL_BOOT_SECONDARY BIT(7)
> #define WDT_CTRL_RESET_MODE_SOC (0x00 << 5)
> #define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5)
> #define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5)
> @@ -158,6 +159,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
> {
> struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
>
> + wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
> aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
>
> mdelay(1000);
> @@ -245,6 +247,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
> }
> if (of_property_read_bool(np, "aspeed,external-signal"))
> wdt->ctrl |= WDT_CTRL_WDT_EXT;
> + if (of_property_read_bool(np, "aspeed,alt-boot"))
> + wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
>
> if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
> /*
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot
2018-03-15 16:02 [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot Eddie James
2018-03-16 5:18 ` Joel Stanley
@ 2018-03-16 5:27 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2018-03-16 5:27 UTC (permalink / raw)
To: Eddie James, linux-watchdog; +Cc: linux-kernel, joel, wim, Milton Miller
On 03/15/2018 09:02 AM, Eddie James wrote:
> From: Milton Miller <miltonm@us.ibm.com>
>
> Allow the device tree to specify a watchdog to fallover to
> the alternate boot source.
>
> The aspeeed watchdog can set a latch directing flash chip select 0 to
> chip select 1, allowing boot from an alternate media if the watchdog
> is not reset in time. On the ast2400 bank 1 also goes to flash bank 1,
> while on the ast2500 the chip selects are swapped.
>
> Also clear the secondary boot bit during the machine restart operation.
> Otherwise, the system will switch to the alternate boot after every
> reboot, which is not desired.
>
> Signed-off-by: Milton Miller <miltonm@us.ibm.com>
> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Changes since v1:
> * Disable secondary boot before the restart operation.
>
> drivers/watchdog/aspeed_wdt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index d1987d6..a5b8eb2 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -46,6 +46,7 @@ struct aspeed_wdt_config {
> #define WDT_RELOAD_VALUE 0x04
> #define WDT_RESTART 0x08
> #define WDT_CTRL 0x0C
> +#define WDT_CTRL_BOOT_SECONDARY BIT(7)
> #define WDT_CTRL_RESET_MODE_SOC (0x00 << 5)
> #define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5)
> #define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5)
> @@ -158,6 +159,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
> {
> struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
>
> + wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
> aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
>
> mdelay(1000);
> @@ -245,6 +247,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
> }
> if (of_property_read_bool(np, "aspeed,external-signal"))
> wdt->ctrl |= WDT_CTRL_WDT_EXT;
> + if (of_property_read_bool(np, "aspeed,alt-boot"))
> + wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
>
> if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
> /*
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-16 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 16:02 [PATCH v2] watchdog: aspeed: Allow configuring for alternate boot Eddie James
2018-03-16 5:18 ` Joel Stanley
2018-03-16 5:27 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome