[PATCH] sparc64: fix wrong m48t59 RTC year

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Krzysztof Helt <krzysztof.h1@xxxxx>

Correctly calculate offset to the year register for
Mostek RTC.

Signed-off-by: Krzysztof Helt <krzysztof.h1@xxxxx>
---

This happened because the rtc-m48t59 patches
changed offset constants to new one calculated
as difference from the nvram size.

diff -urp linux-ref/arch/sparc64/kernel/time.c linux-mm/arch/sparc64/kernel/time.c
--- linux-ref/arch/sparc64/kernel/time.c	2008-09-05 23:38:20.000000000 +0200
+++ linux-mm/arch/sparc64/kernel/time.c	2008-09-06 19:02:28.459001489 +0200
@@ -500,6 +500,7 @@ static struct of_platform_driver bq4802_
 static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	struct m48t59_plat_data *pdata = pdev->dev.platform_data;
 	void __iomem *regs;
 	unsigned char val;
 
@@ -507,7 +508,7 @@ static unsigned char mostek_read_byte(st
 	val = readb(regs + ofs);
 
 	/* the year 0 is 1968 */
-	if (ofs == M48T59_YEAR) {
+	if (ofs == pdata->offset + M48T59_YEAR) {
 		val += 0x68;
 		if ((val & 0xf) > 9)
 			val += 6;
@@ -518,10 +519,11 @@ static unsigned char mostek_read_byte(st
 static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	struct m48t59_plat_data *pdata = pdev->dev.platform_data;
 	void __iomem *regs;
 
 	regs = (void __iomem *) pdev->resource[0].start;
-	if (ofs == M48T59_YEAR) {
+	if (ofs == pdata->offset + M48T59_YEAR) {
 		if (val < 0x68)
 			val += 0x32;
 		else
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux