From patchwork Fri Jul 21 16:20:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafal X-Patchwork-Id: 9857265 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 638F7601C0 for ; Fri, 21 Jul 2017 16:21:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 504092871C for ; Fri, 21 Jul 2017 16:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 455D12872B; Fri, 21 Jul 2017 16:21:27 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 6DE5728765 for ; Fri, 21 Jul 2017 16:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754155AbdGUQUh (ORCPT ); Fri, 21 Jul 2017 12:20:37 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35604 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754062AbdGUQUg (ORCPT ); Fri, 21 Jul 2017 12:20:36 -0400 Received: by mail-wr0-f193.google.com with SMTP id c24so9081326wra.2 for ; Fri, 21 Jul 2017 09:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:subject:message-id:user-agent:mime-version; bh=QSSm9y+u1ApiWH+DYP41o5FV2exUlTdta5BIHzQ9ULE=; b=SBYGcHskE5TCCTMzgLGGzSirUnWcECsXgyGPn71YnE9RV1vtmPcbKgjxDqcEIXrQtO flulil5eoiZeW8xb6XQOwJlcPEDNsGUNrYNUmAznx1BMCWmWDqeNO9OU3Ft8cdO4H756 mctrBta+8ZOU5b2iP24BvLGdpPIuJSddKSKqbLZQxF6Di04nwBq9+nDXIWZ0scnO0zOK SiE+T/75ZZW2IvDjjOo3iHYdcujK7J+WkMMjRr81JMHXkJZlXnGY9ovyPoO5dHAEsoxi YTjq4tTiMbDB5y3biorjkKWyrWrQhmey40AIfcS4n3rtHJS8MafhNvjS1+XqwOGhIClR S2KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=QSSm9y+u1ApiWH+DYP41o5FV2exUlTdta5BIHzQ9ULE=; b=NdPmCA7qG7sgnu3SzfjO0TCbuBhzim01wTiREp8ZLRuYqFSpq8QUO6SWttlBvTFiqf UfX4THNhN4p4Nyvjwnzqz0ozC/usV3bLtAVAFCVK8hI4/nxa9QyeXKfVA44zxlcYqF+H Rmuy7j+6oV5LFVUSGSyY0fR8kyOpbehODF6ivJJdcNIbAN6llrVFae/wOEuHl0Eb9zpo zeoz908OyA5qaZwQj307qxyt5O64h4CmTtUTmYarHoaK6sV9iTnzpd13UvvpyVYj3y71 2PKocvtKvOpcCOjGoq8YwDH3wY7V9qCqkvRw4LLYuXKOYXd3VvxwV55eiG1PjwsAHYw1 UCkg== X-Gm-Message-State: AIVw112dWAA/gj6Fg7c2bOXRyJWYmMtfyrcHSk+EOHmLlAn5mdVwhekH SKGJsvyAD6lYNCM9 X-Received: by 10.223.161.195 with SMTP id v3mr2184224wrv.125.1500654034836; Fri, 21 Jul 2017 09:20:34 -0700 (PDT) Received: from [192.168.1.5] (ip-31-0-122-76.multi.internet.cyfrowypolsat.pl. [31.0.122.76]) by smtp.gmail.com with ESMTPSA id 34sm6803274wrt.36.2017.07.21.09.20.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jul 2017 09:20:34 -0700 (PDT) From: Rafal X-Google-Original-From: Rafal Date: Fri, 21 Jul 2017 18:20:29 +0200 (CEST) To: linux-wireless@vger.kernel.org Subject: brcmfmac: 43430, additional delay after core out of reset Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 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 Again, ap6212 device on board. When the module gets unloaded and then loaded again, sometimes the driver fails to bring up the device - it stops with the following errors: [ 125.668000] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 125.676000] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 125.680000] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 125.684000] brcmfmac: brcmf_sdio_dpc: failed backplane access over SDIO, halting operation [ 125.684000] brcmfmac: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -84 [ 125.684000] brcmfmac: brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -84 [ 125.684000] brcmfmac: brcmf_bus_started: failed: -84 I have made some investigations and it looks the problem is caused by too short time between getting CM3 core out of reset and first communication attempt with the device. It looks the device needs about 50ms to boot up. Usually the appropriate delay is introduced by function sdio_enable_func which is called just after activation of the core to enable F2 function on device. Usually the sdio function introduces the needed 50ms delay and everything is OK. But sometimes the function returns immediately. In this case the driver breaks down with the above error. But if the additional delay is added in place of sdio_enable_func, everything is okay. I don't know, how wide is the problem. Maybe it is related only to ap6212. Hence I have provided below a patch proposal, which adds delay for 43430 chip rev. 0 only. Rafal diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c index 05f22ff..a913285 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c @@ -1215,6 +1215,14 @@ static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip) core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3); brcmf_chip_resetcore(core, 0, 0, 0); + if( chip->pub.chip == BRCM_CC_43430_CHIP_ID && chip->pub.chiprev == 0 ) { + /* ap6212: fix occasional I/O timeout occuring after this reset. + * Usually appropriate delay (~50ms) provides sdio_enable_func() + * invoked after reset to enable F2. But sometimes (after rmmod + * followed by insmod) the enable function returns immediately. + */ + usleep_range(40000, 60000); + } return true; }