* [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin
@ 2009-06-13 1:02 Rob Emanuele
2009-06-15 16:20 ` Nicolas Ferre
2009-06-15 21:35 ` Michael Roth
0 siblings, 2 replies; 5+ messages in thread
From: Rob Emanuele @ 2009-06-13 1:02 UTC (permalink / raw)
To: Haavard Skinnemoen
Cc: Andrew Victor, Nicolas Ferre, linux-arm-kernel, linux-kernel, drzeus-mmc
Add support to the atmel-mci driver for a VCC pin in order to conserve
power if the MMC interface is powered down.
Please read the whole set, try it out, and comment.
Thank you,
Rob Emanuele
---
drivers/mmc/host/atmel-mci.c | 33 ++++++++++++++++++++-------------
include/linux/atmel-mci.h | 2 ++
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 1c1a4b3..a639b93 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -214,6 +214,8 @@ struct atmel_mci_slot {
int detect_pin;
int wp_pin;
+ int vcc_pin;
+ bool vcc_pin_act_low;
struct timer_list detect_timer;
};
@@ -926,23 +928,19 @@ static void atmci_set_ios(struct mmc_host *mmc,
struct mmc_ios *ios)
}
switch (ios->power_mode) {
+ case MMC_POWER_OFF:
+ if (gpio_is_valid(slot->vcc_pin))
+ gpio_set_value(slot->vcc_pin, slot->vcc_pin_act_low);
+ break;
case MMC_POWER_UP:
+ if (gpio_is_valid(slot->vcc_pin))
+ gpio_set_value(slot->vcc_pin, !slot->vcc_pin_act_low);
set_bit(ATMCI_CARD_NEED_INIT, &slot->flags);
break;
- default:
- /*
- * TODO: None of the currently available AVR32-based
- * boards allow MMC power to be turned off. Implement
- * power control when this can be tested properly.
- *
- * We also need to hook this into the clock management
- * somehow so that newly inserted cards aren't
- * subjected to a fast clock before we have a chance
- * to figure out what the maximum rate is. Currently,
- * there's no way to avoid this, and there never will
- * be for boards that don't support power control.
- */
+ case MMC_POWER_ON:
break;
+ default:
+ WARN_ON(1);
}
}
@@ -1498,6 +1496,8 @@ static int __init atmci_init_slot(struct atmel_mci *host,
slot->host = host;
slot->detect_pin = slot_data->detect_pin;
slot->wp_pin = slot_data->wp_pin;
+ slot->vcc_pin = slot_data->vcc_pin;
+ slot->vcc_pin_act_low = slot_data->vcc_pin_act_low;
slot->sdc_reg = sdc_reg;
mmc->ops = &atmci_ops;
@@ -1534,6 +1534,13 @@ static int __init atmci_init_slot(struct atmel_mci *host,
}
}
+ if (gpio_is_valid(slot->vcc_pin)) {
+ if (gpio_request(slot->vcc_pin, "mmc_pow")) {
+ dev_dbg(&mmc->class_dev, "no power pin available\n");
+ slot->vcc_pin = -EBUSY;
+ }
+ }
+
host->slot[id] = slot;
mmc_add_host(mmc);
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 2f1f957..3b4239a 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -24,6 +24,8 @@ struct mci_slot_pdata {
unsigned int bus_width;
int detect_pin;
int wp_pin;
+ int vcc_pin;
+ unsigned vcc_pin_act_low:1;
};
/**
--
1.6.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin
2009-06-13 1:02 [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin Rob Emanuele
@ 2009-06-15 16:20 ` Nicolas Ferre
2009-06-15 18:17 ` Rob Emanuele
2009-06-15 21:35 ` Michael Roth
1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2009-06-15 16:20 UTC (permalink / raw)
To: Rob Emanuele
Cc: Haavard Skinnemoen, Andrew Victor, linux-arm-kernel,
linux-kernel, drzeus-mmc
Rob Emanuele :
> Add support to the atmel-mci driver for a VCC pin in order to conserve
> power if the MMC interface is powered down.
Can you elaborate a bit more. In particular, I do not understand the
concept of "vcc_pin_act_low".
[..]
Thanks. Bye,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin
2009-06-15 16:20 ` Nicolas Ferre
@ 2009-06-15 18:17 ` Rob Emanuele
0 siblings, 0 replies; 5+ messages in thread
From: Rob Emanuele @ 2009-06-15 18:17 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Haavard Skinnemoen, Andrew Victor, linux-arm-kernel,
linux-kernel, drzeus-mmc
Nicolas,
On Mon, Jun 15, 2009 at 9:20 AM, Nicolas Ferre<nicolas.ferre@atmel.com> wrote:
> Rob Emanuele :
>> Add support to the atmel-mci driver for a VCC pin in order to conserve
>> power if the MMC interface is powered down.
>
> Can you elaborate a bit more. In particular, I do not understand the
> concept of "vcc_pin_act_low".
>
Like the original at91_mci driver, this patch adds the ability to use
a pin to toggle 3.3V power going to the SD Card. In my case the pin
is tied to a International Rectifier 6420 P-type MOSFET since a port
pin alone cannot drive the SD Card. When I pull the vcc_pin low, 3.3V
can reach the SD Card to power it. The "vcc_pin_act_low" (pin active
low) determines which way the pin should be pulled to enable power to
the SD Card. If vcc_pin_act_low is true, when the card needs to get
powered up, it sets the vcc_pin low. Other board designs may need a
pin driven high to power the SD Card.
Thanks,
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin
2009-06-13 1:02 [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin Rob Emanuele
2009-06-15 16:20 ` Nicolas Ferre
@ 2009-06-15 21:35 ` Michael Roth
2009-06-15 22:16 ` Rob Emanuele
1 sibling, 1 reply; 5+ messages in thread
From: Michael Roth @ 2009-06-15 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Rob Emanuele, Haavard Skinnemoen, Andrew Victor, Nicolas Ferre,
linux-kernel, drzeus-mmc
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 1c1a4b3..a639b93 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -214,6 +214,8 @@ struct atmel_mci_slot {
>
> int detect_pin;
> int wp_pin;
> + int vcc_pin;
> + bool vcc_pin_act_low;
Maybe, just 'vcc_active_low' is more clear?
Most other kernel code use 'active_low' or 'xyz_active_low' as far as I can
see.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin
2009-06-15 21:35 ` Michael Roth
@ 2009-06-15 22:16 ` Rob Emanuele
0 siblings, 0 replies; 5+ messages in thread
From: Rob Emanuele @ 2009-06-15 22:16 UTC (permalink / raw)
To: Michael Roth
Cc: linux-arm-kernel, Haavard Skinnemoen, Andrew Victor,
Nicolas Ferre, linux-kernel, drzeus-mmc
That would be fine with me.
On Mon, Jun 15, 2009 at 2:35 PM, Michael Roth<mroth@nessie.de> wrote:
>
>> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
>> index 1c1a4b3..a639b93 100644
>> --- a/drivers/mmc/host/atmel-mci.c
>> +++ b/drivers/mmc/host/atmel-mci.c
>> @@ -214,6 +214,8 @@ struct atmel_mci_slot {
>>
>> int detect_pin;
>> int wp_pin;
>> + int vcc_pin;
>> + bool vcc_pin_act_low;
>
> Maybe, just 'vcc_active_low' is more clear?
>
> Most other kernel code use 'active_low' or 'xyz_active_low' as far as I can
> see.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-15 22:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-13 1:02 [PATCH 5/6] Unified AVR32/AT91 MCI Driver Support for a VCC Pin Rob Emanuele
2009-06-15 16:20 ` Nicolas Ferre
2009-06-15 18:17 ` Rob Emanuele
2009-06-15 21:35 ` Michael Roth
2009-06-15 22:16 ` Rob Emanuele
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).