lkml.org 
[lkml]   [2015]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rtc-linux] [PATCH 4/5] RTC/i.MX/DryIce: when locked, do not fail silently
Please always include a commit message.

On 14/04/2015 at 11:11:55 +0200, Juergen Borleis wrote :
> Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> Signed-off-by: Robert Schwebel <rsc@pengutronix.de>
> [rsc: got NDA clearance from Freescale]
> ---
> drivers/rtc/rtc-imxdi.c | 28 +++++++++++++++++++++++++---
> 1 file changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
> index b04c64f..de1a2e4 100644
> --- a/drivers/rtc/rtc-imxdi.c
> +++ b/drivers/rtc/rtc-imxdi.c
> @@ -581,14 +581,36 @@ static int dryice_rtc_read_time(struct device *dev, struct rtc_time *tm)
> static int dryice_rtc_set_mmss(struct device *dev, unsigned long secs)
> {
> struct imxdi_dev *imxdi = dev_get_drvdata(dev);
> + u32 dcr, dsr;
> int rc;
>
> + dcr = __raw_readl(imxdi->ioaddr + DCR);
> + dsr = __raw_readl(imxdi->ioaddr + DSR);
> +
> + if (!(dcr & DCR_TCE) || (dsr & DSR_SVF)) {
> + if (dcr & DCR_TCHL) {
> + /* we are even more out of luck */
> + di_what_is_to_be_done(imxdi, "battery");
> + return -EPERM;
> + }
> + if ((dcr & DCR_TCSL) || (dsr & DSR_SVF)) {
> + /* we are out of luck for now */
> + di_what_is_to_be_done(imxdi, "main");
> + return -EPERM;
> + }
> + }
> +
> /* zero the fractional part first */
> rc = di_write_wait(imxdi, 0, DTCLR);
> - if (rc == 0)
> - rc = di_write_wait(imxdi, secs, DTCMR);
> + if (rc != 0)
> + return rc;
>
> - return rc;
> + rc = di_write_wait(imxdi, secs, DTCMR);
> + if (rc != 0)
> + return rc;
> +
> + return di_write_wait(imxdi, __raw_readl(imxdi->ioaddr + DCR) |
> + DCR_TCE, DCR);
> }
>
> static int dryice_rtc_alarm_irq_enable(struct device *dev,
> --
> 2.1.4
>
> --
> --
> You received this message because you are subscribed to "rtc-linux".
> Membership options at http://groups.google.com/group/rtc-linux .
> Please read http://groups.google.com/group/rtc-linux/web/checklist
> before submitting a driver.
> ---
> You received this message because you are subscribed to the Google Groups "rtc-linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


\
 
 \ /
  Last update: 2015-04-22 01:41    [W:0.107 / U:2.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site