From patchwork Thu Dec 26 09:20:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 182450 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp1479761ild; Thu, 26 Dec 2019 01:23:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzw7/IEEK+FS1RzPW5q6NuTF2GPdU9XSvrdbOMzZvegH2QyZM2xWjDh9CPqYehPKq7nKYSD X-Received: by 2002:a9d:7d99:: with SMTP id j25mr37426148otn.226.1577352224708; Thu, 26 Dec 2019 01:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577352224; cv=none; d=google.com; s=arc-20160816; b=RSXNOTk3wiw074PRR4sdAivOgvFs9paJeKxxcIvWUl3ORoiUvXFvJZROrOGLjCmzGf M7Q5neEvNJNkVOLK+3ANYf+1LrLHg1jRtvRjEkRYX60MJC8X3nY3HpfPbWaTa4mWv8T3 11gP6FKxUjNC5s22biNsyu9/To4SQsTr7108wBgFObuZgbCwyavwJ/u4LTujpF5VMCWp wd88r50F6aNRn8cskpcxHXqTRfU1mb3g7PzgguIIIkVT/hwQ4tXjDNe0qzylG/YOsi7r Y2wzahOVja+nLVKX1VBS5ZSaX5t8r4Cz0s/aUJnt4Kqww9LSJnut19FeRRN5zydFjTMh djAQ== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nurk82iIc6Uf6HLv+/kPOhKpFPTwWrEFlF6AYIZHVqQ=; b=OuwMcw39IAyUjdvlIIUI0hz4u7y3sYZoHDtGG6XapIy1lL7fX/I+y9OHvON66UcBW3 jwzIF+g7RehU/tzGBthAHpeAjooWxnLSvftSH/enN447BDjluseASZlXDjwft1A2Eism sNIedFnUVfZj3cS5IVxD40RzBOjIecUJqtM2LoE1kpSej4ElK1qGJ8Ec7I3wDuSz2ba9 8h4z6M2jTdL/THm3DB8So0QkxiJtgwSGMduXB5AeeQWsb4PElM3yuMEI6n03l4pcBIZA 8xBADaYGX5i3C99HW/qHRDf4RIsTh/JZu8e10urfHJJtdwKuOkch04facg/SzkeuGNEW UWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yaL76tM9; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23si11339732otp.109.2019.12.26.01.23.44; Thu, 26 Dec 2019 01:23:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-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=@linaro.org header.s=google header.b=yaL76tM9; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726475AbfLZJXn (ORCPT + 9 others); Thu, 26 Dec 2019 04:23:43 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38535 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbfLZJXn (ORCPT ); Thu, 26 Dec 2019 04:23:43 -0500 Received: by mail-wr1-f67.google.com with SMTP id y17so23226867wrh.5 for ; Thu, 26 Dec 2019 01:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nurk82iIc6Uf6HLv+/kPOhKpFPTwWrEFlF6AYIZHVqQ=; b=yaL76tM97lic3wdIDVCfNrWmp9mP3+VXnpugn3RPs9cJU6TgGpTXrk2k169775DirQ lPs8k2lXxh20ln+uuLA/EHoWolzciSKLjB595cEBfTYj1ZbwQODqy37Mc/jE76VXOkLt SMOrl5nKOUJD52cuyYnJenoti4KCrOI6zlpFaUMTP28sgHZ+Tl2e8U39zjurT32GR2uI hN4gwERSVxbTLw/M3JbNesQdjT4OhIu0The4KQCgYJ8K6p6wbZm8l44UXVAqaaT1WHqB AldN+Gy4/6uka86en1+TPE0Abp0iA5njxagyYatdSjmik382b9o3kMVAGEQqIJ4rO4Qc 67dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nurk82iIc6Uf6HLv+/kPOhKpFPTwWrEFlF6AYIZHVqQ=; b=oXmuKfP613HM2g3BsSj+j9naE+MVkulfP+t3kUw1KgsGfxJvqBXeXMuV//qyN74Ss0 8/BG3BZjc/2B4GvR4AKp5UnKEMjvca61sv5Ry/PYKjgR4LyGhPCzU6Dbl0tKtcDRbLZA ace0enaEkBJdh7R4oUSCo5U+ifwLR9f4GkIof07INlqGPZRYF2iHPhxioUKGxiG2T1Al lojVa9CZ13LJAvJolDaM69RPiTTvX3ttais4p5XQUqrKxi2PubD7572+uT9IX3Ji3XTG 4xFO59Q7wGrk+qyM961OPoKxSHVuJbBHAqdhDWVbGwL9T5S1GFvHDJY8xupoDWyxRUbY dFig== X-Gm-Message-State: APjAAAX+hBjSfRnIGg1AnTiWHG9HZPHBysjY0Ht4YKBZWOkuNwgGY4bG ZYtA/OKo3SGfBvwF79Mohjuz7Q== X-Received: by 2002:adf:fe0e:: with SMTP id n14mr43938820wrr.116.1577352221254; Thu, 26 Dec 2019 01:23:41 -0800 (PST) Received: from lophozonia.localdomain (68.120.91.91.rev.sfr.net. [91.91.120.68]) by smtp.gmail.com with ESMTPSA id d14sm31930037wru.9.2019.12.26.01.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 01:23:40 -0800 (PST) From: Jean-Philippe Brucker To: linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, arend.vanspriel@broadcom.com, hdegoede@redhat.com Cc: franky.lin@broadcom.com, hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com, wright.feng@cypress.com, kvalo@codeaurora.org, davem@davemloft.net Subject: [PATCH] brcmfmac: sdio: Fix OOB interrupt initialization on brcm43362 Date: Thu, 26 Dec 2019 10:20:33 +0100 Message-Id: <20191226092033.12600-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling brcmf_bus_started()") changed the initialization order of the brcmfmac SDIO driver. Unfortunately since brcmf_sdiod_intr_register() is now called before the sdiodev->bus_if initialization, it reads the wrong chip ID and fails to initialize the GPIO on brcm43362. Thus the chip cannot send interrupts and fails to probe: [ 12.517023] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout [ 12.531214] ieee80211 phy0: brcmf_bus_started: failed: -110 [ 12.536976] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-110 [ 12.566467] brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed Initialize the bus interface earlier to ensure that brcmf_sdiod_intr_register() properly sets up the OOB interrupt. BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908438 Fixes: 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling brcmf_bus_started()") Signed-off-by: Jean-Philippe Brucker --- A workaround [1] disabling the OOB interrupt is being discussed. It works for me, but this patch fixes the wifi problem on my cubietruck. [1] https://lore.kernel.org/linux-arm-kernel/20180930150927.12076-1-hdegoede@redhat.com/ --- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.24.0 Reviewed-by: Arend van Spriel diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 264ad63232f8..058069a03693 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4220,38 +4220,38 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, brcmf_sdio_sr_init(bus); } else { /* Restore previous clock setting */ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err); } if (err == 0) { + /* Assign bus interface call back */ + sdiod->bus_if->dev = sdiod->dev; + sdiod->bus_if->ops = &brcmf_sdio_bus_ops; + sdiod->bus_if->chip = bus->ci->chip; + sdiod->bus_if->chiprev = bus->ci->chiprev; + /* Allow full data communication using DPC from now on. */ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); err = brcmf_sdiod_intr_register(sdiod); if (err != 0) brcmf_err("intr register failed:%d\n", err); } /* If we didn't come up, turn off backplane clock */ if (err != 0) { brcmf_sdio_clkctl(bus, CLK_NONE, false); goto checkdied; } sdio_release_host(sdiod->func1); - /* Assign bus interface call back */ - sdiod->bus_if->dev = sdiod->dev; - sdiod->bus_if->ops = &brcmf_sdio_bus_ops; - sdiod->bus_if->chip = bus->ci->chip; - sdiod->bus_if->chiprev = bus->ci->chiprev; - err = brcmf_alloc(sdiod->dev, sdiod->settings); if (err) { brcmf_err("brcmf_alloc failed\n"); goto claim; } /* Attach to the common layer, reserve hdr space */ err = brcmf_attach(sdiod->dev);