All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Peng Zhou <peng.zhou@mediatek.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	Satya Tangirala <satyat@google.com>,
	Wulin Li <wulin.li@mediatek.com>
Subject: Re: [PATCH v2 1/4] mmc: Mediatek: add Inline Crypto Engine support
Date: Thu, 11 Mar 2021 10:44:15 -0800	[thread overview]
Message-ID: <YEpk//tPRS47tLij@gmail.com> (raw)
In-Reply-To: <20210309015630.19545-1-peng.zhou@mediatek.com>

On Tue, Mar 09, 2021 at 09:56:31AM +0800, Peng Zhou wrote:
> 1. add crypto clock control and ungate it before CQHCI init
> 
> 2. set MMC_CAP2_CRYPTO property of eMMC
> 
> Signed-off-by: Peng Zhou <peng.zhou@mediatek.com>
> ---
>  drivers/mmc/host/mtk-sd.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 898ed1b023df..1c90360d6cf2 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -442,6 +442,7 @@ struct msdc_host {
>  	struct clk *src_clk_cg; /* msdc source clock control gate */
>  	struct clk *sys_clk_cg;	/* msdc subsys clock control gate */
>  	struct clk_bulk_data bulk_clks[MSDC_NR_CLOCKS];
> +	struct clk *crypto_clk; /* msdc crypto clock */
>  	u32 mclk;		/* mmc subsystem clock frequency */
>  	u32 src_clk_freq;	/* source clock frequency */
>  	unsigned char timing;
> @@ -802,6 +803,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_disable_unprepare(host->crypto_clk);
>  	clk_bulk_disable_unprepare(MSDC_NR_CLOCKS, host->bulk_clks);
>  	clk_disable_unprepare(host->src_clk_cg);
>  	clk_disable_unprepare(host->src_clk);
> @@ -822,6 +824,7 @@ static void msdc_ungate_clock(struct msdc_host *host)
>  		dev_err(host->dev, "Cannot enable pclk/axi/ahb clock gates\n");
>  		return;
>  	}
> +	clk_prepare_enable(host->crypto_clk);
>  
>  	while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB))
>  		cpu_relax();
> @@ -2512,6 +2515,15 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  		goto host_free;
>  	}
>  
> +	/* only eMMC has crypto property */
> +	if ((mmc->caps2 & MMC_CAP2_NO_SD) && (mmc->caps2 & MMC_CAP2_NO_SDIO)) {
> +		host->crypto_clk = devm_clk_get(&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;
> @@ -2582,6 +2594,8 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  		host->dma_mask = DMA_BIT_MASK(32);
>  	mmc_dev(mmc)->dma_mask = &host->dma_mask;
>  
> +	/* here ungate due to cqhci init will access registers */
> +	msdc_ungate_clock(host);
>  	if (mmc->caps2 & MMC_CAP2_CQE) {
>  		host->cq_host = devm_kzalloc(mmc->parent,
>  					     sizeof(*host->cq_host),
> @@ -2618,7 +2632,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	spin_lock_init(&host->lock);
>  
>  	platform_set_drvdata(pdev, mmc);
> -	msdc_ungate_clock(host);
>  	msdc_init_hw(host);

I'm still not able to apply this patch.  You can see yourself if you check out
v5.12-rc2 (or mmc/next), download this email from lkml.kernel.org
(https://lkml.kernel.org/linux-mmc/20210309015630.19545-1-peng.zhou@mediatek.com/raw),
and use 'git am'.  It's probably related to the email being base64-encoded,
which it shouldn't be.

Also, this patch series isn't in a thread, so it's hard to follow.

Please make sure you use 'git format-patch --cover-letter v5.12-rc2..@' or
similar, and then 'git send-email', passing it all the patches (including the
cover letter) at once.  And please make sure that your company's mail server is
set up to properly handle plaintext email.

Thanks,

- Eric

      reply	other threads:[~2021-03-11 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  1:56 [PATCH v2 1/4] mmc: Mediatek: add Inline Crypto Engine support Peng Zhou
2021-03-11 18:44 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEpk//tPRS47tLij@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=peng.zhou@mediatek.com \
    --cc=satyat@google.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wulin.li@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.