summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
* acpi: Support generation of I2C descriptorSimon Glass2020-07-171-0/+13
| | | | | | | | Add a function to write a GPIO descriptor to the generated ACPI code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* rtc: i2c_rtc_emul: catch any write to the "reset" registerRasmus Villemoes2020-07-091-1/+2
| | | | | | | | | | It's more natural that any write that happens to touch the reset register should cause a reset, rather than just a write that starts at that offset. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: sandbox-rtc: fix set methodRasmus Villemoes2020-07-091-41/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current set method is broken; a simple test case is to first set the date to something in April, then change the date to 31st May: => date 040412122020.34 Date: 2020-04-04 (Saturday) Time: 12:12:34 => date 053112122020.34 Date: 2020-05-01 (Friday) Time: 12:12:34 or via the amending of the existing rtc_set_get test case similarly: $ ./u-boot -T -v => ut dm rtc_set_get Test: dm_test_rtc_set_get: rtc.c expected: 31/08/2004 18:18:00 actual: 01/08/2004 18:18:00 The problem is that after each register write, sandbox_i2c_rtc_complete_write() gets called and sets the internal time from the current set of registers. However, when we get to writing 31 to mday, the registers are in an inconsistent state (mon is still 4), so the mktime machinery ends up translating April 31st to May 1st. Upon the next register write, the registers are populated by sandbox_i2c_rtc_prepare_read(), so the 31 we just wrote to mday gets overwritten by a 1. Fix it by writing all registers at once, and for consistency, update the get method to retrieve them all with one "i2c transfer". Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: pcf2127: provide ->write methodRasmus Villemoes2020-07-091-0/+7
| | | | | | Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: pcf2127: provide ->read methodRasmus Villemoes2020-07-091-3/+3
| | | | | | | | | | | This simply consists of renaming the existing pcf2127_read_reg() helper to follow the naming of the other methods (i.e. pcf2127_rtc_<method name>) and changing the type of its "len" parameter. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: fall back to ->{read, write} if ->{read, write}8 are not providedRasmus Villemoes2020-07-091-6/+19
| | | | | | | | | | | | | | | | Similar to how the dm_rtc_{read,write} functions fall back to using the {read,write}8 methods, do the opposite in the rtc_{read,write}8 functions. This way, each driver only needs to provide either ->read8 or ->read to make both rtc_read8() and dm_rtc_read() work - without this, a driver that provides ->read() would most likely just duplicate the logic here for implementing a ->read8() method in term of its ->read() method. The same remarks of course apply to the write case. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: add dm_rtc_write() helperRasmus Villemoes2020-07-091-0/+19
| | | | | | | | | | | Similar to dm_rtc_read(), introduce a helper that allows the caller to write multiple consecutive 8-bit registers with one call. If the driver provides the ->write method, use that, otherwise loop using ->write8. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: add dm_rtc_read helper and ->read methodRasmus Villemoes2020-07-091-0/+19
| | | | | | | | | | | | Some users may want to read multiple consecutive 8-bit registers. Instead of each caller having to implement the loop, provide a dm_rtc_read() helper. Also, allow a driver to provide a ->read method, which can be more efficient than reading one register at a time. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* common: Drop linux/bitops.h from common headerSimon Glass2020-05-185-0/+5
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop linux/delay.h from common headerSimon Glass2020-05-188-0/+8
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix some checkpatch warnings in calls to udelay()Simon Glass2020-05-181-13/+13
| | | | | | | Fix up some incorrect code style in calls to functions in the linux/time.h header, mostly udelay(). Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop log.h from common headerSimon Glass2020-05-1817-0/+17
| | | | | | Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix some checkpatch warnings in calls to debug()Simon Glass2020-05-181-6/+6
| | | | | | | Fix up some incorrect code style in calls to functions in the log.h header, mostly debug(). Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc: pt7c4338: Add driver model supportBiwen Li2020-05-041-0/+100
| | | | | | | Add support of driver model of pt7c4338 Signed-off-by: Biwen Li <biwen.li@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
* rtc: ds1337: Add driver model supportBiwen Li2020-05-041-0/+128
| | | | | | | Add support of driver model of ds1337 Signed-off-by: Biwen Li <biwen.li@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
* rtc: pcf2127: don't add/subtract 1 to tm_monRasmus Villemoes2020-05-011-2/+2
| | | | | | | | | | | | As noted in rtc_def.h, the tm_mon field in struct rtc_time is 1-12, unlike in struct tm where it is 0-11. Currently, running "date" prints the wrong Date: 2020-04-01 (Friday) Time: 13:05:30 and setting the RTC via the date command is also broken. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* rtc: ds1374: typo WatchdogHeinrich Schuchardt2020-04-241-1/+1
| | | | | | %s/Watchdoc/Watchdog/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* rtc: m41t62: add compatible for m41st87Marek Vasut2020-03-011-0/+1
| | | | | | | | | | This adds a compatible string for m41st87. This ensures that this driver can be used for m41st87. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Cc: Stefan Roese <sr@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
* dm: core: Create a new header file for 'compat' featuresSimon Glass2020-02-053-0/+4
| | | | | | | | | | | | At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc: pcf8563: Add driver model supportBiwen Li2020-02-041-0/+107
| | | | | | | Add support of driver model of pcf8563 Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
* rtc: s35392a: encode command correctlyIan Ray2020-01-271-11/+18
| | | | | | | | | The 3-bit "command", or register, is encoded within the device address. Configure the device accordingly, and pass command in DM I2C read/write calls correctly. Signed-off-by: Ian Ray <ian.ray@ge.com> Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
* rtc: add support for DS3232 deviceHan Nandor2020-01-103-0/+283
| | | | | | | | | | DS3232 is an i2c RTC with 236 bytes of battery-backed SRAM. Add an RTC driver for DS3232 device, which provides time and date support. Also read and write functions are provided, which can be used to access the SRAM memory. Signed-off-by: Nandor Han <nandor.han@vaisala.com>
* rtc: rx8010js: add compatible stringRobert Beckett2019-12-271-0/+1
| | | | | | | Add compatible string used by Linux. Allows for simpler syncing of device trees. Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
* rtc: s35392a: add compatible stringsRobert Beckett2019-12-271-0/+2
| | | | | | | Add compatible strings used by Linux. Allows for simpler syncing of device trees. Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
* rtc: rx8010sj: fix DM initializationRobert Beckett2019-12-271-1/+1
| | | | | | pass the udevice by reference instead of double ref Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
* rtc: move date.c from drivers/rtc/ to lib/AKASHI Takahiro2019-12-063-101/+1
| | | | | | | | In the next commit, rtc_mktime(), for compatibility with linux, will be implemented using rtc_mktime(), which is no longer drivers/rtc specific. So move this file under lib/. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
* common: Move old EEPROM functions into a new headerSimon Glass2019-12-021-0/+1
| | | | | | | | These functions do not use driver model but are still used. Move them to a new eeprom.h header file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* rtc: ds3231/ds3232: fix coding styleBiwen Li2019-09-191-1/+2
| | | | | | The patch fixes coding style Signed-off-by: Biwen Li <biwen.li@nxp.com>
* rtc: stm32: manage 2 digit limitation on yearPatrick Delaunay2019-08-271-2/+7
| | | | | | | | | | | STM32 RTC manages only 2 digits for YEAR (Year tens and units in BCD format in RTC_DR register). With this patch, RTC driver assumes that tm->tm_years is between 2000 and 2099; tm->tm_year - 2000 have only 2 digit (0 > and <= 99). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* rtc: ds3232/ds3231: Add support to generate 32KHz output for driver moduleChuanhua Han2019-08-222-0/+23
| | | | | | | | | | | Add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Also put code related to rtc_enable_32khz_output under CONFIG_RTC_ENABLE_32KHZ_OUTPUT. Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
* env: Move env_get() to env.hSimon Glass2019-08-111-0/+1
| | | | | | | Move env_get() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* rtc, rx8025: add DM supportHeiko Schocher2019-07-291-19/+135
| | | | | | add DM support for this RTC driver. Signed-off-by: Heiko Schocher <hs@denx.de>
* rtc, rx8025: fix Coding StyleHeiko Schocher2019-07-291-29/+29
| | | | | | fix Coding Style for this driver. Signed-off-by: Heiko Schocher <hs@denx.de>
* rtc: move RTC_RX8025 to KconfigHeiko Schocher2019-07-291-0/+5
| | | | | | move RTC_RX8025 to Kconfig and fixup board configs. Signed-off-by: Heiko Schocher <hs@denx.de>
* rtc: Add rtc driver for stm32mp1Patrick Delaunay2019-07-223-0/+330
| | | | | | | Add support of STM32MP1 rtc driver. Enable it for basic and trusted configurations. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
* rtc: Add DM support to ds3231Chuanhua Han2019-07-181-0/+107
| | | | | | | | Add an implementation of the ds3231 driver that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
* rtc: add Microcrystal RV-8803 driverMichael Walle2019-07-133-0/+178
| | | | Signed-off-by: Michael Walle <michael@walle.cc>
* rtc: ds1307: add support for m41t11Heiko Schocher2019-07-131-0/+14
| | | | | | | | | | add m41t11 support in ds1307 driver. changes: - add compatible string for m41t11 - check if RTC clock is running, if not enable the clock Signed-off-by: Heiko Schocher <hs@denx.de>
* rtc: pcf2127: Fixed bug with rtc settings and getting error timeChuanhua Han2019-07-091-9/+24
| | | | | | | | | | | | | | | | | | The previous pcf2127 RTC chip could not read and set the correct time. When reading the data of internal registers, the read address was the value of register plus 1. This is because this chip requires the host to send a stop signal after setting the register address and before reading the register data. This patch sets the register address using dm_i2c_write and reads the register data using the original dm_i2c_xfer in order to generate a stop signal after the register address is set, and fixes the bug of the original read and write time. Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* rtc: export rtc_month_days()Heinrich Schuchardt2019-05-311-1/+1
| | | | | | Export function rtc_month_days() for reuse in the UEFI subsystem. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* rtc: m41t62: add compatible for m41t82Simon Goldschmidt2019-04-251-0/+11
| | | | | | | | | | | | | | This adds a compatible string for m41t82. This ensures that this driver can be used for m41t82 in DM mode, too (asit was usable for this model in non-DM mode before). In addition, the HT bit has to be reset during probe, since the m41t82 chip sets it when entering battery standby mode. This patch ensures this driver works on socfpga_socrates. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: m41t62: Convert the RTC driver to support the driver model (DM)Lukasz Majewski2018-12-031-0/+77
| | | | | | | | After this change the m41t62.c can be used with RTC subsystem (i.e. date command) which uses device model (DM). Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: m41t62: Extract common RTC handling code to facilitate DM conversionLukasz Majewski2018-12-031-12/+20
| | | | | | | | This change facilitates the conversion of m41t62 RTC driver to device model (DM). Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
* rtc: m41t62: Break i2c_write() arguments to fix checkpatch warningLukasz Majewski2018-12-031-1/+2
| | | | | | | No functional change for this commit. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
* Kconfig: Migrate CONFIG_RTC_M41T62 define to KconfigLukasz Majewski2018-12-031-0/+6
| | | | | | | | This patch moves the RTC M41T62 config define to Kconfig. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* drivers: rtc: correctly convert seconds to time structureHeinrich Schuchardt2018-12-011-1/+5
| | | | | | | | | Variable 'days' must be defined as signed int. Otherwise the conversion fails for some dates, e.g. 2004-08-25. Cf function rtc_time64_to_tm() in the Linux kernel source. Fixes: 992c1db45591 "drivers: rtc: resolve year 2038 problem in rtc_to_tm" Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* Merge tag 'for-master-20181130' of git://git.denx.de/u-boot-rockchipTom Rini2018-12-012-137/+453
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Improvements: - RK3188 USB-UART functionality - errors triggering a hard-stop in SPL on the RK3399 are reported - Rockchip RV1108 (SoC) support - MicroCrystal RV3029 (RTC) DM driver Fixes: - RK3188 early UART setup - limit SD-card frequency to 40MHz on the RK3399-Q7 - MIPI fixes - RK3399 CPUB clock initialisation
| * rtc: rv3029: update to support DM and sync with Linux 4.17Philipp Tomsich2018-11-301-137/+443
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Flamingo" carrier-board for the RK3399-Q7 has a RV3029 populated and the application will use the off-module RV3029 RTC including the battery backed SRAM. To support this use case, this commit includes the following changes: * updates the rv3029 driver to use DM * implements the read8/write8 operations This syncs the implementation with the Linux code (based on 4.17), porting the trickle-charger support from there (with improvements to avoid unnecessary EEPROM updates) and adheres to the Linux DTS binding. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
| * rtc: rv3029: add to KconfigPhilipp Tomsich2018-11-301-0/+10
| | | | | | | | | | | | | | | | The MicroCrystal RV3029 driver didn't have a Kconfig entry and was not used anywhere. Add it to Kconfig to make it selectable. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
* | rtc: Allow child driversSimon Glass2018-11-291-0/+1
|/ | | | | | | Some RTC chips have child drivers, e.g. to provide access to their non-volatile RAM. Scan for these when binding. Signed-off-by: Simon Glass <sjg@chromium.org>