From patchwork Sat Sep 29 18:38:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 1528561 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2E0403FE4F for ; Sat, 29 Sep 2012 18:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757558Ab2I2SiR (ORCPT ); Sat, 29 Sep 2012 14:38:17 -0400 Received: from server19320154104.serverpool.info ([193.201.54.104]:59117 "EHLO hauke-m.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757448Ab2I2SiQ (ORCPT ); Sat, 29 Sep 2012 14:38:16 -0400 Received: from localhost (localhost [127.0.0.1]) by hauke-m.de (Postfix) with ESMTP id 0C2B68880; Sat, 29 Sep 2012 20:38:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hauke-m.de Received: from hauke-m.de ([127.0.0.1]) by localhost (hauke-m.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zwCAD5Es0kTM; Sat, 29 Sep 2012 20:38:13 +0200 (CEST) Received: from hauke.lan (unknown [134.102.133.158]) by hauke-m.de (Postfix) with ESMTPSA id 389E587B9; Sat, 29 Sep 2012 20:38:13 +0200 (CEST) From: Hauke Mehrtens To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, zajec5@gmail.com, Hauke Mehrtens Subject: [PATCH] bcma: use fallback sprom if sprom on card was not valid Date: Sat, 29 Sep 2012 20:38:11 +0200 Message-Id: <1348943891-23352-1-git-send-email-hauke@hauke-m.de> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Sometimes the PCIe card indicates that it has a sprom somewhere and we are able to read the memory region, but it is empty and not valid. In these cases we should try to use the fallback sprom as a last chance. This is the case for the PCIe cards in my ASUS RT-N66U (BCM4706 + 2 times BCM4331) and I have heard of someone having the same problem with an other PCIe card connected to an other Broadcom SoC. Signed-off-by: Hauke Mehrtens --- drivers/bcma/sprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index 0d546b6..4adf9ef9 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -595,8 +595,11 @@ int bcma_sprom_get(struct bcma_bus *bus) bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); err = bcma_sprom_valid(sprom); - if (err) + if (err) { + bcma_warn(bus, "invalid sprom read from the PCIe card, try to use fallback sprom\n"); + err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); goto out; + } bcma_sprom_extract_r8(bus, sprom);