0006-gpio-axp-sunxi-Remove-virtual-VBUS-detection-GPIO.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. From c750151e1107a8d46ca0f9bd30c1da276b142ec1 Mon Sep 17 00:00:00 2001
  2. From: Samuel Holland <[email protected]>
  3. Date: Thu, 26 Aug 2021 18:02:54 -0500
  4. Subject: [PATCH 06/90] gpio: axp/sunxi: Remove virtual VBUS detection GPIO
  5. Now that this functionality is modeled using the device tree and
  6. regulator uclass, the named GPIO is not referenced anywhere. Remove it.
  7. Signed-off-by: Samuel Holland <[email protected]>
  8. ---
  9. arch/arm/include/asm/arch-sunxi/gpio.h | 1 -
  10. drivers/gpio/axp_gpio.c | 21 ++++-----------------
  11. drivers/gpio/sunxi_gpio.c | 6 +-----
  12. include/axp209.h | 1 -
  13. include/axp221.h | 1 -
  14. include/axp809.h | 1 -
  15. include/axp818.h | 1 -
  16. 7 files changed, 5 insertions(+), 27 deletions(-)
  17. --- a/arch/arm/include/asm/arch-sunxi/gpio.h
  18. +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
  19. @@ -209,7 +209,6 @@ enum sunxi_gpio_number {
  20. /* Virtual AXP0 GPIOs */
  21. #define SUNXI_GPIO_AXP0_PREFIX "AXP0-"
  22. -#define SUNXI_GPIO_AXP0_VBUS_DETECT 4
  23. #define SUNXI_GPIO_AXP0_VBUS_ENABLE 5
  24. #define SUNXI_GPIO_AXP0_GPIO_COUNT 6
  25. --- a/drivers/gpio/axp_gpio.c
  26. +++ b/drivers/gpio/axp_gpio.c
  27. @@ -36,18 +36,11 @@ static int axp_gpio_direction_input(stru
  28. {
  29. u8 reg;
  30. - switch (pin) {
  31. -#ifndef CONFIG_AXP152_POWER /* NA on axp152 */
  32. - case SUNXI_GPIO_AXP0_VBUS_DETECT:
  33. - return 0;
  34. -#endif
  35. - default:
  36. - reg = axp_get_gpio_ctrl_reg(pin);
  37. - if (reg == 0)
  38. - return -EINVAL;
  39. + reg = axp_get_gpio_ctrl_reg(pin);
  40. + if (reg == 0)
  41. + return -EINVAL;
  42. - return pmic_bus_write(reg, AXP_GPIO_CTRL_INPUT);
  43. - }
  44. + return pmic_bus_write(reg, AXP_GPIO_CTRL_INPUT);
  45. }
  46. static int axp_gpio_direction_output(struct udevice *dev, unsigned pin,
  47. @@ -83,12 +76,6 @@ static int axp_gpio_get_value(struct ude
  48. int ret;
  49. switch (pin) {
  50. -#ifndef CONFIG_AXP152_POWER /* NA on axp152 */
  51. - case SUNXI_GPIO_AXP0_VBUS_DETECT:
  52. - ret = pmic_bus_read(AXP_POWER_STATUS, &val);
  53. - mask = AXP_POWER_STATUS_VBUS_PRESENT;
  54. - break;
  55. -#endif
  56. #ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC
  57. /* Only available on later PMICs */
  58. case SUNXI_GPIO_AXP0_VBUS_ENABLE:
  59. --- a/drivers/gpio/sunxi_gpio.c
  60. +++ b/drivers/gpio/sunxi_gpio.c
  61. @@ -117,11 +117,7 @@ int sunxi_name_to_gpio(const char *name)
  62. #if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
  63. char lookup[8];
  64. - if (strcasecmp(name, "AXP0-VBUS-DETECT") == 0) {
  65. - sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d",
  66. - SUNXI_GPIO_AXP0_VBUS_DETECT);
  67. - name = lookup;
  68. - } else if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) {
  69. + if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) {
  70. sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d",
  71. SUNXI_GPIO_AXP0_VBUS_ENABLE);
  72. name = lookup;
  73. --- a/include/axp209.h
  74. +++ b/include/axp209.h
  75. @@ -77,7 +77,6 @@ enum axp209_reg {
  76. #ifdef CONFIG_AXP209_POWER
  77. #define AXP_POWER_STATUS 0x00
  78. #define AXP_POWER_STATUS_ALDO_IN BIT(0)
  79. -#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5)
  80. #define AXP_GPIO0_CTRL 0x90
  81. #define AXP_GPIO1_CTRL 0x92
  82. #define AXP_GPIO2_CTRL 0x93
  83. --- a/include/axp221.h
  84. +++ b/include/axp221.h
  85. @@ -53,7 +53,6 @@
  86. #ifdef CONFIG_AXP221_POWER
  87. #define AXP_POWER_STATUS 0x00
  88. #define AXP_POWER_STATUS_ALDO_IN BIT(0)
  89. -#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5)
  90. #define AXP_VBUS_IPSOUT 0x30
  91. #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2)
  92. #define AXP_MISC_CTRL 0x8f
  93. --- a/include/axp809.h
  94. +++ b/include/axp809.h
  95. @@ -47,7 +47,6 @@
  96. #ifdef CONFIG_AXP809_POWER
  97. #define AXP_POWER_STATUS 0x00
  98. #define AXP_POWER_STATUS_ALDO_IN BIT(0)
  99. -#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5)
  100. #define AXP_VBUS_IPSOUT 0x30
  101. #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2)
  102. #define AXP_MISC_CTRL 0x8f
  103. --- a/include/axp818.h
  104. +++ b/include/axp818.h
  105. @@ -61,7 +61,6 @@
  106. #ifdef CONFIG_AXP818_POWER
  107. #define AXP_POWER_STATUS 0x00
  108. #define AXP_POWER_STATUS_ALDO_IN BIT(0)
  109. -#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5)
  110. #define AXP_VBUS_IPSOUT 0x30
  111. #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2)
  112. #define AXP_MISC_CTRL 0x8f