From: Paul M. <le...@us...> - 2002-03-10 23:15:49
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/common In directory usw-pr-cvs1:/tmp/cvs-serv25942/common Modified Files: Makefile icu.c Added Files: power.c probe-ram.c time.c Log Message: Add back in some remnants of the prior Vr4111 common code, and start cleaning them up for the new structure.. --- NEW FILE: power.c --- /* * VR4111 reset and power management type stuff * * Copyright (C) 2000 Michael Klar * * Copyright (C) 2001 Jim Paris <ji...@jt...> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/config.h> #include <linux/delay.h> #include <linux/mm.h> #include <linux/sysctl.h> #include <linux/pm.h> #include <linux/acpi.h> #include <linux/irq.h> /* for disable_irq, enable_irq, to be removed */ #include <asm/vr41xx.h> #include <asm/cacheops.h> #include <asm/mipsregs.h> #include <asm/pgalloc.h> /* * vr4111_dma_sem is needed because we cannot suspend while a DMA transfer * is in progress, otherwise the CPU will be left in an undefined state. */ extern struct semaphore vr41xx_dma_sem; void vr4111_wait(void) { /* Use "standby" instead of "wait" on VR4111. */ asm volatile ( ".set noreorder\n" "standby\n" "nop\n" "nop\n" "nop\n" ".set reorder\n" ); } void vr4111_hibernate(void) { asm volatile ( " .set noreorder\n" " .align 4\n" " hibernate\n" " nop\n" " nop\n" " nop\n" " .set reorder\n" ); } void vr4111_suspend(void) { asm volatile ( " .set noreorder\n" " .align 4\n" " suspend\n" " nop\n" " nop\n" " nop\n" " .set reorder\n" ); } void vr4111_standby(void) { asm volatile ( " .set noreorder\n" " .align 4\n" " standby\n" " nop\n" " nop\n" " nop\n" " .set reorder\n" ); } --- NEW FILE: probe-ram.c --- /* * arch/mips/vr4111/common/probe-ram.c * * Copyright (C) 1999 Bradley D. LaRonde and Michael Klar * * Copyright (C) 2001 Jim Paris <ji...@jt...> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * */ #include <linux/init.h> #include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <asm/vr41xx.h> extern int _end; unsigned long __init probe_ram_size(void) { unsigned long ramsize; unsigned int *p1, *p2; unsigned int d1, d2; /* Begin probe starting with the first 1MB past the global data */ ramsize = ((unsigned long)&_end + 0x000fffff) & 0x1ff00000; /* Probe sequential 1MB areas, looking for a lack of RAM */ while (ramsize < 0x04000000) { /* Save the data and replace with a pattern */ p1 = (unsigned int *)(KSEG1 + ramsize + 0x000ffff0); d1 = *p1; *p1 = 0x1234a5a5; barrier(); /* Do it again to ensure it's not an empty bus */ p2 = (unsigned int *)(KSEG1 + ramsize + 0x000fffe0); d2 = *p2; *p2 = 0x00ff5a5a; barrier(); /* Is the first pattern there? */ if (*p1 != 0x1234a5a5) break; /* Put the old data back */ *p1 = d1; *p2 = d2; ramsize += 0x00100000; } return ramsize; } --- NEW FILE: time.c --- /* * BRIEF MODULE DESCRIPTION * NEC Vr4111 RTC Unit routines. * * Copyright 2001 MontaVista Software Inc. * Author: Yoichi Yuasa * yy...@mv... or so...@mv... * * Adapted to the VR4111 from arch/mips/vr4122/common/time.c * by Jim Paris <ji...@jt...> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/spinlock.h> #include <linux/config.h> #include <linux/irq.h> #include <asm/io.h> #include <asm/time.h> #include <asm/vr41xx.h> spinlock_t vr4111_rtc_lock = SPIN_LOCK_UNLOCKED; static inline unsigned short read_etime_register(volatile unsigned short *addr) { unsigned short val; do { val = *addr; } while (val != *addr); return val; } static unsigned long vr4111_rtc_get_time(void) { unsigned short etimel, etimem, etimeh; do { etimem = read_etime_register(VR41XX_ETIMEMREG); etimeh = read_etime_register(VR41XX_ETIMEHREG); etimel = read_etime_register(VR41XX_ETIMELREG); } while (etimem != read_etime_register(VR41XX_ETIMEMREG)); return ((etimeh << 17) | (etimem << 1) | (etimel >> 15)); } static int vr4111_rtc_set_time(unsigned long sec) { unsigned long flags; spin_lock_irqsave(&vr4111_rtc_lock, flags); *VR41XX_ETIMELREG = sec << 15; *VR41XX_ETIMEMREG = sec >> 1; *VR41XX_ETIMEHREG = sec >> 17; spin_unlock_irqrestore(&vr4111_rtc_lock, flags); return 0; } void vr4111_time_init(void) { unsigned long clock; unsigned short val; rtc_get_time = vr4111_rtc_get_time; rtc_set_time = vr4111_rtc_set_time; /* If it's not already set (by board-specific code), figure out the counter frequency from the clock speed register */ if(mips_counter_frequency) return; val = *VR41XX_CLKSPEEDREG; if((val & 0x1f)==0) panic("can't determine core clock clock: divide by zero!"); clock = (18432000 * 64) / (val & 0x1f); printk("CPU core clock: %ldHz\n",clock); switch((~val) & 0xE000) { case 0x8000: clock = clock / 2; break; case 0x4000: clock = clock / 3; break; case 0x2000: clock = clock / 4; break; default: panic("can't determine peripheral clock: unknown divisor!"); } printk("Peripheral unit clock: %ldHz\n",clock); mips_counter_frequency = clock / 4; } void vr4111_timer_setup(struct irqaction *irq) { unsigned int count; count = read_32bit_cp0_register(CP0_COUNT); write_32bit_cp0_register (CP0_COMPARE, count + (mips_counter_frequency / HZ)); setup_irq(VR41XX_IRQ_TIMER, irq); } Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/common/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 7 Mar 2002 03:16:53 -0000 1.1 +++ Makefile 10 Mar 2002 23:15:47 -0000 1.2 @@ -15,6 +15,6 @@ O_TARGET := vr4111.o -obj-y := bcu.o cmu.o icu.o siu.o +obj-y := bcu.o cmu.o icu.o siu.o power.o probe-ram.o time.o include $(TOPDIR)/Rules.make Index: icu.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/common/icu.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- icu.c 7 Mar 2002 03:16:53 -0000 1.1 +++ icu.c 10 Mar 2002 23:15:47 -0000 1.2 @@ -47,6 +47,7 @@ #include <asm/io.h> #include <asm/mipsregs.h> #include <asm/vr41xx.h> +#include <asm/gdb-stub.h> #include "icu.h" @@ -330,6 +331,12 @@ setup_irq(GIU_IRQ, &cascade); set_except_vector(0, vr41xx_handle_interrupt); + +#ifdef CONFIG_REMOTE_DEBUG + printk("Setting debug traps - please connect the remote debugger.\n"); + set_debug_traps(); + breakpoint(); +#endif } /*=======================================================================*/ |