Message ID | 20230710140825.47793-1-wsa+renesas@sang-engineering.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5059590vqx; Mon, 10 Jul 2023 07:19:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlHi4KM/Nfknfn5XvVeHzu5+Kgi3eH/O+f5GT7eEMZuVOEztbweeS83AYk1dhTrxrugijc1L X-Received: by 2002:a05:6a20:3942:b0:130:a400:1d88 with SMTP id r2-20020a056a20394200b00130a4001d88mr12641058pzg.32.1688998791367; Mon, 10 Jul 2023 07:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688998791; cv=none; d=google.com; s=arc-20160816; b=dfd9W3ArnJ+urJNCqq91K8Ia+w5sJTV8cE4N41bZcF7bwEDm7DwYhAU7xbEfRFyUZD E1eDq/yI37jY6xprnIrYpJ1pL5aNkwxB4vw+CYWfNxkBNZR34MZhbcEg039rXvXUUQqq v/6ACO9XsWhJ5UqXlQcbpqRKmdR/9F24ACVIOJm5hXWiz657Kg6rvGycltknjfukDxLx C2axeiU22TXL9crMFjxiuB39JWIOoGE21/ml0Ij8ErjQd8q+PmFHHbvs9MaqN/RiFgww Q+ci39nmcBV9UeaMbDlYyJizrM3+ugOGI8I1ybxbAyyE5Z9CzrCeZuUb1usVZl7oodTn XGHQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=iNzNDD5W5pPBSKU0n/acKnkO5UiphrUtev01tlu21FI=; fh=sIJromQaSyLVzxzzP9vp6w5qpwT4+ZymsX3HDHSLZXk=; b=zXdf336lOokQSw8dvo5EC/mTn2ZxvctXXpfmhZJnYb3Ds3RFV5m/k8JMEgxdM4BdIA ZMTa/uBi1FuvHqskqzTgyID6kwkFxnCf1Ujf88SLZAIYezxHlTxCuXxNmhaVxnWSLQR5 Y4wDpkmWBCH1OnOT15niWSwqgibdIUVZxdx5IjYxCdOGQFbnC4WJgfmC+vLb9Ucggtf+ 09R6cWV8+soIp+JgmeQ0qXZ8MtOG498B7Qu8dF7atlCAFtdNWAkhf7zc7hN4WXtwkL/o dzNZFx1Vh5Irb8qO4JDpAp/0dBYCaEwmPNEiNgddxCWpYDrRMvfmJCNv7fMr1dQxuyhU T/3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=EB60Nbhg; 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 eb13-20020a056a004c8d00b0068288aaf240si8836111pfb.212.2023.07.10.07.19.39; Mon, 10 Jul 2023 07:19:51 -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=@sang-engineering.com header.s=k1 header.b=EB60Nbhg; 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 S230421AbjGJOJM (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Mon, 10 Jul 2023 10:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbjGJOJK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 10:09:10 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00E4E123 for <linux-kernel@vger.kernel.org>; Mon, 10 Jul 2023 07:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=k1; bh=iNzNDD5W5pPBSK U0n/acKnkO5UiphrUtev01tlu21FI=; b=EB60NbhgFX5/WtalbJ117dKcJh9FD/ qsrqRyy8aYo9csnEPNEYC4sWdea87vQIsp40wytcHA9RKxzwsAByrHooD/ulh6lN H6tI3Ph99KyuvranQAKskZKNffsP0gF8zwQV4U/UPdEFcfNX8DCjYmtMt7OoFBKt pMOe0+qaZrB0+uyGsbHDEuJ8XDK60M+3N050NkHepBHvsxCuigVQFkeOQdaWjXkB ABb2LtLAR1FuY7RAQJ5X6upL3kSfVDbH1O28DdGP4nXSz0AYu+rxYFgz2vGqcRDI tARUXKF8wdx0o8fYPpvzJJ51mEUJj9dEn6Y1TMqr3CPf+h3+e9rsr2yA== Received: (qmail 936683 invoked from network); 10 Jul 2023 16:08:42 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 10 Jul 2023 16:08:42 +0200 X-UD-Smtp-Session: l3s3148p1@QC2ahCIA/IMqAjAyAhFxdwAj+2Ptlp2z From: Wolfram Sang <wsa+renesas@sang-engineering.com> To: linux-renesas-soc@vger.kernel.org, linux-mmc@vger.kernel.org Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>, Ulf Hansson <ulf.hansson@linaro.org>, linux-kernel@vger.kernel.org Subject: [PATCH RFT] mmc: renesas_sdhi: register irqs before registering controller Date: Mon, 10 Jul 2023 16:08:25 +0200 Message-Id: <20230710140825.47793-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771043596969875986 X-GMAIL-MSGID: 1771043596969875986 |
Series |
[RFT] mmc: renesas_sdhi: register irqs before registering controller
|
|
Commit Message
Wolfram Sang
July 10, 2023, 2:08 p.m. UTC
IRQs should be ready to serve when we call mmc_add_host() via
tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked
before registering the handlers.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Based on 6.5-rc1 with bf54dec9e953 ("Revert "mmc: Revert "mmc: core:
Allow mmc_start_host() synchronously detect a card") reverted. That base
alone shows the regression. This patch works fine on a Salvator-X with a
M3-W. I'll test more boards. Yet, I send it out so people can tests with
boards I don't have.
drivers/mmc/host/renesas_sdhi_core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Comments
Hi Wolfram Sang, Thanks for the patch. > -----Original Message----- > From: Wolfram Sang <wsa+renesas@sang-engineering.com> > Sent: Monday, July 10, 2023 3:08 PM > To: linux-renesas-soc@vger.kernel.org; linux-mmc@vger.kernel.org > Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>; Ulf Hansson > <ulf.hansson@linaro.org>; linux-kernel@vger.kernel.org > Subject: [PATCH RFT] mmc: renesas_sdhi: register irqs before registering > controller > > IRQs should be ready to serve when we call mmc_add_host() via > tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked > before registering the handlers. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > > Based on 6.5-rc1 with bf54dec9e953 ("Revert "mmc: Revert "mmc: core: > Allow mmc_start_host() synchronously detect a card") reverted. That base > alone shows the regression. This patch works fine on a Salvator-X with a > M3-W. I'll test more boards. Yet, I send it out so people can tests with > boards I don't have. Tested on RZ/V2L SMARC EVK, after Revert "mmc: Revert "mmc: core: Allow mmc_start_host() synchronously detect a card"" Cheers, Biju > > drivers/mmc/host/renesas_sdhi_core.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/mmc/host/renesas_sdhi_core.c > b/drivers/mmc/host/renesas_sdhi_core.c > index 345934e4f59e..499d043f034f 100644 > --- a/drivers/mmc/host/renesas_sdhi_core.c > +++ b/drivers/mmc/host/renesas_sdhi_core.c > @@ -1004,10 +1004,11 @@ int renesas_sdhi_probe(struct platform_device > *pdev, > host->ops.start_signal_voltage_switch = > renesas_sdhi_start_signal_voltage_switch; > host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; > - host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2; > host->reset = renesas_sdhi_reset; > } > > + host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? > TMIO_MASK_ALL_RCAR2 : > +TMIO_MASK_ALL; > + > /* Orginally registers were 16 bit apart, could be 32 or 64 > nowadays */ > if (!host->bus_shift && resource_size(res) > 0x100) /* old way to > determine the shift */ > host->bus_shift = 1; > @@ -1100,9 +1101,7 @@ int renesas_sdhi_probe(struct platform_device > *pdev, > host->ops.hs400_complete = renesas_sdhi_hs400_complete; > } > > - ret = tmio_mmc_host_probe(host); > - if (ret < 0) > - goto edisclk; > + sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, > +host->sdcard_irq_mask_all); > > num_irqs = platform_irq_count(pdev); > if (num_irqs < 0) { > @@ -1129,6 +1128,10 @@ int renesas_sdhi_probe(struct platform_device > *pdev, > goto eirq; > } > > + ret = tmio_mmc_host_probe(host); > + if (ret < 0) > + goto edisclk; > + > dev_info(&pdev->dev, "%s base at %pa, max clock rate %u MHz\n", > mmc_hostname(host->mmc), &res->start, host->mmc->f_max / > 1000000); > > -- > 2.35.1
Hi Wolfram, On Mon, Jul 10, 2023 at 4:10 PM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > IRQs should be ready to serve when we call mmc_add_host() via > tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked > before registering the handlers. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Thanks for your patch! > Based on 6.5-rc1 with bf54dec9e953 ("Revert "mmc: Revert "mmc: core: > Allow mmc_start_host() synchronously detect a card") reverted. That base > alone shows the regression. This patch works fine on a Salvator-X with a > M3-W. I'll test more boards. Yet, I send it out so people can tests with > boards I don't have. I guess bf54dec9e953 is your local commit that reverts commit fa700d73494abbd3 ("mmc: Revert "mmc: core: Allow mmc_start_host() synchronously detect a card"") in v6.5-rc1? > --- a/drivers/mmc/host/renesas_sdhi_core.c > +++ b/drivers/mmc/host/renesas_sdhi_core.c > @@ -1004,10 +1004,11 @@ int renesas_sdhi_probe(struct platform_device *pdev, > host->ops.start_signal_voltage_switch = > renesas_sdhi_start_signal_voltage_switch; > host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; > - host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2; > host->reset = renesas_sdhi_reset; > } > > + host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL; The condition above is always true. I assume you wanted to test "mmc_data->flags & TMIO_MMC_MIN_RCAR2" instead? > + > /* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */ > if (!host->bus_shift && resource_size(res) > 0x100) /* old way to determine the shift */ > host->bus_shift = 1; Gr{oetje,eeting}s, Geert
Hi Wolfram, On Mon, Jul 10, 2023 at 4:54 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Mon, Jul 10, 2023 at 4:10 PM Wolfram Sang > <wsa+renesas@sang-engineering.com> wrote: > > IRQs should be ready to serve when we call mmc_add_host() via > > tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked > > before registering the handlers. > > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > > Thanks for your patch! > > > Based on 6.5-rc1 with bf54dec9e953 ("Revert "mmc: Revert "mmc: core: > > Allow mmc_start_host() synchronously detect a card") reverted. That base > > alone shows the regression. This patch works fine on a Salvator-X with a > > M3-W. I'll test more boards. Yet, I send it out so people can tests with > > boards I don't have. > > I guess bf54dec9e953 is your local commit that reverts commit > fa700d73494abbd3 ("mmc: Revert "mmc: core: Allow mmc_start_host() > synchronously detect a card"") in v6.5-rc1? > > > --- a/drivers/mmc/host/renesas_sdhi_core.c > > +++ b/drivers/mmc/host/renesas_sdhi_core.c > > @@ -1004,10 +1004,11 @@ int renesas_sdhi_probe(struct platform_device *pdev, > > host->ops.start_signal_voltage_switch = > > renesas_sdhi_start_signal_voltage_switch; > > host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; > > - host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2; > > host->reset = renesas_sdhi_reset; > > } > > > > + host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL; > > The condition above is always true. I assume you wanted to test > "mmc_data->flags & TMIO_MMC_MIN_RCAR2" instead? No issues seen after reverting fa700d73494abbd3 and applying your patch (plus the fix below) on top of today's renesas-drivers release. --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -1004,11 +1004,12 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->ops.start_signal_voltage_switch = renesas_sdhi_start_signal_voltage_switch; host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; + host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2; host->reset = renesas_sdhi_reset; + } else { + host->sdcard_irq_mask_all = TMIO_MASK_ALL; } - host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL; - /* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */ if (!host->bus_shift && resource_size(res) > 0x100) /* old way to determine the shift */ host->bus_shift = 1; Gr{oetje,eeting}s, Geert
> No issues seen after reverting fa700d73494abbd3 and applying your patch > (plus the fix below) on top of today's renesas-drivers release. Thanks! I would have fixed it differently but I agree this is probably the best version when backporting is also considered.
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 345934e4f59e..499d043f034f 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -1004,10 +1004,11 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->ops.start_signal_voltage_switch = renesas_sdhi_start_signal_voltage_switch; host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; - host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2; host->reset = renesas_sdhi_reset; } + host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL; + /* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */ if (!host->bus_shift && resource_size(res) > 0x100) /* old way to determine the shift */ host->bus_shift = 1; @@ -1100,9 +1101,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->ops.hs400_complete = renesas_sdhi_hs400_complete; } - ret = tmio_mmc_host_probe(host); - if (ret < 0) - goto edisclk; + sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_all); num_irqs = platform_irq_count(pdev); if (num_irqs < 0) { @@ -1129,6 +1128,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, goto eirq; } + ret = tmio_mmc_host_probe(host); + if (ret < 0) + goto edisclk; + dev_info(&pdev->dev, "%s base at %pa, max clock rate %u MHz\n", mmc_hostname(host->mmc), &res->start, host->mmc->f_max / 1000000);