From: "Joe Woodward" <jw@terrafix.co.uk>
To: Steve Sakoman <sakoman@gmail.com>, Ohad Ben-Cohen <ohad@wizery.com>
Cc: Chris Ball <cjb@laptop.org>,
linux-mmc@vger.kernel.org, Neil Brown <neilb@suse.de>,
Bing Zhao <bzhao@marvell.com>, Daniel Drake <dsd@laptop.org>
Subject: Re: mmc: sdio: runtime PM and 8686 problems
Date: Fri, 27 Apr 2012 09:26:13 +0100 [thread overview]
Message-ID: <WC20120427082613.2202AB@terrafix.co.uk> (raw)
In-Reply-To: <CAGDS+n=bYK4_RZMd9TeKTGafi6k9JQmu1u2ELuUQecTKxJ_gfg@mail.gmail.com>
-----Original Message-----
From: Steve Sakoman <sakoman@gmail.com>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Chris Ball <cjb@laptop.org>, Joe Woodward <jw@terrafix.co.uk>, linux-mmc@vger.kernel.org, Neil Brown <neilb@suse.de>, Bing Zhao
<bzhao@marvell.com>, Daniel Drake <dsd@laptop.org>
Date: Thu, 26 Apr 2012 16:51:10 -0700
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Mon, Dec 19, 2011 at 1:10 AM, Ohad Ben-Cohen <ohad@wizery.com>
> wrote:
>
> > We're slowly progressing towards understanding the issues we have
> with
> > the 8686 (it seems there are a few different hw revisions of it, some
> > of which do require toggling the reset pin before sending another
> init
> > sequence), but it might take some more time until a solution fully
> > materializes.
> >
> > Since 3.2 is just around the corner, I suggest we should now proceed
> > with the revert (see patch below), and later revisit this once we
> have
> > a complete solution in hand.
>
> Has any progress been made on this issue?
>
> I too have been trying to power down/up the wifi module on the Overo.
> I'm seeing the same issue described in this thread.
>
> Some additional data:
>
> I rebuilt my kernel (3.2) with a CD GPIO enabled for the mmc port the
> module
> is connected to and in turn connected that GPIO to another one that I
> can toggle from user space.
>
> Toggling the CD GPIO after powering back up the module does indeed
> work properly -- the module is detected, the driver loaded, and proper
> function
> restored.
>
> So basically the procedure I've used is:
>
> - decide wifi can be powered down
> - unload the libertas modules
> - put the wifi hw in reset with gpio16
> - wait till wifi is needed again
> - take the chip out of reset
> - toggle the CD gpio
> - libertas modules are autoloaded, as is the firmware
> - wifi is up and functioning
>
> So the next step is to get rid of the silly two GPIO external hardware
> hack. Is it possible to trigger a card insertion/removal event via
> some standard API?
>
> Or does the above information provide a clue as to why normal code
> paths don't work?
>
> Any other ideas?
>
> Steve
>
Since the patch has been reverted (i.e. no runtime PM) I haven't seen a problem.
I've not put any more work in to getting it to work with runtime PM i'm afriad.
On a side note, I'm doing something very similar to you with my Overo, except with one difference. Where you have routed a GPIO externally which you can toggle
from userspace, I've hacked the MMC driver (omap_hsmmc.c) to add a sysfs entry to force a re-scan. This also allows me to safely remove/insert SD cards (as the
Overo SDCard slot doesn't have a card-detect pin) when the device is running (I run from a ramfs).
I've thought for a while that a userspace hook to kick the MMC driver where this is no physical GPIO would be useful in mainline, but haven't done any more about
it.
Also, I've appled the first pass of patches to enable Libertas async firmware loading (as required by newer UDEVs).
I have two scripts pasted below to turn on/off the WiFi (the delays just work for me, I know they are not optimal).
Hope this helps.
Cheers,
Joe
> cat #wifi-down.sh
#!/bin/sh
echo "Turning off WiFi..."
echo "...stopping wlan0 interface"
ifdown wlan0
echo "...unloading WiFi kernel module"
modprobe -r libertas_sdio
echo "...disabling power to WiFi chip"
if [ -e /sys/class/gpio/gpio16/value ] ; then
echo "...already exported GPIO reset control"
else
echo "...exporting GPIO reset control"
echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
fi
echo 0 > /sys/class/gpio/gpio16/value
echo "...removing wpa configuration file"
rm /tmp/wpa_supplicant.conf
echo "..rescanning the MMC/SDIO as we have powered down the WiFi chip"
echo 1 > /sys/bus/platform/drivers/omap_hsmmc/omap_hsmmc.1/mmc_host/mmc1/rescan
sleep 2
echo "...done"
#> cat wifi-up.sh
#!/bin/sh
# Get the network parameters.
SSID=$1
PSK=$2
echo "Turning on WiFi..."
echo "...enabling power to WiFi chip"
if [ -e /sys/class/gpio/gpio16/value ] ; then
echo "...already exported GPIO reset control"
else
echo "...exporting GPIO reset control"
echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
fi
echo 0 > /sys/class/gpio/gpio16/value
usleep 10
echo 1 > /sys/class/gpio/gpio16/value
usleep 10
echo "..rescanning the MMC/SDIO as we have powered up the WiFi chip"
echo 1 > /sys/bus/platform/drivers/omap_hsmmc/omap_hsmmc.1/mmc_host/mmc1/rescan
### Wait for the device to be found.
sleep 2
### Set up the AP and password.
echo "...adding wpa configuration file"
rm /tmp/wpa_supplicant.conf
echo "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid=\"${SSID}\"
proto=WPA2 # try WPA RSN if you WPA2 fails
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
scan_ssid=1
psk=\"${PSK}\"
priority=10
}" > /tmp/wpa_supplicant.conf
echo "...loading WiFi kernel module"
modprobe libertas_sdio
### We must wait for the asynchronous firmware loading to complete.
sleep 2
echo "...starting wlan0 interface"
ifup wlan0
echo "...done"
=========
On 3.2 the rescan looks a bit like:
static ssize_t
omap_hsmmc_store_rescan(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev);
struct omap_hsmmc_host *host = mmc_priv(mmc);
printk (KERN_ERR "MMC: rescanning...\n");
if (!host->suspended)
schedule_work(&host->mmc_carddetect_work);
return size;
}
static DEVICE_ATTR(rescan, S_IWUGO, NULL, omap_hsmmc_store_rescan);
And I add in to omap_hsmmc_probe:
ret = device_create_file(&mmc->class_dev, &dev_attr_rescan);
if (ret < 0)
goto err_slot_name;
>
> >> When SDIO runtime PM was originally introduced, we immediately faced
> >> two regressions with two different chipsets, and in response decided
> >> not to enable it by default.
> >>
> >> With your work on the 8686 we hoped we found all the gotchas, so
> >> 08da834 did make sense (at least experimentally).
> >>
> >> Unfortunately we now see that some setups out there still refuse to
> >> work when SDIO runtime PM is enabled by default, and obviously we
> >> can't live with these kind of regressions.
> >>
> >> commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
> >> Author: Ohad Ben-Cohen <ohad@wizery.com>
> >> Date: Wed Nov 30 16:22:13 2011 +0200
> >>
> >> Revert "mmc: enable runtime PM by default"
> >>
> >> When SDIO runtime PM was originally introduced, we immediately
> faced
> >> two regressions with two different chipsets, and in response
> decided
> >> not to enable it by default.
> >>
> >> With the recent work on the 8686 we hoped we found all the
> gotchas,
> >> so 08da834 did make sense (at least experimentally).
> >>
> >> Unfortunately we now see that some setups out there still
> refuse to work
> >> when SDIO runtime PM is enabled by default (see
> >> http://www.spinics.net/lists/linux-mmc/msg11161.html), and
> obviously we
> >> can't live with these kind of regressions.
> >>
> >> This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
> >>
> >> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> >> Cc: Daniel Drake <dsd@laptop.org>
> >>
> >> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> >> index e8a5eb3..d31c78b 100644
> >> --- a/drivers/mmc/core/host.c
> >> +++ b/drivers/mmc/core/host.c
> >> @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra,
> struct
> >> device *dev)
> >> host->max_blk_size = 512;
> >> host->max_blk_count = PAGE_CACHE_SIZE / 512;
> >>
> >> - /*
> >> - * Enable runtime power management by default. This flag
> was added due
> >> - * to runtime power management causing disruption for
> some users, but
> >> - * the power on/off code has been improved since then.
> >> - *
> >> - * We'll enable this flag by default as an experiment,
> and if no
> >> - * problems are reported, we will follow up later and
> remove the flag
> >> - * altogether.
> >> - */
> >> - host->caps = MMC_CAP_POWER_OFF_CARD;
> >> -
> >> return host;
> >>
> >> free:
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-04-27 9:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-18 8:53 mmc: sdio: runtime PM and 8686 problems Joe Woodward
2011-11-18 9:06 ` Ohad Ben-Cohen
2011-11-18 10:00 ` Joe Woodward
2011-11-18 12:15 ` Ohad Ben-Cohen
2011-11-29 11:17 ` Joe Woodward
2011-11-29 12:43 ` Ohad Ben-Cohen
2011-11-29 21:42 ` Daniel Drake
2011-11-30 10:36 ` Ohad Ben-Cohen
2011-11-30 14:12 ` Daniel Drake
2011-11-30 14:29 ` Ohad Ben-Cohen
2011-11-30 14:57 ` Daniel Drake
2011-12-01 7:50 ` Ohad Ben-Cohen
2011-11-30 15:00 ` Joe Woodward
2011-12-01 8:07 ` Ohad Ben-Cohen
2011-12-01 11:28 ` Joe Woodward
2011-12-03 16:44 ` Daniel Drake
2011-12-03 16:45 ` Daniel Drake
2011-12-07 12:28 ` Joe Woodward
2011-12-19 9:10 ` Ohad Ben-Cohen
2011-12-19 9:22 ` Ohad Ben-Cohen
2012-04-26 23:51 ` Steve Sakoman
2012-04-27 8:26 ` Joe Woodward [this message]
2012-04-28 9:51 ` NeilBrown
-- strict thread matches above, loose matches on Subject: below --
2011-12-01 11:29 Joe Woodward
2011-12-01 11:29 Joe Woodward
2011-11-11 7:26 [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device Seungwon Jeon
2011-11-11 9:38 ` S, Venkatraman
2011-11-11 19:01 ` merez
2011-11-14 9:46 ` Seungwon Jeon
2011-11-15 12:48 ` merez
2011-11-17 2:02 ` Seungwon Jeon
2011-11-17 9:16 ` mmc: sdio: runtime PM and 8686 problems Joe Woodward
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=WC20120427082613.2202AB@terrafix.co.uk \
--to=jw@terrafix.co.uk \
--cc=bzhao@marvell.com \
--cc=cjb@laptop.org \
--cc=dsd@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=neilb@suse.de \
--cc=ohad@wizery.com \
--cc=sakoman@gmail.com \
/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