WSL2-Linux-Kernel/drivers/rtc
Thomas Gleixner 211e5db19d rtc: mc146818: Detect and handle broken RTCs
The recent fix for handling the UIP bit unearthed another issue in the RTC
code. If the RTC is advertised but the readout is straight 0xFF because
it's not available, the old code just proceeded with crappy values, but the
new code hangs because it waits for the UIP bit to become low.

Add a sanity check in the RTC CMOS probe function which reads the RTC_VALID
register (Register D) which should have bit 0-6 cleared. If that's not the
case then fail to register the CMOS.

Add the same check to mc146818_get_time(), warn once when the condition
is true and invalidate the rtc_time data.

Reported-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Mickaël Salaün <mic@linux.microsoft.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/87tur3fx7w.fsf@nanos.tec.linutronix.de
2021-01-27 09:36:22 +01:00
..
Kconfig rtc: mxc{,_v2}: enable COMPILE_TEST 2020-12-03 23:42:36 +01:00
Makefile ntp, rtc: Move rtc_set_ntp_time() to ntp code 2020-12-11 10:40:52 +01:00
class.c RTC for 5.11 2020-12-20 10:12:06 -08:00
dev.c compat_ioctl: move rtc handling into drivers/rtc/dev.c 2019-10-23 17:23:43 +02:00
interface.c rtc: interface: fix kerneldoc comments 2019-11-27 09:31:08 +01:00
lib.c rtc: lib: check whether tm->tm_year in int32 range 2019-04-06 15:05:31 +02:00
nvmem.c rtc: nvmem: emit an error message when nvmem registration fails 2020-11-19 12:50:12 +01:00
proc.c rtc: core: correct trivial checkpatch warnings 2019-04-04 10:07:08 +02:00
rtc-88pm80x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-88pm860x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ab-b5ze-s3.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ab-eoz9.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ab3100.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ab8500.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-abx80x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ac100.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-armada38x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-as3722.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
rtc-asm9260.c rtc: asm9260: add the missed check for devm_clk_get 2019-12-23 11:16:23 +01:00
rtc-aspeed.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-at91rm9200.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-at91sam9.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-au1xxx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-bd70528.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-bq32k.c rtc: Replace HTTP links with HTTPS ones 2020-07-16 11:17:52 +02:00
rtc-bq4802.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
rtc-brcmstb-waketimer.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-cadence.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-cmos.c rtc: mc146818: Detect and handle broken RTCs 2021-01-27 09:36:22 +01:00
rtc-coh901331.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-core.h rtc: move rtc_add_group/s definitions 2018-09-28 14:20:59 +02:00
rtc-cpcap.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-cros-ec.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-da9052.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-da9055.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtc-da9063.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-davinci.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-digicolor.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-dm355evm.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1216.c rtc: use devm_platform_ioremap_resource() to simplify code 2019-10-07 01:07:35 +02:00
rtc-ds1286.c rtc: use devm_platform_ioremap_resource() to simplify code 2019-10-07 01:07:35 +02:00
rtc-ds1302.c rtc: ds1302: Remove unused DRV_NAME 2019-11-15 11:58:14 +01:00
rtc-ds1305.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1307.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1343.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1347.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1374.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1390.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-ds1511.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1553.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1672.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1685.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds1742.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds2404.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ds3232.c rtc: add devm_ prefix to rtc_nvmem_register() 2020-11-19 12:50:11 +01:00
rtc-efi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtc-em3027.c rtc: em3027: correct month value 2019-11-08 16:14:09 +01:00
rtc-ep93xx.c rtc: ep93xx: Fix NULL pointer dereference in ep93xx_rtc_read_time 2020-12-03 23:49:31 +01:00
rtc-fm3130.c RTC for 5.3 2019-07-17 10:03:50 -07:00
rtc-fsl-ftm-alarm.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ftrtc010.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-generic.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
rtc-goldfish.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-hid-sensor-time.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
rtc-hym8563.c rtc: hym8563: enable wakeup when applicable 2020-11-14 23:36:10 +01:00
rtc-imx-sc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-imxdi.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-isl1208.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-isl12022.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-isl12026.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-jz4740.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-lp8788.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-lpc24xx.c rtc: remove unnecessary error message after platform_get_irq 2020-04-15 09:56:17 +02:00
rtc-lpc32xx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ls1x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-m41t80.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-m41t93.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-m41t94.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-m48t35.c rtc: m48t35: remove SGI-IP27 kludge 2020-03-16 11:12:11 +01:00
rtc-m48t59.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-m48t86.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-max6900.c rtc: max6900: remove useless indirection 2018-03-17 14:20:46 +01:00
rtc-max6902.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-max6916.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-max8907.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-max8925.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-max8997.c rtc: max8997: Fix the returned value in case of error in 'max8997_rtc_read_alarm()' 2018-11-22 18:11:35 +01:00
rtc-max8998.c rtc: maxim: Add SPDX license identifiers 2018-08-14 23:38:45 +02:00
rtc-max77686.c rtc: max77686: Fix wake-ups for max77620 2020-08-07 23:29:47 +02:00
rtc-mc13xxx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mc146818-lib.c rtc: mc146818: Detect and handle broken RTCs 2021-01-27 09:36:22 +01:00
rtc-mcp795.c rtc: Replace HTTP links with HTTPS ones 2020-07-16 11:17:52 +02:00
rtc-meson-vrtc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-meson.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-moxart.c rtc: moxart: Convert to SPDX identifier 2019-12-23 11:23:49 +01:00
rtc-mpc5121.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mrst.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-msm6242.c rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions 2019-11-18 15:23:54 +01:00
rtc-mt2712.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mt6397.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mt7622.c rtc: use devm_platform_ioremap_resource() to simplify code 2019-10-07 01:07:35 +02:00
rtc-mv.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mxc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-mxc_v2.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-omap.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-opal.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 114 2019-05-24 17:39:01 +02:00
rtc-palmas.c
rtc-pcap.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pcf2123.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pcf2127.c rtc: pcf2127: only use watchdog when explicitly available 2020-12-19 01:57:44 +01:00
rtc-pcf8523.c rtc: pcf8523: use BIT 2020-11-19 12:52:25 +01:00
rtc-pcf8563.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pcf8583.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-pcf50633.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtc-pcf85063.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pcf85363.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pic32.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pl030.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pl031.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pm8xxx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-ps3.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-pxa.c rtc: Remove dev_err() usage after platform_get_irq() 2019-08-13 10:53:10 +02:00
rtc-r7301.c rtc: Use devm_platform_ioremap_resource() 2019-10-06 21:04:51 +02:00
rtc-r9701.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rc5t583.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
rtc-rc5t619.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rk808.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rp5c01.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rs5c313.c rtc: rtc-rs5c313: Convert to module_platform_driver() 2020-08-21 00:13:44 +02:00
rtc-rs5c348.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rs5c372.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-rtd119x.c rtc: use devm_platform_ioremap_resource() to simplify code 2019-10-07 01:07:35 +02:00
rtc-rv3028.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rv3029c2.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rv3032.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rv8803.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rx4581.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-rx6110.c rtc: rx6110: add i2c support 2020-11-17 20:30:30 +01:00
rtc-rx8010.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-rx8025.c rtc: rx8025: Remove struct i2c_client from struct rx8025_data 2019-12-23 11:22:21 +01:00
rtc-rx8581.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-s3c.c rtc: s3c: Remove dead code related to periodic tick handling 2020-12-03 23:51:30 +01:00
rtc-s3c.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-s5m.c rtc: s5m: convert to i2c_new_dummy_device 2019-07-23 20:34:31 +02:00
rtc-s35390a.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sa1100.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sa1100.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtc-sc27xx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sd3078.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sh.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sirfsoc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-snvs.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-spear.c rtc: use devm_platform_ioremap_resource() to simplify code 2019-10-07 01:07:35 +02:00
rtc-st-lpc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-starfire.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-stk17ta8.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-stm32.c rtc: stm32: add missed clk_disable_unprepare in error path of resume 2019-12-10 14:29:23 +01:00
rtc-stmp3xxx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sun4v.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sun6i.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-sunxi.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-tegra.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-test.c rtc: test: remove debug message 2020-12-03 23:43:23 +01:00
rtc-tps6586x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-tps65910.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-tps80031.c
rtc-twl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtc-tx4939.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-v3020.c rtc: v3020: remove set but unused variable 2019-11-27 09:31:13 +01:00
rtc-vr41xx.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-vt8500.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-wilco-ec.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-wm831x.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-wm8350.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtc-x1205.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rtc-xgene.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
rtc-zynqmp.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
sysfs.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00