From patchwork Mon Oct 31 09:33: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: 13176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2211048wru; Mon, 31 Oct 2022 02:42:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZRe9ifXK2zjRH3fag6042J5UT/9FeFpz8noaSJGkMBlo5KZJNSM3H16E9byTsnSeJO2G1 X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr12740253eds.6.1667209344373; Mon, 31 Oct 2022 02:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667209344; cv=none; d=google.com; s=arc-20160816; b=IkU5nDUnoZ2F8V7cpLpbnD/rMTOWPeW5lUAdvxhE/NFS93VT+D1wcwbMSDuI1V1GfA h/8dApsw43IgqTnqLFEos55MlNm57YEnxrZ6X83tY7PtREhDPzW3X7pRPiZBAvn2C3MM oZ9jgVJ0Gin3tpuI54w3IgtioDk8ZyG/zPU2gLL9trTCBOCP73LfPUHtwo9dDKWs64w0 kywqk43fV3FpLI8VI6A60S5Jy2wwu5JJcpt9RwI6JpgKaVv8ZrIgG/MdsSx5J34W6kwD EFpSGsZHC9+2GAvnwd3dolLtiHd3ID1XdW2JTCZ71+joNGz048Yx5VRa8jDlwDK9PIwO t6LA== 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=pIOCfVMQhu6G9ENJOqDHIKDLMubngYMP9+O2JUUOSo0=; b=dPxoeasbnz1QeC9U7kpNpKO8hirHumA2hsEVNPZy27sxctyvJ1vCuMgmImaNduzMm5 0J4xRlpgbA/C2c9l1uatx6S7AhnwN7ryDagdEynvUCnIk1CJz+cTb8ejbg2kxd28GzGv L+XK+gUQx+4lX2pAbB1A+gf1vyOO4NhvQVIpKN2w3/fbDfhNqd+noTmU2aOi8DbrZZ/3 6d/RduxTMCS/E/dccJpsoRBgcrUYjhpF2Cjg/JawgjFIkGPcTrSIbKHmcC6aa3g3iLJ2 RipekXhhVlSeNp3JBgXO5K3y02Q/yuZYLXaDNZO095yrGZYalVdm3RpKv3mymLOpTShF BZyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=zFXkxtX1; 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 sa18-20020a1709076d1200b0078212b2e6e2si7419666ejc.75.2022.10.31.02.42.01; Mon, 31 Oct 2022 02:42:24 -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=zFXkxtX1; 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 S230271AbiJaJec (ORCPT + 99 others); Mon, 31 Oct 2022 05:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbiJaJeZ (ORCPT ); Mon, 31 Oct 2022 05:34:25 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 856B8DE2 for ; Mon, 31 Oct 2022 02:34:23 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id bk15so15052361wrb.13 for ; Mon, 31 Oct 2022 02:34:23 -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=pIOCfVMQhu6G9ENJOqDHIKDLMubngYMP9+O2JUUOSo0=; b=zFXkxtX1PFkSjJelo7kyZc/Zq+XsOPZRH2RbVLitW3lM+AzsMjRLK32yQpgYQEJhbU mSPbA2fFm48bLL6Xl0/C+HO8q04EJLWrORrFVCkgADHxq7FAXWLtZVuMFoOfSGmSdwQ2 5sQPEt7d9F2biobOm5RSqIB9tfFzaIkFoVq9WcvY+LBWYdLyDKsLQDNBwUc7xUESxhJ6 m1BeT6H6mWqP6LjFb5T2LlhVzwfKtSfPDyexYKk6vYauObhiW1dm0/cDFwVsjGKCl1/s OZoOhR6tMagY2e+6LQP29qPSkUohw8V8x6hqQZ0wj9PlR6RR81p8v5HZPoT4HWk0+wsK mZuQ== 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=pIOCfVMQhu6G9ENJOqDHIKDLMubngYMP9+O2JUUOSo0=; b=xRZqJql8EBGIGbKHQ9HrbB4PuH/BgqwNv8LUOXdVnvkVowFQYrgozKhh3U34eE/8RM eehf2LO09iZ9Wo8k5P+JQ/9L3Yfb1FI3xYE///NCxXlZPPdlM+U0a7KzkHpI60H/999x S1F9zbFhYUypL+OeNnJ8oto4uKq5k+tGXBGocq3M6VnS9tM68DaeZdBaoJfAyH0z0tih WbnB1zGIfHzSd9XbnrL+rnCi9FOnKKG3PDCYndpzbQ+m4ysOJBmA+WEsvOeF2tdqQQeu WBTw6VJkRAvp02+VovwGC9ZwtFPnwyHIIx31Gia+231L5VJ0FIbHD+emcKF3HZuPJpBo wxzg== X-Gm-Message-State: ACrzQf1EyTDNnwfekKk8gPXhHbnACo8biBESi/k4SRBk24xMyYQEKNA0 2Zq+JtJDlcChKmo8xRR8dfY1Qw== X-Received: by 2002:a5d:6901:0:b0:22f:b097:7de6 with SMTP id t1-20020a5d6901000000b0022fb0977de6mr7625253wru.373.1667208861911; Mon, 31 Oct 2022 02:34:21 -0700 (PDT) Received: from fadwachiby.lan ([2001:861:3104:1980:6db3:63f:b30d:9361]) by smtp.gmail.com with ESMTPSA id t16-20020adff610000000b0023538fb27c1sm6547566wrp.85.2022.10.31.02.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 02:34:21 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong . Tao" Cc: Fabien Parent , Fadwa CHIBY , Rob Herring , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 1/3] dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings Date: Mon, 31 Oct 2022 10:33:56 +0100 Message-Id: <20221031093401.22916-2-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031093401.22916-1-fchiby@baylibre.com> References: <20221031093401.22916-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=unavailable 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?1748195705478332832?= X-GMAIL-MSGID: =?utf-8?q?1748195705478332832?= From: Fabien Parent Add pwrap binding documentation for Signed-off-by: Fabien Parent Signed-off-by: Fadwa CHIBY Acked-by: Rob Herring Reviewed-by: AngeloGioacchino Del Regno --- 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..12e4b4260b40 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": Optional system module clock + "tmr": Optional timer module clock - clocks: Must contain an entry for each entry in clock-names. Optional properities: From patchwork Mon Oct 31 09:33: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: 13178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2211424wru; Mon, 31 Oct 2022 02:43:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nZAvRFRM14kHWEAvymvqHW3kcfir/QGpPGANdxA1jzva0hVObt+oUL6uZgDZA1LBucVtj X-Received: by 2002:a05:6402:294f:b0:461:f5ce:31e8 with SMTP id ed15-20020a056402294f00b00461f5ce31e8mr12527432edb.363.1667209411979; Mon, 31 Oct 2022 02:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667209411; cv=none; d=google.com; s=arc-20160816; b=LoSyxkwAhdYA8XO1IZMd3X8tEv8Xs5Cd0askos1y9tkpUJ6A48RlHp0zRD4oVVZcXG sU8O60Ozs1d2Y9eReYlQMBmFfYWSe86lYcSakyZ1D+jTvcyYlIs7D0NBDU5G7Eo5eLB0 P5dG2tALnD+tUwvtHHIXdN319UDyn6dn/5pIfosTiMgcqFsrTmwomobjjf1KeyOWe1fJ k6PdzG0CyYJhLKAcRkbruY5xBwPl6GQW6j+yjXm61q8zixyaWsTn68pk9gNLp8EgfL1c taf8sYBCOnQ+Fxypb6cdIgsoaIoQvuMUd0Mo3/PBgTmpBEV8Q8wiQmDma8+ZAjkm1Ptn 4EDg== 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=s9+9zCegsUCIRIE3UD2cb0S32Fqr93kkv8zeVXoYmsQ=; b=sdLcZqknc0jOAONvqcgX5Ux5HkdSs2sX8h+b29yRxD/CTGuZlwOie/Gqh5Stif6nZS 5Lj4K5G74eyhoEGWOtQQVtwxlDnIHMnN1JdYj/9d5LAJDaIOnrCemg/QZeVtnf5JHYaZ h4JRDgRB7fBAEdUF3lpIlsbhBxbWslFA+42WFMzuqYGnrlPjVBhivZzDppOgzgrsMTmk 8zLFuEOdF1hxaCdUr8RPCSyq0GGVq9t1ddzjFbiGcfx9GpY6/bcpH0ht/RvbQbNR5QKh 9/PR+0FomZiSXS3bJ+/3qziRPSJglpBiCVs6xOutZkYY8X/svU32E0GIxkZycyMuljLA 5eRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=nUwU40Zb; 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 t12-20020a056402524c00b0045c786162f5si8990424edd.567.2022.10.31.02.43.08; Mon, 31 Oct 2022 02:43:31 -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=nUwU40Zb; 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 S230340AbiJaJeo (ORCPT + 99 others); Mon, 31 Oct 2022 05:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbiJaJeg (ORCPT ); Mon, 31 Oct 2022 05:34:36 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 615EA10C6 for ; Mon, 31 Oct 2022 02:34:34 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so10402883wme.5 for ; Mon, 31 Oct 2022 02:34:34 -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=s9+9zCegsUCIRIE3UD2cb0S32Fqr93kkv8zeVXoYmsQ=; b=nUwU40ZbSQQiiXmbuNHJK3uPUKBsu4RliRC4hTNLUhK98Ss8hzzdT7OiLOmb7FmJBf gSvqshhyvQIvg1ydoz2Jkijz72epbTZdOacS/GymSrj47SWRiJHo3rQ9vF4Ad2WMSv/1 l2bz0Q4hAtVLD2eTS/bZHJ/YUrwN1gIoIoRqZigKtZwUapkeTm39DfSsTeOSamvsjtXU wDE6vhGIFtFmI6Tjk4zsLli4427TjK+TmMH5PtQSHPM0uOnPjFDB0nqO8vb7CgP8TwFw ZGx7EX1qir8C83A4z5O5ZJxiVwH3Dm2HpAV3dp5VGfH0xR3BdaBKokBnpDN01nKfMeYG 1Y/w== 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=s9+9zCegsUCIRIE3UD2cb0S32Fqr93kkv8zeVXoYmsQ=; b=Rs18C1mFJgvqeTgtZBhIY8KoQy5IodArLAQr1vS4/MNU0F5kL4Tc9ZoQK+t27oMRK7 ILhnOojK9OCBVFCgsgYL0R2FDFY3WIVu03z0X0G3U5LejKJyPnMevvw3kE2Wu9CGyeHU ztPbHLFsCyOdUpQl0ipEd1dHIpVrASU8ML0KS8UiYVMg3q1zW8ZiGPkDeG8LXTfKnQ11 hoEgk9Z7y5Nt9ar5G8NIgo3sP4oBQSJETRgOJFNGIkkAfSU+n+3EWuc1HkLB/kwxiQC2 wWCN1ehjkgX4lAtNZpNnoCPH7fpdmDBK5G3kUPn7c0MIaQ7b9idGK3Ty7g4TmBxoIzX1 gVeg== X-Gm-Message-State: ACrzQf1VQS73yxoIBaGh6W2xtuoj+YLlryclmS0VW+yq3SQvMs4I3DOn hydVj8d/PZqJ3M2NVI4y61kUAw== X-Received: by 2002:a05:600c:92a:b0:3cf:6264:f2a7 with SMTP id m42-20020a05600c092a00b003cf6264f2a7mr7695880wmp.131.1667208872711; Mon, 31 Oct 2022 02:34:32 -0700 (PDT) Received: from fadwachiby.lan ([2001:861:3104:1980:6db3:63f:b30d:9361]) by smtp.gmail.com with ESMTPSA id t16-20020adff610000000b0023538fb27c1sm6547566wrp.85.2022.10.31.02.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 02:34:32 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong . Tao" Cc: Fabien Parent , Fadwa CHIBY , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 2/3] soc: mediatek: pwrap: add support for sys & tmr clocks Date: Mon, 31 Oct 2022 10:33:57 +0100 Message-Id: <20221031093401.22916-3-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031093401.22916-1-fchiby@baylibre.com> References: <20221031093401.22916-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?1748195776344519356?= X-GMAIL-MSGID: =?utf-8?q?1748195776344519356?= 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 Signed-off-by: Fadwa CHIBY Reviewed-by: AngeloGioacchino Del Regno --- 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 Mon Oct 31 09:33:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fadwa Chiby X-Patchwork-Id: 13177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2211151wru; Mon, 31 Oct 2022 02:42:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7idGTIwrvTbwULZJEsS1FEu7u0Oi4QWpmgEZGouD49PVpxOqhPSLbxlvhWUxbzo5LTkebQ X-Received: by 2002:a05:6a00:16c8:b0:53b:3b9f:7283 with SMTP id l8-20020a056a0016c800b0053b3b9f7283mr13295520pfc.46.1667209368180; Mon, 31 Oct 2022 02:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667209368; cv=none; d=google.com; s=arc-20160816; b=MlEQWX0D9FcU3DD2Wdtz0sGaJGfMivfooKN2RniOrqfrP+s8rpeQ6AepGZlkBEt3I6 +p253EpeXkj+yrmulmKPI/bPmE30TuynLL/Ix1bEL4+lXlKelX6/bbCsHeXQ+MIIMZuK qs3Esn5J2X6xSxqR6s4sH3D38NWwPs+nu8pGESFcC6zVRBslcxkZ+cdrlxvv/JnAJfFW UCZk2VkPn/he0QTbO9F9b17bKwSiC3xtI4lAueF9gVvM01Tbt1NcLVEGFy6/EDnmUwOb +DW4jrKaoQHbEkMUkFWFzpVmo67qBIhXhUootxeOaJnxxcWElts5pjdBb+vATJjm7kG2 7auQ== 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=JtUZKzQUrpqcEXFv8pDDgeNhPJPq/sgeZszFG9JX3VY=; b=QeQYOj7z8mFIk85zPrJ62eTHqmbhIEiJGBbn0qRvqpjXNvivWgjnCxCwd6f/IptEWn aSxDDzRemAOFL3AZqE2C6FFA7LFfXgZPzHj3n9VhTDV8wE/qRPFwPNNkCtLeLP90sGKc yPSZKfpfhvuXV7CQbwmklWWz0LcDU6ItQk3ayctEXZ1gLCprztsJVEDyws3b+nGm8OxR epWjk/66mfwghD5fRvPfQCiBCafcSyw2JFlJjC7t1V7fJ+PganF9b+//ZPMGCorNmFXM Oos1dqmojaJnUtiMe64EMbHs7+SpqRFn9KnkB9Af7+VIubPYL34IIAjTOc/K8+8XoeUQ /epw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=uS9vQFDc; 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 y20-20020a170902b49400b00178b88d40ebsi6749648plr.51.2022.10.31.02.42.35; Mon, 31 Oct 2022 02:42:48 -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=uS9vQFDc; 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 S229792AbiJaJfL (ORCPT + 99 others); Mon, 31 Oct 2022 05:35:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbiJaJfD (ORCPT ); Mon, 31 Oct 2022 05:35:03 -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 A13016388 for ; Mon, 31 Oct 2022 02:35:02 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id o4so15104242wrq.6 for ; Mon, 31 Oct 2022 02:35:02 -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=JtUZKzQUrpqcEXFv8pDDgeNhPJPq/sgeZszFG9JX3VY=; b=uS9vQFDcPVAgiNCyGslkup6PZZpz1fIO+HDVCnKJuRNi7aoSnXolCLjkRVOFsf3OIH tv3nRv3NqaUtC5/zZYjQsc9v70GO2wZLacs7yV75sdQTXwIrfF47TIz1hCEUvT0VrPpc GDStnwMm78uwhFSVGFqHOIloFVQWRRwnJ2fqeed1yZM2ssIoegQI0XW8h3yi4Fzfsnlc fPJlYjeeQP9PV+Hns6fh3KxugvlI6G3QN66VFHrqAZDR0/xlRtqjKMd7oT2Eo/M3fREo FZaKW9HSc0UmFjZD2AjnU+uwLsBJ7hwdQPhM4Vlu3yU5MWEEY00gXw3rM3+CjswrBEJw tYTA== 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=JtUZKzQUrpqcEXFv8pDDgeNhPJPq/sgeZszFG9JX3VY=; b=KU0K/ZP07czaZa0e4u3FjptHCS9fjCQRJ6FH6YzslRRqlC0WHhnOBmFArMSQwCki9n VdACwQvqqf6L3YnjKFvbXsAi75Z8teZGcam9vaonhG5P39LgHFBVZkynZvgZ8rHjss3y BRhFKTTR7nYELuV08S+pwAV4Wj/QV5NXiJecCR5nhdQx35h0g9mZNYQ8+3hBI7W5TRI+ YZAZhKnF0f7EanuNEX5bpgTi5bjm1WzkZYZZxhj9Cbsx0qvDtRrdqA04E4mY9zXJVK2d uhAV27YqNgmkY6PdPRVbXK966IbZUyuaL5rwutS6hTQgmCXREfA5smyHbUpGkA7eKfTF FrfQ== X-Gm-Message-State: ACrzQf0JvyAjGUwUaCWjc9FZtGUHCnbU1gxn99URLIQLGdBQoe8RGX+f vggNyCG0Rj0Vy3lURKx7Qjvn0Q== X-Received: by 2002:a5d:61c9:0:b0:236:781a:8d7e with SMTP id q9-20020a5d61c9000000b00236781a8d7emr7448092wrv.576.1667208901026; Mon, 31 Oct 2022 02:35:01 -0700 (PDT) Received: from fadwachiby.lan ([2001:861:3104:1980:6db3:63f:b30d:9361]) by smtp.gmail.com with ESMTPSA id t16-20020adff610000000b0023538fb27c1sm6547566wrp.85.2022.10.31.02.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 02:35:00 -0700 (PDT) From: fchiby@baylibre.com To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Johnson Wang , "Zhiyong . Tao" Cc: Fabien Parent , Fadwa CHIBY , Sen Chu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 3/3] soc: mediatek: pwrap: add mt8365 SoC support Date: Mon, 31 Oct 2022 10:33:58 +0100 Message-Id: <20221031093401.22916-4-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031093401.22916-1-fchiby@baylibre.com> References: <20221031093401.22916-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=unavailable 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?1748195730400478544?= X-GMAIL-MSGID: =?utf-8?q?1748195730400478544?= From: Fabien Parent Add PMIC Wrap support for MT8365 SoC. Signed-off-by: Fabien Parent Signed-off-by: Fadwa CHIBY Reviewed-by: AngeloGioacchino Del Regno --- 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 */ } };