Skip to contentSkip to conversation

am335x_evm: Enable UART{1,2,3,4,5}

PATCH Superseded Andrew Bradford 1 participant 6 messages Oct 22, 2012 – Oct 24, 2012 Arm (32-bit)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover am335x_evm: Enable UART{1,2,3,4,5}

To support serial ports other than UART0 on am335x based systems like the Beaglebone with the RS232 cape and am335x_evm with daughterboard.

Changes from v1:
Reworked on Marek Vasut's serial changes.
Added UART3 for am335x_evm profile 5.

Andrew Bradford (4):
am33xx: Enable UART{1,2,3,4,5} clocks
am33xx: Enable UART{1,2,3,4,5} pin-mux
serial: ns16550: Enable COM5 and COM6
am335x_evm: Enable use of UART{1,2,3,4,5}

 arch/arm/cpu/armv7/am33xx/board.c            |   17 ++++++++
 arch/arm/cpu/armv7/am33xx/clock.c            |   35 +++++++++++++++++
 arch/arm/include/asm/arch-am33xx/sys_proto.h |    7 +++-
 board/ti/am335x/mux.c                        |   54 ++++++++++++++++++++++++++
 boards.cfg                                   |    5 +++
 drivers/serial/serial_ns16550.c              |   36 +++++++++++++++--
 include/configs/am335x_evm.h                 |   33 +++++++++++++++-
 7 files changed, 182 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/4 am33xx: Enable UART{1,2,3,4,5} clocks

If configured to use UART{1,2,3,4,5} such as on the Beaglebone RS232 cape or the am335x_evm daughterboard, enable the required clocks for the UART in use.

---
Changes from v1:
Also enable UART3 clocks

 arch/arm/cpu/armv7/am33xx/clock.c |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/cpu/armv7/am33xx/clock.c +35 -0
index 2b19506..b34f969 100644
@@ -114,6 +114,41 @@ static void enable_per_clocks(void)
 	while (readl(&cmwkup->wkup_uart0ctrl) != PRCM_MOD_EN)
 		;
 
+	/* UART1 */
+#ifdef CONFIG_SERIAL2
+	writel(PRCM_MOD_EN, &cmper->uart1clkctrl);
+	while (readl(&cmper->uart1clkctrl) != PRCM_MOD_EN)
+		;
+#endif /* CONFIG_SERIAL2 */
+
+	/* UART2 */
+#ifdef CONFIG_SERIAL3
+	writel(PRCM_MOD_EN, &cmper->uart2clkctrl);
+	while (readl(&cmper->uart2clkctrl) != PRCM_MOD_EN)
+		;
+#endif /* CONFIG_SERIAL3 */
+
+	/* UART3 */
+#ifdef CONFIG_SERIAL4
+	writel(PRCM_MOD_EN, &cmper->uart3clkctrl);
+	while (readl(&cmper->uart3clkctrl) != PRCM_MOD_EN)
+		;
+#endif /* CONFIG_SERIAL4 */
+
+	/* UART4 */
+#ifdef CONFIG_SERIAL5
+	writel(PRCM_MOD_EN, &cmper->uart4clkctrl);
+	while (readl(&cmper->uart4clkctrl) != PRCM_MOD_EN)
+		;
+#endif /* CONFIG_SERIAL5 */
+
+	/* UART5 */
+#ifdef CONFIG_SERIAL6
+	writel(PRCM_MOD_EN, &cmper->uart5clkctrl);
+	while (readl(&cmper->uart5clkctrl) != PRCM_MOD_EN)
+		;
+#endif /* CONFIG_SERIAL6 */
+
 	/* MMC0*/
 	writel(PRCM_MOD_EN, &cmper->mmc0clkctrl);
 	while (readl(&cmper->mmc0clkctrl) != PRCM_MOD_EN)
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/4 am33xx: Enable UART{1,2,3,4,5} pin-mux

In reply to Andrew Bradford

If configured to use UART{1,2,3,4,5} such as on the Beaglebone RS232 cape or on the am335x_evm daughterboard, enable the proper pin-muxing.

---
Changes from v1:
Also enable UART3 pin mux

 arch/arm/cpu/armv7/am33xx/board.c            |   17 ++++++++
 arch/arm/include/asm/arch-am33xx/sys_proto.h |    7 +++-
 board/ti/am335x/mux.c                        |   54 ++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/am33xx/board.c +17 -0
index 978b184..e324265 100644
@@ -152,7 +152,24 @@ void s_init(void)
 	/* UART softreset */
 	u32 regVal;
 
+#ifdef CONFIG_SERIAL1
 	enable_uart0_pin_mux();
+#endif /* CONFIG_SERIAL1 */
+#ifdef CONFIG_SERIAL2
+	enable_uart1_pin_mux();
+#endif /* CONFIG_SERIAL2 */
+#ifdef CONFIG_SERIAL3
+	enable_uart2_pin_mux();
+#endif /* CONFIG_SERIAL3 */
+#ifdef CONFIG_SERIAL4
+	enable_uart3_pin_mux();
+#endif /* CONFIG_SERIAL4 */
+#ifdef CONFIG_SERIAL5
+	enable_uart4_pin_mux();
+#endif /* CONFIG_SERIAL5 */
+#ifdef CONFIG_SERIAL6
+	enable_uart5_pin_mux();
+#endif /* CONFIG_SERIAL6 */
 
 	regVal = readl(&uart_base->uartsyscfg);
 	regVal |= UART_RESET;
arch/arm/include/asm/arch-am33xx/sys_proto.h +6 -1
index 819ea65..3ef1ff2 100644
@@ -53,11 +53,16 @@ void ddr_pll_config(unsigned int ddrpll_M);
 
 /*
  * We have three pin mux functions that must exist.  We must be able to enable
- * uart0, for initial output and i2c0 to read the main EEPROM.  We then have a
+ * a uart for initial output and i2c0 to read the main EEPROM.  We then have a
  * main pinmux function that can be overridden to enable all other pinmux that
  * is required on the board.
  */
 void enable_uart0_pin_mux(void);
+void enable_uart1_pin_mux(void);
+void enable_uart2_pin_mux(void);
+void enable_uart3_pin_mux(void);
+void enable_uart4_pin_mux(void);
+void enable_uart5_pin_mux(void);
 void enable_i2c0_pin_mux(void);
 void enable_board_pin_mux(struct am335x_baseboard_id *header);
 #endif
board/ti/am335x/mux.c +54 -0

66 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v2 3/4 serial: ns16550: Enable COM5 and COM6

In reply to Andrew Bradford

Increase the possible number of ns16550 serial devices from 4 to 6.

---
Changes from v1:
Consolidation of patches 3, 4, and 5 on top of Marek Vasut's recent serial changes.

 drivers/serial/serial_ns16550.c |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)
drivers/serial/serial_ns16550.c +33 -3
index b5d1248..5fb3841 100644
@@ -34,7 +34,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_CONS_INDEX)
-#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
+#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 6)
 #error	"Invalid console index value."
 #endif
 
@@ -46,12 +46,16 @@ DECLARE_GLOBAL_DATA_PTR;
 #error	"Console port 3 defined but not configured."
 #elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
 #error	"Console port 4 defined but not configured."
+#elif CONFIG_CONS_INDEX == 5 && !defined(CONFIG_SYS_NS16550_COM5)
+#error	"Console port 5 defined but not configured."
+#elif CONFIG_CONS_INDEX == 6 && !defined(CONFIG_SYS_NS16550_COM6)
+#error	"Console port 6 defined but not configured."
 #endif
 
 /* Note: The port number specified in the functions is 1 based.
  *	 the array is 0 based.
  */
-static NS16550_t serial_ports[4] = {
+static NS16550_t serial_ports[6] = {
 #ifdef CONFIG_SYS_NS16550_COM1
 	(NS16550_t)CONFIG_SYS_NS16550_COM1,
 #else
@@ -68,7 +72,17 @@ static NS16550_t serial_ports[4] = {
 	NULL,
 #endif
 #ifdef CONFIG_SYS_NS16550_COM4
-	(NS16550_t)CONFIG_SYS_NS16550_COM4
+	(NS16550_t)CONFIG_SYS_NS16550_COM4,
+#else
+	NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM5
+	(NS16550_t)CONFIG_SYS_NS16550_COM5,
+#else
+	NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM6
+	(NS16550_t)CONFIG_SYS_NS16550_COM6
 #else
 	NULL
 #endif
@@ -231,6 +245,12 @@ struct serial_device eserial3_device =
 DECLARE_ESERIAL_FUNCTIONS(4);
 struct serial_device eserial4_device =
 	INIT_ESERIAL_STRUCTURE(4, "eserial3");
+DECLARE_ESERIAL_FUNCTIONS(5);
+struct serial_device eserial5_device =
+	INIT_ESERIAL_STRUCTURE(5, "eserial4");
+DECLARE_ESERIAL_FUNCTIONS(6);
+struct serial_device eserial6_device =
+	INIT_ESERIAL_STRUCTURE(6, "eserial5");
 
 __weak struct serial_device *default_serial_console(void)
 {
@@ -242,6 +262,10 @@ __weak struct serial_device *default_serial_console(void)
 	return &eserial3_device;
 #elif CONFIG_CONS_INDEX == 4
 	return &eserial4_device;
+#elif CONFIG_CONS_INDEX == 5
+	return &eserial5_device;
+#elif CONFIG_CONS_INDEX == 6
+	return &eserial6_device;
 #else
 #error "Bad CONFIG_CONS_INDEX."
 #endif
@@ -261,4 +285,10 @@ void ns16550_serial_initialize(void)
 #if defined(CONFIG_SYS_NS16550_COM4)
 	serial_register(&eserial4_device);
 #endif
+#if defined(CONFIG_SYS_NS16550_COM5)
+	serial_register(&eserial5_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM6)
+	serial_register(&eserial6_device);
+#endif
 }
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v2 4/4 am335x_evm: Enable use of UART{1,2,3,4,5}

In reply to Andrew Bradford

Add targets of am335x_evm_uart{1,2,3,4,5} to have serial input/output on UART{1,2,3,4,5} for use with the Beaglebone RS232 cape, am335x_evm daughterboard, and other custom configurations.

---
Changes from v1:
Add UART3 target and register location

 boards.cfg                   |    5 +++++
 include/configs/am335x_evm.h |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
boards.cfg +5 -0
index df62251..0944690 100644
@@ -226,6 +226,11 @@ integratorap_cm946es         arm         arm946es    integrator          armltd
 integratorcp_cm946es         arm         arm946es    integrator          armltd         -               integratorcp:CM946ES
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
 am335x_evm                   arm         armv7       am335x              ti             am33xx
+am335x_evm_uart1             arm         armv7       am335x              ti             am33xx      am335x_evm:AM33XX_UART_SELECT=1
+am335x_evm_uart2             arm         armv7       am335x              ti             am33xx      am335x_evm:AM33XX_UART_SELECT=2
+am335x_evm_uart3             arm         armv7       am335x              ti             am33xx      am335x_evm:AM33XX_UART_SELECT=3
+am335x_evm_uart4             arm         armv7       am335x              ti             am33xx      am335x_evm:AM33XX_UART_SELECT=4
+am335x_evm_uart5             arm         armv7       am335x              ti             am33xx      am335x_evm:AM33XX_UART_SELECT=5
 highbank                     arm         armv7       highbank            -              highbank
 mx51_efikamx                 arm         armv7       mx51_efikamx        genesi         mx5		mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg
 mx51_efikasb                 arm         armv7       mx51_efikamx        genesi         mx5		mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg
include/configs/am335x_evm.h +32 -1
index 339d4bd..d138e45 100644
@@ -158,9 +158,15 @@
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		(48000000)
 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
+#define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
+#define CONFIG_SYS_NS16550_COM3		0x48024000	/* UART2 */
+#define CONFIG_SYS_NS16550_COM4		0x481a6000	/* UART3 */
+#define CONFIG_SYS_NS16550_COM5		0x481a8000	/* UART4 */
+#define CONFIG_SYS_NS16550_COM6		0x481aa000	/* UART5 */
 
 /* I2C Configuration */
 #define CONFIG_I2C
@@ -182,11 +188,36 @@
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 110, 300, 600, 1200, 2400, \
 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
 
+#define CONFIG_ENV_OVERWRITE		1
+
 /*
- * select serial console configuration
+ * select serial console configuration, uart0 always enabled
  */
 #define CONFIG_SERIAL1			1
+#ifndef CONFIG_AM33XX_UART_SELECT
 #define CONFIG_CONS_INDEX		1
+#endif /* CONFIG_AM33XX_UART_SELECT */
+
+#if CONFIG_AM33XX_UART_SELECT == 1
+#define CONFIG_SERIAL2			1
+#define CONFIG_CONS_INDEX		2
+#endif /* CONFIG_AM33XX_UART_SELECT == 1 */
+#if CONFIG_AM33XX_UART_SELECT == 2
+#define CONFIG_SERIAL3			1
+#define CONFIG_CONS_INDEX		3
+#endif /* CONFIG_AM33XX_UART_SELECT == 2 */
+#if CONFIG_AM33XX_UART_SELECT == 3
+#define CONFIG_SERIAL4			1
+#define CONFIG_CONS_INDEX		4
+#endif /* CONFIG_AM33XX_UART_SELECT == 3 */
+#if CONFIG_AM33XX_UART_SELECT == 4
+#define CONFIG_SERIAL5			1
+#define CONFIG_CONS_INDEX		5
+#endif /* CONFIG_AM33XX_UART_SELECT == 4 */
+#if CONFIG_AM33XX_UART_SELECT == 5
+#define CONFIG_SERIAL6			1
+#define CONFIG_CONS_INDEX		6
+#endif /* CONFIG_AM33XX_UART_SELECT == 5 */
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
 
 #define CONFIG_ENV_IS_NOWHERE
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v2 4/4 am335x_evm: Enable use of UART{1, 2, 3, 4, 5}

Quoted 85 lines · On Mon, 22 Oct 2012 15:23:29 -0400 Andrew Bradford…

Add targets of am335x_evm_uart{1,2,3,4,5} to have serial input/output on UART{1,2,3,4,5} for use with the Beaglebone RS232 cape, am335x_evm daughterboard, and other custom configurations.

---
Changes from v1:
Add UART3 target and register location

 boards.cfg                   |    5 +++++
 include/configs/am335x_evm.h |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
boards.cfg +0 -0
index df62251..0944690 100644
@@ -226,6 +226,11 @@ integratorap_cm946es         arm

arm946es integrator armltd integratorcp_cm946es
arm arm946es integrator armltd
- integratorcp:CM946ES ca9x4_ct_vxp
arm armv7 vexpress armltd
am335x_evm arm armv7
am335x ti am33xx
+am335x_evm_uart1 arm armv7
am335x ti am33xx
am335x_evm:AM33XX_UART_SELECT=1 +am335x_evm_uart2
arm armv7 am335x ti
am33xx am335x_evm:AM33XX_UART_SELECT=2
+am335x_evm_uart3 arm armv7
am335x ti am33xx
am335x_evm:AM33XX_UART_SELECT=3 +am335x_evm_uart4
arm armv7 am335x ti
am33xx am335x_evm:AM33XX_UART_SELECT=4
+am335x_evm_uart5 arm armv7
am335x ti am33xx
am335x_evm:AM33XX_UART_SELECT=5 highbank
arm armv7 highbank - highbank
mx51_efikamx arm armv7
mx51_efikamx genesi mx5
mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg
mx51_efikasb arm armv7
mx51_efikamx genesi mx5
mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg

(quoted diff) +0 -0

b/include/configs/am335x_evm.h index 339d4bd..d138e45 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -158,9 +158,15 @@ /* NS16550 Configuration */ #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL +#define
CONFIG_SERIAL_MULTI #define CONFIG_SYS_NS16550_REG_SIZE (-4)
#define CONFIG_SYS_NS16550_CLK (48000000) #define
CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM
has UART0 */ +#define CONFIG_SYS_NS16550_COM2
0x48022000 /* UART1 */ +#define
CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
+#define CONFIG_SYS_NS16550_COM4 0x481a6000 /*
UART3 */ +#define CONFIG_SYS_NS16550_COM5
0x481a8000 /* UART4 */ +#define
CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5
*/ /* I2C Configuration */ #define CONFIG_I2C @@ -182,11 +188,36 @@
#define CONFIG_SYS_BAUDRATE_TABLE { 110, 300, 600, 1200, 2400,
\ 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }

boards.cfg +18 -1
+#define CONFIG_ENV_OVERWRITE		1 + /*
- * select serial console configuration
+ * select serial console configuration, uart0 always enabled
  */
 #define CONFIG_SERIAL1			1
+#ifndef CONFIG_AM33XX_UART_SELECT
 #define CONFIG_CONS_INDEX		1
+#endif /* CONFIG_AM33XX_UART_SELECT */
+
+#if CONFIG_AM33XX_UART_SELECT == 1
+#define CONFIG_SERIAL2			1
+#define CONFIG_CONS_INDEX		2
+#endif /* CONFIG_AM33XX_UART_SELECT == 1 */
+#if CONFIG_AM33XX_UART_SELECT == 2
+#define CONFIG_SERIAL3			1
+#define CONFIG_CONS_INDEX		3
+#endif /* CONFIG_AM33XX_UART_SELECT == 2 */
+#if CONFIG_AM33XX_UART_SELECT == 3
+#define CONFIG_SERIAL4			1
+#define CONFIG_CONS_INDEX		4
+#endif /* CONFIG_AM33XX_UART_SELECT == 3 */
+#if CONFIG_AM33XX_UART_SELECT == 4

boards.cfg

Quoted 10 lines
boards.cfg +7 -0
+#define CONFIG_SERIAL5			1
+#define CONFIG_CONS_INDEX		5
+#endif /* CONFIG_AM33XX_UART_SELECT == 4 */
+#if CONFIG_AM33XX_UART_SELECT == 5
+#define CONFIG_SERIAL6			1
+#define CONFIG_CONS_INDEX		6
+#endif /* CONFIG_AM33XX_UART_SELECT == 5 */
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
 
 #define CONFIG_ENV_IS_NOWHERE

Having all of this in include/configs/am335x_evm.h is rather ugly and hard to read. I have a v3 cleanup patchset coming shortly to fix this by just setting SERIALX and CONS_INDEX in the boards.cfg. It's much easier to read.

Please do not apply this v2 series.

Thanks,
Andrew