diff for duplicates of <1258051487.2280.2@antares> diff --git a/a/1.txt b/N1/1.txt index c75eacc..324ee5e 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,6 +1,6 @@ Merge the WDT code into the GPT interface. -Signed-off-by: Albrecht Dre=DF <albrecht.dress@arcor.de> +Signed-off-by: Albrecht Dreß <albrecht.dress-KvP5wT2u2U0@public.gmane.org> --- Change against v1: fully merge the wdt api into this file. @@ -8,12 +8,10 @@ Note: The patch does also include the tiny GPT api changes from <http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-November/077647.html>. arch/powerpc/include/asm/mpc52xx.h | 5 +- - arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 328 +++++++++++++++++++++++++= -++-- + arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 328 +++++++++++++++++++++++++++-- 2 files changed, 312 insertions(+), 21 deletions(-) -diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/= -mpc52xx.h +diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h index 707ab75..b664ce7 100644 --- a/arch/powerpc/include/asm/mpc52xx.h +++ b/arch/powerpc/include/asm/mpc52xx.h @@ -21,10 +19,8 @@ index 707ab75..b664ce7 100644 /* mpc52xx_gpt.c */ struct mpc52xx_gpt_priv; extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq); --extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int perio= -d, -+extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 perio= -d, +-extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, ++extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, int continuous); -extern void mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); +extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt); @@ -32,8 +28,7 @@ d, /* mpc52xx_lpbfifo.c */ #define MPC52XX_LPBFIFO_FLAG_READ (0) -diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platf= -orms/52xx/mpc52xx_gpt.c +diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index 2c3fa13..42caecf 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -46,12 +41,9 @@ index 2c3fa13..42caecf 100644 + * device. Timer functions are not yet supported. + * + * The timer gpt0 can be used as watchdog (wdt). If the wdt mode is used, -+ * this prevents the use of any gpt0 gpt function (i.e. they will fail wit= -h -+ * -EBUSY). Thus, the safety wdt function always has precedence over the = -gpt -+ * function. If the kernel has been compiled with CONFIG_WATCHDOG_NOWAYOU= -T, ++ * this prevents the use of any gpt0 gpt function (i.e. they will fail with ++ * -EBUSY). Thus, the safety wdt function always has precedence over the gpt ++ * function. If the kernel has been compiled with CONFIG_WATCHDOG_NOWAYOUT, + * this means that gpt0 is locked in wdt mode until the next reboot - this + * may be a requirement in safety applications. * @@ -69,7 +61,7 @@ T, MODULE_DESCRIPTION("Freescale MPC52xx gpt driver"); -MODULE_AUTHOR("Sascha Hauer, Grant Likely"); -+MODULE_AUTHOR("Sascha Hauer, Grant Likely, Albrecht Dre=DF"); ++MODULE_AUTHOR("Sascha Hauer, Grant Likely, Albrecht Dreß"); MODULE_LICENSE("GPL"); /** @@ -77,8 +69,7 @@ T, * @lock: spinlock to coordinate between different functions. * @of_gc: of_gpio_chip instance structure; used when GPIO is enabled * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported -+ * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicate= -s ++ * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates + * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates + * if the timer is actively used as wdt which blocks gpt functions */ @@ -133,33 +124,31 @@ s { u32 clear, set; u64 clocks; -@@ -393,15 +405,19 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *= -gpt, int period, +@@ -393,15 +405,19 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, - clear =3D MPC52xx_GPT_MODE_MS_MASK | MPC52xx_GPT_MODE_CONTINUOUS; - set =3D MPC52xx_GPT_MODE_MS_GPIO | MPC52xx_GPT_MODE_COUNTER_ENABLE; + clear = MPC52xx_GPT_MODE_MS_MASK | MPC52xx_GPT_MODE_CONTINUOUS; + set = MPC52xx_GPT_MODE_MS_GPIO | MPC52xx_GPT_MODE_COUNTER_ENABLE; - if (continuous) + if (as_wdt) { -+ clear |=3D MPC52xx_GPT_MODE_IRQ_EN; -+ set |=3D MPC52xx_GPT_MODE_WDT_EN; ++ clear |= MPC52xx_GPT_MODE_IRQ_EN; ++ set |= MPC52xx_GPT_MODE_WDT_EN; + } else if (continuous) - set |=3D MPC52xx_GPT_MODE_CONTINUOUS; + set |= MPC52xx_GPT_MODE_CONTINUOUS; /* Determine the number of clocks in the requested period. 64 bit * arithmatic is done here to preserve the precision until the value * is scaled back down into the u32 range. Period is in 'ns', bus - * frequency is in Hz. */ -- clocks =3D (u64)period * (u64)gpt->ipb_freq; +- clocks = (u64)period * (u64)gpt->ipb_freq; - do_div(clocks, 1000000000); /* Scale it down to ns range */ + * frequency is in Hz. The maximum timeout @33MHz IPB clock is ~130 + * seconds*/ -+ clocks =3D period * (u64)gpt->ipb_freq; ++ clocks = period * (u64)gpt->ipb_freq; + do_div(clocks, 1000000000ULL); /* Scale it down to ns range */ /* This device cannot handle a clock count greater than 32 bits */ if (clocks > 0xffffffff) -@@ -427,22 +443,279 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv = -*gpt, int period, +@@ -427,22 +443,279 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, return -EINVAL; } @@ -167,8 +156,8 @@ gpt, int period, + /* Set and enable the timer, reject an attempt to use a wdt as gpt */ spin_lock_irqsave(&gpt->lock, flags); + if (as_wdt) -+ gpt->wdt_mode |=3D MPC52xx_GPT_IS_WDT; -+ else if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) !=3D 0) { ++ gpt->wdt_mode |= MPC52xx_GPT_IS_WDT; ++ else if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) { + spin_unlock_irqrestore(&gpt->lock, flags); + return -EBUSY; + } @@ -207,7 +196,7 @@ gpt, int period, + + /* reject the operation if the timer is used as watchdog (gpt 0 only) */ + spin_lock_irqsave(&gpt->lock, flags); -+ if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) !=3D 0) { ++ if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) { + spin_unlock_irqrestore(&gpt->lock, flags); + return -EBUSY; + } @@ -231,14 +220,14 @@ gpt, int period, + unsigned long flags; + + spin_lock_irqsave(&gpt->lock, flags); -+ period =3D in_be32(&gpt->regs->count); ++ period = in_be32(&gpt->regs->count); + spin_unlock_irqrestore(&gpt->lock, flags); + -+ prescale =3D period >> 16; -+ period &=3D 0xffff; -+ if (prescale =3D=3D 0) -+ prescale =3D 0x10000; -+ period =3D period * prescale * 1000000000ULL; ++ prescale = period >> 16; ++ period &= 0xffff; ++ if (prescale == 0) ++ prescale = 0x10000; ++ period = period * prescale * 1000000000ULL; + do_div(period, (u64)gpt->ipb_freq); + return period; +} @@ -251,8 +240,7 @@ gpt, int period, + +#define WDT_IDENTITY "mpc52xx watchdog on GPT0" + -+/* wdt_is_active stores wether or not the /dev/watchdog device is opened *= -/ ++/* wdt_is_active stores wether or not the /dev/watchdog device is opened */ +static unsigned long wdt_is_active; + +/* wdt-capable gpt */ @@ -269,40 +257,39 @@ gpt, int period, +} + +/* wdt misc device api */ -+static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *dat= -a, ++static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data, + size_t len, loff_t *ppos) +{ -+ struct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data; ++ struct mpc52xx_gpt_priv *gpt_wdt = file->private_data; + mpc52xx_gpt_wdt_ping(gpt_wdt); + return 0; +} + -+static struct watchdog_info mpc5200_wdt_info =3D { -+ .options =3D WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, -+ .identity =3D WDT_IDENTITY, ++static struct watchdog_info mpc5200_wdt_info = { ++ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, ++ .identity = WDT_IDENTITY, +}; + +static long mpc52xx_wdt_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ -+ struct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data; -+ int __user *data =3D (int __user *)arg; ++ struct mpc52xx_gpt_priv *gpt_wdt = file->private_data; ++ int __user *data = (int __user *)arg; + int timeout; + u64 real_timeout; -+ int ret =3D 0; ++ int ret = 0; + + switch (cmd) { + case WDIOC_GETSUPPORT: -+ ret =3D copy_to_user(data, &mpc5200_wdt_info, ++ ret = copy_to_user(data, &mpc5200_wdt_info, + sizeof(mpc5200_wdt_info)); + if (ret) -+ ret =3D -EFAULT; ++ ret = -EFAULT; + break; + + case WDIOC_GETSTATUS: + case WDIOC_GETBOOTSTATUS: -+ ret =3D put_user(0, data); ++ ret = put_user(0, data); + break; + + case WDIOC_KEEPALIVE: @@ -310,11 +297,11 @@ a, + break; + + case WDIOC_SETTIMEOUT: -+ ret =3D get_user(timeout, data); ++ ret = get_user(timeout, data); + if (ret) + break; -+ real_timeout =3D (u64) timeout * 1000000000ULL; -+ ret =3D mpc52xx_gpt_do_start(gpt_wdt, real_timeout, 0, 1); ++ real_timeout = (u64) timeout * 1000000000ULL; ++ ret = mpc52xx_gpt_do_start(gpt_wdt, real_timeout, 0, 1); + if (ret) + break; + /* fall through and return the timeout */ @@ -326,15 +313,15 @@ a, + * - real timeout @33MHz is 999997090ns + * - the int divide by 10^9 will return 0. + */ -+ real_timeout =3D ++ real_timeout = + mpc52xx_gpt_timer_period(gpt_wdt) + 500000000ULL; + do_div(real_timeout, 1000000000ULL); -+ timeout =3D (int) real_timeout; -+ ret =3D put_user(timeout, data); ++ timeout = (int) real_timeout; ++ ret = put_user(timeout, data); + break; + + default: -+ ret =3D -ENOTTY; ++ ret = -ENOTTY; + } + return ret; +} @@ -352,14 +339,14 @@ a, + return -EBUSY; + + /* Set and activate the watchdog with 30 seconds timeout */ -+ ret =3D mpc52xx_gpt_do_start(mpc52xx_gpt_wdt, 30ULL * 1000000000ULL, ++ ret = mpc52xx_gpt_do_start(mpc52xx_gpt_wdt, 30ULL * 1000000000ULL, + 0, 1); + if (ret) { + clear_bit(0, &wdt_is_active); + return ret; + } + -+ file->private_data =3D mpc52xx_gpt_wdt; ++ file->private_data = mpc52xx_gpt_wdt; + return nonseekable_open(inode, file); +} + @@ -367,13 +354,13 @@ a, +{ + /* note: releasing the wdt in NOWAYOUT-mode does not stop it */ +#if !defined(CONFIG_WATCHDOG_NOWAYOUT) -+ struct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data; ++ struct mpc52xx_gpt_priv *gpt_wdt = file->private_data; + unsigned long flags; + + spin_lock_irqsave(&gpt_wdt->lock, flags); + clrbits32(&gpt_wdt->regs->mode, + MPC52xx_GPT_MODE_COUNTER_ENABLE | MPC52xx_GPT_MODE_WDT_EN); -+ gpt_wdt->wdt_mode &=3D ~MPC52xx_GPT_IS_WDT; ++ gpt_wdt->wdt_mode &= ~MPC52xx_GPT_IS_WDT; + spin_unlock_irqrestore(&gpt_wdt->lock, flags); +#endif + clear_bit(0, &wdt_is_active); @@ -381,19 +368,19 @@ a, +} + + -+static const struct file_operations mpc52xx_wdt_fops =3D { -+ .owner =3D THIS_MODULE, -+ .llseek =3D no_llseek, -+ .write =3D mpc52xx_wdt_write, -+ .unlocked_ioctl =3D mpc52xx_wdt_ioctl, -+ .open =3D mpc52xx_wdt_open, -+ .release =3D mpc52xx_wdt_release, ++static const struct file_operations mpc52xx_wdt_fops = { ++ .owner = THIS_MODULE, ++ .llseek = no_llseek, ++ .write = mpc52xx_wdt_write, ++ .unlocked_ioctl = mpc52xx_wdt_ioctl, ++ .open = mpc52xx_wdt_open, ++ .release = mpc52xx_wdt_release, +}; + -+static struct miscdevice mpc52xx_wdt_miscdev =3D { -+ .minor =3D WATCHDOG_MINOR, -+ .name =3D "watchdog", -+ .fops =3D &mpc52xx_wdt_fops, ++static struct miscdevice mpc52xx_wdt_miscdev = { ++ .minor = WATCHDOG_MINOR, ++ .name = "watchdog", ++ .fops = &mpc52xx_wdt_fops, +}; + +static int __devinit mpc52xx_gpt_wdt_init(void) @@ -401,7 +388,7 @@ a, + int err; + + /* try to register the watchdog misc device */ -+ err =3D misc_register(&mpc52xx_wdt_miscdev); ++ err = misc_register(&mpc52xx_wdt_miscdev); + if (err) + pr_err("%s: cannot register watchdog device\n", WDT_IDENTITY); + else @@ -415,13 +402,13 @@ a, + u64 real_timeout; + + /* remember the gpt for the wdt operation */ -+ mpc52xx_gpt_wdt =3D gpt; ++ mpc52xx_gpt_wdt = gpt; + + /* configure the wdt if the device tree contained a timeout */ -+ if (!period || *period =3D=3D 0) ++ if (!period || *period == 0) + return 0; + -+ real_timeout =3D (u64) *period * 1000000000ULL; ++ real_timeout = (u64) *period * 1000000000ULL; + if (mpc52xx_gpt_do_start(gpt, real_timeout, 0, 1)) + dev_warn(gpt->dev, "starting as wdt failed\n"); + else @@ -443,8 +430,7 @@ a, /* --------------------------------------------------------------------- * of_platform bus binding code */ -@@ -473,6 +746,22 @@ static int __devinit mpc52xx_gpt_probe(struct of_devic= -e *ofdev, +@@ -473,6 +746,22 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev, list_add(&gpt->list, &mpc52xx_gpt_list); mutex_unlock(&mpc52xx_gpt_list_mutex); @@ -453,12 +439,12 @@ e *ofdev, + of_get_property(ofdev->node, "has-wdt", NULL)) { + const u32 *on_boot_wdt; + -+ gpt->wdt_mode =3D MPC52xx_GPT_CAN_WDT; -+ on_boot_wdt =3D of_get_property(ofdev->node, "fsl,wdt-on-boot", ++ gpt->wdt_mode = MPC52xx_GPT_CAN_WDT; ++ on_boot_wdt = of_get_property(ofdev->node, "fsl,wdt-on-boot", + NULL); + if (on_boot_wdt) { + dev_info(gpt->dev, "used as watchdog\n"); -+ gpt->wdt_mode |=3D MPC52xx_GPT_IS_WDT; ++ gpt->wdt_mode |= MPC52xx_GPT_IS_WDT; + } else + dev_info(gpt->dev, "can function as watchdog\n"); + mpc52xx_gpt_wdt_setup(gpt, on_boot_wdt); diff --git a/a/content_digest b/N1/content_digest index b32b450..c50481a 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,16 +1,16 @@ - "From\0Albrecht Dre\303\237 <albrecht.dress@arcor.de>\0" + "From\0Albrecht Dre\303\237 <albrecht.dress-KvP5wT2u2U0@public.gmane.org>\0" "Subject\0[PATCHv2 2/3] mpc52xx/wdt: merge WDT code into the GPT driver\0" "Date\0Thu, 12 Nov 2009 19:44:47 +0100\0" "To\0Likely" - Grant <grant.likely@secretlab.ca> - Linux PPC Development <linuxppc-dev@ozlabs.org> - Devicetree Discussions <devicetree-discuss@lists.ozlabs.org> - " Wim Van Sebroeck <wim@iguana.be>\0" + Grant <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> + Linux PPC Development <linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org> + Devicetree Discussions <devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org> + " Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>\0" "\00:1\0" "b\0" "Merge the WDT code into the GPT interface.\n" "\n" - "Signed-off-by: Albrecht Dre=DF <albrecht.dress@arcor.de>\n" + "Signed-off-by: Albrecht Dre\303\237 <albrecht.dress-KvP5wT2u2U0@public.gmane.org>\n" "---\n" "\n" "Change against v1: fully merge the wdt api into this file.\n" @@ -18,12 +18,10 @@ "<http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-November/077647.html>.\n" "\n" " arch/powerpc/include/asm/mpc52xx.h | 5 +-\n" - " arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 328 +++++++++++++++++++++++++=\n" - "++--\n" + " arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 328 +++++++++++++++++++++++++++--\n" " 2 files changed, 312 insertions(+), 21 deletions(-)\n" "\n" - "diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/=\n" - "mpc52xx.h\n" + "diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h\n" "index 707ab75..b664ce7 100644\n" "--- a/arch/powerpc/include/asm/mpc52xx.h\n" "+++ b/arch/powerpc/include/asm/mpc52xx.h\n" @@ -31,10 +29,8 @@ " /* mpc52xx_gpt.c */\n" " struct mpc52xx_gpt_priv;\n" " extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq);\n" - "-extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int perio=\n" - "d,\n" - "+extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 perio=\n" - "d,\n" + "-extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period,\n" + "+extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period,\n" " int continuous);\n" "-extern void mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt);\n" "+extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt);\n" @@ -42,8 +38,7 @@ "\n" " /* mpc52xx_lpbfifo.c */\n" " #define MPC52XX_LPBFIFO_FLAG_READ\t\t(0)\n" - "diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platf=\n" - "orms/52xx/mpc52xx_gpt.c\n" + "diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c\n" "index 2c3fa13..42caecf 100644\n" "--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c\n" "+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c\n" @@ -56,12 +51,9 @@ "+ * device. Timer functions are not yet supported.\n" "+ *\n" "+ * The timer gpt0 can be used as watchdog (wdt). If the wdt mode is used,\n" - "+ * this prevents the use of any gpt0 gpt function (i.e. they will fail wit=\n" - "h\n" - "+ * -EBUSY). Thus, the safety wdt function always has precedence over the =\n" - "gpt\n" - "+ * function. If the kernel has been compiled with CONFIG_WATCHDOG_NOWAYOU=\n" - "T,\n" + "+ * this prevents the use of any gpt0 gpt function (i.e. they will fail with\n" + "+ * -EBUSY). Thus, the safety wdt function always has precedence over the gpt\n" + "+ * function. If the kernel has been compiled with CONFIG_WATCHDOG_NOWAYOUT,\n" "+ * this means that gpt0 is locked in wdt mode until the next reboot - this\n" "+ * may be a requirement in safety applications.\n" " *\n" @@ -79,7 +71,7 @@ "\n" " MODULE_DESCRIPTION(\"Freescale MPC52xx gpt driver\");\n" "-MODULE_AUTHOR(\"Sascha Hauer, Grant Likely\");\n" - "+MODULE_AUTHOR(\"Sascha Hauer, Grant Likely, Albrecht Dre=DF\");\n" + "+MODULE_AUTHOR(\"Sascha Hauer, Grant Likely, Albrecht Dre\303\237\");\n" " MODULE_LICENSE(\"GPL\");\n" "\n" " /**\n" @@ -87,8 +79,7 @@ " * @lock: spinlock to coordinate between different functions.\n" " * @of_gc: of_gpio_chip instance structure; used when GPIO is enabled\n" " * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported\n" - "+ * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicate=\n" - "s\n" + "+ * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates\n" "+ * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates\n" "+ * if the timer is actively used as wdt which blocks gpt functions\n" " */\n" @@ -143,33 +134,31 @@ " {\n" " \tu32 clear, set;\n" " \tu64 clocks;\n" - "@@ -393,15 +405,19 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *=\n" - "gpt, int period,\n" + "@@ -393,15 +405,19 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period,\n" "\n" - " \tclear =3D MPC52xx_GPT_MODE_MS_MASK | MPC52xx_GPT_MODE_CONTINUOUS;\n" - " \tset =3D MPC52xx_GPT_MODE_MS_GPIO | MPC52xx_GPT_MODE_COUNTER_ENABLE;\n" + " \tclear = MPC52xx_GPT_MODE_MS_MASK | MPC52xx_GPT_MODE_CONTINUOUS;\n" + " \tset = MPC52xx_GPT_MODE_MS_GPIO | MPC52xx_GPT_MODE_COUNTER_ENABLE;\n" "-\tif (continuous)\n" "+\tif (as_wdt) {\n" - "+\t\tclear |=3D MPC52xx_GPT_MODE_IRQ_EN;\n" - "+\t\tset |=3D MPC52xx_GPT_MODE_WDT_EN;\n" + "+\t\tclear |= MPC52xx_GPT_MODE_IRQ_EN;\n" + "+\t\tset |= MPC52xx_GPT_MODE_WDT_EN;\n" "+\t} else if (continuous)\n" - " \t\tset |=3D MPC52xx_GPT_MODE_CONTINUOUS;\n" + " \t\tset |= MPC52xx_GPT_MODE_CONTINUOUS;\n" "\n" " \t/* Determine the number of clocks in the requested period. 64 bit\n" " \t * arithmatic is done here to preserve the precision until the value\n" " \t * is scaled back down into the u32 range. Period is in 'ns', bus\n" "-\t * frequency is in Hz. */\n" - "-\tclocks =3D (u64)period * (u64)gpt->ipb_freq;\n" + "-\tclocks = (u64)period * (u64)gpt->ipb_freq;\n" "-\tdo_div(clocks, 1000000000); /* Scale it down to ns range */\n" "+\t * frequency is in Hz.\tThe maximum timeout @33MHz IPB clock is ~130\n" "+\t * seconds*/\n" - "+\tclocks =3D period * (u64)gpt->ipb_freq;\n" + "+\tclocks = period * (u64)gpt->ipb_freq;\n" "+\tdo_div(clocks, 1000000000ULL); /* Scale it down to ns range */\n" "\n" " \t/* This device cannot handle a clock count greater than 32 bits */\n" " \tif (clocks > 0xffffffff)\n" - "@@ -427,22 +443,279 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv =\n" - "*gpt, int period,\n" + "@@ -427,22 +443,279 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period,\n" " \t\treturn -EINVAL;\n" " \t}\n" "\n" @@ -177,8 +166,8 @@ "+\t/* Set and enable the timer, reject an attempt to use a wdt as gpt */\n" " \tspin_lock_irqsave(&gpt->lock, flags);\n" "+\tif (as_wdt)\n" - "+\t\tgpt->wdt_mode |=3D MPC52xx_GPT_IS_WDT;\n" - "+\telse if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) !=3D 0) {\n" + "+\t\tgpt->wdt_mode |= MPC52xx_GPT_IS_WDT;\n" + "+\telse if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) {\n" "+\t\tspin_unlock_irqrestore(&gpt->lock, flags);\n" "+\t\treturn -EBUSY;\n" "+\t}\n" @@ -217,7 +206,7 @@ "+\n" "+\t/* reject the operation if the timer is used as watchdog (gpt 0 only) */\n" "+\tspin_lock_irqsave(&gpt->lock, flags);\n" - "+\tif ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) !=3D 0) {\n" + "+\tif ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) {\n" "+\t\tspin_unlock_irqrestore(&gpt->lock, flags);\n" "+\t\treturn -EBUSY;\n" "+\t}\n" @@ -241,14 +230,14 @@ "+\tunsigned long flags;\n" "+\n" "+\tspin_lock_irqsave(&gpt->lock, flags);\n" - "+\tperiod =3D in_be32(&gpt->regs->count);\n" + "+\tperiod = in_be32(&gpt->regs->count);\n" "+\tspin_unlock_irqrestore(&gpt->lock, flags);\n" "+\n" - "+\tprescale =3D period >> 16;\n" - "+\tperiod &=3D 0xffff;\n" - "+\tif (prescale =3D=3D 0)\n" - "+\t\tprescale =3D 0x10000;\n" - "+\tperiod =3D period * prescale * 1000000000ULL;\n" + "+\tprescale = period >> 16;\n" + "+\tperiod &= 0xffff;\n" + "+\tif (prescale == 0)\n" + "+\t\tprescale = 0x10000;\n" + "+\tperiod = period * prescale * 1000000000ULL;\n" "+\tdo_div(period, (u64)gpt->ipb_freq);\n" "+\treturn period;\n" "+}\n" @@ -261,8 +250,7 @@ "+\n" "+#define WDT_IDENTITY\t \"mpc52xx watchdog on GPT0\"\n" "+\n" - "+/* wdt_is_active stores wether or not the /dev/watchdog device is opened *=\n" - "/\n" + "+/* wdt_is_active stores wether or not the /dev/watchdog device is opened */\n" "+static unsigned long wdt_is_active;\n" "+\n" "+/* wdt-capable gpt */\n" @@ -279,40 +267,39 @@ "+}\n" "+\n" "+/* wdt misc device api */\n" - "+static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *dat=\n" - "a,\n" + "+static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data,\n" "+\t\t\t\t size_t len, loff_t *ppos)\n" "+{\n" - "+\tstruct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data;\n" + "+\tstruct mpc52xx_gpt_priv *gpt_wdt = file->private_data;\n" "+\tmpc52xx_gpt_wdt_ping(gpt_wdt);\n" "+\treturn 0;\n" "+}\n" "+\n" - "+static struct watchdog_info mpc5200_wdt_info =3D {\n" - "+\t.options\t=3D WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,\n" - "+\t.identity\t=3D WDT_IDENTITY,\n" + "+static struct watchdog_info mpc5200_wdt_info = {\n" + "+\t.options\t= WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,\n" + "+\t.identity\t= WDT_IDENTITY,\n" "+};\n" "+\n" "+static long mpc52xx_wdt_ioctl(struct file *file, unsigned int cmd,\n" "+\t\t\t unsigned long arg)\n" "+{\n" - "+\tstruct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data;\n" - "+\tint __user *data =3D (int __user *)arg;\n" + "+\tstruct mpc52xx_gpt_priv *gpt_wdt = file->private_data;\n" + "+\tint __user *data = (int __user *)arg;\n" "+\tint timeout;\n" "+\tu64 real_timeout;\n" - "+\tint ret =3D 0;\n" + "+\tint ret = 0;\n" "+\n" "+\tswitch (cmd) {\n" "+\tcase WDIOC_GETSUPPORT:\n" - "+\t\tret =3D copy_to_user(data, &mpc5200_wdt_info,\n" + "+\t\tret = copy_to_user(data, &mpc5200_wdt_info,\n" "+\t\t\t\t sizeof(mpc5200_wdt_info));\n" "+\t\tif (ret)\n" - "+\t\t\tret =3D -EFAULT;\n" + "+\t\t\tret = -EFAULT;\n" "+\t\tbreak;\n" "+\n" "+\tcase WDIOC_GETSTATUS:\n" "+\tcase WDIOC_GETBOOTSTATUS:\n" - "+\t\tret =3D put_user(0, data);\n" + "+\t\tret = put_user(0, data);\n" "+\t\tbreak;\n" "+\n" "+\tcase WDIOC_KEEPALIVE:\n" @@ -320,11 +307,11 @@ "+\t\tbreak;\n" "+\n" "+\tcase WDIOC_SETTIMEOUT:\n" - "+\t\tret =3D get_user(timeout, data);\n" + "+\t\tret = get_user(timeout, data);\n" "+\t\tif (ret)\n" "+\t\t\tbreak;\n" - "+\t\treal_timeout =3D (u64) timeout * 1000000000ULL;\n" - "+\t\tret =3D mpc52xx_gpt_do_start(gpt_wdt, real_timeout, 0, 1);\n" + "+\t\treal_timeout = (u64) timeout * 1000000000ULL;\n" + "+\t\tret = mpc52xx_gpt_do_start(gpt_wdt, real_timeout, 0, 1);\n" "+\t\tif (ret)\n" "+\t\t\tbreak;\n" "+\t\t/* fall through and return the timeout */\n" @@ -336,15 +323,15 @@ "+\t\t * - real timeout @33MHz is 999997090ns\n" "+\t\t * - the int divide by 10^9 will return 0.\n" "+\t\t */\n" - "+\t\treal_timeout =3D\n" + "+\t\treal_timeout =\n" "+\t\t\tmpc52xx_gpt_timer_period(gpt_wdt) + 500000000ULL;\n" "+\t\tdo_div(real_timeout, 1000000000ULL);\n" - "+\t\ttimeout =3D (int) real_timeout;\n" - "+\t\tret =3D put_user(timeout, data);\n" + "+\t\ttimeout = (int) real_timeout;\n" + "+\t\tret = put_user(timeout, data);\n" "+\t\tbreak;\n" "+\n" "+\tdefault:\n" - "+\t\tret =3D -ENOTTY;\n" + "+\t\tret = -ENOTTY;\n" "+\t}\n" "+\treturn ret;\n" "+}\n" @@ -362,14 +349,14 @@ "+\t\treturn -EBUSY;\n" "+\n" "+\t/* Set and activate the watchdog with 30 seconds timeout */\n" - "+\tret =3D mpc52xx_gpt_do_start(mpc52xx_gpt_wdt, 30ULL * 1000000000ULL,\n" + "+\tret = mpc52xx_gpt_do_start(mpc52xx_gpt_wdt, 30ULL * 1000000000ULL,\n" "+\t\t\t\t 0, 1);\n" "+\tif (ret) {\n" "+\t\tclear_bit(0, &wdt_is_active);\n" "+\t\treturn ret;\n" "+\t}\n" "+\n" - "+\tfile->private_data =3D mpc52xx_gpt_wdt;\n" + "+\tfile->private_data = mpc52xx_gpt_wdt;\n" "+\treturn nonseekable_open(inode, file);\n" "+}\n" "+\n" @@ -377,13 +364,13 @@ "+{\n" "+\t/* note: releasing the wdt in NOWAYOUT-mode does not stop it */\n" "+#if !defined(CONFIG_WATCHDOG_NOWAYOUT)\n" - "+\tstruct mpc52xx_gpt_priv *gpt_wdt =3D file->private_data;\n" + "+\tstruct mpc52xx_gpt_priv *gpt_wdt = file->private_data;\n" "+\tunsigned long flags;\n" "+\n" "+\tspin_lock_irqsave(&gpt_wdt->lock, flags);\n" "+\tclrbits32(&gpt_wdt->regs->mode,\n" "+\t\t MPC52xx_GPT_MODE_COUNTER_ENABLE | MPC52xx_GPT_MODE_WDT_EN);\n" - "+\tgpt_wdt->wdt_mode &=3D ~MPC52xx_GPT_IS_WDT;\n" + "+\tgpt_wdt->wdt_mode &= ~MPC52xx_GPT_IS_WDT;\n" "+\tspin_unlock_irqrestore(&gpt_wdt->lock, flags);\n" "+#endif\n" "+\tclear_bit(0, &wdt_is_active);\n" @@ -391,19 +378,19 @@ "+}\n" "+\n" "+\n" - "+static const struct file_operations mpc52xx_wdt_fops =3D {\n" - "+\t.owner\t\t=3D THIS_MODULE,\n" - "+\t.llseek\t\t=3D no_llseek,\n" - "+\t.write\t\t=3D mpc52xx_wdt_write,\n" - "+\t.unlocked_ioctl =3D mpc52xx_wdt_ioctl,\n" - "+\t.open\t\t=3D mpc52xx_wdt_open,\n" - "+\t.release\t=3D mpc52xx_wdt_release,\n" + "+static const struct file_operations mpc52xx_wdt_fops = {\n" + "+\t.owner\t\t= THIS_MODULE,\n" + "+\t.llseek\t\t= no_llseek,\n" + "+\t.write\t\t= mpc52xx_wdt_write,\n" + "+\t.unlocked_ioctl = mpc52xx_wdt_ioctl,\n" + "+\t.open\t\t= mpc52xx_wdt_open,\n" + "+\t.release\t= mpc52xx_wdt_release,\n" "+};\n" "+\n" - "+static struct miscdevice mpc52xx_wdt_miscdev =3D {\n" - "+\t.minor\t\t=3D WATCHDOG_MINOR,\n" - "+\t.name\t\t=3D \"watchdog\",\n" - "+\t.fops\t\t=3D &mpc52xx_wdt_fops,\n" + "+static struct miscdevice mpc52xx_wdt_miscdev = {\n" + "+\t.minor\t\t= WATCHDOG_MINOR,\n" + "+\t.name\t\t= \"watchdog\",\n" + "+\t.fops\t\t= &mpc52xx_wdt_fops,\n" "+};\n" "+\n" "+static int __devinit mpc52xx_gpt_wdt_init(void)\n" @@ -411,7 +398,7 @@ "+\tint err;\n" "+\n" "+\t/* try to register the watchdog misc device */\n" - "+\terr =3D misc_register(&mpc52xx_wdt_miscdev);\n" + "+\terr = misc_register(&mpc52xx_wdt_miscdev);\n" "+\tif (err)\n" "+\t\tpr_err(\"%s: cannot register watchdog device\\n\", WDT_IDENTITY);\n" "+\telse\n" @@ -425,13 +412,13 @@ "+\tu64 real_timeout;\n" "+\n" "+\t/* remember the gpt for the wdt operation */\n" - "+\tmpc52xx_gpt_wdt =3D gpt;\n" + "+\tmpc52xx_gpt_wdt = gpt;\n" "+\n" "+\t/* configure the wdt if the device tree contained a timeout */\n" - "+\tif (!period || *period =3D=3D 0)\n" + "+\tif (!period || *period == 0)\n" "+\t\treturn 0;\n" "+\n" - "+\treal_timeout =3D (u64) *period * 1000000000ULL;\n" + "+\treal_timeout = (u64) *period * 1000000000ULL;\n" "+\tif (mpc52xx_gpt_do_start(gpt, real_timeout, 0, 1))\n" "+\t\tdev_warn(gpt->dev, \"starting as wdt failed\\n\");\n" "+\telse\n" @@ -453,8 +440,7 @@ " /* ---------------------------------------------------------------------\n" " * of_platform bus binding code\n" " */\n" - "@@ -473,6 +746,22 @@ static int __devinit mpc52xx_gpt_probe(struct of_devic=\n" - "e *ofdev,\n" + "@@ -473,6 +746,22 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,\n" " \tlist_add(&gpt->list, &mpc52xx_gpt_list);\n" " \tmutex_unlock(&mpc52xx_gpt_list_mutex);\n" "\n" @@ -463,12 +449,12 @@ "+\t of_get_property(ofdev->node, \"has-wdt\", NULL)) {\n" "+\t\tconst u32 *on_boot_wdt;\n" "+\n" - "+\t\tgpt->wdt_mode =3D MPC52xx_GPT_CAN_WDT;\n" - "+\t\ton_boot_wdt =3D of_get_property(ofdev->node, \"fsl,wdt-on-boot\",\n" + "+\t\tgpt->wdt_mode = MPC52xx_GPT_CAN_WDT;\n" + "+\t\ton_boot_wdt = of_get_property(ofdev->node, \"fsl,wdt-on-boot\",\n" "+\t\t\t\t\t NULL);\n" "+\t\tif (on_boot_wdt) {\n" "+\t\t\tdev_info(gpt->dev, \"used as watchdog\\n\");\n" - "+\t\t\tgpt->wdt_mode |=3D MPC52xx_GPT_IS_WDT;\n" + "+\t\t\tgpt->wdt_mode |= MPC52xx_GPT_IS_WDT;\n" "+\t\t} else\n" "+\t\t\tdev_info(gpt->dev, \"can function as watchdog\\n\");\n" "+\t\tmpc52xx_gpt_wdt_setup(gpt, on_boot_wdt);\n" @@ -483,4 +469,4 @@ " subsys_initcall(mpc52xx_gpt_init);\n" +device_initcall(mpc52xx_gpt_wdt_init); -2d1266af3d97b9381aac50031e71236492a912fd81c40d31170b8f6af22026ef +eb32b0a4402053f3274f65263fe3c5268b7400c5446f454a03ae0db786488385
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.