gpio: stm32: introduce alternative function config
STM32F4 requires the alternative function config to be set, so just initialize that as part of the gpio configure call. Change-Id: I33a4a8efec59c5ebe7dc3f3580f0dd2bf7ded7f4 Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
This commit is contained in:
parent
3bdc77ee09
commit
a9f2061dfb
4 changed files with 8 additions and 6 deletions
|
@ -107,7 +107,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int stm32_gpio_configure(uint32_t *base_addr, int pin, int conf)
|
||||
int stm32_gpio_configure(uint32_t *base_addr, int pin, int conf, int altf)
|
||||
{
|
||||
volatile struct stm32f10x_gpio *gpio =
|
||||
(struct stm32f10x_gpio *)(base_addr);
|
||||
|
|
|
@ -69,7 +69,7 @@ static int gpio_stm32_config(struct device *dev, int access_op,
|
|||
return map_res;
|
||||
}
|
||||
|
||||
if (stm32_gpio_configure(cfg->base, pin, pincfg)) {
|
||||
if (stm32_gpio_configure(cfg->base, pin, pincfg, 0)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@ int stm32_gpio_flags_to_conf(int flags, int *conf);
|
|||
* @param base_addr GPIO port base address
|
||||
* @param pin IO pin
|
||||
* @param func GPIO mode
|
||||
* @param altf Alternate function
|
||||
*/
|
||||
int stm32_gpio_configure(uint32_t *base_addr, int pin, int func);
|
||||
int stm32_gpio_configure(uint32_t *base_addr, int pin, int func, int altf);
|
||||
|
||||
/**
|
||||
* @brief helper for setting of GPIO pin output
|
||||
|
|
|
@ -52,7 +52,7 @@ static int enable_port(uint32_t port, struct device *clk)
|
|||
return clock_control_on(clk, subsys);
|
||||
}
|
||||
|
||||
static int stm32_pin_configure(int pin, int func)
|
||||
static int stm32_pin_configure(int pin, int func, int altf)
|
||||
{
|
||||
/* determine IO port registers location */
|
||||
uint32_t offset = STM32_PORT(pin) * GPIO_REG_SIZE;
|
||||
|
@ -61,7 +61,8 @@ static int stm32_pin_configure(int pin, int func)
|
|||
/* not much here, on STM32F10x the alternate function is
|
||||
* controller by setting up GPIO pins in specific mode.
|
||||
*/
|
||||
return stm32_gpio_configure((uint32_t *)port_base, STM32_PIN(pin), func);
|
||||
return stm32_gpio_configure((uint32_t *)port_base,
|
||||
STM32_PIN(pin), func, altf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +87,7 @@ int _pinmux_stm32_set(uint32_t pin, uint32_t func,
|
|||
/* determine config for alternate function */
|
||||
config = stm32_get_pin_config(pin, func);
|
||||
|
||||
return stm32_pin_configure(pin, config);
|
||||
return stm32_pin_configure(pin, config, func);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue