]> Git Repo - J-u-boot.git/blame - drivers/mmc/mmc-pwrseq.c
driver: clk: tegra: init basic clocks on probe
[J-u-boot.git] / drivers / mmc / mmc-pwrseq.c
CommitLineData
caee38ae
JC
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2021 SAMSUNG Electronics
4 * Jaehoon Chung <[email protected]>
5 */
6
caee38ae
JC
7#include <dm.h>
8#include <mmc.h>
9#include <pwrseq.h>
10#include <asm/gpio.h>
11#include <linux/delay.h>
12
13int mmc_pwrseq_get_power(struct udevice *dev, struct mmc_config *cfg)
14{
15 /* Enable power if needed */
16 return uclass_get_device_by_phandle(UCLASS_PWRSEQ, dev, "mmc-pwrseq",
17 &cfg->pwr_dev);
18}
19
20static int mmc_pwrseq_set_power(struct udevice *dev, bool enable)
21{
22 struct gpio_desc reset;
23 int ret;
24
25 ret = gpio_request_by_name(dev, "reset-gpios", 0, &reset, GPIOD_IS_OUT);
26 if (ret)
27 return ret;
28 dm_gpio_set_value(&reset, 1);
29 udelay(1);
30 dm_gpio_set_value(&reset, 0);
31 udelay(200);
32
33 return 0;
34}
35
36static const struct pwrseq_ops mmc_pwrseq_ops = {
37 .set_power = mmc_pwrseq_set_power,
38};
39
40static const struct udevice_id mmc_pwrseq_ids[] = {
41 { .compatible = "mmc-pwrseq-emmc" },
42 { }
43};
44
45U_BOOT_DRIVER(mmc_pwrseq_drv) = {
46 .name = "mmc_pwrseq_emmc",
47 .id = UCLASS_PWRSEQ,
48 .of_match = mmc_pwrseq_ids,
49 .ops = &mmc_pwrseq_ops,
50};
This page took 0.112214 seconds and 4 git commands to generate.