[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190226112921.GB7654@latitude>
Date: Tue, 26 Feb 2019 12:29:21 +0100
From: Jonathan Neuschäfer <j.neuschaefer@....net>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Jonathan Neuschäfer <j.neuschaefer@....net>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc: spi: Fix card detection during probe
On Tue, Feb 26, 2019 at 09:18:06AM +0100, Ulf Hansson wrote:
> On Sun, 10 Feb 2019 at 18:31, Jonathan Neuschäfer <j.neuschaefer@....net> wrote:
> >
> > When using the mmc_spi driver with a card-detect pin, I noticed that the
> > card was not detected immediately after probe, but only after it was
> > unplugged and plugged back in (and the CD IRQ fired).
> >
> > The call tree looks something like this:
> >
> > mmc_spi_probe
> > mmc_add_host
> > mmc_start_host
> > _mmc_detect_change
> > mmc_schedule_delayed_work(&host->detect, 0)
> > mmc_rescan
> > host->bus_ops->detect(host)
> > mmc_detect
> > _mmc_detect_card_removed
> > host->ops->get_cd(host)
> > mmc_gpio_get_cd -> -ENOSYS (ctx->cd_gpio not set)
> > mmc_gpiod_request_cd
> > ctx->cd_gpio = desc
> >
> > To fix this issue, call mmc_detect_change after the card-detect GPIO/IRQ
> > is registered.
> >
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@....net>
>
> This works well as fix and for stable! However, we should probably
> clean up the code in ->probe() to avoid this thing altogether.
I figured that calling mmc_gpiod_request_cd before mmc_add_host *should*
avoid the 'return -ENOSYS' in mmc_gpio_get_cd. However it turned out to
be not as simple as swapping around a few lines in mmc_spi_probe, when I
wrote/tested this patch.
> Anyway, I send a patch for that - on top.
Thanks!
> Applied for fixes and added a stable tag, thanks!
Great.
Thanks,
Jonathan Neuschäfer
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists