* mwifiex card reset
@ 2014-06-27 14:39 ` Andreas Fenkart
0 siblings, 0 replies; 25+ messages in thread
From: Andreas Fenkart @ 2014-06-27 14:39 UTC (permalink / raw)
To: Bing Zhao, Ulf Hansson,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mmc,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: Tony Lindgren, Daniel Mack
I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
The module is non-removable wired fix to soc. Now the wifi module
needs 2 clocks; one is a sleep clock the other used when not
sleeping.
While the sleep clock is fixed, @32 kHz, the system clock can be
one out of several values, but can be be derived automatically
from the sleep clock. But this requires the clock to be present
when the wifi module comes out of reset.
Another problem is software reboot, at initial power on the wifi
card will react to mmc discovery. After a software reset of the
host it will not, because it has already been disvovered and
didn't notice the host rebooted, unless we reset it as well.
While this seems obvious, the problem is that the reset is needed
before the card can be discovered. Which means we cannot move the
reset logic into the mwifiex driver, since that driver has not
yet been selected through vendor/product id.
the reset logic:
gpiod_set_value(card->gpiod_reset, 0);
clk_enable(card->sleep_clock);
udelay(1000);
gpiod_set_value(card->gpiod_reset, 1);
The idea so far was to extend the device-tree node of the
mmc slot by some reset leafs;
&mmc {
ti,non-removable;
..
peripheral-clocks = <&clk &clk2 ...>;
peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
}
in mmc_add_host, all clocks will be enabled and gpios be pulled
low for 1 msec
Is this a feasible solution?
Another related issue, is the card reset in mwifiex driver:
static void sdio_card_reset_worker(struct work_struct *work)
{
struct mmc_host *target = reset_host;
pr_err("Resetting card...\n");
mmc_remove_host(target);
/* 20ms delay is based on experiment with sdhci controller */
mdelay(20);
mmc_add_host(target);
}
static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
There are obviously a lot of problems with this, e.g. custom debugfs
entries created in the driver will be lost. But sometimes this
code might avert disaster in case the command handlers between
driver and firmware lost synchronization
How could this be done in a better way?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 25+ messages in thread* mwifiex card reset
@ 2014-06-27 14:39 ` Andreas Fenkart
0 siblings, 0 replies; 25+ messages in thread
From: Andreas Fenkart @ 2014-06-27 14:39 UTC (permalink / raw)
To: Bing Zhao, Ulf Hansson, linux-wireless@vger.kernel.org, linux-mmc,
devicetree
Cc: Tony Lindgren, Daniel Mack
I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
The module is non-removable wired fix to soc. Now the wifi module
needs 2 clocks; one is a sleep clock the other used when not
sleeping.
While the sleep clock is fixed, @32 kHz, the system clock can be
one out of several values, but can be be derived automatically
from the sleep clock. But this requires the clock to be present
when the wifi module comes out of reset.
Another problem is software reboot, at initial power on the wifi
card will react to mmc discovery. After a software reset of the
host it will not, because it has already been disvovered and
didn't notice the host rebooted, unless we reset it as well.
While this seems obvious, the problem is that the reset is needed
before the card can be discovered. Which means we cannot move the
reset logic into the mwifiex driver, since that driver has not
yet been selected through vendor/product id.
the reset logic:
gpiod_set_value(card->gpiod_reset, 0);
clk_enable(card->sleep_clock);
udelay(1000);
gpiod_set_value(card->gpiod_reset, 1);
The idea so far was to extend the device-tree node of the
mmc slot by some reset leafs;
&mmc {
ti,non-removable;
..
peripheral-clocks = <&clk &clk2 ...>;
peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
}
in mmc_add_host, all clocks will be enabled and gpios be pulled
low for 1 msec
Is this a feasible solution?
Another related issue, is the card reset in mwifiex driver:
static void sdio_card_reset_worker(struct work_struct *work)
{
struct mmc_host *target = reset_host;
pr_err("Resetting card...\n");
mmc_remove_host(target);
/* 20ms delay is based on experiment with sdhci controller */
mdelay(20);
mmc_add_host(target);
}
static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
There are obviously a lot of problems with this, e.g. custom debugfs
entries created in the driver will be lost. But sometimes this
code might avert disaster in case the command handlers between
driver and firmware lost synchronization
How could this be done in a better way?
^ permalink raw reply [flat|nested] 25+ messages in thread[parent not found: <CALtMJEBWPM+75wxM2Mp5EX_o6NWtZUJdYRCv6psbvdUn4k295w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: mwifiex card reset
2014-06-27 14:39 ` Andreas Fenkart
@ 2014-06-28 5:22 ` James Cameron
-1 siblings, 0 replies; 25+ messages in thread
From: James Cameron @ 2014-06-28 5:22 UTC (permalink / raw)
To: Andreas Fenkart
Cc: Bing Zhao, Ulf Hansson,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mmc,
devicetree-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Daniel Mack
On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
> I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
> The module is non-removable wired fix to soc. Now the wifi module
> needs 2 clocks; one is a sleep clock the other used when not
> sleeping.
> While the sleep clock is fixed, @32 kHz, the system clock can be
> one out of several values, but can be be derived automatically
> from the sleep clock. But this requires the clock to be present
> when the wifi module comes out of reset.
>
> Another problem is software reboot, at initial power on the wifi
> card will react to mmc discovery. After a software reset of the
> host it will not, because it has already been disvovered and
> didn't notice the host rebooted, unless we reset it as well.
> While this seems obvious, the problem is that the reset is needed
> before the card can be discovered. Which means we cannot move the
> reset logic into the mwifiex driver, since that driver has not
> yet been selected through vendor/product id.
>
we had same problem with sd8787 and a different system design. we
added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
sdhci_pxav3_toggle_reset_gpio()
1.
http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
2.
http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
> the reset logic:
> gpiod_set_value(card->gpiod_reset, 0);
> clk_enable(card->sleep_clock);
> udelay(1000);
> gpiod_set_value(card->gpiod_reset, 1);
>
> The idea so far was to extend the device-tree node of the
> mmc slot by some reset leafs;
>
> &mmc {
> ti,non-removable;
> ..
> peripheral-clocks = <&clk &clk2 ...>;
> peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
> }
>
> in mmc_add_host, all clocks will be enabled and gpios be pulled
> low for 1 msec
we used 5ms.
> Is this a feasible solution?
>
>
> Another related issue, is the card reset in mwifiex driver:
>
> static void sdio_card_reset_worker(struct work_struct *work)
> {
> struct mmc_host *target = reset_host;
>
> pr_err("Resetting card...\n");
> mmc_remove_host(target);
> /* 20ms delay is based on experiment with sdhci controller */
> mdelay(20);
> mmc_add_host(target);
> }
> static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
>
> There are obviously a lot of problems with this, e.g. custom debugfs
> entries created in the driver will be lost. But sometimes this
> code might avert disaster in case the command handlers between
> driver and firmware lost synchronization
>
> How could this be done in a better way?
i'm interested as well.
--
James Cameron
http://quozl.linux.org.au/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: mwifiex card reset
@ 2014-06-28 5:22 ` James Cameron
0 siblings, 0 replies; 25+ messages in thread
From: James Cameron @ 2014-06-28 5:22 UTC (permalink / raw)
To: Andreas Fenkart
Cc: Bing Zhao, Ulf Hansson, linux-wireless@vger.kernel.org, linux-mmc,
devicetree, Tony Lindgren, Daniel Mack
On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
> I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
> The module is non-removable wired fix to soc. Now the wifi module
> needs 2 clocks; one is a sleep clock the other used when not
> sleeping.
> While the sleep clock is fixed, @32 kHz, the system clock can be
> one out of several values, but can be be derived automatically
> from the sleep clock. But this requires the clock to be present
> when the wifi module comes out of reset.
>
> Another problem is software reboot, at initial power on the wifi
> card will react to mmc discovery. After a software reset of the
> host it will not, because it has already been disvovered and
> didn't notice the host rebooted, unless we reset it as well.
> While this seems obvious, the problem is that the reset is needed
> before the card can be discovered. Which means we cannot move the
> reset logic into the mwifiex driver, since that driver has not
> yet been selected through vendor/product id.
>
we had same problem with sd8787 and a different system design. we
added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
sdhci_pxav3_toggle_reset_gpio()
1.
http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
2.
http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
> the reset logic:
> gpiod_set_value(card->gpiod_reset, 0);
> clk_enable(card->sleep_clock);
> udelay(1000);
> gpiod_set_value(card->gpiod_reset, 1);
>
> The idea so far was to extend the device-tree node of the
> mmc slot by some reset leafs;
>
> &mmc {
> ti,non-removable;
> ..
> peripheral-clocks = <&clk &clk2 ...>;
> peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
> }
>
> in mmc_add_host, all clocks will be enabled and gpios be pulled
> low for 1 msec
we used 5ms.
> Is this a feasible solution?
>
>
> Another related issue, is the card reset in mwifiex driver:
>
> static void sdio_card_reset_worker(struct work_struct *work)
> {
> struct mmc_host *target = reset_host;
>
> pr_err("Resetting card...\n");
> mmc_remove_host(target);
> /* 20ms delay is based on experiment with sdhci controller */
> mdelay(20);
> mmc_add_host(target);
> }
> static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
>
> There are obviously a lot of problems with this, e.g. custom debugfs
> entries created in the driver will be lost. But sometimes this
> code might avert disaster in case the command handlers between
> driver and firmware lost synchronization
>
> How could this be done in a better way?
i'm interested as well.
--
James Cameron
http://quozl.linux.org.au/
^ permalink raw reply [flat|nested] 25+ messages in thread[parent not found: <20140628052220.GG10407-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>]
* Re: mwifiex card reset
2014-06-28 5:22 ` James Cameron
@ 2014-06-28 7:23 ` Tony Lindgren
-1 siblings, 0 replies; 25+ messages in thread
From: Tony Lindgren @ 2014-06-28 7:23 UTC (permalink / raw)
To: James Cameron
Cc: Andreas Fenkart, Bing Zhao, Ulf Hansson,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mmc,
devicetree-u79uwXL29TY76Z2rM5mHXA, Daniel Mack
* James Cameron <quozl-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org> [140628 08:24]:
> On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
> > I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
> > The module is non-removable wired fix to soc. Now the wifi module
> > needs 2 clocks; one is a sleep clock the other used when not
> > sleeping.
> > While the sleep clock is fixed, @32 kHz, the system clock can be
> > one out of several values, but can be be derived automatically
> > from the sleep clock. But this requires the clock to be present
> > when the wifi module comes out of reset.
> >
> > Another problem is software reboot, at initial power on the wifi
> > card will react to mmc discovery. After a software reset of the
> > host it will not, because it has already been disvovered and
> > didn't notice the host rebooted, unless we reset it as well.
> > While this seems obvious, the problem is that the reset is needed
> > before the card can be discovered. Which means we cannot move the
> > reset logic into the mwifiex driver, since that driver has not
> > yet been selected through vendor/product id.
> >
>
> we had same problem with sd8787 and a different system design. we
> added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
> sdhci_pxav3_toggle_reset_gpio()
>
> 1.
>
> http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
>
> 2.
>
> http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
>
> > the reset logic:
> > gpiod_set_value(card->gpiod_reset, 0);
> > clk_enable(card->sleep_clock);
> > udelay(1000);
> > gpiod_set_value(card->gpiod_reset, 1);
> >
> > The idea so far was to extend the device-tree node of the
> > mmc slot by some reset leafs;
> >
> > &mmc {
> > ti,non-removable;
> > ..
> > peripheral-clocks = <&clk &clk2 ...>;
> > peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
> > }
> >
> > in mmc_add_host, all clocks will be enabled and gpios be pulled
> > low for 1 msec
>
> we used 5ms.
>
> > Is this a feasible solution?
> >
> >
> > Another related issue, is the card reset in mwifiex driver:
> >
> > static void sdio_card_reset_worker(struct work_struct *work)
> > {
> > struct mmc_host *target = reset_host;
> >
> > pr_err("Resetting card...\n");
> > mmc_remove_host(target);
> > /* 20ms delay is based on experiment with sdhci controller */
> > mdelay(20);
> > mmc_add_host(target);
> > }
> > static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
> >
> > There are obviously a lot of problems with this, e.g. custom debugfs
> > entries created in the driver will be lost. But sometimes this
> > code might avert disaster in case the command handlers between
> > driver and firmware lost synchronization
> >
> > How could this be done in a better way?
>
> i'm interested as well.
Wouldn't it be best to have the mwifiex properly handle the
reset GPIOs and idle status pins?
Those are not part of the SDIO spec AFAIK, and the mmc
controller should not need to care about those.
Also, at least omaps also have an issue where suspend won't
work with mwifiex loaded FYI.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: mwifiex card reset
@ 2014-06-28 7:23 ` Tony Lindgren
0 siblings, 0 replies; 25+ messages in thread
From: Tony Lindgren @ 2014-06-28 7:23 UTC (permalink / raw)
To: James Cameron
Cc: Andreas Fenkart, Bing Zhao, Ulf Hansson,
linux-wireless@vger.kernel.org, linux-mmc, devicetree,
Daniel Mack
* James Cameron <quozl@laptop.org> [140628 08:24]:
> On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
> > I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
> > The module is non-removable wired fix to soc. Now the wifi module
> > needs 2 clocks; one is a sleep clock the other used when not
> > sleeping.
> > While the sleep clock is fixed, @32 kHz, the system clock can be
> > one out of several values, but can be be derived automatically
> > from the sleep clock. But this requires the clock to be present
> > when the wifi module comes out of reset.
> >
> > Another problem is software reboot, at initial power on the wifi
> > card will react to mmc discovery. After a software reset of the
> > host it will not, because it has already been disvovered and
> > didn't notice the host rebooted, unless we reset it as well.
> > While this seems obvious, the problem is that the reset is needed
> > before the card can be discovered. Which means we cannot move the
> > reset logic into the mwifiex driver, since that driver has not
> > yet been selected through vendor/product id.
> >
>
> we had same problem with sd8787 and a different system design. we
> added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
> sdhci_pxav3_toggle_reset_gpio()
>
> 1.
>
> http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
>
> 2.
>
> http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
>
> > the reset logic:
> > gpiod_set_value(card->gpiod_reset, 0);
> > clk_enable(card->sleep_clock);
> > udelay(1000);
> > gpiod_set_value(card->gpiod_reset, 1);
> >
> > The idea so far was to extend the device-tree node of the
> > mmc slot by some reset leafs;
> >
> > &mmc {
> > ti,non-removable;
> > ..
> > peripheral-clocks = <&clk &clk2 ...>;
> > peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
> > }
> >
> > in mmc_add_host, all clocks will be enabled and gpios be pulled
> > low for 1 msec
>
> we used 5ms.
>
> > Is this a feasible solution?
> >
> >
> > Another related issue, is the card reset in mwifiex driver:
> >
> > static void sdio_card_reset_worker(struct work_struct *work)
> > {
> > struct mmc_host *target = reset_host;
> >
> > pr_err("Resetting card...\n");
> > mmc_remove_host(target);
> > /* 20ms delay is based on experiment with sdhci controller */
> > mdelay(20);
> > mmc_add_host(target);
> > }
> > static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
> >
> > There are obviously a lot of problems with this, e.g. custom debugfs
> > entries created in the driver will be lost. But sometimes this
> > code might avert disaster in case the command handlers between
> > driver and firmware lost synchronization
> >
> > How could this be done in a better way?
>
> i'm interested as well.
Wouldn't it be best to have the mwifiex properly handle the
reset GPIOs and idle status pins?
Those are not part of the SDIO spec AFAIK, and the mmc
controller should not need to care about those.
Also, at least omaps also have an issue where suspend won't
work with mwifiex loaded FYI.
Regards,
Tony
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: mwifiex card reset
2014-06-28 7:23 ` Tony Lindgren
(?)
@ 2014-06-29 9:41 ` Andreas Fenkart
2014-06-30 6:19 ` Tony Lindgren
-1 siblings, 1 reply; 25+ messages in thread
From: Andreas Fenkart @ 2014-06-29 9:41 UTC (permalink / raw)
To: Tony Lindgren
Cc: James Cameron, Bing Zhao, Ulf Hansson,
linux-wireless@vger.kernel.org, linux-mmc, devicetree,
Daniel Mack
2014-06-28 9:23 GMT+02:00 Tony Lindgren <tony@atomide.com>:
> * James Cameron <quozl@laptop.org> [140628 08:24]:
>> On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
>> > I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
>> > The module is non-removable wired fix to soc. Now the wifi module
>> > needs 2 clocks; one is a sleep clock the other used when not
>> > sleeping.
>> > While the sleep clock is fixed, @32 kHz, the system clock can be
>> > one out of several values, but can be be derived automatically
>> > from the sleep clock. But this requires the clock to be present
>> > when the wifi module comes out of reset.
>> >
ref 1)
>> > Another problem is software reboot, at initial power on the wifi
>> > card will react to mmc discovery. After a software reset of the
>> > host it will not, because it has already been discovered and
>> > didn't notice the host rebooted, unless we reset it as well.
>> > While this seems obvious, the problem is that the reset is needed
>> > before the card can be discovered. Which means we cannot move the
>> > reset logic into the mwifiex driver, since that driver has not
>> > yet been selected through vendor/product id.
>> >
>>
>> we had same problem with sd8787 and a different system design. we
>> added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
>> sdhci_pxav3_toggle_reset_gpio()
>>
>> 1.
>>
>> http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
>>
>> 2.
>>
>> http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
>>
>> > the reset logic:
>> > gpiod_set_value(card->gpiod_reset, 0);
>> > clk_enable(card->sleep_clock);
>> > udelay(1000);
>> > gpiod_set_value(card->gpiod_reset, 1);
>> >
>> > The idea so far was to extend the device-tree node of the
>> > mmc slot by some reset leafs;
>> >
>> > &mmc {
>> > ti,non-removable;
>> > ..
>> > peripheral-clocks = <&clk &clk2 ...>;
>> > peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
>> > }
>> >
>> > in mmc_add_host, all clocks will be enabled and gpios be pulled
>> > low for 1 msec
>>
>> we used 5ms.
>>
>> > Is this a feasible solution?
>> >
>> >
>> > Another related issue, is the card reset in mwifiex driver:
>> >
>> > static void sdio_card_reset_worker(struct work_struct *work)
>> > {
>> > struct mmc_host *target = reset_host;
>> >
>> > pr_err("Resetting card...\n");
>> > mmc_remove_host(target);
>> > /* 20ms delay is based on experiment with sdhci controller */
>> > mdelay(20);
>> > mmc_add_host(target);
>> > }
>> > static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
>> >
>> > There are obviously a lot of problems with this, e.g. custom debugfs
>> > entries created in the driver will be lost. But sometimes this
>> > code might avert disaster in case the command handlers between
>> > driver and firmware lost synchronization
>> >
>> > How could this be done in a better way?
>>
>> i'm interested as well.
>
> Wouldn't it be best to have the mwifiex properly handle the
> reset GPIOs and idle status pins?
doesn't work see ref 1) above
> Those are not part of the SDIO spec AFAIK, and the mmc
> controller should not need to care about those.
>
> Also, at least omaps also have an issue where suspend won't
> work with mwifiex loaded FYI.
first command after resume needs to be cmd52, not cmd53 as the
driver would by default. it's another issue
>
> Regards,
>
> Tony
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: mwifiex card reset
2014-06-29 9:41 ` Andreas Fenkart
@ 2014-06-30 6:19 ` Tony Lindgren
2014-06-30 19:30 ` Daniel Mack
0 siblings, 1 reply; 25+ messages in thread
From: Tony Lindgren @ 2014-06-30 6:19 UTC (permalink / raw)
To: Andreas Fenkart
Cc: James Cameron, Bing Zhao, Ulf Hansson,
linux-wireless@vger.kernel.org, linux-mmc, devicetree,
Daniel Mack
* Andreas Fenkart <afenkart@gmail.com> [140629 12:43]:
> 2014-06-28 9:23 GMT+02:00 Tony Lindgren <tony@atomide.com>:
> > * James Cameron <quozl@laptop.org> [140628 08:24]:
> >> On Fri, Jun 27, 2014 at 04:39:42PM +0200, Andreas Fenkart wrote:
> >> > I have an mwifiex module(sd8787) behind omap_hsmmc(am33xx-soc)
> >> > The module is non-removable wired fix to soc. Now the wifi module
> >> > needs 2 clocks; one is a sleep clock the other used when not
> >> > sleeping.
> >> > While the sleep clock is fixed, @32 kHz, the system clock can be
> >> > one out of several values, but can be be derived automatically
> >> > from the sleep clock. But this requires the clock to be present
> >> > when the wifi module comes out of reset.
> >> >
>
> ref 1)
>
> >> > Another problem is software reboot, at initial power on the wifi
> >> > card will react to mmc discovery. After a software reset of the
> >> > host it will not, because it has already been discovered and
> >> > didn't notice the host rebooted, unless we reset it as well.
> >> > While this seems obvious, the problem is that the reset is needed
> >> > before the card can be discovered. Which means we cannot move the
> >> > reset logic into the mwifiex driver, since that driver has not
> >> > yet been selected through vendor/product id.
> >> >
> >>
> >> we had same problem with sd8787 and a different system design. we
> >> added reset-gpios property [1] and used it in sdhci-pxav3.c [2] as
> >> sdhci_pxav3_toggle_reset_gpio()
> >>
> >> 1.
> >>
> >> http://code.coreboot.org/p/openfirmware/source/tree/HEAD/cpu/arm/olpc/sdhci.fth#L104
> >>
> >> 2.
> >>
> >> http://dev.laptop.org/git/olpc-kernel/tree/drivers/mmc/host/sdhci-pxav3.c?h=arm-3.5#n229
> >>
> >> > the reset logic:
> >> > gpiod_set_value(card->gpiod_reset, 0);
> >> > clk_enable(card->sleep_clock);
> >> > udelay(1000);
> >> > gpiod_set_value(card->gpiod_reset, 1);
> >> >
> >> > The idea so far was to extend the device-tree node of the
> >> > mmc slot by some reset leafs;
> >> >
> >> > &mmc {
> >> > ti,non-removable;
> >> > ..
> >> > peripheral-clocks = <&clk &clk2 ...>;
> >> > peripheral-reset-gpios = <&gpio0 1 1 &gpio1 2 3 ...>;
> >> > }
> >> >
> >> > in mmc_add_host, all clocks will be enabled and gpios be pulled
> >> > low for 1 msec
> >>
> >> we used 5ms.
> >>
> >> > Is this a feasible solution?
> >> >
> >> >
> >> > Another related issue, is the card reset in mwifiex driver:
> >> >
> >> > static void sdio_card_reset_worker(struct work_struct *work)
> >> > {
> >> > struct mmc_host *target = reset_host;
> >> >
> >> > pr_err("Resetting card...\n");
> >> > mmc_remove_host(target);
> >> > /* 20ms delay is based on experiment with sdhci controller */
> >> > mdelay(20);
> >> > mmc_add_host(target);
> >> > }
> >> > static DECLARE_WORK(card_reset_work, sdio_card_reset_worker);
> >> >
> >> > There are obviously a lot of problems with this, e.g. custom debugfs
> >> > entries created in the driver will be lost. But sometimes this
> >> > code might avert disaster in case the command handlers between
> >> > driver and firmware lost synchronization
> >> >
> >> > How could this be done in a better way?
> >>
> >> i'm interested as well.
> >
> > Wouldn't it be best to have the mwifiex properly handle the
> > reset GPIOs and idle status pins?
>
> doesn't work see ref 1) above
OK so we can't do much anything at mwifiex probe time on SDIO bus because
it won't probe unless the pins are configured.
Maybe we should have a separate mwifiex-power helper module that just
manages the reset/idle/regulator pins? Then mwifiex-reset can be always
loaded and configure things so mwifiex-sdio can probe properly.
And mwifiex-reset helper can also provide the user space interfaces
for the reset/idle/regulator pins.
> > Those are not part of the SDIO spec AFAIK, and the mmc
> > controller should not need to care about those.
> >
> > Also, at least omaps also have an issue where suspend won't
> > work with mwifiex loaded FYI.
>
> first command after resume needs to be cmd52, not cmd53 as the
> driver would by default. it's another issue
Oh OK, sounds like you have some patches coming for that?
Regards,
Tony
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: mwifiex card reset
2014-06-30 6:19 ` Tony Lindgren
@ 2014-06-30 19:30 ` Daniel Mack
[not found] ` <53B1BAC1.3090902-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2014-06-30 19:30 UTC (permalink / raw)
To: Tony Lindgren, Andreas Fenkart
Cc: James Cameron, Bing Zhao, Ulf Hansson,
linux-wireless@vger.kernel.org, linux-mmc, devicetree
Hi Tony, everyone,
Thanks Andreas for addressing this issue! So far, we've been using a
terrible hack in the hsmmc in order to bring the card into a workable
state, and we're looking for a nicer solution for awhile.
On 06/30/2014 08:19 AM, Tony Lindgren wrote:
> * Andreas Fenkart <afenkart@gmail.com> [140629 12:43]:
>> 2014-06-28 9:23 GMT+02:00 Tony Lindgren <tony@atomide.com>:
>>> * James Cameron <quozl@laptop.org> [140628 08:24]:
>>> Wouldn't it be best to have the mwifiex properly handle the
>>> reset GPIOs and idle status pins?
>>
>> doesn't work see ref 1) above
>
> OK so we can't do much anything at mwifiex probe time on SDIO bus because
> it won't probe unless the pins are configured.
>
> Maybe we should have a separate mwifiex-power helper module that just
> manages the reset/idle/regulator pins? Then mwifiex-reset can be always
> loaded and configure things so mwifiex-sdio can probe properly.
>
> And mwifiex-reset helper can also provide the user space interfaces
> for the reset/idle/regulator pins.
Yes, a helper might be the best solution. It could even be a generic
one, that just takes any number of clocks, reset GPIOs and regulators
and takes care for sequencing them. However, we need to reference that
helper from the mwifiex driver, for two reasons.
a) we need to make sure the reset helper gets to do its job before the
mwifiex driver scans the SDIO bus, and
b) the reset helper needs to be called when the mmc host controller
wants to do a card reset.
Hence, we'll need some sort of internal API for this, and a phandle in
dts. I wonder whether that glue logic might be better off living in the
mmc core, as mwifiex might well be interfaced to other hosts?
Thanks,
Daniel
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2014-07-15 13:25 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-27 14:39 mwifiex card reset Andreas Fenkart
2014-06-27 14:39 ` Andreas Fenkart
[not found] ` <CALtMJEBWPM+75wxM2Mp5EX_o6NWtZUJdYRCv6psbvdUn4k295w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-28 5:22 ` James Cameron
2014-06-28 5:22 ` James Cameron
[not found] ` <20140628052220.GG10407-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>
2014-06-28 7:23 ` Tony Lindgren
2014-06-28 7:23 ` Tony Lindgren
2014-06-29 9:41 ` Andreas Fenkart
2014-06-30 6:19 ` Tony Lindgren
2014-06-30 19:30 ` Daniel Mack
[not found] ` <53B1BAC1.3090902-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
2014-07-01 6:44 ` Bing Zhao
2014-07-01 6:44 ` Bing Zhao
2014-07-01 6:57 ` James Cameron
[not found] ` <20140701065721.GM24891-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>
2014-07-01 7:02 ` Bing Zhao
2014-07-01 7:02 ` Bing Zhao
2014-07-01 7:03 ` James Cameron
[not found] ` <20140701070349.GN24891-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>
2014-07-01 7:41 ` Tony Lindgren
2014-07-01 7:41 ` Tony Lindgren
2014-07-01 12:20 ` Yuvaraj Cd
2014-07-01 12:20 ` Yuvaraj Cd
2014-07-01 15:09 ` Doug Anderson
2014-07-01 15:09 ` Doug Anderson
2014-07-15 13:25 ` Andreas Fenkart
2014-07-15 13:25 ` Andreas Fenkart
2014-07-01 7:52 ` Daniel Mack
2014-07-01 8:44 ` Andreas Fenkart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.