This grabs the reset GPIO and holds it de-asserted, if available. Asserting this signal will make the SDIO card re-enumerate. Cc: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> --- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 10 ++++++++++ .../net/wireless/broadcom/brcm80211/brcmfmac/common.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index e3758bd86acf..40e18ebfe1ea 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -446,6 +446,16 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, brcmf_dmi_probe(settings, chip, chiprev); brcmf_of_probe(dev, bus_type, settings); } + /* Fetch WL_RESET GPIO and de-assert it, if available */ + settings->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + if (settings->reset) { + /* + * If we found a reset GPIO, we may have just de-asserted it + * so wait some 8 ms for PLLs to lock, se figure 32, WLAN + * boot-up sequence in the manual. + */ + usleep_range(8000, 10000); + } return settings; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h index 8b5f49997c8b..4209e71ebcdd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h @@ -7,6 +7,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/brcmfmac.h> +#include <linux/gpio/consumer.h> #include "fwil_types.h" #define BRCMF_FW_ALTPATH_LEN 256 @@ -39,6 +40,8 @@ extern struct brcmf_mp_global_t brcmf_mp_global; * @roamoff: Firmware roaming off? * @ignore_probe_fail: Ignore probe failure. * @country_codes: If available, pointer to struct for translating country codes + * @board_type: String with the board type name + * @reset: GPIO descriptor for the RESET line * @bus: Bus specific platform data. Only SDIO at the mmoment. */ struct brcmf_mp_device { @@ -50,6 +53,7 @@ struct brcmf_mp_device { bool ignore_probe_fail; struct brcmfmac_pd_cc *country_codes; const char *board_type; + struct gpio_desc *reset; union { struct brcmfmac_sdio_pd sdio; } bus; -- 2.30.2