1 --- a/drivers/rtc/rtc-ds1307.c
2 +++ b/drivers/rtc/rtc-ds1307.c
3 @@ -661,6 +661,13 @@ static int __devinit ds1307_probe(struct
7 +#if (defined(CONFIG_MACH_SIM_ONE))
8 + /* SIM.ONE board needs 32khz clock on SQW/INTB pin */
9 + i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
10 + ds1307->regs[0] & ~DS1337_BIT_INTCN);
11 + i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
12 + ds1307->regs[0] | (DS1337_BIT_RS1 | DS1337_BIT_RS2));
14 /* oscillator off? turn it on, so clock can tick. */
15 if (ds1307->regs[0] & DS1337_BIT_nEOSC)
16 ds1307->regs[0] &= ~DS1337_BIT_nEOSC;
17 --- a/drivers/rtc/Kconfig
18 +++ b/drivers/rtc/Kconfig
19 @@ -570,6 +570,14 @@ config RTC_DRV_EP93XX
20 This driver can also be built as a module. If so, the module
21 will be called rtc-ep93xx.
23 +config RTC_DRV_EP93XX_DS1337
24 + bool "Cirrus Logic EP93XX using DS1337 chip"
25 + depends on RTC_DRV_EP93XX && I2C && MACH_SIM_ONE
27 + If you say yes here, the EP93XX driver will use the
28 + battery-backed-up DS1337 RTC chip on the SIM.ONE board.
29 + You almost certainly want this.
32 tristate "SA11x0/PXA2xx"
33 depends on ARCH_SA1100 || ARCH_PXA
34 --- a/drivers/rtc/rtc-ep93xx.c
35 +++ b/drivers/rtc/rtc-ep93xx.c
37 #include <linux/rtc.h>
38 #include <linux/platform_device.h>
39 #include <mach/hardware.h>
42 +#if defined(CONFIG_RTC_DRV_EP93XX_DS1337)
43 +extern int ds1337_do_command(int id, int cmd, void *arg);
44 +#define DS1337_GET_DATE 0
45 +#define DS1337_SET_DATE 1
48 #define EP93XX_RTC_REG(x) (EP93XX_RTC_BASE + (x))
49 #define EP93XX_RTC_DATA EP93XX_RTC_REG(0x0000)
50 @@ -37,16 +44,28 @@ static int ep93xx_get_swcomp(struct devi
52 static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
54 +#if defined(CONFIG_RTC_DRV_EP93XX_DS1337)
55 + /* Reroute the internal device to the DS1337 */
56 + return ds1337_do_command(0, DS1337_GET_DATE, (void *)tm);
58 unsigned long time = __raw_readl(EP93XX_RTC_DATA);
60 rtc_time_to_tm(time, tm);
65 static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs)
67 +#if defined(CONFIG_RTC_DRV_EP93XX_DS1337)
70 + rtc_time_to_tm(secs, &tm);
71 + return ds1337_do_command(0, DS1337_SET_DATE, (void *)&tm);
73 __raw_writel(secs + 1, EP93XX_RTC_LOAD);
78 static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq)