From: Mike Frysinger Date: Wed, 23 Nov 2011 18:40:23 -0500 Subject: [U-Boot] [PATCH 4/6] tegra: Add support for UART init in cpu board.c In-Reply-To: <1322089148-2810-5-git-send-email-sjg@chromium.org> References: <1322089148-2810-1-git-send-email-sjg@chromium.org> <1322089148-2810-5-git-send-email-sjg@chromium.org> Message-ID: <201111231840.24573.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday 23 November 2011 17:59:06 Simon Glass wrote: > --- a/arch/arm/cpu/armv7/tegra2/board.c > +++ b/arch/arm/cpu/armv7/tegra2/board.c > > +static void setup_uarts(int uart_ids) > +{ > + static enum periph_id id_for_uart[UART_COUNT] = { > + PERIPH_ID_UART1, > + PERIPH_ID_UART2, > + PERIPH_ID_UART3, > + PERIPH_ID_UART4, > + }; does this need the [UART_COUNT] ? what if you used "[]" ... > + int i; size_t > + for (i = 0; i < UART_COUNT; i++) { ... and then did ARRAY_SIZE(id_for_uart) ? > +void board_init_uart_f(void) > +{ > + int uart_ids = 0; /* bit mask of which UART ids to enable */ > + > +#ifdef CONFIG_TEGRA2_ENABLE_UARTA > + uart_ids |= UARTA; > +#endif > +#ifdef CONFIG_TEGRA2_ENABLE_UARTB > + uart_ids |= UARTB; > +#endif > +#ifdef CONFIG_TEGRA2_ENABLE_UARTD > + uart_ids |= UARTD; > +#endif > + setup_uarts(uart_ids); > +} we added a func in the Blackfin pinmux API where you could pass it a list of peripherals to mux. so you could do: static const unsigned pin_list[] = { #ifdef CONFIG_TEGRA2_ENABLE_UARTA UART1, #endif 0, }; pinmux_request_list(pin_list); and the list version would just walk the 0-terminated array calling pinmux_request() automatically -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: