Skip to contentSkip to conversation

ARM: NUC900: add RTC driver support for nuc910 and nuc920

PATCH Superseded Wan ZongShun 2 participants 2 messages Nov 29, 2009 – Nov 30, 2009 Real time clock (RTC)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ARM: NUC900: add RTC driver support for nuc910 and nuc920

Dear Alessandro,

I fixed this patch and submitted it again.

thanks!

---
 drivers/rtc/Kconfig      |    6 +
 drivers/rtc/Makefile     |    1 +
 drivers/rtc/rtc-nuc900.c |  331 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-nuc900.c
drivers/rtc/Kconfig +6 -0
index 3c20dae..266ce62 100644
@@ -573,6 +573,12 @@ config RTC_DRV_AB3100
 	  Select this to enable the ST-Ericsson AB3100 Mixed Signal IC RTC
 	  support. This chip contains a battery- and capacitor-backed RTC.
 
+config RTC_DRV_NUC900
+	tristate "NUC910/NUC920 RTC driver"
+	depends on RTC_CLASS && ARCH_W90X900
+	help
+	  If you say yes here you get support for the RTC subsystem of the
+	  NUC910/NUC920 used in embedded systems.
 
 comment "on-CPU RTC drivers"
 
drivers/rtc/Makefile +1 -0
index aa3fbd5..d511774 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_RTC_MXC)		+= rtc-mxc.o
 obj-$(CONFIG_RTC_DRV_MAX6900)	+= rtc-max6900.o
 obj-$(CONFIG_RTC_DRV_MAX6902)	+= rtc-max6902.o
 obj-$(CONFIG_RTC_DRV_MV)	+= rtc-mv.o
+obj-$(CONFIG_RTC_DRV_NUC900)	+= rtc-nuc900.o
 obj-$(CONFIG_RTC_DRV_OMAP)	+= rtc-omap.o
 obj-$(CONFIG_RTC_DRV_PCAP)	+= rtc-pcap.o
 obj-$(CONFIG_RTC_DRV_PCF8563)	+= rtc-pcf8563.o
drivers/rtc/rtc-nuc900.c new file +331 -0

331 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 7 lines · On Sun, 29 Nov 2009 20:37:23 +0800 Wan ZongShun <[email protected]> wrote:

Dear Alessandro,

I fixed this patch and submitted it again.

thanks!

That's not a terribly useful changelog.

Quoted 7 lines

...

drivers/rtc/rtc-nuc900.c new file +4 -0
+static void check_rtc_power(struct nuc900_rtc *nuc900_rtc)
+{
+	unsigned int i;
+	__raw_writel(INIRRESET, nuc900_rtc->rtc_reg + REG_RTC_INIR);

drivers/rtc/rtc-nuc900.c line 98

Quoted 10 lines
drivers/rtc/rtc-nuc900.c new file +10 -0
+
+	mdelay(10);
+
+	__raw_writel(AERPOWERON, nuc900_rtc->rtc_reg + REG_RTC_AER);
+
+	for (i = 0; i < 1000000; i++) {
+		if (__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB)
+			break;
+	}
+}

I don't like that function much.

- It's not obvious what it actually does (I don't know), so it should have some comment explaining this.

- It's called "check_rtc_power", but it doesn't actually "check" anything.

- If that enormously expensive loop times out, the function will not inform the caller of this, so it will be called again and again and will continue to be enormously expensive.

Quoted 3 lines

...