14 #include <linux/kernel.h>
15 #include <linux/module.h>
16 #include <linux/device.h>
17 #include <linux/slab.h>
53 static int of_mmc_spi_read_gpio(
struct device *
dev,
int gpio_num)
59 return active_low ^
value;
62 static int of_mmc_spi_get_cd(
struct device *
dev)
64 return of_mmc_spi_read_gpio(dev,
CD_GPIO);
67 static int of_mmc_spi_get_ro(
struct device *
dev)
69 return of_mmc_spi_read_gpio(dev,
WP_GPIO);
72 static int of_mmc_spi_init(
struct device *
dev,
81 static void of_mmc_spi_exit(
struct device *dev,
void *mmc)
93 const u32 *voltage_ranges;
106 num_ranges = num_ranges /
sizeof(*voltage_ranges) / 2;
107 if (!voltage_ranges || !num_ranges) {
108 dev_err(dev,
"OF: voltage-ranges unspecified\n");
112 for (i = 0; i < num_ranges; i++) {
120 dev_err(dev,
"OF: voltage-range #%d is invalid\n", i);
129 oms->
gpios[
i] = of_get_gpio_flags(np, i, &gpio_flags);
130 if (!gpio_is_valid(oms->
gpios[i]))
144 oms->
pdata.get_cd = of_mmc_spi_get_cd;
146 oms->
pdata.get_ro = of_mmc_spi_get_ro;
150 oms->
pdata.init = of_mmc_spi_init;
151 oms->
pdata.exit = of_mmc_spi_exit;
175 if (gpio_is_valid(oms->
gpios[i]))