Message ID | 20240730033053.4092132-5-jacobe.zang@wesion.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | Add AP6275P wireless support | expand |
Hi Jacobe, Am 30.07.24 um 05:30 schrieb Jacobe Zang: > WiFi modules often require 32kHz clock to function. Add support to > enable the clock to PCIe driver. > > Co-developed-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Jacobe Zang <jacobe.zang@wesion.com> > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > index e406e11481a62..6246e3fd7399f 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > @@ -6,6 +6,7 @@ > #include <linux/of.h> > #include <linux/of_irq.h> > #include <linux/of_net.h> > +#include <linux/clk.h> > > #include <defs.h> > #include "debug.h" > @@ -70,6 +71,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, > { > struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; > struct device_node *root, *np = dev->of_node; > + struct clk *clk; > const char *prop; > int irq; > int err; > @@ -113,6 +115,12 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, > of_node_put(root); > } > > + clk = devm_clk_get_optional_enabled(dev, "lpo"); > + if (!IS_ERR_OR_NULL(clk)) { > + brcmf_dbg(INFO, "enabling 32kHz clock\n"); > + clk_set_rate(clk, 32768); > + } even if the clock is optional, there should be a proper error handling (e.g. the -EPROBE_DEFER case). Best regards > + > if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) > return; >
On 7/30/2024 5:30 AM, Jacobe Zang wrote: > WiFi modules often require 32kHz clock to function. Add support to > enable the clock to PCIe driver. > > Co-developed-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Jacobe Zang <jacobe.zang@wesion.com> > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > index e406e11481a62..6246e3fd7399f 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > @@ -6,6 +6,7 @@ > #include <linux/of.h> > #include <linux/of_irq.h> > #include <linux/of_net.h> > +#include <linux/clk.h> > > #include <defs.h> > #include "debug.h" > @@ -70,6 +71,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, > { > struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; > struct device_node *root, *np = dev->of_node; > + struct clk *clk; > const char *prop; > int irq; > int err; > @@ -113,6 +115,12 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, > of_node_put(root); > } > > + clk = devm_clk_get_optional_enabled(dev, "lpo"); > + if (!IS_ERR_OR_NULL(clk)) { > + brcmf_dbg(INFO, "enabling 32kHz clock\n"); > + clk_set_rate(clk, 32768); > + } > + > if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) > return; This if-statement should be the first check in brcmf_of_probe(). Can you include that change in your patch. Regards, Arend
>> WiFi modules often require 32kHz clock to function. Add support to >> enable the clock to PCIe driver. >> >> Co-developed-by: Ondrej Jirman <megi@xff.cz> >> Signed-off-by: Ondrej Jirman <megi@xff.cz> >> Signed-off-by: Jacobe Zang <jacobe.zang@wesion.com> >> --- >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c >> index e406e11481a62..6246e3fd7399f 100644 >> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c >> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c >> @@ -6,6 +6,7 @@ >> #include <linux/of.h> >> #include <linux/of_irq.h> >> #include <linux/of_net.h> >> +#include <linux/clk.h> >> >> #include <defs.h> >> #include "debug.h" >> @@ -70,6 +71,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, >> { >> struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; >> struct device_node *root, *np = dev->of_node; >> + struct clk *clk; >> const char *prop; >> int irq; >> int err; >> @@ -113,6 +115,12 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, >> of_node_put(root); >> } >> >> + clk = devm_clk_get_optional_enabled(dev, "lpo"); >> + if (!IS_ERR_OR_NULL(clk)) { >> + brcmf_dbg(INFO, "enabling 32kHz clock\n"); >> + clk_set_rate(clk, 32768); >> + } >> + >> if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) >> return; > > This if-statement should be the first check in brcmf_of_probe(). Can you > include that change in your patch. Sure. I will change it ;-) --- Best Regards Jacobe
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index e406e11481a62..6246e3fd7399f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -6,6 +6,7 @@ #include <linux/of.h> #include <linux/of_irq.h> #include <linux/of_net.h> +#include <linux/clk.h> #include <defs.h> #include "debug.h" @@ -70,6 +71,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, { struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; struct device_node *root, *np = dev->of_node; + struct clk *clk; const char *prop; int irq; int err; @@ -113,6 +115,12 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, of_node_put(root); } + clk = devm_clk_get_optional_enabled(dev, "lpo"); + if (!IS_ERR_OR_NULL(clk)) { + brcmf_dbg(INFO, "enabling 32kHz clock\n"); + clk_set_rate(clk, 32768); + } + if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) return;