From patchwork Mon Jul 1 09:22:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shen, Jackey" X-Patchwork-Id: 2806591 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BF5FBF4A1 for ; Mon, 1 Jul 2013 09:25:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4752720166 for ; Mon, 1 Jul 2013 09:25:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D35AE20165 for ; Mon, 1 Jul 2013 09:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186Ab3GAJZE (ORCPT ); Mon, 1 Jul 2013 05:25:04 -0400 Received: from co9ehsobe005.messaging.microsoft.com ([207.46.163.28]:42592 "EHLO co9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752974Ab3GAJZD (ORCPT ); Mon, 1 Jul 2013 05:25:03 -0400 Received: from mail134-co9-R.bigfish.com (10.236.132.250) by CO9EHSOBE021.bigfish.com (10.236.130.84) with Microsoft SMTP Server id 14.1.225.23; Mon, 1 Jul 2013 09:25:02 +0000 Received: from mail134-co9 (localhost [127.0.0.1]) by mail134-co9-R.bigfish.com (Postfix) with ESMTP id 57372480745 for ; Mon, 1 Jul 2013 09:25:02 +0000 (UTC) X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPV:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VPS0(zzzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh1e23h1155h) Received: from mail134-co9 (localhost.localdomain [127.0.0.1]) by mail134-co9 (MessageSwitch) id 1372670700632519_13388; Mon, 1 Jul 2013 09:25:00 +0000 (UTC) Received: from CO9EHSMHS007.bigfish.com (unknown [10.236.132.236]) by mail134-co9.bigfish.com (Postfix) with ESMTP id 977CF3C0294 for ; Mon, 1 Jul 2013 09:25:00 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by CO9EHSMHS007.bigfish.com (10.236.130.17) with Microsoft SMTP Server id 14.1.225.23; Mon, 1 Jul 2013 09:25:00 +0000 X-WSS-ID: 0MP93HM-01-20U-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2E66210280BA for ; Mon, 1 Jul 2013 04:24:58 -0500 (CDT) Received: from SAUSEXDAG06.amd.com (163.181.55.7) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.192.1; Mon, 1 Jul 2013 04:25:03 -0500 Received: from SCYBEXDAG02.amd.com (10.34.11.12) by sausexdag06.amd.com (163.181.55.7) with Microsoft SMTP Server (TLS) id 14.2.328.9; Mon, 1 Jul 2013 04:24:59 -0500 Received: from ubuntu.amd.com (10.237.74.109) by SCYBEXDAG02.amd.com (10.34.11.12) with Microsoft SMTP Server id 14.2.328.9; Mon, 1 Jul 2013 17:24:52 +0800 From: Jackey Shen To: CC: Jackey Shen Subject: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots Date: Mon, 1 Jul 2013 17:22:15 +0800 Message-ID: <1372670535-2778-1-git-send-email-jackey.shen@amd.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 A PCI Based SD Host Controller can support up to a total of six SD Slots, and the base addresses are specified by Slot Information Register of its PCI header. Please refer to C.3.3 of SD Host Controller Standard Specification Version 3.0. Signed-off-by: Jackey Shen --- drivers/mmc/host/sdhci-pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index d7d6bc8..3a84e95 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c @@ -50,7 +50,8 @@ #define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7) #define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07 -#define MAX_SLOTS 8 +#define MAX_SLOTS 6 +#define MAX_BARS 6 struct sdhci_pci_chip; struct sdhci_pci_slot; @@ -1282,7 +1283,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( { struct sdhci_pci_slot *slot; struct sdhci_host *host; - int ret, bar = first_bar + slotno; + int ret, bar = (first_bar + slotno) % MAX_BARS; if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar); @@ -1481,7 +1482,7 @@ static int sdhci_pci_probe(struct pci_dev *pdev, first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK; - if (first_bar > 5) { + if (first_bar > MAX_BARS - 1) { dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n"); return -ENODEV; }