diff options
Diffstat (limited to 'arch/sparc64/kernel/time.c')
-rw-r--r-- | arch/sparc64/kernel/time.c | 6 |
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 = { | |||
500 | static unsigned char mostek_read_byte(struct device *dev, u32 ofs) | 500 | static 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) | |||
518 | static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) | 519 | static 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 |