[brcm63xx] base-files: brcm63xx.sh: Added comtrend (96348GW-11) to routers with butto...
[openwrt.git] / target / linux / ep93xx / patches-2.6.30 / 004-simone-rtc.patch
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
4 goto exit_free;
5 }
6
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));
13 +#endif
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.
22
23 +config RTC_DRV_EP93XX_DS1337
24 + bool "Cirrus Logic EP93XX using DS1337 chip"
25 + depends on RTC_DRV_EP93XX && I2C && MACH_SIM_ONE
26 + help
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.
30 +
31 config RTC_DRV_SA1100
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
36 @@ -13,6 +13,13 @@
37 #include <linux/rtc.h>
38 #include <linux/platform_device.h>
39 #include <mach/hardware.h>
40 +#include <asm/io.h>
41 +
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
46 +#endif
47
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
51
52 static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
53 {
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);
57 +#else
58 unsigned long time = __raw_readl(EP93XX_RTC_DATA);
59
60 rtc_time_to_tm(time, tm);
61 return 0;
62 +#endif
63 }
64
65 static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs)
66 {
67 +#if defined(CONFIG_RTC_DRV_EP93XX_DS1337)
68 + struct rtc_time tm;
69 +
70 + rtc_time_to_tm(secs, &tm);
71 + return ds1337_do_command(0, DS1337_SET_DATE, (void *)&tm);
72 +#else
73 __raw_writel(secs + 1, EP93XX_RTC_LOAD);
74 return 0;
75 +#endif
76 }
77
78 static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq)
This page took 0.051185 seconds and 5 git commands to generate.