
On Saturday 11 February 2012 02:08:33 Marek Vasut wrote:
--- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c
- /* UART1 GPIOs (part1) : GPA0CON[7:4] 0x2222 */
- for (i = 4; i < 8; i++) {
+#if defined(CONFIG_SERIAL0)
- /*
* UART0 GPIOs : GPA0CON[3:0] 0x2222
* Must set CFG17 switches to select UART0 to use.
*/
- for (i = 0; i <= 3; i++) { s5p_gpio_set_pull(&gpio1->a0, i, GPIO_PULL_NONE); s5p_gpio_cfg_pin(&gpio1->a0, i, GPIO_FUNC(0x2)); }
+#elif defined(CONFIG_SERIAL1)
- /*
* UART1 GPIOs : GPA0CON[5:4] 0x22
* Must set CFG17 switches to select UART1 to use.
*
* This only sets RXD/TXD, as RTS/CTS need a resister soldered down
* in order to use them (so that those pins can be used for I2C).
*/
- for (i = 4; i <= 5; i++) {
s5p_gpio_set_pull(&gpio1->a0, i, GPIO_PULL_NONE);
s5p_gpio_cfg_pin(&gpio1->a0, i, GPIO_FUNC(0x2));
- }
+#elif defined(CONFIG_SERIAL2)
- /*
* UART2 GPIOs : GPA1CON[1:0] 0x22
* Must set CFG17 switches to select UART2 to use.
*
* This only sets RXD/TXD, as RTS/CTS need a resister soldered down
* in order to use them (so that those pins can be used for I2C).
*/
- for (i = 0; i <= 1; i++) {
s5p_gpio_set_pull(&gpio1->a1, i, GPIO_PULL_NONE);
s5p_gpio_cfg_pin(&gpio1->a1, i, GPIO_FUNC(0x2));
- }
+#elif defined(CONFIG_SERIAL3)
- /*
* UART3 GPIOs : GPA1CON[5:4] 0x22
* Must set CFG16 switches to select UART3 to use.
*/
- for (i = 4; i <= 5; i++) {
s5p_gpio_set_pull(&gpio1->a1, i, GPIO_PULL_NONE);
s5p_gpio_cfg_pin(&gpio1->a1, i, GPIO_FUNC(0x2));
- }
+#elif defined(CONFIG_SERIAL4)
- /*
* There's no mux for UART4--it's internal only
*/
+#error "Can't set console to serial 4--it's not exposed" +#else +#error "Unknown serial config" +#endif
Uhm ... CONFIG_SERIAL_MULTI? Also, you can configure the mux just like that, without all this macro crap, can't you? Why not do it like that?
i don't know the exynos5 pinmux specifics, but speaking in general, you shouldn't go configuring pins directly if the user hasn't asked for them. config multi would be useful because then the pinmux logic would be in a uart- specific init func and we wouldn't need ifdefs. when the user says "use uart# as my i/o device", we know we should configure the pinmuxes for that.
the uart1 above looks like a good example ... the pins can be UART1 or I2C. we shouldn't go blasting them all to UART1 ...
Doug can speak to the exact pinrouting setup that the smdk5250 board has ... -mike