add support for ST M41T94 SPI RTC (patch rev. 2)
PATCH 1/1 add support for ST M41T94 SPI RTC (patch rev. 2)
This patch adds kernel driver for M41T94 RTC chip connected via SPI. I've tested it on two different AT91-based hardwares.
This is second revision of the patch: support for century bit added, some comments made by Alessandro Zummo fixed.
Signed-off-by Kim B. Heino <[email protected]>
drivers/rtc/Kconfig +9 -0
@@ -266,6 +266,15 @@ if SPI_MASTER +config RTC_DRV_M41T94 + tristate "ST M41T94" + help + If you say yes here you will get support for the + ST M41T94 SPI RTC chip. + + This driver can also be built as a module. If so, the module + will be called rtc-m41t94. + config RTC_DRV_MAX6902 tristate "Maxim MAX6902" help
drivers/rtc/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o +obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o
drivers/rtc/rtc-m41t94.c +188 -0
188 lines not on this page · raw message
Quoted 4 lines · On Thu, 15 May 2008 12:53:05 +0300 "Kim B. Heino" <[email protected]>…
drivers/rtc/rtc-m41t94.c +3
-0+struct m41t94 { +struct rtc_device *rtc; +};
[...]
Quoted 11 lines
drivers/rtc/rtc-m41t94.c +11
-0+ +static int __devinit m41t94_probe (struct spi_device *spi) +{ +struct rtc_device *rtc; +struct m41t94 *m41t94; +int res; + + m41t94 =kzalloc (sizeof (struct m41t94 ),GFP_KERNEL ); +if (!m41t94) +return -ENOMEM ; +dev_set_drvdata (&spi->dev, m41t94);
[..]
drivers/rtc/rtc-m41t94.c line 148
Quoted 12 lines
drivers/rtc/rtc-m41t94.c +11
-0+ rtc =rtc_device_register (m41t94_driver.driver.name, + &spi->dev, &m41t94_rtc_ops,THIS_MODULE ); +if (IS_ERR (rtc)) { +kfree (m41t94); +return PTR_ERR (rtc); + } + + m41t94->rtc = rtc; + +return 0 ; +}
thanks for having implemented the sugestions.
one more thing. now that the struct m41t94 is
almost empty it makes no sense to keep it.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it