Commit 32db7be75d14887268596aa2fd9120f7c9cf2c1b

Authored by Lokesh Vutla
1 parent 359d4c42e3

board: am335x: Allow to choose serial device dynamically

Different AM335x based platforms have different serial consoles. As serial
console is Kconfig option a separate defconfig has to be created for each
platform. So pass the serial device dynamically.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff

board/ti/am335x/board.c
... ... @@ -11,6 +11,7 @@
11 11 #include <common.h>
12 12 #include <errno.h>
13 13 #include <spl.h>
  14 +#include <serial.h>
14 15 #include <asm/arch/cpu.h>
15 16 #include <asm/arch/hardware.h>
16 17 #include <asm/arch/omap.h>
... ... @@ -69,6 +70,16 @@
69 70 {
70 71 return ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR);
71 72 }
  73 +
  74 +#ifndef CONFIG_DM_SERIAL
  75 +struct serial_device *default_serial_console(void)
  76 +{
  77 + if (board_is_icev2())
  78 + return &eserial4_device;
  79 + else
  80 + return &eserial1_device;
  81 +}
  82 +#endif
72 83  
73 84 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
74 85 static const struct ddr_data ddr2_data = {
... ... @@ -40,6 +40,10 @@
40 40  
41 41 extern struct serial_device eserial1_device;
42 42 extern struct serial_device eserial2_device;
  43 +extern struct serial_device eserial3_device;
  44 +extern struct serial_device eserial4_device;
  45 +extern struct serial_device eserial5_device;
  46 +extern struct serial_device eserial6_device;
43 47  
44 48 extern void serial_register(struct serial_device *);
45 49 extern void serial_initialize(void);