From: Leblanc f. <fle...@us...> - 2002-03-07 09:15:19
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr4111/common In directory usw-pr-cvs1:/tmp/cvs-serv3157/arch/mips/vr4111/common Modified Files: power.c serial.c Log Message: Adds more VR stuff for Cassiopeia E15 Support. Index: power.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr4111/common/power.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- power.c 27 Nov 2001 01:16:41 -0000 1.2 +++ power.c 7 Mar 2002 09:15:16 -0000 1.3 @@ -57,7 +57,8 @@ ); } -static inline void vr4111_suspend(void) +/*static inline*/ +void vr4111_suspend(void) { asm volatile ( " .set noreorder\n" @@ -70,7 +71,7 @@ ); } -static inline void vr4111_standby(void) +void vr4111_standby(void) { asm volatile ( " .set noreorder\n" Index: serial.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/vr4111/common/serial.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- serial.c 30 Nov 2001 18:34:09 -0000 1.3 +++ serial.c 7 Mar 2002 09:15:16 -0000 1.4 @@ -28,6 +28,9 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/serial.h> +#ifdef CONFIG_REMOTE_DEBUG +#include <linux/serial_reg.h> +#endif #include <asm/string.h> #include <asm/io.h> #include <asm/vr41xx.h> @@ -57,4 +60,95 @@ panic("vr4111_init_serial() failed!"); } } + +#ifdef CONFIG_REMOTE_DEBUG + +/* + * 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 = 120; + *VR41XX_SIUDLM = 0; /* hardcoded: set to 9600 */ + 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); +} + +#endif /* CONFIG_REMOTE_DEBUG */ + |