From patchwork Mon Jun 24 08:19:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacobe Zang X-Patchwork-Id: 13709156 X-Patchwork-Delegate: kvalo@adurom.com Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2115.outbound.protection.outlook.com [40.107.117.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A3C9762FF; Mon, 24 Jun 2024 08:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.115 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217454; cv=fail; b=iYMWMJgPEvLMQSwy2PMdlNQRn5+YHvnv0lKZgJ0jCT+vH1OeL1p1Y3vCBs+EsCUuh+fKvpg58iQ0SdLrc0/cPg7iil/DckvNkNo3H+CVV9V0SFL86hxNOkF1Zqe3qHYc8bE64PrB03/98lVXxWtdI6eQlscRQxsbdADOeQRNPWU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217454; c=relaxed/simple; bh=5x8qacw50qOCNZX/84FwUSO8mSQF8PunKiIffwR9EDk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XZoyMHD6kEV0CTFUujtw2Lj8KYM5i95+n9ylLmWCWgmyaILKd8/2pJT3W8bACCEooLEQKyFq8bKCOgmKsxmhfzrbxxjUwkC1wItjgungQTjUEMzRn9f81RcV0fc88GeqjQhLHi2CRck9pgznNDvRfRn8i7ReNsq2ZXTkZv/JEO0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wesion.com; spf=pass smtp.mailfrom=wesion.com; arc=fail smtp.client-ip=40.107.117.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wesion.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wesion.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxaIWcf22e0MxNjpNOCy6hkVoJB7x3j8QhAnIild/1BGAUubB4CCxvXjlvn14MnL3RBPS10MEGO8XKRy/owMeqlxlKDMNgWwwU3JdUTlq72mC7736vARhEN5nNk0Eb5remF00W3AysL8nqa9GEYuu+GWHaFkDBlWK/ySykW11+mwNmntlpfguB9xTY1leMpeizoSftrRBGo4un3t1vlAc3ORVABN8lnDCn4Wu2C0sCl67w2jjAZr27cJJAON/1OkuIQo9lhgpKR9QUqYgIFoy5AtCpVZTZpZbShkeCrFJmQNxKfm/MjHbIR9SikNvnafXreV2FlAMZ9c0JOtKlm+Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qVtxdk8x4vZfLLq9NLeNtFKEm+EISHpS6u1vd+CAgzY=; b=YCnmL5RTzSGkKb7zjwQMOMAq9o7OKhiH9Dzzq0xhTDCIeMHFrV6Z66JN+pFdDEHETi+QUpO8yZodyS2fxs0sZ2ZSk3uLdLntfFnCe97/CdKVr+8wBCxH/HhLp7BdyvxRQIw/7yUcJl1v7vl8EWr06n0w7mzovmdzDu+4q3Wo9Pf/KkOXmord8ZSZ2kV6C5usCkmreLRM/3pmmJN67e/4y4ofkmUivs7lsYitNVQUvCKJmm6EXioSVLw+238AddhcaszzbWVN8mM2uBaXK2TZN2g7RZyWtG8Dq2SnUV4j9YfJlqJWA6DT3AyXZPO7LpGeWVA4ph+sE7RMTWFw0CaV5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wesion.com; dmarc=pass action=none header.from=wesion.com; dkim=pass header.d=wesion.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wesion.com; Received: from TYZPR03MB7001.apcprd03.prod.outlook.com (2603:1096:400:26a::14) by OSQPR03MB8600.apcprd03.prod.outlook.com (2603:1096:604:290::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 24 Jun 2024 08:24:11 +0000 Received: from TYZPR03MB7001.apcprd03.prod.outlook.com ([fe80::78dd:5e68:1a9c:36c0]) by TYZPR03MB7001.apcprd03.prod.outlook.com ([fe80::78dd:5e68:1a9c:36c0%6]) with mapi id 15.20.7698.024; Mon, 24 Jun 2024 08:24:11 +0000 From: Jacobe Zang To: arend.vanspriel@broadcom.com Cc: kvalo@kernel.org, duoming@zju.edu.cn, bhelgaas@google.com, minipli@grsecurity.net, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, megi@xff.cz, robh@kernel.org, efectn@protonmail.com, krzk+dt@kernel.org, conor+dt@kernel.org, heiko@sntech.de, nick@khadas.com, jagan@edgeble.ai, dsimic@manjaro.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jacobe Zang Subject: [PATCH v2 2/5] net: wireless: brcmfmac: Add optional 32k clock enable support Date: Mon, 24 Jun 2024 16:19:03 +0800 Message-Id: <20240624081906.1399447-3-jacobe.zang@wesion.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240624081906.1399447-1-jacobe.zang@wesion.com> References: <20240624081906.1399447-1-jacobe.zang@wesion.com> X-ClientProxiedBy: SI1PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:1f5::13) To TYZPR03MB7001.apcprd03.prod.outlook.com (2603:1096:400:26a::14) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR03MB7001:EE_|OSQPR03MB8600:EE_ X-MS-Office365-Filtering-Correlation-Id: ce7cf8f3-bdee-4c1c-cd0e-08dc94270684 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|52116011|7416011|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: ddgJBY8Wj8cDc+Nl3G3bYOxP58wO+mBeN4Y4ivcGsnAB4PhQik0T08oCDrL1XH0IzGGpo2rfSa/+5z10QsmV6Tv77aogkXw9Kcm8c1CtlwO3h2p+O8nscMyvsl+3jiXkp7/PJQZlhP8bTCAv7GbaBFXGPfoQlSeT5dzkOrTqEVr1+xpwVm7ncr9K8dfWZIdY2XsWw+Ignggd/R5VyOSNIymzmLkJ/rXS00br6LAheZSVSwn2mi4qmcsbUWzVEa4CY22LjWQyHPpYOIsV7v50AraNDcifeFdXxpSEQqWmNZ+9xNRUxCZdX5HzcPv7vwRWt+dLgqp0i88pZHBjyGqECaWmaDeaX7WIgBmoCfGXm14DIMHoaoudFT71gQSiNG6VVkWJXSB8iG/AbCs7kLUMQ9HRQ6Udf2uON0qdlB94/mDJ9Xrne8/KaZS+ga6lh/Z52gy4plBJBbOq9Y6+Bmo+1HX5KNELVkPGGtkU6LGPtvwbLCYup1v2r43ZfV2+8TpFlh3qNdbgz9Qp89TcMtRtRcJs0Vjo1UxzYESMknlILa2gpNjg73XThUPpD1HzA9FtGG/9klJJ1Z1l8m0wvPFv5EFS8SikRRxCqe5znCUW7vbARiW3BIm+rmgOM1/gNM9GR6SFZIHJn5pfjfy68QmajXOUK9XZjRP2DkkP7UnrK9PNsc/G4nacRRglefnG8wq6lVnLjOSFSajJQMMt5GqTP2yGbiYUMhn3/7Vc7na/A4UutV/9glATjZXfUKU09EM6OE1xrh27JEmR6LHflSDPkdCxHFlsAIZUzQtw9p+OFfE+PRbkqmALaUFvuLDJz9beyJWlmhXjA0VQeWeJeAZC6xYV/paj33g8HvABOvvKQnlT0FFVgNIgJnLWvOw5w+SZvBCSgGKgEVv/Qv+C1VbruEE75G15VV/ANbM3fSb4B3q14o9zbIk/IIeujnlPxpMEJyHc7S1pOpRZNyFF9ioD8E3VjG2ctK2y/JdJu+OqsSzmjD3tsDEIbeFxcouVRQe+y5f+sVFn990s8IVRCKfoqMEvLvrA6HxwHu8RaXW4/G2FXi1Z52a/887LCogqlc2fwaMfggr+8wM716MmC63ccjbNvujSMOqQd2SbIRX6B54XMdVX4sqeTOwylaT+9/4f16/+sTXN2hsygc+2mqqsOwbmumlzXblMyKVG2XM2SftOKTS7jaFWyO0iB/qM/cefgrSrwA2AKjrKh4Zbrpi5V7kQy6wvvs59Uxn3vCzWWDDuI14/luc3yz2aASLc9A/965RJoaNogIJCSJFoPMmqZDvKucdJlg33kv4Rqko40ZwTipVbkFoC0mJqNUxZGz9RAWbL4MingFLHJIFykKmJ4H/KhCTbkodICoJqOMvBGJ8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR03MB7001.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(366013)(52116011)(7416011)(376011)(1800799021)(38350700011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ETymAqVmfoqGVNQNxbA0yCe+a6Ov9ddimmZVS4V3PPSa3NZ0XTJi+R61bdQoBM94+Oahh3eLon2/8E+bVdnDck0s3Ah6nGKjsY2I0y1B5RKlROj6KxZE3YiYBWiQQYvULFUy1EWmhnONTFy9AHuo4T5E+edhgS5s9n7o6m3pq8vKK2rOqB9XKQPCDAu4rU0kC/CXa5JzDAe6L40Uza9GibuWVCwsZ+rpUgjEZuiRrUg/fnAGLzVTr+ASqLX1U/xC+PAeJQoyTzzMq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fEACJY1IDVZG64LkW4+zFwt7bZMVc74ErSEgKhMxdQcZP1ne15FCt+EInQ+emH1LMKiFbATTFpLrKJJOmwIrQpiQOBORRGmn6hjm4EQPrrg3KaPruvwFPo38sHc6v7AY8YQDrjuNGIftXK90giSFsNixSyKBqnINMYWmo5131UzeppbMx6igJDCr+WkrjG62LJPCqRSNcUIWe8SIUZ3WLE6B04lq4fpTXmjesvLl2OODm2xJ0xqqVujP0K53TG X-OriginatorOrg: wesion.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce7cf8f3-bdee-4c1c-cd0e-08dc94270684 X-MS-Exchange-CrossTenant-AuthSource: TYZPR03MB7001.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 08:24:11.4951 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 2dc3bd76-7ac2-4780-a5b7-6c6cc6b5af9b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nf582qAsSzUH4V9efmXW7NaknchpiGkgSk0iqCO/Yn6uSyBp2n6/eV/3NrZH79e5Grd8iF4ULvbixFdG3n5K2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR03MB8600 WiFi modules often require 32kHz clock to function. Add support to enable the clock to PCIe driver. Co-developed-by: Ondrej Jirman Signed-off-by: Ondrej Jirman Signed-off-by: Jacobe Zang --- .../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..4a7eb83a60ffc 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 #include #include #include @@ -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 (IS_ERR(clk)) + return PTR_ERR(clk); + if (clk) { + brcmf_dbg(PCIE, "enabling 32kHz clock\n", pdev->vendor, pdev->device); + clk_set_rate(clk, 32768); + } + ret = -ENOMEM; devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL); if (devinfo == NULL)