svn commit: r317800 - head/sys/dev/sdhci
Luiz Otavio O Souza
loos at FreeBSD.org
Thu May 4 18:56:12 UTC 2017
Author: loos
Date: Thu May 4 18:56:11 2017
New Revision: 317800
URL: https://svnweb.freebsd.org/changeset/base/317800
Log:
Add support for the no-1-8-v and wp-inverted properties in generic SDHCI
FDT glue.
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)
Modified:
head/sys/dev/sdhci/sdhci_fdt.c
Modified: head/sys/dev/sdhci/sdhci_fdt.c
==============================================================================
--- head/sys/dev/sdhci/sdhci_fdt.c Thu May 4 17:23:39 2017 (r317799)
+++ head/sys/dev/sdhci/sdhci_fdt.c Thu May 4 18:56:11 2017 (r317800)
@@ -70,6 +70,9 @@ struct sdhci_fdt_softc {
int num_slots; /* Number of slots on this controller*/
struct sdhci_slot slots[MAX_SLOTS];
struct resource *mem_res[MAX_SLOTS]; /* Memory resource */
+
+ bool wp_inverted; /* WP pin is inverted */
+ bool no_18v; /* No 1.8V support */
};
static uint8_t
@@ -110,8 +113,13 @@ static uint32_t
sdhci_fdt_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off)
{
struct sdhci_fdt_softc *sc = device_get_softc(dev);
+ uint32_t val32;
+
+ val32 = bus_read_4(sc->mem_res[slot->num], off);
+ if (off == SDHCI_CAPABILITIES && sc->no_18v)
+ val32 &= ~SDHCI_CAN_VDD_180;
- return (bus_read_4(sc->mem_res[slot->num], off));
+ return (val32);
}
static void
@@ -152,6 +160,14 @@ sdhci_fdt_intr(void *arg)
}
static int
+sdhci_fdt_get_ro(device_t bus, device_t dev)
+{
+ struct sdhci_fdt_softc *sc = device_get_softc(bus);
+
+ return (sdhci_generic_get_ro(bus, dev) ^ sc->wp_inverted);
+}
+
+static int
sdhci_fdt_probe(device_t dev)
{
struct sdhci_fdt_softc *sc = device_get_softc(dev);
@@ -182,6 +198,10 @@ sdhci_fdt_probe(device_t dev)
sc->num_slots = cid;
if ((OF_getencprop(node, "max-frequency", &cid, sizeof(cid))) > 0)
sc->max_clk = cid;
+ if (OF_hasprop(node, "no-1-8-v"))
+ sc->no_18v = true;
+ if (OF_hasprop(node, "wp-inverted"))
+ sc->wp_inverted = true;
return (0);
}
@@ -279,7 +299,7 @@ static device_method_t sdhci_fdt_methods
/* mmcbr_if */
DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios),
DEVMETHOD(mmcbr_request, sdhci_generic_request),
- DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro),
+ DEVMETHOD(mmcbr_get_ro, sdhci_fdt_get_ro),
DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host),
DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host),
More information about the svn-src-head
mailing list