Skip to contentSkip to conversation

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

PATCH Superseded Andrew Bradford 3 participants 10 messages Oct 25, 2012 – Nov 2, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

v4 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 v3:
* Patch 4/4 simplified further.
Changes from v2:
* Patch 4/4 cleaned up to define CONS_INDEX and SERIALX in the target options.
Changes from v1:
* Reduced from 6 patches to 4.
* 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                                   |    7 +++-
 drivers/serial/serial_ns16550.c              |   36 +++++++++++++++--
 include/configs/am335x_evm.h                 |   12 +++---
 7 files changed, 158 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v4 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 v3:
No changes
Changes from v2:
No changes
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 v4 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 v3:
No changes
Changes from v2:
No changes
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 v4 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 v3:
No changes
Changes from v2:
No changes
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 v4 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.

Modify target for am335x_evm to include SERIAL1 and CONS_INDEX=1 options in order to clarify UART selection requirements.

---
Changes from v3:
All am335x_evm targets get SERIALX without a 1 and CONS_INDEX=X defined in boards.cfg. am335x_evm.h no longer define any CONFIG_SERIALX or CONFIG_CONS_INDEX.
Changes from v2:
Set CONS_INDEX and SERIALX in the target options instead of using AM33XX_UART_SELECT resulting in an easier to read config.
Changes from v1:
Add UART3 target and register location.

 boards.cfg                   |    7 ++++++-
 include/configs/am335x_evm.h |   12 +++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
boards.cfg +6 -1
index b14a08f..4047966 100644
@@ -225,7 +225,12 @@ versatileqemu                arm         arm926ejs   versatile           armltd
 integratorap_cm946es         arm         arm946es    integrator          armltd         -               integratorap:CM946ES
 integratorcp_cm946es         arm         arm946es    integrator          armltd         -               integratorcp:CM946ES
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
-am335x_evm                   arm         armv7       am335x              ti             am33xx
+am335x_evm                   arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL1,CONS_INDEX=1
+am335x_evm_uart1             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL2,CONS_INDEX=2
+am335x_evm_uart2             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL3,CONS_INDEX=3
+am335x_evm_uart3             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL4,CONS_INDEX=4
+am335x_evm_uart4             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL5,CONS_INDEX=5
+am335x_evm_uart5             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL6,CONS_INDEX=6
 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 +7 -5
index 339d4bd..e822d25 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,7 @@
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 110, 300, 600, 1200, 2400, \
 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
 
-/*
- * select serial console configuration
- */
-#define CONFIG_SERIAL1			1
-#define CONFIG_CONS_INDEX		1
+#define CONFIG_ENV_OVERWRITE		1
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
 
 #define CONFIG_ENV_IS_NOWHERE
Signature · 1 line
1.7.10.4
#5 lore raw

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

In reply to Andrew Bradford

... on AM335x IDK board with console on UART3.

Matthias

Quoted 28 lines · Andrew Bradford

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 v3:
* Patch 4/4 simplified further.
Changes from v2:
* Patch 4/4 cleaned up to define CONS_INDEX and SERIALX in the target options.
Changes from v1:
* Reduced from 6 patches to 4.
* 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                                   |    7 +++-
 drivers/serial/serial_ns16550.c              |   36 +++++++++++++++--
 include/configs/am335x_evm.h                 |   12 +++---
 7 files changed, 158 insertions(+), 10 deletions(-)

-------------------------------------------------------------

#6 lore raw

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

In reply to Andrew Bradford

Andrew,

can you rebase your series? arch/arm/cpu/armv7/am33xx/board.c has been moved to board/ti/am335x.

I expect w/o this it won't get applied, right?

Matthias

Quoted 28 lines · Andrew Bradford

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 v3:
* Patch 4/4 simplified further.
Changes from v2:
* Patch 4/4 cleaned up to define CONS_INDEX and SERIALX in the target options.
Changes from v1:
* Reduced from 6 patches to 4.
* 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                                   |    7 +++-
 drivers/serial/serial_ns16550.c              |   36 +++++++++++++++--
 include/configs/am335x_evm.h                 |   12 +++---
 7 files changed, 158 insertions(+), 10 deletions(-)
Signature · 17 lines
------------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs
Head of System Design

esd electronic system design gmbh
Vahrenwalder Str. 207 - 30165 Hannover - GERMANY
Phone: +49-511-37298-0 - Fax: +49-511-37298-68
Please visit our homepage http://www.esd.eu
Quality Products - Made in Germany

Besuchen Sie uns auf der SPS/IPC/DRIVES 2012
in Halle 6, Stand 436
vom 27.-29. November 2012 in N?rnberg !
-----------------------------------------------------------------------
Gesch?ftsf?hrer: Klaus Detering
Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832
-------------------------------------------------------------------------
#7 lore raw

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

Quoted 2 lines · On Fri, 02 Nov 2012 14:05:23 +0100 Matthias Fuchs <[email protected]> wrote:

can you rebase your series? arch/arm/cpu/armv7/am33xx/board.c has been moved to board/ti/am335x.

Yes, I will send a v5 patch series to support u-boot/master changes early next week. Time has not permitted me to do so this week, sorry.

-Andrew

#8 lore raw

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

Quoted 8 lines · Andrew Bradford
Quoted 2 lines · On Fri, 02 Nov 2012 14:05:23 +0100 Matthias Fuchs <[email protected]> wrote:

can you rebase your series? arch/arm/cpu/armv7/am33xx/board.c has been moved to board/ti/am335x.

Yes, I will send a v5 patch series to support u-boot/master changes early next week. Time has not permitted me to do so this week, sorry.

Actually, it was a trivial move and I've got this queued locally, just waiting on the warning fix patch I had posted a little longer before doing a pull request.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121102/26944c88/attachment.pgp>
#9 lore raw

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

In reply to Andrew Bradford
Quoted 19 lines · Andrew Bradford

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 v3:
* Patch 4/4 simplified further.
Changes from v2:
* Patch 4/4 cleaned up to define CONS_INDEX and SERIALX in the target options.
Changes from v1:
* Reduced from 6 patches to 4.
* 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}

Quoted 8 lines
 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                                   |    7 +++-
 drivers/serial/serial_ns16550.c              |   36 +++++++++++++++--
 include/configs/am335x_evm.h                 |   12 +++---
 7 files changed, 158 insertions(+), 10 deletions(-)

Applied to u-boot-ti/master with the easy fixup for board/ti/am335x/board.c instead, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121102/8d4bb367/attachment.pgp>