diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-25 18:55:33 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-25 18:55:33 -0700 |
commit | c13c81006314ad76c2b31824960a900385601b8b (patch) | |
tree | 749f71b07f252960775c42bd1141d21cb35a768d /drivers | |
parent | 24867481b8c0a3bc3ab53b634e3cc03680ac3ac6 (diff) | |
parent | 3783055ef4cf096910f670f9a1a32e32db08559b (diff) |
Merge tag 'rtc-v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"Core:
- Coding style and whitespace fixes (interface, Makefile and Kconfig)
- New rtc_tm_sub() helper
- New CONFIG_RTC_SYSTOHC_DEVICE option
- Removed rtc_set_mmss()
New drivers:
- Mediatek MT6397
- Cortina Gemini
Drivers:
- Year 2106 fixes for isl1208, pcf8563 and sunxi
- update author email for at32ap700x and efi
- ds1307: alarm fix
- efi: use correct EFI 'epoch'
- hym8563: make irq optional
- imxdi: cleanups and better handling of the security/tamper monitoring
- snvs: fix wakealarm
- Compilation fixes or warning removal for gemini, mt6397, palmas, pfc8563
- Trivial cleanups for ab8500, ds1216, ds1286, ds1672, ep93xx,
hid-sensor-time, max6900, max8998, max77686, max77802, mc13xxx, mv,
mxc, s3c, spear, v3020
- Kconfig fixes for stmp3xxx and xgene"
* tag 'rtc-v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (48 commits)
rtc: remove useless I2C dependencies
rtc: whitespace fixes
rtc: Properly sort Makefile
MAINTAINERS: Add RTC subsystem repository
rtc: pfc8563: fix uninitialized variable warning
rtc: ds1307: Enable the mcp794xx alarm after programming time
rtc: hym8563: make the irq optional
rtc: gemini: fix cocci warnings
rtc: mv: correct 24 hour error message
rtc: mv: use BIT()
rtc: efi: use correct EFI 'epoch'
rtc: interface: Remove rtc_set_mmss()
sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC
rtc: NTP: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
rtc: sunxi: Replace deprecated rtc_tm_to_time()
rtc: isl1208: Replace deprecated rtc_tm_to_time()
rtc: Introduce rtc_tm_sub() helper function
rtc: pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
rtc: palmas: Initialise bb_charging flag before using it
rtc: simplify use of devm_ioremap_resource
...
Diffstat (limited to 'drivers')
33 files changed, 1173 insertions, 323 deletions
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 38a0458f7834..03929a6c6fc4 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -21,9 +21,27 @@ #include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/registers.h> +#define MT6397_RTC_BASE 0xe000 +#define MT6397_RTC_SIZE 0x3e + +static const struct resource mt6397_rtc_resources[] = { + { + .start = MT6397_RTC_BASE, + .end = MT6397_RTC_BASE + MT6397_RTC_SIZE, + .flags = IORESOURCE_MEM, + }, + { + .start = MT6397_IRQ_RTC, + .end = MT6397_IRQ_RTC, + .flags = IORESOURCE_IRQ, + }, +}; + static const struct mfd_cell mt6397_devs[] = { { .name = "mt6397-rtc", + .num_resources = ARRAY_SIZE(mt6397_rtc_resources), + .resources = mt6397_rtc_resources, .of_compatible = "mediatek,mt6397-rtc", }, { .name = "mt6397-regulator", diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 5e963df9e565..db2fe4ab4b4a 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -12,7 +12,7 @@ menuconfig RTC_CLASS select RTC_LIB help Generic RTC class support. If you say yes here, you will - be allowed to plug one or more RTCs to your system. You will + be allowed to plug one or more RTCs to your system. You will probably want to enable one or more of the interfaces below. if RTC_CLASS @@ -25,17 +25,9 @@ config RTC_HCTOSYS the value read from a specified RTC device. This is useful to avoid unnecessary fsck runs at boot time, and to network better. -config RTC_SYSTOHC - bool "Set the RTC time based on NTP synchronization" - default y - help - If you say yes here, the system time (wall clock) will be stored - in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 - minutes if userspace reports synchronized NTP status. - config RTC_HCTOSYS_DEVICE string "RTC used to set the system time" - depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y + depends on RTC_HCTOSYS default "rtc0" help The RTC device that will be used to (re)initialize the system @@ -56,6 +48,25 @@ config RTC_HCTOSYS_DEVICE sleep states. Do not specify an RTC here unless it stays powered during all this system's supported sleep states. +config RTC_SYSTOHC + bool "Set the RTC time based on NTP synchronization" + default y + help + If you say yes here, the system time (wall clock) will be stored + in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 + minutes if userspace reports synchronized NTP status. + +config RTC_SYSTOHC_DEVICE + string "RTC used to synchronize NTP adjustment" + depends on RTC_SYSTOHC + default RTC_HCTOSYS_DEVICE if RTC_HCTOSYS + default "rtc0" + help + The RTC device used for NTP synchronization. The main difference + between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this + one can sleep when setting time, because it runs in the workqueue + context. + config RTC_DEBUG bool "RTC debug support" help @@ -135,7 +146,7 @@ if I2C config RTC_DRV_88PM860X tristate "Marvell 88PM860x" - depends on I2C && MFD_88PM860X + depends on MFD_88PM860X help If you say yes here you get support for RTC function in Marvell 88PM860x chips. @@ -145,7 +156,7 @@ config RTC_DRV_88PM860X config RTC_DRV_88PM80X tristate "Marvell 88PM80x" - depends on I2C && MFD_88PM800 + depends on MFD_88PM800 help If you say yes here you get support for RTC function in Marvell 88PM80x chips. @@ -154,10 +165,9 @@ config RTC_DRV_88PM80X will be called rtc-88pm80x. config RTC_DRV_ABB5ZES3 - depends on I2C - select REGMAP_I2C - tristate "Abracon AB-RTCMC-32.768kHz-B5ZE-S3" - help + select REGMAP_I2C + tristate "Abracon AB-RTCMC-32.768kHz-B5ZE-S3" + help If you say yes here you get support for the Abracon AB-RTCMC-32.768kHz-B5ZE-S3 I2C RTC chip. @@ -204,7 +214,6 @@ config RTC_DRV_DS1307 config RTC_DRV_DS1374 tristate "Dallas/Maxim DS1374" - depends on I2C help If you say yes here you get support for Dallas Semiconductor DS1374 real-time clock chips. If an interrupt is associated @@ -232,7 +241,6 @@ config RTC_DRV_DS1672 config RTC_DRV_DS3232 tristate "Dallas/Maxim DS3232" - depends on I2C help If you say yes here you get support for Dallas Semiconductor DS3232 real-time clock chips. If an interrupt is associated @@ -243,7 +251,7 @@ config RTC_DRV_DS3232 config RTC_DRV_HYM8563 tristate "Haoyu Microelectronics HYM8563" - depends on I2C && OF + depends on OF help Say Y to enable support for the HYM8563 I2C RTC chip. Apart from the usual rtc functions it provides a clock output of @@ -365,10 +373,9 @@ config RTC_DRV_ISL12022 will be called rtc-isl12022. config RTC_DRV_ISL12057 - depends on I2C - select REGMAP_I2C - tristate "Intersil ISL12057" - help + select REGMAP_I2C + tristate "Intersil ISL12057" + help If you say yes here you get support for the Intersil ISL12057 I2C RTC chip. @@ -603,13 +610,13 @@ comment "SPI RTC drivers" if SPI_MASTER config RTC_DRV_M41T93 - tristate "ST M41T93" - help - If you say yes here you will get support for the - ST M41T93 SPI RTC chip. + tristate "ST M41T93" + help + If you say yes here you will get support for the + ST M41T93 SPI RTC chip. - This driver can also be built as a module. If so, the module - will be called rtc-m41t93. + This driver can also be built as a module. If so, the module + will be called rtc-m41t93. config RTC_DRV_M41T94 tristate "ST M41T94" @@ -1200,7 +1207,7 @@ config RTC_DRV_SH Say Y here to enable support for the on-chip RTC found in most SuperH processors. - To compile this driver as a module, choose M here: the + To compile this driver as a module, choose M here: the module will be called rtc-sh. config RTC_DRV_VR41XX @@ -1299,14 +1306,14 @@ config RTC_DRV_GENERIC just say Y. config RTC_DRV_PXA - tristate "PXA27x/PXA3xx" - depends on ARCH_PXA - help - If you say Y here you will get access to the real time clock - built into your PXA27x or PXA3xx CPU. + tristate "PXA27x/PXA3xx" + depends on ARCH_PXA + help + If you say Y here you will get access to the real time clock + built into your PXA27x or PXA3xx CPU. - This RTC driver uses PXA RTC registers available since pxa27x - series (RDxR, RYxR) instead of legacy RCNR, RTAR. + This RTC driver uses PXA RTC registers available since pxa27x + series (RDxR, RYxR) instead of legacy RCNR, RTAR. config RTC_DRV_VT8500 tristate "VIA/WonderMedia 85xx SoC RTC" @@ -1372,6 +1379,17 @@ config RTC_DRV_ARMADA38X This driver can also be built as a module. If so, the module will be called armada38x-rtc. +config RTC_DRV_GEMINI + tristate "Gemini SoC RTC" + depends on ARCH_GEMINI || COMPILE_TEST + depends on HAS_IOMEM + help + If you say Y here you will get support for the + RTC found on Gemini SoC's. + + This driver can also be built as a module. If so, the module + will be called rtc-gemini. + config RTC_DRV_PS3 tristate "PS3 RTC" depends on PPC_PS3 @@ -1396,6 +1414,7 @@ config RTC_DRV_COH901331 config RTC_DRV_STMP tristate "Freescale STMP3xxx/i.MX23/i.MX28 RTC" depends on ARCH_MXS + select STMP_DEVICE help If you say yes here you will get support for the onboard STMP3xxx/i.MX23/i.MX28 RTC. @@ -1541,9 +1560,20 @@ config RTC_DRV_MOXART This driver can also be built as a module. If so, the module will be called rtc-moxart +config RTC_DRV_MT6397 + tristate "Mediatek Real Time Clock driver" + depends on MFD_MT6397 || COMPILE_TEST + help + This selects the Mediatek(R) RTC driver. RTC is part of Mediatek + MT6397 PMIC. You should enable MT6397 PMIC MFD before select + Mediatek(R) RTC driver. + + If you want to use Mediatek(R) RTC interface, select Y or M here. + config RTC_DRV_XGENE tristate "APM X-Gene RTC" depends on HAS_IOMEM + depends on ARCH_XGENE || COMPILE_TEST help If you say yes here you get support for the APM X-Gene SoC real time clock. diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index ebe2c085d01c..1b09a62fcf4b 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -14,14 +14,14 @@ ifdef CONFIG_RTC_DRV_EFI rtc-core-y += rtc-efi-platform.o endif -rtc-core-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o -rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o -rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o +rtc-core-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o +rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o +rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o # Keep the list ordered. -obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o obj-$(CONFIG_RTC_DRV_88PM80X) += rtc-88pm80x.o +obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o @@ -43,7 +43,6 @@ obj-$(CONFIG_RTC_DRV_DA9063) += rtc-da9063.o obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o obj-$(CONFIG_RTC_DRV_DIGICOLOR) += rtc-digicolor.o obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o -obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o obj-$(CONFIG_RTC_DRV_DS1302) += rtc-ds1302.o @@ -58,20 +57,21 @@ obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1685_FAMILY) += rtc-ds1685.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o -obj-$(CONFIG_RTC_DRV_DS2404) += rtc-ds2404.o +obj-$(CONFIG_RTC_DRV_DS2404) += rtc-ds2404.o obj-$(CONFIG_RTC_DRV_DS3232) += rtc-ds3232.o obj-$(CONFIG_RTC_DRV_DS3234) += rtc-ds3234.o obj-$(CONFIG_RTC_DRV_EFI) += rtc-efi.o obj-$(CONFIG_RTC_DRV_EM3027) += rtc-em3027.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o +obj-$(CONFIG_RTC_DRV_GEMINI) += rtc-gemini.o obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o obj-$(CONFIG_RTC_DRV_HYM8563) += rtc-hym8563.o obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o -obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o obj-$(CONFIG_RTC_DRV_ISL12057) += rtc-isl12057.o +obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o obj-$(CONFIG_RTC_DRV_LP8788) += rtc-lp8788.o obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o @@ -82,32 +82,35 @@ obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o obj-$(CONFIG_RTC_DRV_M48T35) += rtc-m48t35.o obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o -obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o +obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o +obj-$(CONFIG_RTC_DRV_MAX77686) += rtc-max77686.o +obj-$(CONFIG_RTC_DRV_MAX77802) += rtc-max77802.o obj-$(CONFIG_RTC_DRV_MAX8907) += rtc-max8907.o obj-$(CONFIG_RTC_DRV_MAX8925) += rtc-max8925.o -obj-$(CONFIG_RTC_DRV_MAX8998) += rtc-max8998.o obj-$(CONFIG_RTC_DRV_MAX8997) += rtc-max8997.o -obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o -obj-$(CONFIG_RTC_DRV_MAX77686) += rtc-max77686.o -obj-$(CONFIG_RTC_DRV_MAX77802) += rtc-max77802.o +obj-$(CONFIG_RTC_DRV_MAX8998) += rtc-max8998.o obj-$(CONFIG_RTC_DRV_MC13XXX) += rtc-mc13xxx.o obj-$(CONFIG_RTC_DRV_MCP795) += rtc-mcp795.o -obj-$(CONFIG_RTC_DRV_MSM6242) += rtc-msm6242.o +obj-$(CONFIG_RTC_DRV_MOXART) += rtc-moxart.o obj-$(CONFIG_RTC_DRV_MPC5121) += rtc-mpc5121.o +obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o +obj-$(CONFIG_RTC_DRV_MSM6242) += rtc-msm6242.o +obj-$(CONFIG_RTC_DRV_MT6397) += rtc-mt6397.o obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o +obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o obj-$(CONFIG_RTC_DRV_NUC900) += rtc-nuc900.o -obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o +obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o obj-$(CONFIG_RTC_DRV_PALMAS) += rtc-palmas.o obj-$(CONFIG_RTC_DRV_PCAP) += rtc-pcap.o +obj-$(CONFIG_RTC_DRV_PCF2123) += rtc-pcf2123.o obj-$(CONFIG_RTC_DRV_PCF2127) += rtc-pcf2127.o +obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o +obj-$(CONFIG_RTC_DRV_PCF85063) += rtc-pcf85063.o obj-$(CONFIG_RTC_DRV_PCF8523) += rtc-pcf8523.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o -obj-$(CONFIG_RTC_DRV_PCF85063) += rtc-pcf85063.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o -obj-$(CONFIG_RTC_DRV_PCF2123) += rtc-pcf2123.o -obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o @@ -130,21 +133,23 @@ obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o obj-$(CONFIG_RTC_DRV_S5M) += rtc-s5m.o obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o +obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o obj-$(CONFIG_RTC_DRV_SNVS) += rtc-snvs.o obj-$(CONFIG_RTC_DRV_SPEAR) += rtc-spear.o obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o obj-$(CONFIG_RTC_DRV_STMP) += rtc-stmp3xxx.o +obj-$(CONFIG_RTC_DRV_ST_LPC) += rtc-st-lpc.o obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o obj-$(CONFIG_RTC_DRV_SUN6I) += rtc-sun6i.o obj-$(CONFIG_RTC_DRV_SUNXI) += rtc-sunxi.o obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o -obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o obj-$(CONFIG_RTC_DRV_TPS80031) += rtc-tps80031.o +obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o @@ -153,6 +158,3 @@ obj-$(CONFIG_RTC_DRV_WM831X) += rtc-wm831x.o obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o obj-$(CONFIG_RTC_DRV_XGENE) += rtc-xgene.o -obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o -obj-$(CONFIG_RTC_DRV_ST_LPC) += rtc-st-lpc.o -obj-$(CONFIG_RTC_DRV_MOXART) += rtc-moxart.o diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 166fc60d8b55..11b639067312 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -91,51 +91,6 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) } EXPORT_SYMBOL_GPL(rtc_set_time); -int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) -{ - int err; - - err = mutex_lock_interruptible(&rtc->ops_lock); - if (err) - return err; - - if (!rtc->ops) - err = -ENODEV; - else if (rtc->ops->set_mmss64) - err = rtc->ops->set_mmss64(rtc->dev.parent, secs); - else if (rtc->ops->set_mmss) - err = rtc->ops->set_mmss(rtc->dev.parent, secs); - else if (rtc->ops->read_time && rtc->ops->set_time) { - struct rtc_time new, old; - - err = rtc->ops->read_time(rtc->dev.parent, &old); - if (err == 0) { - rtc_time64_to_tm(secs, &new); - - /* - * avoid writing when we're going to change the day of - * the month. We will retry in the next minute. This - * basically means that if the RTC must not drift - * by more than 1 minute in 11 minutes. - */ - if (!((old.tm_hour == 23 && old.tm_min == 59) || - (new.tm_hour == 23 && new.tm_min == 59))) - err = rtc->ops->set_time(rtc->dev.parent, - &new); - } - } else { - err = -EINVAL; - } - - pm_stay_awake(rtc->dev.parent); - mutex_unlock(&rtc->ops_lock); - /* A timer might have just expired */ - schedule_work(&rtc->irqwork); - - return err; -} -EXPORT_SYMBOL_GPL(rtc_set_mmss); - static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *alarm) { int err; @@ -976,14 +931,12 @@ int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer *timer, * * Kernel interface to cancel an rtc_timer */ -int rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer *timer) +void rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer *timer) { - int ret = 0; mutex_lock(&rtc->ops_lock); if (timer->enabled) rtc_timer_remove(rtc, timer); mutex_unlock(&rtc->ops_lock); - return ret; } diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 6856f0a3a3d5..133d2e2e1a25 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c @@ -442,7 +442,7 @@ static const struct rtc_class_ops ab8540_rtc_ops = { .alarm_irq_enable = ab8500_rtc_irq_enable, }; -static struct platform_device_id ab85xx_rtc_ids[] = { +static const struct platform_device_id ab85xx_rtc_ids[] = { { "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, }, { "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, }, }; diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c index d618d6c7ef93..83ac2337c0f7 100644 --- a/drivers/rtc/rtc-at32ap700x.c +++ b/drivers/rtc/rtc-at32ap700x.c @@ -282,6 +282,6 @@ static struct platform_driver at32_rtc_driver = { module_platform_driver_probe(at32_rtc_driver, at32_rtc_probe); -MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); +MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); MODULE_DESCRIPTION("Real time clock for AVR32 AT32AP700x"); MODULE_LICENSE("GPL"); diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c index d16f550897b8..12dbd70859ae 100644 --- a/drivers/rtc/rtc-ds1216.c +++ b/drivers/rtc/rtc-ds1216.c @@ -144,15 +144,13 @@ static int __init ds1216_rtc_probe(struct platform_device *pdev) struct ds1216_priv *priv; u8 dummy[8]; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->ioaddr = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(priv->ioaddr)) return PTR_ERR(priv->ioaddr); diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index 2fe537f4e2bd..8247a29a4eb4 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c @@ -332,13 +332,11 @@ static int ds1286_probe(struct platform_device *pdev) struct resource *res; struct ds1286_priv *priv; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL); if (!priv) return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->rtcregs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(priv->rtcregs)) return PTR_ERR(priv->rtcregs); diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 4ffabb322a9a..6e76de1856fc 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -742,17 +742,17 @@ static int mcp794xx_set_alarm(struct device *dev, struct rtc_wkalrm *t) regs[6] &= ~MCP794XX_BIT_ALMX_IF; /* Set alarm match: second, minute, hour, day, date, month. */ regs[6] |= MCP794XX_MSK_ALMX_MATCH; - - if (t->enabled) - regs[0] |= MCP794XX_BIT_ALM0_EN; - else - regs[0] &= ~MCP794XX_BIT_ALM0_EN; + /* Disable interrupt. We will not enable until completely programmed */ + regs[0] &= ~MCP794XX_BIT_ALM0_EN; ret = ds1307->write_block_data(client, MCP794XX_REG_CONTROL, 10, regs); if (ret < 0) return ret; - return 0; + if (!t->enabled) + return 0; + regs[0] |= MCP794XX_BIT_ALM0_EN; + return i2c_smbus_write_byte_data(client, MCP794XX_REG_CONTROL, regs[0]); } static int mcp794xx_alarm_irq_enable(struct device *dev, unsigned int enabled) diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index a4888dbca2e1..92b1cbf2c4a7 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c @@ -198,6 +198,7 @@ static struct i2c_device_id ds1672_id[] = { { "ds1672", 0 }, { } }; +MODULE_DEVICE_TABLE(i2c, ds1672_id); static struct i2c_driver ds1672_driver = { .driver = { diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index cb989cd00b14..3806961b4348 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -3,7 +3,7 @@ * * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * - * Author: dann frazier <dannf@hp.com> + * Author: dann frazier <dannf@dannf.org> * Based on efirtc.c by Stephane Eranian * * This program is free software; you can redistribute it and/or modify it @@ -24,10 +24,6 @@ #include <linux/efi.h> #define EFI_ISDST (EFI_TIME_ADJUST_DAYLIGHT|EFI_TIME_IN_DAYLIGHT) -/* - * EFI Epoch is 1/1/1998 - */ -#define EFI_RTC_EPOCH 1998 /* * returns day of the year [0-365] @@ -38,31 +34,24 @@ compute_yday(efi_time_t *eft) /* efi_time_t.month is in the [1-12] so, we need -1 */ return rtc_year_days(eft->day, eft->month - 1, eft->year); } + /* * returns day of the week [0-6] 0=Sunday - * - * Don't try to provide a year that's before 1998, please ! */ static int -compute_wday(efi_time_t *eft) +compute_wday(efi_time_t *eft, int yday) { - int y; - int ndays = 0; - - if (eft->year < EFI_RTC_EPOCH) { - pr_err("EFI year < " __stringify(EFI_RTC_EPOCH) ", invalid date\n"); - return -1; - } - - for (y = EFI_RTC_EPOCH; y < eft->year; y++) - ndays += 365 + (is_leap_year(y) ? 1 : 0); - - ndays += compute_yday(eft); + int ndays = eft->year * (365 % 7) + + (eft->year - 1) / 4 + - (eft->year - 1) / 100 + + (eft->year - 1) / 400 + + yday; /* - * 4=1/1/1998 was a Thursday + * 1/1/0000 may or may not have been a Sunday (if it ever existed at + * all) but assuming it was makes this calculation work correctly. */ - return (ndays + 4) % 7; + return ndays % 7; } static void @@ -103,16 +92,16 @@ convert_from_efi_time(efi_time_t *eft, struct rtc_time *wtime) if (!eft->month || eft->month > 12) return false; wtime->tm_mon = eft->month - 1; - wtime->tm_year = eft->year - 1900; - /* day of the week [0-6], Sunday=0 */ - wtime->tm_wday = compute_wday(eft); - if (wtime->tm_wday < 0) + if (eft->year < 1900 || eft->year > 9999) return false; + wtime->tm_year = eft->year - 1900; /* day in the year [1-365]*/ wtime->tm_yday = compute_yday(eft); + /* day of the week [0-6], Sunday=0 */ + wtime->tm_wday = compute_wday(eft, wtime->tm_yday); switch (eft->daylight & EFI_ISDST) { case EFI_ISDST: @@ -233,7 +222,7 @@ static struct platform_driver efi_rtc_driver = { module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); MODULE_ALIAS("platform:rtc-efi"); -MODULE_AUTHOR("dann frazier <dannf@hp.com>"); +MODULE_AUTHOR("dann frazier <dannf@dannf.org>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("EFI RTC driver"); MODULE_ALIAS("platform:rtc-efi"); diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index de325d68c7e4..a1628adf9f52 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c @@ -45,7 +45,7 @@ static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); unsigned long comp; - comp = __raw_readl(ep93xx_rtc->mmio_base + EP93XX_RTC_SWCOMP); + comp = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_SWCOMP); if (preload) *preload = (comp & EP93XX_RTC_SWCOMP_INT_MASK) @@ -63,7 +63,7 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); unsigned long time; - time = __raw_readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA); + time = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA); rtc_time_to_tm(time, tm); return 0; @@ -73,7 +73,7 @@ static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs) { struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); - __raw_writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD); + writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD); return 0; } diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c new file mode 100644 index 000000000000..35f4486738fc --- /dev/null +++ b/drivers/rtc/rtc-gemini.c @@ -0,0 +1,175 @@ +/* + * Gemini OnChip RTC + * + * Copyright (C) 2009 Janos Laube <janos.dev@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Original code for older kernel 2.6.15 are from Stormlinksemi + * first update from Janos Laube for > 2.6.29 kernels + * + * checkpatch fixes and usage of rtc-lib code + * Hans Ulli Kroll <ulli.kroll@googlemail.com> + */ + +#include <linux/rtc.h> +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/platform_device.h> +#include <linux/kernel.h> +#include <linux/module.h> + +#define DRV_NAME "rtc-gemini" +#define DRV_VERSION "0.2" + +MODULE_AUTHOR("Hans Ulli Kroll <ulli.kroll@googlemail.com>"); +MODULE_DESCRIPTION("RTC driver for Gemini SoC"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); + +struct gemini_rtc { + struct rtc_device *rtc_dev; + void __iomem *rtc_base; + int rtc_irq; +}; + +enum gemini_rtc_offsets { + GEMINI_RTC_SECOND = 0x00, + GEMINI_RTC_MINUTE = 0x04, + GEMINI_RTC_HOUR = 0x08, + GEMINI_RTC_DAYS = 0x0C, + GEMINI_R |