Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2007-2012 |
| 4 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> |
| 5 | * Tom Cubie <tangliang@allwinnertech.com> |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _SUNXI_GPIO_H |
| 9 | #define _SUNXI_GPIO_H |
| 10 | |
| 11 | #include <linux/types.h> |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 12 | #include <asm/arch/cpu.h> |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 13 | |
| 14 | /* |
| 15 | * sunxi has 9 banks of gpio, they are: |
| 16 | * PA0 - PA17 | PB0 - PB23 | PC0 - PC24 |
| 17 | * PD0 - PD27 | PE0 - PE31 | PF0 - PF5 |
| 18 | * PG0 - PG9 | PH0 - PH27 | PI0 - PI12 |
| 19 | */ |
| 20 | |
| 21 | #define SUNXI_GPIO_A 0 |
| 22 | #define SUNXI_GPIO_B 1 |
| 23 | #define SUNXI_GPIO_C 2 |
| 24 | #define SUNXI_GPIO_D 3 |
| 25 | #define SUNXI_GPIO_E 4 |
| 26 | #define SUNXI_GPIO_F 5 |
| 27 | #define SUNXI_GPIO_G 6 |
| 28 | #define SUNXI_GPIO_H 7 |
| 29 | #define SUNXI_GPIO_I 8 |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * This defines the number of GPIO banks for the _main_ GPIO controller. |
| 33 | * You should fix up the padding in struct sunxi_gpio_reg below if you |
| 34 | * change this. |
| 35 | */ |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 36 | #define SUNXI_GPIO_BANKS 9 |
| 37 | |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 38 | /* |
| 39 | * sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) |
| 40 | * at a different register offset. |
| 41 | * |
| 42 | * sun6i has 2 banks: |
| 43 | * PL0 - PL8 | PM0 - PM7 |
| 44 | * |
| 45 | * sun8i has 1 bank: |
| 46 | * PL0 - PL11 |
Hans de Goede | 8760c91 | 2015-01-26 16:46:43 +0100 | [diff] [blame] | 47 | * |
| 48 | * sun9i has 3 banks: |
| 49 | * PL0 - PL9 | PM0 - PM15 | PN0 - PN1 |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 50 | */ |
| 51 | #define SUNXI_GPIO_L 11 |
| 52 | #define SUNXI_GPIO_M 12 |
Hans de Goede | 8760c91 | 2015-01-26 16:46:43 +0100 | [diff] [blame] | 53 | #define SUNXI_GPIO_N 13 |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 54 | |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 55 | struct sunxi_gpio { |
| 56 | u32 cfg[4]; |
| 57 | u32 dat; |
| 58 | u32 drv[2]; |
| 59 | u32 pull[2]; |
| 60 | }; |
| 61 | |
| 62 | /* gpio interrupt control */ |
| 63 | struct sunxi_gpio_int { |
| 64 | u32 cfg[3]; |
| 65 | u32 ctl; |
| 66 | u32 sta; |
| 67 | u32 deb; /* interrupt debounce */ |
| 68 | }; |
| 69 | |
| 70 | struct sunxi_gpio_reg { |
| 71 | struct sunxi_gpio gpio_bank[SUNXI_GPIO_BANKS]; |
| 72 | u8 res[0xbc]; |
| 73 | struct sunxi_gpio_int gpio_int; |
| 74 | }; |
| 75 | |
Icenowy Zheng | 112c886 | 2019-04-24 13:44:12 +0800 | [diff] [blame] | 76 | #define SUN50I_H6_GPIO_POW_MOD_SEL 0x340 |
| 77 | #define SUN50I_H6_GPIO_POW_MOD_VAL 0x348 |
| 78 | |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 79 | #define BANK_TO_GPIO(bank) (((bank) < SUNXI_GPIO_L) ? \ |
| 80 | &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ |
| 81 | &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_L]) |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 82 | |
| 83 | #define GPIO_BANK(pin) ((pin) >> 5) |
| 84 | #define GPIO_NUM(pin) ((pin) & 0x1f) |
| 85 | |
| 86 | #define GPIO_CFG_INDEX(pin) (((pin) & 0x1f) >> 3) |
| 87 | #define GPIO_CFG_OFFSET(pin) ((((pin) & 0x1f) & 0x7) << 2) |
| 88 | |
Paul Kocialkowski | c97e168 | 2015-03-22 18:07:08 +0100 | [diff] [blame] | 89 | #define GPIO_DRV_INDEX(pin) (((pin) & 0x1f) >> 4) |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 90 | #define GPIO_DRV_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) |
| 91 | |
| 92 | #define GPIO_PULL_INDEX(pin) (((pin) & 0x1f) >> 4) |
| 93 | #define GPIO_PULL_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) |
| 94 | |
| 95 | /* GPIO bank sizes */ |
| 96 | #define SUNXI_GPIO_A_NR 32 |
| 97 | #define SUNXI_GPIO_B_NR 32 |
| 98 | #define SUNXI_GPIO_C_NR 32 |
| 99 | #define SUNXI_GPIO_D_NR 32 |
| 100 | #define SUNXI_GPIO_E_NR 32 |
| 101 | #define SUNXI_GPIO_F_NR 32 |
| 102 | #define SUNXI_GPIO_G_NR 32 |
| 103 | #define SUNXI_GPIO_H_NR 32 |
| 104 | #define SUNXI_GPIO_I_NR 32 |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 105 | #define SUNXI_GPIO_L_NR 32 |
| 106 | #define SUNXI_GPIO_M_NR 32 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 107 | |
| 108 | #define SUNXI_GPIO_NEXT(__gpio) \ |
| 109 | ((__gpio##_START) + (__gpio##_NR) + 0) |
| 110 | |
| 111 | enum sunxi_gpio_number { |
| 112 | SUNXI_GPIO_A_START = 0, |
| 113 | SUNXI_GPIO_B_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_A), |
| 114 | SUNXI_GPIO_C_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_B), |
| 115 | SUNXI_GPIO_D_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_C), |
| 116 | SUNXI_GPIO_E_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_D), |
| 117 | SUNXI_GPIO_F_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_E), |
| 118 | SUNXI_GPIO_G_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_F), |
| 119 | SUNXI_GPIO_H_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_G), |
| 120 | SUNXI_GPIO_I_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_H), |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 121 | SUNXI_GPIO_L_START = 352, |
| 122 | SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), |
Hans de Goede | 8760c91 | 2015-01-26 16:46:43 +0100 | [diff] [blame] | 123 | SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M), |
Hans de Goede | 1fc9c4a | 2014-12-24 19:34:38 +0100 | [diff] [blame] | 124 | SUNXI_GPIO_AXP0_START = 1024, |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | /* SUNXI GPIO number definitions */ |
| 128 | #define SUNXI_GPA(_nr) (SUNXI_GPIO_A_START + (_nr)) |
| 129 | #define SUNXI_GPB(_nr) (SUNXI_GPIO_B_START + (_nr)) |
| 130 | #define SUNXI_GPC(_nr) (SUNXI_GPIO_C_START + (_nr)) |
| 131 | #define SUNXI_GPD(_nr) (SUNXI_GPIO_D_START + (_nr)) |
| 132 | #define SUNXI_GPE(_nr) (SUNXI_GPIO_E_START + (_nr)) |
| 133 | #define SUNXI_GPF(_nr) (SUNXI_GPIO_F_START + (_nr)) |
| 134 | #define SUNXI_GPG(_nr) (SUNXI_GPIO_G_START + (_nr)) |
| 135 | #define SUNXI_GPH(_nr) (SUNXI_GPIO_H_START + (_nr)) |
| 136 | #define SUNXI_GPI(_nr) (SUNXI_GPIO_I_START + (_nr)) |
Hans de Goede | 0ee7268 | 2014-10-22 16:47:45 +0800 | [diff] [blame] | 137 | #define SUNXI_GPL(_nr) (SUNXI_GPIO_L_START + (_nr)) |
| 138 | #define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr)) |
Hans de Goede | 8760c91 | 2015-01-26 16:46:43 +0100 | [diff] [blame] | 139 | #define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr)) |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 140 | |
Hans de Goede | 1fc9c4a | 2014-12-24 19:34:38 +0100 | [diff] [blame] | 141 | #define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr)) |
| 142 | |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 143 | /* GPIO pin function config */ |
| 144 | #define SUNXI_GPIO_INPUT 0 |
| 145 | #define SUNXI_GPIO_OUTPUT 1 |
Siarhei Siamashka | 6f3ea20 | 2016-06-07 14:28:34 +0300 | [diff] [blame] | 146 | #define SUNXI_GPIO_DISABLE 7 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 147 | |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 148 | #define SUNXI_GPA_EMAC 2 |
| 149 | #define SUN6I_GPA_GMAC 2 |
| 150 | #define SUN7I_GPA_GMAC 5 |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 151 | #define SUN6I_GPA_SDC2 5 |
| 152 | #define SUN6I_GPA_SDC3 4 |
Jens Kuske | f977072 | 2015-11-17 15:12:58 +0100 | [diff] [blame] | 153 | #define SUN8I_H3_GPA_UART0 2 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 154 | |
Hans de Goede | 663ae65 | 2016-08-19 15:25:41 +0200 | [diff] [blame] | 155 | #define SUN4I_GPB_PWM 2 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 156 | #define SUN4I_GPB_TWI0 2 |
| 157 | #define SUN4I_GPB_TWI1 2 |
| 158 | #define SUN5I_GPB_TWI1 2 |
| 159 | #define SUN4I_GPB_TWI2 2 |
| 160 | #define SUN5I_GPB_TWI2 2 |
Icenowy Zheng | 365951a | 2020-10-26 22:19:34 +0800 | [diff] [blame] | 161 | #define SUN8I_V3S_GPB_TWI0 2 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 162 | #define SUN4I_GPB_UART0 2 |
| 163 | #define SUN5I_GPB_UART0 2 |
Laurent Itti | 20dfe00 | 2015-05-05 17:02:00 -0700 | [diff] [blame] | 164 | #define SUN8I_GPB_UART2 2 |
Chen-Yu Tsai | 28b7192 | 2015-06-23 19:57:25 +0800 | [diff] [blame] | 165 | #define SUN8I_A33_GPB_UART0 3 |
vishnupatekar | 133bfbe | 2015-11-29 01:07:20 +0800 | [diff] [blame] | 166 | #define SUN8I_A83T_GPB_UART0 2 |
Icenowy Zheng | 52e6188 | 2017-04-08 15:30:12 +0800 | [diff] [blame] | 167 | #define SUN8I_V3S_GPB_UART0 3 |
Siarhei Siamashka | 26c50fb | 2016-03-29 17:29:10 +0200 | [diff] [blame] | 168 | #define SUN50I_GPB_UART0 4 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 169 | |
Karol Gugala | 7bea893 | 2015-07-23 14:33:01 +0200 | [diff] [blame] | 170 | #define SUNXI_GPC_NAND 2 |
Siarhei Siamashka | 6f3ea20 | 2016-06-07 14:28:34 +0300 | [diff] [blame] | 171 | #define SUNXI_GPC_SPI0 3 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 172 | #define SUNXI_GPC_SDC2 3 |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 173 | #define SUN6I_GPC_SDC3 4 |
Siarhei Siamashka | 6f3ea20 | 2016-06-07 14:28:34 +0300 | [diff] [blame] | 174 | #define SUN50I_GPC_SPI0 4 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 175 | |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 176 | #define SUN8I_GPD_SDC1 3 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 177 | #define SUNXI_GPD_LCD0 2 |
| 178 | #define SUNXI_GPD_LVDS0 3 |
Vasily Khoruzhick | 86a38e5 | 2018-05-14 08:16:20 -0700 | [diff] [blame] | 179 | #define SUNXI_GPD_PWM 2 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 180 | |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 181 | #define SUN5I_GPE_SDC2 3 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 182 | #define SUN8I_GPE_TWI2 3 |
Stefan Mavrodiev | cabe992 | 2019-01-08 12:04:30 +0200 | [diff] [blame] | 183 | #define SUN50I_GPE_TWI2 3 |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 184 | |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 185 | #define SUNXI_GPF_SDC0 2 |
| 186 | #define SUNXI_GPF_UART0 4 |
| 187 | #define SUN8I_GPF_UART0 3 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 188 | |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 189 | #define SUN4I_GPG_SDC1 4 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 190 | #define SUN5I_GPG_SDC1 2 |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 191 | #define SUN6I_GPG_SDC1 2 |
| 192 | #define SUN8I_GPG_SDC1 2 |
Tobias Schramm | 6892a56 | 2021-02-15 00:19:58 +0100 | [diff] [blame] | 193 | #define SUN8I_GPG_UART1 2 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 194 | #define SUN6I_GPG_TWI3 2 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 195 | #define SUN5I_GPG_UART1 4 |
Hans de Goede | 7e68a1b | 2014-12-21 16:28:32 +0100 | [diff] [blame] | 196 | |
Hans de Goede | 663ae65 | 2016-08-19 15:25:41 +0200 | [diff] [blame] | 197 | #define SUN6I_GPH_PWM 2 |
| 198 | #define SUN8I_GPH_PWM 2 |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 199 | #define SUN4I_GPH_SDC1 5 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 200 | #define SUN6I_GPH_TWI0 2 |
| 201 | #define SUN8I_GPH_TWI0 2 |
Stefan Mavrodiev | cabe992 | 2019-01-08 12:04:30 +0200 | [diff] [blame] | 202 | #define SUN50I_GPH_TWI0 2 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 203 | #define SUN6I_GPH_TWI1 2 |
| 204 | #define SUN8I_GPH_TWI1 2 |
Stefan Mavrodiev | cabe992 | 2019-01-08 12:04:30 +0200 | [diff] [blame] | 205 | #define SUN50I_GPH_TWI1 2 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 206 | #define SUN6I_GPH_TWI2 2 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 207 | #define SUN6I_GPH_UART0 2 |
Hans de Goede | 7bfe2bb | 2015-01-13 19:25:06 +0100 | [diff] [blame] | 208 | #define SUN9I_GPH_UART0 2 |
Icenowy Zheng | a78bb07 | 2018-07-21 16:20:28 +0800 | [diff] [blame] | 209 | #define SUN50I_H6_GPH_UART0 2 |
Jernej Skrabec | 30efb9d | 2021-01-11 21:11:41 +0100 | [diff] [blame] | 210 | #define SUN50I_H616_GPH_UART0 2 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 211 | |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 212 | #define SUNXI_GPI_SDC3 2 |
Paul Kocialkowski | 0a3ec0a | 2015-04-10 23:09:52 +0200 | [diff] [blame] | 213 | #define SUN7I_GPI_TWI3 3 |
| 214 | #define SUN7I_GPI_TWI4 3 |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 215 | |
Hans de Goede | 7c59038 | 2014-12-13 10:25:14 +0100 | [diff] [blame] | 216 | #define SUN6I_GPL0_R_P2WI_SCK 3 |
| 217 | #define SUN6I_GPL1_R_P2WI_SDA 3 |
Oliver Schinagl | 4f9a008 | 2013-07-25 14:07:42 +0200 | [diff] [blame] | 218 | |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 219 | #define SUN8I_GPL_R_RSB 2 |
Jelle van der Waa | 8d3d7c1 | 2016-01-14 14:06:26 +0100 | [diff] [blame] | 220 | #define SUN8I_H3_GPL_R_TWI 2 |
| 221 | #define SUN8I_A23_GPL_R_TWI 3 |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 222 | #define SUN8I_GPL_R_UART 2 |
Vasily Khoruzhick | 6f4c344 | 2018-11-05 20:24:30 -0800 | [diff] [blame] | 223 | #define SUN50I_GPL_R_TWI 2 |
Jernej Skrabec | 7de8eb0 | 2021-01-11 21:11:42 +0100 | [diff] [blame] | 224 | #define SUN50I_H616_GPL_R_TWI 3 |
Chen-Yu Tsai | 6ee6388 | 2014-10-22 16:47:47 +0800 | [diff] [blame] | 225 | |
Paul Kocialkowski | ae358a4 | 2015-03-22 18:12:22 +0100 | [diff] [blame] | 226 | #define SUN9I_GPN_R_RSB 3 |
Hans de Goede | 8760c91 | 2015-01-26 16:46:43 +0100 | [diff] [blame] | 227 | |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 228 | /* GPIO pin pull-up/down config */ |
| 229 | #define SUNXI_GPIO_PULL_DISABLE 0 |
| 230 | #define SUNXI_GPIO_PULL_UP 1 |
| 231 | #define SUNXI_GPIO_PULL_DOWN 2 |
| 232 | |
Paul Kocialkowski | 6604a13 | 2015-03-22 18:07:09 +0100 | [diff] [blame] | 233 | /* Virtual AXP0 GPIOs */ |
Hans de Goede | 08607d1 | 2015-04-22 11:31:22 +0200 | [diff] [blame] | 234 | #define SUNXI_GPIO_AXP0_PREFIX "AXP0-" |
| 235 | #define SUNXI_GPIO_AXP0_VBUS_DETECT 4 |
| 236 | #define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 |
| 237 | #define SUNXI_GPIO_AXP0_GPIO_COUNT 6 |
Paul Kocialkowski | 6604a13 | 2015-03-22 18:07:09 +0100 | [diff] [blame] | 238 | |
Simon Glass | d862453 | 2014-10-30 20:25:47 -0600 | [diff] [blame] | 239 | void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val); |
| 240 | void sunxi_gpio_set_cfgpin(u32 pin, u32 val); |
| 241 | int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset); |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 242 | int sunxi_gpio_get_cfgpin(u32 pin); |
| 243 | int sunxi_gpio_set_drv(u32 pin, u32 val); |
| 244 | int sunxi_gpio_set_pull(u32 pin, u32 val); |
Paul Kocialkowski | d390d8c | 2015-03-22 18:12:23 +0100 | [diff] [blame] | 245 | int sunxi_name_to_gpio_bank(const char *name); |
Ian Campbell | af47147 | 2014-06-05 19:00:15 +0100 | [diff] [blame] | 246 | int sunxi_name_to_gpio(const char *name); |
| 247 | #define name_to_gpio(name) sunxi_name_to_gpio(name) |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 248 | |
Hans de Goede | 3ae1d13 | 2015-04-25 17:25:14 +0200 | [diff] [blame] | 249 | #if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO |
| 250 | int axp_gpio_init(void); |
| 251 | #else |
| 252 | static inline int axp_gpio_init(void) { return 0; } |
| 253 | #endif |
| 254 | |
Ian Campbell | b2765ec | 2014-05-05 11:52:24 +0100 | [diff] [blame] | 255 | #endif /* _SUNXI_GPIO_H */ |