EXYNOS: SMDK5250: Support all 4 UARTs
PATCH 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
This properly configures the mux to enable the right UART depending on the setting of CONFIG_SERIALX.
This also fixes things so that we don't configure balls XUCTSN_1 and XURTSN_1 as UART1 configuration (RTS/CTS), since they aren't connected.
--- board/samsung/smdk5250/smdk5250.c | 49 +++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 2 deletions(-)
board/samsung/smdk5250/smdk5250.c +47 -2
@@ -224,11 +224,56 @@ static void board_uart_init(void) (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1 ();int i; -/* 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 }#ifdef CONFIG_BOARD_EARLY_INIT_F
Signature · 1 line
1.7.7.3
PATCH 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
Quoted 66 lines
This properly configures the mux to enable the right UART depending on the setting of
CONFIG_SERIALX.This also fixes things so that we don't configure balls
XUCTSN_1andXURTSN_1as UART1 configuration (RTS/CTS), since they aren't connected.Signed-off-by Doug Anderson <[email protected]>--- board/samsung/smdk5250/smdk5250.c | 49+++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 2 deletions(-)
(quoted diff) +0
-0
b/board/samsung/smdk5250/smdk5250.cindex 928c08f..61b8634 100644board/samsung/smdk5250/smdk5250.c +40
-2@@ -224,11 +224,56 @@ static void board_uart_init(void) (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1 ();int i; -/* 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 )
board/samsung/smdk5250/smdk5250.c static void board_uart_init(void) · line 279
Quoted 10 lines
board/samsung/smdk5250/smdk5250.c +7
-0+/* +* 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 }#ifdef CONFIG_BOARD_EARLY_INIT_F
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?
M
PATCH 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
Quoted 50 lines · On Saturday 11 February 2012 02:08:33 Marek Vasut wrote:
Quoted 50 lines
board/samsung/smdk5250/smdk5250.c +42
-2-/* 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
Quoted 8 lines
board/samsung/smdk5250/smdk5250.c static void board_uart_init(void) · line 276
Quoted 5 lines
board/samsung/smdk5250/smdk5250.c +5
-0+*/ +#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
-------------- 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: <http://lists.denx.de/pipermail/u-boot/attachments/20120214/f19372ef/attachment.pgp>
PATCH 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
Mike,
Quoted 8 lines · Mike Frysinger
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.
Quoted 6 lines
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
...
In the case of the smdk5250, all of the above pinmuxes are safe to always configure as UART. ...and since this pinmux is in a board-specific file (as opposed to generic exynos code), I think it's OK to remove the ifdefs.
Eventually this still will change with device tree work, but until then I think the v2 patch is a reasonable way to do things and does allow all the serial ports to work.
Thanks!
-Doug
PATCH v2 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
In reply to Doug AndersonThis properly configures the mux to enable all UARTs.
This also fixes things so that we don't configure balls XUCTSN_1 and XURTSN_1 as UART1 configuration (RTS/CTS), since they aren't connected.
---
Changes in v2:
- Removed #ifdefs and tested SERIAL_MULTI by setting stdin/out/err to s5pserN and validating that serial moved.
board/samsung/smdk5250/smdk5250.c | 44 +++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 2 deletions(-)
board/samsung/smdk5250/smdk5250.c +42 -2
@@ -224,11 +224,51 @@ static void board_uart_init(void) (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1 ();int i; -/* UART1 GPIOs (part1) : GPA0CON[7:4] 0x2222 */ -for (i =4 ; i <8 ; i++) { +/* +* 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 )); } + +/* +* 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 resistor 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 )); + } + +/* +* 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 resistor 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 )); + } + +/* +* 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 )); + } + +/* +* There's no mux for UART4--it's internal only +*/ }#ifdef CONFIG_BOARD_EARLY_INIT_F
Signature · 1 line
1.7.7.3
PATCH v2 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
Quoted 72 lines · Doug Anderson
This properly configures the mux to enable all UARTs.
This also fixes things so that we don't configure balls
XUCTSN_1andXURTSN_1as UART1 configuration (RTS/CTS), since they aren't connected.Signed-off-by Doug Anderson <[email protected]>---
Changes in v2:
- Removed #ifdefs and testedSERIAL_MULTIby setting stdin/out/err to s5pserN and validating that serial moved.?board/samsung/smdk5250/smdk5250.c | ? 44 +++++++++++++++++++++++++++++++++++- ?1 files changed, 42 insertions(+), 2 deletions(-)
board/samsung/smdk5250/smdk5250.c +42
-2@@ -224,11 +224,51 @@ static void board_uart_init(void) ? ? ? ? ? ? ? ?(struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1(); ? ? ? ?int i; - ? ? ? /* UART1 GPIOs (part1) : GPA0CON[7:4] 0x2222 */ - ? ? ? for (i = 4; i < 8; i++) { + ? ? ? /* + ? ? ? ?* 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)); ? ? ? ?} + + ? ? ? /* + ? ? ? ?* 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 resistor 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)); + ? ? ? } + + ? ? ? /* + ? ? ? ?* 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 resistor 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)); + ? ? ? } + + ? ? ? /* + ? ? ? ?* 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)); + ? ? ? } + + ? ? ? /* + ? ? ? ?* There's no mux for UART4--it's internal only + ? ? ? ?*/ ?}
Quoted 4 lines
?#ifdef
CONFIG_BOARD_EARLY_INIT_F
--
1.7.7.3
Signature · 2 lines
with warm regards, Chander Kashyap
PATCH v2 1/1 EXYNOS: SMDK5250: Support all 4 UARTs
Dear Doug Anderson,
Quoted 13 lines · Chander Kashyap
Quoted 12 lines · Doug Anderson
This properly configures the mux to enable all UARTs.
This also fixes things so that we don't configure balls
XUCTSN_1andXURTSN_1as UART1 configuration (RTS/CTS), since they aren't connected.Signed-off-by Doug Anderson <[email protected]>---
Changes in v2:
- Removed #ifdefs and testedSERIAL_MULTIby setting stdin/out/err to s5pserN and validating that serial moved.
Quoted 3 lines
Quoted 3 lines
?board/samsung/smdk5250/smdk5250.c | ? 44 +++++++++++++++++++++++++++++++++++- ?1 files changed, 42 insertions(+), 2 deletions(-)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net