rtc: m48t86: remove need for platform_data
Subsystems (7)
H Hartley Sweeten
maintainercover rtc: m48t86: remove need for platform_data
The rtc-m48t86 driver can now manage it's own resources for the index and data registers.
1) Add the RTC detection logic from the ts78xx platform to the driver and remove it from the platform code.
2) Update the two platforms that use this driver to remove the need for the platform_data.
3) Remove the, then unused, platform_data header and it's use in the driver.
H Hartley Sweeten (5):
rtc: m48t86: verify that the RTC is actually present
ARM: Orion5x: ts78xx: remove RTC detection
ARM: Orion5x: ts78xx: allow rtc-m48t86 to manage it's own resources
ARM: ep93xx: ts72xx: allow rtc-m48t86 to manage it's own resources
rtc: m48t86: remove unused platform_data
arch/arm/mach-ep93xx/ts72xx.c | 40 ++++----------- arch/arm/mach-ep93xx/ts72xx.h | 11 ---- arch/arm/mach-orion5x/ts78xx-setup.c | 80 +++++++---------------------- drivers/rtc/rtc-m48t86.c | 87 ++++++++++++++++++++------------ include/linux/platform_data/rtc-m48t86.h | 16 ------ 5 files changed, 84 insertions(+), 150 deletions(-) delete mode 100644 include/linux/platform_data/rtc-m48t86.h
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
H Hartley Sweeten
maintainerPATCH 1/5 rtc: m48t86: verify that the RTC is actually present
The RTC is an optional feature at purchase time on some Technologic Systems boards. Verify that it actually exists by checking if the last two bytes of the NVRAM can be changed.
--- drivers/rtc/rtc-m48t86.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/rtc/rtc-m48t86.c +36 -0
@@ -201,6 +201,37 @@ static ssize_t m48t86_nvram_write(struct file *filp, struct kobject *kobj, static BIN_ATTR(nvram, 0644, m48t86_nvram_read, m48t86_nvram_write, M48T86_NVRAM_LEN); +/* +* The RTC is an optional feature at purchase time on some Technologic Systems +* boards. Verify that it actually exists by checking if the last two bytes +* of the NVRAM can be changed. +* +* This is based on the method used in their rtc7800.c example. +*/ +static bool m48t86_verify_chip (struct platform_device *pdev) +{ +unsigned int offset0 =M48T86_NVRAM_LEN -2 ; +unsigned int offset1 =M48T86_NVRAM_LEN -1 ; +unsigned char tmp0, tmp1; + + tmp0 =m48t86_readb (&pdev->dev, offset0); + tmp1 =m48t86_readb (&pdev->dev, offset1); + +m48t86_writeb (&pdev->dev,0x00 , offset0); +m48t86_writeb (&pdev->dev,0x55 , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0x55 ) { +m48t86_writeb (&pdev->dev,0xaa , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0xaa && +m48t86_readb (&pdev->dev, offset0) ==0x00 ) { +m48t86_writeb (&pdev->dev, tmp0, offset0); +m48t86_writeb (&pdev->dev, tmp1, offset1); + +return true; + } + } +return false; +} +static int m48t86_rtc_probe (struct platform_device *pdev) {struct m48t86_rtc_info *info;
@@ -231,6 +262,11 @@ static int m48t86_rtc_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, info); +if (!m48t86_verify_chip (pdev)) { +dev_info (&pdev->dev,"RTC not present\n" ); +return -ENODEV ; + } + info->rtc =devm_rtc_device_register (&pdev->dev,"m48t86" , &m48t86_rtc_ops,THIS_MODULE );if (IS_ERR (info->rtc))
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
[rtc-linux] Re: [PATCH 1/5] rtc: m48t86: verify that the RTC is actually present
Hi,
Quoted 4 lines · H Hartley Sweeten
The RTC is an optional feature at purchase time on some Technologic Systems boards. Verify that it actually exists by checking if the last two bytes of the NVRAM can be changed.
Quoted 8 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Alessandro Zummo <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Alexander Clouter <[email protected]>--- drivers/rtc/rtc-m48t86.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
I've applied that one. Alex, if you are fine with the mach-orion5x changes, I can take them for 4.11. Else, this will wait for 4.12.
Quoted 57 lines
drivers/rtc/rtc-m48t86.c +36
-0@@ -201,6 +201,37 @@ static ssize_t m48t86_nvram_write(struct file *filp, struct kobject *kobj, static BIN_ATTR(nvram, 0644, m48t86_nvram_read, m48t86_nvram_write, M48T86_NVRAM_LEN); +/* +* The RTC is an optional feature at purchase time on some Technologic Systems +* boards. Verify that it actually exists by checking if the last two bytes +* of the NVRAM can be changed. +* +* This is based on the method used in their rtc7800.c example. +*/ +static bool m48t86_verify_chip (struct platform_device *pdev) +{ +unsigned int offset0 =M48T86_NVRAM_LEN -2 ; +unsigned int offset1 =M48T86_NVRAM_LEN -1 ; +unsigned char tmp0, tmp1; + + tmp0 =m48t86_readb (&pdev->dev, offset0); + tmp1 =m48t86_readb (&pdev->dev, offset1); + +m48t86_writeb (&pdev->dev,0x00 , offset0); +m48t86_writeb (&pdev->dev,0x55 , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0x55 ) { +m48t86_writeb (&pdev->dev,0xaa , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0xaa && +m48t86_readb (&pdev->dev, offset0) ==0x00 ) { +m48t86_writeb (&pdev->dev, tmp0, offset0); +m48t86_writeb (&pdev->dev, tmp1, offset1); + +return true; + } + } +return false; +} +static int m48t86_rtc_probe (struct platform_device *pdev) {struct m48t86_rtc_info *info;@@ -231,6 +262,11 @@ static int m48t86_rtc_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, info); +if (!m48t86_verify_chip (pdev)) { +dev_info (&pdev->dev,"RTC not present\n" ); +return -ENODEV ; + } + info->rtc =devm_rtc_device_register (&pdev->dev,"m48t86" , &m48t86_rtc_ops,THIS_MODULE );if (IS_ERR (info->rtc))Signature · 1 line
2.10.0
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
[rtc-linux] RE: [PATCH 1/5] rtc: m48t86: verify that the RTC is actually present
Quoted 14 lines · Alexandre Belloni
Quoted 4 lines · H Hartley Sweeten
The RTC is an optional feature at purchase time on some Technologic Systems boards. Verify that it actually exists by checking if the last two bytes of the NVRAM can be changed.
Quoted 8 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Alessandro Zummo <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Alexander Clouter <[email protected]>--- drivers/rtc/rtc-m48t86.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
Quoted 2 lines
I've applied that one. Alex, if you are fine with the mach-orion5x changes, I can take them for 4.11. Else, this will wait for 4.12.
Hello,
Thanks. The change to mach-ep93xx is ok if you want to take that one.
I did just notice a minor issue with this one. It will still work as-is but It's not technically doing what was done in mach-orion52. See below...
Quoted 8 lines
Quoted 8 lines
drivers/rtc/rtc-m48t86.c +0
-0@@ -201,6 +201,37 @@ static ssize_t m48t86_nvram_write(struct file *filp, struct kobject *kobj, static BIN_ATTR(nvram, 0644, m48t86_nvram_read, m48t86_nvram_write, M48T86_NVRAM_LEN);
Quoted 11 lines
drivers/rtc/rtc-m48t86.c static ssize_t m48t86_nvram_write(struct file *filp, struct kobject *kobj, · line 214
Quoted 11 lines
drivers/rtc/rtc-m48t86.c +11
-0+/* +* The RTC is an optional feature at purchase time on some Technologic Systems +* boards. Verify that it actually exists by checking if the last two bytes +* of the NVRAM can be changed. +* +* This is based on the method used in their rtc7800.c example. +*/ +static bool m48t86_verify_chip (struct platform_device *pdev) +{ +unsigned int offset0 =M48T86_NVRAM_LEN -2 ; +unsigned int offset1 =M48T86_NVRAM_LEN -1 ;
In order to address the last two bytes, these two offsets should actually be:
+ unsigned int offset0 = M48T86_NVRAM(M48T86_NVRAM_LEN - 2);
+ unsigned int offset1 = M48T86_NVRAM(M48T86_NVRAM_LEN - 1);
As they are right now, they are both off by 14 bytes (0x0e).
I can send a patch to fix it or you can do it if you prefer.
Sorry about that.
Hartley
Signature · 8 lines
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
[rtc-linux] Re: [PATCH 1/5] rtc: m48t86: verify that the RTC is actually present
Quoted 15 lines · Hartley Sweeten
Quoted 14 lines · Alexandre Belloni
Quoted 12 lines · H Hartley Sweeten
The RTC is an optional feature at purchase time on some Technologic Systems boards. Verify that it actually exists by checking if the last two bytes of the NVRAM can be changed.
Signed-off-by H Hartley Sweeten <[email protected]>Cc Alessandro Zummo <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Alexander Clouter <[email protected]>--- drivers/rtc/rtc-m48t86.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
Quoted 7 lines
Quoted 2 lines
I've applied that one. Alex, if you are fine with the mach-orion5x changes, I can take them for 4.11. Else, this will wait for 4.12.
Hello,
Thanks. The change to mach-ep93xx is ok if you want to take that one.
Ok, I took it.
Quoted 9 lines
In order to address the last two bytes, these two offsets should actually be:
(quoted diff) +2
-0+ unsigned int offset0 = M48T86_NVRAM(M48T86_NVRAM_LEN - 2); + unsigned int offset1 = M48T86_NVRAM(M48T86_NVRAM_LEN - 1);As they are right now, they are both off by 14 bytes (
0x0e).I can send a patch to fix it or you can do it if you prefer.
I fixed it up directly in rtc-next
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
[rtc-linux] Re: [PATCH 1/5] rtc: m48t86: verify that the RTC is actually present
In reply to Alexandre BelloniThanks, not tested though, as I am lacking in time at the moment. I probably am the only ts7800 user in the world using a mainline kernel too...so will only be punishing myself :-)
Quoted 82 lines · On 21 February 2017 4:37:35 p.m. Alexandre Belloni…
Hi,
Quoted 4 lines · H Hartley Sweeten
The RTC is an optional feature at purchase time on some Technologic Systems boards. Verify that it actually exists by checking if the last two bytes of the NVRAM can be changed.
Quoted 8 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Alessandro Zummo <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Alexander Clouter <[email protected]>--- drivers/rtc/rtc-m48t86.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)I've applied that one. Alex, if you are fine with the mach-orion5x changes, I can take them for 4.11. Else, this will wait for 4.12.
Quoted 56 lines
drivers/rtc/rtc-m48t86.c +31
-0@@ -201,6 +201,37 @@ static ssize_t m48t86_nvram_write(struct file *filp,struct kobject *kobj, static BIN_ATTR(nvram, 0644, m48t86_nvram_read, m48t86_nvram_write,M48T86_NVRAM_LEN ); +/* +* The RTC is an optional feature at purchase time on some Technologic Systems +* boards. Verify that it actually exists by checking if the last two bytes +* of the NVRAM can be changed. +* +* This is based on the method used in their rtc7800.c example. +*/ +static bool m48t86_verify_chip (struct platform_device *pdev) +{ +unsigned int offset0 =M48T86_NVRAM_LEN -2 ; +unsigned int offset1 =M48T86_NVRAM_LEN -1 ; +unsigned char tmp0, tmp1; + + tmp0 =m48t86_readb (&pdev->dev, offset0); + tmp1 =m48t86_readb (&pdev->dev, offset1); + +m48t86_writeb (&pdev->dev,0x00 , offset0); +m48t86_writeb (&pdev->dev,0x55 , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0x55 ) { +m48t86_writeb (&pdev->dev,0xaa , offset1); +if (m48t86_readb (&pdev->dev, offset1) ==0xaa && +m48t86_readb (&pdev->dev, offset0) ==0x00 ) { +m48t86_writeb (&pdev->dev, tmp0, offset0); +m48t86_writeb (&pdev->dev, tmp1, offset1); + +return true; + } + } +return false; +} +static int m48t86_rtc_probe (struct platform_device *pdev) {drivers/rtc/rtc-m48t86.c +5
-1struct m48t86_rtc_info *info;@@ -231,6 +262,11 @@ static int m48t86_rtc_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, info); +if (!m48t86_verify_chip (pdev)) { +dev_info (&pdev->dev,"RTC not present\n" ); +return -ENODEV ; + } + info->rtc =devm_rtc_device_register (&pdev->dev,"m48t86" , &m48t86_rtc_ops,THIS_MODULE );if (IS_ERR (info->rtc)) --Quoted 2 lines
2.10.0
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 7 lines
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
[rtc-linux] Re: [PATCH 1/5] rtc: m48t86: verify that the RTC is actually present
Quoted 6 lines · Alexander Clouter
Thanks, not tested though, as I am lacking in time at the moment. I probably am the only ts7800 user in the world using a mainline kernel too...so will only be punishing myself :-)
Ok, then I've applied the whole series. I'll send that to Linus by the end of the week.
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
H Hartley Sweeten
maintainerPATCH 2/5 ARM: Orion5x: ts78xx: remove RTC detection
In reply to H Hartley SweetenThe rtc-m48t86 driver now handles the RTC detection. Remove the redundant code from the platform.
--- arch/arm/mach-orion5x/ts78xx-setup.c | 51 +++++++++--------------------------- 1 file changed, 12 insertions(+), 39 deletions(-)
arch/arm/mach-orion5x/ts78xx-setup.c +12 -39
@@ -109,50 +109,23 @@ static struct platform_device ts78xx_ts_rtc_device = { .num_resources = 0, }; -/* -* TS uses some of the user storage space on the RTC chip so see if it is -* present; as it's an optional feature at purchase time and not all boards -* will have it present -* -* I've used the method TS use in their rtc7800.c example for the detection -* -* TODO: track down a guinea pig without an RTC to see if we can work out a -* better RTC detection routine -*/ static int ts78xx_ts_rtc_load (void ) {int rc; -unsigned char tmp_rtc0, tmp_rtc1; - - tmp_rtc0 =ts78xx_ts_rtc_readbyte (126 ); - tmp_rtc1 =ts78xx_ts_rtc_readbyte (127 ); - -ts78xx_ts_rtc_writebyte (0x00 ,126 ); -ts78xx_ts_rtc_writebyte (0x55 ,127 ); -if (ts78xx_ts_rtc_readbyte (127 ) ==0x55 ) { -ts78xx_ts_rtc_writebyte (0xaa ,127 ); -if (ts78xx_ts_rtc_readbyte (127 ) ==0xaa - &&ts78xx_ts_rtc_readbyte (126 ) ==0x00 ) { -ts78xx_ts_rtc_writebyte (tmp_rtc0,126 ); -ts78xx_ts_rtc_writebyte (tmp_rtc1,127 ); - -if (ts78xx_fpga.supports.ts_rtc.init ==0 ) { - rc =platform_device_register (&ts78xx_ts_rtc_device); -if (!rc) - ts78xx_fpga.supports.ts_rtc.init =1 ; - }else - rc =platform_device_add (&ts78xx_ts_rtc_device); - -if (rc) -pr_info ("RTC could not be registered: %d\n" , - rc); -return rc; - } + +if (ts78xx_fpga.supports.ts_rtc.init ==0 ) { + rc =platform_device_register (&ts78xx_ts_rtc_device); +if (!rc) + ts78xx_fpga.supports.ts_rtc.init =1 ; + }else { + rc =platform_device_add (&ts78xx_ts_rtc_device); } -pr_info ("RTC not found\n" ); -return -ENODEV ; -}; +if (rc) +pr_info ("RTC could not be registered: %d\n" , rc); + +return rc; +}static void ts78xx_ts_rtc_unload (void ) {
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
H Hartley Sweeten
maintainerPATCH 3/5 ARM: Orion5x: ts78xx: allow rtc-m48t86 to manage it's own resources
In reply to H Hartley SweetenThe rtc-m48t86 driver can now handle it's own resources and do the read/write operations internally.
Pass the necessary resources to the driver and remove the m48t86_ops platform data.
--- arch/arm/mach-orion5x/ts78xx-setup.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-)
arch/arm/mach-orion5x/ts78xx-setup.c +7 -22
@@ -16,7 +16,6 @@#include <linux/platform_device.h> #include <linux/mv643xx_eth.h> #include <linux/ata_platform.h> -#include <linux/platform_data/rtc-m48t86.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> #include <linux/timeriomem-rng.h>
@@ -80,33 +79,19 @@ static struct mv_sata_platform_data ts78xx_sata_data = {/***************************************************************************** * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c ****************************************************************************/ -#define TS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE + 0x808) -#define TS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE + 0x80c) +#define TS_RTC_CTRL (TS78XX_FPGA_REGS_PHYS_BASE + 0x808) +#define TS_RTC_DATA (TS78XX_FPGA_REGS_PHYS_BASE + 0x80c) -static unsigned char ts78xx_ts_rtc_readbyte (unsigned long addr) -{ -writeb (addr,TS_RTC_CTRL ); -return readb (TS_RTC_DATA ); -} - -static void ts78xx_ts_rtc_writebyte (unsigned char value,unsigned long addr) -{ -writeb (addr,TS_RTC_CTRL ); -writeb (value,TS_RTC_DATA ); -} - -static struct m48t86_ops ts78xx_ts_rtc_ops = { - .readbyte = ts78xx_ts_rtc_readbyte, - .writebyte = ts78xx_ts_rtc_writebyte, +static struct resource ts78xx_ts_rtc_resources[] = { +DEFINE_RES_MEM (TS_RTC_CTRL ,0x01 ), +DEFINE_RES_MEM (TS_RTC_DATA ,0x01 ), };static struct platform_device ts78xx_ts_rtc_device = { .name ="rtc-m48t86" , .id =-1 , - .dev = { - .platform_data = &ts78xx_ts_rtc_ops, - }, - .num_resources =0 , + .resource = ts78xx_ts_rtc_resources, + .num_resources =ARRAY_SIZE (ts78xx_ts_rtc_resources), };static int ts78xx_ts_rtc_load (void )
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
H Hartley Sweeten
maintainerPATCH 4/5 ARM: ep93xx: ts72xx: allow rtc-m48t86 to manage it's own resources
In reply to H Hartley SweetenThe rtc-m48t86 driver can now handle it's own resources and do the read/write operations internally.
Pass the necessary resources to the driver and remove the m48t86_ops platform data.
Remove the, then unnecessary, static remapping for the registers.
--- arch/arm/mach-ep93xx/ts72xx.c | 40 ++++++++++------------------------------ arch/arm/mach-ep93xx/ts72xx.h | 11 ----------- 2 files changed, 10 insertions(+), 41 deletions(-)
arch/arm/mach-ep93xx/ts72xx.c +10 -30
@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/io.h> -#include <linux/platform_data/rtc-m48t86.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h>
@@ -45,16 +44,6 @@ static struct map_desc ts72xx_io_desc[] __initdata = { .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), .length = TS72XX_OPTIONS2_SIZE, .type = MT_DEVICE, - }, { - .virtual = (unsigned long)TS72XX_RTC_INDEX_VIRT_BASE, - .pfn = __phys_to_pfn(TS72XX_RTC_INDEX_PHYS_BASE), - .length = TS72XX_RTC_INDEX_SIZE, - .type = MT_DEVICE, - }, { - .virtual = (unsigned long)TS72XX_RTC_DATA_VIRT_BASE, - .pfn = __phys_to_pfn(TS72XX_RTC_DATA_PHYS_BASE), - .length = TS72XX_RTC_DATA_SIZE, - .type = MT_DEVICE, } };
@@ -179,31 +168,22 @@ static void __init ts72xx_register_flash(void) } } +/************************************************************************* +* RTC M48T86 +*************************************************************************/ +#define TS72XX_RTC_INDEX_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x00800000) +#define TS72XX_RTC_DATA_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x01700000) -static unsigned char ts72xx_rtc_readbyte (unsigned long addr) -{ -__raw_writeb (addr,TS72XX_RTC_INDEX_VIRT_BASE ); -return __raw_readb (TS72XX_RTC_DATA_VIRT_BASE ); -} - -static void ts72xx_rtc_writebyte (unsigned char value,unsigned long addr) -{ -__raw_writeb (addr,TS72XX_RTC_INDEX_VIRT_BASE ); -__raw_writeb (value,TS72XX_RTC_DATA_VIRT_BASE ); -} - -static struct m48t86_ops ts72xx_rtc_ops = { - .readbyte = ts72xx_rtc_readbyte, - .writebyte = ts72xx_rtc_writebyte, +static struct resource ts72xx_rtc_resources[] = { +DEFINE_RES_MEM (TS72XX_RTC_INDEX_PHYS_BASE ,0x01 ), +DEFINE_RES_MEM (TS72XX_RTC_DATA_PHYS_BASE ,0x01 ), };static struct platform_device ts72xx_rtc_device = { .name ="rtc-m48t86" , .id =-1 , - .dev = { - .platform_data = &ts72xx_rtc_ops, - }, - .num_resources =0 , + .resource = ts72xx_rtc_resources, + .num_resources =ARRAY_SIZE (ts72xx_rtc_resources), };static struct resource ts72xx_wdt_resources[] = {
arch/arm/mach-ep93xx/ts72xx.h +0 -11
@@ -9,8 +9,6 @@* febff000 22000000 4K model number register (bits 0-2) * febfe000 22400000 4K options register * febfd000 22800000 4K options register #2 -* febf9000 10800000 4K TS-5620 RTC index register -* febf8000 11700000 4K TS-5620 RTC data register */ #define TS72XX_MODEL_PHYS_BASE 0x22000000
@@ -40,15 +38,6 @@#define TS72XX_OPTIONS2_TS9420 0x04#define TS72XX_OPTIONS2_TS9420_BOOT 0x02 - -#define TS72XX_RTC_INDEX_VIRT_BASE IOMEM(0xfebf9000) -#define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000 -#define TS72XX_RTC_INDEX_SIZE 0x00001000 - -#define TS72XX_RTC_DATA_VIRT_BASE IOMEM(0xfebf8000) -#define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 -#define TS72XX_RTC_DATA_SIZE 0x00001000 -#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
H Hartley Sweeten
maintainerPATCH 5/5 rtc: m48t86: remove unused platform_data
In reply to H Hartley SweetenAll users of this driver have been updated to allow the driver to manage it's own resources and do the read/write operations internally. The m48t86_ops are no longer used.
Remove the platform_data header and the support code in the driver.
--- drivers/rtc/rtc-m48t86.c | 51 ++++++++++++-------------------- include/linux/platform_data/rtc-m48t86.h | 16 ---------- 2 files changed, 19 insertions(+), 48 deletions(-) delete mode 100644 include/linux/platform_data/rtc-m48t86.h
drivers/rtc/rtc-m48t86.c +19 -32
@@ -16,7 +16,6 @@#include <linux/module.h> #include <linux/rtc.h> #include <linux/platform_device.h> -#include <linux/platform_data/rtc-m48t86.h> #include <linux/bcd.h> #include <linux/io.h>
@@ -45,7 +44,6 @@ struct m48t86_rtc_info {void __iomem *index_reg;void __iomem *data_reg;struct rtc_device *rtc; -struct m48t86_ops *ops; };static unsigned char m48t86_readb (struct device *dev,unsigned long addr)
@@ -53,12 +51,9 @@ static unsigned char m48t86_readb(struct device *dev, unsigned long addr)struct m48t86_rtc_info *info =dev_get_drvdata (dev);unsigned char value; -if (info->ops) { - value = info->ops->readbyte (addr); - }else { -writeb (addr, info->index_reg); - value =readb (info->data_reg); - } +writeb (addr, info->index_reg); + value =readb (info->data_reg); +return value; }
@@ -67,12 +62,8 @@ static void m48t86_writeb(struct device *dev, {struct m48t86_rtc_info *info =dev_get_drvdata (dev); -if (info->ops) { - info->ops->writebyte (value, addr); - }else { -writeb (addr, info->index_reg); -writeb (value, info->data_reg); - } +writeb (addr, info->index_reg); +writeb (value, info->data_reg); }static int m48t86_rtc_read_time (struct device *dev,struct rtc_time *tm)
@@ -235,30 +226,26 @@ static bool m48t86_verify_chip(struct platform_device *pdev)static int m48t86_rtc_probe (struct platform_device *pdev) {struct m48t86_rtc_info *info; +struct resource *res;unsigned char reg; info =devm_kzalloc (&pdev->dev,sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ; - info->ops =dev_get_platdata (&pdev->dev); -if (!info->ops) { -struct resource *res; - - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) -return -ENODEV ; - info->index_reg =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (info->index_reg)) -return PTR_ERR (info->index_reg); - - res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); -if (!res) -return -ENODEV ; - info->data_reg =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (info->data_reg)) -return PTR_ERR (info->data_reg); - } + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + info->index_reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (info->index_reg)) +return PTR_ERR (info->index_reg); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!res) +return -ENODEV ; + info->data_reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (info->data_reg)) +return PTR_ERR (info->data_reg);dev_set_drvdata (&pdev->dev, info);
include/linux/platform_data/rtc-m48t86.h deleted +0 -16
@@ -1,16 +0,0 @@ -/* -* ST M48T86 / Dallas DS12887 RTC driver -* Copyright (c) 2006 Tower Technologies -* -* Author: Alessandro Zummo <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -struct m48t86_ops -{ -void (*writebyte)(unsigned char value,unsigned long addr); -unsigned char (*readbyte)(unsigned long addr); -};
Signature · 11 lines
2.10.0 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.