From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] rtc: imxdi: Initial support
Date: Sun, 5 Aug 2012 16:14:17 +0200 (CEST) [thread overview]
Message-ID: <1483827613.1452102.1344176057635.JavaMail.root@advansee.com> (raw)
In-Reply-To: <501E1D19.5040906@denx.de>
On Sun, Aug 5, 2012 at 09:13:29 AM, Stefano Babic wrote:
> On 20/07/2012 16:24, Beno?t Th?baudeau wrote:
> > Add support for Freescale's i.MX DryIce RTC, present on i.MX25.
> >
> > Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> > Cc: Wolfgang Denk <wd@denx.de>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
>
> Hi Benoit,
>
>
> just a few comments.
>
> > +
> > +/*
> > + * Date & Time support for Freescale i.MX DryIce RTC
> > + */
> > +
> > +#include <common.h>
> > +#include <command.h>
> > +#include <rtc.h>
> > +
> > +#if defined(CONFIG_CMD_DATE)
> > +
> > +#include <asm/io.h>
> > +#include <asm/arch/imx-regs.h>
> > +
> > +/* DryIce Register Definitions */
> > +
> > +#define DTCMR 0x00 /* Time Counter MSB Reg */
> > +#define DTCLR 0x04 /* Time Counter LSB Reg */
> > +
> > +#define DCAMR 0x08 /* Clock Alarm MSB Reg */
> > +#define DCALR 0x0c /* Clock Alarm LSB Reg */
>
> U-Boot as rule does not allow usage of start address + offset to
> access
> internal registers. Instead of that, please define a proper C
> structure
> with the register's layout. This should be fixed globally for all
> read /
> write accesses.
OK, I'll do that.
> > +/*
> > + * This function attempts to clear the dryice write-error flag.
> > + *
> > + * A dryice write error is similar to a bus fault and should not
> > occur in
> > + * normal operation. Clearing the flag requires another write, so
> > the root
> > + * cause of the problem may need to be fixed before the flag can
> > be cleared.
> > + */
> > +static void clear_write_error(void)
> > +{
> > + int cnt;
> > +
> > + puts("### Warning: RTC - Register write error!\n");
> > +
> > + /* clear the write error flag */
> > + __raw_writel(DSR_WEF, IMX_DRYICE_BASE + DSR);
>
> Ditto
>
> > +int rtc_get(struct rtc_time *tmp)
> > +{
> > + unsigned long now;
> > + int rc;
> > +
> > + rc = di_init();
>
> Why is di_init always called ? Should be not checked if it is was
> already initialized and the function should be called only once ?
I think this can be done. I'll check that this does not cause any regression.
I think only the reset function should have to call di_init unconditionally.
Best regards,
Beno?t
next prev parent reply other threads:[~2012-08-05 14:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1227195557.336910.1342794274777.JavaMail.root@advansee.com>
2012-07-20 14:24 ` [U-Boot] [PATCH] rtc: imxdi: Initial support Benoît Thébaudeau
2012-08-03 23:06 ` Benoît Thébaudeau
2012-08-05 7:13 ` Stefano Babic
2012-08-05 14:14 ` Benoît Thébaudeau [this message]
2012-08-08 11:57 ` [U-Boot] [PATCH v2] " Benoît Thébaudeau
2012-08-08 14:29 ` Stefano Babic
2012-08-08 14:52 ` [U-Boot] [PATCH v3] " Benoît Thébaudeau
2012-08-09 13:58 ` Stefano Babic
2012-08-08 14:57 ` [U-Boot] [PATCH v2] " Benoît Thébaudeau
2012-08-08 15:24 ` Stefano Babic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1483827613.1452102.1344176057635.JavaMail.root@advansee.com \
--to=benoit.thebaudeau@advansee.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox