Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4493618ybl; Tue, 20 Aug 2019 12:49:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGZTn52+7TDp6o7cxBmamrVOhhECS68LLTotP5MLJ7myFYiJkwQLBmfkmi+RohJg+VJ0ul X-Received: by 2002:a17:90a:cc0c:: with SMTP id b12mr1576737pju.138.1566330582641; Tue, 20 Aug 2019 12:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566330582; cv=none; d=google.com; s=arc-20160816; b=hmX5uqUIKDFI7u8MNEkELweUl+F271AXRwcVvxQpLojobTvAUh+VukfifoOWXaj0Ki 6cm6U64g3kqwOOY/8Knkx6MNpWQShgdyD7ebv//7nIpqLNncezO9q+KTH5y0Lryb6PPj WIojH2ip9WxB9NFpdR3GllpBZvnx788lrL5Ra80d2m/G7AYEZIe0O2tejnhPIy8k/n9W JtT/lUQBisAYABhOEf8on8T0wydCeyTN44fD+kzm6ieNZGF1sYXjGAFM4JITvIraV9Y6 OxQYOR6RB3CyFmcyxD/zIFGDWaiyXyNnLBhuNmHEcwE2Bu24rtblhnH8yxCtAd0psNys Dvww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ctli0WLK1sJ29+ObftcJLlMBeLcVtPN7J4Ssq1TO+iU=; b=dRY75zF4tm34dYEr/wHe+6xmgT54fFOklMPDbUoerNQ7+NTOMb7iPDXKttzI9zW3IX BU9X/XcDiMRF3NVQ2BVHS4A2D9AneVphVG2vGzVdSzr0aWgMfdpIoEKTzbxDKaSV7ywF 5X6PKbUa8Uyw5yu57zNBs5mLmF2FfN70TxBdAkKgUScgxU17WeNBoClW4p4doHgNihTB jnQygvfLJg2n3Q1am9VKk/AvVybz++xHBzlGdZ7TLnnJtrvyO4OAY8bHhAKx4y/ZG3sw 4yX1bcZqwudYff5FIQ4CUcaDqThGU/VGwIRsP3tQSxwq/DRFnl8LZLNUTEwlJbMFNWMB vmvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61si13320741pld.21.2019.08.20.12.49.10; Tue, 20 Aug 2019 12:49:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730649AbfHTTsH (ORCPT + 99 others); Tue, 20 Aug 2019 15:48:07 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:32845 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729950AbfHTTsH (ORCPT ); Tue, 20 Aug 2019 15:48:07 -0400 X-Originating-IP: 90.65.161.137 Received: from localhost (lfbn-1-1545-137.w90-65.abo.wanadoo.fr [90.65.161.137]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id DE91D60004; Tue, 20 Aug 2019 19:48:03 +0000 (UTC) Date: Tue, 20 Aug 2019 21:48:03 +0200 From: Alexandre Belloni To: Frank Wunderlich Cc: linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, "linux-arm-kernel @ lists . infradead . org Alessandro Zummo" , Eddie Huang , Josef Friedl , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Rob Herring , Sean Wang , Sebastian Reichel , Tianping Fang Subject: Re: [PATCH v6 05/13] rtc: mt6397: move some common definitions into rtc.h Message-ID: <20190820194803.GW3545@piout.net> References: <20190818135611.7776-1-frank-w@public-files.de> <20190818135611.7776-6-frank-w@public-files.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190818135611.7776-6-frank-w@public-files.de> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/08/2019 15:56:03+0200, Frank Wunderlich wrote: > From: Josef Friedl > > move code to separate header-file to reuse definitions later > in poweroff-driver (drivers/power/reset/mt6323-poweroff.c) > > Suggested-by: Frank Wunderlich > Signed-off-by: Josef Friedl > Signed-off-by: Frank Wunderlich Acked-by: Alexandre Belloni > --- > changes since v5: none > changes since v4: none > changes since v3: none > changes since v2: add missing commit-message > --- > drivers/rtc/rtc-mt6397.c | 55 +------------------------- > include/linux/mfd/mt6397/rtc.h | 71 ++++++++++++++++++++++++++++++++++ > 2 files changed, 72 insertions(+), 54 deletions(-) > create mode 100644 include/linux/mfd/mt6397/rtc.h > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > index b46ed4dc7015..c08ee5edf865 100644 > --- a/drivers/rtc/rtc-mt6397.c > +++ b/drivers/rtc/rtc-mt6397.c > @@ -9,60 +9,7 @@ > #include > #include > #include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#define RTC_BBPU 0x0000 > -#define RTC_BBPU_CBUSY BIT(6) > - > -#define RTC_WRTGR 0x003c > - > -#define RTC_IRQ_STA 0x0002 > -#define RTC_IRQ_STA_AL BIT(0) > -#define RTC_IRQ_STA_LP BIT(3) > - > -#define RTC_IRQ_EN 0x0004 > -#define RTC_IRQ_EN_AL BIT(0) > -#define RTC_IRQ_EN_ONESHOT BIT(2) > -#define RTC_IRQ_EN_LP BIT(3) > -#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) > - > -#define RTC_AL_MASK 0x0008 > -#define RTC_AL_MASK_DOW BIT(4) > - > -#define RTC_TC_SEC 0x000a > -/* Min, Hour, Dom... register offset to RTC_TC_SEC */ > -#define RTC_OFFSET_SEC 0 > -#define RTC_OFFSET_MIN 1 > -#define RTC_OFFSET_HOUR 2 > -#define RTC_OFFSET_DOM 3 > -#define RTC_OFFSET_DOW 4 > -#define RTC_OFFSET_MTH 5 > -#define RTC_OFFSET_YEAR 6 > -#define RTC_OFFSET_COUNT 7 > - > -#define RTC_AL_SEC 0x0018 > - > -#define RTC_PDN2 0x002e > -#define RTC_PDN2_PWRON_ALARM BIT(4) > - > -#define RTC_MIN_YEAR 1968 > -#define RTC_BASE_YEAR 1900 > -#define RTC_NUM_YEARS 128 > -#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) > - > -struct mt6397_rtc { > - struct device *dev; > - struct rtc_device *rtc_dev; > - struct mutex lock; > - struct regmap *regmap; > - int irq; > - u32 addr_base; > -}; > +#include > > static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) > { > diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h > new file mode 100644 > index 000000000000..b702c29e8c74 > --- /dev/null > +++ b/include/linux/mfd/mt6397/rtc.h > @@ -0,0 +1,71 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) 2014-2018 MediaTek Inc. > + * > + * Author: Tianping.Fang > + * Sean Wang > + */ > + > +#ifndef _LINUX_MFD_MT6397_RTC_H_ > +#define _LINUX_MFD_MT6397_RTC_H_ > + > +#include > +#include > +#include > +#include > + > +#define RTC_BBPU 0x0000 > +#define RTC_BBPU_CBUSY BIT(6) > +#define RTC_BBPU_KEY (0x43 << 8) > + > +#define RTC_WRTGR 0x003c > + > +#define RTC_IRQ_STA 0x0002 > +#define RTC_IRQ_STA_AL BIT(0) > +#define RTC_IRQ_STA_LP BIT(3) > + > +#define RTC_IRQ_EN 0x0004 > +#define RTC_IRQ_EN_AL BIT(0) > +#define RTC_IRQ_EN_ONESHOT BIT(2) > +#define RTC_IRQ_EN_LP BIT(3) > +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) > + > +#define RTC_AL_MASK 0x0008 > +#define RTC_AL_MASK_DOW BIT(4) > + > +#define RTC_TC_SEC 0x000a > +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ > +#define RTC_OFFSET_SEC 0 > +#define RTC_OFFSET_MIN 1 > +#define RTC_OFFSET_HOUR 2 > +#define RTC_OFFSET_DOM 3 > +#define RTC_OFFSET_DOW 4 > +#define RTC_OFFSET_MTH 5 > +#define RTC_OFFSET_YEAR 6 > +#define RTC_OFFSET_COUNT 7 > + > +#define RTC_AL_SEC 0x0018 > + > +#define RTC_PDN2 0x002e > +#define RTC_PDN2_PWRON_ALARM BIT(4) > + > +#define RTC_MIN_YEAR 1968 > +#define RTC_BASE_YEAR 1900 > +#define RTC_NUM_YEARS 128 > +#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) > + > +#define MTK_RTC_POLL_DELAY_US 10 > +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) > + > +struct mt6397_rtc { > + struct device *dev; > + struct rtc_device *rtc_dev; > + > + /* Protect register access from multiple tasks */ > + struct mutex lock; > + struct regmap *regmap; > + int irq; > + u32 addr_base; > +}; > + > +#endif /* _LINUX_MFD_MT6397_RTC_H_ */ > -- > 2.17.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com