aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-09-07 21:12:59 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-07 21:12:59 -0400
commit3baca76f5653482f4b7fe1fc400b01877f6b2d92 (patch)
tree21c40a40ad121eab8f7b6c0061bb71f72354ed00 /arch/sparc64
parent1aa0365f275f7df6bb1e0b6667ed2b54199fe21d (diff)
sparc64: fix wrong m48t59 RTC year
Correctly calculate offset to the year register for Mostek RTC. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/time.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 209e7d28c3a5..226a0042d870 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -500,6 +500,7 @@ static struct of_platform_driver bq4802_driver = {
500static unsigned char mostek_read_byte(struct device *dev, u32 ofs) 500static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
501{ 501{
502 struct platform_device *pdev = to_platform_device(dev); 502 struct platform_device *pdev = to_platform_device(dev);
503 struct m48t59_plat_data *pdata = pdev->dev.platform_data;
503 void __iomem *regs; 504 void __iomem *regs;
504 unsigned char val; 505 unsigned char val;
505 506
@@ -507,7 +508,7 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
507 val = readb(regs + ofs); 508 val = readb(regs + ofs);
508 509
509 /* the year 0 is 1968 */ 510 /* the year 0 is 1968 */
510 if (ofs == M48T59_YEAR) { 511 if (ofs == pdata->offset + M48T59_YEAR) {
511 val += 0x68; 512 val += 0x68;
512 if ((val & 0xf) > 9) 513 if ((val & 0xf) > 9)
513 val += 6; 514 val += 6;
@@ -518,10 +519,11 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
518static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) 519static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
519{ 520{
520 struct platform_device *pdev = to_platform_device(dev); 521 struct platform_device *pdev = to_platform_device(dev);
522 struct m48t59_plat_data *pdata = pdev->dev.platform_data;
521 void __iomem *regs; 523 void __iomem *regs;
522 524
523 regs = (void __iomem *) pdev->resource[0].start; 525 regs = (void __iomem *) pdev->resource[0].start;
524 if (ofs == M48T59_YEAR) { 526 if (ofs == pdata->offset + M48T59_YEAR) {
525 if (val < 0x68) 527 if (val < 0x68)
526 val += 0x32; 528 val += 0x32;
527 else 529 else