Received: by 10.213.65.68 with SMTP id h4csp306442imn; Fri, 23 Mar 2018 05:11:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELtAfiqEiltqeTgoMAQjYYIo4D4vN2a1/P9agT3gZifvhpUeSz49oXOJ+QRzrdfSOj4mjtw8 X-Received: by 10.101.65.5 with SMTP id w5mr15809573pgp.186.1521807117117; Fri, 23 Mar 2018 05:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521807117; cv=none; d=google.com; s=arc-20160816; b=z1E0pjqJ8wsT6PEJ82oeR0YHf+P9MzecjEVFeMeyNjEC3C5c5Fx0e4U/DIef96TATN kpQbRC/+Wk2qUApFI578ACTo77wT5DTophEyvnI5uYFFqwvQxIjhZs/CsGO6qKHRS2tT W42jE0XgMcnjdu9jiofnvSiFYS5OKHNRsQwCd8VkmCTT0cP0CEzTTOHqH+3fibYEBwfy mveLTWqfClKDytSkkyrbAtNX0Qv/H+vpVg6csRu3Td6M0lKfqAe3vOoOz7bKY92lmSDx itWrcwY+arhXe5FwzprcaYTVm/NUOMENrm3b5Q4WWO0KAtuADhPBbNPFBqgtRxcIV5Dh 4QUg== 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:arc-authentication-results; bh=XkMTopF0Gb9iKBbpNNrRHvYoL6EinAxynq1fXDYjUG8=; b=qOCCb0NqyG9Epd379HEpsXvc0iW+A0UlZSse3V4bxVIO+msE/Iv/L4VUdytSP4dF7S VgXbqQOpbtl9ujlrZJgk1rljPHS1/gs7CDoCQQugwW73oM/Hj79ezqzAIbTpvUPzk2tb 8Y4iAbuXZOS54UikKWdPp1izgypatCGF/EUGUUquZf/jDsG04p+3nv61ZEbgKz/Ep/vS /D+b5tl5RpSNrI3cGQtdeEhWCuSL7c9yq6LdjTTelzHw4+SRPnNaTBO2HIItzlNrQwLH w3ij+4SXf/oCFlg/heImKL2aIc5Hoq4I/mMsNDj9e7LoH7JUW7u1h+im3/YR9AFqCr61 SuRA== 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 b7si5899375pgc.551.2018.03.23.05.11.41; Fri, 23 Mar 2018 05:11:57 -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 S1752978AbeCWJ54 (ORCPT + 99 others); Fri, 23 Mar 2018 05:57:56 -0400 Received: from mail.bootlin.com ([62.4.15.54]:40277 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbeCWJ5x (ORCPT ); Fri, 23 Mar 2018 05:57:53 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 79C3420725; Fri, 23 Mar 2018 10:57:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 0E358203B1; Fri, 23 Mar 2018 10:57:40 +0100 (CET) Date: Fri, 23 Mar 2018 10:57:40 +0100 From: Alexandre Belloni To: sean.wang@mediatek.com Cc: robh+dt@kernel.org, mark.rutland@arm.com, sre@kernel.org, lee.jones@linaro.org, a.zummo@towertech.it, eddie.huang@mediatek.com, devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-pm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 11/16] rtc: mediatek: move the declaration into a globally visible header file Message-ID: <20180323095740.GD3417@piout.net> References: <53afbe8172fb1afd809ce9ba1afeda924b9ea705.1521794177.git.sean.wang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53afbe8172fb1afd809ce9ba1afeda924b9ea705.1521794177.git.sean.wang@mediatek.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/03/2018 at 17:15:08 +0800, sean.wang@mediatek.com wrote: > From: Sean Wang > > This is in preparation for allowing other drivers can share the > declaration, so move the declaration into a globally visible header file. > > Signed-off-by: Sean Wang > --- > drivers/rtc/rtc-mt6397.c | 53 +--------------------------------- > include/linux/rtc/mt6397.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++ This should go in include/linux/mfd/ > 2 files changed, 73 insertions(+), 52 deletions(-) > create mode 100644 include/linux/rtc/mt6397.h > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > index d133d1f..015609d 100644 > --- a/drivers/rtc/rtc-mt6397.c > +++ b/drivers/rtc/rtc-mt6397.c > @@ -19,63 +19,12 @@ > #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) > - > -#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; > - 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/rtc/mt6397.h b/include/linux/rtc/mt6397.h > new file mode 100644 > index 0000000..4b19f51 > --- /dev/null > +++ b/include/linux/rtc/mt6397.h > @@ -0,0 +1,72 @@ > + Unnecessary empty line > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2014-2018 MediaTek Inc. > + * > + * Author: Tianping.Fang > + * Sean Wang > + */ > + > +#ifndef _LINUX_RTC_MT6397_H_ > +#define _LINUX_RTC_MT6397_H_ > + > +#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) > + > +#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 registers accessing */ > + struct mutex lock; > + struct regmap *regmap; > + int irq; > + u32 addr_base; > +}; > + > +#endif /* _LINUX_RTC_MT6397_H_ */ > + > -- > 2.7.4 > -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com