diff --git a/config.h b/config.h index 31c89387..9a288224 100644 --- a/config.h +++ b/config.h @@ -20,6 +20,8 @@ // Target for device-specific debug builds //#define TARGET T8103 +// Some devices like Apple TV HD use other uarts for debug console +//#define TARGET_BOARD 0x34 #ifdef RELEASE # define FB_SILENT_MODE diff --git a/src/soc.h b/src/soc.h index eb375eda..b6632ad2 100644 --- a/src/soc.h +++ b/src/soc.h @@ -5,6 +5,17 @@ #include "../config.h" +#define S5L8960X 0x8960 +#define T7000 0x7000 +#define T7001 0x7001 +#define S8000 0x8000 +#define S8001 0x8001 +#define S8003 0x8003 +#define T8010 0x8010 +#define T8011 0x8011 +#define T8012 0x8012 +#define T8015 0x8015 + #define T8103 0x8103 #define T8112 0x8112 #define T8122 0x8122 @@ -28,6 +39,20 @@ #define EARLY_UART_BASE 0x235200000 #elif TARGET == T6034 || TARGET == T6031 #define EARLY_UART_BASE 0x391200000 +#elif TARGET == T8015 +#define EARLY_UART_BASE 0x22e600000 +#elif TARGET == T7000 || TARGET == T7001 || TARGET == S8000 || TARGET == S8001 || \ + TARGET == S8003 || TARGET == T8010 || TARGET == T8011 +#if TARGET == T7000 && defined(TARGET_BOARD) && TARGET_BOARD == 0x34 // Apple TV HD +#define EARLY_UART_BASE 0x20a0d8000 +#else +#define EARLY_UART_BASE 0x20a0c0000 +#endif + +#elif TARGET == T8012 +#define EARLY_UART_BASE 0x20a600000 +#elif TARGET == S5L8960X +#define EARLY_UART_BASE 0x20a0a0000 #endif #endif diff --git a/src/uart.c b/src/uart.c index 67aa0e3a..6bd2dab6 100644 --- a/src/uart.c +++ b/src/uart.c @@ -17,13 +17,20 @@ static u64 uart_base = 0; int uart_init(void) { int path[8]; - int node = adt_path_offset_trace(adt, "/arm-io/uart0", path); + const char *uart_path; - if (node < 0) { - printf("!!! UART node not found!\n"); + if (adt_path_offset_trace(adt, "/arm-io/uart6/debug-console", NULL) > 0) { + uart_path = "/arm-io/uart6"; + /* T2 ADT does not have /arm-io/uart0/debug-console, but it is the correct UART */ + } else if (adt_path_offset_trace(adt, "/arm-io/uart0", NULL) > 0) { + uart_path = "/arm-io/uart0"; + } else { + printf("!!!Debug UART node not found!\n"); return -1; } + adt_path_offset_trace(adt, uart_path, path); + if (adt_get_reg(adt, path, "reg", 0, &uart_base, NULL)) { printf("!!! Failed to get UART reg property!\n"); return -1;