* [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support
@ 2014-01-06 21:56 Markus Mayer
2014-01-06 21:56 ` [PATCH v2 1/2] " Markus Mayer
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Markus Mayer @ 2014-01-06 21:56 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Christian Daudt
Cc: Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List,
Markus Mayer
This series adds debugfs support to the bcm281xx watchdog driver. Most
of the code submitted here was already included as part of v5 of the
original driver submission. See
http://www.spinics.net/lists/linux-watchdog/msg03328.html
This series is dependent on commit
bd90ccd42c5d6317979c62919ba1c79fd34fa785 in linux-watchdog-next.
Changes since v1 of this series:
- http://www.spinics.net/lists/linux-watchdog/msg03544.html has been
included here
- bcm_kona_wdt_debug_init() and bcm_kona_wdt_debugfs_init() as well as
bcm_kona_wdt_debug_exit() and bcm_kona_debugfs_exit() were merged
together, so now there are just two instead of four functions
Markus Mayer (2):
watchdog: bcm281xx: Debugfs support
watchdog: bcm281xx: Turn on debugfs support for watchdog driver
arch/arm/configs/bcm_defconfig | 1 +
drivers/watchdog/Kconfig | 10 ++++
drivers/watchdog/bcm_kona_wdt.c | 108 +++++++++++++++++++++++++++++++++++++--
3 files changed, 115 insertions(+), 4 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/2] watchdog: bcm281xx: Debugfs support 2014-01-06 21:56 [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Markus Mayer @ 2014-01-06 21:56 ` Markus Mayer 2014-01-13 18:14 ` Markus Mayer 2014-01-06 21:56 ` [PATCH v2 2/2] watchdog: bcm281xx: Turn on debugfs support for watchdog driver Markus Mayer 2014-01-13 21:10 ` [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Wim Van Sebroeck 2 siblings, 1 reply; 6+ messages in thread From: Markus Mayer @ 2014-01-06 21:56 UTC (permalink / raw) To: Wim Van Sebroeck, Guenter Roeck, Christian Daudt Cc: Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List, Markus Mayer This change introduces debugfs support for the BCM281xx watchdog driver. Signed-off-by: Markus Mayer <markus.mayer@linaro.org> --- drivers/watchdog/Kconfig | 10 ++++ drivers/watchdog/bcm_kona_wdt.c | 108 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 10d188a..af8f7c7 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1152,6 +1152,16 @@ config BCM_KONA_WDT Say 'Y' or 'M' here to enable the driver. The module will be called bcm_kona_wdt. +config BCM_KONA_WDT_DEBUG + bool "DEBUGFS support for BCM Kona Watchdog" + depends on BCM_KONA_WDT + help + If enabled, adds /sys/kernel/debug/bcm_kona_wdt/info which provides + access to the driver's internal data structures as well as watchdog + timer hardware registres. + + If in doubt, say 'N'. + config LANTIQ_WDT tristate "Lantiq SoC watchdog" depends on LANTIQ diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c index 7e41a83..9c24809 100644 --- a/drivers/watchdog/bcm_kona_wdt.c +++ b/drivers/watchdog/bcm_kona_wdt.c @@ -11,6 +11,7 @@ * GNU General Public License for more details. */ +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> @@ -55,9 +56,13 @@ struct bcm_kona_wdt { */ int resolution; spinlock_t lock; +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + unsigned long busy_count; + struct dentry *debugfs; +#endif }; -static int secure_register_read(void __iomem *addr) +static int secure_register_read(struct bcm_kona_wdt *wdt, uint32_t offset) { uint32_t val; unsigned count = 0; @@ -70,10 +75,16 @@ static int secure_register_read(void __iomem *addr) do { if (unlikely(count > 1)) udelay(5); - val = readl_relaxed(addr); + val = readl_relaxed(wdt->base + offset); count++; } while ((val & SECWDOG_WD_LOAD_FLAG) && count < SECWDOG_MAX_TRY); +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + /* Remember the maximum number iterations due to WD_LOAD_FLAG */ + if (count > wdt->busy_count) + wdt->busy_count = count; +#endif + /* This is the only place we return a negative value. */ if (val & SECWDOG_WD_LOAD_FLAG) return -ETIMEDOUT; @@ -84,6 +95,93 @@ static int secure_register_read(void __iomem *addr) return val; } +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + +static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data) +{ + int ctl_val, cur_val, ret; + unsigned long flags; + struct bcm_kona_wdt *wdt = s->private; + + if (!wdt) + return seq_puts(s, "No device pointer\n"); + + spin_lock_irqsave(&wdt->lock, flags); + ctl_val = secure_register_read(wdt, SECWDOG_CTRL_REG); + cur_val = secure_register_read(wdt, SECWDOG_COUNT_REG); + spin_unlock_irqrestore(&wdt->lock, flags); + + if (ctl_val < 0 || cur_val < 0) { + ret = seq_puts(s, "Error accessing hardware\n"); + } else { + int ctl, cur, ctl_sec, cur_sec, res; + + ctl = ctl_val & SECWDOG_COUNT_MASK; + res = (ctl_val & SECWDOG_RES_MASK) >> SECWDOG_CLKS_SHIFT; + cur = cur_val & SECWDOG_COUNT_MASK; + ctl_sec = TICKS_TO_SECS(ctl, wdt); + cur_sec = TICKS_TO_SECS(cur, wdt); + ret = seq_printf(s, "Resolution: %d / %d\n" + "Control: %d s / %d (%#x) ticks\n" + "Current: %d s / %d (%#x) ticks\n" + "Busy count: %lu\n", res, + wdt->resolution, ctl_sec, ctl, ctl, cur_sec, + cur, cur, wdt->busy_count); + } + + return ret; +} + +static int bcm_kona_dbg_open(struct inode *inode, struct file *file) +{ + return single_open(file, bcm_kona_wdt_dbg_show, inode->i_private); +} + +static const struct file_operations bcm_kona_dbg_operations = { + .open = bcm_kona_dbg_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) +{ + struct dentry *dir; + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); + + if (!wdt) + return; + + wdt->debugfs = NULL; + + dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL); + if (IS_ERR_OR_NULL(dir)) + return; + + if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt, + &bcm_kona_dbg_operations)) + wdt->debugfs = dir; + else + debugfs_remove_recursive(dir); +} + +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) +{ + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); + + if (wdt && wdt->debugfs) { + debugfs_remove_recursive(wdt->debugfs); + wdt->debugfs = NULL; + } +} + +#else + +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) {} +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) {} + +#endif /* CONFIG_BCM_KONA_WDT_DEBUG */ + static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, unsigned mask, unsigned newval) { @@ -93,7 +191,7 @@ static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, spin_lock_irqsave(&wdt->lock, flags); - val = secure_register_read(wdt->base + SECWDOG_CTRL_REG); + val = secure_register_read(wdt, SECWDOG_CTRL_REG); if (val < 0) { ret = val; } else { @@ -140,7 +238,7 @@ static unsigned int bcm_kona_wdt_get_timeleft(struct watchdog_device *wdog) unsigned long flags; spin_lock_irqsave(&wdt->lock, flags); - val = secure_register_read(wdt->base + SECWDOG_COUNT_REG); + val = secure_register_read(wdt, SECWDOG_COUNT_REG); spin_unlock_irqrestore(&wdt->lock, flags); if (val < 0) @@ -229,6 +327,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) return ret; } + bcm_kona_wdt_debug_init(pdev); dev_dbg(dev, "Broadcom Kona Watchdog Timer"); return 0; @@ -236,6 +335,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) static int bcm_kona_wdt_remove(struct platform_device *pdev) { + bcm_kona_wdt_debug_exit(pdev); bcm_kona_wdt_shutdown(pdev); watchdog_unregister_device(&bcm_kona_wdt_wdd); dev_dbg(&pdev->dev, "Watchdog driver disabled"); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] watchdog: bcm281xx: Debugfs support 2014-01-06 21:56 ` [PATCH v2 1/2] " Markus Mayer @ 2014-01-13 18:14 ` Markus Mayer 2014-01-13 19:22 ` Wim Van Sebroeck 0 siblings, 1 reply; 6+ messages in thread From: Markus Mayer @ 2014-01-13 18:14 UTC (permalink / raw) To: Wim Van Sebroeck, Guenter Roeck, Christian Daudt Cc: Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List, Markus Mayer On 6 January 2014 13:56, Markus Mayer <markus.mayer@linaro.org> wrote: > This change introduces debugfs support for the BCM281xx watchdog driver. > > Signed-off-by: Markus Mayer <markus.mayer@linaro.org> > --- > drivers/watchdog/Kconfig | 10 ++++ > drivers/watchdog/bcm_kona_wdt.c | 108 +++++++++++++++++++++++++++++++++++++-- > 2 files changed, 114 insertions(+), 4 deletions(-) > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 10d188a..af8f7c7 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -1152,6 +1152,16 @@ config BCM_KONA_WDT > Say 'Y' or 'M' here to enable the driver. The module will be called > bcm_kona_wdt. > > +config BCM_KONA_WDT_DEBUG > + bool "DEBUGFS support for BCM Kona Watchdog" > + depends on BCM_KONA_WDT > + help > + If enabled, adds /sys/kernel/debug/bcm_kona_wdt/info which provides > + access to the driver's internal data structures as well as watchdog > + timer hardware registres. > + > + If in doubt, say 'N'. > + > config LANTIQ_WDT > tristate "Lantiq SoC watchdog" > depends on LANTIQ > diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c > index 7e41a83..9c24809 100644 > --- a/drivers/watchdog/bcm_kona_wdt.c > +++ b/drivers/watchdog/bcm_kona_wdt.c > @@ -11,6 +11,7 @@ > * GNU General Public License for more details. > */ > > +#include <linux/debugfs.h> > #include <linux/delay.h> > #include <linux/err.h> > #include <linux/io.h> > @@ -55,9 +56,13 @@ struct bcm_kona_wdt { > */ > int resolution; > spinlock_t lock; > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > + unsigned long busy_count; > + struct dentry *debugfs; > +#endif > }; > > -static int secure_register_read(void __iomem *addr) > +static int secure_register_read(struct bcm_kona_wdt *wdt, uint32_t offset) > { > uint32_t val; > unsigned count = 0; > @@ -70,10 +75,16 @@ static int secure_register_read(void __iomem *addr) > do { > if (unlikely(count > 1)) > udelay(5); > - val = readl_relaxed(addr); > + val = readl_relaxed(wdt->base + offset); > count++; > } while ((val & SECWDOG_WD_LOAD_FLAG) && count < SECWDOG_MAX_TRY); > > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > + /* Remember the maximum number iterations due to WD_LOAD_FLAG */ > + if (count > wdt->busy_count) > + wdt->busy_count = count; > +#endif > + > /* This is the only place we return a negative value. */ > if (val & SECWDOG_WD_LOAD_FLAG) > return -ETIMEDOUT; > @@ -84,6 +95,93 @@ static int secure_register_read(void __iomem *addr) > return val; > } > > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > + > +static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data) > +{ > + int ctl_val, cur_val, ret; > + unsigned long flags; > + struct bcm_kona_wdt *wdt = s->private; > + > + if (!wdt) > + return seq_puts(s, "No device pointer\n"); > + > + spin_lock_irqsave(&wdt->lock, flags); > + ctl_val = secure_register_read(wdt, SECWDOG_CTRL_REG); > + cur_val = secure_register_read(wdt, SECWDOG_COUNT_REG); > + spin_unlock_irqrestore(&wdt->lock, flags); > + > + if (ctl_val < 0 || cur_val < 0) { > + ret = seq_puts(s, "Error accessing hardware\n"); > + } else { > + int ctl, cur, ctl_sec, cur_sec, res; > + > + ctl = ctl_val & SECWDOG_COUNT_MASK; > + res = (ctl_val & SECWDOG_RES_MASK) >> SECWDOG_CLKS_SHIFT; > + cur = cur_val & SECWDOG_COUNT_MASK; > + ctl_sec = TICKS_TO_SECS(ctl, wdt); > + cur_sec = TICKS_TO_SECS(cur, wdt); > + ret = seq_printf(s, "Resolution: %d / %d\n" > + "Control: %d s / %d (%#x) ticks\n" > + "Current: %d s / %d (%#x) ticks\n" > + "Busy count: %lu\n", res, > + wdt->resolution, ctl_sec, ctl, ctl, cur_sec, > + cur, cur, wdt->busy_count); > + } > + > + return ret; > +} > + > +static int bcm_kona_dbg_open(struct inode *inode, struct file *file) > +{ > + return single_open(file, bcm_kona_wdt_dbg_show, inode->i_private); > +} > + > +static const struct file_operations bcm_kona_dbg_operations = { > + .open = bcm_kona_dbg_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = single_release, > +}; > + > +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) > +{ > + struct dentry *dir; > + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); > + > + if (!wdt) > + return; > + > + wdt->debugfs = NULL; > + > + dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL); > + if (IS_ERR_OR_NULL(dir)) > + return; > + > + if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt, > + &bcm_kona_dbg_operations)) > + wdt->debugfs = dir; > + else > + debugfs_remove_recursive(dir); > +} > + > +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) > +{ > + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); > + > + if (wdt && wdt->debugfs) { > + debugfs_remove_recursive(wdt->debugfs); > + wdt->debugfs = NULL; > + } > +} > + > +#else > + > +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) {} > +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) {} > + > +#endif /* CONFIG_BCM_KONA_WDT_DEBUG */ > + > static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, > unsigned mask, unsigned newval) > { > @@ -93,7 +191,7 @@ static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, > > spin_lock_irqsave(&wdt->lock, flags); > > - val = secure_register_read(wdt->base + SECWDOG_CTRL_REG); > + val = secure_register_read(wdt, SECWDOG_CTRL_REG); > if (val < 0) { > ret = val; > } else { > @@ -140,7 +238,7 @@ static unsigned int bcm_kona_wdt_get_timeleft(struct watchdog_device *wdog) > unsigned long flags; > > spin_lock_irqsave(&wdt->lock, flags); > - val = secure_register_read(wdt->base + SECWDOG_COUNT_REG); > + val = secure_register_read(wdt, SECWDOG_COUNT_REG); > spin_unlock_irqrestore(&wdt->lock, flags); > > if (val < 0) > @@ -229,6 +327,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) > return ret; > } > > + bcm_kona_wdt_debug_init(pdev); > dev_dbg(dev, "Broadcom Kona Watchdog Timer"); > > return 0; > @@ -236,6 +335,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) > > static int bcm_kona_wdt_remove(struct platform_device *pdev) > { > + bcm_kona_wdt_debug_exit(pdev); > bcm_kona_wdt_shutdown(pdev); > watchdog_unregister_device(&bcm_kona_wdt_wdd); > dev_dbg(&pdev->dev, "Watchdog driver disabled"); > -- > 1.7.9.5 > Hi Wim, I was wondering if this series be queued for 3.14? Thanks, -Markus -- Markus Mayer Broadcom Landing Team ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] watchdog: bcm281xx: Debugfs support 2014-01-13 18:14 ` Markus Mayer @ 2014-01-13 19:22 ` Wim Van Sebroeck 0 siblings, 0 replies; 6+ messages in thread From: Wim Van Sebroeck @ 2014-01-13 19:22 UTC (permalink / raw) To: Markus Mayer Cc: Guenter Roeck, Christian Daudt, Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List Hi Markus, > On 6 January 2014 13:56, Markus Mayer <markus.mayer@linaro.org> wrote: > > This change introduces debugfs support for the BCM281xx watchdog driver. > > > > Signed-off-by: Markus Mayer <markus.mayer@linaro.org> > > --- > > drivers/watchdog/Kconfig | 10 ++++ > > drivers/watchdog/bcm_kona_wdt.c | 108 +++++++++++++++++++++++++++++++++++++-- > > 2 files changed, 114 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > > index 10d188a..af8f7c7 100644 > > --- a/drivers/watchdog/Kconfig > > +++ b/drivers/watchdog/Kconfig > > @@ -1152,6 +1152,16 @@ config BCM_KONA_WDT > > Say 'Y' or 'M' here to enable the driver. The module will be called > > bcm_kona_wdt. > > > > +config BCM_KONA_WDT_DEBUG > > + bool "DEBUGFS support for BCM Kona Watchdog" > > + depends on BCM_KONA_WDT > > + help > > + If enabled, adds /sys/kernel/debug/bcm_kona_wdt/info which provides > > + access to the driver's internal data structures as well as watchdog > > + timer hardware registres. > > + > > + If in doubt, say 'N'. > > + > > config LANTIQ_WDT > > tristate "Lantiq SoC watchdog" > > depends on LANTIQ > > diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c > > index 7e41a83..9c24809 100644 > > --- a/drivers/watchdog/bcm_kona_wdt.c > > +++ b/drivers/watchdog/bcm_kona_wdt.c > > @@ -11,6 +11,7 @@ > > * GNU General Public License for more details. > > */ > > > > +#include <linux/debugfs.h> > > #include <linux/delay.h> > > #include <linux/err.h> > > #include <linux/io.h> > > @@ -55,9 +56,13 @@ struct bcm_kona_wdt { > > */ > > int resolution; > > spinlock_t lock; > > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > > + unsigned long busy_count; > > + struct dentry *debugfs; > > +#endif > > }; > > > > -static int secure_register_read(void __iomem *addr) > > +static int secure_register_read(struct bcm_kona_wdt *wdt, uint32_t offset) > > { > > uint32_t val; > > unsigned count = 0; > > @@ -70,10 +75,16 @@ static int secure_register_read(void __iomem *addr) > > do { > > if (unlikely(count > 1)) > > udelay(5); > > - val = readl_relaxed(addr); > > + val = readl_relaxed(wdt->base + offset); > > count++; > > } while ((val & SECWDOG_WD_LOAD_FLAG) && count < SECWDOG_MAX_TRY); > > > > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > > + /* Remember the maximum number iterations due to WD_LOAD_FLAG */ > > + if (count > wdt->busy_count) > > + wdt->busy_count = count; > > +#endif > > + > > /* This is the only place we return a negative value. */ > > if (val & SECWDOG_WD_LOAD_FLAG) > > return -ETIMEDOUT; > > @@ -84,6 +95,93 @@ static int secure_register_read(void __iomem *addr) > > return val; > > } > > > > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > > + > > +static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data) > > +{ > > + int ctl_val, cur_val, ret; > > + unsigned long flags; > > + struct bcm_kona_wdt *wdt = s->private; > > + > > + if (!wdt) > > + return seq_puts(s, "No device pointer\n"); > > + > > + spin_lock_irqsave(&wdt->lock, flags); > > + ctl_val = secure_register_read(wdt, SECWDOG_CTRL_REG); > > + cur_val = secure_register_read(wdt, SECWDOG_COUNT_REG); > > + spin_unlock_irqrestore(&wdt->lock, flags); > > + > > + if (ctl_val < 0 || cur_val < 0) { > > + ret = seq_puts(s, "Error accessing hardware\n"); > > + } else { > > + int ctl, cur, ctl_sec, cur_sec, res; > > + > > + ctl = ctl_val & SECWDOG_COUNT_MASK; > > + res = (ctl_val & SECWDOG_RES_MASK) >> SECWDOG_CLKS_SHIFT; > > + cur = cur_val & SECWDOG_COUNT_MASK; > > + ctl_sec = TICKS_TO_SECS(ctl, wdt); > > + cur_sec = TICKS_TO_SECS(cur, wdt); > > + ret = seq_printf(s, "Resolution: %d / %d\n" > > + "Control: %d s / %d (%#x) ticks\n" > > + "Current: %d s / %d (%#x) ticks\n" > > + "Busy count: %lu\n", res, > > + wdt->resolution, ctl_sec, ctl, ctl, cur_sec, > > + cur, cur, wdt->busy_count); > > + } > > + > > + return ret; > > +} > > + > > +static int bcm_kona_dbg_open(struct inode *inode, struct file *file) > > +{ > > + return single_open(file, bcm_kona_wdt_dbg_show, inode->i_private); > > +} > > + > > +static const struct file_operations bcm_kona_dbg_operations = { > > + .open = bcm_kona_dbg_open, > > + .read = seq_read, > > + .llseek = seq_lseek, > > + .release = single_release, > > +}; > > + > > +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) > > +{ > > + struct dentry *dir; > > + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); > > + > > + if (!wdt) > > + return; > > + > > + wdt->debugfs = NULL; > > + > > + dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL); > > + if (IS_ERR_OR_NULL(dir)) > > + return; > > + > > + if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt, > > + &bcm_kona_dbg_operations)) > > + wdt->debugfs = dir; > > + else > > + debugfs_remove_recursive(dir); > > +} > > + > > +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) > > +{ > > + struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); > > + > > + if (wdt && wdt->debugfs) { > > + debugfs_remove_recursive(wdt->debugfs); > > + wdt->debugfs = NULL; > > + } > > +} > > + > > +#else > > + > > +static void bcm_kona_wdt_debug_init(struct platform_device *pdev) {} > > +static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) {} > > + > > +#endif /* CONFIG_BCM_KONA_WDT_DEBUG */ > > + > > static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, > > unsigned mask, unsigned newval) > > { > > @@ -93,7 +191,7 @@ static int bcm_kona_wdt_ctrl_reg_modify(struct bcm_kona_wdt *wdt, > > > > spin_lock_irqsave(&wdt->lock, flags); > > > > - val = secure_register_read(wdt->base + SECWDOG_CTRL_REG); > > + val = secure_register_read(wdt, SECWDOG_CTRL_REG); > > if (val < 0) { > > ret = val; > > } else { > > @@ -140,7 +238,7 @@ static unsigned int bcm_kona_wdt_get_timeleft(struct watchdog_device *wdog) > > unsigned long flags; > > > > spin_lock_irqsave(&wdt->lock, flags); > > - val = secure_register_read(wdt->base + SECWDOG_COUNT_REG); > > + val = secure_register_read(wdt, SECWDOG_COUNT_REG); > > spin_unlock_irqrestore(&wdt->lock, flags); > > > > if (val < 0) > > @@ -229,6 +327,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) > > return ret; > > } > > > > + bcm_kona_wdt_debug_init(pdev); > > dev_dbg(dev, "Broadcom Kona Watchdog Timer"); > > > > return 0; > > @@ -236,6 +335,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) > > > > static int bcm_kona_wdt_remove(struct platform_device *pdev) > > { > > + bcm_kona_wdt_debug_exit(pdev); > > bcm_kona_wdt_shutdown(pdev); > > watchdog_unregister_device(&bcm_kona_wdt_wdd); > > dev_dbg(&pdev->dev, "Watchdog driver disabled"); > > -- > > 1.7.9.5 > > > > Hi Wim, > > > I was wondering if this series be queued for 3.14? > That's indeed the goal. Kind regards, Wim. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] watchdog: bcm281xx: Turn on debugfs support for watchdog driver 2014-01-06 21:56 [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Markus Mayer 2014-01-06 21:56 ` [PATCH v2 1/2] " Markus Mayer @ 2014-01-06 21:56 ` Markus Mayer 2014-01-13 21:10 ` [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Wim Van Sebroeck 2 siblings, 0 replies; 6+ messages in thread From: Markus Mayer @ 2014-01-06 21:56 UTC (permalink / raw) To: Wim Van Sebroeck, Guenter Roeck, Christian Daudt Cc: Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List, Markus Mayer This change turns on debugfs support for the BCM281xx watchdog driver. Signed-off-by: Markus Mayer <markus.mayer@linaro.org> --- arch/arm/configs/bcm_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig index 10d1392..d4d0083 100644 --- a/arch/arm/configs/bcm_defconfig +++ b/arch/arm/configs/bcm_defconfig @@ -128,3 +128,4 @@ CONFIG_XZ_DEC=y CONFIG_AVERAGE=y CONFIG_WATCHDOG=y CONFIG_BCM_KONA_WDT=y +CONFIG_BCM_KONA_WDT_DEBUG=y -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support 2014-01-06 21:56 [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Markus Mayer 2014-01-06 21:56 ` [PATCH v2 1/2] " Markus Mayer 2014-01-06 21:56 ` [PATCH v2 2/2] watchdog: bcm281xx: Turn on debugfs support for watchdog driver Markus Mayer @ 2014-01-13 21:10 ` Wim Van Sebroeck 2 siblings, 0 replies; 6+ messages in thread From: Wim Van Sebroeck @ 2014-01-13 21:10 UTC (permalink / raw) To: Markus Mayer Cc: Guenter Roeck, Christian Daudt, Linaro Patches, Linux Watchdog List, Linux Kernel Mailing List Hi Markus, > This series adds debugfs support to the bcm281xx watchdog driver. Most > of the code submitted here was already included as part of v5 of the > original driver submission. See > http://www.spinics.net/lists/linux-watchdog/msg03328.html > > This series is dependent on commit > bd90ccd42c5d6317979c62919ba1c79fd34fa785 in linux-watchdog-next. > > Changes since v1 of this series: > > - http://www.spinics.net/lists/linux-watchdog/msg03544.html has been > included here > > - bcm_kona_wdt_debug_init() and bcm_kona_wdt_debugfs_init() as well as > bcm_kona_wdt_debug_exit() and bcm_kona_debugfs_exit() were merged > together, so now there are just two instead of four functions > > Markus Mayer (2): > watchdog: bcm281xx: Debugfs support > watchdog: bcm281xx: Turn on debugfs support for watchdog driver > > arch/arm/configs/bcm_defconfig | 1 + > drivers/watchdog/Kconfig | 10 ++++ > drivers/watchdog/bcm_kona_wdt.c | 108 +++++++++++++++++++++++++++++++++++++-- > 3 files changed, 115 insertions(+), 4 deletions(-) This patch was added to linux-watchdog-next. Kind regards, Wim. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-13 21:10 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-06 21:56 [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Markus Mayer 2014-01-06 21:56 ` [PATCH v2 1/2] " Markus Mayer 2014-01-13 18:14 ` Markus Mayer 2014-01-13 19:22 ` Wim Van Sebroeck 2014-01-06 21:56 ` [PATCH v2 2/2] watchdog: bcm281xx: Turn on debugfs support for watchdog driver Markus Mayer 2014-01-13 21:10 ` [PATCH v2 0/2] watchdog: bcm281xx: Debugfs support Wim Van Sebroeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).