From: Leblanc f. <fle...@us...> - 2002-03-22 10:22:48
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/casio-e15 In directory usw-pr-cvs1:/tmp/cvs-serv6638/arch/mips/vr41xx/vr4111/casio-e15 Modified Files: Makefile setup.c Added Files: gdb.c Log Message: Casio E15 power on/off improvement & GPIO Documentation added. --- NEW FILE: gdb.c --- /* * arch/mips/vr41xx/vr4111/casio-e15/gdb.c * provide fonctions for gdb use. * * Copyright (C) 2002 Francois Leblanc <fra...@ce...> * * 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. * */ #include <linux/config.h> #include <linux/types.h> #include <linux/serial.h> #include <linux/serial_reg.h> #include <asm/vr41xx.h> /* * This is the interface to the remote debugger stub. * I've put that here to be able to control the serial * device more directly. * * We're a little paranoid with the barrier()s, just in * case the compiler tries to be too cute. */ static int initialized = 0; void DbgInitSerial(void) { unsigned char dummy; /* Ensure that serial is set to RS-232C (not IrDA) */ *VR41XX_SIUIRSEL &= ~VR41XX_SIUIRSEL_SIRSEL; /* Supply clocks to all serial units */ vr41xx_clock_supply(VR41XX_CMUCLKMSK_MSKSIU); vr41xx_clock_supply(VR41XX_CMUCLKMSK_MSKDSIU); vr41xx_clock_supply(VR41XX_CMUCLKMSK_MSKSSIU); #if 0 /* turn on the clocks to the serial port */ serial_power_on(0); #endif *VR41XX_SIULC = UART_LCR_DLAB; /* prepare to set baud rate */ barrier(); *VR41XX_SIUDLL = 10; /* set 120 here for 9600 */ *VR41XX_SIUDLM = 0; /* hardcoded: set to 115200 */ barrier(); *VR41XX_SIULC = UART_LCR_WLEN8; /* clear DLAB, set up for 8N1 */ barrier(); *VR41XX_SIUIE = 0; /* disable interrupts */ *VR41XX_SIUFC = UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT; #ifdef CONFIG_PM //fcr_shadow[0] = 0; #endif *VR41XX_SIUMC = UART_MCR_RTS | UART_MCR_DTR; /* set RTS and DTR */ dummy = *VR41XX_SIURB; /* clear any pending ints */ dummy = *VR41XX_SIUMS; dummy = *VR41XX_SIUIID; barrier(); /* clear the receive buffer (and finish clearing ints) */ while ( *VR41XX_SIULS & UART_LSR_DR ) dummy = *VR41XX_SIURB; } int putDebugChar(unsigned char c) { if (!initialized) { /* need to init device first */ DbgInitSerial(); initialized = 1; } while ( !(*VR41XX_SIULS & UART_LSR_THRE) ) ; barrier(); *VR41XX_SIUTH = c; return 1; } char getDebugChar(void) { if (!initialized) { /* need to init device first */ DbgInitSerial(); initialized = 1; } while ( !(*VR41XX_SIULS & UART_LSR_DR) ) ; barrier(); return(*VR41XX_SIURB); } Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/casio-e15/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 19 Mar 2002 14:22:21 -0000 1.2 +++ Makefile 22 Mar 2002 10:22:43 -0000 1.3 @@ -20,6 +20,7 @@ all: casio-e15.o obj-y += setup.o prom.o +obj-$(CONFIG_REMOTE_DEBUG) += gdb.o include $(TOPDIR)/Rules.make Index: setup.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4111/casio-e15/setup.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- setup.c 19 Mar 2002 14:22:21 -0000 1.3 +++ setup.c 22 Mar 2002 10:22:43 -0000 1.4 @@ -1,38 +1,40 @@ /* - * linux/arch/mips/vr4111/casio/setup.c - * - * VR41xx setup routines - * - * Copyright (C) 1999 Bradley D. LaRonde - * Copyright (C) 1999, 2000 Michael Klar + * FILE NAME + * arch/mips/vr41xx/vr4111/casio-e15/setup.c * - * Copyright 2001 MontaVista Software Inc. - * Author: js...@mv... or js...@ju... + * BRIEF MODULE DESCRIPTION + * Setup for the CASIO CASSIOPEIA E-15. * - * Copyright 2001 Jim Paris <ji...@jt...> + * Copyright 2002 Yoichi Yuasa + * yu...@hh... * - * 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. + * 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. * */ +/* + * Changes: + * - Francois Leblanc <fra...@ce...> + * Copy from casio-e55/setup.c an update to casio-e15. + * + */ #include <linux/config.h> #include <linux/init.h> #include <linux/console.h> -#ifdef CONFIG_IDE #include <linux/ide.h> -#endif #include <linux/ioport.h> #include <asm/reboot.h> #include <asm/time.h> #include <asm/vr41xx.h> #include <asm/vr41xx/e15.h> -#ifdef CONFIG_PM_SUSPEND_WAKEUP -#include <asm/power.h> -#endif extern void vr41xx_xblink_led(unsigned int times, unsigned int time_on, unsigned int time_off); +extern void vr4111_wait(void); +extern void vr4111_hibernate(void); +extern void vr4111_suspend(void); #ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start, initrd_end; @@ -50,6 +52,94 @@ { } +#ifdef CONFIG_PM_SUSPEND_WAKEUP +void vr41xx_board_hibernate(void) +{ + vr4111_hibernate(); +} +#endif +#ifdef CONFIG_PM_POWERED_SUSPEND +void vr41xx_board_suspend(void) +{ + vr4111_suspend(); +} +#endif +#ifdef CONFIG_PM_STANDBY +void vr41xx_board_standby(void) +{ + vr4111_wait(); +} +#endif + +#ifdef CONFIG_PM_SUSPEND_WAKEUP +#include <asm/vr41xx-platdep.h> +#include <asm/gdb-stub.h> + +extern void breakpoint(void); +extern void kernel_entry(void); +extern void DbgInitSerial(void); + +// Put contents of WINCE_SIGNATURE_CHECK1 & 2 at +// WINCE_SIGNATURE_ADD1 & 2 set WINCE_RETURN_ADD +// to kernel_entry for go back to linux. + +#define WINCE_SIGNATURE_ADD1 ((unsigned int *)0xa0006000) +#define WINCE_SIGNATURE_ADD2 ((unsigned int *)0xa0006004) +#define WINCE_RETURN_ADD ((unsigned int *)0xa0006008) +#define WINCE_SIGNATURE_CHECK1 ((unsigned int *)0x9f00048c) +#define WINCE_SIGNATURE_CHECK2 ((unsigned int *)0x9f000490) + +static unsigned int wince_signature_old1; +static unsigned int wince_signature_old2; +static unsigned int wince_return_old; + +static asmlinkage void casio_e15_wakeup(void) +{ + write_32bit_cp0_register(CP0_STATUS, ST0_CU0); + + // Let the CPU know we are alive by resetting HAL timer. + *VR41XX_PMUCNTREG |= 0x4; + + // Restore context, necessary if do_wakeup scratch + // the next reset call should restore wince internal + // since memory signature is corrupted ! + *WINCE_SIGNATURE_ADD1 = wince_signature_old1; + *WINCE_SIGNATURE_ADD2 = wince_signature_old2; + *WINCE_RETURN_ADD = wince_return_old; + +#ifdef CONFIG_REMOTE_DEBUG + //re-init serial + set_debug_traps(); + DbgInitSerial(); +#endif + + //try restore screen view + gpiolcd_lcdpower(1); + +#ifdef CONFIG_VR41XX_LED + vr41xx_xblink_led(2, 12, 3); +#endif + + // restart kernel + kernel_entry(); +} + +void vr41xx_extend_hibernate(void) +{ + // wince E15 signature + wince_signature_old1 = *WINCE_SIGNATURE_ADD1; + wince_signature_old2 = *WINCE_SIGNATURE_ADD2; + wince_return_old = *WINCE_RETURN_ADD; + + *WINCE_SIGNATURE_ADD1 = *WINCE_SIGNATURE_CHECK1; + *WINCE_SIGNATURE_ADD2 = *WINCE_SIGNATURE_CHECK2; + *WINCE_RETURN_ADD = casio_e15_wakeup; + + printk (KERN_NOTICE "Hibernate signature set, ready for wake up !\n"); + +} +#endif /* end of CONFIG_PM_SUSPEND_WAKEUP */ + void __init nec_vr41xx_setup(void) { set_io_port_base(IO_PORT_BASE); @@ -88,6 +178,7 @@ init_MUTEX(&vr41xx_dma_sem); #ifdef CONFIG_VR41XX_LED - vr41xx_xblink_led(4, 16, 4); + vr41xx_xblink_led(2, 12, 3); #endif } + |