* [PATCH v2 0/2] watchdog: sunxi: Add A31 watchdog support @ 2014-09-21 16:05 ` Chen-Yu Tsai 0 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: Wim Van Sebroeck, Maxime Ripard Cc: Chen-Yu Tsai, Guenter Roeck, linux-watchdog, linux-arm-kernel Hi, This is v2 of the Allwinner A31 watchdog support series. This series adds support for the watchdog hardware found in Allwinner A31 and later SoCs. These new chips have multiple watchdogs, with separate interrupt lines and registers, but the basic layout and operation is the same. This series is based on Guenter's restart handler series. Patch 1 prepares the sunxi-wdt driver for varying register offsets tied to compatible strings. Various ioread32/iowrite32 calls have been replaced with readl/writel as well. Patch 2 adds the sun6i compatible string with accompanying register offset data. I tested this series on my Cubieboard (sun4i) and A23 tablet (sun8i), which has the same watchdog hardware as the A31 (sun6i). This covers the 2 classes of hardware supported. After this series is merged, we can remove the power/reset driver for sun6i. Changes since v1: - Mention replacing ioread32/iowrite32 calls in patch 1 commit message. Cheers ChenYu Chen-Yu Tsai (2): watchdog: sunxi: support parameterized compatible strings watchdog: sunxi: Add A31 watchdog support drivers/watchdog/sunxi_wdt.c | 111 +++++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 25 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 0/2] watchdog: sunxi: Add A31 watchdog support @ 2014-09-21 16:05 ` Chen-Yu Tsai 0 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: linux-arm-kernel Hi, This is v2 of the Allwinner A31 watchdog support series. This series adds support for the watchdog hardware found in Allwinner A31 and later SoCs. These new chips have multiple watchdogs, with separate interrupt lines and registers, but the basic layout and operation is the same. This series is based on Guenter's restart handler series. Patch 1 prepares the sunxi-wdt driver for varying register offsets tied to compatible strings. Various ioread32/iowrite32 calls have been replaced with readl/writel as well. Patch 2 adds the sun6i compatible string with accompanying register offset data. I tested this series on my Cubieboard (sun4i) and A23 tablet (sun8i), which has the same watchdog hardware as the A31 (sun6i). This covers the 2 classes of hardware supported. After this series is merged, we can remove the power/reset driver for sun6i. Changes since v1: - Mention replacing ioread32/iowrite32 calls in patch 1 commit message. Cheers ChenYu Chen-Yu Tsai (2): watchdog: sunxi: support parameterized compatible strings watchdog: sunxi: Add A31 watchdog support drivers/watchdog/sunxi_wdt.c | 111 +++++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 25 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings 2014-09-21 16:05 ` Chen-Yu Tsai @ 2014-09-21 16:05 ` Chen-Yu Tsai -1 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: Wim Van Sebroeck, Maxime Ripard Cc: Chen-Yu Tsai, Guenter Roeck, linux-watchdog, linux-arm-kernel This patch adds support for hardware parameters tied to compatible strings, so similar hardware can reuse the driver. This will be used to support the newer watchdog found in A31 and later SoCs. Differences in the new hardware include separate interrupt lines for each watchdog, and corresponding interrupt control/status registers. Watchdog control registers were also slightly rearranged. Also replace ioread32()/iowrite32() with readl()/writel() in various places changed. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/watchdog/sunxi_wdt.c | 101 ++++++++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index 480bb55..a1f7113 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -23,6 +23,7 @@ #include <linux/moduleparam.h> #include <linux/notifier.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reboot.h> #include <linux/types.h> @@ -30,15 +31,11 @@ #define WDT_MAX_TIMEOUT 16 #define WDT_MIN_TIMEOUT 1 -#define WDT_MODE_TIMEOUT(n) ((n) << 3) -#define WDT_TIMEOUT_MASK WDT_MODE_TIMEOUT(0x0F) +#define WDT_TIMEOUT_MASK 0x0F -#define WDT_CTRL 0x00 #define WDT_CTRL_RELOAD ((1 << 0) | (0x0a57 << 1)) -#define WDT_MODE 0x04 #define WDT_MODE_EN (1 << 0) -#define WDT_MODE_RST_EN (1 << 1) #define DRV_NAME "sunxi-wdt" #define DRV_VERSION "1.0" @@ -46,15 +43,29 @@ static bool nowayout = WATCHDOG_NOWAYOUT; static unsigned int timeout = WDT_MAX_TIMEOUT; +/* + * This structure stores the register offsets for different variants + * of Allwinner's watchdog hardware. + */ +struct sunxi_wdt_reg { + u8 wdt_ctrl; + u8 wdt_cfg; + u8 wdt_mode; + u8 wdt_timeout_shift; + u8 wdt_reset_mask; + u8 wdt_reset_val; +}; + struct sunxi_wdt_dev { struct watchdog_device wdt_dev; void __iomem *wdt_base; + const struct sunxi_wdt_reg *wdt_regs; struct notifier_block restart_handler; }; /* * wdt_timeout_map maps the watchdog timer interval value in seconds to - * the value of the register WDT_MODE bit 3:6 + * the value of the register WDT_MODE at bits .wdt_timeout_shift ~ +3 * * [timeout seconds] = register value * @@ -82,19 +93,32 @@ static int sunxi_restart_handle(struct notifier_block *this, unsigned long mode, struct sunxi_wdt_dev, restart_handler); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; + u32 val; + + /* Set system reset function */ + val = readl(wdt_base + regs->wdt_cfg); + val &= ~(regs->wdt_reset_mask); + val |= regs->wdt_reset_val; + writel(val, wdt_base + regs->wdt_cfg); - /* Enable timer and set reset bit in the watchdog */ - writel(WDT_MODE_EN | WDT_MODE_RST_EN, wdt_base + WDT_MODE); + /* Set lowest timeout and enable watchdog */ + val = readl(wdt_base + regs->wdt_mode); + val &= ~(WDT_TIMEOUT_MASK << regs->wdt_timeout_shift); + val |= WDT_MODE_EN; + writel(val, wdt_base + regs->wdt_mode); /* * Restart the watchdog. The default (and lowest) interval * value for the watchdog is 0.5s. */ - writel(WDT_CTRL_RELOAD, wdt_base + WDT_CTRL); + writel(WDT_CTRL_RELOAD, wdt_base + regs->wdt_ctrl); while (1) { mdelay(5); - writel(WDT_MODE_EN | WDT_MODE_RST_EN, wdt_base + WDT_MODE); + val = readl(wdt_base + regs->wdt_mode); + val |= WDT_MODE_EN; + writel(val, wdt_base + regs->wdt_mode); } return NOTIFY_DONE; } @@ -103,8 +127,9 @@ static int sunxi_wdt_ping(struct watchdog_device *wdt_dev) { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; - iowrite32(WDT_CTRL_RELOAD, wdt_base + WDT_CTRL); + writel(WDT_CTRL_RELOAD, wdt_base + regs->wdt_ctrl); return 0; } @@ -114,6 +139,7 @@ static int sunxi_wdt_set_timeout(struct watchdog_device *wdt_dev, { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; u32 reg; if (wdt_timeout_map[timeout] == 0) @@ -121,10 +147,10 @@ static int sunxi_wdt_set_timeout(struct watchdog_device *wdt_dev, sunxi_wdt->wdt_dev.timeout = timeout; - reg = ioread32(wdt_base + WDT_MODE); - reg &= ~WDT_TIMEOUT_MASK; - reg |= WDT_MODE_TIMEOUT(wdt_timeout_map[timeout]); - iowrite32(reg, wdt_base + WDT_MODE); + reg = readl(wdt_base + regs->wdt_mode); + reg &= ~(WDT_TIMEOUT_MASK << regs->wdt_timeout_shift); + reg |= wdt_timeout_map[timeout] << regs->wdt_timeout_shift; + writel(reg, wdt_base + regs->wdt_mode); sunxi_wdt_ping(wdt_dev); @@ -135,8 +161,9 @@ static int sunxi_wdt_stop(struct watchdog_device *wdt_dev) { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; - iowrite32(0, wdt_base + WDT_MODE); + writel(0, wdt_base + regs->wdt_mode); return 0; } @@ -146,6 +173,7 @@ static int sunxi_wdt_start(struct watchdog_device *wdt_dev) u32 reg; struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; int ret; ret = sunxi_wdt_set_timeout(&sunxi_wdt->wdt_dev, @@ -153,9 +181,16 @@ static int sunxi_wdt_start(struct watchdog_device *wdt_dev) if (ret < 0) return ret; - reg = ioread32(wdt_base + WDT_MODE); - reg |= (WDT_MODE_RST_EN | WDT_MODE_EN); - iowrite32(reg, wdt_base + WDT_MODE); + /* Set system reset function */ + reg = readl(wdt_base + regs->wdt_cfg); + reg &= ~(regs->wdt_reset_mask); + reg |= ~(regs->wdt_reset_val); + writel(reg, wdt_base + regs->wdt_cfg); + + /* Enable watchdog */ + reg = readl(wdt_base + regs->wdt_mode); + reg |= WDT_MODE_EN; + writel(reg, wdt_base + regs->wdt_mode); return 0; } @@ -175,9 +210,25 @@ static const struct watchdog_ops sunxi_wdt_ops = { .set_timeout = sunxi_wdt_set_timeout, }; +static const struct sunxi_wdt_reg sun4i_wdt_reg = { + .wdt_ctrl = 0x00, + .wdt_cfg = 0x04, + .wdt_mode = 0x04, + .wdt_timeout_shift = 3, + .wdt_reset_mask = 0x02, + .wdt_reset_val = 0x02, +}; + +static const struct of_device_id sunxi_wdt_dt_ids[] = { + { .compatible = "allwinner,sun4i-a10-wdt", .data = &sun4i_wdt_reg }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); + static int sunxi_wdt_probe(struct platform_device *pdev) { struct sunxi_wdt_dev *sunxi_wdt; + const struct of_device_id *device; struct resource *res; int err; @@ -187,6 +238,12 @@ static int sunxi_wdt_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sunxi_wdt); + device = of_match_device(sunxi_wdt_dt_ids, &pdev->dev); + if (!device) + return -ENODEV; + + sunxi_wdt->wdt_regs = device->data; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sunxi_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(sunxi_wdt->wdt_base)) @@ -242,12 +299,6 @@ static void sunxi_wdt_shutdown(struct platform_device *pdev) sunxi_wdt_stop(&sunxi_wdt->wdt_dev); } -static const struct of_device_id sunxi_wdt_dt_ids[] = { - { .compatible = "allwinner,sun4i-a10-wdt" }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); - static struct platform_driver sunxi_wdt_driver = { .probe = sunxi_wdt_probe, .remove = sunxi_wdt_remove, -- 2.1.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings @ 2014-09-21 16:05 ` Chen-Yu Tsai 0 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: linux-arm-kernel This patch adds support for hardware parameters tied to compatible strings, so similar hardware can reuse the driver. This will be used to support the newer watchdog found in A31 and later SoCs. Differences in the new hardware include separate interrupt lines for each watchdog, and corresponding interrupt control/status registers. Watchdog control registers were also slightly rearranged. Also replace ioread32()/iowrite32() with readl()/writel() in various places changed. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/watchdog/sunxi_wdt.c | 101 ++++++++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index 480bb55..a1f7113 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -23,6 +23,7 @@ #include <linux/moduleparam.h> #include <linux/notifier.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reboot.h> #include <linux/types.h> @@ -30,15 +31,11 @@ #define WDT_MAX_TIMEOUT 16 #define WDT_MIN_TIMEOUT 1 -#define WDT_MODE_TIMEOUT(n) ((n) << 3) -#define WDT_TIMEOUT_MASK WDT_MODE_TIMEOUT(0x0F) +#define WDT_TIMEOUT_MASK 0x0F -#define WDT_CTRL 0x00 #define WDT_CTRL_RELOAD ((1 << 0) | (0x0a57 << 1)) -#define WDT_MODE 0x04 #define WDT_MODE_EN (1 << 0) -#define WDT_MODE_RST_EN (1 << 1) #define DRV_NAME "sunxi-wdt" #define DRV_VERSION "1.0" @@ -46,15 +43,29 @@ static bool nowayout = WATCHDOG_NOWAYOUT; static unsigned int timeout = WDT_MAX_TIMEOUT; +/* + * This structure stores the register offsets for different variants + * of Allwinner's watchdog hardware. + */ +struct sunxi_wdt_reg { + u8 wdt_ctrl; + u8 wdt_cfg; + u8 wdt_mode; + u8 wdt_timeout_shift; + u8 wdt_reset_mask; + u8 wdt_reset_val; +}; + struct sunxi_wdt_dev { struct watchdog_device wdt_dev; void __iomem *wdt_base; + const struct sunxi_wdt_reg *wdt_regs; struct notifier_block restart_handler; }; /* * wdt_timeout_map maps the watchdog timer interval value in seconds to - * the value of the register WDT_MODE bit 3:6 + * the value of the register WDT_MODE@bits .wdt_timeout_shift ~ +3 * * [timeout seconds] = register value * @@ -82,19 +93,32 @@ static int sunxi_restart_handle(struct notifier_block *this, unsigned long mode, struct sunxi_wdt_dev, restart_handler); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; + u32 val; + + /* Set system reset function */ + val = readl(wdt_base + regs->wdt_cfg); + val &= ~(regs->wdt_reset_mask); + val |= regs->wdt_reset_val; + writel(val, wdt_base + regs->wdt_cfg); - /* Enable timer and set reset bit in the watchdog */ - writel(WDT_MODE_EN | WDT_MODE_RST_EN, wdt_base + WDT_MODE); + /* Set lowest timeout and enable watchdog */ + val = readl(wdt_base + regs->wdt_mode); + val &= ~(WDT_TIMEOUT_MASK << regs->wdt_timeout_shift); + val |= WDT_MODE_EN; + writel(val, wdt_base + regs->wdt_mode); /* * Restart the watchdog. The default (and lowest) interval * value for the watchdog is 0.5s. */ - writel(WDT_CTRL_RELOAD, wdt_base + WDT_CTRL); + writel(WDT_CTRL_RELOAD, wdt_base + regs->wdt_ctrl); while (1) { mdelay(5); - writel(WDT_MODE_EN | WDT_MODE_RST_EN, wdt_base + WDT_MODE); + val = readl(wdt_base + regs->wdt_mode); + val |= WDT_MODE_EN; + writel(val, wdt_base + regs->wdt_mode); } return NOTIFY_DONE; } @@ -103,8 +127,9 @@ static int sunxi_wdt_ping(struct watchdog_device *wdt_dev) { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; - iowrite32(WDT_CTRL_RELOAD, wdt_base + WDT_CTRL); + writel(WDT_CTRL_RELOAD, wdt_base + regs->wdt_ctrl); return 0; } @@ -114,6 +139,7 @@ static int sunxi_wdt_set_timeout(struct watchdog_device *wdt_dev, { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; u32 reg; if (wdt_timeout_map[timeout] == 0) @@ -121,10 +147,10 @@ static int sunxi_wdt_set_timeout(struct watchdog_device *wdt_dev, sunxi_wdt->wdt_dev.timeout = timeout; - reg = ioread32(wdt_base + WDT_MODE); - reg &= ~WDT_TIMEOUT_MASK; - reg |= WDT_MODE_TIMEOUT(wdt_timeout_map[timeout]); - iowrite32(reg, wdt_base + WDT_MODE); + reg = readl(wdt_base + regs->wdt_mode); + reg &= ~(WDT_TIMEOUT_MASK << regs->wdt_timeout_shift); + reg |= wdt_timeout_map[timeout] << regs->wdt_timeout_shift; + writel(reg, wdt_base + regs->wdt_mode); sunxi_wdt_ping(wdt_dev); @@ -135,8 +161,9 @@ static int sunxi_wdt_stop(struct watchdog_device *wdt_dev) { struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; - iowrite32(0, wdt_base + WDT_MODE); + writel(0, wdt_base + regs->wdt_mode); return 0; } @@ -146,6 +173,7 @@ static int sunxi_wdt_start(struct watchdog_device *wdt_dev) u32 reg; struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = sunxi_wdt->wdt_base; + const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs; int ret; ret = sunxi_wdt_set_timeout(&sunxi_wdt->wdt_dev, @@ -153,9 +181,16 @@ static int sunxi_wdt_start(struct watchdog_device *wdt_dev) if (ret < 0) return ret; - reg = ioread32(wdt_base + WDT_MODE); - reg |= (WDT_MODE_RST_EN | WDT_MODE_EN); - iowrite32(reg, wdt_base + WDT_MODE); + /* Set system reset function */ + reg = readl(wdt_base + regs->wdt_cfg); + reg &= ~(regs->wdt_reset_mask); + reg |= ~(regs->wdt_reset_val); + writel(reg, wdt_base + regs->wdt_cfg); + + /* Enable watchdog */ + reg = readl(wdt_base + regs->wdt_mode); + reg |= WDT_MODE_EN; + writel(reg, wdt_base + regs->wdt_mode); return 0; } @@ -175,9 +210,25 @@ static const struct watchdog_ops sunxi_wdt_ops = { .set_timeout = sunxi_wdt_set_timeout, }; +static const struct sunxi_wdt_reg sun4i_wdt_reg = { + .wdt_ctrl = 0x00, + .wdt_cfg = 0x04, + .wdt_mode = 0x04, + .wdt_timeout_shift = 3, + .wdt_reset_mask = 0x02, + .wdt_reset_val = 0x02, +}; + +static const struct of_device_id sunxi_wdt_dt_ids[] = { + { .compatible = "allwinner,sun4i-a10-wdt", .data = &sun4i_wdt_reg }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); + static int sunxi_wdt_probe(struct platform_device *pdev) { struct sunxi_wdt_dev *sunxi_wdt; + const struct of_device_id *device; struct resource *res; int err; @@ -187,6 +238,12 @@ static int sunxi_wdt_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sunxi_wdt); + device = of_match_device(sunxi_wdt_dt_ids, &pdev->dev); + if (!device) + return -ENODEV; + + sunxi_wdt->wdt_regs = device->data; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sunxi_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(sunxi_wdt->wdt_base)) @@ -242,12 +299,6 @@ static void sunxi_wdt_shutdown(struct platform_device *pdev) sunxi_wdt_stop(&sunxi_wdt->wdt_dev); } -static const struct of_device_id sunxi_wdt_dt_ids[] = { - { .compatible = "allwinner,sun4i-a10-wdt" }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); - static struct platform_driver sunxi_wdt_driver = { .probe = sunxi_wdt_probe, .remove = sunxi_wdt_remove, -- 2.1.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings 2014-09-21 16:05 ` Chen-Yu Tsai @ 2014-09-21 16:32 ` Guenter Roeck -1 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-21 16:32 UTC (permalink / raw) To: Chen-Yu Tsai, Wim Van Sebroeck, Maxime Ripard Cc: linux-watchdog, linux-arm-kernel On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: > This patch adds support for hardware parameters tied to compatible > strings, so similar hardware can reuse the driver. > > This will be used to support the newer watchdog found in A31 and > later SoCs. Differences in the new hardware include separate > interrupt lines for each watchdog, and corresponding interrupt > control/status registers. Watchdog control registers were also > slightly rearranged. > > Also replace ioread32()/iowrite32() with readl()/writel() in various > places changed. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings @ 2014-09-21 16:32 ` Guenter Roeck 0 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-21 16:32 UTC (permalink / raw) To: linux-arm-kernel On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: > This patch adds support for hardware parameters tied to compatible > strings, so similar hardware can reuse the driver. > > This will be used to support the newer watchdog found in A31 and > later SoCs. Differences in the new hardware include separate > interrupt lines for each watchdog, and corresponding interrupt > control/status registers. Watchdog control registers were also > slightly rearranged. > > Also replace ioread32()/iowrite32() with readl()/writel() in various > places changed. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings 2014-09-21 16:32 ` Guenter Roeck @ 2014-09-26 8:29 ` Chen-Yu Tsai -1 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-26 8:29 UTC (permalink / raw) To: Guenter Roeck Cc: Wim Van Sebroeck, Maxime Ripard, linux-watchdog, linux-arm-kernel On Mon, Sep 22, 2014 at 12:32 AM, Guenter Roeck <linux@roeck-us.net> wrote: > On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: >> >> This patch adds support for hardware parameters tied to compatible >> strings, so similar hardware can reuse the driver. >> >> This will be used to support the newer watchdog found in A31 and >> later SoCs. Differences in the new hardware include separate >> interrupt lines for each watchdog, and corresponding interrupt >> control/status registers. Watchdog control registers were also >> slightly rearranged. >> >> Also replace ioread32()/iowrite32() with readl()/writel() in various >> places changed. >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org> > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > Hi Guenter, Are you submitting the restart handler patches for inclusion in 3.18? If so, are you taking any related patches or patches depending on that series? Thanks ChenYu ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings @ 2014-09-26 8:29 ` Chen-Yu Tsai 0 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-26 8:29 UTC (permalink / raw) To: linux-arm-kernel On Mon, Sep 22, 2014 at 12:32 AM, Guenter Roeck <linux@roeck-us.net> wrote: > On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: >> >> This patch adds support for hardware parameters tied to compatible >> strings, so similar hardware can reuse the driver. >> >> This will be used to support the newer watchdog found in A31 and >> later SoCs. Differences in the new hardware include separate >> interrupt lines for each watchdog, and corresponding interrupt >> control/status registers. Watchdog control registers were also >> slightly rearranged. >> >> Also replace ioread32()/iowrite32() with readl()/writel() in various >> places changed. >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org> > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > Hi Guenter, Are you submitting the restart handler patches for inclusion in 3.18? If so, are you taking any related patches or patches depending on that series? Thanks ChenYu ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings 2014-09-26 8:29 ` Chen-Yu Tsai @ 2014-09-26 13:58 ` Guenter Roeck -1 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-26 13:58 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Wim Van Sebroeck, Maxime Ripard, linux-watchdog, linux-arm-kernel On 09/26/2014 01:29 AM, Chen-Yu Tsai wrote: > On Mon, Sep 22, 2014 at 12:32 AM, Guenter Roeck <linux@roeck-us.net> wrote: >> On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: >>> >>> This patch adds support for hardware parameters tied to compatible >>> strings, so similar hardware can reuse the driver. >>> >>> This will be used to support the newer watchdog found in A31 and >>> later SoCs. Differences in the new hardware include separate >>> interrupt lines for each watchdog, and corresponding interrupt >>> control/status registers. Watchdog control registers were also >>> slightly rearranged. >>> >>> Also replace ioread32()/iowrite32() with readl()/writel() in various >>> places changed. >>> >>> Signed-off-by: Chen-Yu Tsai <wens@csie.org> >> >> >> Reviewed-by: Guenter Roeck <linux@roeck-us.net> >> > > Hi Guenter, > > Are you submitting the restart handler patches for inclusion in 3.18? Yes, should go in through Andrew's tree or through one of the branches depending on it. > If so, are you taking any related patches or patches depending on > that series? > In general no, but I just sent a pull request pointing to an immutable branch containing the series. Affected maintainers should merge this branch into the affected subject branch(es). I do have a number of related patches in my watchdog-next branch. I'll send an updated pull request with those to Wim later today. Thanks, Guenter ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings @ 2014-09-26 13:58 ` Guenter Roeck 0 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-26 13:58 UTC (permalink / raw) To: linux-arm-kernel On 09/26/2014 01:29 AM, Chen-Yu Tsai wrote: > On Mon, Sep 22, 2014 at 12:32 AM, Guenter Roeck <linux@roeck-us.net> wrote: >> On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: >>> >>> This patch adds support for hardware parameters tied to compatible >>> strings, so similar hardware can reuse the driver. >>> >>> This will be used to support the newer watchdog found in A31 and >>> later SoCs. Differences in the new hardware include separate >>> interrupt lines for each watchdog, and corresponding interrupt >>> control/status registers. Watchdog control registers were also >>> slightly rearranged. >>> >>> Also replace ioread32()/iowrite32() with readl()/writel() in various >>> places changed. >>> >>> Signed-off-by: Chen-Yu Tsai <wens@csie.org> >> >> >> Reviewed-by: Guenter Roeck <linux@roeck-us.net> >> > > Hi Guenter, > > Are you submitting the restart handler patches for inclusion in 3.18? Yes, should go in through Andrew's tree or through one of the branches depending on it. > If so, are you taking any related patches or patches depending on > that series? > In general no, but I just sent a pull request pointing to an immutable branch containing the series. Affected maintainers should merge this branch into the affected subject branch(es). I do have a number of related patches in my watchdog-next branch. I'll send an updated pull request with those to Wim later today. Thanks, Guenter ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 2/2] watchdog: sunxi: Add A31 watchdog support 2014-09-21 16:05 ` Chen-Yu Tsai @ 2014-09-21 16:05 ` Chen-Yu Tsai -1 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: Wim Van Sebroeck, Maxime Ripard Cc: Chen-Yu Tsai, Guenter Roeck, linux-watchdog, linux-arm-kernel This patch adds support for the watchdog hardware found in A31 and newer SoCs. This new hardware has registers at different offsets, and the system reset control has been split out of the "mode" register into a new "configuration" register. Differences not supported by this driver include separate interrupt lines for each watchdog, instead of sharing an interrupt line and registers with the timer block. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/watchdog/sunxi_wdt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index a1f7113..b62301e 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -219,8 +219,18 @@ static const struct sunxi_wdt_reg sun4i_wdt_reg = { .wdt_reset_val = 0x02, }; +static const struct sunxi_wdt_reg sun6i_wdt_reg = { + .wdt_ctrl = 0x10, + .wdt_cfg = 0x14, + .wdt_mode = 0x18, + .wdt_timeout_shift = 4, + .wdt_reset_mask = 0x03, + .wdt_reset_val = 0x01, +}; + static const struct of_device_id sunxi_wdt_dt_ids[] = { { .compatible = "allwinner,sun4i-a10-wdt", .data = &sun4i_wdt_reg }, + { .compatible = "allwinner,sun6i-a31-wdt", .data = &sun6i_wdt_reg }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); -- 2.1.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/2] watchdog: sunxi: Add A31 watchdog support @ 2014-09-21 16:05 ` Chen-Yu Tsai 0 siblings, 0 replies; 16+ messages in thread From: Chen-Yu Tsai @ 2014-09-21 16:05 UTC (permalink / raw) To: linux-arm-kernel This patch adds support for the watchdog hardware found in A31 and newer SoCs. This new hardware has registers at different offsets, and the system reset control has been split out of the "mode" register into a new "configuration" register. Differences not supported by this driver include separate interrupt lines for each watchdog, instead of sharing an interrupt line and registers with the timer block. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/watchdog/sunxi_wdt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index a1f7113..b62301e 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -219,8 +219,18 @@ static const struct sunxi_wdt_reg sun4i_wdt_reg = { .wdt_reset_val = 0x02, }; +static const struct sunxi_wdt_reg sun6i_wdt_reg = { + .wdt_ctrl = 0x10, + .wdt_cfg = 0x14, + .wdt_mode = 0x18, + .wdt_timeout_shift = 4, + .wdt_reset_mask = 0x03, + .wdt_reset_val = 0x01, +}; + static const struct of_device_id sunxi_wdt_dt_ids[] = { { .compatible = "allwinner,sun4i-a10-wdt", .data = &sun4i_wdt_reg }, + { .compatible = "allwinner,sun6i-a31-wdt", .data = &sun6i_wdt_reg }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); -- 2.1.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/2] watchdog: sunxi: Add A31 watchdog support 2014-09-21 16:05 ` Chen-Yu Tsai @ 2014-09-21 16:32 ` Guenter Roeck -1 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-21 16:32 UTC (permalink / raw) To: Chen-Yu Tsai, Wim Van Sebroeck, Maxime Ripard Cc: linux-watchdog, linux-arm-kernel On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: > This patch adds support for the watchdog hardware found in A31 and > newer SoCs. This new hardware has registers at different offsets, and > the system reset control has been split out of the "mode" register > into a new "configuration" register. > > Differences not supported by this driver include separate interrupt > lines for each watchdog, instead of sharing an interrupt line and > registers with the timer block. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 2/2] watchdog: sunxi: Add A31 watchdog support @ 2014-09-21 16:32 ` Guenter Roeck 0 siblings, 0 replies; 16+ messages in thread From: Guenter Roeck @ 2014-09-21 16:32 UTC (permalink / raw) To: linux-arm-kernel On 09/21/2014 09:05 AM, Chen-Yu Tsai wrote: > This patch adds support for the watchdog hardware found in A31 and > newer SoCs. This new hardware has registers at different offsets, and > the system reset control has been split out of the "mode" register > into a new "configuration" register. > > Differences not supported by this driver include separate interrupt > lines for each watchdog, instead of sharing an interrupt line and > registers with the timer block. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/2] watchdog: sunxi: Add A31 watchdog support 2014-09-21 16:05 ` Chen-Yu Tsai @ 2014-09-21 16:46 ` Maxime Ripard -1 siblings, 0 replies; 16+ messages in thread From: Maxime Ripard @ 2014-09-21 16:46 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1310 bytes --] Hi, On Mon, Sep 22, 2014 at 12:05:17AM +0800, Chen-Yu Tsai wrote: > Hi, > > This is v2 of the Allwinner A31 watchdog support series. This series adds > support for the watchdog hardware found in Allwinner A31 and later SoCs. > These new chips have multiple watchdogs, with separate interrupt lines > and registers, but the basic layout and operation is the same. This series > is based on Guenter's restart handler series. > > Patch 1 prepares the sunxi-wdt driver for varying register offsets tied to > compatible strings. Various ioread32/iowrite32 calls have been replaced with > readl/writel as well. > > Patch 2 adds the sun6i compatible string with accompanying register offset > data. > > I tested this series on my Cubieboard (sun4i) and A23 tablet (sun8i), which > has the same watchdog hardware as the A31 (sun6i). This covers the 2 classes > of hardware supported. > > After this series is merged, we can remove the power/reset driver for sun6i. > > > Changes since v1: > - Mention replacing ioread32/iowrite32 calls in patch 1 commit message. On the whole series, Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 0/2] watchdog: sunxi: Add A31 watchdog support @ 2014-09-21 16:46 ` Maxime Ripard 0 siblings, 0 replies; 16+ messages in thread From: Maxime Ripard @ 2014-09-21 16:46 UTC (permalink / raw) To: linux-arm-kernel Hi, On Mon, Sep 22, 2014 at 12:05:17AM +0800, Chen-Yu Tsai wrote: > Hi, > > This is v2 of the Allwinner A31 watchdog support series. This series adds > support for the watchdog hardware found in Allwinner A31 and later SoCs. > These new chips have multiple watchdogs, with separate interrupt lines > and registers, but the basic layout and operation is the same. This series > is based on Guenter's restart handler series. > > Patch 1 prepares the sunxi-wdt driver for varying register offsets tied to > compatible strings. Various ioread32/iowrite32 calls have been replaced with > readl/writel as well. > > Patch 2 adds the sun6i compatible string with accompanying register offset > data. > > I tested this series on my Cubieboard (sun4i) and A23 tablet (sun8i), which > has the same watchdog hardware as the A31 (sun6i). This covers the 2 classes > of hardware supported. > > After this series is merged, we can remove the power/reset driver for sun6i. > > > Changes since v1: > - Mention replacing ioread32/iowrite32 calls in patch 1 commit message. On the whole series, Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140921/5f1178ab/attachment.sig> ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-09-26 13:58 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-09-21 16:05 [PATCH v2 0/2] watchdog: sunxi: Add A31 watchdog support Chen-Yu Tsai 2014-09-21 16:05 ` Chen-Yu Tsai 2014-09-21 16:05 ` [PATCH v2 1/2] watchdog: sunxi: support parameterized compatible strings Chen-Yu Tsai 2014-09-21 16:05 ` Chen-Yu Tsai 2014-09-21 16:32 ` Guenter Roeck 2014-09-21 16:32 ` Guenter Roeck 2014-09-26 8:29 ` Chen-Yu Tsai 2014-09-26 8:29 ` Chen-Yu Tsai 2014-09-26 13:58 ` Guenter Roeck 2014-09-26 13:58 ` Guenter Roeck 2014-09-21 16:05 ` [PATCH v2 2/2] watchdog: sunxi: Add A31 watchdog support Chen-Yu Tsai 2014-09-21 16:05 ` Chen-Yu Tsai 2014-09-21 16:32 ` Guenter Roeck 2014-09-21 16:32 ` Guenter Roeck 2014-09-21 16:46 ` [PATCH v2 0/2] " Maxime Ripard 2014-09-21 16:46 ` Maxime Ripard
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.