Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76d55564 authored by Timo Kokkonen's avatar Timo Kokkonen Committed by Ulf Hansson
Browse files

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: default avatarTimo Kokkonen <timo.kokkonen@offcode.fi>
Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 0654bb3c
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -560,6 +560,9 @@ atmci_of_init(struct platform_device *pdev)
		pdata->slot[slot_id].detect_is_active_high =
		pdata->slot[slot_id].detect_is_active_high =
			of_property_read_bool(cnp, "cd-inverted");
			of_property_read_bool(cnp, "cd-inverted");


		pdata->slot[slot_id].non_removable =
			of_property_read_bool(cnp, "non-removable");

		pdata->slot[slot_id].wp_pin =
		pdata->slot[slot_id].wp_pin =
			of_get_named_gpio(cnp, "wp-gpios", 0);
			of_get_named_gpio(cnp, "wp-gpios", 0);
	}
	}
@@ -2206,8 +2209,12 @@ static int __init atmci_init_slot(struct atmel_mci *host,
		}
		}
	}
	}


	if (!gpio_is_valid(slot->detect_pin))
	if (!gpio_is_valid(slot->detect_pin)) {
		if (slot_data->non_removable)
			mmc->caps |= MMC_CAP_NONREMOVABLE;
		else
			mmc->caps |= MMC_CAP_NEEDS_POLL;
			mmc->caps |= MMC_CAP_NEEDS_POLL;
	}


	if (gpio_is_valid(slot->wp_pin)) {
	if (gpio_is_valid(slot->wp_pin)) {
		if (devm_gpio_request(&host->pdev->dev, slot->wp_pin,
		if (devm_gpio_request(&host->pdev->dev, slot->wp_pin,
+2 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
 * @detect_pin: GPIO pin wired to the card detect switch
 * @detect_pin: GPIO pin wired to the card detect switch
 * @wp_pin: GPIO pin wired to the write protect sensor
 * @wp_pin: GPIO pin wired to the write protect sensor
 * @detect_is_active_high: The state of the detect pin when it is active
 * @detect_is_active_high: The state of the detect pin when it is active
 * @non_removable: The slot is not removable, only detect once
 *
 *
 * If a given slot is not present on the board, @bus_width should be
 * If a given slot is not present on the board, @bus_width should be
 * set to 0. The other fields are ignored in this case.
 * set to 0. The other fields are ignored in this case.
@@ -26,6 +27,7 @@ struct mci_slot_pdata {
	int			detect_pin;
	int			detect_pin;
	int			wp_pin;
	int			wp_pin;
	bool			detect_is_active_high;
	bool			detect_is_active_high;
	bool			non_removable;
};
};


/**
/**