From patchwork Fri Nov 17 12:55:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 10062709 X-Patchwork-Delegate: kvalo@adurom.com 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 77E8160352 for ; Fri, 17 Nov 2017 12:55:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66B0D2AC8A for ; Fri, 17 Nov 2017 12:55:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58F5F2ACAF; Fri, 17 Nov 2017 12:55:08 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E652AC8A for ; Fri, 17 Nov 2017 12:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933013AbdKQMzG (ORCPT ); Fri, 17 Nov 2017 07:55:06 -0500 Received: from mail-qt0-f174.google.com ([209.85.216.174]:43901 "EHLO mail-qt0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933010AbdKQMzE (ORCPT ); Fri, 17 Nov 2017 07:55:04 -0500 Received: by mail-qt0-f174.google.com with SMTP id n61so5648249qte.10 for ; Fri, 17 Nov 2017 04:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=MzhxqDgicL4RgTrwSyU6Yrtp+mwd/gJJyScRt/ULV6A=; b=LCaZXe7KnmUExH62/w4ZLqrgzoMNTkRwNIA8tFeKw/pD8C4so7Iai6I99xH1cjjfLU u3fMbIPvmjHYWWD38JrMIaTGmMl5VJ4hStXd0DOO+beh8J6K4CL4PvBGXsc4wKDxwj9q FAE00eJ6ZBUpvIBcqGaBk1F4lzdr1vT6FCpX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=MzhxqDgicL4RgTrwSyU6Yrtp+mwd/gJJyScRt/ULV6A=; b=E6gdLIq5BXVeFvb75w434DGc952sETGtds878j0iyfdGHkGu/rpbqj7YXAXMGk9l1y KkJU4G9ynRwVt3KjS3qKQRF4Cqn0MaVYmHyDch8n1S84cQicY0VvTv3t/6SJPABEnRmS SycRxLkKPicy2g5pNmfIfVuj06sU3axsTf0HsmjRDOYjrEr+0GvyqKFXUKhIFBDcaJ5n Sb3AaD+NhonhpNjMfVsioYFhasn9q+1OV8CTDIX7CMxpw2WRNfHAnHGiMI29EMqSbx5P eI693id80uzZW94Qx9zzyRmlMJo/Ti+oQF9jAvCy648jta0a7TWEbabtxDP8JDD71ZQI Qcow== X-Gm-Message-State: AJaThX76g5madFU0z7qM+vtE0VrZpByDz+xnYLZb5lczml93+Ip197Bi 5kApgIFe6eE/KJmeRPDEkP+5pg== X-Google-Smtp-Source: AGs4zMa8IooE/YEWLuBgI6KKcqWgDriw8S5YFWLBddyR4uHrnZ74JFaKNnAKApdO0Ttcqv8+7QffOA== X-Received: by 10.55.48.199 with SMTP id w190mr2317365qkw.317.1510923303625; Fri, 17 Nov 2017 04:55:03 -0800 (PST) Received: from [10.176.68.125] ([192.19.248.250]) by smtp.gmail.com with ESMTPSA id m5sm2531550qkh.90.2017.11.17.04.55.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 04:55:03 -0800 (PST) Subject: Re: AP6335 with mainline kernel To: Vanessa Maegima , "van.ayumi@gmail.com" References: <85717463-11e2-e2e3-b08e-b758986687b5@broadcom.com> <1510916848.26896.2.camel@nxp.com> Cc: "linux-wireless@vger.kernel.org" , "embed3d@gmail.com" , "joerg.krause@embedded.rocks" From: Arend van Spriel Message-ID: <5A0EDC25.7030505@broadcom.com> Date: Fri, 17 Nov 2017 13:55:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1510916848.26896.2.camel@nxp.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 11/17/2017 12:08 PM, Vanessa Maegima wrote: > Hi Arend, > > On Sex, 2017-11-10 at 20:58 +0100, Arend van Spriel wrote: >> On 10-11-17 13:43, Vanessa Maegima wrote: >>> >>> Hi, >>> >>> On Qui, 2017-09-21 at 12:30 -0300, Vanessa Ayumi Maegima wrote: >>>> >>>> Hi Arend, >>>> >>>> On Thu, Sep 21, 2017 at 4:26 AM, Arend van Spriel >>>> wrote: >>>>> >>>>> >>>>> On 20-09-17 21:33, Vanessa Ayumi Maegima wrote: >>>>>> >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> I am trying to enable Wifi on imx7d-pico using mainline >>>>>> kernel. >>>>>> imx7d-pico >>>>>> has an AP6335 chip. >>>>>> >>>>>> I am facing some issues related to the nvram file. I am using >>>>>> the >>>>>> firmware >>>>>> provided by Buildroot (brcmfmac4339-sdio.bin). I get the >>>>>> following error: >>>>>> >>>>>> [ 8.630380] brcmfmac: brcmf_sdio_htclk: HT Avail timeout >>>>>> (1000000): >>>>>> clkctl 0x50 >>>>>> >>>>>> I have tried to use the firmware and nvram provided by >>>>>> TechNexion >>>>>> but I >>>>>> get >>>>>> the same error. >>>>>> >>>>>> Is there anyone that could enable Wifi on AP6335 using kernel >>>>>> mainline? >>>>>> What nvram file was used? >>>>>> >>>>>> I am able to use Wifi on the board if I use the firmware, >>>>>> nvram >>>>>> file and >>>>>> kernel >>>>>> provided by TechNexion. They use a 4.1 kernel from NXP with >>>>>> the >>>>>> bcmdhd >>>>>> driver. >>>>>> >>>>>> So I know that the hardware is functional. >>>>>> >>>>>> Any suggestions as how to get it working with a 4.13 and >>>>>> brcmfmac >>>>>> driver >>>>>> is >>>>>> appreciated. >>>>> So the nvram file is specific to the wifi chipset on your >>>>> platform >>>>> so best >>>>> to stick with the provided one. The "HT Avail timeout" most >>>>> often >>>>> is an >>>>> indication that the firmware crashed. So getting more debug >>>>> output >>>>> would >>>>> help us understand how it ended up like that. Can you build the >>>>> brcmfmac >>>>> with CONFIG_BRCMDBG and load the driver using: >>>>> >>>>> $ insmod brcmfmac.ko debug=0x1416 >>>> Thanks for the reply! >>>> >>>> Here is the log (using 4.14-rc1): >>>> >>>> # dmesg | grep brcmfmac >>>> [ 19.297206] brcmfmac: brcmfmac_module_init No platform data >>>> available. >>>> [ 19.307075] brcmfmac: brcmf_sdio_probe Enter >>>> [ 19.308384] brcmfmac: F1 signature read @0x18000000=0x16224335 >>>> [ 19.309026] brcmfmac: brcmf_chip_recognition found AXI chip: >>>> BCM4339, rev=2 >>>> [ 19.317115] brcmfmac: brcmf_chip_cores_check [1 ] core >>>> 0x800:46 >>>> base 0x18000000 wrap 0x18100000 >>>> [ 19.317141] brcmfmac: brcmf_chip_cores_check [2 ] core >>>> 0x812:46 >>>> base 0x18001000 wrap 0x18101000 >>>> [ 19.317165] brcmfmac: brcmf_chip_cores_check [3 ] core >>>> 0x83e:4 >>>> base 0x18002000 wrap 0x18102000 >>>> [ 19.317188] brcmfmac: brcmf_chip_cores_check [4 ] core >>>> 0x83c:4 >>>> base 0x18003000 wrap 0x18103000 >>>> [ 19.317210] brcmfmac: brcmf_chip_cores_check [5 ] core >>>> 0x81a:20 >>>> base 0x18004000 wrap 0x18104000 >>>> [ 19.317233] brcmfmac: brcmf_chip_cores_check [6 ] core >>>> 0x829:21 >>>> base 0x18005000 wrap 0x18105000 >>>> [ 19.317256] brcmfmac: brcmf_chip_cores_check [7 ] core >>>> 0x135:0 >>>> base 0x00000000 wrap 0x18109000 >>>> [ 19.317279] brcmfmac: brcmf_chip_cores_check [8 ] core >>>> 0x240:0 >>>> base 0x00000000 wrap 0x00000000 >>>> [ 19.317298] brcmfmac: brcmf_chip_set_passive Enter >>>> [ 19.322232] brcmfmac: brcmf_chip_get_raminfo RAM: >>>> base=0x180000 >>>> size=786432 (0xc0000) sr=0 (0x0) >>>> [ 19.322457] brcmfmac: brcmf_chip_setup ccrev=46, pmurev=23, >>>> pmucaps=0x39cc5f17 >>>> [ 19.322481] brcmfmac: brcmf_get_module_param Enter, bus=0, >>>> chip=17209, rev=2 >>>> [ 19.322504] brcmfmac: brcmf_sdiod_sgtable_alloc nents=35 >>>> [ 19.322531] brcmfmac: brcmf_sdio_kso_init Enter >>>> [ 19.322618] brcmfmac: brcmf_sdio_drivestrengthinit No SDIO >>>> driver >>>> strength init needed for chip 43 >>>> 39 rev 2 pmurev 23 >>>> [ 19.323235] brcmfmac: brcmf_attach Enter >>>> [ 19.323725] brcmfmac: brcmf_proto_attach Enter >>>> [ 19.323769] brcmfmac: brcmf_fweh_register event handler >>>> registered >>>> for PSM_WATCHDOG >>>> [ 19.324306] brcmfmac: brcmf_sdio_probe completed!! >>>> [ 19.324337] brcmfmac: brcmf_fw_map_chip_to_name: using >>>> brcm/brcmfmac4339-sdio.bin for chip 0x00433 >>>> 9(17209) rev 0x000002 >>>> [ 19.335353] brcmfmac: brcmf_fw_get_firmwares_pcie enter: >>>> dev=mmc0:0001:1 >>>> [ 19.351787] brcmfmac: brcmf_fw_request_code_done enter: >>>> dev=mmc0:0001:1 >>>> [ 19.353202] brcmfmac: brcmf_fw_request_nvram_done enter: >>>> dev=mmc0:0001:1 >>>> [ 19.353424] brcmfmac: brcmf_sdio_firmware_callback Enter: >>>> dev=mmc0:0001:1, err=0 >>>> [ 19.353814] brcmfmac: brcmf_sdio_download_code_file Enter >>>> [ 19.388586] brcmfmac: brcmf_sdio_verifymemory Compare RAM dl & >>>> ul >>>> at 0x00180000; size=493599 >>>> [ 19.546675] brcmfmac: brcmf_sdio_download_nvram Enter >>>> [ 19.547432] brcmfmac: brcmf_sdio_verifymemory Compare RAM dl & >>>> ul >>>> at 0x0023f730; size=2256 >>>> [ 19.548665] brcmfmac: brcmf_chip_set_active Enter >>>> [ 20.562974] brcmfmac: brcmf_sdio_htclk: HT Avail timeout >>>> (1000000): >>>> clkctl 0x50 >>>> [ 20.570490] brcmfmac: brcmf_sdio_firmware_callback failed: >>>> dev=mmc0:0001:1, err=0 >>>> [ 20.570739] brcmfmac: brcmf_sdio_remove Enter >>>> [ 20.570775] brcmfmac: brcmf_detach Enter >>>> [ 20.610414] brcmfmac: brcmf_bus_change_state 0 -> 0 >>>> [ 20.610441] brcmfmac: brcmf_sdio_bus_stop Enter >>>> [ 21.622477] brcmfmac: brcmf_sdio_htclk: HT Avail timeout >>>> (1000000): >>>> clkctl 0x50 >>>> [ 21.630912] brcmfmac: brcmf_proto_detach Enter >>>> [ 21.630967] brcmfmac: brcmf_fweh_unregister event handler >>>> cleared >>>> for PSM_WATCHDOG >>>> [ 22.642457] brcmfmac: brcmf_sdio_htclk: HT Avail timeout >>>> (1000000): >>>> clkctl 0x50 >>>> [ 22.680131] brcmfmac: brcmf_chip_set_passive Enter >>>> [ 22.682580] brcmfmac: brcmf_sdio_remove Disconnected >>>> >>> Any suggestions on this? >> Sorry for not getting back to your earlier email. Thanks for the >> reminder. So you tried different firmwares, right? Can you provide >> output of the following command: >> >> $ strings firmware.bin | tail -1 >> >> for the firmwares you tried. >> >> Regards, >> Arend > > Thanks for the reply! > > Here's the output: > > For Technexion firmware: > > # strings /lib/firmware/brcm/brcmfmac4339-sdio.bin | tail -1 > 4339a0-roml/sdio-ag-pool-p2p-pno-pktfilter-keepalive-aoe-sr-mchan- > proptxstatus-lpc-tdls-autoabn-txbf- > rcc-wepso-okc-ndoe Version: 6.37.32.28 CRC: 3075f12e Date: Thu 2014-04- > 03 12:15:31 CST FWID 01-4ae4ad > 03 > > For linux-firmware and Buildroot firmware: > > # strings /lib/firmware/brcm/brcmfmac4339-sdio.bin | tail -1 > 4339a0-roml/sdio-ag-pool-autoabn-lpc Version: 6.37.34.28 CRC: a696897b > Date: Thu 2014-08-28 18:40:12 > PDT FWID 01-a13120fc > > In both cases, I am using the nvram provided by Technexion. That should be fine. Can you try the patch below. It would give me more info on state of firmware. Regards, Arend &err); + brcmf_err(" max_res_mask = %08x\n", val); + return -EBADE; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/ne index f355612..631c5cb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -828,8 +828,27 @@ static int brcmf_sdio_htclk(struct brcmf_sdio *bus, bool on, return -EBADE; } if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { + struct brcmf_core *pmu = brcmf_chip_get_pmu(bus->ci); + u32 regaddr; + u32 val; + brcmf_err("HT Avail timeout (%d): clkctl 0x%02x\n", PMU_MAX_TRANSITION_DLY, clkctl); + + /* DEBUG INFO */ + regaddr = CORE_CC_REG(pmu->base, pmucontrol); + val = brcmf_sdiod_regrl(bus->sdiodev, regaddr, &err); + brcmf_err(" pmucontrol = %08x\n", val); + regaddr = CORE_CC_REG(pmu->base, pmustatus); + val = brcmf_sdiod_regrl(bus->sdiodev, regaddr, &err); + brcmf_err(" pmustatus = %08x\n", val); + regaddr = CORE_CC_REG(pmu->base, min_res_mask); + val = brcmf_sdiod_regrl(bus->sdiodev, regaddr, &err); + brcmf_err(" min_res_mask = %08x\n", val); + regaddr = CORE_CC_REG(pmu->base, max_res_mask); + val = brcmf_sdiod_regrl(bus->sdiodev, regaddr,