From: Romain Izard <romain.izard.pro@gmail.com>
To: linux-mmc@vger.kernel.org
Subject: [PATCH] Re: How to trigger sdio bus probing from user space
Date: Fri, 27 Sep 2013 13:56:14 +0000 (UTC) [thread overview]
Message-ID: <l242pu$fog$1@ger.gmane.org> (raw)
In-Reply-To: 52455BCD.5040309@rt-rk.com
On 2013-09-27, Bojan Prtvar <bojan.prtvar@rt-rk.com> wrote:
>
> Is there a clean way to trigger sdio bus probing from user space?
>
> I have a non removable sdio WiFi/BT module on embedded system that needs
> to be tested and calibrated on production line.
> In order to speed up production process, I need to be able to replace
> the WiFi/BT modules in run time without reboot.
> Modules are connected to the host with a ribbon cable, not with a sdio
> connector.
>
> I came up with fallowing two-part solution:
> a)
> I extended WiFi driver's /proc interface with a call to
> mmc_detect_change()
> b)
> I also needed to let the sdio host think module is removable by
> commenting fallowing in sdhci-mv.c:
> sdhci_mv_probe_dt(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> struct sdhci_host *host = platform_get_drvdata(pdev);
>
> if (of_get_property(np, "mrvl,card-wired", NULL)) {
> /*
> * RT-RK
> * We need to comment out these in order to be able to
> * trigger sdio bus probing on the fly
> */
> //host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
> //host->mmc->caps |= MMC_CAP_NONREMOVABLE;
> }
>
> This works in situations when working modules are inserted.
> Unfortunately, it does not work in case when broken module is inserted
> on production line.
> In this case production board needs to be rebooted, because the WiFi
> driver's /proc interface is gone, and I can not force a call to
> mmc_detect_change() any more.
>
> Is there cleaner and better approach?
For internal use I have added a 'rescan' sysfs entry to the mmc
controller, instead of the sdio device itself. It is quite similar to
the way it is done in the scsi subsystem, and uses the same
'mmc_detect_change' function as you do .
Updated to use the new attribute groups syntax for 3.12, I obtain the
following patch - compile-tested only, nothing more, as I do not have a
3.12 test system available.
---
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 49bc403..b5b0811 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -39,9 +39,26 @@ static void mmc_host_classdev_release(struct device *dev)
kfree(host);
}
+static ssize_t rescan_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct mmc_host *host = cls_dev_to_mmc_host(dev);
+ mmc_detect_change(host, 0);
+ return count;
+}
+
+static DEVICE_ATTR_WO(rescan);
+
+static struct attribute *mmc_host_attrs[] = {
+ &dev_attr_rescan.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(mmc_host);
+
static struct class mmc_host_class = {
.name = "mmc_host",
.dev_release = mmc_host_classdev_release,
+ .dev_groups = mmc_host_groups,
};
int mmc_register_host_class(void)
--
Romain Izard
next prev parent reply other threads:[~2013-09-27 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 10:19 How to trigger sdio bus probing from user space Bojan Prtvar
2013-09-27 13:56 ` Romain Izard [this message]
2013-09-30 11:56 ` [PATCH] " Bojan Prtvar
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='l242pu$fog$1@ger.gmane.org' \
--to=romain.izard.pro@gmail.com \
--cc=linux-mmc@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).