Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp746190imc; Sun, 10 Mar 2019 20:51:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2fMoX91xFb3OG3wyedZT8Vyezs3Wp4OhuOnp6QiqrYOmXuNujFmovg2ZjQjMHE8IokXYW X-Received: by 2002:a63:5702:: with SMTP id l2mr28519901pgb.2.1552276279222; Sun, 10 Mar 2019 20:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552276279; cv=none; d=google.com; s=arc-20160816; b=m0RKz0pk3tatRlLs6SQznLI0g7XpclD/4LXRcPAO8WrzEIIqMP/18XYEqt3enBZgQZ LziYJAGcTUDJzPIJfG+7Acrz0hV5YlW3eNyybusOYZsn/pvZK6o2yQhKW4xCqy7XKoft t7kNBkO4QhiaSRpo9/tI9hEuaPcBLh/Erdm6EoZQCLMHj8Oq0ZKwyAbddT4vV3K8jZsn Ywhha3Hd9VRHRHMS2QKSiC8jN7CQpWA8/SIjgfuRvNG7pdAB+oolTi9C2isKpfTsxphG qq1TAMeFohTx31DJSkS5gEpRdR3VuUpjlSGZBJef9H1sGfuN5UHiwfSyl6fX1vtstjIH zOAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=A72hONeN35tpyJbt0Vs96PQjoChFJ4RrJAzki8t0/Ik=; b=RP0d6MxNZ7UZyR7kmkaie0DJT5l/U4OjB7zo45djv1TEfDFSALoKe++/fI3edTXU/C RqjjolKjPf6A9F93qydkTWR2nH/y34sq7JWXVpTIs+9pfrWFW3kBjvTr/5djfCLbc/mY EiOzWvwgey5/koG1uDdFEZikyO2LbSfWlOBrEWbd5du4tHKP1rParc1W9ml8nEqy8pRO qe54mgomCoX76z4e7ms7/HPenxaHc3gRFQRFvvlj9gTZcNrk2lbzY4fFiwBaA3azeIm0 uKag/yaxwJmYs/lA5b73Jo6c6foEpSiXgAf7Rk37hrVH8sHly3657a2E9pkuQQbZAFsG KA0w== 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 cj2si4798602plb.9.2019.03.10.20.51.03; Sun, 10 Mar 2019 20:51:19 -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 S1727450AbfCKDs4 (ORCPT + 99 others); Sun, 10 Mar 2019 23:48:56 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41264 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727041AbfCKDsZ (ORCPT ); Sun, 10 Mar 2019 23:48:25 -0400 X-UUID: 6e0c2be5f12e4778b57297680578e052-20190311 X-UUID: 6e0c2be5f12e4778b57297680578e052-20190311 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1842584796; Mon, 11 Mar 2019 11:48:10 +0800 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 CC: Marc Zyngier , , , , , , , Liam Girdwood , Mark Rutland , Sean Wang , Alessandro Zummo , Alexandre Belloni , Ran Bi 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 Content-Type: text/plain X-TM-SNTS-SMTP: 940FE17246965C8CCC8881607C3F0EE8685B22C125EC05FBADDFF8DE90F0C90C2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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", }, { } }; -- 1.9.1