diff options
author | Guodong Liu <guodong.liu@mediatek.corp-partner.google.com> | 2022-02-21 20:22:40 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-03-09 14:31:02 +0000 |
commit | ada2a63dabe566b1cb8ebb9d909fa2c07f296136 (patch) | |
tree | 7ad6339859d63d5c9f692874b5e7ebdcf91e2815 /src/soc/mediatek/common/include | |
parent | 6555c4c6017bcd3255611dfef36508cd8e132f65 (diff) |
soc/mediatek/mt8186: Add GPIO driving functions
Add GPIO driving functions to adjust pin driving.
The value of drive strength is different for each SoC, so we define
GPIO_DRV0 to GPIO_DRV7 which are corresponding to 2/4/6/8/10/12/14/16mA
in MT8186.
This implementation is according to chapter 5.1 in MT8186 Functional
Specification.
BUG=b:218775654, b:216462313, b:212375511
TEST=build pass
Signed-off-by: Guodong Liu <guodong.liu@mediatek.corp-partner.google.com>
Change-Id: I6d987f28be98b515fa5c542222bda08bea1d5118
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62471
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/mediatek/common/include')
-rw-r--r-- | src/soc/mediatek/common/include/soc/gpio_common.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/soc/mediatek/common/include/soc/gpio_common.h b/src/soc/mediatek/common/include/soc/gpio_common.h index 283cf94561..097c2b9525 100644 --- a/src/soc/mediatek/common/include/soc/gpio_common.h +++ b/src/soc/mediatek/common/include/soc/gpio_common.h @@ -18,10 +18,39 @@ enum pull_select { GPIO_PULL_UP = 1, }; +/* + * GPIO DRIVING + * Special IO(I2C, HDMI...) advanced drive strength: + * GPIO_DRV_ADV_125_UA: 0.125mA + * GPIO_DRV_ADV_250_UA: 0.25mA + * GPIO_DRV_ADV_500_UA: 0.5mA + * GPIO_DRV_ADV_1_MA: 1mA + */ +enum gpio_drv_adv { + GPIO_DRV_ADV_125_UA = 0, + GPIO_DRV_ADV_250_UA = 1, + GPIO_DRV_ADV_500_UA = 2, + GPIO_DRV_ADV_1_MA = 3, +}; + +struct gpio_drv_info { + uint32_t offset; + uint8_t shift; + uint8_t width; +}; + void gpio_set_pull(gpio_t gpio, enum pull_enable enable, enum pull_select select); void gpio_set_mode(gpio_t gpio, int mode); +/* Normal driving function */ +int gpio_set_driving(gpio_t gpio, uint8_t drv); +int gpio_get_driving(gpio_t gpio); + +/* Advanced driving function */ +int gpio_set_driving_adv(gpio_t gpio, enum gpio_drv_adv drv); +int gpio_get_driving_adv(gpio_t gpio); + enum gpio_irq_type { IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, |