aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorTom Rini2021-01-05 22:34:43 -0500
committerTom Rini2021-01-05 22:34:43 -0500
commitb11f634b1c1be6ab419758c6596c673445e5ac70 (patch)
tree2329e1ff53c6c543e01d84b7901c53621ad8b7f9 /drivers/mmc
parent720620e6916ba40b9a173bb07706d2c73f3c23e7 (diff)
parent970349a96dac3ad46c33851b1a773bfe3f1d4b33 (diff)
Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into next
Driver model: make some udevice fields private Driver model: Rename U_BOOT_DEVICE et al. dtoc: Tidy up and add more tests ns16550 code clean-up x86 and sandbox minor fixes for of-platdata dtoc prepration for adding build-time instantiation
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/arm_pl180_mmci.c6
-rw-r--r--drivers/mmc/fsl_esdhc_imx.c2
-rw-r--r--drivers/mmc/mxsmmc.c4
-rw-r--r--drivers/mmc/octeontx_hsmmc.c42
-rw-r--r--drivers/mmc/pci_mmc.c2
-rw-r--r--drivers/mmc/rockchip_dw_mmc.c4
6 files changed, 35 insertions, 25 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index fe406fe4ad7..b2d1b4f9aa9 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -421,7 +421,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
struct arm_pl180_mmc_plat *pdata = dev_get_plat(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct mmc *mmc = &pdata->mmc;
- struct pl180_mmc_host *host = dev->priv;
+ struct pl180_mmc_host *host = dev_get_priv(dev);
struct mmc_config *cfg = &pdata->cfg;
struct clk clk;
u32 bus_width;
@@ -508,7 +508,7 @@ static int dm_host_set_ios(struct udevice *dev)
static int dm_mmc_getcd(struct udevice *dev)
{
- struct pl180_mmc_host *host = dev->priv;
+ struct pl180_mmc_host *host = dev_get_priv(dev);
int value = 1;
if (dm_gpio_is_valid(&host->cd_gpio))
@@ -525,7 +525,7 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = {
static int arm_pl180_mmc_of_to_plat(struct udevice *dev)
{
- struct pl180_mmc_host *host = dev->priv;
+ struct pl180_mmc_host *host = dev_get_priv(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 01a94428e70..f47a095c50f 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1742,5 +1742,5 @@ U_BOOT_DRIVER(fsl_esdhc) = {
.priv_auto = sizeof(struct fsl_esdhc_priv),
};
-U_BOOT_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc)
+DM_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc)
#endif
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 143818d4018..8fd41764152 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -668,7 +668,7 @@ static const struct dm_mmc_ops mxsmmc_ops = {
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int mxsmmc_of_to_plat(struct udevice *bus)
{
- struct mxsmmc_plat *plat = bus->plat;
+ struct mxsmmc_plat *plat = dev_get_plat(bus);
u32 prop[2];
int ret;
@@ -722,5 +722,5 @@ U_BOOT_DRIVER(fsl_imx23_mmc) = {
.plat_auto = sizeof(struct mxsmmc_plat),
};
-U_BOOT_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc)
+DM_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc)
#endif /* CONFIG_DM_MMC */
diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c
index 5552342f8d9..442ca493d76 100644
--- a/drivers/mmc/octeontx_hsmmc.c
+++ b/drivers/mmc/octeontx_hsmmc.c
@@ -30,6 +30,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/csrs/csrs-mio_emm.h>
#include <asm/io.h>
+#include <dm/device-internal.h>
#include <power/regulator.h>
@@ -3438,7 +3439,7 @@ static u32 xlate_voltage(u32 voltage)
*/
static bool octeontx_mmc_get_valid(struct udevice *dev)
{
- const char *stat = ofnode_read_string(dev->node, "status");
+ const char *stat = ofnode_read_string(dev_ofnode(dev), "status");
if (!stat || !strncmp(stat, "ok", 2))
return true;
@@ -3460,14 +3461,15 @@ static int octeontx_mmc_get_config(struct udevice *dev)
uint low, high;
char env_name[32];
int err;
- ofnode node = dev->node;
+ ofnode node = dev_ofnode(dev);
int bus_width = 1;
ulong new_max_freq;
debug("%s(%s)", __func__, dev->name);
slot->cfg.name = dev->name;
- slot->cfg.f_max = ofnode_read_s32_default(dev->node, "max-frequency",
+ slot->cfg.f_max = ofnode_read_s32_default(dev_ofnode(dev),
+ "max-frequency",
26000000);
snprintf(env_name, sizeof(env_name), "mmc_max_frequency%d",
slot->bus_id);
@@ -3485,25 +3487,26 @@ static int octeontx_mmc_get_config(struct udevice *dev)
if (IS_ENABLED(CONFIG_ARCH_OCTEONTX2)) {
slot->hs400_tuning_block =
- ofnode_read_s32_default(dev->node,
+ ofnode_read_s32_default(dev_ofnode(dev),
"marvell,hs400-tuning-block",
-1);
debug("%s(%s): mmc HS400 tuning block: %d\n", __func__,
dev->name, slot->hs400_tuning_block);
slot->hs200_tap_adj =
- ofnode_read_s32_default(dev->node,
+ ofnode_read_s32_default(dev_ofnode(dev),
"marvell,hs200-tap-adjust", 0);
debug("%s(%s): hs200-tap-adjust: %d\n", __func__, dev->name,
slot->hs200_tap_adj);
slot->hs400_tap_adj =
- ofnode_read_s32_default(dev->node,
+ ofnode_read_s32_default(dev_ofnode(dev),
"marvell,hs400-tap-adjust", 0);
debug("%s(%s): hs400-tap-adjust: %d\n", __func__, dev->name,
slot->hs400_tap_adj);
}
- err = ofnode_read_u32_array(dev->node, "voltage-ranges", voltages, 2);
+ err = ofnode_read_u32_array(dev_ofnode(dev), "voltage-ranges",
+ voltages, 2);
if (err) {
slot->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
} else {
@@ -3751,18 +3754,19 @@ static int octeontx_mmc_host_probe(struct udevice *dev)
host->dev = dev;
debug("%s(%s): Base address: %p\n", __func__, dev->name,
host->base_addr);
- if (!dev_has_of_node(dev)) {
+ if (!dev_has_ofnode(dev)) {
pr_err("%s: No device tree information found\n", __func__);
return -1;
}
- host->node = dev->node;
+ host->node = dev_ofnode(dev);
host->last_slotid = -1;
if (otx_is_platform(PLATFORM_ASIM))
host->is_asim = true;
if (otx_is_platform(PLATFORM_EMULATOR))
host->is_emul = true;
host->dma_wait_delay =
- ofnode_read_u32_default(dev->node, "marvell,dma-wait-delay", 1);
+ ofnode_read_u32_default(dev_ofnode(dev),
+ "marvell,dma-wait-delay", 1);
/* Force reset of eMMC */
writeq(0, host->base_addr + MIO_EMM_CFG());
debug("%s: Clearing MIO_EMM_CFG\n", __func__);
@@ -3823,7 +3827,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev)
struct octeontx_mmc_host *host = dev_get_priv(dev_get_parent(dev));
struct octeontx_mmc_slot *slot;
struct mmc_uclass_priv *upriv;
- ofnode node = dev->node;
+ ofnode node = dev_ofnode(dev);
u32 bus_id;
char name[16];
int err;
@@ -3841,7 +3845,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev)
}
slot = &host->slots[bus_id];
- dev->priv = slot;
+ dev_set_priv(dev, slot);
slot->host = host;
slot->bus_id = bus_id;
slot->dev = dev;
@@ -3852,16 +3856,21 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev)
snprintf(name, sizeof(name), "octeontx-mmc%d", bus_id);
err = device_set_name(dev, name);
- if (!dev->uclass_priv) {
+ /* FIXME: This code should not be needed */
+ if (!dev_get_uclass_priv(dev)) {
debug("%s(%s): Allocating uclass priv\n", __func__,
dev->name);
upriv = calloc(1, sizeof(struct mmc_uclass_priv));
if (!upriv)
return -ENOMEM;
- dev->uclass_priv = upriv;
- dev->uclass->priv = upriv;
+
+ /*
+ * FIXME: This is not allowed
+ * dev_set_uclass_priv(dev, upriv);
+ * uclass_set_priv(dev->uclass, upriv);
+ */
} else {
- upriv = dev->uclass_priv;
+ upriv = dev_get_uclass_priv(dev);
}
upriv->mmc = &slot->mmc;
@@ -3878,6 +3887,7 @@ static const struct udevice_id octeontx_hsmmc_host_ids[] = {
U_BOOT_DRIVER(octeontx_hsmmc_host) = {
.name = "octeontx_hsmmc_host",
+ /* FIXME: Why is this not UCLASS_MMC? */
.id = UCLASS_MISC,
.of_match = of_match_ptr(octeontx_hsmmc_host_ids),
.probe = octeontx_mmc_host_probe,
diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
index fc09ad99e5e..c71c495d581 100644
--- a/drivers/mmc/pci_mmc.c
+++ b/drivers/mmc/pci_mmc.c
@@ -75,7 +75,7 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,
struct acpi_dp *dp;
int ret;
- if (!dev_of_valid(dev))
+ if (!dev_has_ofnode(dev))
return 0;
ret = gpio_get_acpi(&priv->cd_gpio, &gpio);
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index 75db81ba4ca..1be3c1741fd 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -180,8 +180,8 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = {
.plat_auto = sizeof(struct rockchip_mmc_plat),
};
-U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc)
-U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc)
+DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc)
+DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc)
#ifdef CONFIG_PWRSEQ
static int rockchip_dwmmc_pwrseq_set_power(struct udevice *dev, bool enable)