Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47C20C4708F for ; Wed, 2 Jun 2021 20:40:10 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA00D613DE for ; Wed, 2 Jun 2021 20:40:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA00D613DE Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=libero.it Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 217BE82F73; Wed, 2 Jun 2021 22:38:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="jrAcAWCr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3669682F47; Wed, 2 Jun 2021 22:38:35 +0200 (CEST) Received: from libero.it (smtp-35-i2.italiaonline.it [213.209.12.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C778982C9B for ; Wed, 2 Jun 2021 22:38:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from passgat-Modern-14-A10M.homenet.telecomitalia.it ([79.17.119.101]) by smtp-35.iol.local with ESMTPA id oXctlNwhysptioXdDlNDj6; Wed, 02 Jun 2021 22:38:27 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1622666307; bh=6MxCQfTH/yt77Xz2crQs1IliEw2C8Y7UrsJEXDga6i8=; h=From; b=jrAcAWCrxr8GBeRJI+lrvZyZ2HV9Vw+e5eyR0yTpu0CSE3Z3J3lTFBwKroTIvqLeO RS7NgSEjcZb+eSi2zlbrf7mfaTM58oM3mjpO3fIN6ejS34FPZtlKacmnAv0t2c/Rr+ jRWboml9pqUCdBbbUBjjl+VTYtYvsAGQFMuLDClnQIR/jPdroUsoxx4MIS8jlXeB4e oMPaooM9nz3d0KkFzrOBp1/7IHhZ6V0F898agK0RFjx8qxO+jaFnCxUk7wX0HqMuCJ H6ThEowoZ1DUO3+vRV4kpTikC3fOZi+C/RsTVdxgNEepSiBxj96Dayxiph8V1OIjEf LaNtDIIW2Yuzw== X-CNFS-Analysis: v=2.4 cv=Bo1Yfab5 c=1 sm=1 tr=0 ts=60b7ec43 cx=a_exe a=do1bHx4A/kh2kuTIUQHSxQ==:117 a=do1bHx4A/kh2kuTIUQHSxQ==:17 a=prFL4SO8xRJx28DiWS8A:9 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lokesh Vutla Subject: [PATCH v2 8/8] rtc: davinci: fix date loaded on reset Date: Wed, 2 Jun 2021 22:38:05 +0200 Message-Id: <20210602203805.11494-9-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602203805.11494-1-dariobin@libero.it> References: <20210602203805.11494-1-dariobin@libero.it> X-CMAE-Envelope: MS4xfP5wprdIZ8mHEl+Ffoz6LEO1+O1PgMB9Jj3IYPiMzoQ54W2SWHWwdTfp8RvYL1IaBVQGPh9Zsuz/8vDCmgyxx4zp6t5TtxMuFg9fpwxjl+9giIw9FRZg iILPEC10Cmgp8fGP+wP9kMzA8EPIEQV40T18/qW6RtOIMBufe8v1ch1dxlleQ1+IJ+Q1bbdGWm/PYlUhLj2kG0uiSt0EvS5Jekxww1sUO8Zb41tswkQoNtdS WlL+tfKlOyi6PAjm7tEmBNOXBo+MpSwHB3EibzcI7xndMGB5gov4OMiapfCCqf7M X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean On reset, the RTC loads the 2000-01-01 date with a wrong day of the week (Sunday instead of Saturday). Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/rtc/davinci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/rtc/davinci.c b/drivers/rtc/davinci.c index 21e5234477..c7ce41bbf5 100644 --- a/drivers/rtc/davinci.c +++ b/drivers/rtc/davinci.c @@ -290,6 +290,7 @@ static int omap_rtc_remove(struct udevice *dev) static int omap_rtc_probe(struct udevice *dev) { struct omap_rtc_priv *priv = dev_get_priv(dev); + struct rtc_time tm; u8 reg, mask, new_ctrl; priv->dev = dev; @@ -380,6 +381,15 @@ static int omap_rtc_probe(struct udevice *dev) } omap_rtc_lock(priv); + + if (omap_rtc_get(dev, &tm)) { + dev_err(dev, "failed to get datetime\n"); + } else if (tm.tm_year == 2000 && tm.tm_mon == 1 && tm.tm_mday == 1 && + tm.tm_wday == 0) { + tm.tm_wday = 6; + omap_rtc_set(dev, &tm); + } + return 0; } -- 2.17.1