diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-13 16:18:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-13 16:18:32 -0400 |
commit | 84c48e6f43ae1771fc67fd8fcd777ff4b3b4465b (patch) | |
tree | 3272373e763d8e3ba5f7d7b0a7e18cd16eb178a8 /drivers/mmc | |
parent | 5c55b40b27bc3249358dcfc86c0845be409ab7a6 (diff) | |
parent | bb6e647051a59dca5a72b3deef1e061d7c1c34da (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6:
avr32: Fix oops on unaligned user access
avr32: Add support for Mediama RMTx add-on board for ATNGW100
avr32: Change Atmel ATNGW100 config to add choice of add-on board
Fix MIMC200 board LCD init
avr32: Fix clash in ATMEL_USART_ flags
avr32: remove obsolete hw_interrupt_type
avr32: Solves problem with inverted MCI detect pin on Merisc board
atmel-mci: Add support for inverted detect pin
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index cf6a100bb38f..7b603e4b41db 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -177,6 +177,7 @@ struct atmel_mci { | |||
177 | * available. | 177 | * available. |
178 | * @wp_pin: GPIO pin used for card write protect sending, or negative | 178 | * @wp_pin: GPIO pin used for card write protect sending, or negative |
179 | * if not available. | 179 | * if not available. |
180 | * @detect_is_active_high: The state of the detect pin when it is active. | ||
180 | * @detect_timer: Timer used for debouncing @detect_pin interrupts. | 181 | * @detect_timer: Timer used for debouncing @detect_pin interrupts. |
181 | */ | 182 | */ |
182 | struct atmel_mci_slot { | 183 | struct atmel_mci_slot { |
@@ -196,6 +197,7 @@ struct atmel_mci_slot { | |||
196 | 197 | ||
197 | int detect_pin; | 198 | int detect_pin; |
198 | int wp_pin; | 199 | int wp_pin; |
200 | bool detect_is_active_high; | ||
199 | 201 | ||
200 | struct timer_list detect_timer; | 202 | struct timer_list detect_timer; |
201 | }; | 203 | }; |
@@ -924,7 +926,8 @@ static int atmci_get_cd(struct mmc_host *mmc) | |||
924 | struct atmel_mci_slot *slot = mmc_priv(mmc); | 926 | struct atmel_mci_slot *slot = mmc_priv(mmc); |
925 | 927 | ||
926 | if (gpio_is_valid(slot->detect_pin)) { | 928 | if (gpio_is_valid(slot->detect_pin)) { |
927 | present = !gpio_get_value(slot->detect_pin); | 929 | present = !(gpio_get_value(slot->detect_pin) ^ |
930 | slot->detect_is_active_high); | ||
928 | dev_dbg(&mmc->class_dev, "card is %spresent\n", | 931 | dev_dbg(&mmc->class_dev, "card is %spresent\n", |
929 | present ? "" : "not "); | 932 | present ? "" : "not "); |
930 | } | 933 | } |
@@ -1028,7 +1031,8 @@ static void atmci_detect_change(unsigned long data) | |||
1028 | return; | 1031 | return; |
1029 | 1032 | ||
1030 | enable_irq(gpio_to_irq(slot->detect_pin)); | 1033 | enable_irq(gpio_to_irq(slot->detect_pin)); |
1031 | present = !gpio_get_value(slot->detect_pin); | 1034 | present = !(gpio_get_value(slot->detect_pin) ^ |
1035 | slot->detect_is_active_high); | ||
1032 | present_old = test_bit(ATMCI_CARD_PRESENT, &slot->flags); | 1036 | present_old = test_bit(ATMCI_CARD_PRESENT, &slot->flags); |
1033 | 1037 | ||
1034 | dev_vdbg(&slot->mmc->class_dev, "detect change: %d (was %d)\n", | 1038 | dev_vdbg(&slot->mmc->class_dev, "detect change: %d (was %d)\n", |
@@ -1456,6 +1460,7 @@ static int __init atmci_init_slot(struct atmel_mci *host, | |||
1456 | slot->host = host; | 1460 | slot->host = host; |
1457 | slot->detect_pin = slot_data->detect_pin; | 1461 | slot->detect_pin = slot_data->detect_pin; |
1458 | slot->wp_pin = slot_data->wp_pin; | 1462 | slot->wp_pin = slot_data->wp_pin; |
1463 | slot->detect_is_active_high = slot_data->detect_is_active_high; | ||
1459 | slot->sdc_reg = sdc_reg; | 1464 | slot->sdc_reg = sdc_reg; |
1460 | 1465 | ||
1461 | mmc->ops = &atmci_ops; | 1466 | mmc->ops = &atmci_ops; |
@@ -1477,7 +1482,8 @@ static int __init atmci_init_slot(struct atmel_mci *host, | |||
1477 | if (gpio_request(slot->detect_pin, "mmc_detect")) { | 1482 | if (gpio_request(slot->detect_pin, "mmc_detect")) { |
1478 | dev_dbg(&mmc->class_dev, "no detect pin available\n"); | 1483 | dev_dbg(&mmc->class_dev, "no detect pin available\n"); |
1479 | slot->detect_pin = -EBUSY; | 1484 | slot->detect_pin = -EBUSY; |
1480 | } else if (gpio_get_value(slot->detect_pin)) { | 1485 | } else if (gpio_get_value(slot->detect_pin) ^ |
1486 | slot->detect_is_active_high) { | ||
1481 | clear_bit(ATMCI_CARD_PRESENT, &slot->flags); | 1487 | clear_bit(ATMCI_CARD_PRESENT, &slot->flags); |
1482 | } | 1488 | } |
1483 | } | 1489 | } |