RTC: add rtc-rs5c313 driver
PATCH 1/1 RTC: add rtc-rs5c313 driver
Hi , all .
Add an RTC driver for Ricoh RS5C313 RTC chip.
Please apply.
regards,
Nobuhiro
drivers/rtc/Kconfig +6 -0
@@ -354,4 +354,10 @@ config RTC_DRV_V3020 This driver can also be built as a module. If so, the module will be called rtc-v3020. +config RTC_DRV_RS5C313 + tristate "Ricoh RS5C313" + depends on RTC_CLASS + help + If you say yes here you get support for the Ricoh RS5C313 RTC chips. + endmenu
drivers/rtc/Makefile +1 -0
@@ -38,3 +38,4 @@ obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o +obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
drivers/rtc/rtc-rs5c313.c new file +408 -0
408 lines not on this page · raw message
Signature · 3 lines
Nobuhiro Iwamatsu E-Mail : [email protected] GPG ID : 3170EBE9
Quoted 4 lines · On Fri, 9 Mar 2007 12:03:02 +0900 Nobuhiro Iwamatsu <[email protected]>…
Hi , all .
Add an RTC driver for Ricoh RS5C313 RTC chip.
drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_read_reg':drivers/rtc/rtc-rs5c313.c:186: warning: implicit declaration of function 'rs5c313_write_data' drivers/rtc/rtc-rs5c313.c:187: warning: implicit declaration of function 'rs5c313_read_data' drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_read_time':drivers/rtc/rtc-rs5c313.c:208: error: 'RS5C313_CEENABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c:208: error: (Each undeclared identifier is reported only once drivers/rtc/rtc-rs5c313.c:208: error: for each function it appears in.) drivers/rtc/rtc-rs5c313.c:217: error: 'RS5C313_CEDISABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_set_time':drivers/rtc/rtc-rs5c313.c:265: error: 'RS5C313_CEENABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c:273: error: 'RS5C313_MISCOP' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c:274: error: 'RS5C313_CEDISABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_check_xstp_bit':drivers/rtc/rtc-rs5c313.c:315: error: 'RS5C313_CEENABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c:324: error: 'RS5C313_MISCOP' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c:336: error: 'RS5C313_CEDISABLE' undeclared (first use in this function) drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_init':drivers/rtc/rtc-rs5c313.c:390: warning: implicit declaration of function 'rs5c313_init_port'
I think we're missing a header file?
Quoted 5 lines · Nobuhiro Iwamatsu
drivers/rtc/Kconfig +0
-0
drivers/rtc/Kconfig config RTC_DRV_V3020 · line 363
Quoted 10 lines
drivers/rtc/Kconfig +6
-0@@ -354,4 +354,10 @@ config RTC_DRV_V3020 This driver can also be built as a module. If so, the module will be called rtc-v3020. +config RTC_DRV_RS5C313 + tristate "Ricoh RS5C313" + depends on RTC_CLASS + help + If you say yes here you get support for the Ricoh RS5C313 RTC chips. + endmenu
This should also depend on SH_LANDISK if it has any hope of compiling.. however..
Quoted 5 lines
drivers/rtc/Kconfig +5
-0+#ifdef CONFIG_SH_LANDISK +/*****************************************************/ +/* LANDISK dependence part of RS5C313 */ +/*****************************************************/ +
[snip]
Quoted 8 lines
drivers/rtc/Kconfig +8
-0+#define RS5C313_CEENABLE ctrl_outb(RS5C313_CE_RTCCE, RS5C313_CE); +#define RS5C313_CEDISABLE ctrl_outb(0x00, RS5C313_CE) +#define RS5C313_MISCOP ctrl_outb(0x02, 0xB0000008) + +static void rs5c313_init_port(void) +{ + /* Set SCK as I/O port and Initialize SCSPTR1 data & I/O port. */ + ctrl_outb(ctrl_inb(SCSMR1) & ~SCSMR1_CA, SCSMR1);
drivers/rtc/Kconfig
Quoted 10 lines
drivers/rtc/Kconfig +10
-0+ ctrl_outb(ctrl_inb(SCSCR1) & ~SCSCR1_CKE, SCSCR1); + + /* And Initialize SCL for RS5C313 clock */ + scsptr1_data = ctrl_inb(SCSPTR1) | SCL; /* SCL:H */ + ctrl_outb(scsptr1_data, SCSPTR1); + scsptr1_data = ctrl_inb(SCSPTR1) | SCL_OEN; /* SCL output enable */ + ctrl_outb(scsptr1_data, SCSPTR1); + RS5C313_CEDISABLE; /* CE:L */ +} +
This is all I2C cruft, which should be split out in to a separate driver. If any other platforms are going to have a hope of using this driver, it'll be through the generic I2C interfaces (many RTC drivers already do this).
Of course the SH_LANDISK dependency can be added, but it's preferable to do this right the first time, before someone ends up inevitably reimplementing the same thing.
Quoted 19 lines · Andrew Morton
drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_read_reg':drivers/rtc/rtc-rs5c313.c:186: warning: implicit declaration of function 'rs5c313_write_data'drivers/rtc/rtc-rs5c313.c:187: warning: implicit declaration of function 'rs5c313_read_data'drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_read_time':drivers/rtc/rtc-rs5c313.c:208: error: 'RS5C313_CEENABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c:208: error: (Each undeclared identifier is reported only oncedrivers/rtc/rtc-rs5c313.c:208: error: for each function it appears in.)drivers/rtc/rtc-rs5c313.c:217: error: 'RS5C313_CEDISABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_set_time':drivers/rtc/rtc-rs5c313.c:265: error: 'RS5C313_CEENABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c:273: error: 'RS5C313_MISCOP' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c:274: error: 'RS5C313_CEDISABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_check_xstp_bit':drivers/rtc/rtc-rs5c313.c:315: error: 'RS5C313_CEENABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c:324: error: 'RS5C313_MISCOP' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c:336: error: 'RS5C313_CEDISABLE' undeclared (first use in this function)drivers/rtc/rtc-rs5c313.c: In function 'rs5c313_rtc_init':drivers/rtc/rtc-rs5c313.c:390: warning: implicit declaration of function 'rs5c313_init_port'
Quoted 1 line
I think we're missing a header file?
It basically has no hope of compiling for the !SH_LANDISK case at present, so the options are to either munge the dependencies or to rip out the platform-specific cruft from the driver.