summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1307.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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-191-7/+1
| | | | | | | | | 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: 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: 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>
* 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: import ds1307 driver from linux-3.15Antony Pavlov2014-08-021-0/+347
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>