]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: Orion5x: ts78xx: allow rtc-m48t86 to manage it's own resources
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 15 Feb 2017 16:35:25 +0000 (09:35 -0700)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Tue, 21 Feb 2017 20:22:59 +0000 (21:22 +0100)
The 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.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-By: Alexander Clouter <alex+kernel@digriz.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
arch/arm/mach-orion5x/ts78xx-setup.c

index cb4c3747214a8a0a887367092fe157861cfddd44..7ef80a8304c0c3ce96f3120e285914fce49b89e8 100644 (file)
@@ -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)