aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc64
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-09-07 18:12:59 -0700
committerDavid S. Miller <davem@davemloft.net>2008-09-07 18:12:59 -0700
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 209e7d28c3a..226a0042d87 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -500,6 +500,7 @@ static struct of_platform_driver bq4802_driver = {
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(struct device *dev, u32 ofs)
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(struct device *dev, u32 ofs)
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