Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3463012ioo; Mon, 30 May 2022 02:37:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyqdONvlJpmFC7+oi6wTX7cuW6F2vi71kTjrbhumkVTxb72+Uqblb/GtaONGMU62eEVKG3 X-Received: by 2002:a17:90a:c202:b0:1e2:e772:5f0a with SMTP id e2-20020a17090ac20200b001e2e7725f0amr6661092pjt.109.1653903445393; Mon, 30 May 2022 02:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653903445; cv=none; d=google.com; s=arc-20160816; b=jgbPo0fH0qamZw7EsNlFrY362Vsr4Ng1WMxdGaG8PQJicc0e2NjI36aeNBgJ4rEYsV G6h6LXBoRiZjEzwOlNyjcSnPayCO9vVgFXdXe9sjpmDTtjOnBYOjmU46lVz/miKom7X+ NQjJpu5XXKh5KFoLdT/Q28S9sqQ5siFfB4TnqWVyiYtxKtEfD06s71gdJ7Dbx9lwqZaB qItdal60hmAtARnoByEFZ/AGOt/GbK4DIUS8xWN1COZ8Rs5lc87gOrH6xCkS/6NJPvJb mM4f8LQ5JRohqRSWPFp1dm0j68xkz1DQ8sosFGKW8mhzJLLSkWchs08qHh2qIeiwQh2o 2CMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CkdzP0Iq3FU7wjmp0Y3UeR9Oy/0QxcQ42VN+PLrzBqg=; b=PyPlHr7XsaqRUIpan/WKk7yfQILpXRhMR7SIi3pKdEIZIJmNm+WNcms6BdFOGPNL/R SIPVaAmo4dOv3zWxuHHX8lnHJv1P5oUYq5cv4R6q+KtXn2AUOlEzmg8MKUSDpFHwUaFn cDmy7uxenKcS+mKPzmAJ33NVRK2oLD/c1r07FkqDlx1vb22X3ptkYQHRHjr25J7i4Mbp aVvVWAwLBSI7RRlwb27iJoXyjL+uTinLl/9Mi21ef+I8UCV+s4tZkCaohr3PQBYnlGKB 9PczofSaJ2zbkhDHgNt8odO6qIqle2HXpuOkiDxzurI32eO2BI0D3S5U663IN1lCifQA n+hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902ec8800b0015819f5edc5si6344005plg.426.2022.05.30.02.37.11; Mon, 30 May 2022 02:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbiE3HHp convert rfc822-to-8bit (ORCPT + 99 others); Mon, 30 May 2022 03:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233319AbiE3HHm (ORCPT ); Mon, 30 May 2022 03:07:42 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D69101FF; Mon, 30 May 2022 00:07:30 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 40A7F1C0BAB; Mon, 30 May 2022 09:07:29 +0200 (CEST) Date: Mon, 30 May 2022 09:07:28 +0200 From: Pavel Machek To: Conor Dooley Cc: a.zummo@towertech.it, alexandre.belloni@bootlin.com, daire.mcnamara@microchip.com, lewis.hanly@microchip.com, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v3 1/2] rtc: Add driver for Microchip PolarFire SoC Message-ID: <20220530070728.GH1363@bug> References: <20220516082838.3717982-1-conor.dooley@microchip.com> <20220516082838.3717982-2-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20220516082838.3717982-2-conor.dooley@microchip.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > Add support for the built-in RTC on Microchip PolarFire SoC > +#define CONTROL_UPLOAD_BIT BIT(5) > +#define CONTROL_DOWNLOAD_BIT BIT(6) > +#define CONTROL_DOWNLOAD_BIT BIT(6) > +#define CONTROL_WAKEUP_CLR_BIT BIT(8) Dup? > +static void mpfs_rtc_start(struct mpfs_rtc_dev *rtcdev) > +{ > + u32 ctrl; > + > + ctrl = readl(rtcdev->base + CONTROL_REG); > + ctrl &= ~(CONTROL_STOP_BIT | CONTROL_START_BIT); > + ctrl |= CONTROL_START_BIT; > + writel(ctrl, rtcdev->base + CONTROL_REG); > +} You don't need to clear bit just to set it. > + do { > + prog = readl(rtcdev->base + CONTROL_REG); > + prog &= CONTROL_UPLOAD_BIT; > + } while (prog); Limit to XY iterations? > + > +static int mpfs_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) > +{ > + u32 mode = readl(rtcdev->base + MODE_REG); > + u64 time; > + > + mode = readl(rtcdev->base + MODE_REG); Dup? > + if (mode & MODE_WAKE_EN) + alrm->enabled = true; + else + alrm->enabled = false; + enabled = ()? Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html