From patchwork Wed Jul 31 06:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacobe Zang X-Patchwork-Id: 13748100 X-Patchwork-Delegate: kvalo@adurom.com Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2091.outbound.protection.outlook.com [40.107.255.91]) (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 0536A16C875; Wed, 31 Jul 2024 06:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.91 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722406322; cv=fail; b=d0Ggp9eRI4OHzuuSE+qUVW0MpEizP6WI3Tbh+C7uSaNjOXlp7pLWilxEVg1ZHO6G97smnlfrVBfoGiRuWDajYBTsP4cnlEcV3xeMXMYBmsySzenGTjGFWjrHQ+arH6lL1mp37zJbU63n/KZ4ArS+ng/kDXtt7dnjy34OAshF0Wc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722406322; c=relaxed/simple; bh=lKn7tedXjLdpYoxPuq/HfCw3vPweUEjpaIRuIff6PWk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UhTk6jVJ81jaM0a+LNae5zSdx6EwZUSpEePPdYIYyJvilrbB1aesxQnbeX7iECF2o1YIlDZ+bR9HXMuoSdaQMabU5eFayvJ6zj8fFRJod7dflnGSM2r8vblq1YywugqlmGiJ7BEoKjZuuQJvSaCd2Vmi+U9ToteFoAEAXVcr8mc= 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.255.91 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=arcselector10001; d=microsoft.com; cv=none; b=ejYoXQ48BVWMG04moR/Iol5Hyc4JdHHzxtFKpKC58rDzPUSmke4HIxW2/bhiglnkR0EGZJRF7//gABl0JNiQvbgE0esg4L+9w05m+YvPzTeV3PqR12tC3Z+R9VRc2dgnN0TjRNrlRe02zwrMM51VZ6/WvFpTfmNmmcNRy4xXZpeceEHV22A4cekqvjXAwSFTXJEi2d32kzPlGL2VP2DBtp7jTLPHbU7fTmGeXAq3vFRrVzIUpSqxfhrgk+BHAe9VvSnFnDPU7wXu1LQWdAGWPQRCLKelgDB82Znc198lzq4kjkD65FkXTvA3AIVQhtdZtk8I7DlRgcdgxMT9Lhpa6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/2JPbJjR30bz0tWINXyBq+rwGz3WBsWM8w7Fol41l0I=; b=gZj4ygLea/EFna5IqwYEFpNt+PtcaRj8p2zKw4UJwu3AxvNNBDlyrSIbnIa2wpy/KoiPwElU/PH8/BBOd7rsYcWa8SQNwhNmCLrNdFacx8dwdM9w0ZhF8TRL+Phwt7MTlhtc/QDFYTcRq5B41xnT/tT5wudvCwfR+IjdaW2B2DMCeJHhRv1JGbJ7V+yngyFro4aRX4rIVZDDsmzWSeWyrQJdPGDrmXACyaIaOCrVi0lvVpd9W6sD+UUBNX4fu0KCQvek9kDD3hic3rYInyGj38HmXAoSbwS8Pvo8MvCqIwMFMBhS8KpAv6ImONNYhFZQ2hcVm5t9WUyrSq4XC/O5xA== 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 SEYPR03MB6580.apcprd03.prod.outlook.com (2603:1096:101:85::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Wed, 31 Jul 2024 06:11:56 +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.7828.016; Wed, 31 Jul 2024 06:11:56 +0000 From: Jacobe Zang To: robh@kernel.org, krzk+dt@kernel.org, heiko@sntech.de, kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, conor+dt@kernel.org, arend.vanspriel@broadcom.com Cc: efectn@protonmail.com, dsimic@manjaro.org, jagan@edgeble.ai, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, arend@broadcom.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, megi@xff.cz, duoming@zju.edu.cn, bhelgaas@google.com, minipli@grsecurity.net, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, nick@khadas.com, Jacobe Zang Subject: [PATCH v6 4/5] wifi: brcmfmac: Add optional lpo clock enable support Date: Wed, 31 Jul 2024 14:11:31 +0800 Message-Id: <20240731061132.703368-5-jacobe.zang@wesion.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240731061132.703368-1-jacobe.zang@wesion.com> References: <20240731061132.703368-1-jacobe.zang@wesion.com> X-ClientProxiedBy: TYCP286CA0178.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::9) 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_|SEYPR03MB6580:EE_ X-MS-Office365-Filtering-Correlation-Id: c93f608b-9231-492b-306e-08dcb127ae3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: xeSlYMkrJK9LBi0kMMgNwM1Cm6adjBlUskOuL61To17M+ia0ud1QgHTOROc7tHjvzLQPEfIJpF9Fl4hLfj5EuI+wBcLzrxOoqfzoJGkaheXcoLdj5DJubmm8b249l3wOeSAUv79fmzJEUdEHPYYA8vuNh7OFsiZEij1mk5V7soa8LiTsIpud+DtcF6/A1CUdmc3rAHgMA/b23soC4UAopDlN82lHmRuhePqXJQM8okXyksl9b3lCQKMwk5ZUPLckhjFUvTIu9ORVaiXN9jODqtY7E6xdUUJnbfUcpEVhgZJvZCLjKi9XG7co59PKC0oRczRIQIQFpgPsgKSJ3UjHDd9vG2D5+WbX/Db8YQafS6zHhc6GLEhHigrw1OelpkMiyMlr8t1nVk/pM2LL1D5VhlxFzmFMS1t9gM255RRuKeEfY8hRSwDYb/OUsuxgC+b69lPflOLq3rObUh/2Ep53r1ssxNcXM751b/4OhSTAHH6wviGdhllGqKH7oYyFTyawY0O3kquAl+ydWXWC+gvShIa2jAQ+v48gRNGTml8Dx8yzgshoQmQfGRDoQgEfW3TkqDaBt+Heh2I+f7BB+zuR/6EKYmHyYT7Xpcqc2WvuRvOWGzi1mVXw0BHRQ3T9SWvVyQ+In5+ei5f+lHSvonmD1qu29c4wwt2e8TrfwGQVdNTx6ZAXu5q32zXCc4vDfidk71/fXg+OnRoG/huqj00H1iXHajfeJBVKn+HbhIP0K1FOa1reNk9+X4/4hCZSdKa9rqIC1lqw2fJztwZ7kZjqQwV53jVqXINoYbdADW7VswSiBIZrb7TrFsYazEK4yQz8vWQz1BffuHakTk/oyxwD1PQxfa+qln4YDhKYd5ez01ClfF8d+lsZT9hXoHCCupKth/cx2yEdtfS7FH4zZji/4bhcVyocWsVo6lHsfAOvlz5gSVmzZnRYJKuzsQojWTtObopBB2DO3KmUe7VCpYdtT3on5/0Qjze1rxQIaf7qKBv2Em3Xmn+AQbj8OOxssoR1j7Lum1mpEKye8SjooyA5RJBZMFxNKczXQBIb5jOR38UCez148F6iOarqBUONunUXE7JjINjpG0TiX02umtsp7TKcGHQVmiUnShCPnZOYLHsNe9FYMA6a/pfpCm501n7EiSlehS2Laf1Pbqi8dbt7ZZ8S1bjX7jgBrT3J3Wd+P6iRJ/5k6LBlZJZzXOgEdecZ9gvlmMsowZEzlJK4R37W54JGY3q0vccuDWbWM7sqN13Sxy/2kZioCWcCEN2O5CIGplMNkyIeDaQDjMw5wE75YmOnD9p3TtxCz1q6neKrrhHXR4W9UHMhL7kTI4VjUx1glEVQJUKbE6YB8a0SUuqLJysSk4agNcl2Ks5jEx3XL6s1gvEVMD5dhv2EU4bq/BlIqifeK8CmlCbpUoFE27dpQp/RJo9xuCAo9y69cfPkbUk= 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:(13230040)(376014)(52116014)(7416014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6x3pci9TbOdvkU8LqY9QkeRY6nhAmZJUBFTmkwfzygC8+zy1921d+ebJU4d4VQbYTnAaJRPmcA6y39AF5Gqs6iX5xrF5qzF+PwoIhL6sIn/rBHEC/Urq8qqZ4BMHiosTaNIAlkDrQXKa7MprH8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rQtOFp59cQ/b5uorMp06gKLwQa6hQv0u5fjqkNHKqY5VyiUaIRzLzdz9swGgPutEujRpyNbjRihBY0TvME1ll2EH47P5INMyQUZYyZeBGDdkEDiKPfZefPDR8nej2I0WnSPxzK2iPgyzwJG9EStpTU/pOR38bRPx1MVbbaOP5xCQ/KqRx07x/DIkBNK22gjPU4H2ApUkjuU66Ink/6qeCJfrXn1xVg/nNzzgJTVFOwUtsn1NA6HdgFLyZzrL6REzTWSedp5mTwuyEaT++xlt5afQijeZcvDLq9gLdEGdq/+u07jHlfr+rN2pn34MkYclmRLkE7ojsqEjGh1fnUF4nCvDX8t/aGjDEa0DUOLzz X-OriginatorOrg: wesion.com X-MS-Exchange-CrossTenant-Network-Message-Id: c93f608b-9231-492b-306e-08dcb127ae3d X-MS-Exchange-CrossTenant-AuthSource: TYZPR03MB7001.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 06:11:56.6533 (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: l8A/M1K6JtLWhIZ2ymMDLQHmWMbtXXyAft9VekNQW5zCc+c9Ans2dVePgJujW8cS85SH6imbUGIhEjRRnmWe4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR03MB6580 WiFi modules often require 32kHz clock to function. Add support to enable the clock to PCIe driver and move "brcm,bcm4329-fmac" check to the top of brcmf_of_probe Co-developed-by: Ondrej Jirman Signed-off-by: Ondrej Jirman Signed-off-by: Jacobe Zang --- .../net/wireless/broadcom/brcm80211/brcmfmac/of.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index e406e11481a62..7e0a2ad5c7c8a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "debug.h" @@ -70,12 +71,16 @@ 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; u32 irqf; u32 val; + if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + return; + /* Apple ARM64 platforms have their own idea of board type, passed in * via the device tree. They also have an antenna SKU parameter */ @@ -113,8 +118,13 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, of_node_put(root); } - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + 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); + } else { return; + } err = brcmf_of_get_country_codes(dev, settings); if (err)