Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-05 Thread Fu Wei
On 5 February 2016 at 00:25, Mathieu Poirier  wrote:
> On 3 February 2016 at 10:18,   wrote:
>> From: Fu Wei 
>>
>> According to Server Base System Architecture (SBSA) specification,
>> the SBSA Generic Watchdog has two stage timeouts: the first signal (WS0)
>> is for alerting the system by interrupt, the second one (WS1) is a real
>> hardware reset.
>>
>> This patch initially implements a simple single stage watchdog driver:
>> when the timeout is reached, your system will be reset by the second
>> signal (WS1).
>> The first signal (WS0) is ignored in this driver.
>>
>> This driver bases on linux kernel watchdog framework, so it can get
>> timeout from module parameter and FDT at the driver init stage.
>>
>> Signed-off-by: Fu Wei 
>> Reviewed-by: Graeme Gregory 
>> Tested-by: Pratyush Anand 
>> ---
>>  drivers/watchdog/Kconfig |  17 +++
>>  drivers/watchdog/Makefile|   1 +
>>  drivers/watchdog/sbsa_gwdt.c | 322 
>> +++
>>  3 files changed, 340 insertions(+)
>>
>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
>> index 4f0e7be..4ab1b05 100644
>> --- a/drivers/watchdog/Kconfig
>> +++ b/drivers/watchdog/Kconfig
>> @@ -201,6 +201,23 @@ config ARM_SP805_WATCHDOG
>>   ARM Primecell SP805 Watchdog timer. This will reboot your system 
>> when
>>   the timeout is reached.
>>
>> +config ARM_SBSA_WATCHDOG
>> +   tristate "ARM SBSA Generic Watchdog"
>> +   depends on ARM64
>> +   depends on ARM_ARCH_TIMER
>> +   select WATCHDOG_CORE
>> +   help
>> + ARM SBSA Generic Watchdog has two stage timeouts:
>> + the first signal (WS0) is for alerting the system by interrupt,
>> + the second one (WS1) is a real hardware reset.
>> + More details: ARM DEN0029B - Server Base System Architecture (SBSA)
>> +
>> + This is a simple single stage driver: when the timeout is reached,
>> + your system will be reset by WS1. The first signal (WS0) is 
>> ignored.
>> +
>> + To compile this driver as module, choose M here: The module
>> + will be called sbsa_gwdt.
>> +
>>  config ASM9260_WATCHDOG
>> tristate "Alphascale ASM9260 watchdog"
>> depends on MACH_ASM9260
>> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
>> index f566753..f9826d4 100644
>> --- a/drivers/watchdog/Makefile
>> +++ b/drivers/watchdog/Makefile
>> @@ -30,6 +30,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
>>
>>  # ARM Architecture
>>  obj-$(CONFIG_ARM_SP805_WATCHDOG) += sp805_wdt.o
>> +obj-$(CONFIG_ARM_SBSA_WATCHDOG) += sbsa_gwdt.o
>>  obj-$(CONFIG_ASM9260_WATCHDOG) += asm9260_wdt.o
>>  obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
>>  obj-$(CONFIG_AT91SAM9X_WATCHDOG) += at91sam9_wdt.o
>> diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
>> new file mode 100644
>> index 000..5a2dba3
>> --- /dev/null
>> +++ b/drivers/watchdog/sbsa_gwdt.c
>> @@ -0,0 +1,322 @@
>> +/*
>> + * SBSA(Server Base System Architecture) Generic Watchdog driver
>> + *
>> + * Copyright (c) 2015, Linaro Ltd.
>> + * Author: Fu Wei 
>> + * Suravee Suthikulpanit 
>> + * Al Stone 
>> + * Timur Tabi 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License 2 as published
>> + * by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * This SBSA Generic watchdog driver is a single stage timeout version.
>> + * Since this watchdog timer has two stages, and each stage is determined
>> + * by WOR. So the timeout is (WOR * 2).
>> + * When first timeout is reached, WS0 is triggered, the interrupt
>> + * triggered by WS0 will be ignored, then the second watch period starts;
>> + * when second timeout is reached, then WS1 is triggered, system reset.
>> + *
>> + * More details about the hardware specification of this device:
>> + * ARM DEN0029B - Server Base System Architecture (SBSA)
>> + *
>> + * SBSA GWDT: |WOR---WS0WOR---WS1
>> + *|timeoutreset
>> + *
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +/* SBSA Generic Watchdog register definitions */
>> +/* refresh frame */
>> +#define SBSA_GWDT_WRR  0x000
>> +
>> +/* control frame */
>> +#define SBSA_GWDT_WCS  0x000
>> +#define SBSA_GWDT_WOR  0x008
>> +#define SBSA_GWDT_WCV  0x010
>> +
>> +/* refresh/control frame */
>> +#define SBSA_GWDT_W_IIDR   0xfcc
>> +#define SBSA_GWDT_IDR 

Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-05 Thread Fu Wei
Hi

On 5 February 2016 at 00:46, Guenter Roeck  wrote:
> On 02/04/2016 08:37 AM, Timur Tabi wrote:
>>
>> Will Deacon wrote:

 +static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)
 >+{
 >+struct sbsa_gwdt *gwdt = to_sbsa_gwdt(wdd);
 >+
 >+/*
 >+* Writing WRR for an explicit watchdog refresh.
 >+* You can write anyting(like 0xc0ffee).
 >+*/
 >+writel(0xc0ffee, gwdt->refresh_base + SBSA_GWDT_WRR);
 >+
 >+return 0;
 >+}
>>>
>>> You might get in trouble for that. 0xd09f00d is probably less poisonous.
>>>
>>> http://www.petpoisonhelpline.com/poison/caffeine/
>>
>>
>> Any reason why we can't just keep it simple and write 0?
>
>
> +1

yes, we can, just "0" would be fine, will do.

Thanks :-)

>
> Guenter
>



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
Ph: +86 21 61221326(direct)
Ph: +86 186 2020 4684 (mobile)
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-04 Thread Guenter Roeck

On 02/04/2016 08:37 AM, Timur Tabi wrote:

Will Deacon wrote:

+static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)
>+{
>+struct sbsa_gwdt *gwdt = to_sbsa_gwdt(wdd);
>+
>+/*
>+* Writing WRR for an explicit watchdog refresh.
>+* You can write anyting(like 0xc0ffee).
>+*/
>+writel(0xc0ffee, gwdt->refresh_base + SBSA_GWDT_WRR);
>+
>+return 0;
>+}

You might get in trouble for that. 0xd09f00d is probably less poisonous.

http://www.petpoisonhelpline.com/poison/caffeine/


Any reason why we can't just keep it simple and write 0?


+1

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-04 Thread Timur Tabi

Will Deacon wrote:

+static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)
>+{
>+   struct sbsa_gwdt *gwdt = to_sbsa_gwdt(wdd);
>+
>+   /*
>+   * Writing WRR for an explicit watchdog refresh.
>+   * You can write anyting(like 0xc0ffee).
>+   */
>+   writel(0xc0ffee, gwdt->refresh_base + SBSA_GWDT_WRR);
>+
>+   return 0;
>+}

You might get in trouble for that. 0xd09f00d is probably less poisonous.

http://www.petpoisonhelpline.com/poison/caffeine/


Any reason why we can't just keep it simple and write 0?
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-04 Thread Will Deacon
On Thu, Feb 04, 2016 at 01:18:42AM +0800, fu@linaro.org wrote:
> +static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)
> +{
> + struct sbsa_gwdt *gwdt = to_sbsa_gwdt(wdd);
> +
> + /*
> + * Writing WRR for an explicit watchdog refresh.
> + * You can write anyting(like 0xc0ffee).
> + */
> + writel(0xc0ffee, gwdt->refresh_base + SBSA_GWDT_WRR);
> +
> + return 0;
> +}

You might get in trouble for that. 0xd09f00d is probably less poisonous.

http://www.petpoisonhelpline.com/poison/caffeine/

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-04 Thread Mathieu Poirier
On 3 February 2016 at 10:18,   wrote:
> From: Fu Wei 
>
> According to Server Base System Architecture (SBSA) specification,
> the SBSA Generic Watchdog has two stage timeouts: the first signal (WS0)
> is for alerting the system by interrupt, the second one (WS1) is a real
> hardware reset.
>
> This patch initially implements a simple single stage watchdog driver:
> when the timeout is reached, your system will be reset by the second
> signal (WS1).
> The first signal (WS0) is ignored in this driver.
>
> This driver bases on linux kernel watchdog framework, so it can get
> timeout from module parameter and FDT at the driver init stage.
>
> Signed-off-by: Fu Wei 
> Reviewed-by: Graeme Gregory 
> Tested-by: Pratyush Anand 
> ---
>  drivers/watchdog/Kconfig |  17 +++
>  drivers/watchdog/Makefile|   1 +
>  drivers/watchdog/sbsa_gwdt.c | 322 
> +++
>  3 files changed, 340 insertions(+)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 4f0e7be..4ab1b05 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -201,6 +201,23 @@ config ARM_SP805_WATCHDOG
>   ARM Primecell SP805 Watchdog timer. This will reboot your system 
> when
>   the timeout is reached.
>
> +config ARM_SBSA_WATCHDOG
> +   tristate "ARM SBSA Generic Watchdog"
> +   depends on ARM64
> +   depends on ARM_ARCH_TIMER
> +   select WATCHDOG_CORE
> +   help
> + ARM SBSA Generic Watchdog has two stage timeouts:
> + the first signal (WS0) is for alerting the system by interrupt,
> + the second one (WS1) is a real hardware reset.
> + More details: ARM DEN0029B - Server Base System Architecture (SBSA)
> +
> + This is a simple single stage driver: when the timeout is reached,
> + your system will be reset by WS1. The first signal (WS0) is ignored.
> +
> + To compile this driver as module, choose M here: The module
> + will be called sbsa_gwdt.
> +
>  config ASM9260_WATCHDOG
> tristate "Alphascale ASM9260 watchdog"
> depends on MACH_ASM9260
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index f566753..f9826d4 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -30,6 +30,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
>
>  # ARM Architecture
>  obj-$(CONFIG_ARM_SP805_WATCHDOG) += sp805_wdt.o
> +obj-$(CONFIG_ARM_SBSA_WATCHDOG) += sbsa_gwdt.o
>  obj-$(CONFIG_ASM9260_WATCHDOG) += asm9260_wdt.o
>  obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
>  obj-$(CONFIG_AT91SAM9X_WATCHDOG) += at91sam9_wdt.o
> diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
> new file mode 100644
> index 000..5a2dba3
> --- /dev/null
> +++ b/drivers/watchdog/sbsa_gwdt.c
> @@ -0,0 +1,322 @@
> +/*
> + * SBSA(Server Base System Architecture) Generic Watchdog driver
> + *
> + * Copyright (c) 2015, Linaro Ltd.
> + * Author: Fu Wei 
> + * Suravee Suthikulpanit 
> + * Al Stone 
> + * Timur Tabi 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License 2 as published
> + * by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * This SBSA Generic watchdog driver is a single stage timeout version.
> + * Since this watchdog timer has two stages, and each stage is determined
> + * by WOR. So the timeout is (WOR * 2).
> + * When first timeout is reached, WS0 is triggered, the interrupt
> + * triggered by WS0 will be ignored, then the second watch period starts;
> + * when second timeout is reached, then WS1 is triggered, system reset.
> + *
> + * More details about the hardware specification of this device:
> + * ARM DEN0029B - Server Base System Architecture (SBSA)
> + *
> + * SBSA GWDT: |WOR---WS0WOR---WS1
> + *|timeoutreset
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* SBSA Generic Watchdog register definitions */
> +/* refresh frame */
> +#define SBSA_GWDT_WRR  0x000
> +
> +/* control frame */
> +#define SBSA_GWDT_WCS  0x000
> +#define SBSA_GWDT_WOR  0x008
> +#define SBSA_GWDT_WCV  0x010
> +
> +/* refresh/control frame */
> +#define SBSA_GWDT_W_IIDR   0xfcc
> +#define SBSA_GWDT_IDR  0xfd0
> +
> +/* Watchdog Control and Status Register */
> +#define SBSA_GWDT_WCS_EN   BIT(0)
> +#define SBSA_GWDT_WCS_WS0 

Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread Timur Tabi

Fu Wei wrote:

static const struct platform_device_id sbsa_gwdt_pdev_match[] = {
  { .name = "sbsa-gwdt", },
  {},
};
MODULE_DEVICE_TABLE(platform, sbsa_gwdt_pdev_match);


Ok, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread Fu Wei
On 4 February 2016 at 01:58, Timur Tabi  wrote:
> Fu Wei wrote:
>>
>> I have posted  GTDT support separately :https://lkml.org/lkml/2016/2/1/660
>>
>> devicetree driver and GTDT driver both export sbsa gwdt info to
>> "platform resource".
>>
>> this driver get hardware info from platform resource.
>
>
> I must be missing something.  How does the driver probe?  It only has an

maybe you miss a  line of code for platform resource :

-
static const struct platform_device_id sbsa_gwdt_pdev_match[] = {
 { .name = "sbsa-gwdt", },
 {},
};
MODULE_DEVICE_TABLE(platform, sbsa_gwdt_pdev_match);
-

> entry for device tree:
>
> +   .of_match_table = sbsa_gwdt_of_match,
>
> Doesn't there need to be an ACPI match table to probe on an ACPI system?

No, we don't. And this have been tested.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
Ph: +86 21 61221326(direct)
Ph: +86 186 2020 4684 (mobile)
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread Timur Tabi

Fu Wei wrote:

I have posted  GTDT support separately :https://lkml.org/lkml/2016/2/1/660

devicetree driver and GTDT driver both export sbsa gwdt info to
"platform resource".

this driver get hardware info from platform resource.


I must be missing something.  How does the driver probe?  It only has an 
entry for device tree:


+   .of_match_table = sbsa_gwdt_of_match,

Doesn't there need to be an ACPI match table to probe on an ACPI system?
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread Fu Wei
Hi Timur,

On 4 February 2016 at 01:48, Timur Tabi  wrote:
> fu@linaro.org wrote:
>>
>> +static struct platform_driver sbsa_gwdt_driver = {
>> +   .driver = {
>> +   .name = "sbsa-gwdt",
>> +   .pm = &sbsa_gwdt_pm_ops,
>> +   .of_match_table = sbsa_gwdt_of_match,
>> +   },
>> +   .probe = sbsa_gwdt_probe,
>> +   .remove = sbsa_gwdt_remove,
>> +   .shutdown = sbsa_gwdt_shutdown,
>> +   .id_table = sbsa_gwdt_pdev_match,
>> +};
>
>
> I just noticed you dropped ACPI support.  Server platforms are supposed to
> use ACPI, so that seems like a critical omission to me.  You had a GTDT
> parser in an older version of this patch.  What happened to it?

I have posted  GTDT support separately : https://lkml.org/lkml/2016/2/1/660

devicetree driver and GTDT driver both export sbsa gwdt info to
"platform resource".

this driver get hardware info from platform resource.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
Ph: +86 21 61221326(direct)
Ph: +86 186 2020 4684 (mobile)
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread Timur Tabi

fu@linaro.org wrote:

+static struct platform_driver sbsa_gwdt_driver = {
+   .driver = {
+   .name = "sbsa-gwdt",
+   .pm = &sbsa_gwdt_pm_ops,
+   .of_match_table = sbsa_gwdt_of_match,
+   },
+   .probe = sbsa_gwdt_probe,
+   .remove = sbsa_gwdt_remove,
+   .shutdown = sbsa_gwdt_shutdown,
+   .id_table = sbsa_gwdt_pdev_match,
+};


I just noticed you dropped ACPI support.  Server platforms are supposed 
to use ACPI, so that seems like a critical omission to me.  You had a 
GTDT parser in an older version of this patch.  What happened to it?

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v10 4/5] Watchdog: introduce ARM SBSA watchdog driver

2016-02-03 Thread fu . wei
From: Fu Wei 

According to Server Base System Architecture (SBSA) specification,
the SBSA Generic Watchdog has two stage timeouts: the first signal (WS0)
is for alerting the system by interrupt, the second one (WS1) is a real
hardware reset.

This patch initially implements a simple single stage watchdog driver:
when the timeout is reached, your system will be reset by the second
signal (WS1).
The first signal (WS0) is ignored in this driver.

This driver bases on linux kernel watchdog framework, so it can get
timeout from module parameter and FDT at the driver init stage.

Signed-off-by: Fu Wei 
Reviewed-by: Graeme Gregory 
Tested-by: Pratyush Anand 
---
 drivers/watchdog/Kconfig |  17 +++
 drivers/watchdog/Makefile|   1 +
 drivers/watchdog/sbsa_gwdt.c | 322 +++
 3 files changed, 340 insertions(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 4f0e7be..4ab1b05 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -201,6 +201,23 @@ config ARM_SP805_WATCHDOG
  ARM Primecell SP805 Watchdog timer. This will reboot your system when
  the timeout is reached.
 
+config ARM_SBSA_WATCHDOG
+   tristate "ARM SBSA Generic Watchdog"
+   depends on ARM64
+   depends on ARM_ARCH_TIMER
+   select WATCHDOG_CORE
+   help
+ ARM SBSA Generic Watchdog has two stage timeouts:
+ the first signal (WS0) is for alerting the system by interrupt,
+ the second one (WS1) is a real hardware reset.
+ More details: ARM DEN0029B - Server Base System Architecture (SBSA)
+
+ This is a simple single stage driver: when the timeout is reached,
+ your system will be reset by WS1. The first signal (WS0) is ignored.
+
+ To compile this driver as module, choose M here: The module
+ will be called sbsa_gwdt.
+
 config ASM9260_WATCHDOG
tristate "Alphascale ASM9260 watchdog"
depends on MACH_ASM9260
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index f566753..f9826d4 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
 
 # ARM Architecture
 obj-$(CONFIG_ARM_SP805_WATCHDOG) += sp805_wdt.o
+obj-$(CONFIG_ARM_SBSA_WATCHDOG) += sbsa_gwdt.o
 obj-$(CONFIG_ASM9260_WATCHDOG) += asm9260_wdt.o
 obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
 obj-$(CONFIG_AT91SAM9X_WATCHDOG) += at91sam9_wdt.o
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
new file mode 100644
index 000..5a2dba3
--- /dev/null
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -0,0 +1,322 @@
+/*
+ * SBSA(Server Base System Architecture) Generic Watchdog driver
+ *
+ * Copyright (c) 2015, Linaro Ltd.
+ * Author: Fu Wei 
+ * Suravee Suthikulpanit 
+ * Al Stone 
+ * Timur Tabi 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This SBSA Generic watchdog driver is a single stage timeout version.
+ * Since this watchdog timer has two stages, and each stage is determined
+ * by WOR. So the timeout is (WOR * 2).
+ * When first timeout is reached, WS0 is triggered, the interrupt
+ * triggered by WS0 will be ignored, then the second watch period starts;
+ * when second timeout is reached, then WS1 is triggered, system reset.
+ *
+ * More details about the hardware specification of this device:
+ * ARM DEN0029B - Server Base System Architecture (SBSA)
+ *
+ * SBSA GWDT: |WOR---WS0WOR---WS1
+ *|timeoutreset
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* SBSA Generic Watchdog register definitions */
+/* refresh frame */
+#define SBSA_GWDT_WRR  0x000
+
+/* control frame */
+#define SBSA_GWDT_WCS  0x000
+#define SBSA_GWDT_WOR  0x008
+#define SBSA_GWDT_WCV  0x010
+
+/* refresh/control frame */
+#define SBSA_GWDT_W_IIDR   0xfcc
+#define SBSA_GWDT_IDR  0xfd0
+
+/* Watchdog Control and Status Register */
+#define SBSA_GWDT_WCS_EN   BIT(0)
+#define SBSA_GWDT_WCS_WS0  BIT(1)
+#define SBSA_GWDT_WCS_WS1  BIT(2)
+
+/**
+ * struct sbsa_gwdt - Internal representation of the SBSA GWDT
+ * @wdd:   kernel watchdog_device structure
+ * @clk:   store the System Counter clock frequency, in Hz.
+ * @refresh_base:  Virtual