From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 9A9CBC4707F for ; Thu, 27 May 2021 10:04:54 +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 BB481610A6 for ; Thu, 27 May 2021 10:04:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB481610A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com 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 D2DEE82D56; Thu, 27 May 2021 12:04:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="luUwb37l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C646182B89; Thu, 27 May 2021 12:04:49 +0200 (CEST) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 BEFDB82B89 for ; Thu, 27 May 2021 12:04:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=lokeshvutla@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 14RA4hrQ125014; Thu, 27 May 2021 05:04:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1622109883; bh=jcIMFEsgXZ0cnsOmZJdbIzP6y6Ua/gWmqEdgzmcpAPs=; h=Subject:To:References:From:Date:In-Reply-To; b=luUwb37lNrzGS2cCPaye56tDllfg9uKlDApc/1a/XAHb0ya/+JDKQcS3Mp/RciyEp AlJ+8TPluLnmM10SNUQeK0vfPSQaX9hm3428WqnxRnBHAhDlyDdERKZ1JUujlBANAj oluhoNhiZwW1LLIWq4LCPTDkrr3eXWz5XJ1mKg74= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 14RA4h19122013 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 May 2021 05:04:43 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 27 May 2021 05:04:43 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 27 May 2021 05:04:43 -0500 Received: from [10.24.69.20] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 14RA4eMB071747; Thu, 27 May 2021 05:04:42 -0500 Subject: Re: [PATCH 6/7] rtc: davinci: add driver model support To: Dario Binacchi , References: <20210507041509.4928-1-dariobin@libero.it> <20210507041509.4928-7-dariobin@libero.it> From: Lokesh Vutla Message-ID: <440362b5-e887-b708-d3e5-aca4dcf1ee78@ti.com> Date: Thu, 27 May 2021 15:34:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210507041509.4928-7-dariobin@libero.it> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 07/05/21 9:45 am, Dario Binacchi wrote: > Update the driver to support the device tree and the driver model. > The read / write helpers in rtc_ops allow access to scratch registers > only. The offset parameter is added to the address of the scratch0 > register. > > Signed-off-by: Dario Binacchi > --- > > drivers/rtc/davinci.c | 373 ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 363 insertions(+), 10 deletions(-) > > diff --git a/drivers/rtc/davinci.c b/drivers/rtc/davinci.c > index 82e5eb3b43..b0a077cba7 100644 > --- a/drivers/rtc/davinci.c > +++ b/drivers/rtc/davinci.c > @@ -2,20 +2,20 @@ > /* > * (C) Copyright 2011 DENX Software Engineering GmbH > * Heiko Schocher > + * Copyright (C) 2021 Dario Binacchi > */ > #include > #include > +#include > +#include > #include > #include > #include > #include > #include > +#include > #include > > -#if !defined(RTC_BASE) && defined(DAVINCI_RTC_BASE) > -#define RTC_BASE DAVINCI_RTC_BASE > -#endif > - > static void davinci_rtc_lock(struct davinci_rtc *rtc) > { > writel(0, &rtc->kick0r); > @@ -52,9 +52,8 @@ static int davinci_rtc_wait_not_busy(struct davinci_rtc *rtc) > return 0; > } > > -int rtc_get(struct rtc_time *tmp) > +static int davinci_rtc_get(struct davinci_rtc *rtc, struct rtc_time *tmp) can we use use consistent naming? omap_rtc_? > { > - struct davinci_rtc *rtc = (struct davinci_rtc *)RTC_BASE; > unsigned long sec, min, hour, mday, wday, mon_cent, year; > int ret; > > @@ -92,9 +91,8 @@ int rtc_get(struct rtc_time *tmp) > return 0; > } > > -int rtc_set(struct rtc_time *tmp) > +static int davinci_rtc_set(struct davinci_rtc *rtc, const struct rtc_time *tmp) > { > - struct davinci_rtc *rtc = (struct davinci_rtc *)RTC_BASE; > int ret; > > ret = davinci_rtc_wait_not_busy(rtc); > @@ -119,10 +117,365 @@ int rtc_set(struct rtc_time *tmp) > return 0; > } > > +static void davinci_rtc_reset(struct davinci_rtc *rtc) > +{ > + /* run RTC counter */ > + writeb(0x01, &rtc->ctrl); > +} > + > +#if !CONFIG_IS_ENABLED(DM_RTC) Are there any users of non-DM? If not can we just drop the support for non-DM? Thanks and regards, Lokesh