lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ynke3hcrkzowv63u43b55zidr55gzlnca6vvwrndvvpb5r57y@iberusehts5q>
Date: Thu, 20 Jun 2024 08:22:54 +0200
From: Ondřej Jirman <megi@....cz>
To: Jacobe Zang <jacobe.zang@...ion.com>
Cc: arend.vanspriel@...adcom.com, kvalo@...nel.org, duoming@....edu.cn, 
	bhelgaas@...gle.com, minipli@...ecurity.net, linux-wireless@...r.kernel.org, 
	brcm80211@...ts.linux.dev, brcm80211-dev-list.pdl@...adcom.com, robh@...nel.org, 
	krzk+dt@...nel.org, conor+dt@...nel.org, heiko@...ech.de, nick@...das.com, 
	efectn@...tonmail.com, jagan@...eble.ai, dsimic@...jaro.org, devicetree@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/3] net: wireless: brcmfmac: Add optional 32k clock
 enable support

Hi,

On Thu, Jun 20, 2024 at 10:00:14AM GMT, Jacobe Zang wrote:
> WiFi modules often require 32kHz clock to function. Add support to
> enable the clock to PCIe driver.

There's also this approach https://lore.kernel.org/lkml/20240117160748.37682-1-brgl@bgdev.pl/

> Signed-off-by: Jacobe Zang <jacobe.zang@...ion.com>
> ---
>  .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 06698a714b523..f241e1757d7e3 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2014 Broadcom Corporation
>   */
>  
> +#include <linux/clk.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/firmware.h>
> @@ -2411,6 +2412,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	struct brcmf_pciedev *pcie_bus_dev;
>  	struct brcmf_core *core;
>  	struct brcmf_bus *bus;
> +	struct clk *clk;
>  
>  	if (!id) {
>  		id = pci_match_id(brcmf_pcie_devid_table, pdev);
> @@ -2422,6 +2424,14 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
>  
> +	clk = devm_clk_get_optional_enabled(&pdev->dev, "32k");

If you do this, you need to update the DT bindings. Current ones don't have 32k
clock.

> +	if (IS_ERR(clk))
> +		return PTR_ERR(clk);
> +	if (clk) {
> +		dev_info(&pdev->dev, "enabling 32kHz clock\n");

The driver has its own debug logging infrastructure (brcmf_dbg).

Kind regards,
	o.

> +		clk_set_rate(clk, 32768);
> +	}
> +
>  	ret = -ENOMEM;
>  	devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
>  	if (devinfo == NULL)
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ