Skip to contentSkip to conversation

rtc: add driver for internal RTC on kirkwood SoC

PATCH New Chris Packham 1 participant 3 messages May 13, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 rtc: add driver for internal RTC on kirkwood SoC

From: Luuk Paulussen <[email protected]>

---
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    2 +
 drivers/rtc/Makefile                          |    1 +
 drivers/rtc/kirkwood.c                        |   76 +++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/kirkwood.c
arch/arm/include/asm/arch-kirkwood/kirkwood.h +2 -0
index 0104418..15922eb 100644
@@ -50,6 +50,8 @@
 #define KW_MPP_BASE			(KW_REGISTER(0x10000))
 #define KW_GPIO0_BASE			(KW_REGISTER(0x10100))
 #define KW_GPIO1_BASE			(KW_REGISTER(0x10140))
+#define KW_RTC_TIME			(KW_REGISTER(0x10300))
+#define KW_RTC_DATE			(KW_REGISTER(0x10304))
 #define KW_NANDF_BASE			(KW_REGISTER(0x10418))
 #define KW_SPI_BASE			(KW_REGISTER(0x10600))
 #define KW_CPU_WIN_BASE			(KW_REGISTER(0x20000))
drivers/rtc/Makefile +1 -0
index e4be4a4..ec064d9 100644
@@ -43,6 +43,7 @@ COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
 COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
+COBJS-$(CONFIG_RTC_KIRKWOOD) += kirkwood.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
 COBJS-$(CONFIG_RTC_M41T62) += m41t62.o
drivers/rtc/kirkwood.c new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/3 sntp: avoid use of uninitialized variable

From: Luuk Paulussen <[email protected]>

When we use the ntpserverip environment variable argv[1] may not be set. Printing the error message using the NetNtpServerIP variable ensures the correct output in both cases.

---
 common/cmd_net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_net.c +1 -1
index 8c6f5c8..e0d7d23 100644
@@ -324,7 +324,7 @@ int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	else NetTimeOffset = simple_strtol (toff, NULL, 10);
 
 	if (NetLoop(SNTP) < 0) {
-		printf("SNTP failed: host %s not responding\n", argv[1]);
+		printf("SNTP failed: host %pI4 not responding\n", &NetNtpServerIP);
 		return 1;
 	}
 
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 3/3 bootp: add ntpserver option to bootp request

From: Luuk Paulussen <[email protected]>

---
 net/bootp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
net/bootp.c +13 -0
index 4db63cb..53f37d0 100644
@@ -228,6 +228,11 @@ static void BootpVendorFieldProcess (u8 * ext)
 			NetOurNISDomain[size] = 0;
 		}
 		break;
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
+	case 42:	/* NTP server IP */
+		NetCopyIP (&NetNtpServerIP, (IPaddr_t *) (ext + 2));
+		break;
+#endif
 		/* Application layer fields */
 	case 43:		/* Vendor specific info - Not yet supported	*/
 		/*
@@ -278,6 +283,9 @@ static void BootpVendorProcess (u8 * ext, int size)
 
 	if (NetBootFileSize)
 		debug("NetBootFileSize: %d\n", NetBootFileSize);
+
+	if (NetNtpServerIP)
+		debug("NetNtpServerIP : %pI4\n", &NetNtpServerIP);
 }
 /*
  *	Handle a BOOTP received packet.
@@ -538,6 +546,11 @@ static int BootpExtended (u8 * e)
 	*e++ = 32;
 	e   += 32;
 #endif
+#if defined(CONFIG_BOOTP_NTPSERVER)
+	*e++  = 42;
+	*e++ = 4;
+	e   += 4;
+#endif
 
 	*e++ = 255;		/* End of the list */
 
Signature · 1 line
1.7.4.1