diff options
author | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-11 10:41:07 +0300 |
---|---|---|
committer | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-13 08:17:18 +0300 |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/rtc/rtc-armada38x.c | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/rtc/rtc-armada38x.c')
-rw-r--r-- | kernel/drivers/rtc/rtc-armada38x.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/kernel/drivers/rtc/rtc-armada38x.c b/kernel/drivers/rtc/rtc-armada38x.c index 4b62d1a87..9a3f2a6f5 100644 --- a/kernel/drivers/rtc/rtc-armada38x.c +++ b/kernel/drivers/rtc/rtc-armada38x.c @@ -40,13 +40,6 @@ struct armada38x_rtc { void __iomem *regs; void __iomem *regs_soc; spinlock_t lock; - /* - * While setting the time, the RTC TIME register should not be - * accessed. Setting the RTC time involves sleeping during - * 100ms, so a mutex instead of a spinlock is used to protect - * it - */ - struct mutex mutex_time; int irq; }; @@ -64,9 +57,9 @@ static void rtc_delayed_write(u32 val, struct armada38x_rtc *rtc, int offset) static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - unsigned long time, time_check; + unsigned long time, time_check, flags; - mutex_lock(&rtc->mutex_time); + spin_lock_irqsave(&rtc->lock, flags); time = readl(rtc->regs + RTC_TIME); /* * WA for failing time set attempts. As stated in HW ERRATA if @@ -77,7 +70,7 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) if ((time_check - time) > 1) time_check = readl(rtc->regs + RTC_TIME); - mutex_unlock(&rtc->mutex_time); + spin_unlock_irqrestore(&rtc->lock, flags); rtc_time_to_tm(time_check, tm); @@ -95,16 +88,16 @@ static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm) if (ret) goto out; /* - * Setting the RTC time not always succeeds. According to the - * errata we need to first write on the status register and - * then wait for 100ms before writing to the time register to be - * sure that the data will be taken into account. + * According to errata FE-3124064, Write to RTC TIME register + * may fail. As a workaround, after writing to RTC TIME + * register, issue a dummy write of 0x0 twice to RTC Status + * register. */ - mutex_lock(&rtc->mutex_time); - rtc_delayed_write(0, rtc, RTC_STATUS); - msleep(100); + spin_lock_irqsave(&rtc->lock, flags); rtc_delayed_write(time, rtc, RTC_TIME); - mutex_unlock(&rtc->mutex_time); + rtc_delayed_write(0, rtc, RTC_STATUS); + rtc_delayed_write(0, rtc, RTC_STATUS); + spin_unlock_irqrestore(&rtc->lock, flags); out: return ret; @@ -229,7 +222,6 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) return -ENOMEM; spin_lock_init(&rtc->lock); - mutex_init(&rtc->mutex_time); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rtc"); rtc->regs = devm_ioremap_resource(&pdev->dev, res); @@ -303,6 +295,7 @@ static const struct of_device_id armada38x_rtc_of_match_table[] = { { .compatible = "marvell,armada-380-rtc", }, {} }; +MODULE_DEVICE_TABLE(of, armada38x_rtc_of_match_table); #endif static struct platform_driver armada38x_rtc_driver = { |