summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
...
| * rtc: pcf85363: add alarm supportAlexandre Belloni2018-03-171-0/+159
| | | | | | | | | | | | Handle alarms, currently only on INTA Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: pcf85363: add .max_register in regmap_configAlexandre Belloni2018-03-171-0/+1
| | | | | | | | | | | | This helps debugging as it allows reading registers from debugfs. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: m41t80: remove useless indirectionAlexandre Belloni2018-03-171-15/+5
| | | | | | | | | | | | | | m41t80_get_datetime and m41t80_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: m41t80: fix race conditionsAlexandre Belloni2018-03-171-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler, leading to: Unable to handle kernel NULL pointer dereference at virtual address 0000017c pgd = a38a2f9b [0000017c] *pgd=00000000 Internal error: Oops: 5 [#1] ARM Modules linked in: CPU: 0 PID: 613 Comm: irq/48-m41t80 Not tainted 4.16.0-rc1+ #42 Hardware name: Atmel SAMA5 PC is at mutex_lock+0x14/0x38 LR is at m41t80_handle_irq+0x1c/0x9c pc : [<c06e864c>] lr : [<c04b70f0>] psr: 20000013 sp : dec73f30 ip : 00000000 fp : dec56d98 r10: df437cf0 r9 : c0a03008 r8 : c0145ffc r7 : df5c4300 r6 : dec568d0 r5 : df593000 r4 : 0000017c r3 : df592800 r2 : 60000013 r1 : df593000 r0 : 0000017c Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c53c7d Table: 20004059 DAC: 00000051 Process irq/48-m41t80 (pid: 613, stack limit = 0xb52d091e) Stack: (0xdec73f30 to 0xdec74000) 3f20: dec56840 df5c4300 00000001 df5c4300 3f40: c0145ffc c0146018 dec56840 ffffe000 00000001 c0146290 dec567c0 00000000 3f60: c0146084 ed7c9a62 c014615c dec56d80 dec567c0 00000000 dec72000 dec56840 3f80: c014615c c012ffc0 dec72000 dec567c0 c012fe80 00000000 00000000 00000000 3fa0: 00000000 00000000 00000000 c01010e8 00000000 00000000 00000000 00000000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 29282726 2d2c2b2a [<c06e864c>] (mutex_lock) from [<c04b70f0>] (m41t80_handle_irq+0x1c/0x9c) [<c04b70f0>] (m41t80_handle_irq) from [<c0146018>] (irq_thread_fn+0x1c/0x54) [<c0146018>] (irq_thread_fn) from [<c0146290>] (irq_thread+0x134/0x1c0) [<c0146290>] (irq_thread) from [<c012ffc0>] (kthread+0x140/0x148) [<c012ffc0>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) Exception stack(0xdec73fb0 to 0xdec73ff8) 3fa0: 00000000 00000000 00000000 00000000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 Code: e3c33d7f e3c3303f f5d0f000 e593300c (e1901f9f) ---[ end trace 22b027302eb7c604 ]--- genirq: exiting task "irq/48-m41t80" (613) is an active IRQ thread (irq 48) Also, there is another possible race condition. The probe function is not allowed to fail after the RTC is registered because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ and register it as late as possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: m41t80: move m41t80_rtc_mutex to the block where it is usedSebastian Andrzej Siewior2018-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Without CONFIG_RTC_DRV_M41T80_WDT the compiler complains: |drivers/rtc/rtc-m41t80.c:76 ‘m41t80_rtc_mutex’ defined but not used [-Wunused-variable] Move the variable to the block where it is used. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: pcf85063: remove useless indirectionAlexandre Belloni2018-03-171-12/+4
| | | | | | | | | | | | | | pcf85063_get_datetime and pcf85063_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: pcf85063: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-171-1/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: max6900: remove useless indirectionAlexandre Belloni2018-03-171-13/+4
| | | | | | | | | | | | | | max6900_i2c_read_time and max6900_i2c_set_time are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: max6900: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-171-1/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rs5c372: remove useless indirectionAlexandre Belloni2018-03-171-13/+4
| | | | | | | | | | | | | | rs5c372_get_datetime and rs5c372_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rs5c372: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-171-2/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rs5c372: remove useless messageAlexandre Belloni2018-03-171-4/+0
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: s35390a: remove useless indirectionAlexandre Belloni2018-03-171-24/+8
| | | | | | | | | | | | | | | | s35390a_set_datetime, s35390a_get_datetime, s35390a_set_alarm and s35390a_read_alarm are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: s35390a: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-171-1/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: s35390a: remove useless messageAlexandre Belloni2018-03-171-4/+0
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rk808: fix possible race conditionAlexandre Belloni2018-03-171-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The probe function is not allowed to fail after registering the RTC because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc as late as possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rk808: remove useless debug messageAlexandre Belloni2018-03-171-11/+0
| | | | | | | | | | | | | | | | At probe time, printing a message when the time is invalid doesn't have much value. Also, as the comment suggest, this is a leftover from development wherhe this was used to set the RTc to a default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rx8581: remove useless messageAlexandre Belloni2018-03-021-5/+1
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rx4581: remove useless messageAlexandre Belloni2018-03-021-5/+1
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: pm8xxx: remove useless messageAlexandre Belloni2018-03-021-6/+0
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: abx80x: remove useless messageAlexandre Belloni2018-03-021-5/+1
| | | | | | | | | | | | | | It is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tegra: stop validating rtc_time in .set_timeAlexandre Belloni2018-03-021-4/+0
| | | | | | | | | | | | | | The RTC core is always validating the rtc_time struct before calling .set_time. It is not necessary to do it again in .set_time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: spear: stop validating rtc_time in .set_time and .set_alarmAlexandre Belloni2018-03-021-9/+3
| | | | | | | | | | | | | | The RTC core is always validating the rtc_time struct before calling .set_time or .set_alarm. It is not necessary to do it again. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: omap: stop validating rtc_time in .set_time and .set_alarmAlexandre Belloni2018-03-021-3/+0
| | | | | | | | | | | | | | | | | | The RTC core is always validating the rtc_time struct before calling .set_time or .set_alarm. It is not necessary to do it again. Also, rtc_time_to_tm never generates an invalid rtc_tm (it can be out of range though). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: max77686: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-3/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: m41t93: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: isl12022: remove useless indirectionAlexandre Belloni2018-03-021-12/+4
| | | | | | | | | | | | | | isl12022_get_datetime and isl12022_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: sc27xx: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | | | | | | | | | | | | rtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback. Reviewed-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: r7301: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: nuc900: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-6/+8
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: diasemi: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-023-4/+3
| | | | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback. Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: cpcap: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: ab-b5ze-s3: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-3/+1
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-0248-53/+48
| | | | | | | | | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: stop validating rtc_time after rtc_time_to_tmAlexandre Belloni2018-03-0113-13/+13
| | | | | | | | | | | | | | rtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: stop validating rtc_time after rtc_time64_to_tmAlexandre Belloni2018-03-013-3/+3
| | | | | | | | | | | | | | rtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: stk17ta8: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | | | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: rs5c348: let the core handle invalid timeAlexandre Belloni2018-03-011-5/+0
| | | | | | | | | | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: cmos: let the core handle invalid timeAlexandre Belloni2018-03-011-12/+0
| | | | | | | | | | | | | | Setting the rtc to a valid time when the time is invalid is a bad practice, because then userspace doesn't know it shouldn't trust the RTC. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: ds1553: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | | | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: ds1511: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | | | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: avoid unintended sign extension on a 24 bit shiftColin Ian King2018-03-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The shifting of buf[5] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an unsigned long. If the top bit of buf[5] is set then all then all the upper bits sec end up as also being set because of the sign-extension. Fix this by casting buf[5] to an unsigned long before the shift. Detected by CoverityScan, CID#1465292 ("Unintended sign extension") Fixes: 0e1492330cd2 ("rtc: add rtc-tx4939 driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: mxc_v2: Fix _iomem pointer notationFabio Estevam2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the iomem pointer notation in order to fix the following sparse warnings: drivers/rtc/rtc-mxc_v2.c:280:18: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:280:18: expected void const volatile [noderef] <asn:2>*addr drivers/rtc/rtc-mxc_v2.c:280:18: got void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:329:44: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:329:44: expected void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:329:44: got void [noderef] <asn:2>* drivers/rtc/rtc-mxc_v2.c:339:44: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:339:44: expected void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:339:44: got void [noderef] <asn:2>* Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: isl1208: Fix unintended clear of SR bitsDenis Osterland2018-03-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After successful sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); sr will be 0. As a result sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr & ~ISL1208_REG_SR_WRTC); is equal to sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, 0); which clears all flags in SR. Add an additional read of SR, to have value of SR in sr again. Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: use generic nvmemAlexandre Belloni2018-03-011-33/+26
| | | | | | | | | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: fix possible race conditionAlexandre Belloni2018-03-011-2/+3
| | | | | | | | | | | | | | The probe function is not allowed to fail after registering the RTC. Call rtc_register_device() at the end. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+8
| | | | | | | | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: extend test coverageAlexandre Belloni2018-03-011-1/+1
| | | | | | | | | | | | | | The rtc-tx4939 driver now compiles correctly on other architectures, add COMPILE_TEST to improve code coverage. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: tx4939: remove arch/mips dependencyAlexandre Belloni2018-03-011-1/+24
| | | | | | | | | | | | | | Copy RTC definitions from arch/mips/include/asm/txx9/tx4939.h to the RTC driver so it doesn't depend on arch/mips anymore. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| * rtc: stk17ta8: use generic nvmemAlexandre Belloni2018-03-011-40/+24
| | | | | | | | | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
OpenPOWER on IntegriCloud