RE: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Nicolas Pitre
On Tue, 6 Jul 2010, Madhusudhan wrote:

> 
> 
> > -Original Message-
> > From: Ohad Ben-Cohen [mailto:o...@wizery.com]
> > Sent: Tuesday, July 06, 2010 6:48 AM
> > To: Nicolas Pitre
> > Cc: linux-wirel...@vger.kernel.org; linux-...@vger.kernel.org; linux-
> > o...@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
> > li...@arm.linux.org.uk; Chikkature Rajashekar Madhusudhan; Luciano Coelho;
> > Andrew Morton; San Mehat; Pandita, Vikram
> > Subject: Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support
> > 
> > On Tue, Jul 6, 2010 at 1:22 PM, Ohad Ben-Cohen  wrote:
> > > Note: the wl1271 device does support standard card detection, but
> > > AFAIK there's a limitation to use that with the specific omap
> > > controller the device is hardwired to. I will try to get more info
> > > about that, but probably Madhu can comment on that better.
> > 
> > 
> > Some correction and additional info:
> > 
> > The wl1271 device has an issue which makes the standard card detect
> > mechanism irrelevant: it is always up, even if the power enable gpio
> > input of the device is down (the power enable input does not supply
> > the power to the chip, it's just logical digital high/low input upon
> > which the device reacts).  That's why we must use software control for
> > emulating card detect with that device.
> > 
> > In addition, as far as I could find out, the card detect mechanism on
> > the ZOOM is implemented by mechanical means, and thus is not relevant
> > for hardwired embedded SDIO devices (I'm not even sure card detect is
> > supported for the 3rd mmc controller).
> 
> The card detect is supported through T2 GPIO interrupts only for MMC1 and
> MMC2. Such a mechanism is not present for MMC3 to which the WLAN chip is
> hardwired.

Many existing implementations simply have no (or a broken) card 
detection signal.  In that case, either the host controller passes the 
MMC_CAP_NEEDS_POLL flag to the core so that the bus is probed on a 
regular interval for card presence.  Or, like in this case where the 
"card" is always hardwired on the board, you simply rely on the initial 
probe which is always performed at least once when the host controller 
driver is registered.

Now the issue of having the card powered off when not in use is a valid 
one, whether or not it is actually hardwired on the board or 
hot insertable/removable.  This fake insertion thing is not the best way 
to go about it.

It would be way more useful, generic, and less hackish to simply improve 
the generic code so to power down the card when it is 1) not claimed by 
any function driver, and 2) provide an API to let a function driver 
signify to the core and host controller that it is not interested by the 
hardware at the moment (if the network interface is not up for example) 
and therefore the core could again power down the card.  This would work 
in all cases with no need for exceptions  for so called "enbedded 
controllers".


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Madhusudhan


> -Original Message-
> From: Ohad Ben-Cohen [mailto:o...@wizery.com]
> Sent: Tuesday, July 06, 2010 6:48 AM
> To: Nicolas Pitre
> Cc: linux-wirel...@vger.kernel.org; linux-...@vger.kernel.org; linux-
> o...@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
> li...@arm.linux.org.uk; Chikkature Rajashekar Madhusudhan; Luciano Coelho;
> Andrew Morton; San Mehat; Pandita, Vikram
> Subject: Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support
> 
> On Tue, Jul 6, 2010 at 1:22 PM, Ohad Ben-Cohen  wrote:
> > Note: the wl1271 device does support standard card detection, but
> > AFAIK there's a limitation to use that with the specific omap
> > controller the device is hardwired to. I will try to get more info
> > about that, but probably Madhu can comment on that better.
> 
> 
> Some correction and additional info:
> 
> The wl1271 device has an issue which makes the standard card detect
> mechanism irrelevant: it is always up, even if the power enable gpio
> input of the device is down (the power enable input does not supply
> the power to the chip, it's just logical digital high/low input upon
> which the device reacts).  That's why we must use software control for
> emulating card detect with that device.
> 
> In addition, as far as I could find out, the card detect mechanism on
> the ZOOM is implemented by mechanical means, and thus is not relevant
> for hardwired embedded SDIO devices (I'm not even sure card detect is
> supported for the 3rd mmc controller).

The card detect is supported through T2 GPIO interrupts only for MMC1 and
MMC2. Such a mechanism is not present for MMC3 to which the WLAN chip is
hardwired.

Regards,
Madhu

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Ohad Ben-Cohen
On Tue, Jul 6, 2010 at 3:39 PM, Roger Quadros  wrote:
> Just to clarify, is the wl1271 device always powered on the board?

Yes.

> And this GPIO power enable (OMAP_ZOOM_WLAN_PMENA_GPIO) is used to gate this
> supply internally?

Yes. It's a digital input that the chip does not draw current from
(well, only a very minimal one).

> and what do these do ?
>
> set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
>
> clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);

This is an internal driver bit that maintains the power state of the chip.
AFAICT, it does not "do" anything. The only place I can see it is
being used is in a debugfs entry.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Roger Quadros

Hi,

On 07/06/2010 02:48 PM, ext Ohad Ben-Cohen wrote:

On Tue, Jul 6, 2010 at 1:22 PM, Ohad Ben-Cohen  wrote:

Note: the wl1271 device does support standard card detection, but
AFAIK there's a limitation to use that with the specific omap
controller the device is hardwired to. I will try to get more info
about that, but probably Madhu can comment on that better.



Some correction and additional info:

The wl1271 device has an issue which makes the standard card detect
mechanism irrelevant: it is always up, even if the power enable gpio
input of the device is down (the power enable input does not supply
the power to the chip, it's just logical digital high/low input upon
which the device reacts).  That's why we must use software control for
emulating card detect with that device.


Just to clarify, is the wl1271 device always powered on the board?

And this GPIO power enable (OMAP_ZOOM_WLAN_PMENA_GPIO) is used to gate this 
supply internally?


and what do these do ?

set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);

clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);

regards,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Ohad Ben-Cohen
On Tue, Jul 6, 2010 at 2:02 PM, Roger Quadros  wrote:
> On 07/06/2010 01:22 PM, ext Ohad Ben-Cohen wrote:
>> We prefer not to power up the chip as early as boot time; instead, we
>
> Why?

Let's say you boot your device but never use WLAN.
In this scenario, we prefer the wl1271 device to stay powered off to
minimize power consumption.
This way we will power on the wl1271 device only when the user
actually turns WLAN on.

> The function driver should power it down later if required. no?

Care to explain this ? I'm not sure I'm following: the sdio function
is added and the sdio driver is probed only after you power on the
wl1271 device and let the mmc layer initialize and configure it. Why
would you want to do that if WLAN is disabled (i.e. user didn't turn
wlan on) ?

> If it was powered OFF then how did the wlan interface come into picture?

As soon as you insmod wl1271 and wl1271_sdio, you will have a wlan
interface (which is still down). At this point the wl1271 device is
still powered off and not consuming power.

If the user chooses to enable wlan (i.e. ifconfig wlan0 up), the chip
is powered on, it is initialized and configured by the mmc layer, and
then it can be used for WLAN activities.

> I agree, we some how need to power down the card when not in use in the
> right way.

In this patchset proposal, as soon as the user disables wlan (i.e.
ifconfig wlan0 down), the wl1271 device is powered off, and the
corresponding sdio function is removed.


Thanks,
Ohad.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Ohad Ben-Cohen
On Tue, Jul 6, 2010 at 1:22 PM, Ohad Ben-Cohen  wrote:
> Note: the wl1271 device does support standard card detection, but
> AFAIK there's a limitation to use that with the specific omap
> controller the device is hardwired to. I will try to get more info
> about that, but probably Madhu can comment on that better.


Some correction and additional info:

The wl1271 device has an issue which makes the standard card detect
mechanism irrelevant: it is always up, even if the power enable gpio
input of the device is down (the power enable input does not supply
the power to the chip, it's just logical digital high/low input upon
which the device reacts).  That's why we must use software control for
emulating card detect with that device.

In addition, as far as I could find out, the card detect mechanism on
the ZOOM is implemented by mechanical means, and thus is not relevant
for hardwired embedded SDIO devices (I'm not even sure card detect is
supported for the 3rd mmc controller).
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Roger Quadros

On 07/06/2010 01:22 PM, ext Ohad Ben-Cohen wrote:

Hi Nicolas,

On Tue, Jul 6, 2010 at 4:45 AM, Nicolas Pitre  wrote:

On Tue, 6 Jul 2010, Ohad Ben-Cohen wrote:


From: Ohad Ben-Cohen

Add support for software emulation of card detect
events.

This is required for specific controllers
that are hard wired with embedded SDIO devices
(such as TI's wl1271 WLAN device).


Why?

Many instances of hardwired SDIO based WLAN devices do exist already,
and they don't need extra card detect events to be generated.  The core
MMC code already triggers a probe for cards whenever a new host
controller is registered.


We prefer not to power up the chip as early as boot time; instead, we
Why? if the card is hard wired with no card detect then it should be powered up. 
The function driver should power it down later if required. no?



would like to have it powered off until the wlan interface is brought
up, power it on when the interface is brought up,


If it was powered OFF then how did the wlan interface come into picture?


and power it off again as soon as the interface is brought down again
(to minimize power consumption when the wlan is not in use).

I agree, we some how need to power down the card when not in use in the right 
way.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-06 Thread Ohad Ben-Cohen
Hi Nicolas,

On Tue, Jul 6, 2010 at 4:45 AM, Nicolas Pitre  wrote:
> On Tue, 6 Jul 2010, Ohad Ben-Cohen wrote:
>
>> From: Ohad Ben-Cohen 
>>
>> Add support for software emulation of card detect
>> events.
>>
>> This is required for specific controllers
>> that are hard wired with embedded SDIO devices
>> (such as TI's wl1271 WLAN device).
>
> Why?
>
> Many instances of hardwired SDIO based WLAN devices do exist already,
> and they don't need extra card detect events to be generated.  The core
> MMC code already triggers a probe for cards whenever a new host
> controller is registered.

We prefer not to power up the chip as early as boot time; instead, we
would like to have it powered off until the wlan interface is brought
up, power it on when the interface is brought up,
and power it off again as soon as the interface is brought down again
(to minimize power consumption when the wlan is not in use).

For that we can't rely on the probing done when the controller is
registered, we want to have a mechanism to allow dynamic detection and
removal of the card.

Note: the wl1271 device does support standard card detection, but
AFAIK there's a limitation to use that with the specific omap
controller the device is hardwired to. I will try to get more info
about that, but probably Madhu can comment on that better.

>> Board-specific configuration is required to
>> enable this software card detect control.
>
> Could you elaborate please?

Please check out the last patch - that patch is doing that configuration.
In essence, this virtual card detect mechanism is enabled only for
specific controllers which we know there's an embedded sdio device
hardwired to. This knowledge is board-specific, and that's why we
enable this mechanism in the board files, per a specific mmc
controller.

Thanks,
Ohad.


>
>
> Nicolas
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support

2010-07-05 Thread Nicolas Pitre
On Tue, 6 Jul 2010, Ohad Ben-Cohen wrote:

> From: Ohad Ben-Cohen 
> 
> Add support for software emulation of card detect
> events.
> 
> This is required for specific controllers
> that are hard wired with embedded SDIO devices
> (such as TI's wl1271 WLAN device).

Why?

Many instances of hardwired SDIO based WLAN devices do exist already, 
and they don't need extra card detect events to be generated.  The core 
MMC code already triggers a probe for cards whenever a new host 
controller is registered.

> Board-specific configuration is required to
> enable this software card detect control.

Could you elaborate please?


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html