[U-Boot-Users] [PATCH] Add support for Intersil isl1208 RTC

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Mar 13 22:30:23 CET 2008


On 08:53 Thu 28 Feb     , Tor Krill wrote:
> Signed-off-by: Tor Krill <tor at excito.com>
> ---
>  README                |    1 +
>  drivers/rtc/Makefile  |    1 +
>  drivers/rtc/isl1208.c |  176 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 178 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/rtc/isl1208.c
> 
> diff --git a/README b/README
> index 491397a..b230fde 100644
> --- a/README
> +++ b/README
> @@ -669,6 +669,7 @@ The following options need to be configured:
>  		CONFIG_RTC_DS1337	- use Maxim, Inc. DS1337 RTC
>  		CONFIG_RTC_DS1338	- use Maxim, Inc. DS1338 RTC
>  		CONFIG_RTC_DS164x	- use Dallas DS164x RTC
> +		CONFIG_RTC_ISL1208	- use Intersil ISL1208 RTC
>  		CONFIG_RTC_MAX6900	- use Maxim, Inc. MAX6900 RTC
>  
>  		Note that if the RTC uses I2C, then the I2C interface
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 2af2bf4..a0d3472 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -53,6 +53,7 @@ COBJS-y += rs5c372.o
>  COBJS-y += rx8025.o
>  COBJS-y += mcfrtc.o
>  COBJS-y += x1205.o
> +COBJS-y += isl1208.o
>  
>  COBJS	:= $(COBJS-y)
>  SRCS	:= $(COBJS:.o=.c)
> diff --git a/drivers/rtc/isl1208.c b/drivers/rtc/isl1208.c
> new file mode 100644
> index 0000000..d52d23d
> --- /dev/null
> +++ b/drivers/rtc/isl1208.c
> @@ -0,0 +1,176 @@
> +/*
> + * (C) Copyright 2008
> + * Tor Krill, Excito Elektronik i Skåne , tor at excito.com
> + *
> + * Modelled after the ds1337 driver
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +/*
> + * Date & Time support (no alarms) for Intersil
> + * ISL1208 Real Time Clock (RTC).
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <rtc.h>
> +#include <i2c.h>
> +
> +#if defined(CONFIG_RTC_ISL1208) && defined(CONFIG_CMD_DATE)
Please move it to the Makefile
> +
> +/*---------------------------------------------------------------------*/
> +#undef DEBUG_RTC
Please remove it
> +
> +#ifdef DEBUG_RTC
> +#define DEBUGR(fmt,args...) printf(fmt ,##args)
> +#else
> +#define DEBUGR(fmt,args...)
> +#endif
> +/*---------------------------------------------------------------------*/
> +
> +/*
> + * RTC register addresses
> + */
> +
> +#define RTC_SEC_REG_ADDR        0x0
> +#define RTC_MIN_REG_ADDR        0x1
> +#define RTC_HR_REG_ADDR         0x2
> +#define RTC_DATE_REG_ADDR       0x3
> +#define RTC_MON_REG_ADDR        0x4
> +#define RTC_YR_REG_ADDR         0x5
> +#define RTC_DAY_REG_ADDR        0x6
> +#define RTC_STAT_REG_ADDR       0x7
Please use tab not spaces
> +/*
> + * RTC control register bits
> + */
> +
[Snip]
> +
> +/*
> + * Helper functions
> + */
> +

> +static
> +uchar rtc_read (uchar reg)
On one line please
> +{
> +	return (i2c_reg_read (CFG_I2C_RTC_ADDR, reg));
> +}
> +
> +
Please only one empty line
> +static void rtc_write (uchar reg, uchar val)
> +{
> +	i2c_reg_write (CFG_I2C_RTC_ADDR, reg, val);
> +}
> +
Best Regards,
J.




More information about the U-Boot mailing list