Redo the magic of console selection

This commit is contained in:
reinoud 2014-09-26 18:59:29 +00:00
parent 40797a03eb
commit 52dc32dbd9
2 changed files with 33 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: odroid_machdep.c,v 1.35 2014/09/24 20:38:33 reinoud Exp $ */
/* $NetBSD: odroid_machdep.c,v 1.36 2014/09/26 18:59:29 reinoud Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.35 2014/09/24 20:38:33 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.36 2014/09/26 18:59:29 reinoud Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_exynos.h"
@ -108,44 +108,9 @@ __KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.35 2014/09/24 20:38:33 reinoud
#include <arm/samsung/sscom_var.h>
#include <arm/samsung/sscom_reg.h>
static const struct sscom_uart_info exynos_uarts[] = {
#ifdef EXYNOS5
{
.unit = 0,
.iobase = EXYNOS5_UART0_OFFSET
},
{
.unit = 1,
.iobase = EXYNOS5_UART1_OFFSET
},
{
.unit = 2,
.iobase = EXYNOS5_UART2_OFFSET
},
{
.unit = 3,
.iobase = EXYNOS5_UART3_OFFSET
},
#endif
#ifdef EXYNOS4
{
.unit = 0,
.iobase = EXYNOS4_UART0_OFFSET
},
{
.unit = 1,
.iobase = EXYNOS4_UART1_OFFSET
},
{
.unit = 2,
.iobase = EXYNOS4_UART2_OFFSET
},
{
.unit = 3,
.iobase = EXYNOS4_UART3_OFFSET
},
#endif
};
extern const int num_exynos_uarts_entries;
extern const struct sscom_uart_info exynos_uarts[];
KASSERT(sizeof(struct sscom_uart_info) == 8);
/* sanity checks for serial console */
#ifndef CONSPEED
@ -161,7 +126,7 @@ static const struct sscom_uart_info exynos_uarts[] = {
//static const bus_addr_t conaddr = CONADDR;
static const int conspeed = CONSPEED;
static const int conmode = CONMODE;
#endif /*defined(KGDB) || defined(SSCOM0CONSOLE) || defined(SSCOM1CONSOLE) */
#endif /*defined(KGDB) || defined(SSCOM*CONSOLE) */
/*
* uboot passes 4 arguments to us.
@ -458,12 +423,13 @@ consinit(void)
freq = (freq + conspeed / 2) / 1000;
freq *= 1000;
for (i = 0; i < __arraycount(exynos_uarts); i++) {
/* go trough all entries */
for (i = 0; i < num_exynos_uarts_entries; i++) {
/* attach console */
if (exynos_uarts[i].iobase + EXYNOS_CORE_PBASE == iobase)
break;
}
KASSERT(i < __arraycount(exynos_uarts));
KASSERT(i < num_exynos_uarts_entries);
printf("%s: attaching console @ %#"PRIxPTR" (%u HZ, %u bps)\n",
__func__, iobase, freq, conspeed);
if (sscom_cnattach(bst, exynos_core_bsh, &exynos_uarts[i],

View File

@ -1,4 +1,4 @@
/* $NetBSD: odroid_start.S,v 1.4 2014/09/26 18:26:24 reinoud Exp $ */
/* $NetBSD: odroid_start.S,v 1.5 2014/09/26 18:59:29 reinoud Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
#include <evbarm/odroid/platform.h>
RCSID("$NetBSD: odroid_start.S,v 1.4 2014/09/26 18:26:24 reinoud Exp $")
RCSID("$NetBSD: odroid_start.S,v 1.5 2014/09/26 18:59:29 reinoud Exp $")
#if defined(VERBOSE_INIT_ARM)
@ -186,10 +186,16 @@ _C_LABEL(odroid_start):
adr r1, .Lsscom_exynos5_table
#endif
#ifdef SSCOM0CONSOLE
ldr r2, [r1, #0]
ldr r2, [r1, #0*8+4]
#endif
#ifdef SSCOM1CONSOLE
ldr r2, [r1, #4]
ldr r2, [r1, #1*8+4]
#endif
#ifdef SSCOM2CONSOLE
ldr r2, [r1, #2*8+4]
#endif
#ifdef SSCOM3CONSOLE
ldr r2, [r1, #3*8+4]
#endif
add r2, r2, #EXYNOS_CORE_PBASE
mcr p15, 0, r2, c13, c0, 3 // TPIDRURO set (uart address)
@ -244,17 +250,30 @@ _C_LABEL(odroid_start):
/* NOTREACHED */
.align 0
.global _C_LABEL(num_exynos_uarts_entries)
_C_LABEL(num_exynos_uarts_entries):
.word 8 // update number of entries!!!
.global _C_LABEL(exynos_uarts)
_C_LABEL(exynos_uarts):
.Lsscom_exynos4_table:
.word 0
.word EXYNOS4_UART0_OFFSET
.word 1
.word EXYNOS4_UART1_OFFSET
.word 2
.word EXYNOS4_UART2_OFFSET
.word 3
.word EXYNOS4_UART3_OFFSET
.Lsscom_exynos5_table:
.word 0
.word EXYNOS5_UART0_OFFSET
.word 1
.word EXYNOS5_UART1_OFFSET
.word 2
.word EXYNOS5_UART2_OFFSET
.word 3
.word EXYNOS5_UART3_OFFSET