NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-evbarm/43990: a few problems with the new evbarm marvell orion/kirkwood code



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 21 00:55:00 +0000 2010
>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)                    ; \



Home | Main Index | Thread Index | Old Index