Skip to contentSkip to conversation

Add SDHCI ACPI driver

PATCH Superseded Adrian Hunter 4 participants 13 messages Nov 22, 2012 – Nov 23, 2012

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Adrian Hunter

author maintainer
#0 lore raw

cover Add SDHCI ACPI driver

Hi

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Adrian Hunter (3):
PNPACPI: exclude SDHCI devices
ACPI: add SDHCI to ACPI platform devices
mmc: sdhci-acpi: add SDHCI ACPI driver

 drivers/acpi/scan.c           |   2 +
 drivers/mmc/host/Kconfig      |  12 ++
 drivers/mmc/host/Makefile     |   1 +
 drivers/mmc/host/sdhci-acpi.c | 304 ++++++++++++++++++++++++++++++++++++++++++
 drivers/pnp/pnpacpi/core.c    |   1 +
 5 files changed, 320 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-acpi.c

Regards
Adrian Hunter

author maintainer
#1 lore raw

PATCH 1/3 PNPACPI: exclude SDHCI devices

These devices will be handled by a ACPI Platform driver.

---
 drivers/pnp/pnpacpi/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pnp/pnpacpi/core.c +1 -0
index 26b5d4b..5b17cc8 100644
@@ -43,6 +43,7 @@ static struct acpi_device_id excluded_id_list[] __initdata = {
 	{"PNP0C0F", 0},		/* Link device */
 	{"PNP0000", 0},		/* PIC */
 	{"PNP0100", 0},		/* Timer */
+	{"PNP0D40", 0},		/* SDHCI */
 	{"", 0},
 };
 
Signature · 1 line
1.7.11.7
author maintainer
#2 lore raw

PATCH 2/3 ACPI: add SDHCI to ACPI platform devices

In reply to Adrian Hunter
---
 drivers/acpi/scan.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/scan.c +2 -0
index 8c4ac6d..67a7fa6 100644
@@ -35,6 +35,8 @@ static const char *dummy_hid = "device";
  */
 static const struct acpi_device_id acpi_platform_device_ids[] = {
 
+	{ "PNP0D40" },
+
 	{ }
 };
 
Signature · 1 line
1.7.11.7
author maintainer
#3 lore raw

PATCH 3/3 mmc: sdhci-acpi: add SDHCI ACPI driver

In reply to Adrian Hunter
---
 drivers/mmc/host/Kconfig      |  12 ++
 drivers/mmc/host/Makefile     |   1 +
 drivers/mmc/host/sdhci-acpi.c | 304 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 317 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-acpi.c
drivers/mmc/host/Kconfig +12 -0
index 9bf10e7..56eac10 100644
@@ -81,6 +81,18 @@ config MMC_RICOH_MMC
 
 	  If unsure, say Y.
 
+config MMC_SDHCI_ACPI
+	tristate "SDHCI support for ACPI enumerated SDHCI controllers"
+	depends on MMC_SDHCI && ACPI
+	help
+	  This selects support for ACPI enumerated SDHCI controllers,
+	  identified by ACPI Compatibility ID PNP0D40 or specific
+	  ACPI Hardware IDs.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_PLTFM
 	tristate "SDHCI platform and OF driver helper"
 	depends on MMC_SDHCI
drivers/mmc/host/Makefile +1 -0
index 17ad0a7..0e4960a 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_MMC_MXS)		+= mxs-mmc.o
 obj-$(CONFIG_MMC_SDHCI)		+= sdhci.o
 obj-$(CONFIG_MMC_SDHCI_PCI)	+= sdhci-pci.o
 obj-$(subst m,y,$(CONFIG_MMC_SDHCI_PCI))	+= sdhci-pci-data.o
+obj-$(CONFIG_MMC_SDHCI_ACPI)	+= sdhci-acpi.o
 obj-$(CONFIG_MMC_SDHCI_PXAV3)	+= sdhci-pxav3.o
 obj-$(CONFIG_MMC_SDHCI_PXAV2)	+= sdhci-pxav2.o
 obj-$(CONFIG_MMC_SDHCI_S3C)	+= sdhci-s3c.o
drivers/mmc/host/sdhci-acpi.c new file +304 -0

304 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#4 lore raw

Re: [PATCH 3/3] mmc: sdhci-acpi: add SDHCI ACPI driver

drivers/mmc/host/sdhci-acpi.c line 109

Quoted 4 lines · Adrian Hunter
drivers/mmc/host/sdhci-acpi.c new file +4 -0
+static int __devinit sdhci_acpi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	acpi_handle handle = dev->acpi_handle;

This is not going to work anymore, you'll have to use ACPI_HANDLE(dev) for this (there was a new macro introduced with the struct acpi_dev_node).

drivers/mmc/host/sdhci-acpi.c line 122

Quoted 13 lines
drivers/mmc/host/sdhci-acpi.c new file +13 -0
+	struct acpi_device *device;
+	struct sdhci_acpi_host *c;
+	struct sdhci_host *host;
+	struct resource *iomem;
+	resource_size_t len;
+	const char *hid;
+	int err;
+
+	if (acpi_bus_get_device(handle, &device))
+		return -ENODEV;
+
+	if (acpi_bus_get_status(device) || !device->status.present)
+		return -ENODEV;

This is a bit redundant as the platform code already checks whether the device is present or not and only creates the platform device in case it is present.

Acked-by on the v1 series
#5 lore raw
In reply to Adrian Hunter

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
author maintainer
#6 lore raw
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Rafael can you take these patches?

#7 lore raw
Quoted 20 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Quoted 5 lines

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Rafael can you take these patches?

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

Also, I wonder if you really don't want to use ACPI PM and if you don't, then why?

Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#8 lore raw
Quoted 25 lines · Rafael J. Wysocki
Quoted 24 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Quoted 5 lines
Quoted 1 line

Rafael can you take these patches?

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

How about having pnpacpi to check if the ACPI device is already bound to a physical device and skip the device creation? Then we don't need to expose the acpi_platform_device_ids[] list, and this is what the ->find_device() code already does so why create the device in the first place?

drivers/pnp/pnpacpi/core.c +4 -0
index 5b17cc8..4dc2e64 100644
@@ -243,6 +243,10 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	char *pnpid;
 	struct acpi_hardware_id *id;
 
+	/* Skip devices that are already bound */
+	if (device->physical_node_count)
+		return 0;
+
 	/*
 	 * If a PnPacpi device is not present , the device
 	 * driver should not be loaded.
author maintainer
#9 lore raw
Quoted 28 lines · Mika Westerberg
Quoted 27 lines · Rafael J. Wysocki
Quoted 25 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Rafael can you take these patches?

Quoted 8 lines
Quoted 3 lines

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

How about having pnpacpi to check if the ACPI device is already bound to a physical device and skip the device creation? Then we don't need to expose the acpi_platform_device_ids[] list, and this is what the ->find_device() code already does so why create the device in the first place?

Yes, I was going to suggest that too. AFAICS pnpacpi has no concept of multiple physical nodes. Any objections?

Quoted 18 lines
drivers/pnp/pnpacpi/core.c +4 -0
index 5b17cc8..4dc2e64 100644
@@ -243,6 +243,10 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	char *pnpid;
 	struct acpi_hardware_id *id;
 
+	/* Skip devices that are already bound */
+	if (device->physical_node_count)
+		return 0;
+
 	/*
 	 * If a PnPacpi device is not present , the device
 	 * driver should not be loaded.
#10 lore raw
Quoted 33 lines · Adrian Hunter
Quoted 32 lines · Mika Westerberg
Quoted 30 lines · Rafael J. Wysocki
Quoted 20 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Quoted 5 lines

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Rafael can you take these patches?

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

Quoted 7 lines
Quoted 4 lines

How about having pnpacpi to check if the ACPI device is already bound to a physical device and skip the device creation? Then we don't need to expose the acpi_platform_device_ids[] list, and this is what the ->find_device() code already does so why create the device in the first place?

Yes, I was going to suggest that too. AFAICS pnpacpi has no concept of multiple physical nodes. Any objections?

Not from me.

Thanks,
Rafael

Quoted 19 lines
Quoted 17 lines
drivers/pnp/pnpacpi/core.c +4 -0
index 5b17cc8..4dc2e64 100644
@@ -243,6 +243,10 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	char *pnpid;
 	struct acpi_hardware_id *id;
 
+	/* Skip devices that are already bound */
+	if (device->physical_node_count)
+		return 0;
+
 	/*
 	 * If a PnPacpi device is not present , the device
 	 * driver should not be loaded.
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author maintainer
#11 lore raw
In reply to Rafael J. Wysocki
Quoted 25 lines · Rafael J. Wysocki
Quoted 24 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Quoted 8 lines
Quoted 1 line

Rafael can you take these patches?

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

Also, I wonder if you really don't want to use ACPI PM and if you don't, then why?

Mika and Lv Zheng are working on adding it to acpi_platform

#12 lore raw
Quoted 28 lines · Adrian Hunter
Quoted 27 lines · Rafael J. Wysocki
Quoted 25 lines · Adrian Hunter
Quoted 11 lines · Chris Ball

Hi,

Quoted 4 lines · Adrian Hunter

Here is SDHCI ACPI driver. It is dependent on new ACPI Platform support so I suggest Rafael takes the patches with Chris' Ack.

Please note that I would prefer this to be queued for 3.8

Looks fine:

Thank you!

Quoted 4 lines

I have some dumb questions, though -- what kind of platforms ship with these devices? Do they ever have the controller on PCI too, and what happens with sdhci-pci vs. sdhci-acpi in that case?

Since the arrival of ACPI5, platform devices can be configured using ACPI tables. PCI can also be used, but the firmware ensures that the same device is not enumerated via both ACPI and PCI.

Rafael can you take these patches?

Quoted 8 lines
Quoted 6 lines

Well, I'd prefer pnpacpi/core.c to actually use acpi_platform_device_ids[] directly in addition to excluded_id_list[], so that duplicate entries don't have to be added to the both of them.

Also, I wonder if you really don't want to use ACPI PM and if you don't, then why?

Mika and Lv Zheng are working on adding it to acpi_platform

OK

Please address the Mika's comment for [3/3], though.

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.