summaryrefslogtreecommitdiff
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
* drivers: rtc: add max313xx series rtc driverChris Packham2023-03-303-0/+473
| | | | | | | | | | | | | | Adding support for Analog Devices MAX313XX series RTCs. This is ported from the Linux driver and adapted for use in u-boot. Notable differences are - handling of tm_year and tm_mon differ - clock source support is omitted - hwmon support for the MAX31328 and MAX31343 is omitted - rtc_ops->reset is added Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: m41t62: implements read8/write8 operationsThomas Perrot2023-03-301-0/+12
| | | | | | | | These operations are required by dm_rtc_read and dm_bootcount_get helpers. Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox: Tidy up RTC optionsSimon Glass2023-03-022-2/+20
| | | | | | | | At present we enable the sandbox RTC driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc: Drop old and unused driversSimon Glass2023-02-0712-2114/+0
| | | | | | | These drivers are not used and have not been converted to driver model. Drop them and references to the non-existent CONFIG options they use. Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc: abx8xx: Add support for reading RAMSean Anderson2023-01-111-17/+51
| | | | | | | | | | | | | This adds support for reading the battery-backed memory present on these RTCs. This modifies the read/write methods to access the RAM instead of raw register offsets. No one was using these in-tree, so we should be fine changing them. We use the "standard" address space window to access the RAM. The extension RAM address register has some reserved bits, but we write the whole thing for simplicity (as these bits default to 0). Signed-off-by: Sean Anderson <sean.anderson@seco.com>
* rtc: add ht1380 driverSergei Antonov2023-01-023-0/+339
| | | | | | | | | | | Support Holtek HT1380/HT1381 Serial Timekeeper Chip. It provides seconds , minutes, hours, day of the week, date, month and year information. Datasheet: https://www.holtek.com.tw/documents/10179/11842/ht1380_1v130.pdf Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* global: Migrate CONFIG_FTRTC010_PCLK to CFGTom Rini2022-12-231-1/+1
| | | | | | Perform a simple rename of CONFIG_FTRTC010_PCLK to CFG_FTRTC010_PCLK Signed-off-by: Tom Rini <trini@konsulko.com>
* global: Migrate CONFIG_FTRTC010_EXTCLK to CFGTom Rini2022-12-231-1/+1
| | | | | | Perform a simple rename of CONFIG_FTRTC010_EXTCLK to CFG_FTRTC010_EXTCLK Signed-off-by: Tom Rini <trini@konsulko.com>
* malta: Rename CONFIG_MALTA to CONFIG_TARGET_MALTATom Rini2022-12-221-1/+1
| | | | | | | Fixup this last remnant of CONFIG_MALTA. Cc: Paul Burton <paul.burton@mips.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* Convert CONFIG_RTC_DS1337 et al to KconfigTom Rini2022-12-051-1/+41
| | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_RTC_DS1337 CONFIG_RTC_DS1337_NOOSC CONFIG_RTC_DS1338 CONFIG_RTC_DS1374 CONFIG_RTC_DS3231 CONFIG_RTC_MC13XXX CONFIG_RTC_MXS CONFIG_RTC_PT7C4338 Signed-off-by: Tom Rini <trini@konsulko.com>
* global: Move remaining CONFIG_SYS_* to CFG_SYS_*Tom Rini2022-12-0511-43/+43
| | | | | | | | | | The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: Remove unused driversTom Rini2022-12-054-525/+0
| | | | | | | | These RTC drivers are currently unused and reference other unused CONFIG variables, so remove them. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: Remove unused driversTom Rini2022-11-105-669/+0
| | | | | | | These drivers are not enabled anywhere, remove them. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Convert CONFIG_SYS_INTERLAKEN et al to KconfigTom Rini2022-11-101-1/+1
| | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_INTERLAKEN CONFIG_SYS_ISA_IO CONFIG_SYS_ISA_IO_BASE_ADDRESS Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* treewide: Fix Marek's name and change my e-mail addressMarek Behún2022-07-211-1/+1
| | | | | | | | | | Fix diacritics in some instances of my name and change my e-mail address to kabel@kernel.org. Add corresponding .mailmap entries. Signed-off-by: Marek Behún <kabel@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
* test: Load mac address using RTCSean Anderson2022-06-081-0/+10
| | | | | | | This uses the nvmem API to load a mac address from an RTC. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: rv8803: fix off-by-one in month countingOliver Graute2022-05-051-2/+2
| | | | | | | | | | tm_mon has a range from 0..11, but the RTC expects 1..12. So we adapt the month accordingly. This was determined when comparing the driver with the corresponding linux kernel driver. Signed-off-by: Oliver Graute <oliver.graute@kococonnector.com> Reviewed-by: Michael Walle <michael@walle.cc> Reviewed-by: Heiko Schocher <hs@denx.de>
* vpl: Add Kconfig options for VPLSimon Glass2022-05-021-0/+9
| | | | | | Add VPL versions of commonly used Kconfig options. Signed-off-by: Simon Glass <sjg@chromium.org>
* Convert CONFIG_MCFRTC et al to KconfigTom Rini2022-04-012-4/+8
| | | | | | | | | | This converts the following to Kconfig: CONFIG_MCFRTC CONFIG_SYS_MCFRTC_BASE While at it, remove '#undef RTC_DEBUG' from these config files. Signed-off-by: Tom Rini <trini@konsulko.com>
* drivers: rtc: fix null pointer access in armada38x_rtc_resetFrancois Berder2022-03-041-1/+1
| | | | | | | | Replace null pointer by pointer to device registers when calling armada38x_rtc_write. Signed-off-by: Francois Berder <fberder@outlook.fr> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: ds1307: Add bindings for microchip, mcp7940xPali Rohár2022-02-171-0/+1
| | | | | | | | Compatible string microchip,mcp7940x is used by Turris Mox DTS file in Linux kernel and U-Boot ds1307.c driver works fine with it. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: pcf2127: remove U-Boot specific compatible stringVladimir Oltean2022-02-011-1/+0
| | | | | | | | | | | Now that all in-tree boards have been converted to the compatible strings from Linux, delete the support for the ad-hoc "pcf2127-rtc" one. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Walle <michael@walle.cc> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
* rtc: pcf2127: sync with Linux compatible stringsVladimir Oltean2022-02-011-0/+3
| | | | | | | | | | | | | Allow this driver to be used by boards which inherit their device trees from Linux. Compatibility is temporarily retained with the old compatible string which is U-Boot specific, and will be removed after a few changes. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Walle <michael@walle.cc> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
* rtc: ds1337: fix compatible string typoClemens Gruber2021-11-111-1/+1
| | | | | | | The driver supports the ds1339 as well, which was probably intended by the author but prevented by a typo. Fix the typo. Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
* Merge tag 'u-boot-imx-20211020' of ↵Tom Rini2021-10-201-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20211020 ------------------- First PR from u-boot-imx for 2022.01 CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/9535 - new board: kontron-sl-mx8mm - imx8m: - fix secure boot - imx ESDHC: fixes - i.MX53: Support thum2, bmode and fixes for Menlo board usbarmory switch to Ethernet driver model - imx6 : - DDR calibration for Toradex boards - imx7: - Fixes - Updated gateworks boards (ventana / venice) # gpg verification failed.
| * rtc: rv8803: add epson,rx8803 and epson,rx8900 compatibleHeiko Thiery2021-10-071-0/+2
| | | | | | | | | | | | | | | | | | | | The RX8803 and RX8900 register layouts are compatible with the one of the RV8803. So add these to the compatibles. The same compatible strings are used and approved in linux kernel. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Reviewed-by: Michael Walle <michael@walle.cc>
* | rtc: ds1307: Handle oscillator-stop bit correctlyMark Tomlinson2021-10-121-52/+20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DS1307 driver was originally based on the DS1337 driver. However, the functionality of the clock set/get functions has diverged. In the original DS1337 driver, the set/get functions did the following: 1) Setting the clock ensured the oscillator was enabled. 2) Getting the clock checked and reset the oscillator-stop flag. The DS1307 does not have an oscillator-stop flag, but the driver tried (incorrectly) to emulate this by ensuring the oscillator was running. It really makes no sense to start a stopped clock without setting it. This patch makes the DS1307 driver behave like the original DS1337 driver again. For the DS1307 itself, this is just a removal of code, since there is no oscillator-fail bit to check or reset, and the clock is started when it is set. Since the DS1307 driver can now also be used for the DS1337 and DS1340 which do have this bit, add code to handle the oscillator-stop bit in the same was the original DS1337 driver did -- i.e. report that the oscillator had stopped and clear the flag. This means that setting the date using the date command (which does both a get and a set) will now clear the oscillator-stop flag in addition to setting and starting the clock. The old-style (non-DM) code has not been updated and will be removed in a future patch. Note that this older code does not support the DS1337, as there is a separate driver for this. Also note that the original (DM) code used the wrong control-register address for the DS1337. Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
* rtc: rx8025: revise single register write to use offsetMathew McBride2021-10-031-4/+7
| | | | | | | | | Writing of individual registers was not functioning correctly as a 0 'offset' byte under DM-managed I2C was being appended in front of register we wanted to access. Signed-off-by: Mathew McBride <matt@traverse.com.au>
* rtc: rx8025: set date in a single i2c transactionMathew McBride2021-10-031-21/+23
| | | | | | | | | | | | | | | | | | | | The RX8025/RX8035 does not like having it's time registers set byte-by-byte in separate I2C transactions. From the note at the top of the file, it appears target-dependent workarounds have been used in the past for this. Resolve this by setting the time registers in a single I2C transaction. As part of this, also ensure the '24/12' flag in the RTC is reset before writing the date (instead of after), otherwise the RX8035 will clear the seconds and minutes registers. Tested on Traverse Ten64 (NXP LS1088A) with RX8035. Signed-off-by: Mathew McBride <matt@traverse.com.au>
* rtc: rx8025: add support for EPSON RX8035.Mathew McBride2021-10-031-5/+28
| | | | | | | | | | | | | | The RX8035 is a newer model from EPSON which is very similar in operation to the RX8025. The changes mirror similar ones that will be in Linux 5.15: https://lore.kernel.org/all/20210709044518.28769-2-matt@traverse.com.au/ The UBOOT_DRIVER ID has also been corrected, previously it declared itself as rx8010sj_rtc which is a different driver. Signed-off-by: Mathew McBride <matt@traverse.com.au>
* rtc: rx8025: drop non-DM supportMathew McBride2021-10-032-75/+6
| | | | | | | | | | | A search of the tree showed there is only one user of this driver (soon to be two) - board/socrates The second user will be the Traverse Ten64 board. Both these boards have DM_RTC. Signed-off-by: Mathew McBride <matt@traverse.com.au>
* treewide: Use OF_REAL instead of !OF_PLATDATASimon Glass2021-09-251-1/+1
| | | | | | | Now that we have a 'positive' Kconfig option, use this instead of the negative one, which is harder to understand. Signed-off-by: Simon Glass <sjg@chromium.org>
* Remove including timestamp.h in version.hWIP/2021-09-16-general-updatesPali Rohár2021-09-171-1/+1
| | | | | | | | | | | | | | | | | | Header file version.h does not use anything from timestamp.h. Including of timestamp.h has side effect which cause recompiling object file at every make run because timestamp.h changes at every run. So remove timestamp.h from version.h and include timestamp.h in files which needs it. This change reduce recompilation time of final U-Boot binary when U-Boot source files were not changed as less source files needs to be recompiled. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Add in lib/acpi/acpi_table.c and test/dm/acpi.c, rework a few others] Signed-off-by: Tom Rini <trini@konsulko.com>
* rtc: ds1307: Fix incorrect clock reset for DS13xxCallum Sinclair2021-09-011-13/+56
| | | | | | | | | | | | | The ds1307 driver also supports the DS1339 and DS1340. However, in ds1307_rtc_reset the register writes assume that the chip is a DS1307. This is evident in the writing of bits SQWE, RS1, RS0 to the control register. While this applies correctly to the DS1307, on a DS1340 the control register doesn't contain those bits (instead, the register is used for clock calibration). By writing these bits the clock calibration will be changed and the chip can become non-functional after a reset call. Signed-off-by: Callum Sinclair <callum.sinclair@alliedtelesis.co.nz>
* rtc: zynqmp: Add support for ZynqMP RTCMichal Simek2021-08-063-0/+166
| | | | | | | | The whole driver logic is taken from Linux kernel but only set/get/reset functions are implemented. When device is power off RTC is power out of battery. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* dm: rtc: uclass: Add flag to control sequence numberingMichal Simek2021-08-061-0/+1
| | | | | | | | | RTCs are using aliases for sequences. That's why enable DM_UC_FLAG_SEQ_ALIAS for exact RTC indentification. The same flag is used by a lot of other uclasses like mmc, pci, serial, spi, timer, tpm, etc. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* global: Convert simple_strtoul() with hex to hextoul()Simon Glass2021-08-021-1/+1
| | | | | | | | | It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc: m41t62: fix wrong register use for set/reset ST bitMax Yang2021-07-151-2/+2
| | | | | | | | | | Fix wrong register use when set/reset ST bit. ST bit is in register M41T62_REG_SEC not in M41T62_REG_ALARM_HOUR. I have not actually tested this. But this seemed buggy from inspection. Fixes: 9bbe210512c4539 ("rtc: m41t62: add oscillator fail bit reset support") Signed-off-by: Max Yang <max.yang@deltaww.com>
* lib: move rtc-lib.c to libHeinrich Schuchardt2021-07-142-78/+0
| | | | | | | | Function rtc_to_tm() is needed for FAT file system support even if we don't have a real time clock. So move it from drivers/ to lib/. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: define LOG_CATEGORY for all uclassPatrick Delaunay2021-07-061-0/+2
| | | | | | | | Define LOG_CATEGORY for all uclass to allow filtering with log command. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: davinci: fix date loaded on resetDario Binacchi2021-06-091-0/+10
| | | | | | | | | On reset, the RTC loads the 2000-01-01 date with a wrong day of the week (Sunday instead of Saturday). Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-9-dariobin@libero.it
* rtc: davinci: add driver model supportDario Binacchi2021-06-091-61/+367
| | | | | | | | | | | | | Update the driver to support the device tree and the driver model. The read / write helpers in rtc_ops allow access to scratch registers only. The offset parameter is added to the address of the scratch0 register. Support for non-DM has been removed as there were no users. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-8-dariobin@libero.it
* rtc: davinci: use unlock/lock mechanismDario Binacchi2021-06-091-0/+14
| | | | | | | | | | The RTC module contains a kicker mechanism to prevent any spurious writes from changing the register values. To set the time, you must first unlock the TC registers, update them and then lock. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-6-dariobin@libero.it
* rtc: davinci: check BUSY bit before set TC registersDario Binacchi2021-06-091-9/+36
| | | | | | | | | | | | To write correct data to the TC registers, the STATUS register must be read until the BUSY bit is equal to zero. Once the BUSY flag is zero, there is a 15 μs access period in which the TC registers can be programmed. The rtc_wait_not_busy() has been inspired by the Kernel. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-5-dariobin@libero.it
* rtc: davinci: replace 32bit access with 8bit accessDario Binacchi2021-06-091-16/+16
| | | | | | | | | | Use 32-bit access only where it is needed. Most of the RTC registers contain useful information in the 8 least significant bits, the others are reserved. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-4-dariobin@libero.it
* rtc: davinci: fix compiler errorsDario Binacchi2021-06-091-3/+8
| | | | | | | | Fix errors raised by module compilation. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-3-dariobin@libero.it
* rtc: davinci: enable compilation for omap architecturesDario Binacchi2021-06-091-0/+7
| | | | | | | | | The Davinci's onchip RTC is also present on TI OMAP1, AM33XX, AM43XX and DRA7XX SOCs. So, let's enable compilation for these architectures too. Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Link: https://lore.kernel.org/r/20210602203805.11494-2-dariobin@libero.it
* rtc: add support for rv3028 rtcHeiko Schocher2021-04-123-0/+215
| | | | | | | | | | Add support for rtc3028 rtc from microcrystal. based on linux dirver: commit a38fd8748464: ("Linux 5.12-rc2") Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: add armada38x driverMarek Behún2021-04-083-0/+192
| | | | | | | | | | | | | Add RTC driver for Armada 38x, based on Linux' driver. For now implement only `marvell,armada-380-rtc` compatible. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Cc: Pali Rohár <pali@kernel.org> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Chris Packham <judge.packham@gmail.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Pali Rohár <pali@kernel.org>
* Merge tag 'v2021.04-rc5' into nextWIP/29Mar2021-nextTom Rini2021-03-291-0/+2
|\ | | | | | | Prepare v2021.04-rc5