Skip to contentSkip to conversation

tegra: add alternate UART1 funcmux entry

PATCH New Stephen Warren 3 participants 6 messages May 14, 2012 – May 31, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 tegra: add alternate UART1 funcmux entry

From: Stephen Warren <[email protected]>

(In at least some configurations) Whistler uses UART1 on pingroups UAA, UAB.

---
 arch/arm/cpu/armv7/tegra2/board.c          |   14 +++++++++++++-
 arch/arm/cpu/armv7/tegra2/funcmux.c        |   13 ++++++++++++-
 arch/arm/include/asm/arch-tegra2/funcmux.h |    1 +
 3 files changed, 26 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/tegra2/board.c +13 -1
index a50b1b9..629ad5d 100644
@@ -101,6 +101,18 @@ int arch_cpu_init(void)
 }
 #endif
 
+static int uart_configs[] = {
+#ifdef CONFIG_TEGRA2_UARTA_UAA_UAB
+	FUNCMUX_UART1_UAA_UAB,
+#else
+	FUNCMUX_UART1_IRRX_IRTX,
+#endif
+	FUNCMUX_UART2_IRDA,
+	-1,
+	FUNCMUX_UART4_GMC,
+	-1,
+};
+
 /**
  * Set up the specified uarts
  *
@@ -120,7 +132,7 @@ static void setup_uarts(int uart_ids)
 		if (uart_ids & (1 << i)) {
 			enum periph_id id = id_for_uart[i];
 
-			funcmux_select(id, FUNCMUX_DEFAULT);
+			funcmux_select(id, uart_configs[i]);
 			clock_ll_start_uart(id);
 		}
 	}
arch/arm/cpu/armv7/tegra2/funcmux.c +12 -1
index 0ef7753..e2d1273 100644
@@ -31,11 +31,22 @@ int funcmux_select(enum periph_id id, int config)
 
 	switch (id) {
 	case PERIPH_ID_UART1:
-		if (config == FUNCMUX_UART1_IRRX_IRTX) {
+		switch (config) {
+		case FUNCMUX_UART1_IRRX_IRTX:
 			pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
 			pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
 			pinmux_tristate_disable(PINGRP_IRRX);
 			pinmux_tristate_disable(PINGRP_IRTX);
+			break;
+		case FUNCMUX_UART1_UAA_UAB:
+			pinmux_set_func(PINGRP_UAA, PMUX_FUNC_UARTA);
+			pinmux_set_func(PINGRP_UAB, PMUX_FUNC_UARTA);
+			pinmux_tristate_disable(PINGRP_UAA);
+			pinmux_tristate_disable(PINGRP_UAB);
+			bad_config = 0;
+			break;
+		}
+		if (!bad_config) {
 			/*
 			 * Tegra appears to boot with function UARTA pre-
 			 * selected on mux group SDB. If two mux groups are
arch/arm/include/asm/arch-tegra2/funcmux.h +1 -0
index ae73c72..b455122 100644
@@ -30,6 +30,7 @@ enum {
 
 	/* UART configs */
 	FUNCMUX_UART1_IRRX_IRTX = 0,
+	FUNCMUX_UART1_UAA_UAB,
 	FUNCMUX_UART2_IRDA = 0,
 	FUNCMUX_UART4_GMC = 0,
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 tegra: Whistler board support

From: Stephen Warren <[email protected]>

Whistler is a highly configurable Tegra evaluation and development board. This change adds support for the following specific configuration:

E1120 motherboard
E1108 CPU board
E1116 PMU board

The motherboard configuration switches are set as follows:
SW1=0 SW2=0 SW3=5
S1/S2/S3/S4 all on, except S3 7/8 are off.

Other combinations of daugher boards may work to varying degrees, but will likely require some SW adjustment.

---
 MAINTAINERS                          |    1 +
 board/nvidia/dts/tegra2-whistler.dts |   67 ++++++++++++++++++++
 board/nvidia/whistler/Makefile       |   48 ++++++++++++++
 board/nvidia/whistler/whistler.c     |  115 ++++++++++++++++++++++++++++++++++
 boards.cfg                           |    1 +
 include/configs/whistler.h           |   90 ++++++++++++++++++++++++++
 6 files changed, 322 insertions(+), 0 deletions(-)
 create mode 100644 board/nvidia/dts/tegra2-whistler.dts
 create mode 100644 board/nvidia/whistler/Makefile
 create mode 100644 board/nvidia/whistler/whistler.c
 create mode 100644 include/configs/whistler.h
MAINTAINERS +1 -0
index a16ead0..563b4ec 100644
@@ -912,6 +912,7 @@ Stephen Warren <[email protected]>
 
 	ventana		Tegra2 (ARM7 & A9 Dual Core)
 	paz00		Tegra2 (ARM7 & A9 Dual Core)
+	whistler	Tegra2 (ARM7 & A9 Dual Core)
 
 Thomas Weber <[email protected]>
 
board/nvidia/dts/tegra2-whistler.dts new file +67 -0

67 lines not on this page · raw message

board/nvidia/whistler/Makefile new file +48 -0

48 lines not on this page · raw message

board/nvidia/whistler/whistler.c new file +115 -0

115 lines not on this page · raw message

boards.cfg +1 -0
index ce1f1d4..03982f6 100644
@@ -230,6 +230,7 @@ trats                        arm         armv7       trats               samsung
 harmony                      arm         armv7       harmony             nvidia         tegra2
 seaboard                     arm         armv7       seaboard            nvidia         tegra2
 ventana                      arm         armv7       ventana             nvidia         tegra2
+whistler                     arm         armv7       whistler            nvidia         tegra2
 u8500_href                   arm         armv7       u8500               st-ericsson    u8500
 actux1_4_16                  arm         ixp         actux1              -              -           actux1:FLASH2X2
 actux1_4_32                  arm         ixp         actux1              -              -           actux1:FLASH2X2,RAM_32MB
include/configs/whistler.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/2 tegra: add alternate UART1 funcmux entry

In reply to Stephen Warren

Hello Stephen,

this patch looks reasonable. I also need to change the pingroup config for UARTA on the Colibri T20 board and came up with a similar approach, but I will rebase my work on top of this.

As I'm not in the position to give anything more official, I just wanted to give this patch a public +1 to show that I'm in favour of this change.

-- Lucas
Am Montag, den 14.05.2012, 17:13 -0600 schrieb Stephen Warren:

Quoted 84 lines

From: Stephen Warren <[email protected]>

(In at least some configurations) Whistler uses UART1 on pingroups UAA, UAB.

---
 arch/arm/cpu/armv7/tegra2/board.c          |   14 +++++++++++++-
 arch/arm/cpu/armv7/tegra2/funcmux.c        |   13 ++++++++++++-
 arch/arm/include/asm/arch-tegra2/funcmux.h |    1 +
 3 files changed, 26 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/tegra2/board.c +13 -1
index a50b1b9..629ad5d 100644
@@ -101,6 +101,18 @@ int arch_cpu_init(void)
 }
 #endif
 
+static int uart_configs[] = {
+#ifdef CONFIG_TEGRA2_UARTA_UAA_UAB
+	FUNCMUX_UART1_UAA_UAB,
+#else
+	FUNCMUX_UART1_IRRX_IRTX,
+#endif
+	FUNCMUX_UART2_IRDA,
+	-1,
+	FUNCMUX_UART4_GMC,
+	-1,
+};
+
 /**
  * Set up the specified uarts
  *
@@ -120,7 +132,7 @@ static void setup_uarts(int uart_ids)
 		if (uart_ids & (1 << i)) {
 			enum periph_id id = id_for_uart[i];
 
-			funcmux_select(id, FUNCMUX_DEFAULT);
+			funcmux_select(id, uart_configs[i]);
 			clock_ll_start_uart(id);
 		}
 	}
arch/arm/cpu/armv7/tegra2/funcmux.c +12 -1
index 0ef7753..e2d1273 100644
@@ -31,11 +31,22 @@ int funcmux_select(enum periph_id id, int config)
 
 	switch (id) {
 	case PERIPH_ID_UART1:
-		if (config == FUNCMUX_UART1_IRRX_IRTX) {
+		switch (config) {
+		case FUNCMUX_UART1_IRRX_IRTX:
 			pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
 			pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
 			pinmux_tristate_disable(PINGRP_IRRX);
 			pinmux_tristate_disable(PINGRP_IRTX);
+			break;
+		case FUNCMUX_UART1_UAA_UAB:
+			pinmux_set_func(PINGRP_UAA, PMUX_FUNC_UARTA);
+			pinmux_set_func(PINGRP_UAB, PMUX_FUNC_UARTA);
+			pinmux_tristate_disable(PINGRP_UAA);
+			pinmux_tristate_disable(PINGRP_UAB);
+			bad_config = 0;
+			break;
+		}
+		if (!bad_config) {
 			/*
 			 * Tegra appears to boot with function UARTA pre-
 			 * selected on mux group SDB. If two mux groups are
arch/arm/include/asm/arch-tegra2/funcmux.h +1 -0
index ae73c72..b455122 100644
@@ -30,6 +30,7 @@ enum {
 
 	/* UART configs */
 	FUNCMUX_UART1_IRRX_IRTX = 0,
+	FUNCMUX_UART1_UAA_UAB,
 	FUNCMUX_UART2_IRDA = 0,
 	FUNCMUX_UART4_GMC = 0,
 
#3 lore raw

PATCH 1/2 tegra: add alternate UART1 funcmux entry

In reply to Stephen Warren

Hi Stephen,

Quoted 18 lines · Stephen Warren

From: Stephen Warren <[email protected]>

(In at least some configurations) Whistler uses UART1 on pingroups UAA, UAB.

---
 arch/arm/cpu/armv7/tegra2/board.c          |   14 +++++++++++++-
 arch/arm/cpu/armv7/tegra2/funcmux.c        |   13 ++++++++++++-
 arch/arm/include/asm/arch-tegra2/funcmux.h |    1 +
 3 files changed, 26 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/tegra2/board.c +0 -0
index a50b1b9..629ad5d 100644

arch/arm/cpu/armv7/tegra2/board.c int arch_cpu_init(void) · line 110

Quoted 10 lines
arch/arm/cpu/armv7/tegra2/board.c +6 -0
@@ -101,6 +101,18 @@ int arch_cpu_init(void)
 }
 #endif
 
+static int uart_configs[] = {
+#ifdef CONFIG_TEGRA2_UARTA_UAA_UAB
+       FUNCMUX_UART1_UAA_UAB,
+#else
+       FUNCMUX_UART1_IRRX_IRTX,
+#endif
 

We really shouldn't be using configs to deal with this. It should be a run-time check.

I recall you saying that we could use the ODM bits for this?

Quoted 61 lines
arch/arm/cpu/armv7/tegra2/board.c +6 -0
+       FUNCMUX_UART2_IRDA,
+       -1,
+       FUNCMUX_UART4_GMC,
+       -1,
+};
+
 /**
 * Set up the specified uarts

*

arch/arm/cpu/armv7/tegra2/board.c +1 -1
@@ -120,7 +132,7 @@ static void setup_uarts(int uart_ids)
               if (uart_ids & (1 << i)) {
                       enum periph_id id = id_for_uart[i];
 
-                       funcmux_select(id, FUNCMUX_DEFAULT);
+                       funcmux_select(id, uart_configs[i]);
                       clock_ll_start_uart(id);
               }
       }
arch/arm/cpu/armv7/tegra2/funcmux.c +12 -1
index 0ef7753..e2d1273 100644
@@ -31,11 +31,22 @@ int funcmux_select(enum periph_id id, int config)
 
       switch (id) {
       case PERIPH_ID_UART1:
-               if (config == FUNCMUX_UART1_IRRX_IRTX) {
+               switch (config) {
+               case FUNCMUX_UART1_IRRX_IRTX:
                       pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
                       pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
                       pinmux_tristate_disable(PINGRP_IRRX);
                       pinmux_tristate_disable(PINGRP_IRTX);
+                       break;
+               case FUNCMUX_UART1_UAA_UAB:
+                       pinmux_set_func(PINGRP_UAA, PMUX_FUNC_UARTA);
+                       pinmux_set_func(PINGRP_UAB, PMUX_FUNC_UARTA);
+                       pinmux_tristate_disable(PINGRP_UAA);
+                       pinmux_tristate_disable(PINGRP_UAB);
+                       bad_config = 0;
+                       break;
+               }
+               if (!bad_config) {
                       /*
                        * Tegra appears to boot with function UARTA pre-
                        * selected on mux group SDB. If two mux groups are
arch/arm/include/asm/arch-tegra2/funcmux.h +1 -1
index ae73c72..b455122 100644
@@ -30,6 +30,7 @@ enum {
 
       /* UART configs */
       FUNCMUX_UART1_IRRX_IRTX = 0,
+       FUNCMUX_UART1_UAA_UAB,
       FUNCMUX_UART2_IRDA = 0,
       FUNCMUX_UART4_GMC = 0,
 
--
Quoted 3 lines

1.7.0.4

Regards,
Simon

#4 lore raw

PATCH 1/2 tegra: add alternate UART1 funcmux entry

Quoted 20 lines · Simon Glass

Hi Stephen,

On Mon, May 14, 2012 at 4:13 PM, Stephen Warren <[email protected] <mailto:[email protected]>> wrote:

From: Stephen Warren <swarren at nvidia.com <mailto:[email protected]>>

(In at least some configurations) Whistler uses UART1 on pingroups UAA, UAB.

diff --git a/arch/arm/cpu/armv7/tegra2/board.c

+static int uart_configs[] = {
+#ifdef CONFIG_TEGRA2_UARTA_UAA_UAB
+ FUNCMUX_UART1_UAA_UAB,
+#else
+ FUNCMUX_UART1_IRRX_IRTX,
+#endif

Quoted 4 lines

We really shouldn't be using configs to deal with this. It should be a run-time check.

I recall you saying that we could use the ODM bits for this?

The ODM bits can indicate which UART is to be used to the debug serial port, but not the pinmux options. We have no alternative but to make this a compile-time constant.

Quoted 6 lines
    +       FUNCMUX_UART2_IRDA,
    +       -1,
    +       FUNCMUX_UART4_GMC,
    +       -1,
    +};
#5 lore raw

PATCH 1/2 tegra: add alternate UART1 funcmux entry

Hi Stephen,

Quoted 22 lines · Stephen Warren
Quoted 21 lines · Simon Glass

Hi Stephen,

On Mon, May 14, 2012 at 4:13 PM, Stephen Warren <[email protected] <mailto:[email protected]>> wrote:

From: Stephen Warren <swarren at nvidia.com <mailto:[email protected]

Quoted 1 line
    (In at least some configurations) Whistler uses UART1 on pingroups
    UAA, UAB.

    diff --git a/arch/arm/cpu/armv7/tegra2/board.c

    +static int uart_configs[] = {
    +#ifdef CONFIG_TEGRA2_UARTA_UAA_UAB
    +       FUNCMUX_UART1_UAA_UAB,
    +#else
    +       FUNCMUX_UART1_IRRX_IRTX,
    +#endif
Quoted 9 lines
Quoted 4 lines

We really shouldn't be using configs to deal with this. It should be a run-time check.

I recall you saying that we could use the ODM bits for this?

The ODM bits can indicate which UART is to be used to the debug serial port, but not the pinmux options. We have no alternative but to make this a compile-time constant.

To solve this properly we will need a run-time way of selecting the pinmux for UARTs I suppose. We haven't cracked that problem yet. Let's clean this up later.

Quoted 9 lines
Quoted 7 lines

    +       FUNCMUX_UART2_IRDA,
    +       -1,
    +       FUNCMUX_UART4_GMC,
    +       -1,
    +};

Regards,

Simon