The branch main has been updated by adrian:

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

commit 006920b63c03528bae5abd273d57c8af63bdf68a
Author:     Ahmad Khalifa <[email protected]>
AuthorDate: 2026-08-23 16:46:34 +0000
Commit:     Adrian Chadd <[email protected]>
CommitDate: 2026-08-23 16:46:34 +0000

    rtwn: add rtwn_efuse_preread
    
    This would be used to switch to the "WiFi bank" before reading the rom.
    The 8723bu will need this, currently a nop on all chips.
    
    Differential Revision:  https://reviews.freebsd.org/D59106
---
 sys/dev/rtwn/if_rtwn_efuse.c             | 4 ++++
 sys/dev/rtwn/if_rtwnvar.h                | 3 +++
 sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c | 1 +
 sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c | 1 +
 sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c | 1 +
 sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c | 1 +
 sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c | 1 +
 sys/dev/rtwn/rtl8812a/usb/r12au_attach.c | 1 +
 sys/dev/rtwn/rtl8821a/usb/r21au_attach.c | 1 +
 9 files changed, 14 insertions(+)

diff --git a/sys/dev/rtwn/if_rtwn_efuse.c b/sys/dev/rtwn/if_rtwn_efuse.c
index 8b071996b49a..6721a5b30ece 100644
--- a/sys/dev/rtwn/if_rtwn_efuse.c
+++ b/sys/dev/rtwn/if_rtwn_efuse.c
@@ -225,6 +225,10 @@ rtwn_efuse_read_prepare(struct rtwn_softc *sc, uint8_t 
*rom, uint16_t size)
 {
        int error;
 
+       error = rtwn_efuse_preread(sc);
+       if (error != 0)
+               return (error);
+
        error = rtwn_efuse_switch_power(sc);
        if (error != 0)
                goto fail;
diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h
index aa42715b1674..54a74d898e00 100644
--- a/sys/dev/rtwn/if_rtwnvar.h
+++ b/sys/dev/rtwn/if_rtwnvar.h
@@ -298,6 +298,7 @@ struct rtwn_softc {
        int             (*sc_check_condition)(struct rtwn_softc *,
                            const uint8_t[]);
        void            (*sc_efuse_postread)(struct rtwn_softc *);
+       int             (*sc_efuse_preread)(struct rtwn_softc *);
        void            (*sc_parse_rom)(struct rtwn_softc *, uint8_t *);
        void            (*sc_set_led)(struct rtwn_softc *, int, int);
        int             (*sc_power_on)(struct rtwn_softc *);
@@ -490,6 +491,8 @@ void        rtwn_attach_vht_cap_info_mcs(struct rtwn_softc 
*);
        (((_sc)->sc_check_condition)((_sc), (_cond)))
 #define rtwn_efuse_postread(_sc) \
        (((_sc)->sc_efuse_postread)((_sc)))
+#define rtwn_efuse_preread(_sc) \
+       (((_sc)->sc_efuse_preread)((_sc)))
 #define rtwn_parse_rom(_sc, _rom) \
        (((_sc)->sc_parse_rom)((_sc), (_rom)))
 #define rtwn_set_led(_sc, _led, _on) \
diff --git a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c 
b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c
index 5bcd4a81b50d..75f59b27d470 100644
--- a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c
+++ b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c
@@ -152,6 +152,7 @@ r88ee_attach(struct rtwn_pci_softc *pc)
        sc->sc_rf_write                 = r88e_rf_write;
        sc->sc_check_condition          = r92c_check_condition;
        sc->sc_efuse_postread           = rtwn_nop_softc;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r88e_parse_rom;
        sc->sc_set_led                  = r88e_set_led;
        sc->sc_power_on                 = r88ee_power_on;
diff --git a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c 
b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
index 9ace2396d712..a0ead28037c2 100644
--- a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
+++ b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
@@ -145,6 +145,7 @@ r88eu_attach(struct rtwn_usb_softc *uc)
        sc->sc_rf_write                 = r88e_rf_write;
        sc->sc_check_condition          = r92c_check_condition;
        sc->sc_efuse_postread           = rtwn_nop_softc;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r88e_parse_rom;
        sc->sc_set_led                  = r88e_set_led;
        sc->sc_power_on                 = r88eu_power_on;
diff --git a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c 
b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c
index ef18edceabc2..b34a07714cf1 100644
--- a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c
+++ b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c
@@ -182,6 +182,7 @@ r92ce_attach(struct rtwn_pci_softc *pc)
        sc->sc_rf_write                 = r92c_rf_write;
        sc->sc_check_condition          = r92c_check_condition;
        sc->sc_efuse_postread           = r92c_efuse_postread;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r92c_parse_rom;
        sc->sc_set_led                  = r92ce_set_led;
        sc->sc_power_on                 = r92ce_power_on;
diff --git a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c 
b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c
index cd350c7fcd8a..aa8442b2ae87 100644
--- a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c
+++ b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c
@@ -174,6 +174,7 @@ r92cu_attach(struct rtwn_usb_softc *uc)
        sc->sc_rf_write                 = r92c_rf_write;
        sc->sc_check_condition          = r92c_check_condition;
        sc->sc_efuse_postread           = r92c_efuse_postread;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r92c_parse_rom;
        sc->sc_set_led                  = r92cu_set_led;
        sc->sc_power_on                 = r92cu_power_on;
diff --git a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c 
b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
index a11a6bb79c5d..103994d69593 100644
--- a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
+++ b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
@@ -123,6 +123,7 @@ r92eu_attach(struct rtwn_usb_softc *uc)
        sc->sc_rf_write                 = r92e_rf_write;
        sc->sc_check_condition          = r92c_check_condition;
        sc->sc_efuse_postread           = rtwn_nop_softc;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r92e_parse_rom;
        sc->sc_set_led                  = r92e_set_led;
        sc->sc_power_on                 = r92e_power_on;
diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c 
b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
index b6850eb9fa23..562c23001a8d 100644
--- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
+++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
@@ -225,6 +225,7 @@ r12au_attach(struct rtwn_usb_softc *uc)
        sc->sc_rf_write                 = r12a_rf_write;
        sc->sc_check_condition          = r12a_check_condition;
        sc->sc_efuse_postread           = rtwn_nop_softc;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r12a_parse_rom;
        sc->sc_power_on                 = r12a_power_on;
        sc->sc_power_off                = r12a_power_off;
diff --git a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c 
b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
index 60cb6d3fc61d..64dac8ab68bf 100644
--- a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
+++ b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
@@ -209,6 +209,7 @@ r21au_attach(struct rtwn_usb_softc *uc)
        sc->sc_rf_write                 = r12a_rf_write;
        sc->sc_check_condition          = r21a_check_condition;
        sc->sc_efuse_postread           = rtwn_nop_softc;
+       sc->sc_efuse_preread            = rtwn_nop_int_softc;
        sc->sc_parse_rom                = r21a_parse_rom;
        sc->sc_power_on                 = r21a_power_on;
        sc->sc_power_off                = r21a_power_off;

Reply via email to