Patchwork [3/9] MXS/i.MX28: prepare different clocking of the built-in RTC

login
register
mail settings
Submitter Steffen Trumtrar
Date March 4, 2013, 2:05 p.m.
Message ID <1362405948-12992-4-git-send-email-s.trumtrar@pengutronix.de>
Download mbox | patch
Permalink /patch/224732/
State New
Headers show

Comments

Steffen Trumtrar - March 4, 2013, 2:05 p.m.
From: Juergen Beisert <jbe@pengutronix.de>

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/rtc/rtc-stmp3xxx.c |    8 ++++++++
 1 file changed, 8 insertions(+)
Shawn Guo - March 7, 2013, 6:40 a.m.
On Mon, Mar 04, 2013 at 03:05:42PM +0100, Steffen Trumtrar wrote:
> From: Juergen Beisert <jbe@pengutronix.de>
> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> ---
>  drivers/rtc/rtc-stmp3xxx.c |    8 ++++++++
>  1 file changed, 8 insertions(+)

So this is a rtc patch, and should be prefixed with "rtc: stmp3xxx: "
like patches #6~9.

And IMO, all the changes in this patch can just be added together with
the codes that use them.  IOW, it can be merged into patch #4.

> 
> diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
> index 98f0d3c..7311292 100644
> --- a/drivers/rtc/rtc-stmp3xxx.c
> +++ b/drivers/rtc/rtc-stmp3xxx.c
> @@ -53,18 +53,26 @@
>  #define STMP3XXX_RTC_PERSISTENT0		0x60
>  #define STMP3XXX_RTC_PERSISTENT0_SET		0x64
>  #define STMP3XXX_RTC_PERSISTENT0_CLR		0x68
> +#define STMP3XXX_RTC_PERSISTENT0_CLOCKSOURCE	(1 << 0)
>  #define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN	0x00000002
>  #define STMP3XXX_RTC_PERSISTENT0_ALARM_EN	0x00000004
> +#define STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP (1 << 4)
> +#define STMP3XXX_RTC_PERSISTENT0_XTAL32KHZ_PWRUP (1 << 5)
> +#define STMP3XXX_RTC_PERSISTENT0_XTAL32_FREQ	(1 << 6)
> +
>  #define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE	0x00000080
>  
>  #define STMP3XXX_RTC_PERSISTENT1		0x70
>  /* missing bitmask in headers */
>  #define STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER	0x80000000
>  
> +enum clock_source { MXS_UNKNOWN, MXS_OSC_24M, MXS_OSC_32K, MXS_OSC_32K768 };
> +
We generic write it like

enum clock_source {
        MXS_UNKNOWN,
        MXS_OSC_24M,
        MXS_OSC_32K,
        MXS_OSC_32K768
};

Shawn

>  struct stmp3xxx_rtc_data {
>  	struct rtc_device *rtc;
>  	void __iomem *io;
>  	int irq_alarm;
> +	enum clock_source clk_src;
>  };
>  
>  #if IS_ENABLED(CONFIG_STMP3XXX_RTC_WATCHDOG)
> -- 
> 1.7.10.4
>

Patch

diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 98f0d3c..7311292 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -53,18 +53,26 @@ 
 #define STMP3XXX_RTC_PERSISTENT0		0x60
 #define STMP3XXX_RTC_PERSISTENT0_SET		0x64
 #define STMP3XXX_RTC_PERSISTENT0_CLR		0x68
+#define STMP3XXX_RTC_PERSISTENT0_CLOCKSOURCE	(1 << 0)
 #define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN	0x00000002
 #define STMP3XXX_RTC_PERSISTENT0_ALARM_EN	0x00000004
+#define STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP (1 << 4)
+#define STMP3XXX_RTC_PERSISTENT0_XTAL32KHZ_PWRUP (1 << 5)
+#define STMP3XXX_RTC_PERSISTENT0_XTAL32_FREQ	(1 << 6)
+
 #define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE	0x00000080
 
 #define STMP3XXX_RTC_PERSISTENT1		0x70
 /* missing bitmask in headers */
 #define STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER	0x80000000
 
+enum clock_source { MXS_UNKNOWN, MXS_OSC_24M, MXS_OSC_32K, MXS_OSC_32K768 };
+
 struct stmp3xxx_rtc_data {
 	struct rtc_device *rtc;
 	void __iomem *io;
 	int irq_alarm;
+	enum clock_source clk_src;
 };
 
 #if IS_ENABLED(CONFIG_STMP3XXX_RTC_WATCHDOG)