8 #include <linux/module.h>
12 #include <linux/slab.h>
14 #define DRV_VERSION "0.2"
27 #define DS1216_HOUR_1224 (1 << 7)
28 #define DS1216_HOUR_AMPM (1 << 5)
38 0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c
51 for (i = 0; i < 8; i++) {
53 for (j = 0; j < 8; j++)
54 c |= (
readb(ioaddr) & 0x1) <<
j;
59 static void ds1216_write(
u8 __iomem *ioaddr,
const u8 *buf)
64 for (i = 0; i < 8; i++) {
66 for (j = 0; j < 8; j++) {
73 static void ds1216_switch_ds_to_clock(
u8 __iomem *ioaddr)
78 ds1216_write(ioaddr,
magic);
87 ds1216_switch_ds_to_clock(priv->
ioaddr);
109 static int ds1216_rtc_set_time(
struct device *dev,
struct rtc_time *tm)
112 struct ds1216_priv *priv = platform_get_drvdata(pdev);
115 ds1216_switch_ds_to_clock(priv->
ioaddr);
133 ds1216_switch_ds_to_clock(priv->
ioaddr);
139 .read_time = ds1216_rtc_read_time,
140 .set_time = ds1216_rtc_set_time,
157 platform_set_drvdata(pdev, priv);
159 priv->
size = resource_size(res);
172 if (IS_ERR(priv->
rtc)) {
173 ret = PTR_ERR(priv->
rtc);
178 ds1216_read(priv->
ioaddr, dummy);
192 struct ds1216_priv *priv = platform_get_drvdata(pdev);
203 .name =
"rtc-ds1216",
206 .remove =
__exit_p(ds1216_rtc_remove),
209 static int __init ds1216_rtc_init(
void)
214 static void __exit ds1216_rtc_exit(
void)