summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Young <dyoung@nslu2-linux.org>2005-11-16 00:56:15 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-11-16 00:56:15 +0000
commit2f079b224cdb1c2c6e767adee0114c98fdd513fc (patch)
tree3d255d7dc560a13dca72c66e1afda6a3a2c8d4d5
parentc62503269a38e242746175fd31e3d6ae5198a935 (diff)
nas100d-kernel: i2c version 0.0.4 plus pcf8563 driver
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch656
1 files changed, 610 insertions, 46 deletions
diff --git a/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch b/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch
index b4c5e3c63b..69d0c47282 100644
--- a/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch
+++ b/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch
@@ -1,9 +1,12 @@
- drivers/i2c/algos/i2c-algo-bit.c | 9 +++++++--
- drivers/i2c/busses/i2c-ixp4xx.c | 9 ++++++---
- 2 files changed, 13 insertions(+), 5 deletions(-)
+ drivers/i2c/busses/i2c-ixp4xx.c | 9
+ drivers/i2c/chips/Kconfig | 9
+ drivers/i2c/chips/Makefile | 1
+ drivers/i2c/chips/pcf8563.c | 547 ++++++++++++++++++++++++++++++++++++++++
+ include/linux/pcf8563.h | 24 +
+ 5 files changed, 587 insertions(+), 3 deletions(-)
--- linux-nas100d.orig/drivers/i2c/busses/i2c-ixp4xx.c 2005-11-11 22:22:43.000000000 +0100
-+++ linux-nas100d/drivers/i2c/busses/i2c-ixp4xx.c 2005-11-15 11:51:51.000000000 +0100
++++ linux-nas100d/drivers/i2c/busses/i2c-ixp4xx.c 2005-11-15 22:06:23.000000000 +0100
@@ -65,7 +65,6 @@ static int ixp4xx_bit_getscl(void *data)
gpio_line_config(ixp4xx_scl_pin(data), IXP4XX_GPIO_IN );
@@ -26,8 +29,8 @@
drv_data->algo_data.timeout = 100;
-
+#ifdef CONFIG_MACH_NAS100D
-+ drv_data->algo_data.udelay = 200;
-+ drv_data->algo_data.mdelay = 200;
++ drv_data->algo_data.udelay = 100;
++ drv_data->algo_data.mdelay = 100;
+#endif
drv_data->adapter.id = I2C_HW_B_IXP4XX;
drv_data->adapter.algo_data = &drv_data->algo_data;
@@ -36,50 +39,611 @@
return err;
}
-+ printk(KERN_INFO "i2c: ixp4xx 0.0.3\n");
++ printk(KERN_INFO "i2c: ixp4xx 0.0.4\n");
+
dev_set_drvdata(&plat_dev->dev, drv_data);
return 0;
---- linux-nas100d.orig/drivers/i2c/algos/i2c-algo-bit.c 2005-11-15 11:01:31.000000000 +0100
-+++ linux-nas100d/drivers/i2c/algos/i2c-algo-bit.c 2005-11-15 11:47:33.000000000 +0100
-@@ -44,8 +44,8 @@
-
- /* module parameters:
- */
--static int i2c_debug;
--static int bit_test; /* see if the line-setting functions work */
-+static int i2c_debug=2;
-+static int bit_test=1; /* see if the line-setting functions work */
-
- /* --- setting states on the bus with the right timing: --------------- */
-
-@@ -203,6 +203,7 @@ static int i2c_inb(struct i2c_adapter *i
- return -ETIMEDOUT;
- };
- indata *= 2;
-+ udelay(adap->udelay);
- if ( getsda(adap) )
- indata |= 0x01;
- scllo(adap);
-@@ -544,6 +545,8 @@ int i2c_bit_add_bus(struct i2c_adapter *
- adap->timeout = 100; /* default values, should */
- adap->retries = 3; /* be replaced by defines */
-
-+ printk(KERN_INFO "i2c: algo-bit 0.0.3\n");
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-nas100d/drivers/i2c/chips/pcf8563.c 2005-11-16 01:18:21.000000000 +0100
+@@ -0,0 +1,547 @@
++/*
++ * pcf8563.c - An i2c driver for the Philips PCF8563 RTC
++ * Copyright 2005 Alessandro Zummo
++ *
++ * please send all reports to:
++ * a dot zummo at towertech dot it
++ *
++ * based on the other drivers in this same directory.
++ *
++ * http://www.semiconductors.philips.com/acrobat/datasheets/PCF8563-04.pdf
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/i2c.h>
++#include <linux/string.h>
++#include <linux/bcd.h>
++#include <linux/rtc.h>
++#include <linux/list.h>
++
++#include <linux/pcf8563.h>
++
++#define DRV_VERSION "0.2"
++
++/* Addresses to scan */
++static unsigned short normal_i2c[] = { 0x51, I2C_CLIENT_END };
++
++/* Module parameters */
++I2C_CLIENT_INSMOD;
++I2C_CLIENT_MODULE_PARM(hctosys,
++ "Set the system time from the hardware clock upon initialization");
++
++#define PCF8563_REG_ST1 0x00 /* status */
++#define PCF8563_REG_ST2 0x01
++
++#define PCF8563_REG_SC 0x02 /* datetime */
++#define PCF8563_REG_MN 0x03
++#define PCF8563_REG_HR 0x04
++#define PCF8563_REG_DM 0x05
++#define PCF8563_REG_DW 0x06
++#define PCF8563_REG_MO 0x07
++#define PCF8563_REG_YR 0x08
++
++#define PCF8563_REG_AMN 0x09 /* alarm */
++#define PCF8563_REG_AHR 0x0A
++#define PCF8563_REG_ADM 0x0B
++#define PCF8563_REG_ADW 0x0C
++
++#define PCF8563_REG_CLKO 0x0D /* clock out */
++#define PCF8563_REG_TMRC 0x0E /* timer control */
++#define PCF8563_REG_TMR 0x0F /* timer */
++
++#define PCF8563_SC_LV 0x80 /* low voltage */
++
++/* Prototypes */
++static int pcf8563_attach(struct i2c_adapter *adapter);
++static int pcf8563_detach(struct i2c_client *client);
++static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind);
++static int pcf8563_command(struct i2c_client *client, unsigned int cmd,
++ void *arg);
++
++static struct i2c_driver pcf8563_driver = {
++ .owner = THIS_MODULE,
++ .name = "pcf8563",
++ .flags = I2C_DF_NOTIFY,
++ .attach_adapter = &pcf8563_attach,
++ .detach_client = &pcf8563_detach,
++};
++
++struct pcf8563_data {
++ struct i2c_client client;
++ struct list_head list;
++};
++
++static const unsigned char days_in_mo[] =
++ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
++
++static LIST_HEAD(pcf8563_clients);
++
++/* Workaround until the I2C subsytem will allow to send
++ * commands to a specific client. This function will send the command
++ * to the first client.
++ */
++int pcf8563_do_command(unsigned int cmd, void *arg)
++{
++ struct list_head *walk;
++ struct list_head *tmp;
++ struct pcf8563_data *data;
++
++ list_for_each_safe(walk, tmp, &pcf8563_clients) {
++ data = list_entry(walk, struct pcf8563_data, list);
++ return pcf8563_command(&data->client, cmd, arg);
++ }
++
++ return -ENODEV;
++}
++
++#define is_leap(year) \
++ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
++
++/* make sure the rtc_time values are in bounds */
++
++static int pcf8563_validate_tm(struct rtc_time *tm)
++{
++ int year = tm->tm_year + 1900;
++
++ if ((tm->tm_year < 70) || (tm->tm_year > 255))
++ return -EINVAL;
++
++ if ((tm->tm_mon > 11) || (tm->tm_mday == 0))
++ return -EINVAL;
++
++ if (tm->tm_mday > days_in_mo[tm->tm_mon]
++ + ((tm->tm_mon == 1) && is_leap(year)))
++ return -EINVAL;
++
++ if ((tm->tm_hour >= 24) || (tm->tm_min >= 60) || (tm->tm_sec >= 60))
++ return -EINVAL;
++
++ return 0;
++}
+
- i2c_add_adapter(adap);
- return 0;
- }
-@@ -561,9 +564,11 @@ MODULE_AUTHOR("Simon G. Vogl <simon@tk.u
- MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm");
- MODULE_LICENSE("GPL");
-
+/*
- module_param(bit_test, bool, 0);
- module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
-
- MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck");
- MODULE_PARM_DESC(i2c_debug,
- "debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol");
++ * In the routines that deal directly with the pcf8563 hardware, we use
++ * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
++ */
++static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm)
++{
++ unsigned char buf[13];
++ unsigned char addr = PCF8563_REG_ST1;
++
++ struct i2c_msg msgs[] = {
++ { client->addr, 0, 1, &addr }, /* setup read ptr */
++ { client->addr, I2C_M_RD, 13, buf }, /* read status + date */
++ };
++
++ /* read registers */
++ if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
++ dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
++ return -EIO;
++ }
++
++ if (buf[PCF8563_REG_SC] & PCF8563_SC_LV)
++ dev_info(&client->dev,
++ "low voltage detected, date/time is not reliable.\n");
++
++ dev_dbg(&client->dev,
++ "%s: raw read data - st1=%02x, st2=%02x, sec=%02x, min=%02x, hr=%02x, "
++ "mday=%02x, wday=%02x, mon=%02x, year=%02x\n",
++ __FUNCTION__,
++ buf[0], buf[1], buf[2], buf[3],
++ buf[4], buf[5], buf[6], buf[7],
++ buf[8]);
++
++
++ tm->tm_sec = BCD2BIN(buf[PCF8563_REG_SC] & 0x7F);
++ tm->tm_min = BCD2BIN(buf[PCF8563_REG_MN] & 0x7F);
++ tm->tm_hour = BCD2BIN(buf[PCF8563_REG_HR] & 0x3F); /* rtc hr 0-23 */
++ tm->tm_mday = BCD2BIN(buf[PCF8563_REG_DM] & 0x3F);
++ tm->tm_wday = buf[PCF8563_REG_DW] & 0x07;
++ tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MN] & 0x1F) - 1; /* rtc mn 1-12 */
++ tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR])
++ + (buf[PCF8563_REG_MN] & 0x80 ? 100 : 0);
++
++ dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
++ "mday=%d, mon=%d, year=%d, wday=%d\n",
++ __FUNCTION__,
++ tm->tm_sec, tm->tm_min, tm->tm_hour,
++ tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
++
++ if (!pcf8563_validate_tm(tm)) {
++ dev_err(&client->dev, "retrieved date/time is not valid.\n");
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
++#if 0
++static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm,
++ int datetoo, u8 reg_base)
++{
++ int i, err, xfer;
++
++ unsigned char buf[8];
++
++ static const unsigned char wel[3] = { 0, PCF8563_REG_SR,
++ PCF8563_SR_WEL };
++
++ static const unsigned char rwel[3] = { 0, PCF8563_REG_SR,
++ PCF8563_SR_WEL | PCF8563_SR_RWEL };
++
++ static const unsigned char diswe[3] = { 0, PCF8563_REG_SR, 0 };
++
++ struct pcf8563_data *data = i2c_get_clientdata(client);
++
++ /* check if all values in the tm struct are correct */
++ if ((err = pcf8563_validate_tm(tm)) < 0)
++ return err;
++
++ dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
++ "mday=%d, mon=%d, year=%d, wday=%d\n",
++ __FUNCTION__,
++ tm->tm_sec, tm->tm_min, tm->tm_hour,
++ tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
++
++ buf[PCF8563_REG_SEC] = BIN2BCD(tm->tm_sec);
++ buf[PCF8563_REG_MIN] = BIN2BCD(tm->tm_min);
++
++ /* set hour and 24hr bit */
++ buf[PCF8563_REG_HOUR] = BIN2BCD(tm->tm_hour) | PCF8563_HR_MIL;
++
++ /* should we also set the date? */
++ if (datetoo) {
++ buf[PCF8563_REG_MDAY] = BIN2BCD(tm->tm_mday);
++
++ /* month, 0 - 11 */
++ buf[PCF8563_REG_MONTH] = BIN2BCD(tm->tm_mon);
++
++ /* year, since 1900 */
++ buf[PCF8563_REG_YEAR] = BIN2BCD(tm->tm_year + 1900 - data->epoch);
++ buf[PCF8563_REG_WDAY] = tm->tm_wday & 0x07;
++ buf[PCF8563_REG_Y2K] = BIN2BCD(data->epoch / 100);
++ }
++
++ /* this sequence is required to unlock the chip */
++ xfer = i2c_master_send(client, wel, 3);
++ if (xfer != 3) {
++ dev_err(&client->dev, "%s: wel - %d\n", __FUNCTION__, xfer);
++ return -EIO;
++ }
++
++ xfer = i2c_master_send(client, rwel, 3);
++ if (xfer != 3) {
++ dev_err(&client->dev, "%s: rwel - %d\n", __FUNCTION__, xfer);
++ return -EIO;
++ }
++
++ /* write register's data */
++ for (i = 0; i < (datetoo ? 8 : 3); i++) {
++ unsigned char rdata[3] = { 0, reg_base + i, buf[i] };
++
++ xfer = i2c_master_send(client, rdata, 3);
++ if (xfer != 3) {
++ dev_err(&client->dev,
++ "%s: xfer=%d addr=%02x, data=%02x\n",
++ __FUNCTION__,
++ xfer, rdata[1], rdata[2]);
++ return -EIO;
++ }
++ };
++
++ /* disable further writes */
++ xfer = i2c_master_send(client, diswe, 3);
++ if (xfer != 3) {
++ dev_err(&client->dev, "%s: diswe - %d\n", __FUNCTION__, xfer);
++ return -EIO;
++ }
++
++ return 0;
++}
++#endif
++
++static int pcf8563_hctosys(struct i2c_client *client)
++{
++ int err;
++
++ struct rtc_time tm;
++ struct timespec tv;
++
++ err = pcf8563_command(client, PCF8563_CMD_GETDATETIME, &tm);
++
++ if (err) {
++ dev_err(&client->dev,
++ "Unable to set the system clock\n");
++ return err;
++ }
++
++ /* IMPORTANT: the RTC only stores whole seconds. It is arbitrary
++ * whether it stores the most close value or the value with partial
++ * seconds truncated. However, it is important that we use it to store
++ * the truncated value. This is because otherwise it is necessary,
++ * in an rtc sync function, to read both xtime.tv_sec and
++ * xtime.tv_nsec. On some processors (i.e. ARM), an atomic read
++ * of >32bits is not possible. So storing the most close value would
++ * slow down the sync API. So here we have the truncated value and
++ * the best guess is to add 0.5s.
++ */
++
++ tv.tv_nsec = NSEC_PER_SEC >> 1;
++
++ /* WARNING: this is not the C library 'mktime' call, it is a built in
++ * inline function from include/linux/time.h. It expects (requires)
++ * the month to be in the range 1-12
++ */
++
++ tv.tv_sec = mktime(tm.tm_year + 1900, tm.tm_mon + 1,
++ tm.tm_mday, tm.tm_hour,
++ tm.tm_min, tm.tm_sec);
++
++ do_settimeofday(&tv);
++
++ dev_info(&client->dev,
++ "setting the system clock to %d-%d-%d %d:%d:%d\n",
++ tm.tm_year + 1900, tm.tm_mon + 1,
++ tm.tm_mday, tm.tm_hour, tm.tm_min,
++ tm.tm_sec);
++
++ return 0;
++}
++#if 0
++struct pcf8563_limit
++{
++ unsigned char reg;
++ unsigned char mask;
++ unsigned char min;
++ unsigned char max;
++};
++
++static int pcf8563_validate_client(struct i2c_client *client)
++{
++ int i, xfer;
++
++ /* Probe array. We will read the register at the specified
++ * address and check if the given bits are zero.
++ */
++ static const unsigned char probe_zero_pattern[] = {
++ /* register, mask */
++ PCF8563_REG_SR, 0x18,
++ PCF8563_REG_DTR, 0xF8,
++ PCF8563_REG_ATR, 0xC0,
++ PCF8563_REG_INT, 0x18,
++ PCF8563_REG_0, 0xFF,
++ };
++
++ static const struct pcf8563_limit probe_limits_pattern[] = {
++ /* register, mask, min, max */
++ { PCF8563_REG_Y2K, 0xFF, 19, 20 },
++ { PCF8563_REG_DW, 0xFF, 0, 6 },
++ { PCF8563_REG_YR, 0xFF, 0, 99 },
++ { PCF8563_REG_MO, 0xFF, 0, 12 },
++ { PCF8563_REG_DT, 0xFF, 0, 31 },
++ { PCF8563_REG_HR, 0x7F, 0, 23 },
++ { PCF8563_REG_MN, 0xFF, 0, 59 },
++ { PCF8563_REG_SC, 0xFF, 0, 59 },
++ { PCF8563_REG_Y2K1, 0xFF, 19, 20 },
++ { PCF8563_REG_Y2K0, 0xFF, 19, 20 },
++ };
++
++ /* check that registers have bits at 0 where expected */
++ for (i = 0; i < ARRAY_SIZE(probe_zero_pattern); i += 2) {
++ unsigned char buf;
++
++ struct i2c_msg msgs[2] = {
++ { client->addr, 0, 1, &probe_zero_pattern[i] },
++ { client->addr, I2C_M_RD, 1, &buf },
++ };
++
++ xfer = i2c_transfer(client->adapter, msgs, 2);
++ if (xfer != 2) {
++ dev_err(&client->adapter->dev,
++ "%s: could not read register %x\n",
++ __FUNCTION__, probe_zero_pattern[i]);
++
++ return -EIO;
++ }
++
++ if ((buf & probe_zero_pattern[i+1]) != 0) {
++ dev_err(&client->adapter->dev,
++ "%s: register=%02x, zero pattern=%d, value=%x\n",
++ __FUNCTION__, probe_zero_pattern[i], i, buf);
++
++ return -ENODEV;
++ }
++ }
++
++ /* check limits (only registers with bcd values) */
++ for (i = 0; i < ARRAY_SIZE(probe_limits_pattern); i++) {
++ unsigned char reg, value;
++
++ struct i2c_msg msgs[2] = {
++ { client->addr, 0, 2, &probe_limits_pattern[i].reg},
++ { client->addr, I2C_M_RD, 1, &reg },
++ };
++
++ xfer = i2c_transfer(client->adapter, msgs, 2);
++
++ if (xfer != 2) {
++ dev_err(&client->adapter->dev,
++ "%s: could not read register %x\n",
++ __FUNCTION__, probe_limits_pattern[i].reg);
++
++ return -EIO;
++ }
++
++ value = BCD2BIN(reg & probe_limits_pattern[i].mask);
++
++ if (value > probe_limits_pattern[i].max ||
++ value < probe_limits_pattern[i].min) {
++ dev_dbg(&client->adapter->dev,
++ "%s: register=%x, lim pattern=%d, value=%d\n",
++ __FUNCTION__, probe_limits_pattern[i].reg, i, value);
++
++ return -ENODEV;
++ }
++ }
++
++ return 0;
++}
++#endif
++static int pcf8563_attach(struct i2c_adapter *adapter)
++{
++ return i2c_probe(adapter, &addr_data, pcf8563_probe);
++}
++
++static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind)
++{
++ struct i2c_client *client;
++ struct pcf8563_data *data;
++
++ int err = 0;
++
++ dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
++
++ if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
++ err = -ENODEV;
++ goto exit;
++ }
++
++ if (!(data = kzalloc(sizeof(struct pcf8563_data), GFP_KERNEL))) {
++ err = -ENOMEM;
++ goto exit;
++ }
++
++ client = &data->client;
++ client->addr = address;
++ client->driver = &pcf8563_driver;
++ client->adapter = adapter;
++
++ strlcpy(client->name, "pcf8563", I2C_NAME_SIZE);
++
++ i2c_set_clientdata(client, data);
++
++ /* Verify the chip is really an PCF8563 */
++ if (kind < 0) {
++/* if (pcf8563_validate_client(client) < 0) {
++ err = -ENODEV;
++ goto exit_kfree;
++ }
++*/ }
++
++ /* Inform the i2c layer */
++ if ((err = i2c_attach_client(client)))
++ goto exit_kfree;
++
++ list_add(&data->list, &pcf8563_clients);
++
++ dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
++
++ /* If requested, set the system time */
++ if (hctosys)
++ pcf8563_hctosys(client);
++
++ return 0;
++
++exit_kfree:
++ kfree(data);
++
++exit:
++ return err;
++}
++
++static int pcf8563_detach(struct i2c_client *client)
++{
++ int err;
++ struct pcf8563_data *data = i2c_get_clientdata(client);
++
++ if ((err = i2c_detach_client(client)))
++ return err;
++
++ list_del(&data->list);
++
++ kfree(data);
++
++ return 0;
++}
++
++static int pcf8563_command(struct i2c_client *client, unsigned int cmd,
++ void *param)
++{
++ if (param == NULL)
++ return -EINVAL;
++
++ if (!capable(CAP_SYS_TIME))
++ return -EACCES;
++
++ dev_dbg(&client->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
++
++ switch (cmd) {
++ case PCF8563_CMD_GETDATETIME:
++ return pcf8563_get_datetime(client, param);
++/*
++ case PCF8563_CMD_SETTIME:
++ return pcf8563_set_datetime(client, param, 0,
++ PCF8563_CCR_BASE);
++
++ case PCF8563_CMD_SETDATETIME:
++ return pcf8563_set_datetime(client, param, 1,
++ PCF8563_CCR_BASE);
++
++ case PCF8563_CMD_GETALARM:
++ return pcf8563_get_datetime(client, param, PCF8563_ALM0_BASE);
++
++ case PCF8563_CMD_SETALARM:
++ return pcf8563_set_datetime(client, param, 1,
++ PCF8563_ALM0_BASE);
+*/
++ default:
++ return -EINVAL;
++ }
++}
++
++static int __init pcf8563_init(void)
++{
++ return i2c_add_driver(&pcf8563_driver);
++}
++
++static void __exit pcf8563_exit(void)
++{
++ i2c_del_driver(&pcf8563_driver);
++}
++
++MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
++MODULE_DESCRIPTION("Philips PCF8563 RTC driver");
++MODULE_LICENSE("GPL");
++MODULE_VERSION(DRV_VERSION);
++
++EXPORT_SYMBOL_GPL(pcf8563_do_command);
++
++module_init(pcf8563_init);
++module_exit(pcf8563_exit);
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-nas100d/include/linux/pcf8563.h 2005-11-15 20:55:54.000000000 +0100
+@@ -0,0 +1,24 @@
++/*
++ * pcf8563.h - defines for drivers/i2c/chips/pcf8563.c
++ * Copyright 2005 Alessandro Zummo
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#ifndef __LINUX_PCF8563_H__
++#define __LINUX_PCF8563_H__
++
++/* commands */
++
++#define PCF8563_CMD_GETDATETIME 0
++#define PCF8563_CMD_SETTIME 1
++#define PCF8563_CMD_SETDATETIME 2
++#define PCF8563_CMD_GETALARM 3
++#define PCF8563_CMD_SETALARM 4
++
++extern int pcf8563_do_command(unsigned int cmd, void *arg);
++
++#endif /* __LINUX_PCF8563_H__ */
+--- linux-nas100d.orig/drivers/i2c/chips/Kconfig 2005-11-11 22:22:43.000000000 +0100
++++ linux-nas100d/drivers/i2c/chips/Kconfig 2005-11-15 22:37:25.000000000 +0100
+@@ -126,4 +126,13 @@ config SENSORS_MAX6875
+ This driver can also be built as a module. If so, the module
+ will be called max6875.
+
++config RTC_PCF8563_I2C
++ tristate "Philips PCF8563 RTC"
++ depends on I2C && EXPERIMENTAL
++ help
++ If you say yes here you get support for the Philips PCF8563
++ Real Time Clock chip. This chip is used by the Iomega NAS100D.
++
++ This driver can also be built as a module. If so, the module
++ will be called pcf8563.
+ endmenu
+--- linux-nas100d.orig/drivers/i2c/chips/Makefile 2005-11-11 22:22:43.000000000 +0100
++++ linux-nas100d/drivers/i2c/chips/Makefile 2005-11-15 21:11:26.000000000 +0100
+@@ -13,6 +13,7 @@ obj-$(CONFIG_SENSORS_PCF8591) += pcf8591
+ obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o
+ obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
+ obj-$(CONFIG_TPS65010) += tps65010.o
++obj-$(CONFIG_RTC_PCF8563_I2C) += pcf8563.o
+
+ ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
+ EXTRA_CFLAGS += -DDEBUG