Skip to contentSkip to conversation

sdhci: fix undue iomem warning

PATCH In review Daniel J Blueman 3 participants 5 messages May 30, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdhci: fix undue iomem warning

Some newer SDHCI controllers have memory mapped I/O regions of 512 bytes, so accept these without warning.

---
 drivers/mmc/host/sdhci-pci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci.c +3 -2
index 936bbca..ae948b0 100644
@@ -918,8 +918,9 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
 		return ERR_PTR(-ENODEV);
 	}
 
-	if (pci_resource_len(pdev, bar) != 0x100) {
-		dev_err(&pdev->dev, "Invalid iomem size. You may "
+	int len = pci_resource_len(pdev, bar);
+	if (len != 0x100 && len != 0x200) {
+		dev_warn(&pdev->dev, "Invalid iomem size. You may "
 			"experience problems.\n");
 	}
 
Signature · 1 line
1.7.4.1
#1 lore raw

Hi Daniel,

drivers/mmc/host/sdhci-pci.c static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( · line 922

Quoted 12 lines
drivers/mmc/host/sdhci-pci.c +2 -2
index 936bbca..ae948b0 100644
@@ -918,8 +918,9 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
 		return ERR_PTR(-ENODEV);
 	}
 
-	if (pci_resource_len(pdev, bar) != 0x100) {
-		dev_err(&pdev->dev, "Invalid iomem size. You may "
+	int len = pci_resource_len(pdev, bar);
+	if (len != 0x100 && len != 0x200) {

Hmmm,

a) SDHC Specs (even v3) only mention 0x100, so this _is_ the standard. Do the new cards (which ones?) have anything located in the extra area?
b) your approach won't scale very well

so, I'd say it is better to keep the old way.

drivers/mmc/host/sdhci-pci.c static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( · line 924

Quoted 2 lines
drivers/mmc/host/sdhci-pci.c +1 -0
+		dev_warn(&pdev->dev, "Invalid iomem size. You may "
 			"experience problems.\n");

I second turning the message into a warning, though.

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

Hi Wolfram,

Quoted 17 lines · Wolfram Sang

Hi Daniel,

drivers/mmc/host/sdhci-pci.c static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( · line 922

Quoted 12 lines
drivers/mmc/host/sdhci-pci.c +2 -2
index 936bbca..ae948b0 100644
@@ -918,8 +918,9 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
               return ERR_PTR(-ENODEV);
       }
 
-     if (pci_resource_len(pdev, bar) != 0x100) {
-             dev_err(&pdev->dev, "Invalid iomem size. You may "
+     int len = pci_resource_len(pdev, bar);
+     if (len != 0x100 && len != 0x200) {

Hmmm,

Quoted 3 lines

a) SDHC Specs (even v3) only mention 0x100, so this _is_ the standard. Do the new cards (which ones?) have anything located in the extra area?

This controller is a dual-slot one, so has two register sets (though one set of pins aren't wired to a socket).

Quoted 1 line

b) your approach won't scale very well

True - a more scalable test would be to check for non-zero length and a multiple of 256 bytes, would you say?

This would be in-tune with page 2 of:
http://www.sdcard.org/developers/tech/host_controller/simple_spec/Simplified_SD_Host_Controller_Spec.pdf

Quoted 6 lines

so, I'd say it is better to keep the old way.

drivers/mmc/host/sdhci-pci.c static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( · line 924

Quoted 2 lines
drivers/mmc/host/sdhci-pci.c +1 -0
+             dev_warn(&pdev->dev, "Invalid iomem size. You may "
                       "experience problems.\n");

I second turning the message into a warning, though.

If the latter method is preferred, I'll adjust the patch and resend.

Thanks,
Daniel

Signature · 1 line
Daniel J Blueman
#3 lore raw
Quoted 7 lines
Quoted 4 lines

a) SDHC Specs (even v3) only mention 0x100, so this _is_ the standard. Do the new cards (which ones?) have anything located in the extra area?

This controller is a dual-slot one, so has two register sets (though one set of pins aren't wired to a socket).

There are two controllers and they are packed into one PCI-bar? :( I guess this needs refactoring of the probe_slot routine then. Just silencing the warning will just hide the problem.

Quoted 4 lines
Quoted 1 line

b) your approach won't scale very well

True - a more scalable test would be to check for non-zero length and a multiple of 256 bytes, would you say?

That wouldn't alarm for 0x10000 or the like, so no gain as well.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

+             dev_warn(&pdev->dev, "Invalid iomem size. You may " "experience problems.\n");

I second turning the message into a warning, though.

If the latter method is preferred, I'll adjust the patch and resend.

Reconsidering: Given the current situation, an error message is maybe not a that bad idea, until the code can handle two controllers in one bar.

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw
Quoted 11 lines · On Monday 30 May 2011 20:21:03 Wolfram Sang wrote:

Show Details

Quoted 6 lines
Quoted 3 lines

a) SDHC Specs (even v3) only mention 0x100, so this is the standard. Do the new cards (which ones?) have anything located in the extra area?

This controller is a dual-slot one, so has two register sets (though one set of pins aren't wired to a socket).

There are two controllers and they are packed into one PCI-bar? :( I guess this needs refactoring of the probe_slot routine then. Just silencing the warning will just hide the problem.

Right. Presumably someone has already built a different system with the same chip and both slots in use. This probably also means we need a way to figure out which of the slots are in fact connected.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

b) your approach won't scale very well

True - a more scalable test would be to check for non-zero length and a multiple of 256 bytes, would you say?

That wouldn't alarm for 0x10000 or the like, so no gain as well.

In fact, all PCI resources are by definition power-of-two numbers, so the check would not work at all.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

+ dev_warn(&pdev->dev, "Invalid iomem size. You may "

                      "experience problems.\n");

I second turning the message into a warning, though.

If the latter method is preferred, I'll adjust the patch and resend.

Reconsidering: Given the current situation, an error message is maybe not a that bad idea, until the code can handle two controllers in one bar.

Agreed.

Arnd