From patchwork Mon May 22 21:39:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Franky Lin X-Patchwork-Id: 9741445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8FE2F601C2 for ; Mon, 22 May 2017 21:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FFC62873F for ; Mon, 22 May 2017 21:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70AD128764; Mon, 22 May 2017 21:40:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D531C2873F for ; Mon, 22 May 2017 21:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hfZIpbFxyEKMPaCG+mcMzuokQfpSCfaEssDQLayFSq4=; b=rRkiZMgSHKb5V3 j6ZfZyUlsCdT5QPnqJTP5Jf1HsYUiXJMOhWTytUwv9beb4T/6vj5eqYwim0hv/s/n6NR3CbpxwI3X fAz/0caod6UY2ouWsqMyXFcTvrorIuvJnLoFrZSMzeSoZvtclS9gJeX8R5/eEsJUYEt2rty8ln3qB ZjCFHljUabJPlIembfla10sqywqfFLjX+pT12CeD603GmzITYYAP8r/R95JJxLFv5mI4D/UadL5RK gKBhnqs2wGzG99uJFMKuFQvIWrpjJ7QSGmbPPsBBpZuvP8t8kA2zzRZMIXMomdsojkTu2VYl/Ey3l kIwuY8z2sUXV/FuvPgOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dCv3W-0005jq-Oh; Mon, 22 May 2017 21:39:59 +0000 Received: from mail-yb0-x230.google.com ([2607:f8b0:4002:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dCv3S-0005bx-O2 for linux-amlogic@lists.infradead.org; Mon, 22 May 2017 21:39:57 +0000 Received: by mail-yb0-x230.google.com with SMTP id p143so33686933yba.2 for ; Mon, 22 May 2017 14:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hzwVQ9sIkFUKY9G6IOZlJg4dRko8OFwcFWj9cgywXxY=; b=U7O5OxnZRhySZ5cvfVYiel0g6cw9UpIQqUgtEnbxe2+U2PE4103s/mAIKp08sHDZIL Yna/KiYkHJlLpYxc/V54fttUFdenmYUOwcbSaVHQkbjJu7TpXCLNud/1kZF63NGdWyOT COqANjwEUmvWQodDR5Nk+VGUIUDP3PDZ1JsaE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hzwVQ9sIkFUKY9G6IOZlJg4dRko8OFwcFWj9cgywXxY=; b=BswVdecsITAiQgzARl1EXeZmhgC+bpIOL2g5YleLFXz6g5HEIE03uMsqHTDZefhY6f q+GiRQchOFN5M+wFjdTc6DzIg+1aIVkAqe56y02gS6BnOsK53QPFhs30CjtEewxgwulC AzqTlTblKwFGOaPsnUO5a6s6JMMOJEMaLLSBH3OI6Bp3c34ad3yQlUTwBf3VkZpiQx92 r/2XdaBvvdJj2nJxAZHy9aUeJTcyS5tBEGolRBXbJlUsOktieMILLdJxSMLeY4XXAIWJ Lfr0NTOuGm4tQk/3n1KSr+2s1Rq/zwdR4x+RgDp3ZBgPrGGXDPBGnLjUJOTtSC16yu9J 9gUw== X-Gm-Message-State: AODbwcDmTnA8P5Em/xde1OhH33NMj8F/1cmDTQrpxdMrcnmm1klPWANC hCTsKmVs6fyAiF8/bcopZEIhOuXsp+Xy X-Received: by 10.37.194.66 with SMTP id s63mr19382845ybf.119.1495489173519; Mon, 22 May 2017 14:39:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.231.69 with HTTP; Mon, 22 May 2017 14:39:13 -0700 (PDT) In-Reply-To: References: From: Franky Lin Date: Mon, 22 May 2017 14:39:13 -0700 Message-ID: Subject: Re: brcmfmac firmware issue on NanoPi K2 To: =?UTF-8?Q?Andreas_F=C3=A4rber?= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170522_143955_011103_D6A5DA5C X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arend Van Spriel , netdev@vger.kernel.org, technicalsupport , linux-wireless@vger.kernel.org, "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" , linux-amlogic Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Andreas, On Sun, May 21, 2017 at 9:20 AM, Andreas Färber wrote: > Hello, > > The NanoPi K2 has an Ampak AP6212 SDIO module. brcmfmac driver loads > brcmfmac43430-sdio.bin. > > When using the firmware file from linux-firmware.git that openSUSE ships > I get the following errors on 4.11.0 and next-20170519: > > [ 2103.618716] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): > clkctl 0x50 > [ 2104.668746] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): > clkctl 0x50 > [ 2105.678677] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): > clkctl 0x50 > > If I overwrite /lib/firmware/brcm/bcm43430-sdio.bin with > fw_bcm43438a0.bin from FriendlyARM's Android repository it suddenly works: > > [ +0.157738] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: > Jun 6 2014 14:50:39 version 7.10.226.49 (r) FWID 01-8962686a > [ +0.160108] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code > (0x30 0x30) > > I recall using the linux-firmware.git brcmfmac43430-sdio.bin file > successfully on the Raspberry Pi 3 with a downstream (Leap 42.2) kernel. > > I've tested both nvram_ap6212.txt and nvram_ap6212a.txt, the latter has > the following diff to nvram.txt: > > --- nvram_ap6212.txt 2017-05-21 04:24:40.372113426 +0200 > +++ nvram_ap6212a.txt 2017-05-21 04:24:49.852116599 +0200 > @@ -1,4 +1,4 @@ > -#AP6212_NVRAM_V1.0_20140603 > +#AP6212_NVRAM_V1.0.1_20160606 > # 2.4 GHz, 20 MHz BW mode > > # The following parameter values are just placeholders, need to be updated. > @@ -51,4 +51,4 @@ > muxenab=0x10 > # CLDO PWM voltage settings - 0x4 - 1.1 volt > #cldo_pwm=0x4 > - > +glitch_based_crsmin=1 > > https://github.com/friendlyarm/android_hardware_amlogic_wifi/tree/l-amlogic-gx-sync/bcm_ampak/config/6212 > > * Does the linux-firmware.git brcmfmac43430-sdio.bin need a fix for AP6212? > https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/brcm > > * Does the brcmfmac driver need to distinguish revisions in sdio.c as > done for 43241, plus a separate firmware file? > BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430), It seems we are dealing with different revisions of 43430. The firmware file you pointed to is for 43430a0 and raspberry pi 3 is using 43430a1. So yes brcmfmac needs to load different firmware and nvram for them just like 43241. Could you please help try the attached patch? I don't have the hardware to test it. Please rename the 43438 firmware and nvram to brcmfmac43430a0-sdio.bin/txt. Thanks, Franky --- BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt"); BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt"); @@ -626,7 +627,8 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), + BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index a999f95..1b12ccb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -608,6 +608,7 @@ BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac43430a0-sdio.bin", "brcmfmac43430a0-sdio.txt"); BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");