use rtc mostek drivers instead of minirtc
From: Krzysztof Helt <[email protected]>
Date: Sun, 24 Aug 2008 08:44:34 +0200
Quoted 1 line
I tried to use a rtc layer for sparc arch.
...
Quoted 3 lines
I would like to convert whole rtc handling to the rtc layer. However, I have no hardware to test (only U60) so I need some help from sparc people.
Thank you for doing this work, I appreciate it.
I'm happy to merge this and test other system types once the changes from -mm make it upstream.
RFC 1/1 use rtc mostek drivers instead of minirtc
Hi,
I tried to use a rtc layer for sparc arch.
The patch below removes rtc functions for the Mostek rtcs from the sparc specific files. The rtc is declared as platform device and use a driver from the rtc layer.
The detection and kick start are left untouched. If there are other things which can be fixed or improved please let me know. There are two quirks in the patch:
1. The year is stored since 1968 on sparc so the read/write function must convert this register value (this is ugly).
2. The minirtc driver returns ENODEV for mostek chips (so no two want to access the chip).
I tested it on my U60 and the rtc works correctly after change. The old /dev/rtc device does not work but the hwclock after the /dev/rtc is linked to a new /dev/rtc0 (device created by the rtc layer).
Before using the patch below, the rtc m48t59 driver need to be updated with two patches from the -mm tree:
rtc-m48t59-reduce-structure-m48t59_private.patch rtc-m48t59-add-support-for-m48t02-and-m48t59-chips-2nd-rev.patch
I would like to convert whole rtc handling to the rtc layer. However, I have no hardware to test (only U60) so I need some help from sparc people.
Regards,
Krzysztof
arch/sparc64/kernel/time.c +73 -114
@@ -30,10 +30,12 @@#include <linux/percpu.h> #include <linux/miscdevice.h> #include <linux/rtc.h> +#include <linux/rtc/m48t59.h> #include <linux/kernel_stat.h> #include <linux/clockchips.h> #include <linux/clocksource.h> #include <linux/of_device.h> +#include <linux/platform_device.h> #include <asm/oplib.h> #include <asm/mostek.h>
@@ -408,6 +410,59 @@ int update_persistent_clock(struct timesreturn set_rtc_mmss (now.tv_sec); } +static unsigned char mostek_read_byte (struct device *dev,u32 ofs) +{ +void __iomem *regs = mstk48t08_regs; +unsigned char val =mostek_read (regs + ofs); +struct platform_device *pdev =to_platform_device (dev); +struct m48t59_plat_data *pdata = pdev->dev.platform_data; + +/* the year 0 is 1968 */ +if (ofs = pdata->offset +M48T59_YEAR ) { + val +=0x68 ; +if ((val &0xf ) >9 ) + val +=6 ; + } +return val; +} + +static void mostek_write_byte (struct device *dev,u32 ofs,u8 val) +{ +void __iomem *regs = mstk48t08_regs; +struct platform_device *pdev =to_platform_device (dev); +struct m48t59_plat_data *pdata = pdev->dev.platform_data; + +if (ofs = pdata->offset +M48T59_YEAR ) { +if (val <0x68 ) + val +=0x32 ; +else + val -=0x68 ; +if ((val &0xf ) >9 ) + val +=6 ; +if ((val &0xf0 ) >0x9A ) + val +=0x60 ; + } +mostek_write (regs + ofs, val); +} + +static struct m48t59_plat_data m48t59_data = { + .read_byte = mostek_read_byte, + .write_byte = mostek_write_byte, +}; + +/* resource is set at runtime */ +static struct resource mostek_resource; + +static struct platform_device m48t59_rtc = { + .name ="rtc-m48t59" , + .id =0 , + .num_resources =1 , + .resource = &mostek_resource, + .dev = { + .platform_data = &m48t59_data, + }, +}; +/* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ static void __init kick_start_clock (void ) {
@@ -510,37 +565,6 @@ static int __init has_low_battery(void)return (data1 = data2);/* Was the write blocked? */ } -static void __init mostek_set_system_time (void __iomem *mregs) -{ -unsigned int year, mon, day, hour, min, sec; -u8 tmp; - -spin_lock_irq (&mostek_lock); - -/* Traditional Mostek chip. */ - tmp =mostek_read (mregs +MOSTEK_CREG ); - tmp |=MSTK_CREG_READ ; -mostek_write (mregs +MOSTEK_CREG , tmp); - - sec =MSTK_REG_SEC (mregs); - min =MSTK_REG_MIN (mregs); - hour =MSTK_REG_HOUR (mregs); - day =MSTK_REG_DOM (mregs); - mon =MSTK_REG_MONTH (mregs); - year =MSTK_CVT_YEAR (MSTK_REG_YEAR (mregs) ); - - xtime.tv_sec =mktime (year, mon, day, hour, min, sec); - xtime.tv_nsec = (INITIAL_JIFFIES %HZ ) * (NSEC_PER_SEC /HZ ); -set_normalized_timespec (&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec); - - tmp =mostek_read (mregs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_READ ; -mostek_write (mregs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); -} -/* Probe for the real time clock chip. */ static void __init set_system_time (void ) {
@@ -560,7 +584,6 @@ static void __init set_system_time(void) }if (mregs) { -mostek_set_system_time (mregs);return ; }
@@ -735,14 +758,23 @@ static int __devinit clock_probe(struct bq4802_regs = regs; } else#endif -if (model[5 ] ='0' && model[6 ] ='2' ) { - mstk48t02_regs = regs; - }else if (model[5 ] ='0' && model[6 ] ='8' ) { - mstk48t08_regs = regs; - mstk48t02_regs = mstk48t08_regs +MOSTEK_48T08_48T02 ; - }else { - mstk48t59_regs = regs; - mstk48t02_regs = mstk48t59_regs +MOSTEK_48T59_48T02 ; + { + m48t59_rtc.resource[0 ] = op->resource[0 ]; +if (model[5 ] ='0' && model[6 ] ='2' ) { + mstk48t02_regs = regs; + mstk48t08_regs = regs; + m48t59_data.type =M48T59RTC_TYPE_M48T02 ; + }else if (model[5 ] ='0' && model[6 ] ='8' ) { + mstk48t08_regs = regs; + mstk48t02_regs = mstk48t08_regs +MOSTEK_48T08_48T02 ; + m48t59_data.type =M48T59RTC_TYPE_M48T08 ; + }else { + mstk48t08_regs = regs; + mstk48t02_regs = mstk48t59_regs +MOSTEK_48T59_48T02 ; + m48t59_data.type =M48T59RTC_TYPE_M48T59 ; + } +if (platform_device_register (&m48t59_rtc) <0 ) +printk (KERN_ERR "Registering RTC device failed\n" ); }printk (KERN_INFO "%s: Clock regs at %p\n" , dp->full_name, regs);
@@ -1480,74 +1512,6 @@ static int cmos_set_rtc_time(struct rtc_ }#endif /* CONFIG_PCI */ -static void mostek_get_rtc_time (struct rtc_time *rtc_tm) -{ -void __iomem *regs = mstk48t02_regs; -u8 tmp; - -spin_lock_irq (&mostek_lock); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp |=MSTK_CREG_READ ; -mostek_write (regs +MOSTEK_CREG , tmp); - - rtc_tm->tm_sec =MSTK_REG_SEC (regs); - rtc_tm->tm_min =MSTK_REG_MIN (regs); - rtc_tm->tm_hour =MSTK_REG_HOUR (regs); - rtc_tm->tm_mday =MSTK_REG_DOM (regs); - rtc_tm->tm_mon =MSTK_REG_MONTH (regs); - rtc_tm->tm_year =MSTK_CVT_YEAR (MSTK_REG_YEAR (regs) ); - rtc_tm->tm_wday =MSTK_REG_DOW (regs); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_READ ; -mostek_write (regs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); - - rtc_tm->tm_mon--; - rtc_tm->tm_wday--; - rtc_tm->tm_year -=1900 ; -} - -static int mostek_set_rtc_time (struct rtc_time *rtc_tm) -{ -unsigned char mon, day, hrs, min, sec, wday; -void __iomem *regs = mstk48t02_regs; -unsigned int yrs; -u8 tmp; - - yrs = rtc_tm->tm_year +1900 ; - mon = rtc_tm->tm_mon +1 ; - day = rtc_tm->tm_mday; - wday = rtc_tm->tm_wday +1 ; - hrs = rtc_tm->tm_hour; - min = rtc_tm->tm_min; - sec = rtc_tm->tm_sec; - -spin_lock_irq (&mostek_lock); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp |=MSTK_CREG_WRITE ; -mostek_write (regs +MOSTEK_CREG , tmp); - -MSTK_SET_REG_SEC (regs, sec); -MSTK_SET_REG_MIN (regs, min); -MSTK_SET_REG_HOUR (regs, hrs); -MSTK_SET_REG_DOW (regs, wday); -MSTK_SET_REG_DOM (regs, day); -MSTK_SET_REG_MONTH (regs, mon); -MSTK_SET_REG_YEAR (regs, yrs -MSTK_YEAR_ZERO ); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_WRITE ; -mostek_write (regs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); - -return 0 ; -} -struct mini_rtc_ops {void (*get_rtc_time)(struct rtc_time *);int (*set_rtc_time)(struct rtc_time *);
@@ -1575,11 +1539,6 @@ static struct mini_rtc_ops cmos_rtc_ops };#endif /* CONFIG_PCI */ -static struct mini_rtc_ops mostek_rtc_ops = { - .get_rtc_time = mostek_get_rtc_time, - .set_rtc_time = mostek_set_rtc_time, -}; -static struct mini_rtc_ops *mini_rtc_ops;static inline void mini_get_rtc_time (struct rtc_time *time)
@@ -1713,7 +1672,7 @@ static int __init rtc_mini_init(void) mini_rtc_ops = &cmos_rtc_ops;#endif /* CONFIG_PCI */ else if (mstk48t02_regs) - mini_rtc_ops = &mostek_rtc_ops; + return -ENODEV; else return -ENODEV;
----------------------------------------------------------------------
Quoted 2 lines
Quoted 2 lines
Sprawdz, czy do siebie pasujecie!
http://link.interia.pl/f1eea
RFC 1/1 use rtc mostek drivers instead of minirtc
In reply to David MillerHi,
I tried to use a rtc layer for sparc arch.
The patch below removes rtc functions for the Mostek rtcs from the sparc specific files. The rtc is declared as platform device and use a driver from the rtc layer.
The detection and kick start are left untouched. If there are other things which can be fixed or improved please let me know. There are two quirks in the patch:
1. The year is stored since 1968 on sparc so the read/write function must convert this register value (this is ugly).
2. The minirtc driver returns ENODEV for mostek chips (so no two want to access the chip).
I tested it on my U60 and the rtc works correctly after change. The old /dev/rtc device does not work but the hwclock after the /dev/rtc is linked to a new /dev/rtc0 (device created by the rtc layer).
Before using the patch below, the rtc m48t59 driver need to be updated with two patches from the -mm tree:
rtc-m48t59-reduce-structure-m48t59_private.patch rtc-m48t59-add-support-for-m48t02-and-m48t59-chips-2nd-rev.patch
I would like to convert whole rtc handling to the rtc layer. However, I have no hardware to test (only U60) so I need some help from sparc people.
Regards,
Krzysztof
arch/sparc64/kernel/time.c +73 -114
@@ -30,10 +30,12 @@#include <linux/percpu.h> #include <linux/miscdevice.h> #include <linux/rtc.h> +#include <linux/rtc/m48t59.h> #include <linux/kernel_stat.h> #include <linux/clockchips.h> #include <linux/clocksource.h> #include <linux/of_device.h> +#include <linux/platform_device.h> #include <asm/oplib.h> #include <asm/mostek.h>
@@ -408,6 +410,59 @@ int update_persistent_clock(struct timesreturn set_rtc_mmss (now.tv_sec); } +static unsigned char mostek_read_byte (struct device *dev,u32 ofs) +{ +void __iomem *regs = mstk48t08_regs; +unsigned char val =mostek_read (regs + ofs); +struct platform_device *pdev =to_platform_device (dev); +struct m48t59_plat_data *pdata = pdev->dev.platform_data; + +/* the year 0 is 1968 */ +if (ofs = pdata->offset +M48T59_YEAR ) { + val +=0x68 ; +if ((val &0xf ) >9 ) + val +=6 ; + } +return val; +} + +static void mostek_write_byte (struct device *dev,u32 ofs,u8 val) +{ +void __iomem *regs = mstk48t08_regs; +struct platform_device *pdev =to_platform_device (dev); +struct m48t59_plat_data *pdata = pdev->dev.platform_data; + +if (ofs = pdata->offset +M48T59_YEAR ) { +if (val <0x68 ) + val +=0x32 ; +else + val -=0x68 ; +if ((val &0xf ) >9 ) + val +=6 ; +if ((val &0xf0 ) >0x9A ) + val +=0x60 ; + } +mostek_write (regs + ofs, val); +} + +static struct m48t59_plat_data m48t59_data = { + .read_byte = mostek_read_byte, + .write_byte = mostek_write_byte, +}; + +/* resource is set at runtime */ +static struct resource mostek_resource; + +static struct platform_device m48t59_rtc = { + .name ="rtc-m48t59" , + .id =0 , + .num_resources =1 , + .resource = &mostek_resource, + .dev = { + .platform_data = &m48t59_data, + }, +}; +/* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ static void __init kick_start_clock (void ) {
@@ -510,37 +565,6 @@ static int __init has_low_battery(void)return (data1 = data2);/* Was the write blocked? */ } -static void __init mostek_set_system_time (void __iomem *mregs) -{ -unsigned int year, mon, day, hour, min, sec; -u8 tmp; - -spin_lock_irq (&mostek_lock); - -/* Traditional Mostek chip. */ - tmp =mostek_read (mregs +MOSTEK_CREG ); - tmp |=MSTK_CREG_READ ; -mostek_write (mregs +MOSTEK_CREG , tmp); - - sec =MSTK_REG_SEC (mregs); - min =MSTK_REG_MIN (mregs); - hour =MSTK_REG_HOUR (mregs); - day =MSTK_REG_DOM (mregs); - mon =MSTK_REG_MONTH (mregs); - year =MSTK_CVT_YEAR (MSTK_REG_YEAR (mregs) ); - - xtime.tv_sec =mktime (year, mon, day, hour, min, sec); - xtime.tv_nsec = (INITIAL_JIFFIES %HZ ) * (NSEC_PER_SEC /HZ ); -set_normalized_timespec (&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec); - - tmp =mostek_read (mregs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_READ ; -mostek_write (mregs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); -} -/* Probe for the real time clock chip. */ static void __init set_system_time (void ) {
@@ -560,7 +584,6 @@ static void __init set_system_time(void) }if (mregs) { -mostek_set_system_time (mregs);return ; }
@@ -735,14 +758,23 @@ static int __devinit clock_probe(struct bq4802_regs = regs; } else#endif -if (model[5 ] ='0' && model[6 ] ='2' ) { - mstk48t02_regs = regs; - }else if (model[5 ] ='0' && model[6 ] ='8' ) { - mstk48t08_regs = regs; - mstk48t02_regs = mstk48t08_regs +MOSTEK_48T08_48T02 ; - }else { - mstk48t59_regs = regs; - mstk48t02_regs = mstk48t59_regs +MOSTEK_48T59_48T02 ; + { + m48t59_rtc.resource[0 ] = op->resource[0 ]; +if (model[5 ] ='0' && model[6 ] ='2' ) { + mstk48t02_regs = regs; + mstk48t08_regs = regs; + m48t59_data.type =M48T59RTC_TYPE_M48T02 ; + }else if (model[5 ] ='0' && model[6 ] ='8' ) { + mstk48t08_regs = regs; + mstk48t02_regs = mstk48t08_regs +MOSTEK_48T08_48T02 ; + m48t59_data.type =M48T59RTC_TYPE_M48T08 ; + }else { + mstk48t08_regs = regs; + mstk48t02_regs = mstk48t59_regs +MOSTEK_48T59_48T02 ; + m48t59_data.type =M48T59RTC_TYPE_M48T59 ; + } +if (platform_device_register (&m48t59_rtc) <0 ) +printk (KERN_ERR "Registering RTC device failed\n" ); }printk (KERN_INFO "%s: Clock regs at %p\n" , dp->full_name, regs);
@@ -1480,74 +1512,6 @@ static int cmos_set_rtc_time(struct rtc_ }#endif /* CONFIG_PCI */ -static void mostek_get_rtc_time (struct rtc_time *rtc_tm) -{ -void __iomem *regs = mstk48t02_regs; -u8 tmp; - -spin_lock_irq (&mostek_lock); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp |=MSTK_CREG_READ ; -mostek_write (regs +MOSTEK_CREG , tmp); - - rtc_tm->tm_sec =MSTK_REG_SEC (regs); - rtc_tm->tm_min =MSTK_REG_MIN (regs); - rtc_tm->tm_hour =MSTK_REG_HOUR (regs); - rtc_tm->tm_mday =MSTK_REG_DOM (regs); - rtc_tm->tm_mon =MSTK_REG_MONTH (regs); - rtc_tm->tm_year =MSTK_CVT_YEAR (MSTK_REG_YEAR (regs) ); - rtc_tm->tm_wday =MSTK_REG_DOW (regs); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_READ ; -mostek_write (regs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); - - rtc_tm->tm_mon--; - rtc_tm->tm_wday--; - rtc_tm->tm_year -=1900 ; -} - -static int mostek_set_rtc_time (struct rtc_time *rtc_tm) -{ -unsigned char mon, day, hrs, min, sec, wday; -void __iomem *regs = mstk48t02_regs; -unsigned int yrs; -u8 tmp; - - yrs = rtc_tm->tm_year +1900 ; - mon = rtc_tm->tm_mon +1 ; - day = rtc_tm->tm_mday; - wday = rtc_tm->tm_wday +1 ; - hrs = rtc_tm->tm_hour; - min = rtc_tm->tm_min; - sec = rtc_tm->tm_sec; - -spin_lock_irq (&mostek_lock); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp |=MSTK_CREG_WRITE ; -mostek_write (regs +MOSTEK_CREG , tmp); - -MSTK_SET_REG_SEC (regs, sec); -MSTK_SET_REG_MIN (regs, min); -MSTK_SET_REG_HOUR (regs, hrs); -MSTK_SET_REG_DOW (regs, wday); -MSTK_SET_REG_DOM (regs, day); -MSTK_SET_REG_MONTH (regs, mon); -MSTK_SET_REG_YEAR (regs, yrs -MSTK_YEAR_ZERO ); - - tmp =mostek_read (regs +MOSTEK_CREG ); - tmp &= ~MSTK_CREG_WRITE ; -mostek_write (regs +MOSTEK_CREG , tmp); - -spin_unlock_irq (&mostek_lock); - -return 0 ; -} -struct mini_rtc_ops {void (*get_rtc_time)(struct rtc_time *);int (*set_rtc_time)(struct rtc_time *);
@@ -1575,11 +1539,6 @@ static struct mini_rtc_ops cmos_rtc_ops };#endif /* CONFIG_PCI */ -static struct mini_rtc_ops mostek_rtc_ops = { - .get_rtc_time = mostek_get_rtc_time, - .set_rtc_time = mostek_set_rtc_time, -}; -static struct mini_rtc_ops *mini_rtc_ops;static inline void mini_get_rtc_time (struct rtc_time *time)
@@ -1713,7 +1672,7 @@ static int __init rtc_mini_init(void) mini_rtc_ops = &cmos_rtc_ops;#endif /* CONFIG_PCI */ else if (mstk48t02_regs) - mini_rtc_ops = &mostek_rtc_ops; + return -ENODEV; else return -ENODEV;
From: Krzysztof Helt <[email protected]>
Date: Sun, 24 Aug 2008 08:44:34 +0200
Quoted 5 lines
Before using the patch below, the rtc m48t59 driver need to be updated with two patches from the -mm tree:
rtc-m48t59-reduce-structure-m48t59_private.patch rtc-m48t59-add-support-for-m48t02-and-m48t59-chips-2nd-rev.patch
Actually these patches aren't needed, the first just removes an unused structure member and the second adds support for chips that sparc64 systems don't even have :)
All Sparc64 systems have m48t59 chips, only older 32-bit sparcs have m48t02 and m48t08. BTW there is a typo in the changelog for that second patch:
Add support for two compatible RTC:
- M48T08 which does not have alarm part,
- M48T08 which does not have alarm part and has only 2KB of NVRAM
At least one of those lines should say M48T02 :-)
Anyways, this means this code on the sparc64 side can be simplified even further.
The following revised version of your patch should work. In particular we don't need a fixed static resource, we can just point the platform device at the of_device resource object. We also don't need the silly mostek reg pointers, we can deduce this from the resource the platform_device object has.
Actually, this mostek register access inteface is incomplete, the mostek rtc driver ioremap()'s the resource for MEM resources but doesn't provide the __iomem pointer to the register accessors because the mostek driver private structure type is not available in the header file, it's private to the RTC driver source.
But anyways, ioremap() does nothing but cast pointers on sparc64 so this happens to work :-)
arch/sparc64/kernel/sparc64_ksyms.c +0 -3
@@ -36,7 +36,6 @@#include <asm/elf.h> #include <asm/head.h> #include <asm/smp.h> -#include <asm/mostek.h> #include <asm/ptrace.h> #include <asm/uaccess.h> #include <asm/checksum.h>
@@ -153,8 +152,6 @@ EXPORT_SYMBOL(flush_dcache_page);EXPORT_SYMBOL (__flush_dcache_range);#endif -EXPORT_SYMBOL (mostek_lock); -EXPORT_SYMBOL (mstk48t02_regs);#ifdef CONFIG_SUN_AUXIO EXPORT_SYMBOL (auxio_set_led);EXPORT_SYMBOL (auxio_set_lte);
arch/sparc64/kernel/time.c +91 -307
532 lines not on this page · raw message
Quoted 6 lines
From: Krzysztof Helt <[email protected]>
Date: Sun, 24 Aug 2008 08:44:34 +0200Quoted 3 lines
Before using the patch below, the rtc m48t59 driver need to be updated with two patches from the -mm tree:
Quoted 7 lines
Quoted 2 lines
rtc-m48t59-reduce-structure-m48t59_private.patch rtc-m48t59-add-support-for-m48t02-and-m48t59-chips-2nd-rev.patch
Actually these patches aren't needed, the first just removes an unused structure member and the second adds support for chips that sparc64 systems don't even have :)
I didn't know what rtc chips are available on sparc64 so I did patches to support all types handled in the previous code.
Quoted 11 lines
All Sparc64 systems have m48t59 chips, only older 32-bit sparcs have m48t02 and m48t08. BTW there is a typo in the changelog for that second patch:
Add support for two compatible RTC:
- M48T08 which does not have alarm part,
- M48T08 which does not have alarm part and has only 2KB of NVRAMAt least one of those lines should say M48T02 :-)
Right. The one with 2KB of NVRAM is M48T02.
Quoted 3 lines
Anyways, this means this code on the sparc64 side can be simplified even further.
I suspected that after conversion to platform drivers the sparc code can be simplified further.
Quoted 6 lines
The following revised version of your patch should work. In particular we don't need a fixed static resource, we can just point the platform device at the
of_deviceresource object. We also don't need the silly mostek reg pointers, we can deduce this from the resource theplatform_deviceobject has.
I'll test it on Monday (I am leaving for the weekend).
Quoted 6 lines
Actually, this mostek register access inteface is incomplete, the mostek rtc driver ioremap()'s the resource for MEM resources but doesn't provide the
__iomempointer to the register accessors because the mostek driver private structure type is not available in the header file, it's private to the RTC driver source.
It is available in readb/writeb functions:
struct platform_device *pdev = to_platform_device(dev); struct m48t59_private *m48t59 = platform_get_drvdata(pdev); void __iomem *regs = m48t59->ioaddr;
The patch can use the private ioaddr instead of just casting resource.start if it is a better solution.
Quoted 3 lines
But anyways,
ioremap()does nothing but cast pointers on sparc64 so this happens to work :-)
Ok.
Thank you for your review and tips.
Regards,
Krzysztof
---------------------------------------------------------------
Nasilaja sie kradzieze.
Mieszkancy osiedli zaniepokojeni.
Prosimy o pomoc w tej sprawie >>> http://link.interia.pl/f1eef
From: [email protected]
Date: 29 Aug 2008 07:52:14 +0200
Quoted 1 line
Thank you for your review and tips.
Krzysztof, I just got done converting all of the drivers and deleting the mini RTC code.
It is tested on SunBlade1000 and SunBlade2500 workstations.
I'm about to post the patches, and I'll test other system types shortly afterwards.