git: ac90d8077136 - stable/13 - mmc_fdt_helpers: Parse the optional pwrseq element.

Emmanuel Vadot manu at FreeBSD.org
Thu Jul 22 17:17:01 UTC 2021


The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac90d8077136a3bb573824ebad0332e6e1a2f187

commit ac90d8077136a3bb573824ebad0332e6e1a2f187
Author:     Emmanuel Vadot <manu at FreeBSD.org>
AuthorDate: 2021-05-16 12:50:10 +0000
Commit:     Emmanuel Vadot <manu at FreeBSD.org>
CommitDate: 2021-07-22 17:09:39 +0000

    mmc_fdt_helpers: Parse the optional pwrseq element.
    
    If a sd/emmc node have a pwrseq property parse it and get the corresponding
    driver.
    This can later be used to powerup/powerdown the SDIO card or eMMC.
    
    Sponsored by:   Diablotin Systems
    Differential Revision:  https://reviews.freebsd.org/D30289
    
    (cherry picked from commit b0387990a784050ef3a14ea49cb513b5eb737844)
---
 sys/dev/mmc/mmc_fdt_helpers.c | 8 ++++++++
 sys/dev/mmc/mmc_fdt_helpers.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c
index 7dff3851883b..e544f3c4ac08 100644
--- a/sys/dev/mmc/mmc_fdt_helpers.c
+++ b/sys/dev/mmc/mmc_fdt_helpers.c
@@ -100,6 +100,7 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper,
     struct mmc_host *host)
 {
 	uint32_t bus_width;
+	phandle_t pwrseq_xref;
 
 	if (node <= 0)
 		node = ofw_bus_get_node(dev);
@@ -181,6 +182,13 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper,
 		host->caps |= MMC_CAP_SIGNALING_330;
 #endif
 
+	if (OF_hasprop(node, "mmc-pwrseq")) {
+		if (OF_getencprop(node, "mmc-pwrseq", &pwrseq_xref, sizeof(pwrseq_xref)) == -1) {
+			device_printf(dev, "Cannot get the pwrseq_xref property\n");
+			return (ENXIO);
+		}
+		helper->mmc_pwrseq = OF_device_from_xref(pwrseq_xref);
+	}
 	return (0);
 }
 
diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h
index 73ec324d6b9f..c6e2175690ee 100644
--- a/sys/dev/mmc/mmc_fdt_helpers.h
+++ b/sys/dev/mmc/mmc_fdt_helpers.h
@@ -63,6 +63,8 @@ struct mmc_fdt_helper {
 	regulator_t	vmmc_supply;
 	regulator_t	vqmmc_supply;
 #endif
+
+	device_t	mmc_pwrseq;
 };
 
 typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present);


More information about the dev-commits-src-all mailing list