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: 13748094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8564EC3DA7F for ; Wed, 31 Jul 2024 06:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gbTNxIyb8AzGTytgSL00qPb+axmFVuOizpCG1yaaabk=; b=Y6GLZ5hTDRCrUM 7RJeJXZAUY2iV2Blq9TzNESPlc8bjY/O196mBjdS5ULEBHVT8uctmUUQhAMGxdgWgfkmtVXuo5rDx stl2hFwLOX0DgSwI8HlS2X+mAqY33IEDpH1cRwH80Uw26jBq4o32Ai0AqLDTSM34h6SbrKlN3Erfq RvzF/LumcdXPTkq9VMSxdTwnUe8hb0hl9uXl9YJ6nesOx6WQP7upgYLDyhBOkznMnrHF3tmPyFWoN d+vgmF4gUFSHGCq/OO4PqoBW47GaK5M8mKnfbEVFrMimYuuEjkBJh8pTJnHG0onotCXkgpFc+iniM IOJU5C0ovEC6AZr4bkHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ2bD-0000000HTxV-2bj9; Wed, 31 Jul 2024 06:14:11 +0000 Received: from mail-tyzapc01on20700.outbound.protection.outlook.com ([2a01:111:f403:2011::700] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ2Z9-0000000HTBU-0u9v; Wed, 31 Jul 2024 06:12:04 +0000 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) 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+ebJU4d4VQ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4apzwSBy6gg1xB5WaIdBgJfzfOmketNUB/wXxQ21SOWIgW/Gh9LUBG22qlbe3edVntwLhwoEO3UMftPCZll5iEzZHRrQtOFp59cQ/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_231203_282517_1D615CE5 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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)