public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ns16550: allow UART address to be set dynamically
@ 2012-12-12 23:23 Stephen Warren
  2012-12-12 23:38 ` Simon Glass
  2012-12-13 10:27 ` Wolfgang Denk
  0 siblings, 2 replies; 39+ messages in thread
From: Stephen Warren @ 2012-12-12 23:23 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

A single U-Boot binary may support multiple very similar boards. These
boards may use different UARTs for the main debug console. Hence, it is
impossible to #define CONFIG_SYS_NS16550_COM1 to some static UART
address, since the true value may only be determined at run-time, after
identifying the actual hardware. Provide an API for boards to call to
set the actual address of the UART, e.g. from spl_board_init() or
board_early_init_f().

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Note: I have a Tegra patch that will depend on this functionality. I'd
like to see the patch applied through the Tegra tree if possible, or if
not, quickly pushed into u-boot/master or u-boot/next so Tom Warren can
base a Tegra branch on top of it easily without delay.

 drivers/serial/serial_ns16550.c |    5 +++++
 include/ns16550.h               |    1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index fc01a3c..fc8253b 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -166,6 +166,11 @@ static int calc_divisor (NS16550_t port)
 		(MODE_X_DIV * gd->baudrate);
 }
 
+void NS16550_set_dynamic_address(int port, NS16550_t com_port)
+{
+	PORT = com_port;
+}
+
 void
 _serial_putc(const char c,const int port)
 {
diff --git a/include/ns16550.h b/include/ns16550.h
index 51cb5b4..6d7483f 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -171,6 +171,7 @@ typedef struct NS16550 *NS16550_t;
 /* useful defaults for LCR */
 #define UART_LCR_8N1	0x03
 
+void NS16550_set_dynamic_address(int port, NS16550_t com_port);
 void NS16550_init(NS16550_t com_port, int baud_divisor);
 void NS16550_putc(NS16550_t com_port, char c);
 char NS16550_getc(NS16550_t com_port);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2012-12-18 19:15 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12 23:23 [U-Boot] [PATCH] ns16550: allow UART address to be set dynamically Stephen Warren
2012-12-12 23:38 ` Simon Glass
2012-12-12 23:52   ` Stephen Warren
2012-12-13  0:38     ` Simon Glass
2012-12-13 10:29     ` Wolfgang Denk
2012-12-13 18:17       ` Stephen Warren
2012-12-13 20:36         ` Wolfgang Denk
2012-12-13 20:45           ` Stephen Warren
2012-12-13 20:53             ` Tom Rini
2012-12-13 21:07               ` Stephen Warren
2012-12-13 21:51                 ` Simon Glass
2012-12-14 20:40                   ` Tom Rini
2012-12-14 21:14                     ` Simon Glass
2012-12-14 22:03                       ` Stephen Warren
2012-12-14 22:22                         ` Simon Glass
2012-12-14 22:45                           ` Stephen Warren
2012-12-17 21:09                             ` Tom Rini
2012-12-17 22:24                               ` Stephen Warren
2012-12-17 22:37                                 ` Wolfgang Denk
2012-12-17 22:58                                   ` Stephen Warren
2012-12-18  6:39                                     ` Wolfgang Denk
2012-12-18 16:37                                       ` Stephen Warren
2012-12-18 19:15                                         ` Simon Glass
2012-12-17 21:09                           ` Tom Rini
2012-12-14 22:35                         ` Wolfgang Denk
2012-12-14 21:52                     ` Stephen Warren
2012-12-14 22:31                       ` Wolfgang Denk
2012-12-14 22:26                     ` Wolfgang Denk
2012-12-14 23:16                       ` Graeme Russ
2012-12-15  0:32                         ` Wolfgang Denk
2012-12-15  1:32                           ` Graeme Russ
2012-12-15  7:30                             ` Wolfgang Denk
2012-12-15  9:53                               ` Graeme Russ
2012-12-17 21:04                       ` Tom Rini
2012-12-13 23:11             ` Wolfgang Denk
2012-12-13 23:26               ` Stephen Warren
2012-12-13 10:27 ` Wolfgang Denk
2012-12-13 13:11   ` Tom Rini
2012-12-13 14:22     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox