ARM64: DTS: Fix Firefly board audio driver
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / core / host.c
index bbe4380a8a3088d1ede040a1b0c7c3788b9157f9..0268217e447faf6c63295592a5cb06414572df7e 100644 (file)
@@ -159,12 +159,23 @@ int mmc_of_parse(struct mmc_host *host)
        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,