From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2CC4C6FD19 for ; Mon, 13 Mar 2023 14:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j6oSSrijVtZcJZIxOTx3pI5K3vBve6GuXz+eeutzDuE=; b=lMab6Wyv8rBXAD I6a4nUuhGFHdV/wioEC6qtUWiX4LSV7bJk6Kod+h3MQft4kF9pgCi650o7uNr8cYQ7zq/J4qgJRPm KMPmRXd+k16aRzo7219mABGsl2RCEKNc9jl4a4J3z4XMWz4L0pdYxKSrekU4Q3+Yv+IEpynFUq9iQ 7HrGWL8f7lRdcUxXXSaTdSXOd55c5O8h+WLSbAe2wmXfpvKRofYGl0FdPeyYO0boJJvi3YqphDLb1 K7JvRQuHxOx1oesN4AcQ4LHBMEDz1ysMSIo2LvC4e3YQTz9rZ/JUngPGPSYDV6JauyFKrcjtJ3Nkb oGRl75KbHUcFireT6qeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbjMs-006AKP-CT; Mon, 13 Mar 2023 14:41:42 +0000 Received: from smtp2-g21.free.fr ([212.27.42.2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbjMo-006AIr-Gx for linux-amlogic@lists.infradead.org; Mon, 13 Mar 2023 14:41:40 +0000 Received: from [192.168.108.81] (unknown [213.36.7.13]) (Authenticated sender: marc.w.gonzalez@free.fr) by smtp2-g21.free.fr (Postfix) with ESMTPSA id 7C99720040F; Mon, 13 Mar 2023 15:41:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1678718496; bh=jHWvZ9GrC/ieXg7Cg0vUPFioY8hbPYWnhYGRHJxj67U=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=aAWvVKFgvIG3Y8nOAfipbX9cZT83eQAVcg7wBKUsOZXbaVMTc7RbyVHbt9TXwHYwG 47nxIQHR/I3X6kv3UUYduQne6KpWSfmfkeoQ8NjTID9V2u3AfILGR3LOtH/ASXlZyW qyEQqbAJyuBGEw0RsW76Pyp+ZjpfuAYRASLvOAqUHYM6vmEKwdWMI0za6Q/+QZ9M+Z PfKT779FDJt0Q4qDG0A1hq9pUy5p/xi+uQZgsTprhMp010cXZy8IR9I04YUqi1xkJk 051ypzqaO1+OK/x+b5CYY4UfK+mdQEeMO1abAm6+Z3xU3zNXfm5rNIt13fsRrvPl/2 61zeiQrMaBfrg== Message-ID: Date: Mon, 13 Mar 2023 15:41:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [RFC PATCH] brcmfmac: add 43751 SDIO ids and initialization Content-Language: en-US From: Marc Gonzalez To: Ulf Hansson Cc: Neil Armstrong , Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , Eric Dumazet , Pieter-Paul Giesberts , Alexander Prutskov , Joseph chuang , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Angus Ainslie , Pierre-Hugues Husson , linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org References: <05977cbb-8a8f-0a67-b4bd-b265dbb83280@free.fr> <895a3812-e490-cc40-0f8e-a88e166e8f24@linaro.org> <13676dcc-944f-cf3d-8adf-ee3d4e8fa699@free.fr> <0450e34e-7190-104c-832a-150f15f7c825@free.fr> <3d91a067-c9c3-6d71-11a7-1289ea67f109@free.fr> In-Reply-To: <3d91a067-c9c3-6d71-11a7-1289ea67f109@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_074138_737876_25F281B3 X-CRM114-Status: GOOD ( 21.98 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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