Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4214123ybi; Tue, 11 Jun 2019 02:56:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzolQsVDaCEVx68dqlH7nNoJyd3h666+TUnu+NvUV4vi8CFJcoezvzO1X5FoOgy07Dx9f9R X-Received: by 2002:a17:90a:2224:: with SMTP id c33mr25966082pje.22.1560246977318; Tue, 11 Jun 2019 02:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560246977; cv=none; d=google.com; s=arc-20160816; b=r7hloxBGEJsD1lNqERAODzzOz/cemGEcRlgUKdDCeakaUqEl5SApz+lZwZE9m4his6 0SHFi2f1Cd6IiTZB9O75fgkVgKGlz6AL/pBF5jvWejv8K43ZOkKi4z0RjdveyY/XIW7n 9A/ggir410+te9Nmbh6PPRGIe4dG3/jvmMjllX1+VvlF2SpHOLRJORAPIeTsuv532Rb6 cY+XCaZBII1+9M33yPuFigYTYXQuQJe6mgROK0n+pkpAUhN/0Fvyg69gdoB3LuVCrfT5 k5uYEKDxiiRUMB3PZgF4k4ICD+HullsBGF4ZEi3im4q/0aWtCFL/RiPmihwLNSzcvbmH pxng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=mkdlossu9lkxS+7fRGCsNjYHJ659d4NTmh7T043IVrg=; b=Ky0mvkZ970Hcrd8LQbeRG0+BO1Y4B0LZ2VrbFRI1Q5f5id8Gcgn8HpG7wPwJoq6/aQ /hLBYcLKJzE2VASdSRNwl2BCafPN5/5shTSHx0VNGb662ZeMwYgr8+S8A4FSK4vgM5Vq IVguRUqplJkWMNSq9pqlgmV3gLsxghwWWrfNhAwWLaf8SclumZZie3ar6RSR/IWmtsdr gF0mMuqLKiKG07jChfMwyT9TS/srmDV7OQaRG+Va8iK5v4weZbxg1s5CJve5T+z+wS2N WMtalVN+V7zip8VIcurlNz21nzCkb9J+BhMHWXk/eu+5ME/0f69O4O1b0ShHAqTYzAFT Snqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IdiVrQEX; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si4497054plq.140.2019.06.11.02.56.02; Tue, 11 Jun 2019 02:56:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IdiVrQEX; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404403AbfFKJp7 (ORCPT + 99 others); Tue, 11 Jun 2019 05:45:59 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:46225 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727642AbfFKJp7 (ORCPT ); Tue, 11 Jun 2019 05:45:59 -0400 Received: by mail-ed1-f65.google.com with SMTP id h10so19020160edi.13 for ; Tue, 11 Jun 2019 02:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mkdlossu9lkxS+7fRGCsNjYHJ659d4NTmh7T043IVrg=; b=IdiVrQEX32WX90t0/HexUB9Ksn3VMNyrEqRXZQLgqmM7A67yWGY9W8PUxleDbCUPkQ Nvufs45TxmtzGRApQzZBtuIwBIJAwyocydORqnwwDoKMtgIUDbciKT1d2p/qz71PlS72 Y9HwIrOByPAzWjgYKggtBaJcNkdY7DJlTzc0Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mkdlossu9lkxS+7fRGCsNjYHJ659d4NTmh7T043IVrg=; b=JFiDy4mg3ZmMHgCKlR3hU12j4vHr1NHCcgwT7RX/BTYsD/MiMyardF/lqVuCOGPnyx 8x4+UmljUskyoNxLPAwIb9BCm98wWHXOkEU8NNpnab+gpa2VQMcP71xuWWGc/98D4DTS faPt0PMZtjIgY564bXhKkjmIi/HyVLcyu2St6uRs7iDfepd7hOiIx7wMd1HxqPKJIE4+ 3HDcyXSUO9iNhvq3kREWgfAy1KIJXrzSpLavASfxE6rDxwv9YTDRueNUR0Hw3xVIh5kS 4FyyiGgxa3T/9sJMYwE/deZrf4oDYrwHoU3rYmXe13WpsbJwFiPnU2dKqpb4nt1Wykjp u1uQ== X-Gm-Message-State: APjAAAUru1nZjCKsS5/9V6Sl7TAMECmcz7SVkEdk9Lu6dVSodiU0Jx1k XO8QrcapTtenYRQy+3hIWvdn9DOcc+MSgQ== X-Received: by 2002:a50:b839:: with SMTP id j54mr47167857ede.155.1560246357864; Tue, 11 Jun 2019 02:45:57 -0700 (PDT) Received: from [10.176.68.125] ([192.19.248.250]) by smtp.gmail.com with ESMTPSA id j3sm3558235edh.82.2019.06.11.02.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 02:45:57 -0700 (PDT) Subject: Re: [RESEND] brcmfmac support for BCM4359 sdio on arm64 ?? To: Christian Hewitt Cc: linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, Wright.Feng@cypress.com, Neil Armstrong , Christoph Muellner References: From: Arend Van Spriel Message-ID: <37d2964d-1c2b-51bd-ac98-2cc171aa0c9c@broadcom.com> Date: Tue, 11 Jun 2019 11:45:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 6/8/2019 5:39 AM, Christian Hewitt wrote: > Hello Arend, > > Last October Christoph Müllner reported BCM4359 SDIO issues here: https://www.spinics.net/lists/linux-wireless/msg178783.html but the investigation stalled after the needs/timescale of his project forced a change to a different (working) module. > > BCM4359 is being used in an increasing number of Amlogic devices the Kodi focussed distro LibreELEC supports. I’m one of the maintainers for the distro and I’d like to assist/resume the investigation. > > To recap: using changes from Wright Feng that can be found here https://github.com/RobertCNelson/ti-linux-kernel-dev/blob/65f17112e1c883d3c9f3fa68837e5f9b5eb7cfad/patches/cypress/v4.14.52-2018_0928/cypress-patch/0050-brcmfmac-Add-support-for-BCM4359-SDIO-chipset.patch result in the BCM4359 device being identified but firmware/nvram loading fails: > > [ 8.557929] brcmfmac: F1 signature read @0x18000000=0x17294359 > [ 8.562087] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9 > [ 8.775655] brcmfmac: brcmf_sdiod_ramrw: membytes transfer failed > [ 8.775667] brcmfmac: brcmf_sdio_verifymemory: error -84 on reading 2048 membytes at 0x0025f0c0 > [ 8.775670] brcmfmac: brcmf_sdio_download_firmware: dongle nvram file download failed It seems to fail when reading back the nvram file to assure it was downloaded properly. > See: http://ix.io/1KfY for the full dmesg output on 5.1-rc1 kernel including a splat that may or may not be related/relevant. I am using firmware and nvram files from https://github.com/LibreELEC/brcmfmac_sdio-firmware which match files found in several other github and public repo locations. The firmware/nvram are reported working in Android. The splat could be relevant. Maybe try the patch below to get actual values that are checked in the WARN_ON. > BCMDHD is also reported working with commits here: https://gitlab.com/baylibre/amlogic/atv/linux/commits/narmstrong/v5.1/aml/integ-5.1-bcmdhd but LibreELEC needs to support many different boards (with many different SDIO modules) from a single OS image, so BCMDHD is not the solution we need. > > One additional patch I spotted mentioning BCM4359 (also from Wright Feng) was https://github.com/RobertCNelson/ti-linux-kernel-dev/blob/65f17112e1c883d3c9f3fa68837e5f9b5eb7cfad/patches/cypress/v4.14.52-2018_0928/cypress-patch/0073-non-upstream-reset-two-D11-cores-if-chip-has-two-D11.patch but it makes no difference (the dmesg log above is with this patch applied). > > I don’t write code but am happy to build test kernels with suggested patches or explicit instructions. I’ve also CC’d LibreELEC colleague and linux-amlogic maintainer Neil Armstrong who can assist. NB: If direct access to hardware would help progress things I can easily organise remote access or get board samples shipped. > > How can we resume the investigation? Let's try one step at a time ;-) Regards, Arend --- diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/driver index fc12598..e9b0986 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -772,7 +772,8 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiod sdiodev->settings->bus.sdio.txglomsz); nents += (nents >> 4) + 1; - WARN_ON(nents > sdiodev->max_segment_count); + WARN(nents > sdiodev->max_segment_count, "max_seg_cnt=%u, host_max_seg= + sdiodev->max_segment_count, host->max_segs, nents); brcmf_dbg(TRACE, "nents=%d\n", nents); err = sg_alloc_table(&sdiodev->sgtable, nents, GFP_KERNEL); q