|
19 | 19 | #include <linux/platform_device.h>
|
20 | 20 | #include <linux/of.h>
|
21 | 21 | #include <linux/of_device.h>
|
| 22 | +#include <linux/of_irq.h> |
22 | 23 | #include <linux/pinctrl/pinctrl.h>
|
23 | 24 |
|
24 | 25 | #include "pinctrl-sunxi.h"
|
@@ -530,17 +531,36 @@ static const struct sunxi_desc_pin sun50i_h5_pins[] = {
|
530 | 531 | SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 13)), /* PG_EINT13 */
|
531 | 532 | };
|
532 | 533 |
|
533 |
| -static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data = { |
| 534 | +static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data_broken = { |
534 | 535 | .pins = sun50i_h5_pins,
|
535 | 536 | .npins = ARRAY_SIZE(sun50i_h5_pins),
|
536 | 537 | .irq_banks = 2,
|
537 | 538 | .irq_read_needs_mux = true
|
538 | 539 | };
|
539 | 540 |
|
| 541 | +static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data = { |
| 542 | + .pins = sun50i_h5_pins, |
| 543 | + .npins = ARRAY_SIZE(sun50i_h5_pins), |
| 544 | + .irq_banks = 3, |
| 545 | + .irq_read_needs_mux = true |
| 546 | +}; |
| 547 | + |
540 | 548 | static int sun50i_h5_pinctrl_probe(struct platform_device *pdev)
|
541 | 549 | {
|
542 |
| - return sunxi_pinctrl_init(pdev, |
543 |
| - &sun50i_h5_pinctrl_data); |
| 550 | + switch (of_irq_count(pdev->dev.of_node)) { |
| 551 | + case 2: |
| 552 | + dev_warn(&pdev->dev, |
| 553 | + "Your device tree's pinctrl node is broken, which has no IRQ of PG bank routed.\n"); |
| 554 | + dev_warn(&pdev->dev, |
| 555 | + "Please update the device tree, otherwise PG bank IRQ won't work.\n"); |
| 556 | + return sunxi_pinctrl_init(pdev, |
| 557 | + &sun50i_h5_pinctrl_data_broken); |
| 558 | + case 3: |
| 559 | + return sunxi_pinctrl_init(pdev, |
| 560 | + &sun50i_h5_pinctrl_data); |
| 561 | + default: |
| 562 | + return -EINVAL; |
| 563 | + } |
544 | 564 | }
|
545 | 565 |
|
546 | 566 | static const struct of_device_id sun50i_h5_pinctrl_match[] = {
|
|
0 commit comments