aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2009-06-13 09:34:22 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2009-06-13 09:34:22 -0400
commitfbe0b8d5822a88e2e769a318eaf3134da5881769 (patch)
tree20a55ca2e2e1b7cdd6a60435984c0bd8ae32902f /drivers/mmc
parentc878b7d60418a45c36d99c2dc876ebb76035d404 (diff)
parent4024533e60787a5507818b0c0fdb44ddb522cdf5 (diff)
Merge branch 'avr32-arch' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/atmel-mci.c12
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 */
182struct atmel_mci_slot { 183struct 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 }