Greg, On Tue, Mar 12, 2013 at 01:46:43PM -0700, gregkh@xxxxxxxxxxxxxxxxxxx wrote: > > This is a note to let you know that I've just added the patch titled > > rtc: rtc-mv: Add support for clk to avoid lockups > > to the 3.4-stable tree which can be found at: > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary > > The filename of the patch is: > rtc-rtc-mv-add-support-for-clk-to-avoid-lockups.patch > and it can be found in the queue-3.4 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, > please let <stable@xxxxxxxxxxxxxxx> know about it. This won't work on v3.4.x, please drop from that queue. There was no devm_clk_get(). thx, Jason. > > > From 89c58c198b252f2bc20657fdd72a2aea788c435c Mon Sep 17 00:00:00 2001 > From: Andrew Lunn <andrew@xxxxxxx> > Date: Sun, 3 Feb 2013 12:32:06 +0100 > Subject: rtc: rtc-mv: Add support for clk to avoid lockups > > From: Andrew Lunn <andrew@xxxxxxx> > > commit 89c58c198b252f2bc20657fdd72a2aea788c435c upstream. > > The Marvell RTC on Kirkwood makes use of the runit clock. Ensure the > driver clk_prepare_enable() this clock, otherwise there is a danger > the SoC will lockup when accessing RTC registers with the clock > disabled. > > Reported-by: Simon Baatz <gmbnomis@xxxxxxxxx> > Signed-off-by: Andrew Lunn <andrew@xxxxxxx> > Tested-by: Simon Baatz <gmbnomis@xxxxxxxxx> > Signed-off-by: Jason Cooper <jason@xxxxxxxxxxxxxx> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > > --- > arch/arm/boot/dts/kirkwood.dtsi | 1 + > drivers/rtc/rtc-mv.c | 28 ++++++++++++++++++++++++---- > 2 files changed, 25 insertions(+), 4 deletions(-) > > --- a/arch/arm/boot/dts/kirkwood.dtsi > +++ b/arch/arm/boot/dts/kirkwood.dtsi > @@ -31,6 +31,7 @@ > compatible = "mrvl,kirkwood-rtc", "mrvl,orion-rtc"; > reg = <0x10300 0x20>; > interrupts = <53>; > + clocks = <&gate_clk 7>; > }; > }; > }; > --- a/drivers/rtc/rtc-mv.c > +++ b/drivers/rtc/rtc-mv.c > @@ -14,6 +14,7 @@ > #include <linux/platform_device.h> > #include <linux/of.h> > #include <linux/delay.h> > +#include <linux/clk.h> > #include <linux/gfp.h> > #include <linux/module.h> > > @@ -41,6 +42,7 @@ struct rtc_plat_data { > struct rtc_device *rtc; > void __iomem *ioaddr; > int irq; > + struct clk *clk; > }; > > static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) > @@ -221,6 +223,7 @@ static int __devinit mv_rtc_probe(struct > struct rtc_plat_data *pdata; > resource_size_t size; > u32 rtc_time; > + int ret = 0; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!res) > @@ -239,11 +242,17 @@ static int __devinit mv_rtc_probe(struct > if (!pdata->ioaddr) > return -ENOMEM; > > + pdata->clk = devm_clk_get(&pdev->dev, NULL); > + /* Not all SoCs require a clock.*/ > + if (!IS_ERR(pdata->clk)) > + clk_prepare_enable(pdata->clk); > + > /* make sure the 24 hours mode is enabled */ > rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); > if (rtc_time & RTC_HOURS_12H_MODE) { > dev_err(&pdev->dev, "24 Hours mode not supported.\n"); > - return -EINVAL; > + ret = -EINVAL; > + goto out; > } > > /* make sure it is actually functional */ > @@ -252,7 +261,8 @@ static int __devinit mv_rtc_probe(struct > rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); > if (rtc_time == 0x01000000) { > dev_err(&pdev->dev, "internal RTC not ticking\n"); > - return -ENODEV; > + ret = -ENODEV; > + goto out; > } > } > > @@ -268,8 +278,10 @@ static int __devinit mv_rtc_probe(struct > } else > pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, > &mv_rtc_ops, THIS_MODULE); > - if (IS_ERR(pdata->rtc)) > - return PTR_ERR(pdata->rtc); > + if (IS_ERR(pdata->rtc)) { > + ret = PTR_ERR(pdata->rtc); > + goto out; > + } > > if (pdata->irq >= 0) { > writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); > @@ -282,6 +294,11 @@ static int __devinit mv_rtc_probe(struct > } > > return 0; > +out: > + if (!IS_ERR(pdata->clk)) > + clk_disable_unprepare(pdata->clk); > + > + return ret; > } > > static int __exit mv_rtc_remove(struct platform_device *pdev) > @@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct p > device_init_wakeup(&pdev->dev, 0); > > rtc_device_unregister(pdata->rtc); > + if (!IS_ERR(pdata->clk)) > + clk_disable_unprepare(pdata->clk); > + > return 0; > } > > > > Patches currently in stable-queue which might be from andrew@xxxxxxx are > > queue-3.4/rtc-rtc-mv-add-support-for-clk-to-avoid-lockups.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html