From patchwork Mon Mar 11 03:46:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Hsiung Wang X-Patchwork-Id: 10846679 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 BEA6217DF for ; Mon, 11 Mar 2019 03:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FB15288CF for ; Mon, 11 Mar 2019 03:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9340D288D8; Mon, 11 Mar 2019 03:49:18 +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,UNPARSEABLE_RELAY 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 0633E288CF for ; Mon, 11 Mar 2019 03:49:18 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=MsWPsaxH+k6hGOkdalF1MLkDgAQCoY41rVn2BxYyf6g=; b=JkQm5Y1NnE6/Bo MTV+p7XdGy4hAvosziO5+uuS0Hb0RfYyADmkAaQXnBkTidS0uqQoSQp6Qlmdc1qGkbNyKE6kWNTXt rBX9YoizMaxJdlzuCT253HcqEGH+TSyIgOfg40wSnauBQNWmmRGaJHkIfobg/BtR93ezJ7Y/IdMB2 kuE4cvSnh/YGBzEFF+gSYKMgG1QkHZ/cPg3bT9sYBJgcTuqRl2obxtFk6cGQfstrs8LErm7i5CQk1 S4a2ltNH5KsAToFoNI+zb5rsofFffCna6MWmYXxFYhzsNvs2N87x3M+4O8EGm/eVx+sLAowOvre/l 9vPiVv6YF7dL5Mkmyyfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3BwA-0001lM-KA; Mon, 11 Mar 2019 03:49:14 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3BvK-0000U6-8L; Mon, 11 Mar 2019 03:48:23 +0000 X-UUID: 721c0d52ad9346e9806c4bdd7b17b2c8-20190310 X-UUID: 721c0d52ad9346e9806c4bdd7b17b2c8-20190310 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 899700879; Sun, 10 Mar 2019 19:48:12 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 10 Mar 2019 20:48:11 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 11 Mar 2019 11:48:08 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 11 Mar 2019 11:48:09 +0800 From: Hsin-Hsiung Wang To: Lee Jones , Rob Herring , Matthias Brugger , Mark Brown , Eddie Huang Subject: [PATCH v2 9/9] rtc: Add support for the MediaTek MT6358 RTC Date: Mon, 11 Mar 2019 11:46:31 +0800 Message-ID: <1552275991-34648-10-git-send-email-hsin-hsiung.wang@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1552275991-34648-1-git-send-email-hsin-hsiung.wang@mediatek.com> References: <1552275991-34648-1-git-send-email-hsin-hsiung.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 940FE17246965C8CCC8881607C3F0EE8685B22C125EC05FBADDFF8DE90F0C90C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190310_204822_305319_B3621CA5 X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Belloni , srv_heupstream@mediatek.com, Alessandro Zummo , Marc Zyngier , Ran Bi , Sean Wang , linux-kernel@vger.kernel.org, Liam Girdwood , linux-mediatek@lists.infradead.org, Mark Rutland , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ran Bi This add support for the MediaTek MT6358 RTC. MT6397 mfd will pass RTC_WRTGR address offset to RTC driver. Signed-off-by: Ran Bi Acked-by: Eddie Huang --- drivers/rtc/rtc-mt6397.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index f85f1fc..c8a0090 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -27,7 +27,7 @@ #define RTC_BBPU 0x0000 #define RTC_BBPU_CBUSY BIT(6) -#define RTC_WRTGR 0x003c +#define RTC_WRTGR_DEFAULT 0x003c #define RTC_IRQ_STA 0x0002 #define RTC_IRQ_STA_AL BIT(0) @@ -78,6 +78,7 @@ struct mt6397_rtc { struct regmap *regmap; int irq; u32 addr_base; + u32 wrtgr_offset; }; static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) @@ -86,7 +87,8 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) int ret; u32 data; - ret = regmap_write(rtc->regmap, rtc->addr_base + RTC_WRTGR, 1); + ret = regmap_write(rtc->regmap, + rtc->addr_base + rtc->wrtgr_offset, 1); if (ret < 0) return ret; @@ -341,6 +343,15 @@ static int mtk_rtc_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->addr_base = res->start; + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (res) { + rtc->wrtgr_offset = res->start; + dev_info(&pdev->dev, "register offset:%d\n", rtc->wrtgr_offset); + } else { + rtc->wrtgr_offset = RTC_WRTGR_DEFAULT; + dev_err(&pdev->dev, "Failed to get register offset\n"); + } + rtc->irq = platform_get_irq(pdev, 0); if (rtc->irq < 0) return rtc->irq; @@ -420,6 +431,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,mt6358-rtc", }, { .compatible = "mediatek,mt6397-rtc", }, { } };