mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 19:11:37 +00:00
mmc: sti_sdhci: Use reset framework
Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9ea2fc88dd
commit
dca3166f55
1 changed files with 20 additions and 15 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
|
#include <reset-uclass.h>
|
||||||
#include <sdhci.h>
|
#include <sdhci.h>
|
||||||
#include <asm/arch/sdhci.h>
|
#include <asm/arch/sdhci.h>
|
||||||
|
|
||||||
|
@ -16,15 +17,10 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
struct sti_sdhci_plat {
|
struct sti_sdhci_plat {
|
||||||
struct mmc_config cfg;
|
struct mmc_config cfg;
|
||||||
struct mmc mmc;
|
struct mmc mmc;
|
||||||
|
struct reset_ctl reset;
|
||||||
int instance;
|
int instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* used to get access to MMC1 reset,
|
|
||||||
* will be removed when STi reset driver will be available
|
|
||||||
*/
|
|
||||||
#define STIH410_SYSCONF5_BASE 0x092b0000
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sti_mmc_core_config: configure the Arasan HC
|
* sti_mmc_core_config: configure the Arasan HC
|
||||||
* @dev : udevice
|
* @dev : udevice
|
||||||
|
@ -37,17 +33,19 @@ struct sti_sdhci_plat {
|
||||||
* W/o these settings the SDHCI could configure and use the embedded controller
|
* W/o these settings the SDHCI could configure and use the embedded controller
|
||||||
* with limited features.
|
* with limited features.
|
||||||
*/
|
*/
|
||||||
static void sti_mmc_core_config(struct udevice *dev)
|
static int sti_mmc_core_config(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct sti_sdhci_plat *plat = dev_get_platdata(dev);
|
struct sti_sdhci_plat *plat = dev_get_platdata(dev);
|
||||||
struct sdhci_host *host = dev_get_priv(dev);
|
struct sdhci_host *host = dev_get_priv(dev);
|
||||||
unsigned long *sysconf;
|
int ret;
|
||||||
|
|
||||||
/* only MMC1 has a reset line */
|
/* only MMC1 has a reset line */
|
||||||
if (plat->instance) {
|
if (plat->instance) {
|
||||||
sysconf = (unsigned long *)(STIH410_SYSCONF5_BASE +
|
ret = reset_deassert(&plat->reset);
|
||||||
ST_MMC_CCONFIG_REG_5);
|
if (ret < 0) {
|
||||||
generic_set_bit(SYSCONF_MMC1_ENABLE_BIT, sysconf);
|
error("MMC1 deassert failed: %d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writel(STI_FLASHSS_MMC_CORE_CONFIG_1,
|
writel(STI_FLASHSS_MMC_CORE_CONFIG_1,
|
||||||
|
@ -66,6 +64,8 @@ static void sti_mmc_core_config(struct udevice *dev)
|
||||||
}
|
}
|
||||||
writel(STI_FLASHSS_MMC_CORE_CONFIG4,
|
writel(STI_FLASHSS_MMC_CORE_CONFIG4,
|
||||||
host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4);
|
host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sti_sdhci_probe(struct udevice *dev)
|
static int sti_sdhci_probe(struct udevice *dev)
|
||||||
|
@ -80,13 +80,18 @@ static int sti_sdhci_probe(struct udevice *dev)
|
||||||
* MMC0 is wired to the SD slot,
|
* MMC0 is wired to the SD slot,
|
||||||
* MMC1 is wired on the high speed connector
|
* MMC1 is wired on the high speed connector
|
||||||
*/
|
*/
|
||||||
|
ret = reset_get_by_index(dev, 0, &plat->reset);
|
||||||
if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL))
|
if (!ret)
|
||||||
plat->instance = 1;
|
plat->instance = 1;
|
||||||
else
|
else
|
||||||
plat->instance = 0;
|
if (ret == -ENOENT)
|
||||||
|
plat->instance = 0;
|
||||||
|
else
|
||||||
|
return ret;
|
||||||
|
|
||||||
sti_mmc_core_config(dev);
|
ret = sti_mmc_core_config(dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
|
host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
|
||||||
SDHCI_QUIRK_32BIT_DMA_ADDR |
|
SDHCI_QUIRK_32BIT_DMA_ADDR |
|
||||||
|
|
Loading…
Add table
Reference in a new issue