From a90949661214a14a5f299181267db45a67b6b81e Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Tue, 28 Aug 2012 14:14:06 -0700 Subject: stm32f: remove gpio_set_alternate_function() gpio_set_alternate_function() for STM32F is not used, and even if it were it would be incorrect. So for now it just takes up space. Unlike STM32L, alternate functions rely on toggling bits in AFIO remapping registers rather than setting a simple AF number. This would make writing a working version of this function trickier, and it may not be worth the effort. Signed-off-by: David Hendricks BRANCH=snow BUG=none TEST=locally compiled for snow Change-Id: I2ce1e7aba2760a94819500af4e322812f3346ad3 Reviewed-on: https://gerrit.chromium.org/gerrit/31630 Reviewed-by: Vincent Palatin Commit-Ready: David Hendricks Tested-by: David Hendricks --- chip/stm32/gpio-stm32f100.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/chip/stm32/gpio-stm32f100.c b/chip/stm32/gpio-stm32f100.c index 0cc79a0856..2641db612c 100644 --- a/chip/stm32/gpio-stm32f100.c +++ b/chip/stm32/gpio-stm32f100.c @@ -153,43 +153,6 @@ int gpio_init(void) DECLARE_HOOK(HOOK_INIT, gpio_init, HOOK_PRIO_DEFAULT); -void gpio_set_alternate_function(int port, int mask, int func) -{ - int i; - const struct gpio_info *g = gpio_list; - uint32_t addr, cnf, mode, val = 0; - - /* - * TODO(dhendrix): STM32 GPIO registers do not have free-form - * alternate function setup like the STM32, where each pin can - * be configured for any alternate function (though not necessarily - * in a valid fashion). Instead, pre-determined sets of pins for a - * a given alternate function are chosen via a remapping register. - * - * Consequently, this function becomes very simple and can (should?) - * be merged into gpio_pre_init. - */ - for (i = 0; i < GPIO_COUNT; i++, g++) { - if ((g->port != port) || (g->mask != mask)) - continue; - - gpio_config_info(g, &addr, &mode, &cnf); - val = REG32(addr) & ~cnf; - - /* switch from general output to alternate output mode */ - if (g->flags & GPIO_OUTPUT) { - if (g->flags & GPIO_OPEN_DRAIN) - val |= 0xcccccccc & cnf; - else - val |= 0x88888888 & cnf; - } - - REG32(addr) = val ; - break; - } -} - - uint16_t *gpio_get_level_reg(enum gpio_signal signal, uint32_t *mask) { *mask = gpio_list[signal].mask; -- cgit v1.2.1