diff options
Diffstat (limited to 'arch/sparc/kernel/time.c')
-rw-r--r-- | arch/sparc/kernel/time.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 62c1d94cb43..00f7383c765 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
@@ -119,35 +119,16 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs) | |||
119 | { | 119 | { |
120 | struct platform_device *pdev = to_platform_device(dev); | 120 | struct platform_device *pdev = to_platform_device(dev); |
121 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; | 121 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; |
122 | void __iomem *regs = pdata->ioaddr; | 122 | |
123 | unsigned char val = readb(regs + ofs); | 123 | return readb(pdata->ioaddr + ofs); |
124 | |||
125 | /* the year 0 is 1968 */ | ||
126 | if (ofs == pdata->offset + M48T59_YEAR) { | ||
127 | val += 0x68; | ||
128 | if ((val & 0xf) > 9) | ||
129 | val += 6; | ||
130 | } | ||
131 | return val; | ||
132 | } | 124 | } |
133 | 125 | ||
134 | static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) | 126 | static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) |
135 | { | 127 | { |
136 | struct platform_device *pdev = to_platform_device(dev); | 128 | struct platform_device *pdev = to_platform_device(dev); |
137 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; | 129 | struct m48t59_plat_data *pdata = pdev->dev.platform_data; |
138 | void __iomem *regs = pdata->ioaddr; | 130 | |
139 | 131 | writeb(val, pdata->ioaddr + ofs); | |
140 | if (ofs == pdata->offset + M48T59_YEAR) { | ||
141 | if (val < 0x68) | ||
142 | val += 0x32; | ||
143 | else | ||
144 | val -= 0x68; | ||
145 | if ((val & 0xf) > 9) | ||
146 | val += 6; | ||
147 | if ((val & 0xf0) > 0x9A) | ||
148 | val += 0x60; | ||
149 | } | ||
150 | writeb(val, regs + ofs); | ||
151 | } | 132 | } |
152 | 133 | ||
153 | static struct m48t59_plat_data m48t59_data = { | 134 | static struct m48t59_plat_data m48t59_data = { |