summaryrefslogtreecommitdiff
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
* common: Move old EEPROM functions into a new headerWIP/2019-12-02-master-importsSimon 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>
* Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dmTom Rini2018-10-102-1/+27
|\ | | | | | | | | | | Test improvements to tidy up output and drop duplicate tests Sandbox SPL/TPL support Various dm-related improvements
| * rtc: Allow use of RTC in SPL and TPLSimon Glass2018-10-092-1/+19
| | | | | | | | | | | | | | Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
| * Kconfig: Convert CONFIG_RTC_MC146818 to KconfigSimon Glass2018-10-091-0/+8
| | | | | | | | | | | | Move this option to Kconfig and tidy up the two boards which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
* | rtc: Add read8 and write8 support to isl1208 driverTrent Piepho2018-10-081-0/+20
|/ | | | | | | | | | | | | This can be used for device register access from board code. This allows access to capabilities in the RTC chip not abstracted in U-Boot's RTC class. E.g., device NVRAM or a tamper detection circuit. Cc: Klaus Goger <klaus.goger@theobroma-systems.com> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* rtc: pl031: convert the driver to driver modelAKASHI Takahiro2018-09-231-46/+80
| | | | | | | | With this patch, PL031 driver is converted to driver-model-compliant driver. In addition, CONFIG_SYS_RTC_PL031_BASE is no longer valid. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
* Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini2018-07-3024-89/+0
|\ | | | | | | | | | | | | | | | | | | | | Patch queue for efi - 2018-07-25 Highlights this time: - Many small fixes to improve spec compatibility (found by SCT) - Almost enough to run with sandbox target - GetTime() improvements - Enable EFI_LOADER and HYP entry on ARMv7 with NONSEC=y
| * rtc: remove CONFIG_CMD_DATE dependencyHeinrich Schuchardt2018-07-2524-89/+0
| | | | | | | | | | | | | | | | | | The EFI subsystem accesses the real time clock and is enabled by default. So we should drop any CONFIG_CMD_DATE dependency from the real time clock drivers. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* | drivers: rtc: correctly set week day for mc146818Heinrich Schuchardt2018-07-281-1/+2
| | | | | | | | | | | | | | | | | | | | The driver sets the weekday incorrectly when called by the 'date set' command. Sunday is 1, Saturday is 7 unlike in U-Boot (see data sheet https://www.nxp.com/docs/en/data-sheet/MC146818.pdf, table 3). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | rtc: compile date.c if DM_RTCAKASHI Takahiro2018-07-241-1/+2
|/ | | | | | | | | rtc_to_tm() and rtc_mktime() are required for some RTC drivers, at least PL031. Without this patch, we also need to enable CONFIG_CMD_DATE even if we don't want or need this command. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* drivers: rtc: correct week day for mc146818Heinrich Schuchardt2018-07-201-2/+6
| | | | | | | | | | | | | | | | For qemu-x86 the date command produces wrong days of the week: Date: 2018-07-06 (Saturday) Time: 18:02:03 Date: 2018-07-07 (unknown day) Time: 21:02:06 According to a comment in the Linux driver the mc146818 only updates the day of the week if the register value is non-zero. Sunday is 1, saturday is 7 unlike in U-Boot (see data sheet https://www.nxp.com/docs/en/data-sheet/MC146818.pdf). So let's use our library function to determine the day of the week. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* drivers: rtc: resolve year 2038 problem in rtc_to_tmHeinrich Schuchardt2018-07-194-44/+77
| | | | | | | | | Our implementation of rtc_to_tm() cannot handle dates of more than 0x7fffffff seconds after 1970-01-01. Adopt the Linux kernel implementation. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* ARM: qemu-arm: enable RTCHeinrich Schuchardt2018-07-191-0/+7
| | | | | | | | | | | | | | | | | QEMU provides an emulated ARM AMBA PrimeCell PL031 RTC. The patch sets the base address in the board include file according to the definition in hw/arm/virt.c of the QEMU source. It defines the Kconfig option for the existing driver, and enables the RTC driver in qemu_arm64_defconfig and qemu_arm_defconfig as well as the date command. We need an RTC to provide the GetTime() runtime service in the UEFI subsystem. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Tested-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
* drivers/rtc: convert mvrtc to DMChris Packham2018-06-053-0/+68
| | | | | | | Add DM support for the Marvell RTC driver. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
* drivers/rtc: prepare mvrtc for DM conversionChris Packham2018-06-051-18/+39
| | | | | | | | Split the rtc_{get,set,reset} functions so that the bodies can be used in a DM driver. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-0739-79/+39
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini2018-04-271-2/+0
| | | | | | | | We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
* rtc: rx8025: remove redundant code in rtc_resetChris Packham2018-04-061-17/+1
| | | | | | | | | As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the command "date reset" will set the date/time to 2000-01-01 0:00:00 after calling rtc_reset(). This means that the rx8025 implementation of rtc_reset() does not need to call rtc_set(). Signed-off-by: Chris Packham <judge.packham@gmail.com>
* rtc: rs5c372: remove redundant code in rtc_resetChris Packham2018-04-061-23/+1
| | | | | | | | | As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the command "date reset" will set the date/time to 2000-01-01 0:00:00 after calling rtc_reset(). This means that the rs5c372 implementation of rtc_reset() does not need to call rtc_set(). Signed-off-by: Chris Packham <judge.packham@gmail.com>
* rtc: mx27rtc: remove redundant code in rtc_resetChris Packham2018-04-061-5/+1
| | | | | | | | | As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the command "date reset" will set the date/time to 2000-01-01 0:00:00 after calling rtc_reset(). This means that the mx27rtc implementation of rtc_reset() can be an empty stub function. Signed-off-by: Chris Packham <judge.packham@gmail.com>
* rtc: ds1374: remove redundant code in rtc_resetChris Packham2018-04-061-15/+0
| | | | | | | | | As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the command "date reset" will set the date/time to 2000-01-01 0:00:00 after calling rtc_reset(). This means that the ds1374 implementation of rtc_reset() doesn't need to call rtc_set(). Signed-off-by: Chris Packham <judge.packham@gmail.com>
* rtc: ds1307: remove redundant code in rtc_resetChris Packham2018-04-061-33/+0
| | | | | | | | | | As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the command "date reset" will set the date/time to 2000-01-01 0:00:00 after calling rtc_reset(). This means that the ds1307 implementation of rtc_reset() doesn't need to call rtc_set(). Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: rewrite isl1208 to support DMKlaus Goger2018-04-062-55/+98
| | | | | | | | | | Adds devicemodel support to the ISL1208 driver. This patch drops the non-dm API as no board was using it anyway. Also add it to Kconfig. Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rtc: adding RX8010SJ rtc driverNandor Han2018-02-043-0/+385
| | | | | | | | | Add a new driver for RX8010SJ rtc chip. The driver implements both formats of U-Boot driver model. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
* rtc: add support for s35392aNandor Han2017-11-203-0/+372
| | | | | | | | | Add support for S35392A RTC. The driver supports both U-Boot driver models. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk> Cc: Heiko Schocher <hs@denx.de>
* rtc: mc146818: Correct alarm message for day alarmBin Meng2017-10-231-1/+1
| | | | | | | RTC_CONFIG_D register contains the day within the month to generate an alarm, not the month. This corrects the printf to indicate it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* env: Rename getenv/_f() to env_get()Simon Glass2017-08-161-1/+1
| | | | | | | | | | | We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>