diff options
Diffstat (limited to 'arch/sparc64/kernel/time.c')
-rw-r--r-- | arch/sparc64/kernel/time.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index 80d71a5ce1e3..dfd1b33e770a 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
@@ -503,39 +503,16 @@ static struct of_platform_driver bq4802_driver = { | |||
503 | static unsigned char mostek_read_byte(struct device *dev, u32 ofs) | 503 | static unsigned char mostek_read_byte(struct device *dev, u32 ofs) |
504 | { | 504 | { |
505 | struct platform_device *pdev = to_platform_device(dev); | 505 | struct platform_device *pdev = to_platform_device(dev); |
506 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; | 506 | void __iomem *regs = (void __iomem *) pdev->resource[0].start; |
507 | void __iomem *regs; | 507 | |
508 | unsigned char val; | 508 | return readb(regs + ofs); |
509 | |||
510 | regs = (void __iomem *) pdev->resource[0].start; | ||
511 | val = readb(regs + ofs); | ||
512 | |||
513 | /* the year 0 is 1968 */ | ||
514 | if (ofs == pdata->offset + M48T59_YEAR) { | ||
515 | val += 0x68; | ||
516 | if ((val & 0xf) > 9) | ||
517 | val += 6; | ||
518 | } | ||
519 | return val; | ||
520 | } | 509 | } |
521 | 510 | ||
522 | static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) | 511 | static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) |
523 | { | 512 | { |
524 | struct platform_device *pdev = to_platform_device(dev); | 513 | struct platform_device *pdev = to_platform_device(dev); |
525 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; | 514 | void __iomem *regs = (void __iomem *) pdev->resource[0].start; |
526 | void __iomem *regs; | 515 | |
527 | |||
528 | regs = (void __iomem *) pdev->resource[0].start; | ||
529 | if (ofs == pdata->offset + M48T59_YEAR) { | ||
530 | if (val < 0x68) | ||
531 | val += 0x32; | ||
532 | else | ||
533 | val -= 0x68; | ||
534 | if ((val & 0xf) > 9) | ||
535 | val += 6; | ||
536 | if ((val & 0xf0) > 0x9A) | ||
537 | val += 0x60; | ||
538 | } | ||
539 | writeb(val, regs + ofs); | 516 | writeb(val, regs + ofs); |
540 | } | 517 | } |
541 | 518 | ||