aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2022-06-23 18:35:34 +0930
committerTom Rini <trini@konsulko.com>2022-07-06 14:31:29 -0400
commit66900bc25432ed0f99d6decbf7b383536b3456aa (patch)
tree81f72a52a6458727ebf1d6192c42c04ef2f162b4 /drivers
parentf49a7a160d8851d1a22928125d317f8ddfb3157b (diff)
downloadu-boot-66900bc25432ed0f99d6decbf7b383536b3456aa.zip
u-boot-66900bc25432ed0f99d6decbf7b383536b3456aa.tar.gz
u-boot-66900bc25432ed0f99d6decbf7b383536b3456aa.tar.bz2
mmc/aspeed: Probe from controller
The Aspeed SDHCI controller is arranged with some shared control registers, followed by one or two sets of actual SDHCI registers. Adjust the driver to probe this controller device first. The driver then wants to iterate over the child nodes to probe the SDHCI proper: ofnode node; dev_for_each_subnode(node, parent) { struct udevice *dev; int ret; ret = device_bind_driver_to_node(parent, "aspeed_sdhci", ofnode_get_name(node), node, &dev); if (ret) return ret; } However if we did this the sdhci driver would probe twice; once "naturally" from the device tree and a second time due to this code. Instead of doing this we can rely on the probe order, where the controller will be set up before the sdhci devices. A better solution is preferred. Select MISC as the controller driver is implemented as a misc device. Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/Kconfig1
-rw-r--r--drivers/mmc/aspeed_sdhci.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 53a6b00..b44cd98 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -502,6 +502,7 @@ config MMC_SDHCI_ASPEED
depends on ARCH_ASPEED
depends on DM_MMC
depends on MMC_SDHCI
+ select MISC
help
Enables support for the Aspeed SDHCI 2.0 controller present on Aspeed
SoCs. This device is compatible with SD 3.0 and/or MMC 4.3
diff --git a/drivers/mmc/aspeed_sdhci.c b/drivers/mmc/aspeed_sdhci.c
index c71daae..5591fa2 100644
--- a/drivers/mmc/aspeed_sdhci.c
+++ b/drivers/mmc/aspeed_sdhci.c
@@ -10,6 +10,7 @@
#include <malloc.h>
#include <sdhci.h>
#include <linux/err.h>
+#include <dm/lists.h>
struct aspeed_sdhci_plat {
struct mmc_config cfg;
@@ -94,3 +95,23 @@ U_BOOT_DRIVER(aspeed_sdhci_drv) = {
.priv_auto = sizeof(struct sdhci_host),
.plat_auto = sizeof(struct aspeed_sdhci_plat),
};
+
+
+static int aspeed_sdc_probe(struct udevice *parent)
+{
+ return 0;
+}
+
+static const struct udevice_id aspeed_sdc_ids[] = {
+ { .compatible = "aspeed,ast2400-sd-controller" },
+ { .compatible = "aspeed,ast2500-sd-controller" },
+ { .compatible = "aspeed,ast2600-sd-controller" },
+ { }
+};
+
+U_BOOT_DRIVER(aspeed_sdc_drv) = {
+ .name = "aspeed_sdc",
+ .id = UCLASS_MISC,
+ .of_match = aspeed_sdc_ids,
+ .probe = aspeed_sdc_probe,
+};