Skip to content

Commit 76d5556

Browse files
timokokkonenstorulf
authored andcommitted
mmc: host: atmel-mci: Add support for non-removable slots
Add support for non-removable slots which have no card detection GPIO and which should not be polled for a card change. Signed-off-by: Timo Kokkonen <[email protected]> Acked-by: Ludovic Desroches <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 0654bb3 commit 76d5556

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

drivers/mmc/host/atmel-mci.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ atmci_of_init(struct platform_device *pdev)
560560
pdata->slot[slot_id].detect_is_active_high =
561561
of_property_read_bool(cnp, "cd-inverted");
562562

563+
pdata->slot[slot_id].non_removable =
564+
of_property_read_bool(cnp, "non-removable");
565+
563566
pdata->slot[slot_id].wp_pin =
564567
of_get_named_gpio(cnp, "wp-gpios", 0);
565568
}
@@ -2206,8 +2209,12 @@ static int __init atmci_init_slot(struct atmel_mci *host,
22062209
}
22072210
}
22082211

2209-
if (!gpio_is_valid(slot->detect_pin))
2210-
mmc->caps |= MMC_CAP_NEEDS_POLL;
2212+
if (!gpio_is_valid(slot->detect_pin)) {
2213+
if (slot_data->non_removable)
2214+
mmc->caps |= MMC_CAP_NONREMOVABLE;
2215+
else
2216+
mmc->caps |= MMC_CAP_NEEDS_POLL;
2217+
}
22112218

22122219
if (gpio_is_valid(slot->wp_pin)) {
22132220
if (devm_gpio_request(&host->pdev->dev, slot->wp_pin,

include/linux/atmel-mci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* @detect_pin: GPIO pin wired to the card detect switch
1212
* @wp_pin: GPIO pin wired to the write protect sensor
1313
* @detect_is_active_high: The state of the detect pin when it is active
14+
* @non_removable: The slot is not removable, only detect once
1415
*
1516
* If a given slot is not present on the board, @bus_width should be
1617
* set to 0. The other fields are ignored in this case.
@@ -26,6 +27,7 @@ struct mci_slot_pdata {
2627
int detect_pin;
2728
int wp_pin;
2829
bool detect_is_active_high;
30+
bool non_removable;
2931
};
3032

3133
/**

0 commit comments

Comments
 (0)