summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2014-02-24 11:16:33 +0100
committerTom Rini <trini@ti.com>2014-03-04 09:27:36 -0500
commitc9416b92924376ecead1b48a85cac60db4a5f7ee (patch)
tree69fbcc147422f9a61ed5043eac530b83df939e82 /drivers/serial
parent9e0e37accde19e513caaddb18ad22a573910dbe7 (diff)
downloadu-boot-imx-c9416b92924376ecead1b48a85cac60db4a5f7ee.zip
u-boot-imx-c9416b92924376ecead1b48a85cac60db4a5f7ee.tar.gz
u-boot-imx-c9416b92924376ecead1b48a85cac60db4a5f7ee.tar.bz2
serial: zynq: Add OF initialization support
Add console selection from DTB which is enough to have OF driven solution. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_zynq.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
index 22c6bf0..53a8af0 100644
--- a/drivers/serial/serial_zynq.c
+++ b/drivers/serial/serial_zynq.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <fdtdec.h>
#include <watchdog.h>
#include <asm/io.h>
#include <linux/compiler.h>
@@ -13,6 +14,8 @@
#include <asm/arch/clk.h>
#include <asm/arch/hardware.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#define ZYNQ_UART_SR_TXFULL 0x00000010 /* TX FIFO full */
#define ZYNQ_UART_SR_RXEMPTY 0x00000002 /* RX FIFO empty */
@@ -182,6 +185,30 @@ DECLARE_PSSERIAL_FUNCTIONS(1);
struct serial_device uart_zynq_serial1_device =
INIT_PSSERIAL_STRUCTURE(1, "ttyPS1");
+#ifdef CONFIG_OF_CONTROL
+__weak struct serial_device *default_serial_console(void)
+{
+ const void *blob = gd->fdt_blob;
+ int node;
+ unsigned int base_addr;
+
+ node = fdt_path_offset(blob, "serial0");
+ if (node < 0)
+ return NULL;
+
+ base_addr = fdtdec_get_addr(blob, node, "reg");
+ if (base_addr == FDT_ADDR_T_NONE)
+ return NULL;
+
+ if (base_addr == ZYNQ_SERIAL_BASEADDR0)
+ return &uart_zynq_serial0_device;
+
+ if (base_addr == ZYNQ_SERIAL_BASEADDR1)
+ return &uart_zynq_serial1_device;
+
+ return NULL;
+}
+#else
__weak struct serial_device *default_serial_console(void)
{
#if defined(CONFIG_ZYNQ_SERIAL_UART0)
@@ -194,6 +221,7 @@ __weak struct serial_device *default_serial_console(void)
#endif
return NULL;
}
+#endif
void zynq_serial_initalize(void)
{