From patchwork Mon Oct 24 13:15:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fadwa Chiby X-Patchwork-Id: 10074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624787wru; Mon, 24 Oct 2022 12:52:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66EsOO851j2kXXX8EuPddIrkcvlPWNbOF8auYLruPkm3Qij6ZtoB69kp4g9hJpRYrzKrvj X-Received: by 2002:a17:90b:1b05:b0:20d:3b10:3800 with SMTP id nu5-20020a17090b1b0500b0020d3b103800mr76022466pjb.91.1666641144154; Mon, 24 Oct 2022 12:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641144; cv=none; d=google.com; s=arc-20160816; b=bXE4xmaEgRxY1zPsPv/Qu4EVVtxDVQpRVzua29p/TghMuoeQtnpPPuWDIGs9y1f/4f buu2ckd1m1kZ0o+XsCAao/o1gf3BXVUBgiMeouR6uj+fbrQQFc84upOMJ8IEObRzb87Z IMog3aL7hp/cSC9p9zV3aIYHwa7C5DQXEt1rLSxZ2hugkUSlnuNvI+ANIShD+rVFpNqz IgJ1Mhhod1jEao5lql1Yu5gsprLTgNL6CLICSk3g2D8bMgt2H0sVMi9YAjE0KVLHD1O8 3tAAUt18bvZNmfwa27p2qL3ji1B9rb+LQ13Gs+J2vKYQ2er90gXc2JBIfpMyA81VdmTB YYng== 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=WsCCx9OZk9wFj2/DVHgt3Y9x9iq5RdCeFLOz27acm5w=; b=HOyy/WgT+bIaIX6JoJAQerPzsQ6h5OmP3PyFDbEVu8CFyINQb21C4yRN0BeL5K+/Ek 2NdjR3AiIhomQIG4Za6Gs9LSYD2fqGAfiA8MWyWgZ4rjz2JJPiy6JtGi0jrTrzqfooux mmZBfmyb4O3x14Vl00083sALHxfhsUF6OSoZVibND7DGcc1B/sTOPfIfA7x2BSGdUxGp P9JNnzQkHa3GE74/ZfEo3Ad/w+sdwHJSsWN0Ytt9RPXFM8XxQrxkYDAqx2A8mBOMMLQI eE+slwI0hWSyM+IalP6J9wM/g9D/JoxtG77HNqwRRzrOjyosGUZ1uwTw44E/+PMwwAk2 M0+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=rqeArR92; 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 y13-20020a17090322cd00b0016db0d4f4c9si562024plg.65.2022.10.24.12.52.11; Mon, 24 Oct 2022 12:52: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=rqeArR92; 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 S232901AbiJXTva (ORCPT + 99 others); Mon, 24 Oct 2022 15:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbiJXTu3 (ORCPT ); Mon, 24 Oct 2022 15:50:29 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E12F5270224 for ; Mon, 24 Oct 2022 11:16:27 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id j15so6938001wrq.3 for ; Mon, 24 Oct 2022 11:16:27 -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=WsCCx9OZk9wFj2/DVHgt3Y9x9iq5RdCeFLOz27acm5w=; b=rqeArR92TWQ6RMFWhsf399K640S+XpWzzZv06BhqjdvwBgv0cFuyfyNyVw75iHGq+8 RWiFs4H8VIXOaELHbKBprqAia1Awk6Lwi+RPVbndvitt8QkbS47KwDs/FbIg2wq8O3/5 cVb0db7gr1AjtxhQn9zfcUhSJdLi5SGAeKx2/+mLUUc8RBGpJESxwXXU2MnWH2LZaR0e Rwh15l2xncqt74wRRx5iOkDKcpKPaf355ULSzSd10eTVOtNDKitBopy5YwUj3UyIqMCG CvVwGye8RdcgcITtU1h8RRdKOol4euRSetT8TV2PbuJFNilDRCuVeBCtdaseqKitzI52 3XDg== 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=WsCCx9OZk9wFj2/DVHgt3Y9x9iq5RdCeFLOz27acm5w=; b=z6ocHGtJwp8LBXfa4VEJKwPyyMOUsfIXew6KBKGnw5ya8GDsZguyBYvGXTzYMBIlMl //5w87EgnWYhlqZzS2mLasc0GmuvpDW2YQq/czslbHWbPhCEGgUd6psRkhDxvmAhm/Ax LlR7XbWyG7rhWrH2P9ShKQZUgj2DxISc7upa3O+ScZTL3WRgvCZXi0ZeIX338zpvlNy5 wCGONWPJ/37+YSS2AcVCl0J9glgxA+a5X6rbLtc2vDlo1kYBnyb/ws78cTYuQL4+CzmQ XgyXY9p5N4uXNnIMlEhNpiVtOUVPFNFaGcT/zu2ehkhDLAY06lIJiijH97IHVls4a7nf 00ZQ== X-Gm-Message-State: ACrzQf2AZ2uhDXiUsyd+iSunF6+PWra6io3KMGg//Z+Y4suDU7e8u0g3 Wchiw7oi/t6GbUEcf+zOrdfQrSNxFrqNfhQ1 X-Received: by 2002:adf:a4cc:0:b0:235:f41c:aa1e with SMTP id h12-20020adfa4cc000000b00235f41caa1emr15137169wrb.515.1666617393516; Mon, 24 Oct 2022 06:16:33 -0700 (PDT) Received: from fadwachiby.baylibre (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id l24-20020a056000023800b00236627c078esm6322307wrz.110.2022.10.24.06.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 06:16:32 -0700 (PDT) From: Fadwa CHIBY X-Google-Original-From: Fadwa CHIBY 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 v2 3/3] soc: mediatek: pwrap: add mt8365 SoC support Date: Mon, 24 Oct 2022 15:15:43 +0200 Message-Id: <20221024131544.31219-4-fchiby@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024131544.31219-1-fchiby@baylibre.com> References: <20221024131544.31219-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 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?1747599904061092563?= X-GMAIL-MSGID: =?utf-8?q?1747599904061092563?= 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 */ } };