mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Arend van Spriel <aspriel@gmail.com>,
	Franky Lin <franky.lin@broadcom.com>,
	Hante Meuleman <hante.meuleman@broadcom.com>,
	Kalle Valo <kvalo@kernel.org>, Eric Dumazet <edumazet@google.com>,
	Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>,
	Alexander Prutskov <alep@cypress.com>,
	Joseph chuang <jiac@cypress.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Angus Ainslie <angus@akkea.ca>, Pierre-Hugues Husson <phh@phh.me>,
	linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-amlogic@lists.infradead.org
Subject: Re: [RFC PATCH] brcmfmac: add 43751 SDIO ids and initialization
Date: Mon, 13 Mar 2023 15:41:13 +0100	[thread overview]
Message-ID: <da979443-7a99-b0c8-911b-c5a0d21d595f@free.fr> (raw)
In-Reply-To: <3d91a067-c9c3-6d71-11a7-1289ea67f109@free.fr>

On 13/03/2023 14:55, Marc Gonzalez wrote:

> On 09/03/2023 18:51, Marc Gonzalez wrote:
> 
>> On 09/03/2023 15:29, Ulf Hansson wrote:
>>
>>> To narrow down the problem, I would start by preventing the WiFi
>>> driver from being insmoded. To make sure it doesn't affect the SDIO
>>> card detection process.
>>>
>>> The point is, the SDIO card should be detected properly, no matter
>>> whether there is a corresponding SDIO func driver (WiFi driver)
>>> available for it. For a detected SDIO/eMMC/SD card, mmc_add_card()
>>> prints a message about the card in the log during initialization. It
>>> could look like the below print, for example:
>>>
>>> "mmc2: new ultra high speed SDR104 SDIO card at address 0001".
>>
>> OK, I built the WiFi driver as a module which is NOT loaded at boot time.
> 
> Still trying to bisect this heisenbug into submission... :(
> 
> So far, I've pared it down to mmc_attach_sdio()
> 
> When probe WORKS, mmc_attach_sdio() returns 0.
> When probe FAILS, mmc_attach_sdio() returns ETIMEDOUT
> via mmc_send_io_op_cond(host, 0, &ocr);
> 
> Wrapping mmc_send_io_op_cond() in a loop
> makes it work on the second try.
> 
> Would appreciate additional guidance. Am mostly stabbing in the dark :)

Caught the race "in the act" (in flagrante delicto)

Using this patch:

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index f64b9ac76a5cd..eb2c95721e32c 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1204,11 +1204,24 @@ int mmc_attach_sdio(struct mmc_host *host)
 	struct mmc_card *card;
 
 	WARN_ON(!host->claimed);
-
+	//printk("YO %s: %s", __func__, mmc_hostname(host));
+	//msleep(500);
+
+#if 1
+	for (i = 0; i < 10; ++i) {
+		err = mmc_send_io_op_cond(host, 0, &ocr);
+		printk("YO %s", mmc_hostname(host));
+		if (!err) goto all_good;
+	}
+	printk("%s failed with %d", __func__, err);
+	return err;
+#else
 	err = mmc_send_io_op_cond(host, 0, &ocr);
 	if (err)
 		return err;
+#endif
 
+all_good:
 	mmc_attach_bus(host, &mmc_sdio_ops);
 	if (host->ocr_avail_sdio)
 		host->ocr_avail = host->ocr_avail_sdio;



Two boots of the same kernel:


/* THIS RUN PROBES ONCE */

[    0.846591] loop: module loaded
[    0.848079] g12a-mdio_mux ff64c000.mdio-multiplexer: Driver g12a-mdio_mux requests probe deferral
[    0.853901] usbcore: registered new interface driver usb-storage
[    0.859421] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    0.867880] meson-vrtc ff8000a8.rtc: registered as rtc0
[    0.872148] meson-vrtc ff8000a8.rtc: setting system clock to 1970-01-01T00:00:00 UTC (0)
[    0.880251] i2c_dev: i2c /dev entries driver
[    0.886780] psci-cpuidle: probe of psci-cpuidle rejects match -19
[    0.891279] ledtrig-cpu: registered to indicate activity on CPUs
[    0.891505] meson-gx-mmc ffe03000.sd: allocated mmc-pwrseq
[    0.896644] meson-sm: secure-monitor enabled
[    0.906242] hid: raw HID events driver (C) Jiri Kosina
[    0.911506] usbcore: registered new interface driver usbhid
[    0.916638] usbhid: USB HID core driver
[    0.922897] optee: probing for conduit method.
[    0.924837] optee: revision 2.4
[    0.925770] optee: initialized driver
[    0.932832] NET: Registered PF_PACKET protocol family
[    0.936627] Key type dns_resolver registered
[    0.941251] YO mmc2
[    0.945287] registered taskstats version 1
[    0.946989] Loading compiled-in X.509 certificates
[    1.074273] sdio_read_cis: vendor=2d0 dev=aae7
[    1.074824] sdio_read_cis: vendor=2d0 dev=aae7
[    1.074862] mmc2: new ultra high speed SDR50 SDIO card at address 0001


/* THIS RUN REQUIRES TWO PROBES */

[    0.855536] loop: module loaded
[    0.857064] g12a-mdio_mux ff64c000.mdio-multiplexer: Driver g12a-mdio_mux requests probe deferral
[    0.862952] usbcore: registered new interface driver usb-storage
[    0.868480] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    0.877000] meson-vrtc ff8000a8.rtc: registered as rtc0
[    0.881206] meson-vrtc ff8000a8.rtc: setting system clock to 1970-01-01T00:00:00 UTC (0)
[    0.889310] i2c_dev: i2c /dev entries driver
[    0.895850] psci-cpuidle: probe of psci-cpuidle rejects match -19
[    0.900536] meson-gx-mmc ffe03000.sd: allocated mmc-pwrseq
[    0.905438] ledtrig-cpu: registered to indicate activity on CPUs
[    0.911212] meson-sm: secure-monitor enabled
[    0.915235] hid: raw HID events driver (C) Jiri Kosina
[    0.920576] usbcore: registered new interface driver usbhid
[    0.925700] usbhid: USB HID core driver
[    0.931999] optee: probing for conduit method.
[    0.933912] optee: revision 2.4
[    0.934875] optee: initialized driver
[    0.941567] YO mmc2
[    0.941764] NET: Registered PF_PACKET protocol family
[    0.942884] YO mmc2
[    0.947738] Key type dns_resolver registered
[    0.958079] registered taskstats version 1
[    0.958190] Loading compiled-in X.509 certificates
[    1.068023] g12a-mdio_mux ff64c000.mdio-multiplexer: Driver g12a-mdio_mux requests probe deferral
[    1.072434] g12a-mdio_mux ff64c000.mdio-multiplexer: Driver g12a-mdio_mux requests probe deferral
[    1.072766] meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
[    1.081297] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.101201] sdio_read_cis: vendor=2d0 dev=aae7
[    1.101755] sdio_read_cis: vendor=2d0 dev=aae7
[    1.101794] mmc2: new ultra high speed SDR50 SDIO card at address 0001



NOTA BENE: for mmc1, in both runs, kernel probes 10 times and fails with:

[    1.265231] mmc_attach_sdio failed with -110
[    1.373006] mmc1: new HS200 MMC card at address 0001
[    1.377242] mmcblk1: mmc1:0001 SCA16G 14.7 GiB 
[    1.383718] mmcblk1boot0: mmc1:0001 SCA16G 4.00 MiB 
[    1.387257] mmcblk1boot1: mmc1:0001 SCA16G 4.00 MiB 
[    1.391912] mmcblk1rpmb: mmc1:0001 SCA16G 4.00 MiB, chardev (246:0)

mmc_attach_sdio() fails but mmc_add_card() succeeds anyway...?
Confused.
mmc_attach_sdio() doesn't call mmc_add_card() if it exits prematurely.

Regards


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2023-03-13 14:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 18:19 Unsupported WiFi adapter on S905X2 board Marc Gonzalez
2023-03-06  9:17 ` Neil Armstrong
2023-03-06 10:24   ` [RFC PATCH] brcmfmac: add 43751 SDIO ids and initialization Marc Gonzalez
2023-03-06 10:41     ` Marc Gonzalez
2023-03-07 14:40       ` Marc Gonzalez
2023-03-07 23:15         ` Franky Lin
2023-03-08 12:47           ` Marc Gonzalez
2023-03-08 17:21             ` Franky Lin
2023-03-08 17:37               ` Neil Armstrong
2023-03-22 17:40               ` Marc Gonzalez
2023-04-04 15:59                 ` Marc Gonzalez
2023-03-09 10:16     ` Marc Gonzalez
2023-03-09 12:13       ` Marc Gonzalez
2023-03-09 14:29         ` Ulf Hansson
2023-03-09 16:45           ` Marc Gonzalez
2023-03-09 17:51           ` Marc Gonzalez
2023-03-13 13:55             ` Marc Gonzalez
2023-03-13 14:41               ` Marc Gonzalez [this message]
2023-03-13 14:53                 ` Marc Gonzalez
2023-03-13 17:09               ` Marc Gonzalez
2023-03-13 20:04                 ` Martin Blumenstingl
2023-03-13 21:42                   ` Marc Gonzalez
2023-03-14  7:27                     ` Ulf Hansson
     [not found]                       ` <c7e48c6f-530b-7198-b8bb-fc927a2fdc66@free.fr>
2023-03-14 11:08                         ` Ulf Hansson
2023-03-14 16:37                           ` Marc Gonzalez
2023-03-15 20:55                             ` Ulf Hansson

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=da979443-7a99-b0c8-911b-c5a0d21d595f@free.fr \
    --to=marc.w.gonzalez@free.fr \
    --cc=alep@cypress.com \
    --cc=angus@akkea.ca \
    --cc=aspriel@gmail.com \
    --cc=edumazet@google.com \
    --cc=franky.lin@broadcom.com \
    --cc=hante.meuleman@broadcom.com \
    --cc=jbrunet@baylibre.com \
    --cc=jiac@cypress.com \
    --cc=khilman@baylibre.com \
    --cc=kvalo@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=phh@phh.me \
    --cc=pieter-paul.giesberts@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®