From patchwork Thu Oct 20 13:09:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fadwa Chiby X-Patchwork-Id: 6203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp103995wrr; Thu, 20 Oct 2022 06:14:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ew1YlnziN0psuWfQmhmKEgAQmb/iJ/4ZpHwIB3nEclS1j/eaCACbz7vpMiKxBJMhvyPuB X-Received: by 2002:a05:6402:500d:b0:459:3e56:e6f9 with SMTP id p13-20020a056402500d00b004593e56e6f9mr12539049eda.367.1666271697994; Thu, 20 Oct 2022 06:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666271697; cv=none; d=google.com; s=arc-20160816; b=WwuG1C0dM9X8s8Kjv1tycP6SB+IBB7ih70EEVACd5x9uj2tVpGMylRLHkdeadjsCoM iGU5NsMYRKm2nQF37VrEI5hgpPvAYXPwWQCFj1uQJ3MJsvSWbeoOEiwQItG2MjV4DBDU Hj1WBmwHYzDal+S6CHX52k1DzdCkLR0k3zVsK4aUZuFjRtUuUHAI1s+WyHSB8gimZSb2 /8+JbIradgWX4Lets2fLDhXYRVe5iZw3JLm9RxWWHpT7eNBD6JluPPq0vpF4HLoRB0ZU o3/T9Al+PSwNMiUWGseAkQGoiMfDdeieQX0zT7jPCDGMoNrIEnF4YpIiJDxflzoIxokJ 6Gew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7OTh+ZIjQwPwHMVAfy9H3FuL7YWrhAHg4js/lzlDK/M=; b=tD9XRPiLr1hT303SSHbWksFQWQpAaQHmp6rEoR6oN3MkDFRBFosbtdkEFvkJ+cMP5P pQO1PJZOER0fLhTtzlJZ7PHqQClzQwmDv1TF1elP6z3+zPfcZJmHa2Soc8u7pSEnuNN3 L0M7YpILOwB85q8xNuwJr7PN55Of+jzT4iGjU0kXVAXNNJcZis0RrkYbp5+RYmhqwzAq 4d2xMkhK4gnrbdLsXKpkI9Q7TRpr9V59kqTSL89js4Pi1Q28j+U3oywdnyYX/JQVog2y Kx2RBCPi3Nc0vl8yKpT6/+M40fh+3rWAcozOGs8aLtCcmBTeNBp27cewuJdv1IxbadEH zAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=6EDUCv6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg20-20020a170907a41400b0078db6f5f4b2si16340542ejc.546.2022.10.20.06.14.31; Thu, 20 Oct 2022 06:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=6EDUCv6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbiJTNN2 (ORCPT + 99 others); Thu, 20 Oct 2022 09:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbiJTNN1 (ORCPT ); Thu, 20 Oct 2022 09:13:27 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA8617E209 for ; Thu, 20 Oct 2022 06:12:57 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id fn7-20020a05600c688700b003b4fb113b86so2161546wmb.0 for ; Thu, 20 Oct 2022 06:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7OTh+ZIjQwPwHMVAfy9H3FuL7YWrhAHg4js/lzlDK/M=; b=6EDUCv6G2UgQRsVfJ2I9xQEL96UJ12vdRg5bkhFeSUS8KL3XWADImhOHZXbAIPHbsz GmHQhGgrSI/cNNtSpNEpHuRe/bsQhMGTz09Hv9UvDI33MyLuh7pZgk43VdA3PpgjLAwJ NmoYOQN2+ZrW718j2+WcpYVDPIjYAvYHpuL3bpDNOFzUt5Ln3uXrnMfZAbbBEsduYBMz DoMsVgSf2XfB5WZ9oxb2tvygvBDN3VYb8W2AaHe/GAZlS1CQbpFIOMQqVd+UtNo8K6bj ndPy/tScUYbYM5Y9AQTV27ydm6D4mKb8Oh/Dmu0yY3juBM8PEVuiO0IO6vXjafg/tU6g jGAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7OTh+ZIjQwPwHMVAfy9H3FuL7YWrhAHg4js/lzlDK/M=; b=IX9Ua7jCc1uBpLr1YSDfwG6DT18lZ8YnZ9A1DIEhcvWwvqpWsK8QT1JlXznNBSYQDG Q9fuBVJAf9/Tw0/4dGfP1m10pFcB3nOFyYl39jF1kWie4tJbI3BZC4frgGOPa4Huozb1 Hrall6F9o0d9uxnnXlCmrtUdz4opW+Phi4GRG/gDjoKdbM57XZOZYC6HCHxBukzmuFiU 8vDylUoszr2z2Yigc38ovojtEdnCA/GzcZ/6LXZU0VP3Rxmioe19A+pUVpoGp5Mz2NlQ 5LOE4ZOZ3tx51977zFpO4C/fF3cHQWNU52UtiG1uZg8i2L6nyUot+d4G0U3XvWzge4ku LSWg== X-Gm-Message-State: ACrzQf28il48QB245c5lrJ+lx0zonkuxQMFvtriOyd6CVV8UUs4sQEYx dSLgEjWivS7M1mq9qTVxpsctQw== X-Received: by 2002:a05:600c:4691:b0:3c6:f154:fdc6 with SMTP id p17-20020a05600c469100b003c6f154fdc6mr17950920wmo.195.1666271478376; Thu, 20 Oct 2022 06:11:18 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3a82:90b0:2979:1615:9a68:f204]) by smtp.gmail.com with ESMTPSA id x8-20020a5d6508000000b00228dff8d975sm16453927wru.109.2022.10.20.06.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 06:11:18 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong.Tao" Cc: Fabien Parent , Rob Herring , Tinghan Shen , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/3] dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings Date: Thu, 20 Oct 2022 15:09:55 +0200 Message-Id: <20221020130957.25197-2-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020130957.25197-1-fchiby@baylibre.com> References: <20221020130957.25197-1-fchiby@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747212512282805348?= X-GMAIL-MSGID: =?utf-8?q?1747212512282805348?= From: Fabien Parent Add pwrap binding documentation for Signed-off-by: Fabien Parent Acked-by: Rob Herring --- Documentation/devicetree/bindings/soc/mediatek/pwrap.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt index d24e2bc444be..8424b93c432e 100644 --- a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt +++ b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt @@ -30,6 +30,7 @@ Required properties in pwrap device node. "mediatek,mt8186-pwrap" for MT8186 SoCs "mediatek,mt8188-pwrap", "mediatek,mt8195-pwrap" for MT8188 SoCs "mediatek,mt8195-pwrap" for MT8195 SoCs + "mediatek,mt8365-pwrap" for MT8365 SoCs "mediatek,mt8516-pwrap" for MT8516 SoCs - interrupts: IRQ for pwrap in SOC - reg-names: "pwrap" is required; "pwrap-bridge" is optional. @@ -39,6 +40,8 @@ Required properties in pwrap device node. - clock-names: Must include the following entries: "spi": SPI bus clock "wrap": Main module clock + "sys": System module clock (for MT8365 SoC) + "tmr": Timer module clock (for MT8365 SoC) - clocks: Must contain an entry for each entry in clock-names. Optional properities: From patchwork Thu Oct 20 13:09:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fadwa Chiby X-Patchwork-Id: 6204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp104100wrr; Thu, 20 Oct 2022 06:15:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZXpOTbwuL6StyWB6Fcdp4URyGH4IEiV3ALaoOmDnI/B4X+TJuAL+zAN80Tz5XLiHrRsaM X-Received: by 2002:a17:907:2c59:b0:78d:8e03:134 with SMTP id hf25-20020a1709072c5900b0078d8e030134mr10657122ejc.310.1666271707481; Thu, 20 Oct 2022 06:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666271707; cv=none; d=google.com; s=arc-20160816; b=AE+oeviBiYgdAV5e8KEQ6vMFjRwXdXmLTa+iPMPrcUIDF8sr9Uvz8ojMOe/MhJPJ2R Io9b7i0OIZyIwD8htnbTGZ4X5nY9zhNq09+duMLv3Gz9EDRJzA8lJKyFDPgRgCrbfWpZ RiiCMu+MZ1mQ7KBGO00T2TfMHsFOBDJ47vdCaoLnkZtl4CrwsGkUJ1jzsficoW8DJksA zRPswkokaZxhU4ShzaE1Ga1fI4vKV5ctw6gf3rzu2d3t9pSzfcq1s50jr2kmW2BRdNJx Cwy7Nj3PKBKGoEoz+91XTkYrJMuwVsmTxhB0JKsbhSmiGLZ6wL05JGeSiTzecvjpFk4H 0Wpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J4boSMDIMSEVQTaENzgDytuelvqQTNOGg+C0gp1qMNY=; b=D/ENazr7jUcxyUCL1v2iBuf2s2yf1hkfQ9zCjBM7SYpPJm2mhGMyBd8U8GgfUdYyEF fPwDgipoe0jq5SWicxpWyimXM3eoSQnQfGg677PcC9KHLgoqQVJ7EW9dAw0opHBZMW5g CNhNIPpmN7djtaY6pchSIB2jsK9uDstKFxSuvuD2vIWG47xE38WhBp8KVX54XVH/zIIZ /25RJCdkcIqhgoHsQGopRtjp5IIFT3XnMvA91DmCE+GZxq1rrcps5GuHUL68Ja8kghIZ EUPvurrlh7z23lFevAXJIlS/iCtQtehrbxQ3jP9Fdkp6IC7lgpzXWZ0D5x1I25gRybHt OCzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b="E/Hioe+j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a0564021e9400b0045cecdc1fbcsi19085103edf.9.2022.10.20.06.14.40; Thu, 20 Oct 2022 06:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b="E/Hioe+j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230414AbiJTNNf (ORCPT + 99 others); Thu, 20 Oct 2022 09:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbiJTNNc (ORCPT ); Thu, 20 Oct 2022 09:13:32 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5BBF6D9C4 for ; Thu, 20 Oct 2022 06:13:01 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id bv10so34287302wrb.4 for ; Thu, 20 Oct 2022 06:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J4boSMDIMSEVQTaENzgDytuelvqQTNOGg+C0gp1qMNY=; b=E/Hioe+jZMzRIQ7yMGUhSU9ay7uPXjwm6UBqcrUgwU3IgoI5pSLHBPSmJ/pTFqxz5O roKsqMeS6FiuhGGMda7XTJ+1FNRXTc+pghU8rh44mD8Ycu1kaDyBDPqYJcIKudLuI3jQ dTDishgLlhpzIHyUch61+aiJxjLDxmT+ybnyQ2/D99l6jz71IPm7l1MV6gsmZlJWQtjX 3XcQqZJcsUHES4z20q/BGKRDN03p8cAUamKq+2i1FvjVCsyy92/vlLydwwdf/IGpOB8m R1k5Bs6QcyfQIBZRtzbYZXkUfHZ2Fxc2UuTPgBhyUrtSbJZHkAmkOfbCpdjL5JqiUrhW CugA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J4boSMDIMSEVQTaENzgDytuelvqQTNOGg+C0gp1qMNY=; b=Mqfzj1D9vLLDsb5Qs/NdbrqXalaAJ4rKpsvdPqn+fhWMMMELCV6OmvxaqdmuRg6WS9 /H3gK+FpVHLuM64fDSNqB8TaMen0FsWHzezTf99Hdpg6I0EdI8E4AATZ3ATtTROXulGu ZDtHza1YV/HwoVEW7yoIERsxax2PVhUoNR4w44A8NpFHqmIvYfD1ja61NaQqHJJh5tTi 9bjFbXCIF67O+D5hVF/TVFh/Qxa3pkuebGo5av5eXelScXDX+kyWsUUFPNz7wm+yGUGh t2IAp2eRW4hUii5YGU7DR8avOLvutMdARidmsgXr/Ibs746Mj5XZIbNTpRpzwZ5aPFMv q/sQ== X-Gm-Message-State: ACrzQf0C9MYNtOuxY0IdaMHqff46QyeZZtkx4F94CZ9yb2+bnqcXiXXg jRIDfcW/CCF/rlpky+lTkewtqQ== X-Received: by 2002:a05:6000:1842:b0:22e:7bbf:c75 with SMTP id c2-20020a056000184200b0022e7bbf0c75mr8601406wri.547.1666271488170; Thu, 20 Oct 2022 06:11:28 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3a82:90b0:2979:1615:9a68:f204]) by smtp.gmail.com with ESMTPSA id x8-20020a5d6508000000b00228dff8d975sm16453927wru.109.2022.10.20.06.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 06:11:27 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong.Tao" Cc: Fabien Parent , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/3] soc: mediatek: pwrap: add support for sys & tmr clocks Date: Thu, 20 Oct 2022 15:09:56 +0200 Message-Id: <20221020130957.25197-3-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020130957.25197-1-fchiby@baylibre.com> References: <20221020130957.25197-1-fchiby@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747212521843549192?= X-GMAIL-MSGID: =?utf-8?q?1747212521843549192?= From: Fabien Parent MT8365 requires an extra 2 clocks to be enabled to behave correctly. Add support these 2 clocks, they are made optional since they seem to be present only on MT8365. Signed-off-by: Fabien Parent --- drivers/soc/mediatek/mtk-pmic-wrap.c | 36 ++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index eb82ae06697f..d56b00023ccd 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -1171,6 +1171,8 @@ struct pmic_wrapper { const struct pwrap_slv_type *slave; struct clk *clk_spi; struct clk *clk_wrap; + struct clk *clk_sys; + struct clk *clk_tmr; struct reset_control *rstc; struct reset_control *rstc_bridge; @@ -2214,6 +2216,20 @@ static int pwrap_probe(struct platform_device *pdev) return PTR_ERR(wrp->clk_wrap); } + wrp->clk_sys = devm_clk_get_optional(wrp->dev, "sys"); + if (IS_ERR(wrp->clk_sys)) { + return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_sys), + "failed to get clock: %pe\n", + wrp->clk_sys); + } + + wrp->clk_tmr = devm_clk_get_optional(wrp->dev, "tmr"); + if (IS_ERR(wrp->clk_tmr)) { + return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_tmr), + "failed to get clock: %pe\n", + wrp->clk_tmr); + } + ret = clk_prepare_enable(wrp->clk_spi); if (ret) return ret; @@ -2222,6 +2238,14 @@ static int pwrap_probe(struct platform_device *pdev) if (ret) goto err_out1; + ret = clk_prepare_enable(wrp->clk_sys); + if (ret) + goto err_out2; + + ret = clk_prepare_enable(wrp->clk_tmr); + if (ret) + goto err_out3; + /* Enable internal dynamic clock */ if (HAS_CAP(wrp->master->caps, PWRAP_CAP_DCM)) { pwrap_writel(wrp, 1, PWRAP_DCM_EN); @@ -2236,7 +2260,7 @@ static int pwrap_probe(struct platform_device *pdev) ret = pwrap_init(wrp); if (ret) { dev_dbg(wrp->dev, "init failed with %d\n", ret); - goto err_out2; + goto err_out4; } } @@ -2250,7 +2274,7 @@ static int pwrap_probe(struct platform_device *pdev) if (!(pwrap_readl(wrp, PWRAP_WACS2_RDATA) & mask_done)) { dev_dbg(wrp->dev, "initialization isn't finished\n"); ret = -ENODEV; - goto err_out2; + goto err_out4; } /* Initialize watchdog, may not be done by the bootloader */ @@ -2288,7 +2312,7 @@ static int pwrap_probe(struct platform_device *pdev) IRQF_TRIGGER_HIGH, "mt-pmic-pwrap", wrp); if (ret) - goto err_out2; + goto err_out4; wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regops->regmap); if (IS_ERR(wrp->regmap)) { @@ -2300,11 +2324,15 @@ static int pwrap_probe(struct platform_device *pdev) if (ret) { dev_dbg(wrp->dev, "failed to create child devices at %pOF\n", np); - goto err_out2; + goto err_out4; } return 0; +err_out4: + clk_disable_unprepare(wrp->clk_tmr); +err_out3: + clk_disable_unprepare(wrp->clk_sys); err_out2: clk_disable_unprepare(wrp->clk_wrap); err_out1: From patchwork Thu Oct 20 13:09:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fadwa Chiby X-Patchwork-Id: 6205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp105209wrr; Thu, 20 Oct 2022 06:16:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71rmMJBulom0dm5m+KtumVRK73KBwC0qmeUpM7spqYhYQHG1SaKwGzl0+7C56LpMH6g4Sb X-Received: by 2002:a17:907:3e11:b0:78d:9918:217f with SMTP id hp17-20020a1709073e1100b0078d9918217fmr10616428ejc.742.1666271813842; Thu, 20 Oct 2022 06:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666271813; cv=none; d=google.com; s=arc-20160816; b=hDAQ+yeUHIzcHBezQE5p51V9WrhwbTwYUtXo0wOJiCaY5YSUZH48SV6EoNJN3Yr0tc XZiKRMS1jp/fT8aYm404rA6IyxhWybCrkrwh8l12RluKsx/xygGs+HwQqQoaNcKLXR2M HtUaFZuo/AnLngyRAAu40gdm0VTtn5vvuZPVq4V6wBSY3+ET/9bkdZOcxGOMVlCYjXJS +jHFDxJywCZsjSJDD3Ly/ahPTirpJJU+I+Hw5FmPcHzspWRAUKaQdaV5Pbs7skJSGFub r79sf1QgpV1rjipbu/U1HbWCu6LwN2XkvokqC1+oX8srZMSNQ9h+L5wrunbam9YV5uDH g9Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ot9nuC1I4qAigSvkVZLdiUhVV5F8thjtHAvIFE60P0s=; b=z50pOSvSSIhmeY8RvXP6QHhdgjInzgz17NwI5Qblt1RnMa2IF4fb523st4qF2brNrY vi2JDm5uMSIxQMRgJja+VPvLqDJWMIj+AZ6CtcQDeM3c6z7dF/WS3LoGQhRfb87j5Rf8 GHD5G9i19r5YwCRRKmwXVVFoX5JTzsA+1pSyU4OFjYDLxWW1HUvnSYi+L0fbEL4u1q66 LRH0JzUK6n+U+yy/CzCO3z/1LT0UvZxA0xHybE+BpV5Iiv+3VrqG85Hb/HrFUry+/hjL ErzG3WrNfMrsD+wbJwXsc799jBvqAuIjUBzXo7Uxs5oq4crxhkKtI3tiRy2lBlWcnOwY Sl3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=RfQd7pCu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb7-20020a170907160700b0078decbc3f73si18093515ejc.460.2022.10.20.06.16.29; Thu, 20 Oct 2022 06:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=RfQd7pCu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbiJTNOm (ORCPT + 99 others); Thu, 20 Oct 2022 09:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbiJTNOf (ORCPT ); Thu, 20 Oct 2022 09:14:35 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FF714D8CE for ; Thu, 20 Oct 2022 06:13:58 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id v11so4879735wmd.1 for ; Thu, 20 Oct 2022 06:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ot9nuC1I4qAigSvkVZLdiUhVV5F8thjtHAvIFE60P0s=; b=RfQd7pCu5JXtfHFtctkAdsV36AfpV51SnjlbQNPKe4zwbwR37DsF3XdxzHBe/dNAhU OLEFcUxJrTLfxU4wEyp82PJd03MrmVZIN4a67O2rTxIbHIrPFJRUFvqvlhwS3TzbhDY0 YJ+aMgWruFtNr0CksFwNGKe1kxUsT0/1qPsDhykcmk5LmVFgYmKYTMcXnNcjm5vK5edw 4YwkmOL7NOmFsPR9mX1QYF5zSi1Bs6EIvyfSRSMWAZhuAxF5j8yjpEVAjMOa8Y794+Ue XUd1zmboEzkUiiHzbKB7H9vHotDh4nroJv7yS2l42Skdh11REWPhwrJw9XAL5jQQCQ3n tsUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ot9nuC1I4qAigSvkVZLdiUhVV5F8thjtHAvIFE60P0s=; b=MXCeAKDS38XR6OpbmJmHblOJIEju4jg6bpNb9LaMLqpfSyJ4Kd/HEMS5e+S5CVgGLK 6MrOgHWQXK5/e7/Zds8ti/3KskLc3SZg/vdqXpTSlH9lj6YKdUqhFORiV4vo7iQuZECc SnzN1lOPwfJO3MWf+p0HgdmZFS2iF0cfXunTqragjCThIYIIT0jAJe8exjtv+QrNitY2 FQoYSa2tsOry1dOuSoechd9nHdvhtgWNyfwYPKynuX8Y2tjAyFL8yvQeiZa23bqWMUXt IyPMtzFaJoPrgoOYDgDV0NtkDHOA9dmOpFTj6F17wNp+zmwikRGbcnJHWfqdaaVTzHBV NlJA== X-Gm-Message-State: ACrzQf3r6BSrGzR7cejGx0+jk0batIKp6ega373byvXxXRvO3p28KCep QGgNUrxNfgxYp6y5uAOyEUZ+8qJQhjn+xA== X-Received: by 2002:a05:600c:4f13:b0:3c6:eb72:51e3 with SMTP id l19-20020a05600c4f1300b003c6eb7251e3mr21174576wmq.34.1666271509601; Thu, 20 Oct 2022 06:11:49 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3a82:90b0:2979:1615:9a68:f204]) by smtp.gmail.com with ESMTPSA id x8-20020a5d6508000000b00228dff8d975sm16453927wru.109.2022.10.20.06.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 06:11:49 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong.Tao" Cc: Fabien Parent , Tinghan Shen , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/3] soc: mediatek: pwrap: add mt8365 SoC support Date: Thu, 20 Oct 2022 15:09:57 +0200 Message-Id: <20221020130957.25197-4-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020130957.25197-1-fchiby@baylibre.com> References: <20221020130957.25197-1-fchiby@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747212633716888391?= X-GMAIL-MSGID: =?utf-8?q?1747212633716888391?= From: Fabien Parent Add PMIC Wrap support for MT8365 SoC. Signed-off-by: Fabien Parent --- drivers/soc/mediatek/mtk-pmic-wrap.c | 78 ++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index d56b00023ccd..15789a03e6c6 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -983,6 +983,68 @@ static int mt8195_regs[] = { [PWRAP_WACS2_RDATA] = 0x8A8, }; +static int mt8365_regs[] = { + [PWRAP_MUX_SEL] = 0x0, + [PWRAP_WRAP_EN] = 0x4, + [PWRAP_DIO_EN] = 0x8, + [PWRAP_CSHEXT_WRITE] = 0x24, + [PWRAP_CSHEXT_READ] = 0x28, + [PWRAP_STAUPD_PRD] = 0x3c, + [PWRAP_STAUPD_GRPEN] = 0x40, + [PWRAP_STAUPD_MAN_TRIG] = 0x58, + [PWRAP_STAUPD_STA] = 0x5c, + [PWRAP_WRAP_STA] = 0x60, + [PWRAP_HARB_INIT] = 0x64, + [PWRAP_HARB_HPRIO] = 0x68, + [PWRAP_HIPRIO_ARB_EN] = 0x6c, + [PWRAP_HARB_STA0] = 0x70, + [PWRAP_HARB_STA1] = 0x74, + [PWRAP_MAN_EN] = 0x7c, + [PWRAP_MAN_CMD] = 0x80, + [PWRAP_MAN_RDATA] = 0x84, + [PWRAP_MAN_VLDCLR] = 0x88, + [PWRAP_WACS0_EN] = 0x8c, + [PWRAP_INIT_DONE0] = 0x90, + [PWRAP_WACS0_CMD] = 0xc00, + [PWRAP_WACS0_RDATA] = 0xc04, + [PWRAP_WACS0_VLDCLR] = 0xc08, + [PWRAP_WACS1_EN] = 0x94, + [PWRAP_INIT_DONE1] = 0x98, + [PWRAP_WACS2_EN] = 0x9c, + [PWRAP_INIT_DONE2] = 0xa0, + [PWRAP_WACS2_CMD] = 0xc20, + [PWRAP_WACS2_RDATA] = 0xc24, + [PWRAP_WACS2_VLDCLR] = 0xc28, + [PWRAP_INT_EN] = 0xb4, + [PWRAP_INT_FLG_RAW] = 0xb8, + [PWRAP_INT_FLG] = 0xbc, + [PWRAP_INT_CLR] = 0xc0, + [PWRAP_SIG_ADR] = 0xd4, + [PWRAP_SIG_MODE] = 0xd8, + [PWRAP_SIG_VALUE] = 0xdc, + [PWRAP_SIG_ERRVAL] = 0xe0, + [PWRAP_CRC_EN] = 0xe4, + [PWRAP_TIMER_EN] = 0xe8, + [PWRAP_TIMER_STA] = 0xec, + [PWRAP_WDT_UNIT] = 0xf0, + [PWRAP_WDT_SRC_EN] = 0xf4, + [PWRAP_WDT_FLG] = 0xfc, + [PWRAP_DEBUG_INT_SEL] = 0x104, + [PWRAP_CIPHER_KEY_SEL] = 0x1c4, + [PWRAP_CIPHER_IV_SEL] = 0x1c8, + [PWRAP_CIPHER_RDY] = 0x1d0, + [PWRAP_CIPHER_MODE] = 0x1d4, + [PWRAP_CIPHER_SWRST] = 0x1d8, + [PWRAP_DCM_EN] = 0x1dc, + [PWRAP_DCM_DBC_PRD] = 0x1e0, + [PWRAP_EINT_STA0_ADR] = 0x44, + [PWRAP_EINT_STA1_ADR] = 0x48, + [PWRAP_INT1_EN] = 0xc4, + [PWRAP_INT1_FLG] = 0xcc, + [PWRAP_INT1_CLR] = 0xd0, + [PWRAP_WDT_SRC_EN_1] = 0xf8, +}; + static int mt8516_regs[] = { [PWRAP_MUX_SEL] = 0x0, [PWRAP_WRAP_EN] = 0x4, @@ -1139,6 +1201,7 @@ enum pwrap_type { PWRAP_MT8183, PWRAP_MT8186, PWRAP_MT8195, + PWRAP_MT8365, PWRAP_MT8516, }; @@ -1598,6 +1661,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp) case PWRAP_MT6797: case PWRAP_MT8173: case PWRAP_MT8186: + case PWRAP_MT8365: case PWRAP_MT8516: pwrap_writel(wrp, 1, PWRAP_CIPHER_EN); break; @@ -2106,6 +2170,19 @@ static struct pmic_wrapper_type pwrap_mt8195 = { .init_soc_specific = NULL, }; +static const struct pmic_wrapper_type pwrap_mt8365 = { + .regs = mt8365_regs, + .type = PWRAP_MT8365, + .arb_en_all = 0x3ffff, + .int_en_all = 0x7f1fffff, + .int1_en_all = 0x0, + .spi_w = PWRAP_MAN_CMD_SPI_WRITE, + .wdt_src = PWRAP_WDT_SRC_MASK_ALL, + .caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1, + .init_reg_clock = pwrap_common_init_reg_clock, + .init_soc_specific = NULL, +}; + static struct pmic_wrapper_type pwrap_mt8516 = { .regs = mt8516_regs, .type = PWRAP_MT8516, @@ -2143,6 +2220,7 @@ static const struct of_device_id of_pwrap_match_tbl[] = { { .compatible = "mediatek,mt8183-pwrap", .data = &pwrap_mt8183 }, { .compatible = "mediatek,mt8186-pwrap", .data = &pwrap_mt8186 }, { .compatible = "mediatek,mt8195-pwrap", .data = &pwrap_mt8195 }, + { .compatible = "mediatek,mt8365-pwrap", .data = &pwrap_mt8365 }, { .compatible = "mediatek,mt8516-pwrap", .data = &pwrap_mt8516 }, { /* sentinel */ } };