diff mbox

[4/4] davinci: Add RTC support for DA8xx/OMAP-L13x SoC's

Message ID 20090916011554.GD32194@mag.az.mvista.com (mailing list archive)
State Accepted
Headers show

Commit Message

Mark A. Greer Sept. 16, 2009, 1:15 a.m. UTC
From: Mark A. Greer <mgreer@mvista.com>

Add RTC support for the da830/omap-l137 and da850/omap-l138
SoC's by leveraging existing the rtc-omap driver.

Signed-off-by: Mark A. Greer <mgreer@mvista.com>
---
 arch/arm/mach-davinci/board-da830-evm.c    |    4 +++
 arch/arm/mach-davinci/board-da850-evm.c    |    4 +++
 arch/arm/mach-davinci/devices-da8xx.c      |   35 ++++++++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/da8xx.h |    1 +
 drivers/rtc/Kconfig                        |    7 +++--
 5 files changed, 48 insertions(+), 3 deletions(-)

Comments

Kevin Hilman Sept. 16, 2009, 3:01 p.m. UTC | #1
"Mark A. Greer" <mgreer@mvista.com> writes:

> From: Mark A. Greer <mgreer@mvista.com>
>
> Add RTC support for the da830/omap-l137 and da850/omap-l138
> SoC's by leveraging existing the rtc-omap driver.
>
> Signed-off-by: Mark A. Greer <mgreer@mvista.com>

Can you re-send this rtc-omap patch and Cc linux-omap@vger.kernel.org?

  http://groups.google.com/group/rtc-linux/msg/4b688b755bf93cb4?dmode=source

This will probably have to be Ack'd by omap folks since some omap code
will have to be changed to update platform drivers.

Thanks,

Kevin

> ---
>  arch/arm/mach-davinci/board-da830-evm.c    |    4 +++
>  arch/arm/mach-davinci/board-da850-evm.c    |    4 +++
>  arch/arm/mach-davinci/devices-da8xx.c      |   35 ++++++++++++++++++++++++++++
>  arch/arm/mach-davinci/include/mach/da8xx.h |    1 +
>  drivers/rtc/Kconfig                        |    7 +++--
>  5 files changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index dfc4897..fb76721 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -217,6 +217,10 @@ static __init void da830_evm_init(void)
>  	if (ret)
>  		pr_warning("da830_evm_init: lcd setup failed: %d\n", ret);
>  #endif
> +
> +	ret = da8xx_register_rtc();
> +	if (ret)
> +		pr_warning("da830_evm_init: rtc setup failed: %d\n", ret);
>  }
>  
>  #ifdef CONFIG_SERIAL_8250_CONSOLE
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index da1a6fb..47619a9 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -381,6 +381,10 @@ static __init void da850_evm_init(void)
>  	if (ret)
>  		pr_warning("da850_evm_init: lcdc registration failed: %d\n",
>  				ret);
> +
> +	ret = da8xx_register_rtc();
> +	if (ret)
> +		pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
>  }
>  
>  #ifdef CONFIG_SERIAL_8250_CONSOLE
> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
> index 5595613..dd0ea08 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
> @@ -29,6 +29,7 @@
>  #define DA8XX_TPTC1_BASE		0x01c08400
>  #define DA8XX_WDOG_BASE			0x01c21000 /* DA8XX_TIMER64P1_BASE */
>  #define DA8XX_I2C0_BASE			0x01c22000
> +#define DA8XX_RTC_BASE			0x01C23000
>  #define DA8XX_EMAC_CPPI_PORT_BASE	0x01e20000
>  #define DA8XX_EMAC_CPGMACSS_BASE	0x01e22000
>  #define DA8XX_EMAC_CPGMAC_BASE		0x01e23000
> @@ -453,3 +454,37 @@ int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
>  	da8xx_mmcsd0_device.dev.platform_data = config;
>  	return platform_device_register(&da8xx_mmcsd0_device);
>  }
> +
> +static struct resource da8xx_rtc_resources[] = {
> +	{
> +		.start		= DA8XX_RTC_BASE,
> +		.end		= DA8XX_RTC_BASE + SZ_4K - 1,
> +		.flags		= IORESOURCE_MEM,
> +	},
> +	{ /* timer irq */
> +		.start		= IRQ_DA8XX_RTC,
> +		.end		= IRQ_DA8XX_RTC,
> +		.flags		= IORESOURCE_IRQ,
> +	},
> +	{ /* alarm irq */
> +		.start		= IRQ_DA8XX_RTC,
> +		.end		= IRQ_DA8XX_RTC,
> +		.flags		= IORESOURCE_IRQ,
> +	},
> +};
> +
> +static struct platform_device da8xx_rtc_device = {
> +	.name           = "omap_rtc",
> +	.id             = -1,
> +	.num_resources	= ARRAY_SIZE(da8xx_rtc_resources),
> +	.resource	= da8xx_rtc_resources,
> +};
> +
> +int da8xx_register_rtc(void)
> +{
> +	/* Unlock the rtc's registers */
> +	__raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c));
> +	__raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70));
> +
> +	return platform_device_register(&da8xx_rtc_device);
> +}
> diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
> index 375a3f7..a152261 100644
> --- a/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ b/arch/arm/mach-davinci/include/mach/da8xx.h
> @@ -81,6 +81,7 @@ int da8xx_register_emac(void);
>  int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
>  int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
>  void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
> +int da8xx_register_rtc(void);
>  
>  extern struct platform_device da8xx_serial_device;
>  extern struct emac_platform_data da8xx_emac_pdata;
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index e104be3..b79320d 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -548,10 +548,11 @@ comment "on-CPU RTC drivers"
>  
>  config RTC_DRV_OMAP
>  	tristate "TI OMAP1"
> -	depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730
> +	depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_DAVINCI_DA8XX
>  	help
> -	  Say "yes" here to support the real time clock on TI OMAP1 chips.
> -	  This driver can also be built as a module called rtc-omap.
> +	  Say "yes" here to support the real time clock on TI OMAP1 and
> +	  DA8xx/OMAP-L13x chips.  This driver can also be built as a
> +	  module called rtc-omap.
>  
>  config RTC_DRV_S3C
>  	tristate "Samsung S3C series SoC RTC"
> -- 
> 1.6.2.5.182.ga808d
>
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Mark A. Greer Sept. 16, 2009, 5:18 p.m. UTC | #2
On Wed, Sep 16, 2009 at 08:01:27AM -0700, Kevin Hilman wrote:
> "Mark A. Greer" <mgreer@mvista.com> writes:
> 
> > From: Mark A. Greer <mgreer@mvista.com>
> >
> > Add RTC support for the da830/omap-l137 and da850/omap-l138
> > SoC's by leveraging existing the rtc-omap driver.
> >
> > Signed-off-by: Mark A. Greer <mgreer@mvista.com>
> 
> Can you re-send this rtc-omap patch and Cc linux-omap@vger.kernel.org?
> 
>   http://groups.google.com/group/rtc-linux/msg/4b688b755bf93cb4?dmode=source
> 
> This will probably have to be Ack'd by omap folks since some omap code
> will have to be changed to update platform drivers.

I've already submitted a patch there for the driver changes,

http://groups.google.com/group/rtc-linux/browse_thread/thread/e3f5de9551453d92#

I guess I messed up and should have put the Kconfig changes in that
patch instead of this one.  Let me resubmit both patches with all the
drivers/rtc/ changes in one patch that goes to rtc-linux.

Mark
--
Kevin Hilman Sept. 16, 2009, 6:01 p.m. UTC | #3
"Mark A. Greer" <mgreer@mvista.com> writes:

> On Wed, Sep 16, 2009 at 08:01:27AM -0700, Kevin Hilman wrote:
>> "Mark A. Greer" <mgreer@mvista.com> writes:
>> 
>> > From: Mark A. Greer <mgreer@mvista.com>
>> >
>> > Add RTC support for the da830/omap-l137 and da850/omap-l138
>> > SoC's by leveraging existing the rtc-omap driver.
>> >
>> > Signed-off-by: Mark A. Greer <mgreer@mvista.com>
>> 
>> Can you re-send this rtc-omap patch and Cc linux-omap@vger.kernel.org?
>> 
>>   http://groups.google.com/group/rtc-linux/msg/4b688b755bf93cb4?dmode=source
>> 
>> This will probably have to be Ack'd by omap folks since some omap code
>> will have to be changed to update platform drivers.
>
> I've already submitted a patch there for the driver changes,
>
> http://groups.google.com/group/rtc-linux/browse_thread/thread/e3f5de9551453d92#

When you re-send it and Cc linux-omap?  The OMAP folks will have to do
some platform_device rework before this can go upstream.

> I guess I messed up and should have put the Kconfig changes in that
> patch instead of this one.  Let me resubmit both patches with all the
> drivers/rtc/ changes in one patch that goes to rtc-linux.

I'll just drop the Kconfig change in $SUBJECT patch before pushing
upstream.  No need to resend.

Thanks,

Kevin
Mark A. Greer Sept. 16, 2009, 6:19 p.m. UTC | #4
On Wed, Sep 16, 2009 at 11:01:16AM -0700, Kevin Hilman wrote:
> "Mark A. Greer" <mgreer@mvista.com> writes:
> 
> > On Wed, Sep 16, 2009 at 08:01:27AM -0700, Kevin Hilman wrote:
> >> "Mark A. Greer" <mgreer@mvista.com> writes:
> >> 
> >> > From: Mark A. Greer <mgreer@mvista.com>
> >> >
> >> > Add RTC support for the da830/omap-l137 and da850/omap-l138
> >> > SoC's by leveraging existing the rtc-omap driver.
> >> >
> >> > Signed-off-by: Mark A. Greer <mgreer@mvista.com>
> >> 
> >> Can you re-send this rtc-omap patch and Cc linux-omap@vger.kernel.org?
> >> 
> >>   http://groups.google.com/group/rtc-linux/msg/4b688b755bf93cb4?dmode=source
> >> 
> >> This will probably have to be Ack'd by omap folks since some omap code
> >> will have to be changed to update platform drivers.
> >
> > I've already submitted a patch there for the driver changes,
> >
> > http://groups.google.com/group/rtc-linux/browse_thread/thread/e3f5de9551453d92#
> 
> When you re-send it and Cc linux-omap?  The OMAP folks will have to do
> some platform_device rework before this can go upstream.

It shouldn't be necessary.  The only other user of "omap_rtc"
is arch/arm/mach-omap1/devices.c which has the platform_device
already set up.

I'll cc them, though.

Mark
--
Kevin Hilman Sept. 16, 2009, 9:56 p.m. UTC | #5
"Mark A. Greer" <mgreer@mvista.com> writes:

> On Wed, Sep 16, 2009 at 11:01:16AM -0700, Kevin Hilman wrote:
>> "Mark A. Greer" <mgreer@mvista.com> writes:
>> 
>> > On Wed, Sep 16, 2009 at 08:01:27AM -0700, Kevin Hilman wrote:
>> >> "Mark A. Greer" <mgreer@mvista.com> writes:
>> >> 
>> >> > From: Mark A. Greer <mgreer@mvista.com>
>> >> >
>> >> > Add RTC support for the da830/omap-l137 and da850/omap-l138
>> >> > SoC's by leveraging existing the rtc-omap driver.
>> >> >
>> >> > Signed-off-by: Mark A. Greer <mgreer@mvista.com>
>> >> 
>> >> Can you re-send this rtc-omap patch and Cc linux-omap@vger.kernel.org?
>> >> 
>> >>   http://groups.google.com/group/rtc-linux/msg/4b688b755bf93cb4?dmode=source
>> >> 
>> >> This will probably have to be Ack'd by omap folks since some omap code
>> >> will have to be changed to update platform drivers.
>> >
>> > I've already submitted a patch there for the driver changes,
>> >
>> > http://groups.google.com/group/rtc-linux/browse_thread/thread/e3f5de9551453d92#
>> 
>> When you re-send it and Cc linux-omap?  The OMAP folks will have to do
>> some platform_device rework before this can go upstream.
>
> It shouldn't be necessary.  The only other user of "omap_rtc"
> is arch/arm/mach-omap1/devices.c which has the platform_device
> already set up.

Ah, ok.  I didn't look, but assumed there would be others.  You might
want to mention that in the changelog so folks like me who are too
lazy to look wont get paranoid.  ;)

Kevin
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index dfc4897..fb76721 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -217,6 +217,10 @@  static __init void da830_evm_init(void)
 	if (ret)
 		pr_warning("da830_evm_init: lcd setup failed: %d\n", ret);
 #endif
+
+	ret = da8xx_register_rtc();
+	if (ret)
+		pr_warning("da830_evm_init: rtc setup failed: %d\n", ret);
 }
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index da1a6fb..47619a9 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -381,6 +381,10 @@  static __init void da850_evm_init(void)
 	if (ret)
 		pr_warning("da850_evm_init: lcdc registration failed: %d\n",
 				ret);
+
+	ret = da8xx_register_rtc();
+	if (ret)
+		pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
 }
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 5595613..dd0ea08 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -29,6 +29,7 @@ 
 #define DA8XX_TPTC1_BASE		0x01c08400
 #define DA8XX_WDOG_BASE			0x01c21000 /* DA8XX_TIMER64P1_BASE */
 #define DA8XX_I2C0_BASE			0x01c22000
+#define DA8XX_RTC_BASE			0x01C23000
 #define DA8XX_EMAC_CPPI_PORT_BASE	0x01e20000
 #define DA8XX_EMAC_CPGMACSS_BASE	0x01e22000
 #define DA8XX_EMAC_CPGMAC_BASE		0x01e23000
@@ -453,3 +454,37 @@  int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
 	da8xx_mmcsd0_device.dev.platform_data = config;
 	return platform_device_register(&da8xx_mmcsd0_device);
 }
+
+static struct resource da8xx_rtc_resources[] = {
+	{
+		.start		= DA8XX_RTC_BASE,
+		.end		= DA8XX_RTC_BASE + SZ_4K - 1,
+		.flags		= IORESOURCE_MEM,
+	},
+	{ /* timer irq */
+		.start		= IRQ_DA8XX_RTC,
+		.end		= IRQ_DA8XX_RTC,
+		.flags		= IORESOURCE_IRQ,
+	},
+	{ /* alarm irq */
+		.start		= IRQ_DA8XX_RTC,
+		.end		= IRQ_DA8XX_RTC,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device da8xx_rtc_device = {
+	.name           = "omap_rtc",
+	.id             = -1,
+	.num_resources	= ARRAY_SIZE(da8xx_rtc_resources),
+	.resource	= da8xx_rtc_resources,
+};
+
+int da8xx_register_rtc(void)
+{
+	/* Unlock the rtc's registers */
+	__raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c));
+	__raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70));
+
+	return platform_device_register(&da8xx_rtc_device);
+}
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 375a3f7..a152261 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -81,6 +81,7 @@  int da8xx_register_emac(void);
 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
 int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
+int da8xx_register_rtc(void);
 
 extern struct platform_device da8xx_serial_device;
 extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e104be3..b79320d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -548,10 +548,11 @@  comment "on-CPU RTC drivers"
 
 config RTC_DRV_OMAP
 	tristate "TI OMAP1"
-	depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730
+	depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_DAVINCI_DA8XX
 	help
-	  Say "yes" here to support the real time clock on TI OMAP1 chips.
-	  This driver can also be built as a module called rtc-omap.
+	  Say "yes" here to support the real time clock on TI OMAP1 and
+	  DA8xx/OMAP-L13x chips.  This driver can also be built as a
+	  module called rtc-omap.
 
 config RTC_DRV_S3C
 	tristate "Samsung S3C series SoC RTC"