From patchwork Mon Jul 29 17:41:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 437F2912 for ; Mon, 29 Jul 2019 17:44:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3005C262FF for ; Mon, 29 Jul 2019 17:44:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 243DF26E1A; Mon, 29 Jul 2019 17:44:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C27E92862A for ; Mon, 29 Jul 2019 17:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=X3PBczyQjgBTN9xT9CoFKxWolu6UBghZiKaxtKw96EU=; b=Se9uuRrU4niul1vusYygZ1ITkZ Y2No5H+Gd2FxSIFCdC7u2ygZiBwTqtX2OqhsrBlpXSTaVGNbhBUld7uR88SMKYnw00fY5uvnBf4GN G73DHWfoGLU0f/AvhPwUGgrrqwGFjFZ5MTSYNYJVi/jsWQfoq3WcOqLxlJXuao5JfGUVKR/v1BpP9 xekRMJVZGpjzF7yb67EwGp5g5qQqgTipUfC8xLdHikNCRFc7w4j0QFitzXX0DAyJFOMYJQ6y+x/st P4Vbi+ZDguWdwf/Jubk0nonMNa170OY/kfDApHofXfpckVDjwoEcyQ3ZXXQ4Nn1lG2ZUmr2iyB/4/ 6h0Oi/6g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9hV-0007j2-8B; Mon, 29 Jul 2019 17:44:45 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006EK-OG; Mon, 29 Jul 2019 17:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422135; bh=PVro0E+XhF5WOC+jt5RKsnaiodARkQhonipO342cKic=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=a2K4Wd62s+szzY4KnX95v8a3uPylx0ZM58ngnXpoS9Qfd7tGAeS+nc8apL3/pKrVc rzapBcig3Nika1PC+40nT/DNcrv/iejh15FJT8uQoWNRRV8sBcXlENx/K6cI1azX9E 19d4xA1lonCskARB3yVhg2aot6HUDMysizimaJGs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MQzUc-1hx7iT0deY-00UHTl; Mon, 29 Jul 2019 19:42:15 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 01/10] dt-bindings: add powercontroller Date: Mon, 29 Jul 2019 19:41:45 +0200 Message-Id: <20190729174154.4335-2-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:B1fwJaU2nRa6wsHeYE+Ck1G5ymij59WA9zN7izr9NXD2iDcJ+ET tinBgP+uGz0GVmyd5yjk0KlWTr3OXXRWmKScuwuC0uNuT787yjXzmaMIwceCNta+ULAjpIn CNzeVKHqVn+uHCqiMBlbMu9A/TSQpICO2LwVipML2ZbJhdNNLJeAsPEnxYdPpm5MSfOimrm sKH/FqqbpE6NmLkZw5NqA== X-UI-Out-Filterresults: notjunk:1;V03:K0:H3RHmJDhLDM=:kQGyR5uCqx62NY4l2JyPgh DH/M5jorPU9FZ6UC4N7WiMXbeIrVYXM47CsfjhhD+cNdgn28ny8b48ON/wnoQFdfMzWfZ7RQx O136Zf7yjs4DrBB6FJdAMN0P5y0jLsnjf1xCfzKjNHR7yXkA26bHjle8Pf+QbGz18osF4mD7g rrwdopnTK4yVwSPgKz8BlkEY7cZGJkaXdloHYeLnCX2wu5ybDHYKxJc4QBnYiMVffVf2dSXxg 7WmP+/dRAX3Q6VvJ9Cpuv6hxnEw2LEkHIkYskhdHN1STHs1MoxCnRY5Pcmj0h8RMzP5f/LbtA 0fULuqlqppyWM2k+Swcm51nBRsBswsVcEG98Mk9M589raH4Eb5T+4IgAvc7LEL11FjP6wqsbn uChpg/Limf1KuwIVdFVmx/aIkAGIGhaCFmJPKm+dYOkKXd7HvhpxqeOlzCOa1vzQ1UZniPhPO gktLgmenlZq2BcWOfMUZ7hFh3WpPuKGBnLOELTvCCgapiMCwTqvyOF7sBYHTPQzK5hskYvTCP ZaPJnroNahcMlZVleQtyCPzc4zfQsPBJrzbkkl7k+/iMnBUskFiY9oIF42XwW6dIOGWM9/0+V eTdTwxmDYzgFYpSULhjIJwyHAKRGy7ckJlCfK9A816Eo24WteKtjO3AZHXX9aJne4Stds5BAC QzoIvyMu3mllCnz03Fvi0A2USAZB+ZG3mWh8yKFnSEMLR9fiOLA7CZklPET/cjYizwnkkUp27 r2ybnVUFt5EPxLd3X4xMUY1KYLnuLxXqtpY4S7UIqPb9oQ2v9yetAVNvycVdNTAK4Gs8C33Kh VPm2Uz3j8BEeSEgCNqw+8s12N8IrDRbHPBnVasoe3K/hLJVUFIrtPCR+xHVuHRBv5N9uh2Vs8 vcuajJBxEXUH507DD5f9BH24BUgpWoKjN7X+R/bPG53Kg+GSV00uQExwq17SUZgDTJCKraFxv 0PxI0NOLjRL2w7I2cVxqCyLmBfpjh1aqgehb+1+eAzRSw4btCdQpBFHrrx/rxUAbBlcSdmWuX OCAnVT4mLyamOnSpH13OihAWYlDYuKOYFfoZp1GPjnOtNBa6Ajh1ANxgMf6btHKohlSVDjUEp 8dJndQolD01Kpg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104302_083748_BEE7CAC9 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl add mt6323-rtc and mt6323-pwrc to mt6397 mfd DT bindings an example is shown in mt6323-poweroff.txt changes since v2: separated rtc-mt6397.txt to part 2 Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- .../devicetree/bindings/mfd/mt6397.txt | 10 +++++++++- .../bindings/power/reset/mt6323-poweroff.txt | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt -- 2.17.1 diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt index 0ebd08af777d..44acb9827716 100644 --- a/Documentation/devicetree/bindings/mfd/mt6397.txt +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt @@ -8,6 +8,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules: - Clock - LED - Keys +- Power controller It is interfaced to host controller using SPI interface by a proprietary hardware called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap. @@ -22,8 +23,10 @@ compatible: "mediatek,mt6397" or "mediatek,mt6323" Optional subnodes: - rtc - Required properties: + Required properties: Should be one of follows + - compatible: "mediatek,mt6323-rtc" - compatible: "mediatek,mt6397-rtc" + For details, see Documentation/devicetree/bindings/rtc/rtc-mt6397.txt - regulators Required properties: - compatible: "mediatek,mt6397-regulator" @@ -46,6 +49,11 @@ Optional subnodes: - compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" see Documentation/devicetree/bindings/input/mtk-pmic-keys.txt +- power-controller + Required properties: + - compatible: "mediatek,mt6323-pwrc" + For details, see Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt + Example: pwrap: pwrap@1000f000 { compatible = "mediatek,mt8135-pwrap"; diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt new file mode 100644 index 000000000000..933f0c48e887 --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt @@ -0,0 +1,20 @@ +Device Tree Bindings for Power Controller on MediaTek PMIC + +The power controller which could be found on PMIC is responsible for externally +powering off or on the remote MediaTek SoC through the circuit BBPU. + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-pwrc": for MT6323 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + } From patchwork Mon Jul 29 17:41:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BF4A1823 for ; Mon, 29 Jul 2019 17:43:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59E4C262FF for ; Mon, 29 Jul 2019 17:43:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D3562862A; Mon, 29 Jul 2019 17:43:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC31E262FF for ; Mon, 29 Jul 2019 17:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tF+dmkwNgHi910HGLpdWM2TUWpXM17FKiiJ3o4GNP6g=; b=J2V/e1si9l+sytRQxpgO156i8T gNLGDJkfvqsMi8jKFitE8QlOQcNCjuRzYFEdKglDtfCBcHEHa2AALgzoDX6i8cgLqhyzuAHd8ROAa JWtLUPWF/HK55otHMTiGNQq9X50AGt3oGY57nvxUi/w90glr65sDlGrNpnXo6hzPXBR8AKUjIzNEY c1eiRxyUNGlYZSMRKHRPq630HQn2Vk/g4IpB/6+/iHdiCBsECzyV+fBQ8Doyl1R00lcnIiSks7GnP vcBi6aGrCINri8PgwR4wGVjiGKEvDd3icc9u7dSOXi3hQy1Yc07yFResFFTw9hIktg72RBLtYOVmR et8XMKtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fv-0006Ib-3i; Mon, 29 Jul 2019 17:43:07 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006EF-1L; Mon, 29 Jul 2019 17:43:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422136; bh=2upA4Eee2eLxGKQpMOKxUWbTwNeRMbtSYCSugmC0GWc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VzxBOSkQ57/fGvyduo8JBaFAJ+4VaF5CN4fW7TY2VDUPAkXvgMAcV3EEXSU8TTIV4 QzknCcyJLENarfrzz7nLk58UoDs17jWocp4aEaE09F9wttAq+No0HgtpWRw8pv0uQt aFj27TlQ8tjwfDcuAN2ZNYmIDJd47SlpJ2oN66tY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LwaQZ-1iRnd926zn-018Gvw; Mon, 29 Jul 2019 19:42:16 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 02/10] dt-bindings: add missing mt6397 rtc Date: Mon, 29 Jul 2019 19:41:46 +0200 Message-Id: <20190729174154.4335-3-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:n2zUh/vBMrR/T/FmmAN+wn7QKL0aiwb8lCVGDcRqmLkY60+LbYp 75Yof9evGGAzVYq9T7To3kmtms+cHY1cVVgtyBTBTTcA6ILiDSHdco6fnRBkBVOFZWOgYB/ +mflzaL6iXpplrBY8RqzW8mD3pso3luf6hoAVRWBqYJr9F133IWFvdnHnVi760Wayt29vUB DFXx+EoY/2zJUHu9L0pKQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:3BCmzlM7TJA=:/nJkZvBc4do4lI0pWVrXDu fHAfzfWinW0B6mPgALHOmP3HwFCiJOmcN54Gq7X+9cPdGCfSx9tCoLpStWPNB+CBR9qwkqho4 r4ut0m4JUYbg+ZzLd+VkDyvISw4LKj/msNspivDKgUC3Qg9H9Zt716kgHwfrzNQXmLKBdoWlX Tylf/ZNz+hT5FqzbZ5TJRX1xoI3ORKdhrHZy4y3BNGB09kuyrwkwrlWM+PC13R0iGFeOP70K+ SINkemcm/T0vK096Yei+cIZyrlt9ZZtet1+664WrbtvC2OwfB35ToHWqT07KVN0L17cruOGi5 8UrpLVZkf8bjOXVwc5gec5BN+e1Jjn8M0PAkIQ1H4yDYAq1AJpTn1Fq0Ip45+BXcffemK9jF2 F/LN+SSGl1bN9GUv+REV1ZX/tEBNKrrEDG6S856a6W2zfOOU5yvi/r5VLiUhsZv/CWi1g8c6J rejZOQcWdZcxc5Y96oCmTRNFdV6o1u+E4uYa402iMDW4WXgvs7LsNnx1oDNx9AvmlKeaA9+h1 OGfD4q0UobAfVJ2/I015fi9efjAUXoK3S0njDCypDdQloHPYjUx0rNW7ND0flKSl5hWSuRR+H dIZrQQkm02s1bI8HQSqivuxxbFdAZo8bpbF2nlevAWDoxKfgarBuihytBUyB62ZSaz6Bg3vMR ZjRofVttHU6kJDhwabkvEb7PU8hzRRTY1p2bjOnogGEhLeYNR8rgCJVzwJZSKNS6nLe3zuwgc dzOSmlYWvMKQdvIE2l4vKPsWqzdJYom0wcVl8/L9gzUYb09p7pu9rWKKOkkkfMIX/4+MBSYHZ mdCMYjMkYyJM1SPPRCgi9QvJDniXokzLN4nqqwnlX904L11+RlPckML8qM6xjEH4EuAex6Cng b0ow36LqBD5lfuzSm5Rjqv9prApeZpbSTjfSKm7IXSRdZJq8rUxtdDmKTHRYDbD4j6zF838sz XYsSb59qYHtTqMrJjn0FPtukG+/Kc5PGenkzXVGBxAvMDpg7YGJLE1GiXxZD46c2yGg5GHYtq oDV0pdXxsrg1/X4PdtqRqhZRpNaTydxnTvfZPrpsiFz7NxGywxIcQSn5mvSKVuzUesbv/Rjk4 V7HMJZgp3cOoec= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104301_374593_A64B1DB5 X-CRM114-Status: GOOD ( 12.76 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl add missing devicetree-binding document for mt6397 rtc in later patch driver is extended with mt6323 chip changes since v2: splitted rtc-mt6397.txt from first patch Suggested-By: Alexandre Belloni Signed-off-by: Frank Wunderlich Signed-off-by: Josef Friedl --- .../devicetree/bindings/rtc/rtc-mt6397.txt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt -- 2.17.1 diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt new file mode 100644 index 000000000000..ebd1cf80dcc8 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt @@ -0,0 +1,29 @@ +Device-Tree bindings for MediaTek PMIC based RTC + +MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works +as a type of multi-function device (MFD). The RTC can be configured and set up +with PMIC wrapper bus which is a common resource shared with the other +functions found on the same PMIC. + +For MediaTek PMIC MFD bindings, see: +Documentation/devicetree/bindings/mfd/mt6397.txt + +For MediaTek PMIC wrapper bus bindings, see: +Documentation/devicetree/bindings/soc/mediatek/pwrap.txt + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-rtc": for MT6323 PMIC + "mediatek,mt6397-rtc": for MT6397 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; + }; From patchwork Mon Jul 29 17:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A2F11398 for ; Mon, 29 Jul 2019 17:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39236262FF for ; Mon, 29 Jul 2019 17:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C2872862A; Mon, 29 Jul 2019 17:44:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8B88262FF for ; Mon, 29 Jul 2019 17:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7Nr+vOpBwWIk6ifsgVmXVILFgq+lXEWEIC5Dokn7/EQ=; b=CkpQiJKYuoSeNJ4d5ayqLlnsQk BtvuQSqt3u+E4xWwnuTr2hnZ9D3vZ32LJ5Y99RtIQf1XSO2SOT6+Iw3JEwGj3beFaIq3uql4iHPQ/ ThRKw1mjZIJY1oT/K2XGWEoIxZaJ+KpQSiwlX8m1ugoHbH8Px1QopR/D1KIRvEIOqdupfrAXi5Tm3 9H1kTp6wZBi647YvMt0wWfaCbepOhJprTwxz3ilNWU6v/zBIw5fZBmuN9OsOC8RAPI9ZfqkVXbGoO hZp96ik+ULHhA4XxOzF1LfaGvKtI1QaVauRfdRY7Nmc+Cke0a8t687NeSB4Hjv/v4kvgRwNuvL+HQ 1llZVppw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9hS-0007fo-CZ; Mon, 29 Jul 2019 17:44:42 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006ED-5U; Mon, 29 Jul 2019 17:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422139; bh=qNdMiiXHqllRvqvxDwWTThTceo0oHJHWqFHI79Z6uC8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=GBIaAupzyNnDjehhzBxXQlAtnvmvRetwsmvNU6hZAYY37mWDMtTYVAmHC0bJTfPIU xQHRMiA/p7l9p08hMHzEKDQgl2EGfqI0Kip/Pt2EJ0E03fcSNHHBDTSqZcA/V6nr15 TtDtNS9mYBg2RhKtHSvcKbXREbz0X9+ryj3dy4WE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LcBBl-1iHH8I0Kgf-00jbCk; Mon, 29 Jul 2019 19:42:19 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 03/10] rtc: mt6397: move some common definitions into rtc.h Date: Mon, 29 Jul 2019 19:41:47 +0200 Message-Id: <20190729174154.4335-4-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:XMa6wxfWSzWhCnhua7hhr4idtdRPBvgDLLK/YtTTdVfl1qoX8wl nSZvPJN/Hz34E1qkJ9ecCx0LqvE2em5TN9ckoWjWC9xjhe1pjBdWJiMVGwdnEIHRER0u/lY FflhsGfQJMmG8GmYpmRAEJIQa05wM/HQeuz9/42jRd1sXYLGQcJagMbf6XB+mmC9JGV3tJj TPcqAONrKZLzGtATWXWuA== X-UI-Out-Filterresults: notjunk:1;V03:K0:QAvRqiJU4jM=:xDnSThfWgdB88F7tPxg7ya WJuc44gAo+tnUznHS4QV/Cfztl/kQxlDeQ2pc/rprS2swyy2QUVvFzbhh/5pjiq8eT9MeH1Je H+r+M0uT3ti6rm2mxMBNQtrFahGA2bZ6b4jdNut2yXm6v2KycNgYdwAG3jpzQuwnjV8RozZ+o 6Nn+zUpfB/uSBZF64DQuHcm6PP8eIoMsOMqC/gYB2I7/Gxz5Th8q3P66Yr/1SOf4zLmWmo0Kj L+a70jAQ6DnnmG1nS0sFxNtKpVSO/p41X34/35t0uhVWPzHXH1h0Wuo+5PYKApRJ5i4eLXZq5 u2Q/hekxypcsRXPKZ+GrnfvsZacTcyzbTKYAQm7zLyZh7ZGzXdZeM2/HHb7uwLdxkXyKL3A3I VdoMkHNdaIwLx/2A07VYC3cVv74X1/Sk4/cNASyUw6XNICPu09D1BXgI+gr1NL7sjrAX9G/r9 GCPbAzBGqesm7tW7iaOLomYY/QtgZBg40gXAxY5fyCrEgGqifIHYY93kprsjZiBrQTd/cTz7P UuCoEHtJIjcZn5We3Pc2HsAZ2H221NaAnycRmqc273I/iXZy72+f0ltu8JQpdi8BvoPf+0lS5 H4ZSGB4suqwi8U3elxDCZegCN27CVtyWCi5G3KUUXj2BLLNHKmJEcq8ooPgNKHXoC4py0kwlY mIIezfcbkeAOU6Ceg4qOttYtMMkimHrf+aYFaJ/Glffu6Cam50Rgm4y0V58IHCI7ljX74EYeW GDBarHs/7RyyEQ2KeceKTl7SoMVee3gr76TahVpmvFiPOo9aABmbJxVZyJQpQ4vhWZw20SEJv TU4Uv8N0B11bgZFRuwCwx4gUpdXt9I2v9tGO78quBn0LUlni5JoWpCJ9lRCnEft8CD4+S3wXH R8uf2GrHb9Rv0kWvNKevOvrjjMXw+Qltc/xu0X1RKwxusaujPERI+Z6/tG5Rgt96UEvNNF9cU DCDzrCY69UHqpM2YYVJQdlU9aoIn6gD9+SP8/8MRIfqOSLztiaqh5jRXC492nQF8EnHl0SEXF /QzgXErVLx9/VY/IMrRPVZMpZyGI6+jL/yM8bJPZuK2dbMHU9G95dV/9oI/ZSuR2L3KggCcei YBVe5BDpqUP9dk= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104301_501927_7F2BF3CE X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl move code to separate header-file to reuse definitions later in poweroff-driver (drivers/power/reset/mt6323-poweroff.c) changes since v2: add missing commit-message Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- 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 -- 2.17.1 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_ */ From patchwork Mon Jul 29 17:41:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C434B1398 for ; Mon, 29 Jul 2019 17:44:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B76262FF for ; Mon, 29 Jul 2019 17:44:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A713C2862A; Mon, 29 Jul 2019 17:44:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B896262FF for ; Mon, 29 Jul 2019 17:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qlUpa7MWxnxapMjfWEdRflEs1RUQMQQj4KF0UiqEp88=; b=p4+QwwtEWao3vzPYkvDEb/riV/ TuVtbc63PCgQnPUD2J/1GdfwZk3OQ56vs3wGFD+kgUzX4BjND9KSJAEgWWuEQu8sMYSuAA1p2LiBT XLuOPmuukUDBTCXC+SfGd69MLIa0YlvNaCTFM5vRNbA1BiFpQQUgFE562wxUPCfppu0vqb8S4HFgU HnScwplr0uzUZgqeM66aVJlgjtZtxh/b4NwxY+BU3iDqMFUSMmxa+9R2UGyCfCsAEklaPRG3xan2U ez8xU60lcVt0qqjcfsiESXN3e+S55O/CP0XY2bAK7ukWezlwaejGrgrrHFGBv1ZytHLXNp2spqN9E /Rpa4a7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9hT-0007hO-TU; Mon, 29 Jul 2019 17:44:43 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006EJ-ON; Mon, 29 Jul 2019 17:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422140; bh=cz5syvrpEDjPh6mN9CRnHY7eSpKXvEo/1iVYs0MU7/k=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=UE3QZ/HI3AuxnxPTzLZelV5IijhJqrgwLxXXJkr+dlV4xblqDMaJY+guBXhyNJKbM 9QnaAgyh5xUDXTP7E+hYhm6UHwREebq74n78zy6mqVOwOJ0o3t+FV0y3vUu2QolNPH CeFLmAV2pHKyC1n7wf99v/CtoHVAYsI5boGZ+j4o= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MIuzJ-1hpfcb12fR-002bUc; Mon, 29 Jul 2019 19:42:20 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 04/10] rtc: mt6397: improvements of rtc driver Date: Mon, 29 Jul 2019 19:41:48 +0200 Message-Id: <20190729174154.4335-5-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:rzp9FkJr7EadzfJs3aGYSULhKPhkKTUFIps4gv1ZB118If5DGcc oN7ccU4JkKglYIafUY5Iw4R21eEKa+ARpT5mTm+1UY5nfJxJtUidwjMw7Me9ShjbhuGg820 txw6meSqZlpmuTchydkn2WT3Mdc43ViwlwE3stQGtFUHvdWzf/L1IYGPhoxljJIK2Rib6kM VVYfP2iDIuT1BPSH5RPAA== X-UI-Out-Filterresults: notjunk:1;V03:K0:b+GGDEa6JdU=:kzWlCHr/edMNuIhJ4Un504 UxAyYga9K0wAFFieJVzKKo+oAj7WPsIvUkpF7/HHokmY3b5QBL9K/+qh0nO3Ic85U2VEj3eL6 bvYX55k3BqtB7Z0qOWvOQM9TvFm1XljcVIgesqWghZFKZ4lJog/Ow0JbWhSOkVp6PZTwrfA9e QUaJvWW3bXkVB7ymmTzubDb7hzNhUfOrpnUTU8syihLVbTdPKdRJpQJbDxtidsjHCljzTLfRt CWfoLN3FdQ1R4VDVBlP6CxxprjvQnLl9dtaEvn2OkXviPleYfYfEnDLSzyGU9Nj04Z6rBGSrw K8ibuv/7ao2rQ2x8k56JgF+hArKRKD9hHG1O61u7mVOLVZOwXtl3rI08Br90bCgXUXUcSWThL VwiN8KfVPTJAkqGNHH9aNd3L6Or9csNzHFKEg/LG7CwGEMPkF/3L936W2eZuA9FdyKu19osZb 09JIq9UmF3TcyO8vhl2YYWtPufP2JF1K4iWkowHqVyNcvwwT/akyHvDvEDn5c+gciYTHsF3kN IhucGCaAKmZEbqUy/B7rrooqX3iWFI3S97W0+tzyJlvwxg6rIBNxjuQ2e2ZxJfZsO+ALZrBBt Nrp3MoSLxIbyEClZr5kzyDYYfw8su95YaF3WnBcTsL5fsAh2Jn/oNzGxdBIhctHujNxrxCx7P pmlTRiRGCAA2O25031jAILBcqqbG4PMEigbX/A49ZnJjXrr+L7lCoLdlt24RBEl+N6XypqiGu XuqiVn00LB+Or4wLkgUlO3FlW4vqrJBdhl0dk3tk+YJ0/QF79afQcHgKhG9qCstxX4va+BDoj HZNbLFlQOxbFlTiqXyrCJVcEwKsA0aOo8iMT5JBb77jGNjWVA8k21Qg53KKchpYIunnlH6rDh 0LqJYMNEBbJ8IfcXvGPdKemItCliPdbyYVnd1FsqPAC+wizNfH3CJ5Je7iBup12xF67hUbsXZ I2+0H7Hw9BuvOmHPc5JwoWJvf20ol6iC7KuozF4VrCw+WzrcfnZQNOQmWRL+l0q/wr05GdHsI o6gceydIY9pVM9gnexm7XPu9gLxxlKs/Sqf6ub6FnXNjqqtL2IwVQFmFOsZgHauNmzl85W55o Cmw4BiAgb2g8nY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104302_083069_1E48E92A X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl - use regmap_read_poll_timeout to drop while-loop - use devm-api to drop remove-callback changes since v2: - fix allocation after irq-request - compatible for mt6323 in separate commit => part 5 Suggested-by: Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/rtc/rtc-mt6397.c | 51 +++++++++++++++------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) -- 2.17.1 diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index c08ee5edf865..9370b7fc9f81 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -4,16 +4,19 @@ * Author: Tianping.Fang */ -#include -#include +#include +#include +#include #include +#include +#include #include #include #include +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { - unsigned long timeout = jiffies + HZ; int ret; u32 data; @@ -21,19 +24,13 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) if (ret < 0) return ret; - while (1) { - ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, - &data); - if (ret < 0) - break; - if (!(data & RTC_BBPU_CBUSY)) - break; - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - break; - } - cpu_relax(); - } + ret = regmap_read_poll_timeout(rtc->regmap, + rtc->addr_base + RTC_BBPU, data, + !(data & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret < 0) + dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret); return ret; } @@ -266,19 +263,19 @@ static int mtk_rtc_probe(struct platform_device *pdev) return rtc->irq; rtc->regmap = mt6397_chip->regmap; - rtc->dev = &pdev->dev; mutex_init(&rtc->lock); platform_set_drvdata(pdev, rtc); - rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev); + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); - ret = request_threaded_irq(rtc->irq, NULL, - mtk_rtc_irq_handler_thread, - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, - "mt6397-rtc", rtc); + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, + mtk_rtc_irq_handler_thread, + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, + "mt6397-rtc", rtc); + if (ret) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", rtc->irq, ret); @@ -302,15 +299,6 @@ static int mtk_rtc_probe(struct platform_device *pdev) return ret; } -static int mtk_rtc_remove(struct platform_device *pdev) -{ - struct mt6397_rtc *rtc = platform_get_drvdata(pdev); - - free_irq(rtc->irq, rtc); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int mt6397_rtc_suspend(struct device *dev) { @@ -349,7 +337,6 @@ static struct platform_driver mtk_rtc_driver = { .pm = &mt6397_pm_ops, }, .probe = mtk_rtc_probe, - .remove = mtk_rtc_remove, }; module_platform_driver(mtk_rtc_driver); From patchwork Mon Jul 29 17:41:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 453C5912 for ; Mon, 29 Jul 2019 17:43:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33466262FF for ; Mon, 29 Jul 2019 17:43:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26B862862A; Mon, 29 Jul 2019 17:43:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 652CB262FF for ; Mon, 29 Jul 2019 17:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sBMYowHVU4q/YQ7InTxe9mtlrKeK0UeySptqdgWKvb0=; b=a/D0yGd9cupHSVy89lGW4OCJVd Zd8ZlHUT7lOT73xRwZvIs2c+2333OR+OBRdl/4ovjrDynN740CZveHpy6ZM2ekim5IfAg+f92QGZh BIRLRyTnRrrp0vHlxYZ37hgKYzdAMXK1DCO0MGOhXIhA6WHw6UIy5/uviVcb0rsZiubIbkS4RaXje 4RkLLVCxarWzhNt9UZ7SY80XY8RzaI69qPSH3yGExkwaXR+K4HoSJuXe4seGUBoH8EVqqLujWNxm2 kv0TjbEhc9qNE9xrsJE4w5CxmC/MEg38gRXpKo5n/K0OK7gKAEgJ2wlAknev9F3DOEYyPNXGF3pvz Qt4Ilv+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fs-0006HQ-Re; Mon, 29 Jul 2019 17:43:04 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fo-0006EB-V1; Mon, 29 Jul 2019 17:43:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422141; bh=dzo7VpO1uUdQBSkujY0kbWJNhQ71gTV1phA9QbhtsCo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=UmqJim9rhKYYI6rg1gxZHvdyPwGur0+DZZ0Al0NvImxc1/42K6ZznDtK5I+UE4FkU CH8Ckn7NSl+PE8DYdPpn7MBOuz0sCuLgopubbWdHfSp38AFPj3TSaKpXnzXJ1Fnqv6 qGVQgfRn4OjBkq4blGyemMlReFXIznQ/sfs7N97Y= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0McDl1-1i7tEI19k7-00Ja6q; Mon, 29 Jul 2019 19:42:21 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 05/10] rtc: mt6397: add compatible for mt6323 Date: Mon, 29 Jul 2019 19:41:49 +0200 Message-Id: <20190729174154.4335-6-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:wxxknIib8Ozn5fRGGdL5blyAR19Ib6OBg90MqLFfw8GTFHxWpjh Qpy9UZvf36GuixWQCNxGEoRPdgoZMsujvnPVmdCOD317NbzrIihWrc99GLDxCHitJUkm6xA IyETGHnqpx3lPWjUznCNCTlZmhEeVBSt2ZoqibwTNq8DsS+YUcdk2WuwgfoyqNsK3le1Fnh 5ZfPi2l+Qp7hdiFt4pXzg== X-UI-Out-Filterresults: notjunk:1;V03:K0:xqnkkcUrSzE=:v6qNQBXYEiH6f/XVCnuvr2 Gesj4iyGIi6cG6nBK0kuG+DpbOpg/f8oKKBF/rFtG2+8g4id+v7+lRnL7RcjYYPFLjHJ7tWHe PeqAG2j27WUWDHighouBhLbZ6biSQ/Tn+ueFOmy8MFjOHTwi6UQ4w9a8n1DNSdUpatK/eoaVd dmVpOS95YcBate5CavOxcMC0BSsZCpOCaNUrYjc458b+Bi4ZV4GDNSGG8yioeeXGDioz0N/Eb dUN4haKMwS5Glj5CNgJgXEbNVmFwflqZ3waZEe2Or82L0PSLNs5jWd0wL6k7ZGpKrI6+RDUtT x6VM5IftuUAEiEqYV9eXbkjtaLsYtZ9RN1+0oytQBbpjc2+BH90fXx0OpCdZAdmCyLMeX4gtn fJw8oF4UtEyB8TbTKh/3jmYPsQ5TTrGCp/tUCdpIT1mu5ZCc62R/b9f8IlHykv61a66hXArHM QrnX/FEPY4JBYb5v03ORDb6negchM0Hs3jqal+p30/txIyunne+/166uvTixFDsxzkISP1TtI aGzzi5gXp+lnXu9OLY3iw/sFrAh25B7v3ThQHsD8ZWIHYk8ARLkRGCjXzWLhv8wf8Vegnhe9h d8Bi4pjMLf/tQzLt+RII8bTZEa2Fg2dK6zb0ZYdBeZrfIkCvDaDOGyH0x8aL4cWQ8ttA3G8qb YWrpLtI4d5em3N5WyA96hjaUe0dgpEko+gCrNraeqxKHuW25E7R4uiEZKlQDOi/ea2QGPpjyv UXYeZsRAav+t9wU6CYqVHbUWS+WXgAD1c4u+Jo2UjOzB0KDK4VFU2EkSihtEYGRj65eoPFq6m thbwC09b7Zr3jPEei+aKyls+h0/uo+K0nA43z06nPmSRZXSddliN0GR1n6pYNC6mz0ETM2FKM yMRfi8DR7+tezV09FPIoeQS5C3YvuvzIZHRVBw8mZl9VvJnUxjR9rXLe81zK8mgJ0uoYaApD7 LRDSA8YfxH4PeYs38ZRck79RQMM9ufG4MLhlDD4zeP5SVYyLLmfcB78+eOQ1a0AvG5vLHmCq/ 83/Ib4+NzjIB4zSmTvledXS0P/ZzE5u+l5m1QwtYG3PwY2Y7i+c/gCleFvPmLi6ucQMgRXu6f bcz9JphWkQOuSQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104301_296901_13B3A3F4 X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl use mt6397 rtc driver also for mt6323 compatible needed because of different rtc-base/size see part 7 changes since v2: splitted this from v2.3 suggested-by Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/rtc/rtc-mt6397.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index 9370b7fc9f81..21cd9cc8b4c7 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -325,6 +325,7 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, mt6397_rtc_resume); static const struct of_device_id mt6397_rtc_of_match[] = { + { .compatible = "mediatek,mt6323-rtc", }, { .compatible = "mediatek,mt6397-rtc", }, { } }; From patchwork Mon Jul 29 17:41:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EBEB912 for ; Mon, 29 Jul 2019 17:44:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EE24262FF for ; Mon, 29 Jul 2019 17:44:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 223902862A; Mon, 29 Jul 2019 17:44:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B5D9A262FF for ; Mon, 29 Jul 2019 17:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jqOZ66bnY8SegS/9chdiQOeQ5Tc6GvEF/RdRsmi2YCU=; b=UCPRAfOlhJkNEtP6eo1Hr2JM9+ 8DgALmgKGhvQcNGMPx3JfCmRJyzSf6ZAPRPgmhw0lphWcyCg+1p6raFNG9h3z4DKoML2GycfVclxw 7urZF4YZU7QtdqqkMtBJYk29/0Sn21itvxeykvwK4di/avjkcsPtj/R7adHr2H9b1lraE7PO3IA7T KDPZhWmOtbsU1JTLNv68BhJShGLBJLO8AdCaJsAICxbXKWdAMLoog6w+OEvdLrcd7X40NGBOhBNM8 X5RNUnk60P0k74DvAw0vPpRjLR24ZH6X/xbfiO98N8i6G5MCNpyE2Nysmet3bUYTLGu/T8m/oZQ5e LxlHm8Pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9hP-0007dL-3O; Mon, 29 Jul 2019 17:44:39 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006EI-PD; Mon, 29 Jul 2019 17:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422142; bh=Wnnz+hi8y3tJujc3hWEm/IcLnQTjhjL2xa9xcuHyzKk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=FfyhephkYe4DRdaN9w0q2KGd7KBz5Kl/nduMUa+jjfyznWLXupDAPLwPA2fZC+z8v kTzTAaDwrgbp5X05rsyJRG5ILIt1GRRR64bFoNvD4K4qWLw2GqTfOnosA2dWw3z+W4 txPUiJ/4bidMlThsHBRvh1QUOR/E0tX7gwoBzzu0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MNZgw-1hl0mi23Cs-007GSj; Mon, 29 Jul 2019 19:42:22 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 06/10] mfd: mt6323: some improvements of mt6397-core Date: Mon, 29 Jul 2019 19:41:50 +0200 Message-Id: <20190729174154.4335-7-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:9xr+xz6oCi8Hq4CxtCXG8ydc0wfU5FupCf1TxOUhXy6Ecocb1fM aSVn8md8+cUGLjxd3vi917JGfyikoDSJeei6MChESdK7Jj8dqbSE0fTobO4F6TIS2kX9rX1 bPqrizS5f4gfTyT4O8PsAX+IlwXuqefq3O8E3APcwZ9xot8tXdy9BR9x+3gfmVOXOzBoMDQ +G36n671GmPttm2gsgkgQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:UsEvIRAap4I=:ImFGOhnDLWESNcA1tn3e5B qa4DdURE/2MH5X+YbFL1qkr2uBiNool0SuWPHiLFYJ8txoCdqxQvyTe75X1G0bvFiJwjZluhy ubyGGi2GVNn0lQ7k2QOtsmBvgP3ob4t9ehHNW63Fo6kF546PyhG+fu5HAdDDtCkeTrg+jKyhU OSAKKgrT6DRiDsocSWyvoz9gDqWFJr822IGt2DhMCHqLt6/ebu/WblKVAByYJJzWbYy/FXNG1 As0LBu9IuorSfXIE/NU2/9NjKe23ZosC9grywzd7h/eHtPR2NGoMrN8n44eLUwRzyK/44nQOY IoXQA7VyhJ5YsyZhP8lLI9ZgqFfURg6SYNSJs3XZWUC+NPUmAemhVJLm9u3Ysv4PufLmvDct1 blp5Xs1akUj3pduj5mvC8zGVC3YyFHI+opCm1r6ZoqwYxF4fLEJ2TFGXeUyUVkPurO3ciVQkl /dFSOlLTe21+5ZUSi0+/ttZnVuQ8HXBFH0/yrW1pKnLEVJ5r0e9p74fb0u9hSOPkX5hs9FHxk Vf+pXxwyVY4CP6v3XhbU9HSBJ8Gf64ktFEVmb+RcEQUGNVEMSPvE7wP64r9mbKV30koIimJuD jVOoAZWGycFuHPuFmu5simcTCrrk42BnO3aRXY9wrSZA1ZFEeOJCr+du6N6+xmKxjdEoi+8Tb v/9feww+oQEmF9tl74of1kh2FOLk2rh3YZEiZPSLtDRhu5EFSZ+BgB2JWk9vY84WM3uVZ44rY TjkbEFH3jbVPG7Ogx2EHWavvOl89BoaHo0izGSEkhvfoLkfsmeeo9jMP33zbzW+zSFPDcHEWM KTvVqA75htmhR8T9lLYa1I/z6FtdRzlKTrEUKFBZtyQeyfRbLQfkPC/BgPrIXhhtU0fBDwOi3 bH1NpIeQ+U3/ceVV/9ixyZUsJ1vtx4UzKq3QsEO8l5n7dMdUFIatsM12u5Tb36Oervu7giv+O 5JRU5uOZO+YcUZvP4Lzi3kdpXQyvvG+m1PRpqBFJoLVtQVBE72/2EGuDDBraczlrzpbog4Fc2 XvjOKXR6/hatReNJp8Et0ESRVGXya9JiC+CEb7oDRg6pnRA5a8pwYQVi9ygKLp1JXNuEt0dxO cKDLo59U6DofOA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104302_111353_BFA6D355 X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl simplyfications (resource definitions my DEFINE_RES_* macros) changes since v2: splitted v2 part 4 into 6+7 Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/mfd/mt6397-core.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 337bcccdb914..5f7070267c9a 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -1,10 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014 MediaTek Inc. + * Copyright (c) 2014-2018 MediaTek Inc. * Author: Flora Fu, MediaTek */ #include +#include #include #include #include @@ -23,16 +24,8 @@ #define MT6397_CID_CODE 0x97 static const struct resource mt6397_rtc_resources[] = { - { - .start = MT6397_RTC_BASE, - .end = MT6397_RTC_BASE + MT6397_RTC_SIZE, - .flags = IORESOURCE_MEM, - }, - { - .start = MT6397_IRQ_RTC, - .end = MT6397_IRQ_RTC, - .flags = IORESOURCE_IRQ, - }, + DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE), + DEFINE_RES_IRQ(MT6397_IRQ_RTC), }; static const struct resource mt6323_keys_resources[] = { From patchwork Mon Jul 29 17:41:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 038E7912 for ; Mon, 29 Jul 2019 17:43:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7D16262FF for ; Mon, 29 Jul 2019 17:43:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB07126E1A; Mon, 29 Jul 2019 17:43:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 83CED28640 for ; Mon, 29 Jul 2019 17:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6tRGcbfnQKixDXxphJ7rV+LvrSJs8ihtbpJ9WLMklCg=; b=s+7LJHzeYIqfdtKYynSX1PFjQK LlBuXo0efXcgQXlVB+PDxOs8snsbhcn4NvlB7pPwXBk1Xms2bnKHPiw7QkmfR6xdXooXfDmBNECTU Ny6jqkhRTyHJ25J7hakTr/dQZEdkoLRHrOC9148lmrkEbZzbpc0AMe3k1z/P/6kJr+wZ87AJxb4DX e1Yui9NaSqxroXE2Ect57/MV1ikgYk0APwDKDNFt0R3ngveS6Yspjr7VDiIsfGE3L3mzY7zATT+63 VZDHtj2v9nB3z+aNEE6kO6HuXso0ytrnK2AKjaQ7zoDzukBf+M6xwdQe+y/NwsWepZqLv77Fz8BUn fhu85dwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9gY-0006tP-GK; Mon, 29 Jul 2019 17:43:46 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fp-0006EE-23; Mon, 29 Jul 2019 17:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422143; bh=uoSEstO7wh+z/Yh5O4xemCJ/Lip8M0+P7e9/vs/uBqg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LUYzoyK7AqrnAmb+JoOAKe6C62uiFNbkaRfz9LRBUHcaNbbLwpnqwttQbQqmpkF0g 1s5F7KynXRT58c+oaT13Z00UfOq508HvgXf1m/0a3GjtNfxaztYxmi4OqNLm/cGMrW pgmIqMjUdc91tSN5wzB6dCI7EX0oaPwGws0aV0Lk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LzskF-1iV71A2pwh-014xXw; Mon, 29 Jul 2019 19:42:23 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 07/10] mfd: mt6323: add mt6323 rtc+pwrc Date: Mon, 29 Jul 2019 19:41:51 +0200 Message-Id: <20190729174154.4335-8-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:/8/fLbWdSh3bVNpxmnpL3FPeT0+linP7Us78MAvnUZuQdGm5VkG JCpRlGkofnBlmrzQndWukonLRDLXi08x0zDn1J2XNV36jNGQW6hd1+5DfsE/9deZ0bsiaMA edVYQT2hdUbxeDb60rreTPNXvSJK/NOu196puTcD6SRN/wJAMbc4VxPi0BzC0WTQRF39r0X WD1BP0vy+5EW/qzQ+Ojwg== X-UI-Out-Filterresults: notjunk:1;V03:K0:Dq3eJEN+210=:q2LebVnxWDyoNhAxtkTf2Y +9IwdSRG7/gRTn22h/ok2pRBgVfTwU1TmELeJPQmoQ0DGqMI6NaFOLyCrVgT2bcnId+G1Ft7i IXtNiOHfaM06LuVwQUAZCoEZENr90Lmd9aymi9DMhDjetx+F1fno4vKDOPaKiUlcmOaUbQNN3 YCH/EoVoPOoGuvhaPvEtfSGKARshmEWVmFEGagr8Yze9qNWluOmMDyQ6NpXvS3g1gQHfHZwli PcpMOeKLdtvStE0x03reIA8Ma2Q6wTX3AqILxFpMUOksLsh8QxEJUHGlf/2L5P/YmDlAVESsN FoLWBu9zxex0dQUtlS60C+ha1FuczC1xntVCPw+qwbYE3HDnp4Lvn7ZiA8qQmyTeqoASOjDPO Naz0f0rVc57ItsDJFjAprh3obonT9WHtmuQc3017/DQoCx4O/GPS/TJgs4/mfL18WMcMf8vN8 S3b8egTFabdqYWUu0wRTiSrlxc1zsppxQHaB4NeTylh1IRdxYo07C9NbcNOyxFpPg0bGbOMNS PhEfxl6jJ1EafnbxDo5wMcSEBFl58hcWTu8Z78VDhPWEJvkqC62Zf/juxT5KlRE4cVm6WYs+e qfiMQyD9Xa1vqC87EAQNNRVtjI8wVHUwwGvl4RkCV6xhL155YxdfCRGM65WVvC9x2u1vcSlw9 NRpHOknBYtHL067Vu5gRVBXKwBdHAVLGwEF+vxW0J3XNLRwLlQOf8a274YXJyvrRZAKk1afTg roSQmVKesVkl9U8RHuvYQbMO/AEVYvYrbj6sRFVOHe1eWk6gROBBXWqCdfddYpTqHNCraQCyU G1MbEO4OUyqttPWApGg1LUptcoa3RqkPbPc2FCd0rftFqVmiJ1+fePbfLoL0L6ShvaapudN6q Ux7VPUnCNkVgtMMUWiymUuoOx8V9OYDoODl7RgW0WxXPvQ3q64qJ/5GCAPuAhvyRfvR3EGKvm 6lvgR5z6trDR4Nc9YarQW//4jsXvJvmzkv5BgJ8EYi8HSI11p0QHJUBz6oZkGMmtAKVWtmsTh LKWtjGkcFuYwZVXx/JQ8GEOkHl98NLAExD5GiQOjWuSoQNo9gf6mGICPQaL0iRtJtD18PDOHi /MMfS1tSjmIsqI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104301_394307_D3248FD0 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl add entry for rtc and power-controller to mt6323 changes since v2: only splitting, second part of v2 part 4 Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/mfd/mt6397-core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.17.1 diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 5f7070267c9a..a4abce00f156 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -16,13 +16,24 @@ #include #include +#define MT6323_RTC_BASE 0x8000 +#define MT6323_RTC_SIZE 0x40 + #define MT6397_RTC_BASE 0xe000 #define MT6397_RTC_SIZE 0x3e +#define MT6323_PWRC_BASE 0x8000 +#define MT6323_PWRC_SIZE 0x40 + #define MT6323_CID_CODE 0x23 #define MT6391_CID_CODE 0x91 #define MT6397_CID_CODE 0x97 +static const struct resource mt6323_rtc_resources[] = { + DEFINE_RES_MEM(MT6323_RTC_BASE, MT6323_RTC_SIZE), + DEFINE_RES_IRQ(MT6323_IRQ_STATUS_RTC), +}; + static const struct resource mt6397_rtc_resources[] = { DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE), DEFINE_RES_IRQ(MT6397_IRQ_RTC), @@ -38,8 +49,17 @@ static const struct resource mt6397_keys_resources[] = { DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY), }; +static const struct resource mt6323_pwrc_resources[] = { + DEFINE_RES_MEM(MT6323_PWRC_BASE, MT6323_PWRC_SIZE), +}; + static const struct mfd_cell mt6323_devs[] = { { + .name = "mt6323-rtc", + .num_resources = ARRAY_SIZE(mt6323_rtc_resources), + .resources = mt6323_rtc_resources, + .of_compatible = "mediatek,mt6323-rtc", + }, { .name = "mt6323-regulator", .of_compatible = "mediatek,mt6323-regulator" }, { @@ -50,6 +70,11 @@ static const struct mfd_cell mt6323_devs[] = { .num_resources = ARRAY_SIZE(mt6323_keys_resources), .resources = mt6323_keys_resources, .of_compatible = "mediatek,mt6323-keys" + }, { + .name = "mt6323-pwrc", + .num_resources = ARRAY_SIZE(mt6323_pwrc_resources), + .resources = mt6323_pwrc_resources, + .of_compatible = "mediatek,mt6323-pwrc" }, }; From patchwork Mon Jul 29 17:41:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11064309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B54813AC for ; Mon, 29 Jul 2019 17:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF05F22AFC for ; Mon, 29 Jul 2019 17:45:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2E6D26530; Mon, 29 Jul 2019 17:45:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6840122AFC for ; Mon, 29 Jul 2019 17:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iCLCOPxB9EySJ2PjplM7AbmjW5M89wkNPllwgXzZqHM=; b=Zm2Mp4z9C6B7H6LyjogiBdb+Wl hpk1a8+v+6t+b7z4Uv2Th3uWJ44AO9oExYy6m7ZBMj71uXBWtd9aVNNJV/T4iC/dwUydITbAVC1iG CulZiDV8+Em+wUj969K4/v2V0NO19ZgPgYiGCZoWy6d600UDW9DiFn0cb8ZnJkncd+MOJyIaG9glb q9zaPjQhNIMHZWzmD4GZF8hzZ1gwsJ02UJHYB74bzHrMCe4FOJM9tzaZbCOCyED3HO6DTiqrozMpT uSTiNM4+q9g7bNEbiYrzU15eni7t1DY5orGHPc1mLqU5OQZ+JuPEvHahkLABFnUn/JNy9fenHtdWk cDO8jzVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs9ib-0001RI-2d; Mon, 29 Jul 2019 17:45:53 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs9fq-0006Ee-5r; Mon, 29 Jul 2019 17:43:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1564422145; bh=IQzg9EyoySG6H4o6CVx/5eexJboEaGPQ5QZI0KyNPCQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=RrZ4CrtFTBQNYvUzgR9Dtse7jW63iZXYTqLORArKe1484BP3GSV4O2iN9v3Enue1n 6GOriIU1G/LQAKF8+cVvoKytfPyVeCohVjeO3phWQ5mEx9EwQpDJ/PuOLMOXp8ctQL 1s5v4azkAHVMPEELDdluc2O0zfsrjqTetM7kUaUY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.76.97.79]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MVvi4-1huNgW3HHk-00X0Vb; Mon, 29 Jul 2019 19:42:24 +0200 From: Frank Wunderlich To: Alessandro Zummo , Alexandre Belloni , Allison Randal , "David S. Miller" , devicetree@vger.kernel.org, Eddie Huang , Greg Kroah-Hartman , Jonathan Cameron , Kate Stewart , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Mark Rutland , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Ferre , Richard Fontana , Rob Herring , Sean Wang , Sebastian Reichel , Thomas Gleixner , "Tianping . Fang" Subject: [PATCH v3 08/10] power: reset: add driver for mt6323 poweroff Date: Mon, 29 Jul 2019 19:41:52 +0200 Message-Id: <20190729174154.4335-9-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190729174154.4335-1-frank-w@public-files.de> References: <20190729174154.4335-1-frank-w@public-files.de> X-Provags-ID: V03:K1:lAFcOh6hKQK/d/CpvNwJob/kBICOSBOuC3jHGVTAdVuixRcIcXT gbf7IdjrcZ0nIVwA1WOU7BcAdnQJZHmWwzUrQHkqXWy49zCuFBOS/zNN37O1OHqW4ZQZ/H4 QCy5LEL7ztAHe7QA6+4PqGgeHz4Q8W5vMW7HJCk7fi3E2W8+XVOH6uO05brTc6APFvA+4PN 8YZkIS5mBxvUt/Mm5XHFQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:m7XpZVnB5uQ=:kPjlBRlqekAluyc50aSZer JpbjYWy6IB5v6ZTaxxu8LmdtHAQNE4cw+O8FiuJe8Kv+E+0vqnxf4/8CKJgpWt55t65iXNcxR 7cEOXAnjYbbjVnqtMXbUaA7ZytGshaJ9sqCbi4igKxkp5mVqDAq3BGzJoUDbOM5wdDTj3oN/i zVRfP8yeLOGFTXy/Ne3WqYk3POMJj5+2VkAa+uitLZSi3S0L1/J4+rnBPNtPWC3MtuSj1H9dN U4WL7V8Ccf0zmKjtv1eUC5rnq2hUNKWdYaUxObRY3MkCxQTP/vLer5K0M9QKhMuuoBWMBBKX1 cNJ2EMhOz3Yj+ruT38gaJi3t/zYxHXNvdYgmsKlR7zvLB3l7bodH1vGISAs7ATseIflEuatnK bj0lVeqP7QA607OVCxcVLjFUgh+sx03m2iSlNAlh9OcIvTBohGGg13VzKVjlSd60NB/CP8XgW Lb2wPyac3Px3HsgScbYOk3vOpe3T/wLP106lv9+Sk9ROAUBYiLhaipgsfDsIb+ixLYlCol0sP tkoP2Ryk/zl895ryIYXS4LF0Xe4L9PZoQJQA37/ujyoqwe8V7XzZJcUhPu2/fdIpD1XkJCCE8 iGXdh3YueMxu73mN6npkDARsGeIYgOcEvsrKk5FdjaQMNKvGdstBYKZYEIjRzK26XdUUeL/iT GSOJ0OB5EZgPCTDw0xAiSLN+NBOlmY23z8BMNfe2rQRnIwYJTMeqpGJD8IkqfFI43TrdZmq5w ULHUpmNYWu/s/ehnvenYBW7oLBAVLjD7MvstNGOXIgTlZwtzjWR3+DzWlseFMPwCahwKdwKZA ImgmxS9b/67QIfl2SwAnds4y37cFVtFcR1pxr6P5ksIsrq0EDsq0YLuGZKPBS5OqlAFFFPo0G Tj5F3X9ncLu7to7GlrIMyaFY3mfKjPluMkqE1x5y+JwvM/shKJhmInQu8IzU7NlO4sC3Peo2o jZTrxeGGud2h3Z28uUfFAWgQD8S/puhabXW9y2ffJq4N76j4lezZvIxTAO2fLC1N5vB8mntj9 E2Zo/CS7lotcUS4ZTJZWiMGB82NsvbGm3XFPwBuNZOl+QI/1oyQBDhRLlmrhB+FjwJ9qFGkYx mOveQc7kz5uCn8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_104302_508909_F44CCA61 X-CRM114-Status: GOOD ( 17.21 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josef Friedl , Frank Wunderlich MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl add poweroff driver for mt6323 and make Makefile and Kconfig-Entries changes since v2: none (=v2 part 5) Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/power/reset/Kconfig | 10 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 +++++++++++++++++++++++++++ include/linux/mfd/mt6397/core.h | 2 + 4 files changed, 110 insertions(+) create mode 100644 drivers/power/reset/mt6323-poweroff.c -- 2.17.1 diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index a564237278ff..c721939767eb 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -140,6 +140,16 @@ config POWER_RESET_LTC2952 This driver supports an external powerdown trigger and board power down via the LTC2952. Bindings are made in the device tree. +config POWER_RESET_MT6323 + bool "MediaTek MT6323 power-off driver" + depends on MFD_MT6397 + help + The power-off driver is responsible for externally shutdown down + the power of a remote MediaTek SoC MT6323 is connected to through + controlling a tiny circuit BBPU inside MT6323 RTC. + + Say Y if you have a board where MT6323 could be found. + config POWER_RESET_QNAP bool "QNAP power-off driver" depends on OF_GPIO && PLAT_ORION diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 85da3198e4e0..da37f8b851dc 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o +obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c new file mode 100644 index 000000000000..1caf43d9e46d --- /dev/null +++ b/drivers/power/reset/mt6323-poweroff.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Power off through MediaTek PMIC + * + * Copyright (C) 2018 MediaTek Inc. + * + * Author: Sean Wang + * + */ + +#include +#include +#include +#include +#include +#include + +struct mt6323_pwrc { + struct device *dev; + struct regmap *regmap; + u32 base; +}; + +static struct mt6323_pwrc *mt_pwrc; + +static void mt6323_do_pwroff(void) +{ + struct mt6323_pwrc *pwrc = mt_pwrc; + unsigned int val; + int ret; + + regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY); + regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1); + + ret = regmap_read_poll_timeout(pwrc->regmap, + pwrc->base + RTC_BBPU, val, + !(val & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret) + dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret); + + /* Wait some time until system down, otherwise, notice with a warn */ + mdelay(1000); + + WARN_ONCE(1, "Unable to power off system\n"); +} + +static int mt6323_pwrc_probe(struct platform_device *pdev) +{ + struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent); + struct mt6323_pwrc *pwrc; + struct resource *res; + + pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + if (!pwrc) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pwrc->base = res->start; + pwrc->regmap = mt6397_chip->regmap; + pwrc->dev = &pdev->dev; + mt_pwrc = pwrc; + + pm_power_off = &mt6323_do_pwroff; + + return 0; +} + +static int mt6323_pwrc_remove(struct platform_device *pdev) +{ + if (pm_power_off == &mt6323_do_pwroff) + pm_power_off = NULL; + + return 0; +} + +static const struct of_device_id mt6323_pwrc_dt_match[] = { + { .compatible = "mediatek,mt6323-pwrc" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match); + +static struct platform_driver mt6323_pwrc_driver = { + .probe = mt6323_pwrc_probe, + .remove = mt6323_pwrc_remove, + .driver = { + .name = "mt6323-pwrc", + .of_match_table = mt6323_pwrc_dt_match, + }, +}; + +module_platform_driver(mt6323_pwrc_driver); + +MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC"); +MODULE_AUTHOR("Sean Wang "); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h index 25a95e72179b..652da61e3711 100644 --- a/include/linux/mfd/mt6397/core.h +++ b/include/linux/mfd/mt6397/core.h @@ -7,6 +7,8 @@ #ifndef __MFD_MT6397_CORE_H__ #define __MFD_MT6397_CORE_H__ +#include + enum mt6397_irq_numbers { MT6397_IRQ_SPKL_AB = 0, MT6397_IRQ_SPKR_AB,