diff options
author | Kamlakant Patel <kamlakant.patel@broadcom.com> | 2016-06-05 04:30:44 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-06-08 04:54:13 -0400 |
commit | baa1b920a8408134e4ab117e4bdb216cb09b1869 (patch) | |
tree | 95ef37d84cdff4450819bfb6b4ccf98f23a7c247 /drivers/gpio/gpio-xlp.c | |
parent | 1630a0624a1b8e8d8d9c0cb1a584c5a9d4671101 (diff) |
gpio: Add ACPI support for XLP GPIO controller
Add ACPI support for GPIO controller on Broadcom Vulcan ARM64.
ACPI ID for this device is BRCM9006.
Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-xlp.c')
-rw-r--r-- | drivers/gpio/gpio-xlp.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c index 6acf8aa3b02d..4620d050e5a8 100644 --- a/drivers/gpio/gpio-xlp.c +++ b/drivers/gpio/gpio-xlp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/irqchip/chained_irq.h> | 21 | #include <linux/irqchip/chained_irq.h> |
22 | #include <linux/acpi.h> | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * XLP GPIO has multiple 32 bit registers for each feature where each register | 25 | * XLP GPIO has multiple 32 bit registers for each feature where each register |
@@ -299,7 +300,6 @@ static int xlp_gpio_probe(struct platform_device *pdev) | |||
299 | struct gpio_chip *gc; | 300 | struct gpio_chip *gc; |
300 | struct resource *iores; | 301 | struct resource *iores; |
301 | struct xlp_gpio_priv *priv; | 302 | struct xlp_gpio_priv *priv; |
302 | const struct of_device_id *of_id; | ||
303 | void __iomem *gpio_base; | 303 | void __iomem *gpio_base; |
304 | int irq_base, irq, err; | 304 | int irq_base, irq, err; |
305 | int ngpio; | 305 | int ngpio; |
@@ -321,13 +321,26 @@ static int xlp_gpio_probe(struct platform_device *pdev) | |||
321 | if (irq < 0) | 321 | if (irq < 0) |
322 | return irq; | 322 | return irq; |
323 | 323 | ||
324 | of_id = of_match_device(xlp_gpio_of_ids, &pdev->dev); | 324 | if (pdev->dev.of_node) { |
325 | if (!of_id) { | 325 | const struct of_device_id *of_id; |
326 | dev_err(&pdev->dev, "Failed to get soc type!\n"); | ||
327 | return -ENODEV; | ||
328 | } | ||
329 | 326 | ||
330 | soc_type = (uintptr_t) of_id->data; | 327 | of_id = of_match_device(xlp_gpio_of_ids, &pdev->dev); |
328 | if (!of_id) { | ||
329 | dev_err(&pdev->dev, "Unable to match OF ID\n"); | ||
330 | return -ENODEV; | ||
331 | } | ||
332 | soc_type = (uintptr_t) of_id->data; | ||
333 | } else { | ||
334 | const struct acpi_device_id *acpi_id; | ||
335 | |||
336 | acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table, | ||
337 | &pdev->dev); | ||
338 | if (!acpi_id || !acpi_id->driver_data) { | ||
339 | dev_err(&pdev->dev, "Unable to match ACPI ID\n"); | ||
340 | return -ENODEV; | ||
341 | } | ||
342 | soc_type = (uintptr_t) acpi_id->driver_data; | ||
343 | } | ||
331 | 344 | ||
332 | switch (soc_type) { | 345 | switch (soc_type) { |
333 | case XLP_GPIO_VARIANT_XLP832: | 346 | case XLP_GPIO_VARIANT_XLP832: |
@@ -425,10 +438,19 @@ out_free_desc: | |||
425 | return err; | 438 | return err; |
426 | } | 439 | } |
427 | 440 | ||
441 | #ifdef CONFIG_ACPI | ||
442 | static const struct acpi_device_id xlp_gpio_acpi_match[] = { | ||
443 | { "BRCM9006", GPIO_VARIANT_VULCAN }, | ||
444 | {}, | ||
445 | }; | ||
446 | MODULE_DEVICE_TABLE(acpi, xlp_gpio_acpi_match); | ||
447 | #endif | ||
448 | |||
428 | static struct platform_driver xlp_gpio_driver = { | 449 | static struct platform_driver xlp_gpio_driver = { |
429 | .driver = { | 450 | .driver = { |
430 | .name = "xlp-gpio", | 451 | .name = "xlp-gpio", |
431 | .of_match_table = xlp_gpio_of_ids, | 452 | .of_match_table = xlp_gpio_of_ids, |
453 | .acpi_match_table = ACPI_PTR(xlp_gpio_acpi_match), | ||
432 | }, | 454 | }, |
433 | .probe = xlp_gpio_probe, | 455 | .probe = xlp_gpio_probe, |
434 | }; | 456 | }; |