Search Linux Wireless

Re: [RFC PATCH] brcmfmac: add 43751 SDIO ids and initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux