Skip to contentSkip to conversation

Add UART base addresses for additional UARTs

PATCH New Landheer-Cieslak 3 participants 4 messages Oct 25, 2017 – Nov 17, 2017 Arm (32-bit)

lore
Share & tools
lore

Landheer-Cieslak

#0 lore raw

PATCH 1/1 Add UART base addresses for additional UARTs

UARTs 1 through 5 were missing in the code - added.
Also pick the default according to the configuration setting for the console index.

---
 arch/arm/include/asm/arch-am33xx/hardware.h        | 14 +++++++++++++-
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |  5 +++++
 2 files changed, 18 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-am33xx/hardware.h +13 -1
index dd950e5..873098e 100644
@@ -53,7 +53,19 @@
 #define DDR_CONTROL_BASE_ADDR		0x44E11404
 
 /* UART */
-#define DEFAULT_UART_BASE		UART0_BASE
+#if CONFIG_CONS_INDEX == 1
+#	define DEFAULT_UART_BASE UART0_BASE
+#elif CONFIG_CONS_INDEX == 2
+#	define DEFAULT_UART_BASE UART1_BASE
+#elif CONFIG_CONS_INDEX == 3
+#	define DEFAULT_UART_BASE UART2_BASE
+#elif CONFIG_CONS_INDEX == 4
+#	define DEFAULT_UART_BASE UART3_BASE
+#elif CONFIG_CONS_INDEX == 5
+#	define DEFAULT_UART_BASE UART4_BASE
+#elif CONFIG_CONS_INDEX == 6
+#	define DEFAULT_UART_BASE UART5_BASE
+#endif
 
 /* GPMC Base address */
 #define GPMC_BASE			0x50000000
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +5 -0
index fa9b84f..3e46283 100644
@@ -15,6 +15,11 @@
 
 /* UART Base Address */
 #define UART0_BASE			0x44E09000
+#define UART1_BASE			0x48022000
+#define UART2_BASE			0x48024000
+#define UART3_BASE			0x481A6000
+#define UART4_BASE			0x481A8000
+#define UART5_BASE			0x481AA000
 
 /* GPIO Base address */
 #define GPIO2_BASE			0x481AC000
Signature · 20 lines
2.7.4




--
Ronald Landheer-Cieslak
Lead Developer - Substation Automation
Développeur Logiciel Sénior - Automatisation de poste

Energy Automation Solutions Division
Eaton
1990, 5e Rue, bureau 220
St-Romuald Quebec
Canada G6W 5M6

Tel: (418) 830-5946
Fax. : (514) 227-5256
RonaldLandheerCieslak at Eaton.com
www.eaton.com/smartgrid
#1 lore raw

PATCH 1/1 Add UART base addresses for additional UARTs

Hi,

Quoted 23 lines · Ronald

UARTs 1 through 5 were missing in the code - added.
Also pick the default according to the configuration setting for the console index.

---
 arch/arm/include/asm/arch-am33xx/hardware.h        | 14 +++++++++++++-
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |  5 +++++
 2 files changed, 18 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-am33xx/hardware.h +4 -1
index dd950e5..873098e 100644
@@ -53,7 +53,19 @@
 #define DDR_CONTROL_BASE_ADDR          0x44E11404
 
 /* UART */
-#define DEFAULT_UART_BASE              UART0_BASE
+#if CONFIG_CONS_INDEX == 1
+#      define DEFAULT_UART_BASE UART0_BASE
+#elif CONFIG_CONS_INDEX == 2
+#      define DEFAULT_UART_BASE UART1_BASE

arch/arm/include/asm/arch-am33xx/hardware.h line 69

Quoted 10 lines
arch/arm/include/asm/arch-am33xx/hardware.h +9 -0
+#elif CONFIG_CONS_INDEX == 3
+#      define DEFAULT_UART_BASE UART2_BASE
+#elif CONFIG_CONS_INDEX == 4
+#      define DEFAULT_UART_BASE UART3_BASE
+#elif CONFIG_CONS_INDEX == 5
+#      define DEFAULT_UART_BASE UART4_BASE
+#elif CONFIG_CONS_INDEX == 6
+#      define DEFAULT_UART_BASE UART5_BASE
+#endif
 

Shouldn't these be in device tree?

Quoted 10 lines
arch/arm/include/asm/arch-am33xx/hardware.h +0 -0
 /* GPMC Base address */
 #define GPMC_BASE                      0x50000000
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +0 -0
index fa9b84f..3e46283 100644
@@ -15,6 +15,11 @@
 
 /* UART Base Address */

arch/arm/include/asm/arch-am33xx/hardware_am33xx.h

Quoted 10 lines
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +5 -1
 #define UART0_BASE                     0x44E09000
+#define UART1_BASE                     0x48022000
+#define UART2_BASE                     0x48024000
+#define UART3_BASE                     0x481A6000
+#define UART4_BASE                     0x481A8000
+#define UART5_BASE                     0x481AA000
 
 /* GPIO Base address */
 #define GPIO2_BASE                     0x481AC000
--

Regards,
Bin

#2 lore raw

Hi Bin,

Quoted 20 lines · Bin Meng
Quoted 19 lines · Ronald

UARTs 1 through 5 were missing in the code - added.
Also pick the default according to the configuration setting for the console index.

Signed-off-by: Ronald Landheer-Cieslak
<[email protected]>

---
 arch/arm/include/asm/arch-am33xx/hardware.h        | 14 +++++++++++++-
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |  5 +++++
 2 files changed, 18 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-am33xx/hardware.h +0 -0
index dd950e5..873098e 100644
@@ -53,7 +53,19 @@
 #define DDR_CONTROL_BASE_ADDR          0x44E11404
 
Quoted 16 lines
Quoted 5 lines
arch/arm/include/asm/arch-am33xx/hardware.h +3 -1
 /* UART */
-#define DEFAULT_UART_BASE              UART0_BASE
+#if CONFIG_CONS_INDEX == 1
+#      define DEFAULT_UART_BASE UART0_BASE
+#elif CONFIG_CONS_INDEX == 2

arch/arm/include/asm/arch-am33xx/hardware.h line 68

Quoted 10 lines
arch/arm/include/asm/arch-am33xx/hardware.h +10 -0
+#      define DEFAULT_UART_BASE UART1_BASE
+#elif CONFIG_CONS_INDEX == 3
+#      define DEFAULT_UART_BASE UART2_BASE
+#elif CONFIG_CONS_INDEX == 4
+#      define DEFAULT_UART_BASE UART3_BASE
+#elif CONFIG_CONS_INDEX == 5
+#      define DEFAULT_UART_BASE UART4_BASE
+#elif CONFIG_CONS_INDEX == 6
+#      define DEFAULT_UART_BASE UART5_BASE
+#endif

Shouldn't these be in device tree?

The device tree isn't loaded at this point, so no: the boot needs to know where the UART registers are in order to use them, and needs to use the right ones according to its configuration.

The previous version of the code allowd board-specific code (i.e. board/<vendor>/<name>/*.c) to configure the pins as needed, but that didn't change the base address being used for the UART - just the pins. That means that if you have a board for which the uart0 pins are muxed elsewhere (i.e., in my case, an SPI bus), you have to change code outside of the board directory to get the boot loader to use the right UART.

With this patch in place, you'll no longer have to do that (your board-specific code just has to mux the pins correctly).

<snip/>

Regards,

Ronald

#3 lore raw

PATCH 1/1 Add UART base addresses for additional UARTs

In reply to Landheer-Cieslak
Quoted 5 lines · Ronald

UARTs 1 through 5 were missing in the code - added.
Also pick the default according to the configuration setting for the console index.

Applied to u-boot/master, thanks!

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