From: Steve L. <slo...@us...> - 2002-04-29 23:05:14
|
Update of /cvsroot/linux-mips/linux/arch/mips/rc32300/79EB355 In directory usw-pr-cvs1:/tmp/cvs-serv16874/arch/mips/rc32300/79EB355 Added Files: Makefile irq.c lcd.c rtc-ds1501.c setup.c Log Message: Initial IDT 79EB355 support. --- NEW FILE: Makefile --- # # Copyright 2001 MontaVista Software Inc. # Author: MontaVista Software, Inc. # st...@mv... or so...@mv... # # Makefile for the IDT 79EB355 board specific parts of the kernel # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o O_TARGET := idt-79EB355.o obj-y := irq.o lcd.o setup.o obj-$(CONFIG_MIPS_RTC) += rtc-ds1501.o include $(TOPDIR)/Rules.make --- NEW FILE: irq.c --- /* * BRIEF MODULE DESCRIPTION * RC32355 interrupt routines. * * Copyright 2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * * 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/errno.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/timex.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/delay.h> #include <asm/bitops.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/mipsregs.h> #include <asm/system.h> #include <asm/rc32300/rc32300.h> #undef DEBUG_IRQ #ifdef DEBUG_IRQ /* note: prints function name for you */ #define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args) #else #define DPRINTK(fmt, args...) #endif #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); #endif extern asmlinkage void rc32300_IRQ(void); extern void set_debug_traps(void); extern irq_cpustat_t irq_stat [NR_CPUS]; unsigned int local_bh_count[NR_CPUS]; unsigned int local_irq_count[NR_CPUS]; static unsigned int startup_irq(unsigned int irq); static void end_irq(unsigned int irq_nr); static void mask_and_ack_irq(unsigned int irq_nr); static void rc32355_enable_irq(unsigned int irq_nr); static void rc32355_disable_irq(unsigned int irq_nr); extern unsigned int do_IRQ(int irq, struct pt_regs *regs); extern void __init init_generic_irq(void); #ifdef CONFIG_PM extern void counter0_irq(int irq, void *dev_id, struct pt_regs *regs); #endif typedef struct { int irq_base; /* Base IRQ # of this interrupt group */ int num_irqs; /* Number of IRQs in this group */ u32 mask; /* mask of valid bits in pending/mask registers */ } intr_group_t; static const intr_group_t intr_group[NUM_INTR_GROUPS] = { { GROUP0_IRQ_BASE, 6, 0x0000003f }, { GROUP1_IRQ_BASE, 16, 0x0000ffff }, { GROUP2_IRQ_BASE, 10, 0x000003ff }, { GROUP3_IRQ_BASE, 24, 0x00ffffff }, { GROUP4_IRQ_BASE, 32, 0xffffffff } }; #define READ_PEND(g) \ rc32300_readl(IC_GROUP0_PEND + (g)*IC_GROUP_OFFSET) #define READ_MASK(g) \ rc32300_readl(IC_GROUP0_MASK + (g)*IC_GROUP_OFFSET) #define WRITE_MASK(g,val) \ rc32300_writel((val), IC_GROUP0_MASK + (g)*IC_GROUP_OFFSET) static inline int irq_to_group(unsigned int irq_nr) { int i; for (i=NUM_INTR_GROUPS-1; i >= 0; i--) { if (irq_nr >= intr_group[i].irq_base) break; } return i; } static inline int ip_to_irq(int ipnum) { if (ipnum <= 6 && ipnum >= 2) return intr_group[ipnum-2].irq_base; else return ipnum; } static inline int irq_to_ip(int irq) { if (irq < GROUP0_IRQ_BASE) { return irq; } else { return irq_to_group(irq) + 2; } } static inline int group_to_ip(int group) { return group + 2; } static inline int ip_to_group(int ipnum) { return ipnum - 2; } static inline void enable_local_irq(unsigned int irq_nr) { int ipnum = irq_to_ip(irq_nr); clear_cp0_cause(1 << (ipnum + 8)); set_cp0_status(1 << (ipnum + 8)); } static inline void disable_local_irq(unsigned int irq_nr) { int ipnum = irq_to_ip(irq_nr); clear_cp0_status(1 << (ipnum + 8)); } static inline void ack_local_irq(unsigned int irq_nr) { int ipnum = irq_to_ip(irq_nr); clear_cp0_cause(1 << (ipnum + 8)); } static void enable_exp_irq(unsigned int irq_nr, int group) { const intr_group_t* g = &intr_group[group]; u32 mask, intr_bit; // calc interrupt bit within group intr_bit = (1 << (irq_nr - g->irq_base)) & g->mask; if (!intr_bit) return; DPRINTK("irq%d (group %d, mask %d)\n", irq_nr, group, intr_bit); // first enable the IP mapped to this IRQ enable_local_irq(irq_nr); // unmask intr within group mask = READ_MASK(group) & g->mask; WRITE_MASK(group, mask & ~intr_bit); } static void disable_exp_irq(unsigned int irq_nr, int group) { const intr_group_t* g = &intr_group[group]; u32 mask, intr_bit; // calc interrupt bit within group intr_bit = (1 << (irq_nr - g->irq_base)) & g->mask; if (!intr_bit) return; DPRINTK("irq%d (group %d, mask %d)\n", irq_nr, group, intr_bit); // mask intr within group mask = READ_MASK(group) & g->mask; mask |= intr_bit; WRITE_MASK(group, mask); /* if there are no more interrupts enabled in this group, disable corresponding IP */ if (mask == g->mask) disable_local_irq(irq_nr); } static void rc32355_enable_irq(unsigned int irq_nr) { unsigned long flags; save_and_cli(flags); if (irq_nr < GROUP0_IRQ_BASE) enable_local_irq(irq_nr); else { int group = irq_to_group(irq_nr); enable_exp_irq(irq_nr, group); } restore_flags(flags); } static void rc32355_disable_irq(unsigned int irq_nr) { unsigned long flags; save_and_cli(flags); if (irq_nr < GROUP0_IRQ_BASE) disable_local_irq(irq_nr); else { int group = irq_to_group(irq_nr); disable_exp_irq(irq_nr, group); } restore_flags(flags); } void rc32355_ack_irq(unsigned int irq_nr) { ack_local_irq(irq_nr); } static unsigned int startup_irq(unsigned int irq_nr) { rc32355_enable_irq(irq_nr); return 0; } static void shutdown_irq(unsigned int irq_nr) { rc32355_disable_irq(irq_nr); return; } static void mask_and_ack_irq(unsigned int irq_nr) { rc32355_disable_irq(irq_nr); ack_local_irq(irq_nr); } static void end_irq(unsigned int irq_nr) { if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) { if (irq_nr < GROUP0_IRQ_BASE) { ack_local_irq(irq_nr); enable_local_irq(irq_nr); } else { int group = irq_to_group(irq_nr); enable_exp_irq(irq_nr, group); } } else { printk("warning: end_irq %d did not enable (%x)\n", irq_nr, irq_desc[irq_nr].status); } } static struct hw_interrupt_type rc32355_irq_type = { "RC32355", startup_irq, shutdown_irq, rc32355_enable_irq, rc32355_disable_irq, mask_and_ack_irq, end_irq, NULL }; void __init init_IRQ(void) { int i; unsigned long cp0_status; cp0_status = read_32bit_cp0_register(CP0_STATUS); memset(irq_desc, 0, sizeof(irq_desc)); set_except_vector(0, rc32300_IRQ); init_generic_irq(); for (i = 0; i < RC32355_NR_IRQS; i++) { irq_desc[i].status = IRQ_DISABLED; irq_desc[i].action = NULL; irq_desc[i].depth = 1; irq_desc[i].handler = &rc32355_irq_type; } #ifdef CONFIG_REMOTE_DEBUG /* If local serial I/O used for debug port, enter kgdb at once */ puts("Waiting for kgdb to connect..."); set_debug_traps(); breakpoint(); #endif } /* * Interrupts are nested. Even if an interrupt handler is registered * as "fast", we might get another interrupt before we return from * *_dispatch(). */ /* Dispatch to expanded interrupts */ static void int01234_dispatch(struct pt_regs *regs, int ipnum) { int group, intr; const intr_group_t* g; u32 pend; group = ip_to_group(ipnum); g = &intr_group[group]; pend = READ_PEND(group) & g->mask; pend &= ~READ_MASK(group); // only unmasked interrupts if (!pend) return; // no interrupts pending in this group intr = 31 - rc32300_clz(pend); #ifdef DEBUG_IRQ idtprintf("%02d%02d", group, intr); #endif do_IRQ(g->irq_base + intr, regs); } static void mips_spurious_interrupt(struct pt_regs *regs) { #if 1 return; #else unsigned long status, cause; printk("got spurious interrupt\n"); status = read_32bit_cp0_register(CP0_STATUS); cause = read_32bit_cp0_register(CP0_CAUSE); printk("status %x cause %x\n", status, cause); printk("epc %x badvaddr %x \n", regs->cp0_epc, regs->cp0_badvaddr); // while(1); #endif } /* Main Interrupt dispatcher */ void rc32300_irqdispatch(unsigned long cp0_cause, struct pt_regs *regs) { unsigned long ip; int ipnum; ip = (cp0_cause >> 8) & 0xff; if (!ip) { mips_spurious_interrupt(regs); return; } ipnum = 31 - rc32300_clz(ip); if (ipnum >= 2 && ipnum <= 6) { int01234_dispatch(regs, ipnum); } else { int irq = ip_to_irq(ipnum); do_IRQ(irq, regs); } } --- NEW FILE: lcd.c --- /* * BRIEF MODULE DESCRIPTION * IDT 79EB355 lcd support. * * Copyright 2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * * Modified slightly from version by IDT: * * Copyright a 2000 by Integrated Device Technology, Inc. * This software is the property of the Integrated Device * Technology, Inc. (IDT). * IDT MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * WITH REGARD TO THIS SOFTWARE. IN NO EVENT SHALL IDT * BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN * CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, * OR USE OF THIS SOFTWARE. * * 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/init.h> #include <linux/irq.h> #include <linux/ioport.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/rc32300/rc32300.h> #define LCD_FUNC_SET 0x38 #define LCD_ENT_MODE 0x06 #define LCD_DISP_ON_CURS_OFF 0x0C #define LCD_DISP_ON_CURS_ON 0x0E #define LCD_DISP_CLEAR 0x01 #define LCD_DDRAM_ADR_SET_0 0x80 #define LCD_DDRAM_ADR_SET_1 0xC0 #define LCD_MAX_CHAR_PER_LINE 16 #define LCD_MAX_LINES 2 static void delay_lcd_long(void) { int ii ; for (ii = 0 ; ii < 0x5FF ; ii++) ; } static void delay_lcd_short(void) { int ii ; for (ii = 0 ; ii < 0x1FF ; ii++) ; } int init_lcd(void) { u8* chLcdBase = (u8*)KSEG1ADDR(LCD_BASE); /*-------------- Reset LCD ---------------------------*/ delay_lcd_long() ; /* send function select 4 times */ writeb(LCD_FUNC_SET, chLcdBase); delay_lcd_long() ; writeb(LCD_FUNC_SET, chLcdBase); delay_lcd_long() ; writeb(LCD_FUNC_SET, chLcdBase); delay_lcd_long() ; writeb(LCD_FUNC_SET, chLcdBase); delay_lcd_long() ; writeb(LCD_ENT_MODE, chLcdBase); delay_lcd_long() ; writeb(LCD_DISP_ON_CURS_OFF, chLcdBase); delay_lcd_long() ; writeb(LCD_DISP_CLEAR, chLcdBase); delay_lcd_long() ; /* set it to row-0, column-0 */ writeb(LCD_DDRAM_ADR_SET_0, chLcdBase); delay_lcd_long() ; return 0; } int idtprintf(const char *fmt, ...) { va_list args; u8* chLcdData = (u8*)KSEG1ADDR((LCD_BASE+1)); u8* chLcdBase = (u8*)KSEG1ADDR(LCD_BASE); char str[LCD_MAX_CHAR_PER_LINE * LCD_MAX_LINES]; int iNumChars, iCharsSent; va_start(args, fmt); vsprintf(str, fmt, args); va_end(args); iNumChars = strlen(str); /* Can't have more characters than what will fit on the display */ if (iNumChars > (LCD_MAX_CHAR_PER_LINE * LCD_MAX_LINES)) iNumChars = (LCD_MAX_CHAR_PER_LINE * LCD_MAX_LINES) ; /* first blank out the whole display */ writeb(LCD_DISP_CLEAR, chLcdBase); delay_lcd_long() ; /* set it to row-0, column-0 */ writeb(LCD_DDRAM_ADR_SET_0, chLcdBase); delay_lcd_long() ; /* Now display characters one by one*/ for(iCharsSent = 0 ; iCharsSent < iNumChars ; iCharsSent++) { if (iCharsSent == LCD_MAX_CHAR_PER_LINE) { /* move over to the next line */ writeb(LCD_DDRAM_ADR_SET_1, chLcdBase); delay_lcd_long() ; } writeb(str[iCharsSent], chLcdData); delay_lcd_short() ; } return iNumChars; } --- NEW FILE: rtc-ds1501.c --- /* * BRIEF MODULE DESCRIPTION * DS1501 (Dallas Semiconductor) Real Time Clock Support * * Copyright 2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * * 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/types.h> #include <linux/time.h> #include <asm/time.h> #include <asm/addrspace.h> #include <asm/debug.h> #include <asm/rc32300/rc32300.h> #undef BCD_TO_BIN #define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10) #undef BIN_TO_BCD #define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10) #define EPOCH 2000 static unsigned long rtc_ds1501_get_time(void) { u32 century, year, month, day, hour, minute, second; /* read time data */ writeb(readb(&rtc->control_b) & TDC_DIS_BUFF, &rtc->control_b); century = BCD_TO_BIN(readb(&rtc->century)); year = BCD_TO_BIN(readb(&rtc->year)) + (century * 100); month = BCD_TO_BIN(readb(&rtc->month) & 0x1f); day = BCD_TO_BIN(readb(&rtc->date)); hour = BCD_TO_BIN(readb(&rtc->hours) & 0x3f); /* 24 hour format */ minute = BCD_TO_BIN(readb(&rtc->mins)); second = BCD_TO_BIN(readb(&rtc->secs)); writeb(readb(&rtc->control_b) | TDC_ENA_BUFF, &rtc->control_b); return mktime(year, month, day, hour, minute, second); } static int rtc_ds1501_set_time(unsigned long t) { struct rtc_time tm; u8 temp, ctrl; u8 year, month, day, hour, minute, second; /* freeze external registers */ ctrl = readb(&rtc->control_b); writeb(ctrl & TDC_DIS_BUFF, &rtc->control_b); /* convert */ to_tm(t, &tm); /* check each field one by one */ writeb(BIN_TO_BCD(EPOCH/100), &rtc->century); year = BIN_TO_BCD(tm.tm_year - EPOCH); if (year != readb(&rtc->year)) writeb(year, &rtc->year); temp = readb(&rtc->month); month = BIN_TO_BCD(tm.tm_mon + 1); /* tm_mon starts from 0 to 11 */ if (month != (temp & 0x1f)) writeb((month & 0x1f) | (temp & ~0x1f), &rtc->month); day = BIN_TO_BCD(tm.tm_mday); if (day != readb(&rtc->date)) writeb(day, &rtc->date); hour = BIN_TO_BCD(tm.tm_hour) & 0x3f; /* 24 hour format */ if (hour != readb(&rtc->hours)) writeb(hour, &rtc->hours); minute = BIN_TO_BCD(tm.tm_min); if (minute != readb(&rtc->mins)) writeb(minute, &rtc->mins); second = BIN_TO_BCD(tm.tm_sec); if (second != readb(&rtc->secs)) writeb(second, &rtc->secs); writeb(ctrl | TDC_ENA_BUFF, &rtc->control_b); return 0; } void rtc_ds1501_init(void) { u8 stop; writeb(readb(&rtc->control_b) & TDC_DIS_BUFF, &rtc->control_b); stop = readb(&rtc->month); writeb(readb(&rtc->control_b) | TDC_ENA_BUFF, &rtc->control_b); if (stop & TDS_STOP) { /* start clock */ writeb(readb(&rtc->control_b) & TDC_DIS_BUFF, &rtc->control_b); writeb(stop | TDS_STOP, &rtc->month); writeb(readb(&rtc->control_b) | TDC_ENA_BUFF, &rtc->control_b); /* wait 2s till oscillator stabilizes */ mdelay(2000); } /* set the function pointers */ rtc_get_time = rtc_ds1501_get_time; rtc_set_time = rtc_ds1501_set_time; } --- NEW FILE: setup.c --- /* * BRIEF MODULE DESCRIPTION * IDT 79EB355 board setup. * * Copyright 2002 MontaVista Software Inc. * Author: MontaVista Software, Inc. * st...@mv... or so...@mv... * * 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/init.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/irq.h> #include <linux/ioport.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/mipsregs.h> #include <asm/pgtable.h> #include <asm/reboot.h> #include <asm/rc32300/rc32300.h> extern void (*board_time_init)(void); extern void (*board_timer_setup)(struct irqaction *irq); extern void rc32300_time_init(void); extern void rc32300_timer_setup(struct irqaction *irq); extern char * __init prom_getcmdline(void); extern void rc32300_restart(char *); extern void rc32300_halt(void); extern void rc32300_power_off(void); extern int init_lcd(void); #ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start, initrd_end; extern void * __rd_start, * __rd_end; #endif #if 0 static void dump_dev(int devnum) { printk("DEV%d_BASE = %08x\n", devnum, rc32300_readl(DEV0_BASE + devnum*DEV_REG_OFFSET)); printk("DEV%d_MASK = %08x\n", devnum, rc32300_readl(DEV0_MASK + devnum*DEV_REG_OFFSET)); printk("DEV%d_CNTL = %08x\n", devnum, rc32300_readl(DEV0_CNTL + devnum*DEV_REG_OFFSET)); printk("DEV%d_TIMING = %08x\n", devnum, rc32300_readl(DEV0_TIMING + devnum*DEV_REG_OFFSET)); } #endif void __init idt_setup(void) { char* argptr; argptr = prom_getcmdline(); #ifdef CONFIG_SERIAL_CONSOLE if ((argptr = strstr(argptr, "console=")) == NULL) { argptr = prom_getcmdline(); strcat(argptr, " console=ttyS0,9600"); } #endif board_time_init = rc32300_time_init; board_timer_setup = rc32300_timer_setup; _machine_restart = rc32300_restart; _machine_halt = rc32300_halt; _machine_power_off = rc32300_power_off; set_io_port_base(KSEG1); // clear out any wired entries write_32bit_cp0_register(CP0_WIRED, 0); /* * Setup Device 3. The EPLD (U13) splits device 3 chip-select * into seperate chip selects for the TDM, LCD, and RTC * devices. */ rc32300_writel(0x00000000, DEV0_MASK + 3*DEV_REG_OFFSET); rc32300_writel(TDM_BASE, DEV0_BASE + 3*DEV_REG_OFFSET); /* timings are from IDT/sim source */ rc32300_writel(0x0FFFFF84, DEV0_CNTL + 3*DEV_REG_OFFSET); rc32300_writel(0x00001FFF, DEV0_TIMING + 3*DEV_REG_OFFSET); rc32300_writel(0xFFFF0000, DEV0_MASK + 3*DEV_REG_OFFSET); /* initialize the LCD panel */ init_lcd(); idtprintf("IDT 79EB355 Eval MVL 2.1"); #ifdef CONFIG_MTD /* * Setup device 2 for flash devices. Set for * 32-bit databus size, write-enable. */ rc32300_writel(0x00000000, DEV0_MASK + 2*DEV_REG_OFFSET); rc32300_writel(FLASH_BASE, DEV0_BASE + 2*DEV_REG_OFFSET); /* timings are from IDT/sim source */ rc32300_writel(0x03CF3316, DEV0_CNTL + 2*DEV_REG_OFFSET); rc32300_writel(0x00001133, DEV0_TIMING + 2*DEV_REG_OFFSET); rc32300_writel(0xFF800000, DEV0_MASK + 2*DEV_REG_OFFSET); #endif #ifdef CONFIG_BLK_DEV_INITRD ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); initrd_start = (unsigned long)&__rd_start; initrd_end = (unsigned long)&__rd_end; #endif } |