Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: pwrseq: sd8787: add support for wilc1000

Add new compatible for wilc1000 devices and specify the delay in .data
member of struct of_device_id. WILC1000, WILC3000 devices needs a minimum
of 5ms delay b/w reset and power lines.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20210820092803.78523-3-claudiu.beznea@microchip.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Claudiu Beznea and committed by
Ulf Hansson
b2832b96 2c2eaf88

+9 -2
+9 -2
drivers/mmc/core/pwrseq_sd8787.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/module.h> 17 + #include <linux/of.h> 17 18 #include <linux/slab.h> 18 19 #include <linux/device.h> 19 20 #include <linux/err.h> ··· 28 27 struct mmc_pwrseq pwrseq; 29 28 struct gpio_desc *reset_gpio; 30 29 struct gpio_desc *pwrdn_gpio; 30 + u32 reset_pwrdwn_delay_ms; 31 31 }; 32 32 33 33 #define to_pwrseq_sd8787(p) container_of(p, struct mmc_pwrseq_sd8787, pwrseq) ··· 39 37 40 38 gpiod_set_value_cansleep(pwrseq->reset_gpio, 1); 41 39 42 - msleep(300); 40 + msleep(pwrseq->reset_pwrdwn_delay_ms); 43 41 gpiod_set_value_cansleep(pwrseq->pwrdn_gpio, 1); 44 42 } 45 43 ··· 57 55 }; 58 56 59 57 static const struct of_device_id mmc_pwrseq_sd8787_of_match[] = { 60 - { .compatible = "mmc-pwrseq-sd8787",}, 58 + { .compatible = "mmc-pwrseq-sd8787", .data = (void *)300 }, 59 + { .compatible = "mmc-pwrseq-wilc1000", .data = (void *)5 }, 61 60 {/* sentinel */}, 62 61 }; 63 62 MODULE_DEVICE_TABLE(of, mmc_pwrseq_sd8787_of_match); ··· 67 64 { 68 65 struct mmc_pwrseq_sd8787 *pwrseq; 69 66 struct device *dev = &pdev->dev; 67 + const struct of_device_id *match; 70 68 71 69 pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); 72 70 if (!pwrseq) 73 71 return -ENOMEM; 72 + 73 + match = of_match_node(mmc_pwrseq_sd8787_of_match, pdev->dev.of_node); 74 + pwrseq->reset_pwrdwn_delay_ms = (u32)match->data; 74 75 75 76 pwrseq->pwrdn_gpio = devm_gpiod_get(dev, "powerdown", GPIOD_OUT_LOW); 76 77 if (IS_ERR(pwrseq->pwrdn_gpio))