r2270 - trunk/src/target/u-boot/patches

laforge at sita.openmoko.org laforge at sita.openmoko.org
Sat Jun 16 09:19:22 CEST 2007


Author: laforge
Date: 2007-06-16 09:19:19 +0200 (Sat, 16 Jun 2007)
New Revision: 2270

Modified:
   trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
Log:
* implement pcf50606 RTC driver
* use PCF50606 RTC rather than S3C2410 RTC, in accordance with hardware/kernel


Modified: trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch	2007-06-15 17:06:20 UTC (rev 2269)
+++ trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch	2007-06-16 07:19:19 UTC (rev 2270)
@@ -8,7 +8,7 @@
 ===================================================================
 --- u-boot.orig/Makefile
 +++ u-boot/Makefile
-@@ -2009,6 +2009,14 @@
+@@ -2032,6 +2032,14 @@
  sbc2410x_config: unconfig
  	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
  
@@ -60,7 +60,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/drivers/pcf50606.c
-@@ -0,0 +1,112 @@
+@@ -0,0 +1,161 @@
 +
 +#include <common.h>
 +
@@ -172,6 +172,55 @@
 +	}
 +}
 +
++#if defined(CONFIG_RTC_PCF50606) && (CONFIG_COMMANDS & CFG_CMD_DATE)
++
++#include <rtc.h>
++
++static unsigned bcd2bin (uchar n)
++{
++	return ((((n >> 4) & 0x0F) * 10) + (n & 0x0F));
++}
++
++static unsigned char bin2bcd (unsigned int n)
++{
++	return (((n / 10) << 4) | (n % 10));
++}
++
++
++void rtc_get(struct rtc_time *tmp)
++{
++	tmp->tm_sec = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCSC));
++	tmp->tm_min = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCMN));
++	tmp->tm_hour = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCHR));
++	tmp->tm_wday = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCWD));
++	tmp->tm_mday = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCDT));
++	tmp->tm_mon = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCMT));
++	tmp->tm_year = bcd2bin(pcf50606_reg_read(PCF50606_REG_RTCYR));
++	if (tmp->tm_year < 70)
++		tmp->tm_year += 2000;
++	else
++		tmp->tm_year += 1900;
++	tmp->tm_yday = 0;
++	tmp->tm_isdst = 0;
++}
++
++void rtc_set(struct rtc_time *tmp)
++{
++	pcf50606_reg_write(PCF50606_REG_RTCSC, bin2bcd(tmp->tm_sec));
++	pcf50606_reg_write(PCF50606_REG_RTCMN, bin2bcd(tmp->tm_min));
++	pcf50606_reg_write(PCF50606_REG_RTCHR, bin2bcd(tmp->tm_hour));
++	pcf50606_reg_write(PCF50606_REG_RTCWD, bin2bcd(tmp->tm_wday));
++	pcf50606_reg_write(PCF50606_REG_RTCDT, bin2bcd(tmp->tm_mday));
++	pcf50606_reg_write(PCF50606_REG_RTCMN, bin2bcd(tmp->tm_mon));
++	pcf50606_reg_write(PCF50606_REG_RTCYR, bin2bcd(tmp->tm_year % 100));
++}
++
++void rtc_reset(void)
++{
++	/* FIXME */
++}
++#endif /* CONFIG_RTC_PCF50606 && CFG_CMD_DATE */
++
 +#endif /* CONFIG DRIVER_PCF50606 */
 Index: u-boot/include/pcf50606.h
 ===================================================================
@@ -1943,7 +1992,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/include/configs/neo1973_gta01.h
-@@ -0,0 +1,265 @@
+@@ -0,0 +1,261 @@
 +/*
 + * (C) Copyright 2006 OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -2014,11 +2063,6 @@
 + */
 +#define CONFIG_SERIAL1          1	/* we use SERIAL 1 on GTA01 */
 +
-+/************************************************************
-+ * RTC
-+ ************************************************************/
-+#define	CONFIG_RTC_S3C24X0	1
-+
 +/* allow to overwrite serial and ethaddr */
 +#define CONFIG_ENV_OVERWRITE
 +
@@ -2207,6 +2251,7 @@
 +#define CONFIG_S3C2410_NAND_HWECC              1
 +
 +#define CONFIG_DRIVER_PCF50606		1
++#define CONFIG_RTC_PCF50606		1
 +
 +#endif	/* __CONFIG_H */
 Index: u-boot/board/neo1973/common/neo1973.h





More information about the commitlog mailing list