From patchwork Sun Feb 12 06:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 55880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1798678wrn; Sat, 11 Feb 2023 23:05:31 -0800 (PST) X-Google-Smtp-Source: AK7set+sWjWgaO4tmYXrVhOGB0nBMSeg1zFEt2bCLAqmN8hH84b+KjZuyr3u041PFkvDX6i81X2G X-Received: by 2002:aa7:9695:0:b0:5a8:4c55:db6f with SMTP id f21-20020aa79695000000b005a84c55db6fmr1699773pfk.19.1676185531539; Sat, 11 Feb 2023 23:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676185531; cv=none; d=google.com; s=arc-20160816; b=j7nV7Kbfieh+a3Occ388TqYOmworm5i3Xlo41d9Yg38hHVf5KDUO+ME2qB1djY4wkz A571ez6Cwy8dO02tqj2OjrjJHZp/bpwC12ympVTXryEox96zmHN2Qn2Ibf2v27B4nsuA 9typxXcI1NE2Bk6Fq1u5tsVAugvPv2jUFaqNdYTe2YnCss/AyIlmPEfWaclGwqJ7RD6V 5lQjnQtVwI00CgeVXlQU5dAiDi3fxSk901Qr+OaRUXtIDvOAVfo2dXhZyQHTcoomUbUT UJ1dbK/K3ZDv/v3JcimXm2hLpldQ9juhmTsexTMY5z/q45DRhEHc0BvF21ZV+zzTr24b i3mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tCh1/9wdT4No1hLLJDobzRpnf7Vg/kkkaoLwN8oMaps=; b=KpF1YhYRMdyYM0BwoLOXdMqb+twWDOPJUqdtf1o2pkubB26uhn8Awm/0CBhWXuORPg YIoPBFGMXiwx4UIGfCTvTZT93ZOvOtYKY/7V7Q30D6LAKR8NajFy7o/ZwTMegLMyw0zq T80yFjLi3LhzlHlaikcTMjJzh7Lb6tOIZLtC4nwtFbaQ8fLgep6YFbzmO6u4ZSoqRGeY umHy+a8bx5QPGaikm4f07pOUcW06+dc/0LZ6LIjU8G9l7K9Dj14bE9XNfBGdHVEVHhPs CPs9fLBd4cN6wuZ3JeuK4g5zeKonyT16X5DqxcEJrDVOAPB1lchX+IuTkGEBN+6e7yBm S+UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=m8JAL+q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v187-20020a6261c4000000b0058a245284adsi8329760pfb.301.2023.02.11.23.05.11; Sat, 11 Feb 2023 23:05:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=m8JAL+q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbjBLGjX (ORCPT + 99 others); Sun, 12 Feb 2023 01:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjBLGjW (ORCPT ); Sun, 12 Feb 2023 01:39:22 -0500 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04EFC14EBD; Sat, 11 Feb 2023 22:39:06 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 66B064264E; Sun, 12 Feb 2023 06:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1676183945; bh=BGt8G715pGoRlOQmF5GajgsoJaqKzjZwM8/OXbCFUiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m8JAL+q4gXGYDcpbK4+BMpxKomgLSvRGqXdW7yqpqQZT1ZJx3hbqs8gICxJibgItm sQlWZXM13zJWMgp3QyUdYmXkVw/64i1MCmYci90wSXl9cenTnSVSIB1EdrZzVpF901 37quIBlROk+A+dgi7wC5ZpyFXgyHagGlG2XC+FeUptkuX2oAlxtWo60CieYhSXcwo1 owkT6R5WRYL6JIcYS6ZZMfrHBZGZzI+NREhoMGrD4TVh3KGUmPQHXuuIPjv+EAH98n 5yYG0Ayvt1CqsHnYnfZlv4CkeJk5F/dXfqlxGI85Y8Z5wusEApLS/1ZWBjjjlrswgK 2eiuCDDt56aJA== From: Hector Martin To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Prutskov , Ian Lin , Joseph chuang , Sven Peter , Alyssa Rosenzweig , Aditya Garg , Jonas Gorski , asahi@lists.linux.dev, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Linus Walleij , Arend van Spriel Subject: [PATCH v4 4/4] brcmfmac: pcie: Perform correct BCM4364 firmware selection Date: Sun, 12 Feb 2023 15:38:13 +0900 Message-Id: <20230212063813.27622-5-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230212063813.27622-1-marcan@marcan.st> References: <20230212063813.27622-1-marcan@marcan.st> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757607920259649822?= X-GMAIL-MSGID: =?utf-8?q?1757607920259649822?= This chip exists in two revisions (B2=r3 and B3=r4) on different platforms, and was added without regard to doing proper firmware selection or differentiating between them. Fix this to have proper per-revision firmwares and support Apple NVRAM selection. Revision B2 is present on at least these Apple T2 Macs: kauai: MacBook Pro 15" (Touch/2018-2019) maui: MacBook Pro 13" (Touch/2018-2019) lanai: Mac mini (Late 2018) ekans: iMac Pro 27" (5K, Late 2017) And these non-T2 Macs: nihau: iMac 27" (5K, 2019) Revision B3 is present on at least these Apple T2 Macs: bali: MacBook Pro 16" (2019) trinidad: MacBook Pro 13" (2020, 4 TB3) borneo: MacBook Pro 16" (2019, 5600M) kahana: Mac Pro (2019) kahana: Mac Pro (2019, Rack) hanauma: iMac 27" (5K, 2020) kure: iMac 27" (5K, 2020, 5700/XT) Also fix the firmware interface for 4364, from BCA to WCC. Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2") Reviewed-by: Linus Walleij Reviewed-by: Arend van Spriel Signed-off-by: Hector Martin Reviewed-by: Eric Curtin --- .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index d54394885af7..f320b6ce8bff 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -57,7 +57,8 @@ BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-pcie"); BRCMF_FW_CLM_DEF(43570, "brcmfmac43570-pcie"); BRCMF_FW_DEF(4358, "brcmfmac4358-pcie"); BRCMF_FW_DEF(4359, "brcmfmac4359-pcie"); -BRCMF_FW_DEF(4364, "brcmfmac4364-pcie"); +BRCMF_FW_CLM_DEF(4364B2, "brcmfmac4364b2-pcie"); +BRCMF_FW_CLM_DEF(4364B3, "brcmfmac4364b3-pcie"); BRCMF_FW_DEF(4365B, "brcmfmac4365b-pcie"); BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie"); BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie"); @@ -88,7 +89,8 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { BRCMF_FW_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570), BRCMF_FW_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), - BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0xFFFFFFFF, 4364), + BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0x0000000F, 4364B2), /* 3 */ + BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0xFFFFFFF0, 4364B3), /* 4 */ BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B), BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), @@ -2003,6 +2005,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo) base = 0x8c0; words = 0xb2; break; + case BRCM_CC_4364_CHIP_ID: + coreid = BCMA_CORE_CHIPCOMMON; + base = 0x8c0; + words = 0x1a0; + break; case BRCM_CC_4377_CHIP_ID: case BRCM_CC_4378_CHIP_ID: coreid = BCMA_CORE_GCI; @@ -2611,7 +2618,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = { BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID, WCC), BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID, WCC), BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID, WCC), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID, WCC), BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID, BCA), BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID, BCA), BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID, BCA),