From patchwork Mon Oct 17 14:20:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mengqi Zhang X-Patchwork-Id: 3474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1482476wrs; Mon, 17 Oct 2022 07:32:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PYP/mKAX2qU8EH4QRrZpWEMhN9kDFlGUHVVX4yh2hVtCdlTz4rcf5GLbX00xFPg1CtxMu X-Received: by 2002:a17:906:4786:b0:78d:c3c0:1508 with SMTP id cw6-20020a170906478600b0078dc3c01508mr8751887ejc.211.1666017161270; Mon, 17 Oct 2022 07:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666017161; cv=none; d=google.com; s=arc-20160816; b=KKL6e9HUu5zMYcwjbyITfWEGOehDIvo+auHf9xxPXtnLxJ5ujNNfRNvqSVpZDtDPL6 U4LrLel8SqkcYqQrVth+uIdNPQ9umDLzm0SJtLYltQVh6hSMgABhllKd5OYaNLiYMXgY AqCbYqCrBINlRpqBM+i95u5deqAF0OyH6rQn3+RBE9HgfaR31WgcV9ULCXppJPUXGPhN ZqcFsMxLNRtp30a/RB/hGeKvfT6lfK3wMwf6DosOOkM2PqEQj3+rf+lwAyj43Tn3Qhzs 0AFZpSioUT595iOa4rAk+2c0A54mk5fxU8N8cUtTZac9ALhzZikSfRH7Y/bfoTZEIraL 2p1g== 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=Bn+eB38yUNYYlB0kWIB5Ik9AssYvq2xUhGitlBC7pfw=; b=XqDUC+64B4Wvg1VljgRyTEdWM72MhOG5mRAdpvVgGn4QMi74fq5IHmkWdT00ZBaZXg UVzazqT9R31+kvkyUUv2Xwo8KfcWwgeixb/I3FGLVkfxG7SjArH3Cnd8POZzlMu8USnf JZIXNBwyUz5PUV7TfVMzAPRsd4utW/5dJTjIfg31xPXyS2jTwz84OLxlOwiiMxGhQkgM s77lMJQOEvEWOrMbkBXr9c+kJ7BYa6tXgcYMWggs69oP3bzw0ADSspXmlsoPkUuaF6wW HflDSU/ORBqsRZ9rfdkzYTF3p4Gr8a7n3BR7ljIuOxX9HAkyWROsXf/3qfahjH8bIUyu T58A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XoXkknxb; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk10-20020a1709077f8a00b0078d112eaf80si9614296ejc.86.2022.10.17.07.32.15; Mon, 17 Oct 2022 07:32:41 -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=@mediatek.com header.s=dk header.b=XoXkknxb; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbiJQOU0 (ORCPT + 99 others); Mon, 17 Oct 2022 10:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbiJQOUY (ORCPT ); Mon, 17 Oct 2022 10:20:24 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491AF24F2F; Mon, 17 Oct 2022 07:20:19 -0700 (PDT) X-UUID: 1799c7818eed4038ac64d6e192e8bed2-20221017 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Bn+eB38yUNYYlB0kWIB5Ik9AssYvq2xUhGitlBC7pfw=; b=XoXkknxbiCtUXaMlj34sbAYWv34G5PO5XBjHJjl2HNH5C8QqrOhE7mj0JY+R1vxkdHf4ZaU3Hl+LkURVpZ4JrkaH7MSGhXny8c+aNQTk32Sh4+Rrb8Levn6EnQB4d2T8Cyh3lLafJefuINVuBX2xUSyqXuVMn88c/72UJIp+3AE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:2adc0c2a-17f2-453e-8c2a-c6e918bdac14,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:39a5ff1,CLOUDID:95779fdb-0379-47b3-a5dd-2ef5001d380a,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 1799c7818eed4038ac64d6e192e8bed2-20221017 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 419762980; Mon, 17 Oct 2022 22:20:13 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Mon, 17 Oct 2022 22:20:12 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 17 Oct 2022 22:20:12 +0800 From: Mengqi Zhang To: , , , , , CC: , , , , , Mengqi Zhang Subject: [PATCH 1/2] mmc: mtk-sd: add Inline Crypto Engine support Date: Mon, 17 Oct 2022 22:20:06 +0800 Message-ID: <20221017142007.5408-2-mengqi.zhang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221017142007.5408-1-mengqi.zhang@mediatek.com> References: <20221017142007.5408-1-mengqi.zhang@mediatek.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY 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?1746945611254840866?= X-GMAIL-MSGID: =?utf-8?q?1746945611254840866?= add crypto clock control and ungate it before CQHCI init. Signed-off-by: Mengqi Zhang Reviewed-by: AngeloGioacchino Del Regno --- drivers/mmc/host/mtk-sd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 69d78604d1fc..8b6ef8691e5b 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -452,6 +452,7 @@ struct msdc_host { struct clk *bus_clk; /* bus clock which used to access register */ struct clk *src_clk_cg; /* msdc source clock control gate */ struct clk *sys_clk_cg; /* msdc subsys clock control gate */ + struct clk *crypto_clk; /* msdc crypto clock control gate */ struct clk_bulk_data bulk_clks[MSDC_NR_CLOCKS]; u32 mclk; /* mmc subsystem clock frequency */ u32 src_clk_freq; /* source clock frequency */ @@ -811,6 +812,7 @@ static void msdc_set_busy_timeout(struct msdc_host *host, u64 ns, u64 clks) static void msdc_gate_clock(struct msdc_host *host) { clk_bulk_disable_unprepare(MSDC_NR_CLOCKS, host->bulk_clks); + clk_disable_unprepare(host->crypto_clk); clk_disable_unprepare(host->src_clk_cg); clk_disable_unprepare(host->src_clk); clk_disable_unprepare(host->bus_clk); @@ -826,6 +828,7 @@ static int msdc_ungate_clock(struct msdc_host *host) clk_prepare_enable(host->bus_clk); clk_prepare_enable(host->src_clk); clk_prepare_enable(host->src_clk_cg); + clk_prepare_enable(host->crypto_clk); ret = clk_bulk_prepare_enable(MSDC_NR_CLOCKS, host->bulk_clks); if (ret) { dev_err(host->dev, "Cannot enable pclk/axi/ahb clock gates\n"); @@ -2643,6 +2646,15 @@ static int msdc_drv_probe(struct platform_device *pdev) goto host_free; } + /* only eMMC has crypto property */ + if (!(mmc->caps2 & MMC_CAP2_NO_MMC)) { + host->crypto_clk = devm_clk_get_optional(&pdev->dev, "crypto"); + if (IS_ERR(host->crypto_clk)) + host->crypto_clk = NULL; + else + mmc->caps2 |= MMC_CAP2_CRYPTO; + } + host->irq = platform_get_irq(pdev, 0); if (host->irq < 0) { ret = -EINVAL; From patchwork Mon Oct 17 14:20:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mengqi Zhang X-Patchwork-Id: 3475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1482558wrs; Mon, 17 Oct 2022 07:32:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xuSWeuF5cYPoQhw+I8WPzKMSDmiRKhRqbddAxgskL/ILzaf2eIM87ZqGmQX+sWtnnE9rk X-Received: by 2002:a05:6402:24a0:b0:454:d197:6238 with SMTP id q32-20020a05640224a000b00454d1976238mr10298062eda.274.1666017173790; Mon, 17 Oct 2022 07:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666017173; cv=none; d=google.com; s=arc-20160816; b=fQkOIcn3N7yFmF/OsRwCREeanEDot6zdTXMdYVkYBzsXcbLhpLpWQ2p00gk6L2s853 lA1bzFzXom8WxuDHXWZ18C83kGhJk9aY+UIjiQmpbyJXg0StNIHfGK44AKu6VgQY+yHA RxjF2RV80dTB5Qj5S5wLdOEobGzHuW+9yVljpLNt2SLkaV/fYDQWx9UzhafQrQFCtEXw GYrYDvhrTum9WE2LqMGn42zEI+6MGygh/asC2X5hi8hQKh7J8zcr1qWKXbWpjo180M1v L9KhQnrDh/6rin1bpqEmoxXc59Ek+8/0Lr1p5+oT7Pz4PSMAZ+/pZtPZMoz11yLuPYbz y0hg== 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=SCTfi8EohP0/f/dHHu5qpABoBPiRJzFOeNfn7nLzrEY=; b=i0mrJ0BVBuvgMOmiTy/2LsSc47QQRff8BZf2BGqDC39l3AEied88v8gb2ryGzEgfds 7V66XRs1vVS47+XeKOHIUO+vZf3slImr8a+zzn7QJQR7fhHl/aHnyC0BwT+XKc7mbyyx Xbr6LTsY6PU2iStKEk+8le3yWgfoxYOTTDeFuOUglW+8U5JXQILZqQGoMrxWFAAqLZAH xYy5XkdEHWM9x45x5jsDNfuu4pUeW/+/T3qn1sP1dhqfZUti+wpPA2hOnq2TUPOUaxoX BtfPQwNXeEAzVHpeZ/Jc8lWdafM69UKGyk4zgUs+Mo0eOZIoz9sbJUXUcyePKOiFFQvu D70g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ChQ48xbw; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a17090606c500b0072b1964e54esi8499721ejb.1007.2022.10.17.07.32.27; Mon, 17 Oct 2022 07:32: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=@mediatek.com header.s=dk header.b=ChQ48xbw; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbiJQOU3 (ORCPT + 99 others); Mon, 17 Oct 2022 10:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbiJQOUY (ORCPT ); Mon, 17 Oct 2022 10:20:24 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1083F5B7B9; Mon, 17 Oct 2022 07:20:21 -0700 (PDT) X-UUID: 9cac9a65c168484abf404c38ca669c74-20221017 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=SCTfi8EohP0/f/dHHu5qpABoBPiRJzFOeNfn7nLzrEY=; b=ChQ48xbwQoffs2pVw5xsHQB1p2ZiyK7ymxsB2HU7eyz88Z0n1Nq5mp2NL6SJEK3CgdsUISZBnbGEctTjBg2oCDkR6mCmrRxklFgHU9ATCibStazGWULRldx2itReRLk6to58gKtL0PmwdFA38BAH+yvhcYE7dvcqF+Ke7+HjRZk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:a10657d5-d32c-45a8-bcb4-074bd6056c53,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:39a5ff1,CLOUDID:18d80aa4-ebb2-41a8-a87c-97702aaf2e20,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 9cac9a65c168484abf404c38ca669c74-20221017 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1120127280; Mon, 17 Oct 2022 22:20:15 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 17 Oct 2022 22:20:14 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 17 Oct 2022 22:20:13 +0800 From: Mengqi Zhang To: , , , , , CC: , , , , , Mengqi Zhang Subject: [PATCH 2/2] dt-bingdings: mmc: Mediatek: add ICE clock Date: Mon, 17 Oct 2022 22:20:07 +0800 Message-ID: <20221017142007.5408-3-mengqi.zhang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221017142007.5408-1-mengqi.zhang@mediatek.com> References: <20221017142007.5408-1-mengqi.zhang@mediatek.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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?1746945624212774768?= X-GMAIL-MSGID: =?utf-8?q?1746945624212774768?= Document the binding for crypto clock of the Inline Crypto Engine of Mediatek SoCs. Signed-off-by: Mengqi Zhang --- Documentation/devicetree/bindings/mmc/mtk-sd.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml index d8e1e2e9adf2..f93d686e2911 100644 --- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml +++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml @@ -57,6 +57,7 @@ properties: - description: peripheral bus clock gate (required for MT8192). - description: AXI bus clock gate (required for MT8192). - description: AHB bus clock gate (required for MT8192). + - description: crypto clock used for data encrypt/decrypt (optional). clock-names: minItems: 2 @@ -69,6 +70,7 @@ properties: - const: pclk_cg - const: axi_cg - const: ahb_cg + - const: crypto interrupts: description: