diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 15:46:31 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 15:46:31 -0700 |
commit | c19176154b464c861e49355eff636aa6896735b5 (patch) | |
tree | 5dd931abe6aa3b73d10119a77950f2a0f3323a74 /drivers/rtc/rtc-pxa.c | |
parent | 12f03ee606914317e7e6a0815e53a48205c31dae (diff) | |
parent | 5f1b2f77646fc0ef2f36fc554f5722a1381d0892 (diff) |
Merge tag 'rtc-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"Core:
- use is_visible() to control sysfs attributes
- switch wakealarm attribute to DEVICE_ATTR_RW
- make rtc_does_wakealarm() return boolean
- properly manage lifetime of dev and cdev in rtc device
- remove unnecessary device_get() in rtc_device_unregister
- fix double free in rtc_register_device() error path
New drivers:
- NXP LPC24xx
- Xilinx Zynq MP
- Dialog DA9062
Subsystem wide cleanups:
- fix drivers that consider 0 as a valid IRQ in client->irq
- Drop (un)likely before IS_ERR(_OR_NULL)
- drop the remaining owner assignment for i2c_driver and
platform_driver
- module autoload fixes
Drivers:
- 88pm80x: add device tree support
- abx80x: fix RTC write bit
- ab8500: Add a sentinel to ab85xx_rtc_ids[]
- armada38x: Align RTC set time procedure with the official errata
- as3722: correct month value
- at91sam9: cleanups
- at91rm9200: get and use slow clock and cleanups
- bq32k: remove redundant check
- cmos: century support, proper fix for the spurious wakeup
- ds1307: cleanups and wakeup irq support
- ds1374: Remove unused variable
- ds1685: Use module_platform_driver
- ds3232: fix WARNING trace in resume function
- gemini: fix ptr_ret.cocci warnings
- mt6397: implement suspend/resume
- omap: support internal and external clock enabling
- opal: Enable alarms only when opal supports tpo
- pcf2127: use OFS flag to detect unreliable date and warn the user
- pl031: fix typo for author email
- rx8025: huge cleanup and fixes
- sa1100/pxa: share common code
- s5m: fix to update ctrl register
- s3c: fix clocks and wakeup, cleanup
- sirfsoc: use regmap
- nvram_read()/nvram_write() functions for cmos, ds1305, ds1307,
ds1343, ds1511, ds1553, ds1742, m48t59, rp5c01, stk17ta8, tx4939
- use rtc_valid_tm() error code when reading date/time instead of 0
for isl12022, pcf2123, pcf2127"
* tag 'rtc-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (90 commits)
rtc: abx80x: fix RTC write bit
rtc: ab8500: Add a sentinel to ab85xx_rtc_ids[]
rtc: ds1374: Remove unused variable
rtc: Fix module autoload for OF platform drivers
rtc: Fix module autoload for rtc-{ab8500,max8997,s5m} drivers
rtc: omap: Add external clock enabling support
rtc: omap: Add internal clock enabling support
ARM: dts: AM437x: Add the internal and external clock nodes for rtc
rtc: s5m: fix to update ctrl register
rtc: add xilinx zynqmp rtc driver
devicetree: bindings: rtc: add bindings for xilinx zynqmp rtc
rtc: as3722: correct month value
ARM: config: Switch PXA27x platforms to use PXA RTC driver
ARM: mmp: remove unused RTC register definitions
ARM: sa1100: remove unused RTC register definitions
rtc: sa1100/pxa: convert to run-time register mapping
ARM: pxa: add memory resource to SA1100 RTC device
rtc: pxa: convert to use shared sa1100 functions
rtc: sa1100: prepare to share sa1100_rtc_ops
rtc: ds3232: fix WARNING trace in resume function
...
Diffstat (limited to 'drivers/rtc/rtc-pxa.c')
-rw-r--r-- | drivers/rtc/rtc-pxa.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index 4561f375327d..fe4985b54608 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c @@ -32,6 +32,8 @@ #include <mach/hardware.h> +#include "rtc-sa1100.h" + #define RTC_DEF_DIVIDER (32768 - 1) #define RTC_DEF_TRIM 0 #define MAXFREQ_PERIODIC 1000 @@ -86,10 +88,9 @@ __raw_writel((value), (pxa_rtc)->base + (reg)) struct pxa_rtc { + struct sa1100_rtc sa1100_rtc; struct resource *ress; void __iomem *base; - int irq_1Hz; - int irq_Alrm; struct rtc_device *rtc; spinlock_t lock; /* Protects this structure */ }; @@ -184,25 +185,25 @@ static int pxa_rtc_open(struct device *dev) struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); int ret; - ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, 0, + ret = request_irq(pxa_rtc->sa1100_rtc.irq_1hz, pxa_rtc_irq, 0, "rtc 1Hz", dev); if (ret < 0) { - dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz, - ret); + dev_err(dev, "can't get irq %i, err %d\n", + pxa_rtc->sa1100_rtc.irq_1hz, ret); goto err_irq_1Hz; } - ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, 0, + ret = request_irq(pxa_rtc->sa1100_rtc.irq_alarm, pxa_rtc_irq, 0, "rtc Alrm", dev); if (ret < 0) { - dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm, - ret); + dev_err(dev, "can't get irq %i, err %d\n", + pxa_rtc->sa1100_rtc.irq_alarm, ret); goto err_irq_Alrm; } return 0; err_irq_Alrm: - free_irq(pxa_rtc->irq_1Hz, dev); + free_irq(pxa_rtc->sa1100_rtc.irq_1hz, dev); err_irq_1Hz: return ret; } @@ -215,8 +216,8 @@ static void pxa_rtc_release(struct device *dev) rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE); spin_unlock_irq(&pxa_rtc->lock); - free_irq(pxa_rtc->irq_Alrm, dev); - free_irq(pxa_rtc->irq_1Hz, dev); + free_irq(pxa_rtc->sa1100_rtc.irq_1hz, dev); + free_irq(pxa_rtc->sa1100_rtc.irq_alarm, dev); } static int pxa_alarm_irq_enable(struct device *dev, unsigned int enabled) @@ -320,12 +321,13 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct pxa_rtc *pxa_rtc; + struct sa1100_rtc *sa1100_rtc; int ret; - u32 rttr; pxa_rtc = devm_kzalloc(dev, sizeof(*pxa_rtc), GFP_KERNEL); if (!pxa_rtc) return -ENOMEM; + sa1100_rtc = &pxa_rtc->sa1100_rtc; spin_lock_init(&pxa_rtc->lock); platform_set_drvdata(pdev, pxa_rtc); @@ -336,13 +338,13 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) return -ENXIO; } - pxa_rtc->irq_1Hz = platform_get_irq(pdev, 0); - if (pxa_rtc->irq_1Hz < 0) { + sa1100_rtc->irq_1hz = platform_get_irq(pdev, 0); + if (sa1100_rtc->irq_1hz < 0) { dev_err(dev, "No 1Hz IRQ resource defined\n"); return -ENXIO; } - pxa_rtc->irq_Alrm = platform_get_irq(pdev, 1); - if (pxa_rtc->irq_Alrm < 0) { + sa1100_rtc->irq_alarm = platform_get_irq(pdev, 1); + if (sa1100_rtc->irq_alarm < 0) { dev_err(dev, "No alarm IRQ resource defined\n"); return -ENXIO; } @@ -354,15 +356,14 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) return -ENOMEM; } - /* - * If the clock divider is uninitialized then reset it to the - * default value to get the 1Hz clock. - */ - if (rtc_readl(pxa_rtc, RTTR) == 0) { - rttr = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16); - rtc_writel(pxa_rtc, RTTR, rttr); - dev_warn(dev, "warning: initializing default clock" - " divider/trim value\n"); + sa1100_rtc->rcnr = pxa_rtc->base + 0x0; + sa1100_rtc->rtsr = pxa_rtc->base + 0x8; + sa1100_rtc->rtar = pxa_rtc->base + 0x4; + sa1100_rtc->rttr = pxa_rtc->base + 0xc; + ret = sa1100_rtc_init(pdev, sa1100_rtc); + if (!ret) { + dev_err(dev, "Unable to init SA1100 RTC sub-device\n"); + return ret; } rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE); @@ -402,7 +403,7 @@ static int pxa_rtc_suspend(struct device *dev) struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); if (device_may_wakeup(dev)) - enable_irq_wake(pxa_rtc->irq_Alrm); + enable_irq_wake(pxa_rtc->sa1100_rtc.irq_alarm); return 0; } @@ -411,7 +412,7 @@ static int pxa_rtc_resume(struct device *dev) struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); if (device_may_wakeup(dev)) - disable_irq_wake(pxa_rtc->irq_Alrm); + disable_irq_wake(pxa_rtc->sa1100_rtc.irq_alarm); return 0; } #endif |