999-pinctrl_fixes.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. --- a/drivers/pinctrl/pinctrl-rt2880.c
  2. +++ b/drivers/pinctrl/pinctrl-rt2880.c
  3. @@ -204,6 +204,7 @@ static int rt2880_pmx_group_enable(struc
  4. {
  5. struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
  6. u32 mode = 0;
  7. + int i;
  8. /* dont allow double use */
  9. if (p->groups[group].enabled) {
  10. @@ -217,16 +218,16 @@ static int rt2880_pmx_group_enable(struc
  11. mode = rt_sysc_r32(SYSC_REG_GPIO_MODE);
  12. mode &= ~(p->groups[group].mask << p->groups[group].shift);
  13. + /* mark the pins as gpio */
  14. + for (i = 0; i < p->groups[group].func[0].pin_count; i++)
  15. + p->gpio[p->groups[group].func[0].pins[i]] = 1;
  16. +
  17. /* function 0 is gpio and needs special handling */
  18. if (func == 0) {
  19. - int i;
  20. -
  21. -
  22. mode |= p->groups[group].gpio << p->groups[group].shift;
  23. - /* mark the pins as gpio */
  24. - for (i = 0; i < p->groups[group].func[0].pin_count; i++)
  25. - p->gpio[p->groups[group].func[0].pins[i]] = 1;
  26. } else {
  27. + for (i = 0; i < p->func[func]->pin_count; i++)
  28. + p->gpio[p->func[func]->pins[i]] = 0;
  29. mode |= p->func[func]->value << p->groups[group].shift;
  30. }
  31. rt_sysc_w32(mode, SYSC_REG_GPIO_MODE);