* [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
@ 2013-07-01 9:22 Jackey Shen
2013-10-22 8:24 ` Shen, Jackey
2013-10-27 1:23 ` Chris Ball
0 siblings, 2 replies; 4+ messages in thread
From: Jackey Shen @ 2013-07-01 9:22 UTC (permalink / raw)
To: linux-mmc; +Cc: Jackey Shen
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 <jackey.shen@amd.com>
---
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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
2013-07-01 9:22 [PATCH] mmc: sdhci-pci: identify correct base addresses for slots Jackey Shen
@ 2013-10-22 8:24 ` Shen, Jackey
2013-10-27 1:23 ` Chris Ball
1 sibling, 0 replies; 4+ messages in thread
From: Shen, Jackey @ 2013-10-22 8:24 UTC (permalink / raw)
To: Chris Ball; +Cc: Shen, Jackey, linux-mmc@vger.kernel.org
Hi Chris,
Do you have any comments on this patch?
Thanks,
Jackey
-----Original Message-----
From: Jackey Shen [mailto:jackey.shen@amd.com]
Sent: Monday, July 01, 2013 5:22 PM
To: linux-mmc@vger.kernel.org
Cc: Shen, Jackey
Subject: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
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 <jackey.shen@amd.com>
---
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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
2013-07-01 9:22 [PATCH] mmc: sdhci-pci: identify correct base addresses for slots Jackey Shen
2013-10-22 8:24 ` Shen, Jackey
@ 2013-10-27 1:23 ` Chris Ball
2013-10-28 2:04 ` Shen, Jackey
1 sibling, 1 reply; 4+ messages in thread
From: Chris Ball @ 2013-10-27 1:23 UTC (permalink / raw)
To: Jackey Shen; +Cc: linux-mmc
Hi Jackey,
On Mon, Jul 01 2013, Jackey Shen wrote:
> 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.
Out of curiosity (and for the patch record), do you have hardware that
requires this patch that you've tested it on, or is it just theoretical?
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
2013-10-27 1:23 ` Chris Ball
@ 2013-10-28 2:04 ` Shen, Jackey
0 siblings, 0 replies; 4+ messages in thread
From: Shen, Jackey @ 2013-10-28 2:04 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc@vger.kernel.org
Hi Chris,
> -----Original Message-----
> From: Chris Ball [mailto:cjb@laptop.org]
> Sent: Sunday, October 27, 2013 9:24 AM
> To: Shen, Jackey
> Cc: linux-mmc@vger.kernel.org
> Subject: Re: [PATCH] mmc: sdhci-pci: identify correct base addresses for slots
>
> Hi Jackey,
>
> On Mon, Jul 01 2013, Jackey Shen wrote:
> > 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.
>
> Out of curiosity (and for the patch record), do you have hardware that
> requires this patch that you've tested it on, or is it just theoretical?
I just theoretically wrote this patch according to SD spec.
Thanks,
Jackey
>
> Thanks,
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-28 2:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01 9:22 [PATCH] mmc: sdhci-pci: identify correct base addresses for slots Jackey Shen
2013-10-22 8:24 ` Shen, Jackey
2013-10-27 1:23 ` Chris Ball
2013-10-28 2:04 ` Shen, Jackey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox