diff options
| -rw-r--r-- | drivers/pinctrl/pinctrl-bcm2835.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c index 4eb6d2c4e4df..2a2e427d765e 100644 --- a/drivers/pinctrl/pinctrl-bcm2835.c +++ b/drivers/pinctrl/pinctrl-bcm2835.c | |||
| @@ -699,11 +699,6 @@ static int bcm2835_pctl_dt_node_to_map_pull(struct bcm2835_pinctrl *pc, | |||
| 699 | return 0; | 699 | return 0; |
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | static inline u32 prop_u32(struct property *p, int i) | ||
| 703 | { | ||
| 704 | return be32_to_cpup(((__be32 *)p->value) + i); | ||
| 705 | } | ||
| 706 | |||
| 707 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | 702 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, |
| 708 | struct device_node *np, | 703 | struct device_node *np, |
| 709 | struct pinctrl_map **map, unsigned *num_maps) | 704 | struct pinctrl_map **map, unsigned *num_maps) |
| @@ -761,7 +756,9 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 761 | return -ENOMEM; | 756 | return -ENOMEM; |
| 762 | 757 | ||
| 763 | for (i = 0; i < num_pins; i++) { | 758 | for (i = 0; i < num_pins; i++) { |
| 764 | pin = prop_u32(pins, i); | 759 | err = of_property_read_u32_index(np, "brcm,pins", i, &pin); |
| 760 | if (err) | ||
| 761 | goto out; | ||
| 765 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { | 762 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { |
| 766 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", | 763 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", |
| 767 | of_node_full_name(np), pin); | 764 | of_node_full_name(np), pin); |
| @@ -770,14 +767,20 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 770 | } | 767 | } |
| 771 | 768 | ||
| 772 | if (num_funcs) { | 769 | if (num_funcs) { |
| 773 | func = prop_u32(funcs, (num_funcs > 1) ? i : 0); | 770 | err = of_property_read_u32_index(np, "brcm,function", |
| 771 | (num_funcs > 1) ? i : 0, &func); | ||
| 772 | if (err) | ||
| 773 | goto out; | ||
| 774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, | 774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, |
| 775 | func, &cur_map); | 775 | func, &cur_map); |
| 776 | if (err) | 776 | if (err) |
| 777 | goto out; | 777 | goto out; |
| 778 | } | 778 | } |
| 779 | if (num_pulls) { | 779 | if (num_pulls) { |
| 780 | pull = prop_u32(pulls, (num_pulls > 1) ? i : 0); | 780 | err = of_property_read_u32_index(np, "brcm,pull", |
| 781 | (num_funcs > 1) ? i : 0, &pull); | ||
| 782 | if (err) | ||
| 783 | goto out; | ||
| 781 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, | 784 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, |
| 782 | pull, &cur_map); | 785 | pull, &cur_map); |
| 783 | if (err) | 786 | if (err) |
