The branch main has been updated by manu:

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

commit e758ed2dd5350b432cf10b6c2c3cbf4c3d570b03
Author:     Emmanuel Vadot <[email protected]>
AuthorDate: 2022-09-29 11:58:08 +0000
Commit:     Emmanuel Vadot <[email protected]>
CommitDate: 2023-08-10 07:21:55 +0000

    sdhci: Add support for disable-wp
    
    Some platform needs it when the WP pin is broken.
    
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    MFC after:      2 weeks
---
 sys/dev/sdhci/sdhci_fdt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/sdhci/sdhci_fdt.c b/sys/dev/sdhci/sdhci_fdt.c
index c6319d49ca65..1890ab3ae6a6 100644
--- a/sys/dev/sdhci/sdhci_fdt.c
+++ b/sys/dev/sdhci/sdhci_fdt.c
@@ -143,6 +143,7 @@ struct sdhci_fdt_softc {
        struct resource *mem_res[MAX_SLOTS];    /* Memory resource */
 
        bool            wp_inverted;    /* WP pin is inverted */
+       bool            wp_disabled;    /* WP pin is not supported */
        bool            no_18v;         /* No 1.8V support */
 
        clk_t           clk_xin;        /* xin24m fixed clock */
@@ -433,6 +434,8 @@ sdhci_fdt_get_ro(device_t bus, device_t dev)
 {
        struct sdhci_fdt_softc *sc = device_get_softc(bus);
 
+       if (sc->wp_disabled)
+               return (false);
        return (sdhci_generic_get_ro(bus, dev) ^ sc->wp_inverted);
 }
 
@@ -554,6 +557,8 @@ sdhci_fdt_probe(device_t dev)
                sc->no_18v = true;
        if (OF_hasprop(node, "wp-inverted"))
                sc->wp_inverted = true;
+       if (OF_hasprop(node, "disable-wp"))
+               sc->wp_disabled = true;
 
        return (0);
 }

Reply via email to