From: Steve L. <slo...@us...> - 2002-04-29 23:05:16
|
Update of /cvsroot/linux-mips/linux/arch/mips/rc32300/common In directory usw-pr-cvs1:/tmp/cvs-serv16874/arch/mips/rc32300/common Modified Files: Makefile dbg_io.c puts.c reset.c time.c Added Files: prom.c Removed Files: idtdisplay.c Log Message: Initial IDT 79EB355 support. --- NEW FILE: prom.c --- /* * * BRIEF MODULE DESCRIPTION * PROM library initialization code for the IDT 79S334A and 79EB355 * boards, assumes the boot code is IDT/sim. * * Copyright 2001,2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * * This file was derived from Carsten Langgaard's * arch/mips/mips-boards/xx files. * * Carsten Langgaard, car...@mi... * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * * 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/kdev_t.h> #include <linux/major.h> #include <linux/console.h> #include <asm/bootinfo.h> #include <asm/page.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/bootmem.h> #include <linux/ioport.h> #include <asm/rc32300/rc32300.h> char arcs_cmdline[CL_SIZE]; char * __init prom_getcmdline(void) { return &(arcs_cmdline[0]); } #ifdef CONFIG_IDT_79EB355 /* * NVRAM on the 79EB355 is internal to the DS1511 RTC and uses * indexed addressing. */ static inline u8 nvreadb(int offset) { writeb((u8)offset, &rtc->nvram_addr); return readb(&rtc->nvram_data); } #else static inline u8 nvreadb(int offset) { return *((u8*)KSEG1ADDR(NVRAM_BASE + offset)); } #endif static inline u8 env_readb(int env_index) { return nvreadb(NVRAM_ENVSTART_OFF + env_index); } /* * Parses environment variable strings in NVRAM, copying strings * beginning with "bootparm?=" to arcs_cmdline[]. For example, * * netaddr=10.0.1.95 * bootaddr=10.0.0.139 * bootfile=vmlinus * bootparm1=root=/dev/nfs * bootparm2=ip=10.0.1.95 * * is parsed to: * * root=/dev/nfs ip=10.0.1.95 * * in arcs_cmdline[]. */ static void prom_init_cmdline(void) { int env_size, env_index, arcs_index; env_index = arcs_index = 0; /* stored size is 2 bytes, always big endian order */ env_size = (int)((nvreadb(NVRAM_ENVSIZE_OFF) << 8) + nvreadb(NVRAM_ENVSIZE_OFF+1)); if (env_size < 0 || env_size > 512) return; /* invalid total env size */ while (env_index < env_size && arcs_index < sizeof(arcs_cmdline)) { char env_str[100]; int i, arcs_len; /* first byte is length of this env variable string, including the length. */ int env_len = env_readb(env_index); int max_len = min(100, env_size - env_index); if (env_len == 0 || env_len > max_len) break; /* invalid env variable size */ /* copy the env string */ for (i=0; i<env_len; i++) env_str[i] = env_readb(env_index + i); if (strncmp(&env_str[1], "bootparm", 8) == 0) { /* copy to arcs, skipping over length byte and "bootparm?=" string, a total of 11 chars. */ arcs_len = env_len - 11; /* will this string fit in arcs ? */ if (arcs_index + arcs_len + 1 > sizeof(arcs_cmdline)) break; /* nope */ memcpy(&arcs_cmdline[arcs_index], &env_str[11], arcs_len); arcs_index += arcs_len; /* add a blank between env variables */ arcs_cmdline[arcs_index++] = ' '; #ifdef CONFIG_IDT_79EB355 } else if (strncmp(&env_str[1], "ethaddr", 7) == 0) { /* copy to arcs, skipping over length byte */ arcs_len = env_len - 1; /* will this string fit in arcs ? */ if (arcs_index + arcs_len + 1 > sizeof(arcs_cmdline)) break; /* nope */ memcpy(&arcs_cmdline[arcs_index], &env_str[1], arcs_len); arcs_index += arcs_len; /* add a blank between env variables */ arcs_cmdline[arcs_index++] = ' '; #endif } /* increment to next prom env variable */ env_index += env_len; } arcs_cmdline[arcs_index] = '\0'; } extern unsigned long mips_machgroup; extern unsigned long mips_machtype; const char *get_system_type(void) { #ifdef CONFIG_IDT_79EB355 return "IDT 79EB355"; #else return "IDT 79S334A"; #endif } struct resource rc32300_res_ram = { "RAM", 0, RAM_SIZE, IORESOURCE_MEM }; int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) { /* set up command line */ prom_init_cmdline(); /* set our arch type */ mips_machgroup = MACH_GROUP_IDT; #ifdef CONFIG_IDT_79EB355 mips_machtype = MACH_IDT79EB355; #else mips_machtype = MACH_IDT79S334; #endif add_memory_region(0, rc32300_res_ram.end - rc32300_res_ram.start, BOOT_MEM_RAM); return 0; } void prom_free_prom_memory(void) { } Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/rc32300/common/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 17 Jan 2002 03:09:08 -0000 1.2 +++ Makefile 29 Apr 2002 23:05:11 -0000 1.3 @@ -19,8 +19,6 @@ O_TARGET := rc32300.o -obj-y := int-handler.o reset.o puts.o time.o idtdisplay.o - -obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o +obj-y := dbg_io.o int-handler.o reset.o prom.o puts.o time.o include $(TOPDIR)/Rules.make Index: dbg_io.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/rc32300/common/dbg_io.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dbg_io.c 24 Jan 2002 20:13:34 -0000 1.5 +++ dbg_io.c 29 Apr 2002 23:05:11 -0000 1.6 @@ -2,8 +2,6 @@ #include <linux/config.h> #include <asm/rc32300/rc32300.h> -#ifdef CONFIG_REMOTE_DEBUG - /* --- CONFIG --- */ /* we need uint32 uint8 */ @@ -58,8 +56,8 @@ /* memory-mapped read/write of the port */ -#define UART16550_READ(y) rc32300_inb(DEBUG_BASE + y) -#define UART16550_WRITE(y,z) rc32300_outb(z, DEBUG_BASE + y) +#define UART16550_READ(y) rc32300_readb(DEBUG_BASE + y) +#define UART16550_WRITE(y,z) rc32300_writeb(z, DEBUG_BASE + y) static void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) { @@ -115,5 +113,3 @@ UART16550_WRITE(OFS_SEND_BUFFER, byte); return 1; } - -#endif Index: puts.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/rc32300/common/puts.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- puts.c 24 Jan 2002 20:13:34 -0000 1.6 +++ puts.c 29 Apr 2002 23:05:11 -0000 1.7 @@ -58,14 +58,14 @@ int i = 0; do { - ch = rc32300_inb(SER_CMD); + ch = rc32300_readb(SER_CMD); slow_down(); i++; if (i > TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); - rc32300_outb(c, SER_DATA); + rc32300_writeb(c, SER_DATA); } void puts(unsigned char *cp) @@ -75,14 +75,14 @@ while (*cp) { do { - ch = rc32300_inb(SER_CMD); + ch = rc32300_readb(SER_CMD); slow_down(); i++; if (i > TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); - rc32300_outb(*cp++, SER_DATA); + rc32300_writeb(*cp++, SER_DATA); } putch('\r'); putch('\n'); @@ -96,14 +96,14 @@ while (*cp) { do { - ch = rc32300_inb(SER_CMD); + ch = rc32300_readb(SER_CMD); slow_down(); i++; if (i > TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); - rc32300_outb(*cp++, SER_DATA); + rc32300_writeb(*cp++, SER_DATA); } } Index: reset.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/rc32300/common/reset.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- reset.c 24 Jan 2002 20:13:34 -0000 1.5 +++ reset.c 29 Apr 2002 23:05:11 -0000 1.6 @@ -44,13 +44,15 @@ flush_cache_all(); write_32bit_cp0_register(CP0_WIRED, 0); -#ifdef CONFIG_CPU_RC32334 +#ifdef CONFIG_MIPS_RC32334 // Trigger the WatchDog Timer (Timer 3) to warm reset - rc32300_outl(0, TIMER0_CNTL + 3*TIMER_REG_OFFSET); - rc32300_outl(0xd8, CPU_IP_BUSERR_CNTL); - rc32300_outl(0, TIMER0_COUNT + 3*TIMER_REG_OFFSET); - rc32300_outl(2, TIMER0_COMPARE + 3*TIMER_REG_OFFSET); - rc32300_outl(1, TIMER0_CNTL + 3*TIMER_REG_OFFSET); + rc32300_writel(0, TIMER0_CNTL + 3*TIMER_REG_OFFSET); + rc32300_writel(0xd8, CPU_IP_BUSERR_CNTL); + rc32300_writel(0, TIMER0_COUNT + 3*TIMER_REG_OFFSET); + rc32300_writel(2, TIMER0_COMPARE + 3*TIMER_REG_OFFSET); + rc32300_writel(1, TIMER0_CNTL + 3*TIMER_REG_OFFSET); +#elif defined (CONFIG_MIPS_RC32355) + rc32300_writel(0x80000001, RESET_CNTL); #else __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); #endif Index: time.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/rc32300/common/time.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- time.c 17 Jan 2002 21:07:24 -0000 1.4 +++ time.c 29 Apr 2002 23:05:11 -0000 1.5 @@ -42,6 +42,10 @@ extern unsigned int mips_counter_frequency; +#if defined(CONFIG_IDT_79EB355) && defined(CONFIG_MIPS_RTC) +extern void rtc_ds1501_init(void); +#endif + /* * Figure out the r4k offset, the amount to increment the compare * register for each time tick. There is no RTC available. @@ -71,6 +75,11 @@ printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, (est_freq%1000000)*100/1000000); __restore_flags(flags); + +#if defined(CONFIG_IDT_79EB355) && defined(CONFIG_MIPS_RTC) + /* The 79EB355 board has the Dallas DS1511 RTC chip */ + rtc_ds1501_init(); +#endif } --- idtdisplay.c DELETED --- |