summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
* Add i.MX25 rtc driverSascha Hauer2019-04-123-0/+630
| | | | | | | | This adds a RTC driver for the Freescale i.MX25. This is done more to get access to the nonvolatile general purpose register than it is done to read the clock. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: ds1307: Set DS1341_BIT_DOSF in the right registerAndrey Smirnov2018-11-191-2/+2
| | | | | | | | | | DS1341_BIT_DOSF is located in DS1337_REG_STATUS, not DS1337_REG_CONTROL. Fix the code to reflect that. Also fix "additionale" -> "additional" typo while at it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-091-1/+1
|\
| * drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | rtc: ds1307: Add ds3231 to driver's ID listMarco Felsch2018-10-191-0/+1
| | | | | | | | | | | | | | | | | | In contrast to the ds1337 the ds3231 has a built-in temperature compensated crystal oscillator. The register map seems the same as the one from the ds1337, so using it's driver_data is okay. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-192-14/+2
|/ | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc-lib: drop unused rtc_ydaysAntony Pavlov2017-05-111-7/+0
| | | | | | | | | | | The patch fixes this compiler's warning: drivers/rtc/rtc-lib.c:23:29: warning: ‘rtc_ydays’ defined but not used [-Wunused-const-variable=] static const unsigned short rtc_ydays[2][13] = { ^~~~~~~~~ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: ds1307: Add support for configuring external clock pinTrent Piepho2016-05-301-1/+44
| | | | | | | | | | | | | | | | | | | | The DS1307 has a square wave output pin, which can be used to output a clock signal from the DS1307. Additionally, the DS1308 supports configuring this pin as an input from an external clock source to which it should sync itself. Add support with OF device tree properties to configure these settings. Supported features are using the clock pin as an output, an input, the rate of the pin, and if it should be enabled on battery backup power. The driver does not check that the selected features are supported by the clock chip being used. It is the designer's responsibility to create a valid device tree node; the bootloader does not attempt to be a device tree validator. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: ds1307: Add ds1308 to driver's ID listTrent Piepho2016-05-231-0/+1
| | | | | | | | | As far as the driver is concerned, it's the same as a 1338. It's too bad the i2c drivers can't make use of OF compatible properties with a list of compatible devices. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ds1307: Configure ds1341 for lowest power modeAndrey Smirnov2016-04-051-4/+16
| | | | | | | | | | | | Empirical observations show that configuring INTCN=1, ECLK=0, EGFIL=0, DOSF=1 on DS1341 put the chip in the mode where it draws the least amount fo current. Add code to configure DS1341 in such a way in case Barebox is the last code that runs on the processor before being shut down. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ds1307: Fix a bug in probe()Andrey Smirnov2016-04-051-1/+1
| | | | | | | Add missing "~" to bit clearing operation. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: abracon: Check obtained time for validityAndrey Smirnov2016-04-051-2/+2
| | | | | | | | Check obtianed time for validity before returning it to the caller the same way other RTC drivers do. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* rtc-lib: Check tm_wday for validity in rtc_valid_tm()Andrey Smirnov2016-01-071-0/+2
| | | | | | | | | | | | | | RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus values from uninitialized HW registers get passed to the uppper layers. A somewhat contrived way to reproduce this problem with DS1307 RTC would be to do the following: > i2c_write -b <bus> -a <addr> -r 3 0x00 > hwclock Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: ds1307: Fix a memory leakAndrey Smirnov2016-01-071-0/+3
| | | | | | | | | Several failure paths would result in control being transfered to 'exit' label, so instead of just returning error codes in those cases we also need to free the memory allocated for 'ds1307' Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: ds1307: Add code to support ds1337/1341Andrey Smirnov2016-01-071-0/+91
| | | | | | | | Port DS1337 specific bits from corresponding Linux driver and add small changes needed for DS1341. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: Add Abracon driverSascha Hauer2016-01-073-0/+130
| | | | | | | | This patch adds support for the Abracon ab-rtcmc-32.768khz-eoz9-s3 RTC. The driver can probably support other Abracon RTCs aswell, but this hasn't been verified. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: Fill in weekdays before setting timeSascha Hauer2016-01-071-1/+7
| | | | | | | | Some rtcs store the weekday. Make sure it's filled in correctly before passinf the time to the driver. This is easily done by converting it to seconds-since-epoch and back to struct rtc_time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: Check time for validity before passing it to the rtc driverSascha Hauer2016-01-071-0/+3
| | | | | | So that rtc drivers do not get invalid times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: select GREGORIAN_CALENDERLucas Stach2014-11-271-0/+1
| | | | | | | | Fixes: drivers/rtc/rtc-lib.c:109: undefined reference to `mktime' Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: add jz4740 driverAntony Pavlov2014-08-023-0/+173
| | | | | | | Add support for the RTC unit on Ingenic JZ4740, JZ475x and JZ477x SoCs. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc-lib: import rtc_time_to_tm() from linux-3.15Antony Pavlov2014-08-021-0/+45
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rtc: import ds1307 driver from linux-3.15Antony Pavlov2014-08-023-0/+373
| | | | | | | | Current ds1307 rtc driver supports only ds1307 and ds1338 chips; it has no nvram support at the moment. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add a simple rtc frameworkAntony Pavlov2014-07-314-0/+159
| | | | | | | | This patch adds a simple rtc framework for reading and setting board's RTC time. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove unused driversSascha Hauer2007-09-2121-4210/+0
|
* svn_rev_505Sascha Hauer2007-07-0521-0/+4210