{ .compatible = "fsl,qoriq-gpio", },
{}
};
@@ -303,10 +302,19 @@ static int mpc8xxx_probe(struct platform_device
*pdev)
struct device_node *np = pdev->dev.of_node;
struct mpc8xxx_gpio_chip *mpc8xxx_gc;
struct gpio_chip *gc;
- const struct mpc8xxx_gpio_devtype *devtype =
- of_device_get_match_data(&pdev->dev);
+ const struct mpc8xxx_gpio_devtype *devtype;
+ const struct acpi_device_id *acpi_id;
int ret;
+ if (pdev->dev.of_node) {
+ devtype = of_device_get_match_data(&pdev->dev);
+ } else {
+ acpi_id =
acpi_match_device(pdev->dev.driver->acpi_match_table,
+ &pdev->dev);
+ if (acpi_id)
+ devtype = (struct mpc8xxx_gpio_devtype *)
acpi_id->driver_data;
+ }
+
mpc8xxx_gc = devm_kzalloc(&pdev->dev, sizeof(*mpc8xxx_gc),
GFP_KERNEL);
if (!mpc8xxx_gc)
return -ENOMEM;
@@ -315,14 +323,14 @@ static int mpc8xxx_probe(struct platform_device
*pdev)
raw_spin_lock_init(&mpc8xxx_gc->lock);
- mpc8xxx_gc->regs = of_iomap(np, 0);
+ mpc8xxx_gc->regs = devm_platform_ioremap_resource(pdev, 0);
if (!mpc8xxx_gc->regs)
return -ENOMEM;
gc = &mpc8xxx_gc->gc;
gc->parent = &pdev->dev;
- if (of_property_read_bool(np, "little-endian")) {
+ if (device_property_read_bool(&pdev->dev, "little-endian")) {
ret = bgpio_init(gc, &pdev->dev, 4,
mpc8xxx_gc->regs + GPIO_DAT,
NULL, NULL,
@@ -369,10 +377,14 @@ static int mpc8xxx_probe(struct platform_device
*pdev)
* associated input enable must be set (GPIOxGPIE[IEn]=1) to
propagate
* the port value to the GPIO Data Register.
*/
- if (of_device_is_compatible(np, "fsl,qoriq-gpio") ||
- of_device_is_compatible(np, "fsl,ls1028a-gpio") ||
- of_device_is_compatible(np, "fsl,ls1088a-gpio"))
- gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE,
0xffffffff);
+ if (pdev->dev.of_node) {
+ if (of_device_is_compatible(np, "fsl,qoriq-gpio"))
+ gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE,
0xffffffff);
+ } else {
+ if
(acpi_match_device(pdev->dev.driver->acpi_match_table,
+ &pdev->dev))
+ gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE,
0xffffffff);
+ }
ret = gpiochip_add_data(gc, mpc8xxx_gc);
if (ret) {
@@ -381,12 +393,15 @@ static int mpc8xxx_probe(struct platform_device
*pdev)
goto err;
}
- mpc8xxx_gc->irqn = irq_of_parse_and_map(np, 0);
+ mpc8xxx_gc->irqn = platform_get_irq(pdev, 0);
if (!mpc8xxx_gc->irqn)
return 0;
- mpc8xxx_gc->irq = irq_domain_add_linear(np, MPC8XXX_GPIO_PINS,
- &mpc8xxx_gpio_irq_ops,
mpc8xxx_gc);
+ mpc8xxx_gc->irq =
irq_domain_create_linear(dev_fwnode(&pdev->dev),
+ MPC8XXX_GPIO_PINS,
+
&mpc8xxx_gpio_irq_ops,
+ mpc8xxx_gc);
+
if (!mpc8xxx_gc->irq)
return 0;
@@ -425,12 +440,21 @@ static int mpc8xxx_remove(struct platform_device
*pdev)
return 0;
}
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id gpio_acpi_ids[] = {
+ {"NXP0031",},
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);
+#endif
+
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
+ .acpi_match_table = ACPI_PTR(gpio_acpi_ids),
},
};
--
2.25.1