📄 toshiba_rbtx4927_setup.c
字号:
tx4927_pcicptr->pcistatus = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, ":pci setup complete:\n"); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "+\n");}#endif /* CONFIG_PCI */void toshiba_rbtx4927_restart(char *command){ printk(KERN_NOTICE "System Rebooting...\n"); /* enable the s/w reset register */ reg_wr08(RBTX4927_SW_RESET_ENABLE, RBTX4927_SW_RESET_ENABLE_SET); /* wait for enable to be seen */ while ((reg_rd08(RBTX4927_SW_RESET_ENABLE) & RBTX4927_SW_RESET_ENABLE_SET) == 0x00); /* do a s/w reset */ reg_wr08(RBTX4927_SW_RESET_DO, RBTX4927_SW_RESET_DO_SET); /* do something passive while waiting for reset */ local_irq_disable(); while (1) asm_wait(); /* no return */}void toshiba_rbtx4927_halt(void){ printk(KERN_NOTICE "System Halted\n"); local_irq_disable(); while (1) { asm_wait(); } /* no return */}void toshiba_rbtx4927_power_off(void){ toshiba_rbtx4927_halt(); /* no return */}void __init toshiba_rbtx4927_setup(void){ vu32 cp0_config; char *argptr; printk("CPU is %s\n", toshiba_name); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, "-\n"); /* f/w leaves this on at startup */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":Clearing STO_ERL.\n"); clear_c0_status(ST0_ERL); /* enable caches -- HCP5 does this, pmon does not */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":Enabling TX49_CONF_IC,TX49_CONF_DC.\n"); cp0_config = read_c0_config(); cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC); write_c0_config(cp0_config);#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG { extern void dump_cp0(char *); dump_cp0("toshiba_rbtx4927_early_fw_fixup"); }#endif /* setup irq stuff */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":Setting up tx4927 pic.\n"); TX4927_WR(0xff1ff604, 0x00000400); /* irq trigger */ TX4927_WR(0xff1ff608, 0x00000000); /* irq trigger */ /* setup serial stuff */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":Setting up tx4927 sio.\n"); TX4927_WR(0xff1ff314, 0x00000000); /* h/w flow control off */ TX4927_WR(0xff1ff414, 0x00000000); /* h/w flow control off */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, "+\n"); set_io_port_base(KSEG1 + TBTX4927_ISA_IO_OFFSET); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":mips_io_port_base=0x%08lx\n", mips_io_port_base); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":Resource\n"); ioport_resource.end = 0xffffffff; iomem_resource.end = 0xffffffff; TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, ":ResetRoutines\n"); _machine_restart = toshiba_rbtx4927_restart; _machine_halt = toshiba_rbtx4927_halt; pm_power_off = toshiba_rbtx4927_power_off;#ifdef CONFIG_PCI /* PCIC */ /* * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. * * For TX4927: * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) * i.e. S9[3]: ON (83MHz), OFF (100MHz) * * For TX4937: * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) * PCIDIVMODE[10] is 0. * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) * */ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, "ccfg is %lx, PCIDIVMODE is %x\n", (unsigned long) tx4927_ccfgptr->ccfg, (unsigned long) tx4927_ccfgptr->ccfg & (mips_machtype == MACH_TOSHIBA_RBTX4937 ? TX4937_CCFG_PCIDIVMODE_MASK : TX4927_CCFG_PCIDIVMODE_MASK)); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", (unsigned long) tx4927_ccfgptr-> ccfg & TX4927_CCFG_PCI66, (unsigned long) tx4927_ccfgptr-> ccfg & TX4927_CCFG_PCIMIDE, (unsigned long) tx4927_ccfgptr-> ccfg & TX4927_CCFG_PCIXARB); if (mips_machtype == MACH_TOSHIBA_RBTX4937) switch ((unsigned long)tx4927_ccfgptr-> ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { case TX4937_CCFG_PCIDIVMODE_8: case TX4937_CCFG_PCIDIVMODE_4: tx4927_cpu_clock = 266666666; /* 266MHz */ break; case TX4937_CCFG_PCIDIVMODE_9: case TX4937_CCFG_PCIDIVMODE_4_5: tx4927_cpu_clock = 300000000; /* 300MHz */ break; default: tx4927_cpu_clock = 333333333; /* 333MHz */ } else switch ((unsigned long)tx4927_ccfgptr-> ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { case TX4927_CCFG_PCIDIVMODE_2_5: case TX4927_CCFG_PCIDIVMODE_5: tx4927_cpu_clock = 166666666; /* 166MHz */ break; default: tx4927_cpu_clock = 200000000; /* 200MHz */ } /* CCFG */ /* enable Timeout BusError */ if (tx4927_ccfg_toeon) tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE; /* SDRAMC fixup */#ifdef CONFIG_TX4927BUG_WORKAROUND /* * TX4927-BUG: INF 01-01-18/ BUG 01-01-22 * G-bus timeout error detection is incorrect */ if (tx4927_ccfg_toeon) tx4927_sdramcptr->tr |= 0x02000000; /* RCD:3tck */#endif tx4927_pci_setup(); if (tx4927_using_backplane == 1) printk("backplane board IS installed\n"); else printk("No Backplane \n"); /* this is on ISA bus behind PCI bus, so need PCI up first */#ifdef CONFIG_TOSHIBA_FPCIB0 { if (tx4927_using_backplane) { TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=yes\n"); TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":smsc_fdc37m81x_init()\n"); smsc_fdc37m81x_init(0x3f0); TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":smsc_fdc37m81x_config_beg()\n"); smsc_fdc37m81x_config_beg(); TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":smsc_fdc37m81x_config_set(KBD)\n"); smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM, SMSC_FDC37M81X_KBD); smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1); smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12); smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE, 1); smsc_fdc37m81x_config_end(); TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":smsc_fdc37m81x_config_end()\n"); } else { TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=not_found\n"); } }#else { TOSHIBA_RBTX4927_SETUP_DPRINTK (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=no\n"); }#endif#endif /* CONFIG_PCI */#ifdef CONFIG_SERIAL_TXX9 { extern int early_serial_txx9_setup(struct uart_port *port); int i; struct uart_port req; for(i = 0; i < 2; i++) { memset(&req, 0, sizeof(req)); req.line = i; req.iotype = UPIO_MEM; req.membase = (char *)(0xff1ff300 + i * 0x100); req.mapbase = 0xff1ff300 + i * 0x100; req.irq = 32 + i; req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/; req.uartclk = 50000000; early_serial_txx9_setup(&req); } }#ifdef CONFIG_SERIAL_TXX9_CONSOLE argptr = prom_getcmdline(); if (strstr(argptr, "console=") == NULL) { strcat(argptr, " console=ttyS0,38400"); }#endif#endif#ifdef CONFIG_ROOT_NFS argptr = prom_getcmdline(); if (strstr(argptr, "root=") == NULL) { strcat(argptr, " root=/dev/nfs rw"); }#endif#ifdef CONFIG_IP_PNP argptr = prom_getcmdline(); if (strstr(argptr, "ip=") == NULL) { strcat(argptr, " ip=any"); }#endif TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, "+\n");}#ifdef CONFIG_RTC_DS1742extern unsigned long rtc_ds1742_get_time(void);extern int rtc_ds1742_set_time(unsigned long);extern void rtc_ds1742_wait(void);#endifvoid __inittoshiba_rbtx4927_time_init(void){ u32 c1; u32 c2; TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");#ifdef CONFIG_RTC_DS1742 rtc_mips_get_time = rtc_ds1742_get_time; rtc_mips_set_time = rtc_ds1742_set_time; TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":rtc_ds1742_init()-\n"); rtc_ds1742_init(0xbc010000); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":rtc_ds1742_init()+\n"); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":Calibrate mips_hpt_frequency-\n"); rtc_ds1742_wait(); /* get the count */ c1 = read_c0_count(); /* wait for the seconds to change again */ rtc_ds1742_wait(); /* get the count again */ c2 = read_c0_count(); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":Calibrate mips_hpt_frequency+\n"); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":c1=%12u\n", c1); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":c2=%12u\n", c2); /* this diff is as close as we are going to get to counter ticks per sec */ mips_hpt_frequency = abs(c2 - c1); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":f1=%12u\n", mips_hpt_frequency); /* round to 1/10th of a MHz */ mips_hpt_frequency /= (100 * 1000); mips_hpt_frequency *= (100 * 1000); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, ":f2=%12u\n", mips_hpt_frequency); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO, ":mips_hpt_frequency=%uHz (%uMHz)\n", mips_hpt_frequency, mips_hpt_frequency / 1000000);#else mips_hpt_frequency = 100000000;#endif TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");}void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq){ TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, "-\n"); TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, "+\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -