[kernel] r13845 - in dists/lenny/linux-2.6/debian: . config/mips patches/bugfix/all patches/bugfix/mips patches/series

Martin Michlmayr tbm at alioth.debian.org
Wed Jun 24 22:22:33 UTC 2009


Author: tbm
Date: Wed Jun 24 22:22:30 2009
New Revision: 13845

Log:
fix RTC on IP22

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286-include.patch
   dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286.patch
   dists/lenny/linux-2.6/debian/patches/bugfix/mips/rtc-use-platform.patch
   dists/lenny/linux-2.6/debian/patches/series/18
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/config/mips/config.r4k-ip22

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Tue Jun 23 09:43:55 2009	(r13844)
+++ dists/lenny/linux-2.6/debian/changelog	Wed Jun 24 22:22:30 2009	(r13845)
@@ -1,11 +1,17 @@
 linux-2.6 (2.6.26-18) UNRELEASED; urgency=high
 
+  [ maximilian attems ]
   * [openvz] 19f7f85 net: bridge - process skbs has been already substituted
     due to via_phys_dev (closes: #532811)
   * [openvz] b1f08ed net: avoid double free on net->gen pointer on error
     (closes: #532813)
   * [openvz] bbbad0a pidns: pi-futex pid check fixup
 
+  [ Martin Michlmayr ]
+  * MIPS: DS1286: New RTC driver
+  * MIPS: IP22/28: Switch over to RTC class driver
+  * [mips/r4k-ip22] Build in RTC_DRV_DS1286. (Closes: #533895)
+
  -- maximilian attems <maks at debian.org>  Wed, 10 Jun 2009 15:34:04 +0200
 
 linux-2.6 (2.6.26-17) stable; urgency=high

Modified: dists/lenny/linux-2.6/debian/config/mips/config.r4k-ip22
==============================================================================
--- dists/lenny/linux-2.6/debian/config/mips/config.r4k-ip22	Tue Jun 23 09:43:55 2009	(r13844)
+++ dists/lenny/linux-2.6/debian/config/mips/config.r4k-ip22	Wed Jun 24 22:22:30 2009	(r13845)
@@ -121,10 +121,6 @@
 CONFIG_PRINTER=m
 # CONFIG_LP_CONSOLE is not set
 # CONFIG_PPDEV is not set
-CONFIG_RTC=m
-CONFIG_SGI_DS1286=y
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_TELCLOCK is not set
@@ -630,3 +626,6 @@
 # CONFIG_SOUND_MSNDCLAS is not set
 # CONFIG_SOUND_MSNDPIN is not set
 
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_DS1286=y
+

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286-include.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286-include.patch	Wed Jun 24 22:22:30 2009	(r13845)
@@ -0,0 +1,51 @@
+From: Geert Uytterhoeven <geert at linux-m68k.org>
+Date: Thu, 16 Oct 2008 07:28:47 +0000 (+0200)
+Subject: rtc: rtc-ds1286 and rtc-m48t35 need <linux/io.h>
+X-Git-Tag: v2.6.28-rc1~290
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=d7a6119f457f48a94985fdbdc400cbb03e136a76
+
+rtc: rtc-ds1286 and rtc-m48t35 need <linux/io.h>
+
+With m68k allmodconfig, I get:
+
+| drivers/rtc/rtc-ds1286.c: In function 'ds1286_rtc_read':
+| drivers/rtc/rtc-ds1286.c:33: error: implicit declaration of function '__raw_readl'
+| drivers/rtc/rtc-ds1286.c: In function 'ds1286_rtc_write':
+| drivers/rtc/rtc-ds1286.c:38: error: implicit declaration of function '__raw_writel'
+| drivers/rtc/rtc-ds1286.c: In function 'ds1286_probe':
+| drivers/rtc/rtc-ds1286.c:345: error: implicit declaration of function 'ioremap'
+| drivers/rtc/rtc-ds1286.c:345: warning: assignment makes pointer from integer without a cast
+| drivers/rtc/rtc-ds1286.c:365: error: implicit declaration of function 'iounmap'
+
+and
+
+| drivers/rtc/rtc-m48t35.c: In function 'm48t35_read_time':
+| drivers/rtc/rtc-m48t35.c:59: error: implicit declaration of function 'readb'
+| drivers/rtc/rtc-m48t35.c:60: error: implicit declaration of function 'writeb'
+| drivers/rtc/rtc-m48t35.c: In function 'm48t35_probe':
+| drivers/rtc/rtc-m48t35.c:168: error: implicit declaration of function 'ioremap'
+| drivers/rtc/rtc-m48t35.c:168: warning: assignment makes pointer from integer without a cast
+| drivers/rtc/rtc-m48t35.c:188: error: implicit declaration of function 'iounmap'
+
+Include <linux/io.h> to get access to the I/O API.
+
+Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
+Acked-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+
+diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
+index 4b4c1b6..4fcb16b 100644
+--- a/drivers/rtc/rtc-ds1286.c
++++ b/drivers/rtc/rtc-ds1286.c
+@@ -17,6 +17,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/bcd.h>
+ #include <linux/ds1286.h>
++#include <linux/io.h>
+ 
+ #define DRV_VERSION		"1.0"
+ 
+
+[ rtc-m48t35.c patch removed since that's not in 2.6.26 -- tbm ]
+ 

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/rtc-ds1286.patch	Wed Jun 24 22:22:30 2009	(r13845)
@@ -0,0 +1,455 @@
+From: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+Date: Tue, 14 Oct 2008 15:16:59 +0000 (+0200)
+Subject: MIPS: DS1286: New RTC driver
+X-Git-Tag: v2.6.28-rc1~564^2~4
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5f119f29063c9a9bf1ab40112c02710c2db84f29
+
+MIPS: DS1286: New RTC driver
+
+This driver replaces the broken DS1286 driver in drivers/char and gives back
+RTC support for SGI IP22 and IP28 machines.
+
+Signed-off-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+Acked-by: Alessandro Zummo <alessandro.zummo at towertech.it>
+Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
+---
+
+--- a/drivers/rtc/Kconfig~	2009-06-23 08:41:09.000000000 +0000
++++ b/drivers/rtc/Kconfig	2009-06-23 08:41:14.000000000 +0000
+@@ -333,6 +333,11 @@
+ 	help
+ 	  If you say yes here you get support for the Dallas DS1216 RTC chips.
+ 
++config RTC_DRV_DS1286
++	tristate "Dallas DS1286"
++	help
++	  If you say yes here you get support for the Dallas DS1286 RTC chips.
++
+ config RTC_DRV_DS1302
+ 	tristate "Dallas DS1302"
+ 	depends on SH_SECUREEDGE5410
+--- a/drivers/rtc/Makefile~	2009-06-23 08:41:12.000000000 +0000
++++ b/drivers/rtc/Makefile	2009-06-23 08:41:14.000000000 +0000
+@@ -23,6 +23,7 @@
+ obj-$(CONFIG_RTC_DRV_BFIN)	+= rtc-bfin.o
+ obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc-cmos.o
+ obj-$(CONFIG_RTC_DRV_DS1216)	+= rtc-ds1216.o
++obj-$(CONFIG_RTC_DRV_DS1286)	+= rtc-ds1286.o
+ obj-$(CONFIG_RTC_DRV_DS1302)	+= rtc-ds1302.o
+ obj-$(CONFIG_RTC_DRV_DS1307)	+= rtc-ds1307.o
+ obj-$(CONFIG_RTC_DRV_DS1374)	+= rtc-ds1374.o
+diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
+new file mode 100644
+index 0000000..4b4c1b6
+--- /dev/null
++++ b/drivers/rtc/rtc-ds1286.c
+@@ -0,0 +1,409 @@
++/*
++ * DS1286 Real Time Clock interface for Linux
++ *
++ * Copyright (C) 1998, 1999, 2000 Ralf Baechle
++ * Copyright (C) 2008 Thomas Bogendoerfer
++ *
++ * Based on code written by Paul Gortmaker.
++ *
++ * 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/rtc.h>
++#include <linux/platform_device.h>
++#include <linux/bcd.h>
++#include <linux/ds1286.h>
++
++#define DRV_VERSION		"1.0"
++
++struct ds1286_priv {
++	struct rtc_device *rtc;
++	u32 __iomem *rtcregs;
++	size_t size;
++	unsigned long baseaddr;
++	spinlock_t lock;
++};
++
++static inline u8 ds1286_rtc_read(struct ds1286_priv *priv, int reg)
++{
++	return __raw_readl(&priv->rtcregs[reg]) & 0xff;
++}
++
++static inline void ds1286_rtc_write(struct ds1286_priv *priv, u8 data, int reg)
++{
++	__raw_writel(data, &priv->rtcregs[reg]);
++}
++
++#ifdef CONFIG_RTC_INTF_DEV
++
++static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned long flags;
++	unsigned char val;
++
++	switch (cmd) {
++	case RTC_AIE_OFF:
++		/* Mask alarm int. enab. bit	*/
++		spin_lock_irqsave(&priv->lock, flags);
++		val = ds1286_rtc_read(priv, RTC_CMD);
++		val |=  RTC_TDM;
++		ds1286_rtc_write(priv, val, RTC_CMD);
++		spin_unlock_irqrestore(&priv->lock, flags);
++		break;
++	case RTC_AIE_ON:
++		/* Allow alarm interrupts.	*/
++		spin_lock_irqsave(&priv->lock, flags);
++		val = ds1286_rtc_read(priv, RTC_CMD);
++		val &=  ~RTC_TDM;
++		ds1286_rtc_write(priv, val, RTC_CMD);
++		spin_unlock_irqrestore(&priv->lock, flags);
++		break;
++	case RTC_WIE_OFF:
++		/* Mask watchdog int. enab. bit	*/
++		spin_lock_irqsave(&priv->lock, flags);
++		val = ds1286_rtc_read(priv, RTC_CMD);
++		val |= RTC_WAM;
++		ds1286_rtc_write(priv, val, RTC_CMD);
++		spin_unlock_irqrestore(&priv->lock, flags);
++		break;
++	case RTC_WIE_ON:
++		/* Allow watchdog interrupts.	*/
++		spin_lock_irqsave(&priv->lock, flags);
++		val = ds1286_rtc_read(priv, RTC_CMD);
++		val &= ~RTC_WAM;
++		ds1286_rtc_write(priv, val, RTC_CMD);
++		spin_unlock_irqrestore(&priv->lock, flags);
++		break;
++	default:
++		return -ENOIOCTLCMD;
++	}
++	return 0;
++}
++
++#else
++#define ds1286_ioctl    NULL
++#endif
++
++#ifdef CONFIG_PROC_FS
++
++static int ds1286_proc(struct device *dev, struct seq_file *seq)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned char month, cmd, amode;
++	const char *s;
++
++	month = ds1286_rtc_read(priv, RTC_MONTH);
++	seq_printf(seq,
++		   "oscillator\t: %s\n"
++		   "square_wave\t: %s\n",
++		   (month & RTC_EOSC) ? "disabled" : "enabled",
++		   (month & RTC_ESQW) ? "disabled" : "enabled");
++
++	amode = ((ds1286_rtc_read(priv, RTC_MINUTES_ALARM) & 0x80) >> 5) |
++		((ds1286_rtc_read(priv, RTC_HOURS_ALARM) & 0x80) >> 6) |
++		((ds1286_rtc_read(priv, RTC_DAY_ALARM) & 0x80) >> 7);
++	switch (amode) {
++	case 7:
++		s = "each minute";
++		break;
++	case 3:
++		s = "minutes match";
++		break;
++	case 1:
++		s = "hours and minutes match";
++		break;
++	case 0:
++		s = "days, hours and minutes match";
++		break;
++	default:
++		s = "invalid";
++		break;
++	}
++	seq_printf(seq, "alarm_mode\t: %s\n", s);
++
++	cmd = ds1286_rtc_read(priv, RTC_CMD);
++	seq_printf(seq,
++		   "alarm_enable\t: %s\n"
++		   "wdog_alarm\t: %s\n"
++		   "alarm_mask\t: %s\n"
++		   "wdog_alarm_mask\t: %s\n"
++		   "interrupt_mode\t: %s\n"
++		   "INTB_mode\t: %s_active\n"
++		   "interrupt_pins\t: %s\n",
++		   (cmd & RTC_TDF) ? "yes" : "no",
++		   (cmd & RTC_WAF) ? "yes" : "no",
++		   (cmd & RTC_TDM) ? "disabled" : "enabled",
++		   (cmd & RTC_WAM) ? "disabled" : "enabled",
++		   (cmd & RTC_PU_LVL) ? "pulse" : "level",
++		   (cmd & RTC_IBH_LO) ? "low" : "high",
++		   (cmd & RTC_IPSW) ? "unswapped" : "swapped");
++	return 0;
++}
++
++#else
++#define ds1286_proc     NULL
++#endif
++
++static int ds1286_read_time(struct device *dev, struct rtc_time *tm)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned char save_control;
++	unsigned long flags;
++	unsigned long uip_watchdog = jiffies;
++
++	/*
++	 * read RTC once any update in progress is done. The update
++	 * can take just over 2ms. We wait 10 to 20ms. There is no need to
++	 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
++	 * If you need to know *exactly* when a second has started, enable
++	 * periodic update complete interrupts, (via ioctl) and then
++	 * immediately read /dev/rtc which will block until you get the IRQ.
++	 * Once the read clears, read the RTC time (again via ioctl). Easy.
++	 */
++
++	if (ds1286_rtc_read(priv, RTC_CMD) & RTC_TE)
++		while (time_before(jiffies, uip_watchdog + 2*HZ/100))
++			barrier();
++
++	/*
++	 * Only the values that we read from the RTC are set. We leave
++	 * tm_wday, tm_yday and tm_isdst untouched. Even though the
++	 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
++	 * by the RTC when initially set to a non-zero value.
++	 */
++	spin_lock_irqsave(&priv->lock, flags);
++	save_control = ds1286_rtc_read(priv, RTC_CMD);
++	ds1286_rtc_write(priv, (save_control|RTC_TE), RTC_CMD);
++
++	tm->tm_sec = ds1286_rtc_read(priv, RTC_SECONDS);
++	tm->tm_min = ds1286_rtc_read(priv, RTC_MINUTES);
++	tm->tm_hour = ds1286_rtc_read(priv, RTC_HOURS) & 0x3f;
++	tm->tm_mday = ds1286_rtc_read(priv, RTC_DATE);
++	tm->tm_mon = ds1286_rtc_read(priv, RTC_MONTH) & 0x1f;
++	tm->tm_year = ds1286_rtc_read(priv, RTC_YEAR);
++
++	ds1286_rtc_write(priv, save_control, RTC_CMD);
++	spin_unlock_irqrestore(&priv->lock, flags);
++
++	tm->tm_sec = BCD2BIN(tm->tm_sec);
++	tm->tm_min = BCD2BIN(tm->tm_min);
++	tm->tm_hour = BCD2BIN(tm->tm_hour);
++	tm->tm_mday = BCD2BIN(tm->tm_mday);
++	tm->tm_mon = BCD2BIN(tm->tm_mon);
++	tm->tm_year = BCD2BIN(tm->tm_year);
++
++	/*
++	 * Account for differences between how the RTC uses the values
++	 * and how they are defined in a struct rtc_time;
++	 */
++	if (tm->tm_year < 45)
++		tm->tm_year += 30;
++	tm->tm_year += 40;
++	if (tm->tm_year < 70)
++		tm->tm_year += 100;
++
++	tm->tm_mon--;
++
++	return rtc_valid_tm(tm);
++}
++
++static int ds1286_set_time(struct device *dev, struct rtc_time *tm)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned char mon, day, hrs, min, sec;
++	unsigned char save_control;
++	unsigned int yrs;
++	unsigned long flags;
++
++	yrs = tm->tm_year + 1900;
++	mon = tm->tm_mon + 1;   /* tm_mon starts at zero */
++	day = tm->tm_mday;
++	hrs = tm->tm_hour;
++	min = tm->tm_min;
++	sec = tm->tm_sec;
++
++	if (yrs < 1970)
++		return -EINVAL;
++
++	yrs -= 1940;
++	if (yrs > 255)    /* They are unsigned */
++		return -EINVAL;
++
++	if (yrs >= 100)
++		yrs -= 100;
++
++	sec = BIN2BCD(sec);
++	min = BIN2BCD(min);
++	hrs = BIN2BCD(hrs);
++	day = BIN2BCD(day);
++	mon = BIN2BCD(mon);
++	yrs = BIN2BCD(yrs);
++
++	spin_lock_irqsave(&priv->lock, flags);
++	save_control = ds1286_rtc_read(priv, RTC_CMD);
++	ds1286_rtc_write(priv, (save_control|RTC_TE), RTC_CMD);
++
++	ds1286_rtc_write(priv, yrs, RTC_YEAR);
++	ds1286_rtc_write(priv, mon, RTC_MONTH);
++	ds1286_rtc_write(priv, day, RTC_DATE);
++	ds1286_rtc_write(priv, hrs, RTC_HOURS);
++	ds1286_rtc_write(priv, min, RTC_MINUTES);
++	ds1286_rtc_write(priv, sec, RTC_SECONDS);
++	ds1286_rtc_write(priv, 0, RTC_HUNDREDTH_SECOND);
++
++	ds1286_rtc_write(priv, save_control, RTC_CMD);
++	spin_unlock_irqrestore(&priv->lock, flags);
++	return 0;
++}
++
++static int ds1286_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned char cmd;
++	unsigned long flags;
++
++	/*
++	 * Only the values that we read from the RTC are set. That
++	 * means only tm_wday, tm_hour, tm_min.
++	 */
++	spin_lock_irqsave(&priv->lock, flags);
++	alm->time.tm_min = ds1286_rtc_read(priv, RTC_MINUTES_ALARM) & 0x7f;
++	alm->time.tm_hour = ds1286_rtc_read(priv, RTC_HOURS_ALARM)  & 0x1f;
++	alm->time.tm_wday = ds1286_rtc_read(priv, RTC_DAY_ALARM)    & 0x07;
++	cmd = ds1286_rtc_read(priv, RTC_CMD);
++	spin_unlock_irqrestore(&priv->lock, flags);
++
++	alm->time.tm_min = BCD2BIN(alm->time.tm_min);
++	alm->time.tm_hour = BCD2BIN(alm->time.tm_hour);
++	alm->time.tm_sec = 0;
++	return 0;
++}
++
++static int ds1286_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
++{
++	struct ds1286_priv *priv = dev_get_drvdata(dev);
++	unsigned char hrs, min, sec;
++
++	hrs = alm->time.tm_hour;
++	min = alm->time.tm_min;
++	sec = alm->time.tm_sec;
++
++	if (hrs >= 24)
++		hrs = 0xff;
++
++	if (min >= 60)
++		min = 0xff;
++
++	if (sec != 0)
++		return -EINVAL;
++
++	min = BIN2BCD(min);
++	hrs = BIN2BCD(hrs);
++
++	spin_lock(&priv->lock);
++	ds1286_rtc_write(priv, hrs, RTC_HOURS_ALARM);
++	ds1286_rtc_write(priv, min, RTC_MINUTES_ALARM);
++	spin_unlock(&priv->lock);
++
++	return 0;
++}
++
++static const struct rtc_class_ops ds1286_ops = {
++	.ioctl   	= ds1286_ioctl,
++	.proc   	= ds1286_proc,
++	.read_time	= ds1286_read_time,
++	.set_time	= ds1286_set_time,
++	.read_alarm	= ds1286_read_alarm,
++	.set_alarm	= ds1286_set_alarm,
++};
++
++static int __devinit ds1286_probe(struct platform_device *pdev)
++{
++	struct rtc_device *rtc;
++	struct resource *res;
++	struct ds1286_priv *priv;
++	int ret = 0;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	if (!res)
++		return -ENODEV;
++	priv = kzalloc(sizeof(struct ds1286_priv), GFP_KERNEL);
++	if (!priv)
++		return -ENOMEM;
++
++	priv->size = res->end - res->start + 1;
++	if (!request_mem_region(res->start, priv->size, pdev->name)) {
++		ret = -EBUSY;
++		goto out;
++	}
++	priv->baseaddr = res->start;
++	priv->rtcregs = ioremap(priv->baseaddr, priv->size);
++	if (!priv->rtcregs) {
++		ret = -ENOMEM;
++		goto out;
++	}
++	spin_lock_init(&priv->lock);
++	rtc = rtc_device_register("ds1286", &pdev->dev,
++				  &ds1286_ops, THIS_MODULE);
++	if (IS_ERR(rtc)) {
++		ret = PTR_ERR(rtc);
++		goto out;
++	}
++	priv->rtc = rtc;
++	platform_set_drvdata(pdev, priv);
++	return 0;
++
++out:
++	if (priv->rtc)
++		rtc_device_unregister(priv->rtc);
++	if (priv->rtcregs)
++		iounmap(priv->rtcregs);
++	if (priv->baseaddr)
++		release_mem_region(priv->baseaddr, priv->size);
++	kfree(priv);
++	return ret;
++}
++
++static int __devexit ds1286_remove(struct platform_device *pdev)
++{
++	struct ds1286_priv *priv = platform_get_drvdata(pdev);
++
++	rtc_device_unregister(priv->rtc);
++	iounmap(priv->rtcregs);
++	release_mem_region(priv->baseaddr, priv->size);
++	kfree(priv);
++	return 0;
++}
++
++static struct platform_driver ds1286_platform_driver = {
++	.driver		= {
++		.name	= "rtc-ds1286",
++		.owner	= THIS_MODULE,
++	},
++	.probe		= ds1286_probe,
++	.remove		= __devexit_p(ds1286_remove),
++};
++
++static int __init ds1286_init(void)
++{
++	return platform_driver_register(&ds1286_platform_driver);
++}
++
++static void __exit ds1286_exit(void)
++{
++	platform_driver_unregister(&ds1286_platform_driver);
++}
++
++MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend at alpha.franken.de>");
++MODULE_DESCRIPTION("DS1286 RTC driver");
++MODULE_LICENSE("GPL");
++MODULE_VERSION(DRV_VERSION);
++MODULE_ALIAS("platform:rtc-ds1286");
++
++module_init(ds1286_init);
++module_exit(ds1286_exit);

Added: dists/lenny/linux-2.6/debian/patches/bugfix/mips/rtc-use-platform.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/mips/rtc-use-platform.patch	Wed Jun 24 22:22:30 2009	(r13845)
@@ -0,0 +1,180 @@
+From: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+Date: Tue, 14 Oct 2008 15:16:55 +0000 (+0200)
+Subject: MIPS: IP22/28: Switch over to RTC class driver
+X-Git-Tag: v2.6.28-rc1~564^2~5
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=7d81a5e03ddbb44d05a32cad4a46a23577216497
+
+MIPS: IP22/28: Switch over to RTC class driver
+
+This patchset removes some dead code and creates a platform device
+for the RTC class driver.
+
+Signed-off-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
+---
+
+diff --git a/arch/mips/include/asm/mach-ip22/ds1286.h b/arch/mips/include/asm/mach-ip22/ds1286.h
+deleted file mode 100644
+index f19f1ea..0000000
+--- a/include/asm-mips/mach-ip22/ds1286.h
++++ /dev/null
+@@ -1,18 +0,0 @@
+-/*
+- * This file is subject to the terms and conditions of the GNU General Public
+- * License.  See the file "COPYING" in the main directory of this archive
+- * for more details.
+- *
+- * Copyright (C) 1998, 2001, 03 by Ralf Baechle
+- *
+- * RTC routines for PC style attached Dallas chip.
+- */
+-#ifndef __ASM_MACH_IP22_DS1286_H
+-#define __ASM_MACH_IP22_DS1286_H
+-
+-#include <asm/sgi/hpc3.h>
+-
+-#define rtc_read(reg)		(hpc3c0->rtcregs[(reg)] & 0xff)
+-#define rtc_write(data, reg)	do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
+-
+-#endif /* __ASM_MACH_IP22_DS1286_H */
+diff --git a/arch/mips/include/asm/mach-ip28/ds1286.h b/arch/mips/include/asm/mach-ip28/ds1286.h
+deleted file mode 100644
+index 471bb9a..0000000
+--- a/include/asm-mips/mach-ip28/ds1286.h
++++ /dev/null
+@@ -1,4 +0,0 @@
+-#ifndef __ASM_MACH_IP28_DS1286_H
+-#define __ASM_MACH_IP28_DS1286_H
+-#include <asm/mach-ip22/ds1286.h>
+-#endif /* __ASM_MACH_IP28_DS1286_H */
+diff --git a/arch/mips/sgi-ip22/ip22-platform.c b/arch/mips/sgi-ip22/ip22-platform.c
+index 52486c4..deddbf0 100644
+--- a/arch/mips/sgi-ip22/ip22-platform.c
++++ b/arch/mips/sgi-ip22/ip22-platform.c
+@@ -175,3 +175,19 @@
+ }
+ 
+ device_initcall(sgiseeq_devinit);
++
++static int __init sgi_ds1286_devinit(void)
++{
++	struct resource res;
++
++	memset(&res, 0, sizeof(res));
++	res.start = HPC3_CHIP0_BASE + offsetof(struct hpc3_regs, rtcregs);
++	res.end = res.start + sizeof(hpc3c0->rtcregs) - 1;
++	res.flags = IORESOURCE_MEM;
++
++	return IS_ERR(platform_device_register_simple("rtc-ds1286", -1,
++						&res, 1));
++}
++
++device_initcall(sgi_ds1286_devinit);
++
+diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
+index 896a1ef..b9a9313 100644
+--- a/arch/mips/sgi-ip22/ip22-setup.c
++++ b/arch/mips/sgi-ip22/ip22-setup.c
+@@ -4,7 +4,6 @@
+  * Copyright (C) 1996 David S. Miller (dm at engr.sgi.com)
+  * Copyright (C) 1997, 1998 Ralf Baechle (ralf at gnu.org)
+  */
+-#include <linux/ds1286.h>
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+ #include <linux/kdev_t.h>
+diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
+index 10e5054..3dcb27e 100644
+--- a/arch/mips/sgi-ip22/ip22-time.c
++++ b/arch/mips/sgi-ip22/ip22-time.c
+@@ -10,7 +10,6 @@
+  * Copyright (C) 2003, 06 Ralf Baechle (ralf at linux-mips.org)
+  */
+ #include <linux/bcd.h>
+-#include <linux/ds1286.h>
+ #include <linux/init.h>
+ #include <linux/irq.h>
+ #include <linux/kernel.h>
+@@ -29,69 +28,6 @@
+ #include <asm/sgi/hpc3.h>
+ #include <asm/sgi/ip22.h>
+ 
+-/*
+- * Note that mktime uses month from 1 to 12 while rtc_time_to_tm
+- * uses 0 to 11.
+- */
+-unsigned long read_persistent_clock(void)
+-{
+-	unsigned int yrs, mon, day, hrs, min, sec;
+-	unsigned int save_control;
+-	unsigned long flags;
+-
+-	spin_lock_irqsave(&rtc_lock, flags);
+-	save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
+-	hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
+-
+-	sec = BCD2BIN(hpc3c0->rtcregs[RTC_SECONDS] & 0xff);
+-	min = BCD2BIN(hpc3c0->rtcregs[RTC_MINUTES] & 0xff);
+-	hrs = BCD2BIN(hpc3c0->rtcregs[RTC_HOURS] & 0x3f);
+-	day = BCD2BIN(hpc3c0->rtcregs[RTC_DATE] & 0xff);
+-	mon = BCD2BIN(hpc3c0->rtcregs[RTC_MONTH] & 0x1f);
+-	yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff);
+-
+-	hpc3c0->rtcregs[RTC_CMD] = save_control;
+-	spin_unlock_irqrestore(&rtc_lock, flags);
+-
+-	if (yrs < 45)
+-		yrs += 30;
+-	if ((yrs += 40) < 70)
+-		yrs += 100;
+-
+-	return mktime(yrs + 1900, mon, day, hrs, min, sec);
+-}
+-
+-int rtc_mips_set_time(unsigned long tim)
+-{
+-	struct rtc_time tm;
+-	unsigned int save_control;
+-	unsigned long flags;
+-
+-	rtc_time_to_tm(tim, &tm);
+-
+-	tm.tm_mon += 1;		/* tm_mon starts at zero */
+-	tm.tm_year -= 40;
+-	if (tm.tm_year >= 100)
+-		tm.tm_year -= 100;
+-
+-	spin_lock_irqsave(&rtc_lock, flags);
+-	save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
+-	hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
+-
+-	hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_year);
+-	hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);
+-	hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);
+-	hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);
+-	hpc3c0->rtcregs[RTC_MINUTES] = BIN2BCD(tm.tm_min);
+-	hpc3c0->rtcregs[RTC_SECONDS] = BIN2BCD(tm.tm_sec);
+-	hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0;
+-
+-	hpc3c0->rtcregs[RTC_CMD] = save_control;
+-	spin_unlock_irqrestore(&rtc_lock, flags);
+-
+-	return 0;
+-}
+-
+ static unsigned long dosample(void)
+ {
+ 	u32 ct0, ct1;
+diff --git a/include/linux/ds1286.h b/include/linux/ds1286.h
+index d898986..45ea0aa 100644
+--- a/include/linux/ds1286.h
++++ b/include/linux/ds1286.h
+@@ -8,8 +8,6 @@
+ #ifndef __LINUX_DS1286_H
+ #define __LINUX_DS1286_H
+ 
+-#include <asm/ds1286.h>
+-
+ /**********************************************************************
+  * register summary
+  **********************************************************************/

Added: dists/lenny/linux-2.6/debian/patches/series/18
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/series/18	Wed Jun 24 22:22:30 2009	(r13845)
@@ -0,0 +1,3 @@
++ bugfix/all/rtc-ds1286.patch
++ bugfix/all/rtc-ds1286-include.patch
++ bugfix/mips/rtc-use-platform.patch



More information about the Kernel-svn-changes mailing list