From patchwork Sun Apr 5 16:39:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 6162511 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB75ABF4A6 for ; Sun, 5 Apr 2015 16:39:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2245520429 for ; Sun, 5 Apr 2015 16:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0170220426 for ; Sun, 5 Apr 2015 16:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752392AbbDEQji (ORCPT ); Sun, 5 Apr 2015 12:39:38 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:37268 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbbDEQjg (ORCPT ); Sun, 5 Apr 2015 12:39:36 -0400 Received: by wiaa2 with SMTP id a2so14545718wia.0 for ; Sun, 05 Apr 2015 09:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=BKB49ZTd3gIWWMgzMZbuVzPFddgEQTJAtrg9TjF6gTU=; b=VRUgfg7d+uZtatNkarez3i8/U2lpzMbZu/cRNt83/MvzZOTeKLl2qqjOcD8sABwLmX PQiYC7qxMeIZ7em3I2TP3KPuaBbVgrLYnHlp2ku8Wz9fyeMukuD76Dd99edXhADviPo4 RRFQKi2UEQ1I1Jib/1IrfTT6jMuwjnRSz0eImAj6ciOaqqXPQlwMed5e7YY2ebQQW7sS nDzi1RMA5r1x6+FQK2encXFB5F1fsfD48K53ECyJL5bw73v/9/v+3mOmiCvImSm/SA0C 3olmPskx+NZiobbAeVlDIXUrymg6YBKjwbUkRlqT9piiP554A0rxE/KPna9298nswEk4 /QLA== X-Received: by 10.181.28.170 with SMTP id jp10mr23370892wid.25.1428251974967; Sun, 05 Apr 2015 09:39:34 -0700 (PDT) Received: from linux-tdhb.lan (aegl113.neoplus.adsl.tpnet.pl. [79.186.167.113]) by mx.google.com with ESMTPSA id w3sm3024250wiz.5.2015.04.05.09.39.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Apr 2015 09:39:34 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo , linux-wireless@vger.kernel.org Cc: Hauke Mehrtens , Felix Fietkau , =?UTF-8?q?Michael=20B=C3=BCsch?= , Larry Finger , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] ssb: add delay after PCI reset to fix SoC reboots Date: Sun, 5 Apr 2015 18:39:27 +0200 Message-Id: <1428251967-18066-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Rafa? Mi?ecki --- Kalle: this bug is there since ever, I guess this patch can be queued for next. --- drivers/ssb/driver_pcicore.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index d75b72b..15a7ee3 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c @@ -357,6 +357,15 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc) pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA); + /* + * Accessing PCI config without a proper delay after devices reset (not + * GPIO reset) was causing reboots on WRT300N v1.0. + * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it + * completely. Flushing all writes was also tested but with no luck. + */ + if (pc->dev->bus->chip_id == 0x4704) + usleep_range(1000, 2000); + /* Enable PCI bridge BAR0 prefetch and burst */ val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2);