public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: James Cameron <quozl-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>
To: Andreas Fenkart <afenkart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Bing Zhao <bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-mmc <linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
Subject: Re: mwifiex card reset
Date: Sat, 28 Jun 2014 15:22:20 +1000	[thread overview]
Message-ID: <20140628052220.GG10407@us.netrek.org> (raw)
In-Reply-To: <CALtMJEBWPM+75wxM2Mp5EX_o6NWtZUJdYRCv6psbvdUn4k295w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

  parent reply	other threads:[~2014-06-28  5:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 14:39 mwifiex card reset Andreas Fenkart
     [not found] ` <CALtMJEBWPM+75wxM2Mp5EX_o6NWtZUJdYRCv6psbvdUn4k295w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-28  5:22   ` James Cameron [this message]
     [not found]     ` <20140628052220.GG10407-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>
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:57                   ` James Cameron
     [not found]                     ` <20140701065721.GM24891-kJBlkiJxCS/dtAWm4Da02A@public.gmane.org>
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 12:20                     ` Yuvaraj Cd
2014-07-01 15:09                       ` Doug Anderson
2014-07-15 13:25                         ` Andreas Fenkart
2014-07-01  7:52                   ` Daniel Mack
2014-07-01  8:44                   ` Andreas Fenkart

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=20140628052220.GG10407@us.netrek.org \
    --to=quozl-2x9k7bc8m7mdnm+yrofe0a@public.gmane.org \
    --cc=afenkart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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