Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung Teach sscom attachment, also the consol...
details: https://anonhg.NetBSD.org/src/rev/eca149d76fd7
branches: trunk
changeset: 795512:eca149d76fd7
user: reinoud <reinoud%NetBSD.org@localhost>
date: Wed Apr 16 21:28:51 2014 +0000
description:
Teach sscom attachment, also the console, to use the busspace handle of the
main register space.
While here, map in the correct amount of memory or bus_space_map() won't
return an error but will wedge the system.
diffstat:
sys/arch/arm/samsung/exynos_soc.c | 18 ++++++++++++------
sys/arch/arm/samsung/exynos_sscom.c | 12 +++++++-----
sys/arch/arm/samsung/sscom.c | 25 +++++++++++++++----------
sys/arch/arm/samsung/sscom_var.h | 9 +++++----
4 files changed, 39 insertions(+), 25 deletions(-)
diffs (207 lines):
diff -r b692bf884198 -r eca149d76fd7 sys/arch/arm/samsung/exynos_soc.c
--- a/sys/arch/arm/samsung/exynos_soc.c Wed Apr 16 20:39:55 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_soc.c Wed Apr 16 21:28:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_soc.c,v 1.4 2014/04/13 20:52:29 reinoud Exp $ */
+/* $NetBSD: exynos_soc.c,v 1.5 2014/04/16 21:28:51 reinoud Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,7 +33,7 @@
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.4 2014/04/13 20:52:29 reinoud Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.5 2014/04/16 21:28:51 reinoud Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -205,10 +205,18 @@
#endif /* ARM_TRUSTZONE_FIRMWARE */
+#ifndef EXYNOS4
+# define EXYNOS4_CORE_SIZE 0
+#endif
+#ifndef EXYNOS5
+# define EXYNOS5_CORE_SIZE 0
+#endif
void
exynos_bootstrap(vaddr_t iobase, vaddr_t uartbase)
{
-// int error;
+ int error;
+ size_t core_size = IS_EXYNOS4_P() ?
+ EXYNOS4_CORE_SIZE : EXYNOS5_CORE_SIZE;
/* set up early console so we can use printf() and friends */
#ifdef EXYNOS_CONSOLE_EARLY
@@ -216,15 +224,13 @@
cn_tab = &exynos_earlycons;
printf("Exynos early console operational\n\n");
#endif
-#if 0
/* map in the exynos io registers */
error = bus_space_map(&exynos_bs_tag, EXYNOS_CORE_PBASE,
- 0x04000000 /*EXYNOS_CORE_SIZE*/, 0, &exynos_core_bsh);
+ core_size, 0, &exynos_core_bsh);
if (error)
panic("%s: failed to map in Exynos io registers: %d",
__func__, error);
KASSERT(exynos_core_bsh == iobase);
-#endif
}
diff -r b692bf884198 -r eca149d76fd7 sys/arch/arm/samsung/exynos_sscom.c
--- a/sys/arch/arm/samsung/exynos_sscom.c Wed Apr 16 20:39:55 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_sscom.c Wed Apr 16 21:28:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_sscom.c,v 1.2 2014/04/14 21:16:15 reinoud Exp $ */
+/* $NetBSD: exynos_sscom.c,v 1.3 2014/04/16 21:28:51 reinoud Exp $ */
/*
* Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.2 2014/04/14 21:16:15 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.3 2014/04/16 21:28:51 reinoud Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@@ -141,9 +141,10 @@
struct sscom_softc *sc = device_private(self);
struct exyo_attach_args *exyo = aux;
int unit = exyo->exyo_loc.loc_port;
- bus_addr_t iobase = exyo->exyo_loc.loc_offset;
- aprint_normal( ": UART%d addr=%lx", unit, iobase );
+ /* debug */
+// bus_addr_t iobase = exyo->exyo_loc.loc_offset;
+// aprint_normal( ": UART%d addr=%lx", unit, iobase );
sc->sc_dev = self;
sc->sc_iot = exyo->exyo_core_bst;
@@ -157,7 +158,8 @@
sc->sc_tx_irqno = UINT_TXD;
if (!sscom_is_console(sc->sc_iot, unit, &sc->sc_ioh)
- && bus_space_map(sc->sc_iot, iobase, SSCOM_SIZE, 0, &sc->sc_ioh)) {
+ && bus_space_subregion(sc->sc_iot, exyo->exyo_core_bsh,
+ exyo->exyo_loc.loc_offset, SSCOM_SIZE, &sc->sc_ioh)) {
printf( ": failed to map registers\n" );
return;
}
diff -r b692bf884198 -r eca149d76fd7 sys/arch/arm/samsung/sscom.c
--- a/sys/arch/arm/samsung/sscom.c Wed Apr 16 20:39:55 2014 +0000
+++ b/sys/arch/arm/samsung/sscom.c Wed Apr 16 21:28:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sscom.c,v 1.2 2014/04/14 21:16:15 reinoud Exp $ */
+/* $NetBSD: sscom.c,v 1.3 2014/04/16 21:28:51 reinoud Exp $ */
/*
* Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.2 2014/04/14 21:16:15 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.3 2014/04/16 21:28:51 reinoud Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@@ -181,7 +181,8 @@
static int sscomhwiflow(struct tty *tp, int block);
#if defined(KGDB) || defined(SSCOM0CONSOLE) || defined(SSCOM1CONSOLE)
-static int sscom_init(bus_space_tag_t, const struct sscom_uart_info *,
+static int sscom_init(bus_space_tag_t, bus_space_handle_t,
+ const struct sscom_uart_info *,
int, int, tcflag_t, bus_space_handle_t *);
#endif
@@ -1839,15 +1840,15 @@
* Initialize UART for use as console or KGDB line.
*/
static int
-sscom_init(bus_space_tag_t iot, const struct sscom_uart_info *config,
+sscom_init(bus_space_tag_t iot, bus_space_handle_t base_ioh,
+ const struct sscom_uart_info *config,
int rate, int frequency, tcflag_t cflag, bus_space_handle_t *iohp)
{
bus_space_handle_t ioh;
bus_addr_t iobase = config->iobase;
int timo = 150000;
- if (bus_space_map(iot, iobase, SSCOM_SIZE, 0, &ioh))
- return ENOMEM; /* ??? */
+ bus_space_subregion(iot, base_ioh, iobase, SSCOM_SIZE, &ioh);
/* wait until all is transmitted until we enable this device */
while (!(bus_space_read_4(iot, ioh, SSCOM_UTRSTAT) &
@@ -1893,12 +1894,14 @@
int
-sscom_cnattach(bus_space_tag_t iot, const struct sscom_uart_info *config,
+sscom_cnattach(bus_space_tag_t iot, bus_space_handle_t ioh,
+ const struct sscom_uart_info *config,
int rate, int frequency, tcflag_t cflag)
{
int res;
- res = sscom_init(iot, config, rate, frequency, cflag, &sscomconsioh);
+ res = sscom_init(iot, ioh, config,
+ rate, frequency, cflag, &sscomconsioh);
if (res)
return res;
@@ -2022,7 +2025,8 @@
#ifdef KGDB
int
-sscom_kgdb_attach(bus_space_tag_t iot, const struct sscom_uart_info *config,
+sscom_kgdb_attach(bus_space_tag_t iot, bus_space_handle_t ioh,
+ const struct sscom_uart_info *config,
int rate, int frequency, tcflag_t cflag)
{
int res;
@@ -2032,7 +2036,8 @@
return EBUSY; /* cannot share with console */
}
- res = sscom_init(iot, config, rate, frequency, cflag, &sscom_kgdb_ioh);
+ res = sscom_init(iot, ioh, config,
+ rate, frequency, cflag, &sscom_kgdb_ioh);
if (res)
return res;
diff -r b692bf884198 -r eca149d76fd7 sys/arch/arm/samsung/sscom_var.h
--- a/sys/arch/arm/samsung/sscom_var.h Wed Apr 16 20:39:55 2014 +0000
+++ b/sys/arch/arm/samsung/sscom_var.h Wed Apr 16 21:28:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sscom_var.h,v 1.2 2014/04/14 21:16:15 reinoud Exp $ */
+/* $NetBSD: sscom_var.h,v 1.3 2014/04/16 21:28:51 reinoud Exp $ */
/*
* Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -243,13 +243,14 @@
int sscomrxintr(void *);
int sscomintr(void *);
-int sscom_cnattach(bus_space_tag_t, const struct sscom_uart_info *,
- int, int, tcflag_t);
+int sscom_cnattach(bus_space_tag_t, bus_space_handle_t,
+ const struct sscom_uart_info *, int, int, tcflag_t);
void sscom_cndetach(void);
int sscom_is_console(bus_space_tag_t, int, bus_space_handle_t *);
#ifdef KGDB
-int sscom_kgdb_attach(bus_space_tag_t, const struct sscom_uart_info *,
+int sscom_kgdb_attach(bus_space_tag_t, bus_space_handle_t,
+ const struct sscom_uart_info *,
int, int, tcflag_t);
#endif
Home |
Main Index |
Thread Index |
Old Index