#include "slot-gpio.h"
#include "pwrseq.h"
-#define cls_dev_to_mmc_host(d) container_of(d, struct mmc_host, class_dev)
-
static DEFINE_IDR(mmc_host_idr);
static DEFINE_SPINLOCK(mmc_host_lock);
int ret;
bool cd_cap_invert, cd_gpio_invert = false;
bool ro_cap_invert, ro_gpio_invert = false;
+ enum of_gpio_flags pwrseq_flags;
+ int pwrseq_gpio;
if (!host->parent || !host->parent->of_node)
return 0;
np = host->parent->of_node;
+ pwrseq_gpio = of_get_named_gpio_flags(np, "pwrseq-gpio", 0, &pwrseq_flags);
+ if ( gpio_is_valid(pwrseq_gpio) ) {
+ ret = devm_gpio_request_one(&host->class_dev, pwrseq_gpio, (pwrseq_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, "sdpwr-gpio");
+ if (ret != 0) {
+ dev_err(&host->class_dev, "request sdcard pwrseq gpio error\n");
+ return -EIO;
+ }
+ };
+
/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
dev_dbg(host->parent,
* prepared to start servicing requests before this function
* completes.
*/
-static struct mmc_host *primary_sdio_host;
+struct mmc_host *primary_sdio_host;
int mmc_add_host(struct mmc_host *host)
{
int err;
mmc_add_host_debugfs(host);
#endif
+#ifdef CONFIG_BLOCK
+ mmc_latency_hist_sysfs_init(host);
+#endif
+
mmc_start_host(host);
if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
register_pm_notifier(&host->pm_notify);
mmc_remove_host_debugfs(host);
#endif
+#ifdef CONFIG_BLOCK
+ mmc_latency_hist_sysfs_exit(host);
+#endif
+
device_del(&host->class_dev);
led_trigger_unregister_simple(host->led);