Skip to contentSkip to conversation

drivers: PL061: Add platform driver probing support

PATCH New Shannon Zhao 5 participants 17 messages Aug 3, 2015 – Aug 13, 2015

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

cover drivers: PL061: Add platform driver probing support

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

Shannon Zhao (2):
drivers: PL061: add support for platform driver probing
drivers: PL061: add ACPI probing for PL061

 drivers/gpio/gpio-pl061.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

---
 drivers/gpio/gpio-pl061.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
drivers/gpio/gpio-pl061.c +108 -0
index 0475613..64c10eb 100644
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm.h>
+#include <linux/platform_device.h>
 
 #define GPIODIR 0x400
 #define GPIOIS  0x404
@@ -241,6 +242,94 @@ static struct irq_chip pl061_irqchip = {
 	.irq_set_type	= pl061_irq_type,
 };
 
+static int pl061_platform_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct pl061_platform_data *pdata = dev_get_platdata(dev);
+	struct pl061_gpio *chip;
+	int ret, irq, i, irq_base;
+	struct resource *mem;
+
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem)
+		return -EINVAL;
+
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+	if (chip == NULL)
+		return -ENOMEM;
+
+	if (pdata) {
+		chip->gc.base = pdata->gpio_base;
+		irq_base = pdata->irq_base;
+		if (irq_base <= 0) {
+			dev_err(&pdev->dev, "invalid IRQ base in pdata\n");
+			return -ENODEV;
+		}
+	} else {
+		chip->gc.base = -1;
+		irq_base = 0;
+	}
+
+	chip->base = devm_ioremap(dev, mem->start, resource_size(mem));
+	if (IS_ERR(chip->base))
+		return PTR_ERR(chip->base);
+
+	spin_lock_init(&chip->lock);
+	if (of_property_read_bool(dev->of_node, "gpio-ranges"))
+		chip->uses_pinctrl = true;
+
+	chip->gc.request = pl061_gpio_request;
+	chip->gc.free = pl061_gpio_free;
+	chip->gc.direction_input = pl061_direction_input;
+	chip->gc.direction_output = pl061_direction_output;
+	chip->gc.get = pl061_get_value;
+	chip->gc.set = pl061_set_value;
+	chip->gc.ngpio = PL061_GPIO_NR;
+	chip->gc.label = dev_name(dev);
+	chip->gc.dev = dev;
+	chip->gc.owner = THIS_MODULE;
+
+	ret = gpiochip_add(&chip->gc);
+	if (ret)
+		return ret;
+
+	/*
+	 * irq_chip support
+	 */
+	writeb(0, chip->base + GPIOIE); /* disable irqs */
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		dev_err(&pdev->dev, "invalid IRQ\n");
+		return -ENODEV;
+	}
+
+	ret = gpiochip_irqchip_add(&chip->gc, &pl061_irqchip,
+				   irq_base, handle_simple_irq,
+				   IRQ_TYPE_NONE);
+	if (ret) {
+		dev_info(&pdev->dev, "could not add irqchip\n");
+		return ret;
+	}
+	gpiochip_set_chained_irqchip(&chip->gc, &pl061_irqchip,
+				     irq, pl061_irq_handler);
+
+	for (i = 0; i < PL061_GPIO_NR; i++) {
+		if (pdata) {
+			if (pdata->directions & (BIT(i)))
+				pl061_direction_output(&chip->gc, i,
+						pdata->values & (BIT(i)));
+			else
+				pl061_direction_input(&chip->gc, i);
+		}
+	}
+
+	platform_set_drvdata(pdev, chip);
+	dev_info(&pdev->dev, "PL061 GPIO chip @%pa registered\n",
+		 &mem->start);
+
+	return 0;
+}
+
 static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 {
 	struct device *dev = &adev->dev;
@@ -376,6 +465,23 @@ static const struct dev_pm_ops pl061_dev_pm_ops = {
 };
 #endif
 
+static const struct of_device_id pl061_of_match[] = {
+	{ .compatible = "arm,pl061", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, pl061_of_match);
+
+static struct platform_driver pl061_gpio_platform_driver = {
+	.driver = {
+		.name	= "pl061_gpio",
+		.of_match_table	= pl061_of_match,
+#ifdef CONFIG_PM
+		.pm	= &pl061_dev_pm_ops,
+#endif
+	},
+	.probe		= pl061_platform_probe,
+};
+
 static struct amba_id pl061_ids[] = {
 	{
 		.id	= 0x00041061,
@@ -399,6 +505,8 @@ static struct amba_driver pl061_gpio_driver = {
 
 static int __init pl061_gpio_init(void)
 {
+	if (platform_driver_register(&pl061_gpio_platform_driver))
+		pr_warn("could not register PL061 platform driver\n");
 	return amba_driver_register(&pl061_gpio_driver);
 }
 module_init(pl061_gpio_init);
Signature · 1 line
2.0.4
#2 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

I already stated in 0/2 what the problem is with this, and it's obviously adding a huge codechunk, very similar to the AMBA probe path.

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

Yours,
Linus Walleij

#3 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

Quoted 13 lines · Linus Walleij
Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

Quoted 7 lines

I already stated in 0/2 what the problem is with this, and it's obviously adding
a huge codechunk, very similar to the AMBA probe path.

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

AMBA DT support is a hideous hack, we had kind of hoped to avoid doing that in ACPI.

If you notice ARM already updated pl011 driver to support platform device type probing this seems to be the way to go.

Graeme

#4 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

Quoted 20 lines · Graeme Gregory
Quoted 17 lines · Linus Walleij
Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

I already stated in 0/2 what the problem is with this, and it's obviously adding
a huge codechunk, very similar to the AMBA probe path.

Quoted 8 lines
Quoted 3 lines

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

AMBA DT support is a hideous hack, we had kind of hoped to avoid doing that in ACPI.

If you notice ARM already updated pl011 driver to support platform device type probing this seems to be the way to go.

As the AMBA bus maintainer, NAK on that.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#5 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

In reply to Graeme Gregory
Quoted 18 lines · Graeme Gregory
Quoted 17 lines · Linus Walleij
Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

I already stated in 0/2 what the problem is with this, and it's obviously adding
a huge codechunk, very similar to the AMBA probe path.

Quoted 5 lines
Quoted 2 lines

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

AMBA DT support is a hideous hack, we had kind of hoped to avoid doing that in ACPI.

Define what you mean with "hideous hack".

I think it is elegant. It combines the DT aspect of telling where the device is with the Plug-and-play aspect of reading the 0xB105F00D magic in the PrimeCells very nicely. With an optional override mechanism. It's nice.

The runtime PM stuff and pclk handling that Russell and also Ulf has worked on is very helpful and takes out a lot of codelines in a lot of drivers. Also very nice.

Quoted 2 lines

If you notice ARM already updated pl011 driver to support platform device type probing this seems to be the way to go.

Just because there is a precedent does not mean it is good.

Continuing with this adds 100+ lines of hairy initialization to every AMBA driver.

What needs to happen is stop this and make ACPI spawn AMBA devices for PrimeCells, and move the serial port over to that.

A compromise may be to have something that probes a list of these platform devices in drivers/acpi/ and spawn a corresponding AMBA device for it. It will still save codelines in all other subsystems and lower maintenance for the subsystem maintainers.

Yours,
Linus Walleij

#6 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

Quoted 20 lines · Linus Walleij
Quoted 18 lines · Graeme Gregory
Quoted 17 lines · Linus Walleij
Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

I already stated in 0/2 what the problem is with this, and it's obviously adding
a huge codechunk, very similar to the AMBA probe path.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

AMBA DT support is a hideous hack, we had kind of hoped to avoid doing that in ACPI.

Define what you mean with "hideous hack".

drivers/of/platform.c search for #ifdef CONFIG_ARM_AMBA

Quoted 9 lines

I think it is elegant. It combines the DT aspect of telling where the device is with the Plug-and-play aspect of reading the 0xB105F00D magic in the PrimeCells very nicely. With an optional override mechanism. It's nice.

The runtime PM stuff and pclk handling that Russell and also Ulf has worked on is very helpful and takes out a lot of codelines in a lot of drivers. Also very nice.

I have no objection to AMBA devices that are children of an AMBA bus object. Its the hack above that is nasty! It is also un-scalable as it sets the precedent that the platform.c in both DT and ACPI should learn about all the different types of device probing.

Quoted 12 lines
Quoted 2 lines

If you notice ARM already updated pl011 driver to support platform device type probing this seems to be the way to go.

Just because there is a precedent does not mean it is good.

Continuing with this adds 100+ lines of hairy initialization to every AMBA driver.

What needs to happen is stop this and make ACPI spawn AMBA devices for PrimeCells, and move the serial port over to that.

Quoted 6 lines

A compromise may be to have something that probes a list of these platform devices in drivers/acpi/ and spawn a corresponding AMBA device for it. It will still save codelines in all other subsystems and lower maintenance for the subsystem maintainers.

I am currently working on exactly what you describe above.

Graeme

#7 lore raw

PATCH 1/2 drivers: PL061: add support for platform driver probing

Quoted 26 lines · Graeme Gregory
Quoted 23 lines · Linus Walleij
Quoted 21 lines · Graeme Gregory
Quoted 19 lines · Linus Walleij
Quoted 9 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

Since PL061 currently only supports AMBA driver, to support using GPIO PL061 by DT or ACPI, it needs to add support for platform driver. A DT binding is provided with this patch, ACPI support is added in a separate one.

I already stated in 0/2 what the problem is with this, and it's obviously adding
a huge codechunk, very similar to the AMBA probe path.

We need to investigate if ACPI can just spawn AMBA/PrimeCell type devices instead.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

AMBA DT support is a hideous hack, we had kind of hoped to avoid doing that in ACPI.

Define what you mean with "hideous hack".

drivers/of/platform.c search for #ifdef CONFIG_ARM_AMBA

The way that AMBA support was added to OF was not something I was involved in. Don't make the mistake of saying "we're only supporting platform devices in ACPI because the OF implementation is messed up".

Quoted 4 lines
Quoted 4 lines

I think it is elegant. It combines the DT aspect of telling where the device is with the Plug-and-play aspect of reading the 0xB105F00D magic in the PrimeCells very nicely. With an optional override mechanism. It's nice.

It's also the _right_ way to deal with buses with different properties from platform devices, especially where some can be probed and identified via hardware-encoded IDs.

Quoted 4 lines

I have no objection to AMBA devices that are children of an AMBA bus object. Its the hack above that is nasty! It is also un-scalable as it sets the precedent that the platform.c in both DT and ACPI should learn about all the different types of device probing.

What's actually the nasty thing is that DT and ACPI are wedded to platform devices, which pushes people down the path of more platform device usage, when in fact they should be creating their own bus classes.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If you notice ARM already updated pl011 driver to support platform device type probing this seems to be the way to go.

Just because there is a precedent does not mean it is good.

Exactly.

Quoted 2 lines
Quoted 2 lines

Continuing with this adds 100+ lines of hairy initialization to every AMBA driver.

And that's utterly insane.

Quoted 9 lines
Quoted 9 lines

What needs to happen is stop this and make ACPI spawn AMBA devices for PrimeCells, and move the serial port over to that.

A compromise may be to have something that probes a list of these platform devices in drivers/acpi/ and spawn a corresponding AMBA device for it. It will still save codelines in all other subsystems and lower maintenance for the subsystem maintainers.

Even that isn't nice... but I guess as the madness will be contained within ACPI, it'll be ACPI's problem to maintain, so up to them how to deal with it provided the code is contained within ACPI. :)

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#8 lore raw

PATCH 2/2 drivers: PL061: add ACPI probing for PL061

In reply to Shannon Zhao

From: Shannon Zhao <[email protected]>

Add the necessary driver boilerplate to let the driver be used when the respective ACPI table is discovered by the ACPI subsystem.

---
 drivers/gpio/gpio-pl061.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpio/gpio-pl061.c +8 -0
index 64c10eb..41fcf7b 100644
@@ -25,6 +25,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
+#include <linux/acpi.h>
 
 #define GPIODIR 0x400
 #define GPIOIS  0x404
@@ -471,10 +472,17 @@ static const struct of_device_id pl061_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, pl061_of_match);
 
+static const struct acpi_device_id pl061_acpi_match[] = {
+	{ "ARMH0061",},
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, pl061_acpi_match);
+
 static struct platform_driver pl061_gpio_platform_driver = {
 	.driver = {
 		.name	= "pl061_gpio",
 		.of_match_table	= pl061_of_match,
+		.acpi_match_table = ACPI_PTR(pl061_acpi_match),
 #ifdef CONFIG_PM
 		.pm	= &pl061_dev_pm_ops,
 #endif
Signature · 1 line
2.0.4
#9 lore raw

cover drivers: PL061: Add platform driver probing support

In reply to Shannon Zhao
Quoted 8 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#10 lore raw

cover drivers: PL061: Add platform driver probing support

Hi Russell,

Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

Quoted 6 lines
Quoted 2 lines

These two patches add platform driver support for PL061 probed by DT or ACPI.

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Thanks,

Signature · 1 line
Shannon
#11 lore raw

cover drivers: PL061: Add platform driver probing support

Quoted 13 lines · Shannon Zhao

Hi Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

Quoted 8 lines
Quoted 3 lines

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Maybe rather than having every AMBA driver also converted to a platform driver (which GregKH hates) maybe ACPI should support the AMBA bus instead?

Greg?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#12 lore raw

cover drivers: PL061: Add platform driver probing support

Quoted 10 lines · Russell King - ARM Linux
Quoted 4 lines · Shannon Zhao

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Maybe rather than having every AMBA driver also converted to a platform driver (which GregKH hates) maybe ACPI should support the AMBA bus instead?

I agree with Russell, and overall I'm not sure I'm very happy with commit 0dd1e247fd39aed20fd2baacc62ca44d82534798 "drivers: PL011: add support for the ARM SBSA generic UART" either.

I can see how this works, but it adds a big chunk of overhead to every driver that want to support both PrimeCell MMIO probing and devicetree and ACPI.

Devicetree is spawning awesome AMBA devices for PrimeCells in drivers/of/platform.c, so why can't ACPI do the same?

The AMBA bus is intelligent and very helpful with things like runtime suspend/resume. It also supports reading the version registers to autodetect device characteristics.

Yours,
Linus Walleij

#13 lore raw

cover drivers: PL061: Add platform driver probing support

In reply to Russell King - ARM Linux
Quoted 23 lines · Russell King - ARM Linux
Quoted 13 lines · Shannon Zhao

Hi Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

Quoted 8 lines
Quoted 3 lines

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Quoted 5 lines

Maybe rather than having every AMBA driver also converted to a platform driver (which GregKH hates) maybe ACPI should support the AMBA bus instead?

Greg?

The ACPI developers have been doing work to allow a driver to handle getting the resources from either DT or ACPI no matter what bus it is on, so converting anything to a platform driver shouldn't be needed.

but I don't really know the details here, and this isn't being sent to the ACPI mailing list, so I don't know what to suggest...

greg k-h

#14 lore raw

cover drivers: PL061: Add platform driver probing support

Quoted 28 lines · Greg Kroah-Hartman
Quoted 27 lines · Russell King - ARM Linux
Quoted 13 lines · Shannon Zhao

Hi Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

Quoted 8 lines
Quoted 3 lines

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Maybe rather than having every AMBA driver also converted to a platform driver (which GregKH hates) maybe ACPI should support the AMBA bus instead?

Quoted 8 lines
Quoted 1 line

Greg?

The ACPI developers have been doing work to allow a driver to handle getting the resources from either DT or ACPI no matter what bus it is on, so converting anything to a platform driver shouldn't be needed.

but I don't really know the details here, and this isn't being sent to the ACPI mailing list, so I don't know what to suggest...

Greg,

You're the one who's said many times that you'd like to see platform devices and platform device drivers to go away. So, when I give you the opportunity to comment on platform devices being used to augment existing device drivers such as the AMBA bus drivers (which you've also previously said is a more preferable way to use the driver model) why not support that view?

Right now, there seems to be a move to convert _all_ AMBA device drivers to become dual-drivers: an amba bus driver and a platform driver. Is that something you really want to see, irrespective of ACPI issues?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#15 lore raw

cover drivers: PL061: Add platform driver probing support

Quoted 35 lines · Russell King - ARM Linux
Quoted 34 lines · Greg Kroah-Hartman
Quoted 23 lines · Russell King - ARM Linux
Quoted 13 lines · Shannon Zhao

Hi Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Shannon Zhao

From: Shannon Zhao <[email protected]>

According to ACPI SPEC, it supports ARM boards to use "GPIO-signaled ACPI Events". These events can be used for input events. And to QEMU, it uses GPIO PL061 controller for input events.

These two patches add platform driver support for PL061 probed by DT or ACPI.

Quoted 8 lines
Quoted 3 lines

This certainly is incorrect for DT, and is probably wrong for ACPI too. DT creates amba devices, so binds via the amba device driver.

Oh, sorry. The changes for DT are not necessary. But for ACPI I think it needs to convert pl061 to platform device since ACPI doesn't support AMBA devices. The Pl011 also does the same thing to support ACPI probing. See drivers/tty/serial/amba-pl011.c

Quoted 5 lines

Maybe rather than having every AMBA driver also converted to a platform driver (which GregKH hates) maybe ACPI should support the AMBA bus instead?

Greg?

The ACPI developers have been doing work to allow a driver to handle getting the resources from either DT or ACPI no matter what bus it is on, so converting anything to a platform driver shouldn't be needed.

Quoted 7 lines
Quoted 2 lines

but I don't really know the details here, and this isn't being sent to the ACPI mailing list, so I don't know what to suggest...

Greg,

You're the one who's said many times that you'd like to see platform devices and platform device drivers to go away.

Yes, of course, I hate the things :)

Quoted 5 lines

So, when I give you
the opportunity to comment on platform devices being used to augment existing device drivers such as the AMBA bus drivers (which you've also previously said is a more preferable way to use the driver model) why not support that view?

Because I don't know the whole story here, sorry.

Quoted 3 lines

Right now, there seems to be a move to convert _all_ AMBA device drivers to become dual-drivers: an amba bus driver and a platform driver. Is that something you really want to see, irrespective of ACPI issues?

Ick, no, I don't think that's wise at all. Why not just make the needed resources availble to _all_ bus drivers, then it doesn't matter if it's AMBA, or ACPI, or USB, or anything else?

I thought that is what some recent patches did to the acpi/of core, but maybe I was mistaken.

thanks,

greg k-h

#16 lore raw
Quoted 9 lines · Greg Kroah-Hartman
Quoted 3 lines · Russell King - ARM Linux

Right now, there seems to be a move to convert _all_ AMBA device drivers to become dual-drivers: an amba bus driver and a platform driver. Is that something you really want to see, irrespective of ACPI issues?

Ick, no, I don't think that's wise at all. Why not just make the needed resources availble to _all_ bus drivers, then it doesn't matter if it's AMBA, or ACPI, or USB, or anything else?

Amen to that.

Quoted 2 lines

I thought that is what some recent patches did to the acpi/of core, but maybe I was mistaken.

I think you're referring to the initiative to provide query functions that will work the same on device trees and ACPI devices, that is to get a key/value from a certain struct device * no matter if it came from a DT or ACPI.

This is about how the core hardware description spawns devices. While DT will (correctly) spawn AMBA devices, the ACPI code apparently doesn't. But it should. of_amba_device_create() even shows exactly how to do it.

What I fear is that ACPI actually has no way to tell whether a device is an AMBA device but rather thinks the whole world consists of platform_devices, and then *THAT* needs to be fixed.

Yours,
Linus Walleij