NetBSD Problem Report #43990
From bds@ifgd.net Thu Oct 21 00:51:45 2010
Return-Path: <bds@ifgd.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 87E5D63B8AD
for <gnats-bugs@gnats.NetBSD.org>; Thu, 21 Oct 2010 00:51:45 +0000 (UTC)
Message-Id: <20101020232220.F3CCA1B895@thunderstorm.ifgd.net>
Date: Wed, 20 Oct 2010 18:22:20 -0500 (CDT)
From: bds@ifgd.net
Reply-To: bds@ifgd.net
To: gnats-bugs@gnats.NetBSD.org
Subject: a few problems with the new evbarm marvell orion/kirkwood code
X-Send-Pr-Version: 3.95
>Number: 43990
>Category: port-evbarm
>Synopsis: a few problems with the new marvell orion/kirkwood code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-evbarm-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 21 00:55:00 +0000 2010
>Closed-Date: Fri Sep 16 05:42:00 +0000 2011
>Last-Modified: Fri Sep 16 05:42:00 +0000 2011
>Originator: Brett Slager
>Release: NetBSD current 5.99.39 - sources from today 10/20/2010
>Organization:
>Environment:
System: NetBSD 5.99.39 on evbarm Marvell orion/kirkwood systems
>Description:
I have 3 systems that I've tried the evbarm/Marvell code on, and
have noticed and come up with fixes for a few issues:
1. The port range for the com0 console isn't printed due to
it's size not being set in the driver match function. (very minor)
2. Kernel freezes during autoconf on the TS-7800 due to the
mvsoctmr 0 not running as expected. I guess u-boot starts the timer
on other systems so they worked on accident? (showstopper)
3. None of my 3 systems will reboot without a power cycle.
(quite annoying)
>How-To-Repeat:
(Try to) run netbsd evbarm on a Sheevaplug, Guruplug, and a
Technologic Systems TS-7800. (TS-7800 requires other changes as well
that I'm working on.)
>Fix:
All patches tested on all 3 systems.
Fix for #1:
Set the size also in the console case
Index: com_mv.c
===================================================================
RCS file: /cvsroot/src/sys/dev/marvell/com_mv.c,v
retrieving revision 1.4
diff -u -r1.4 com_mv.c
--- com_mv.c 4 Sep 2010 05:01:20 -0000 1.4
+++ com_mv.c 20 Oct 2010 22:16:11 -0000
@@ -87,8 +87,11 @@
mva->mva_irq == MVA_IRQ_DEFAULT)
return 0;
- if (com_is_console(mva->mva_iot, mva->mva_addr + mva->mva_offset, NULL))
+ if (com_is_console(mva->mva_iot, mva->mva_addr + mva->mva_offset,
+ NULL)) {
+ mva->mva_size = MVUART_SIZE;
return 1;
+ }
if (bus_space_subregion(mva->mva_iot, mva->mva_ioh, mva->mva_offset,
MVUART_SIZE, &ioh))
Fix for #2:
start timer 0 at attach so delay() can be used during autoconf
Index: mvsoctmr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/marvell/mvsoctmr.c,v
retrieving revision 1.1
diff -u -r1.1 mvsoctmr.c
--- mvsoctmr.c 3 Oct 2010 05:49:24 -0000 1.1
+++ mvsoctmr.c 20 Oct 2010 22:08:27 -0000
@@ -121,6 +121,10 @@
if (bus_space_subregion(mva->mva_iot, mva->mva_ioh,
mva->mva_offset, mva->mva_size, &sc->sc_ioh))
panic("%s: Cannot map registers", device_xname(self));
+
+ /* start timer0 for the benefit of delay() during autoconf */
+ clock_ticks = mvTclk / hz;
+ mvsoctmr_cntl(sc, MVSOCTMR_TIMER0, clock_ticks, 1, 1);
}
/*
Fix for #3:
Set up a function to reset the machine when cpu_reset() is called.
Index: marvell_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/marvell/marvell_machdep.c,v
retrieving revision 1.1
diff -u -r1.1 marvell_machdep.c
--- marvell_machdep.c 3 Oct 2010 06:03:10 -0000 1.1
+++ marvell_machdep.c 20 Oct 2010 22:04:47 -0000
@@ -90,9 +90,11 @@
* Address to call from cpu_reset() to reset the machine.
* This is machine architecture dependant as it varies depending
* on where the ROM appears when you turn the MMU off.
+ * We set this to call soft_cpu_reset() (from marvell_start.S) in initarm().
*/
-u_int cpu_reset_address = 0xffff0000;
+u_int cpu_reset_address;
+void soft_cpu_reset(void);
/* Define various stack sizes in pages */
#define IRQ_STACK_SIZE 1
@@ -292,6 +294,9 @@
u_int l1pagetable;
int loop, pt_index, cs, memtag = 0, iotag = 0, window;
+ /* set address for reboot/reset */
+ cpu_reset_address = KERN_VTOPHYS(soft_cpu_reset);
+
/* map some peripheral registers */
pmap_devmap_bootstrap((vaddr_t)read_ttb(), marvell_devmap);
Index: marvell_start.S
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/marvell/marvell_start.S,v
retrieving revision 1.1
diff -u -r1.1 marvell_start.S
--- marvell_start.S 3 Oct 2010 06:03:10 -0000 1.1
+++ marvell_start.S 20 Oct 2010 22:04:47 -0000
@@ -64,6 +64,8 @@
#include <arm/armreg.h>
#include <arm/arm32/pte.h>
#include <arm/arm32/pmap.h> /* for PMAP_DOMAIN_KERNEL */
+#include <arm/marvell/mvsocreg.h>
+#include <evbarm/marvell/marvellreg.h>
#ifndef SDRAM_START
#define SDRAM_START 0x00000000
@@ -185,6 +187,21 @@
sheeva_cores_end:
#endif
+/*
+ * software reset cpu for reboot
+ */
+#define RESET_MASKR (MARVELL_INTERREGS_PBASE + MVSOC_MLMB_BASE + \
+ MVSOC_MLMB_RSTOUTNMASKR)
+ASENTRY_NP(soft_cpu_reset)
+ ldr r0, =RESET_MASKR
+ mov r1, #0x4 /* unmask SW reset */
+ mov r2, #0x1 /* set SW reset */
+ stmia r0, {r1-r2} /* do it */
+4:
+ nop /* spin here until hw resets */
+ b 4b
+ /* NOTREACHED */
+
#define MMU_INIT(va,pa,n_sec,attr) \
.word n_sec ; \
.word 4 * ((va) >> L1_S_SHIFT) ; \
>Release-Note:
>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43990 CVS commit: src/sys/dev/marvell
Date: Fri, 28 Jan 2011 16:12:23 +0000
Module Name: src
Committed By: jakllsch
Date: Fri Jan 28 16:12:23 UTC 2011
Modified Files:
src/sys/dev/marvell: com_mv.c
Log Message:
Set mva_size in the console case.
Addresses first portion of PR#43990.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/com_mv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43990 CVS commit: src/sys/arch
Date: Tue, 1 Feb 2011 22:54:25 +0000
Module Name: src
Committed By: jakllsch
Date: Tue Feb 1 22:54:24 UTC 2011
Modified Files:
src/sys/arch/arm/marvell: mvsocreg.h
src/sys/arch/evbarm/marvell: marvell_machdep.c
Log Message:
Address 3rd issue in PR#43990.
Different implementation but same method as suggested.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/marvell/mvsocreg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/marvell/marvell_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Brett Slager <bds@ifgd.net>
To: gnats-bugs@netbsd.org
Cc: jakllsch@netbsd.org
Subject: Re: port-evbarm/43990: can be closed
Date: Thu, 15 Sep 2011 23:04:16 -0500
The remaining issue in PR/43990 was taken care of by the following
commit:
http://mail-index.netbsd.org/source-changes/2011/06/09/msg023027.html
delay(9) now uses a timer that is started early enough.
PR/43990 can be closed.
--Brett
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 16 Sep 2011 05:42:00 +0000
State-Changed-Why:
Submitter reports problem is fixed. Thanks for the update!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.