📄 ev64260.c
字号:
port.membase = ioremap(EV64260_SERIAL_0, EV64260_UART_SIZE); port.irq = EV64260_UART_0_IRQ; port.uartclk = BASE_BAUD * 16; port.regshift = 2; port.iotype = SERIAL_IO_MEM; port.flags = STD_COM_FLAGS;#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) gen550_init(0, &port);#endif if (early_serial_setup(&port) != 0) printk(KERN_WARNING "Early serial init of port 0" "failed\n"); first_time = 0; } return;}#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)static void __initev64260_early_serial_map(void){}#endifstatic void __initev64260_setup_arch(void){ if (ppc_md.progress) ppc_md.progress("ev64260_setup_arch: enter", 0);#ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) ROOT_DEV = Root_RAM0; else#endif#ifdef CONFIG_ROOT_NFS ROOT_DEV = Root_NFS;#else ROOT_DEV = Root_SDA2;#endif if (ppc_md.progress) ppc_md.progress("ev64260_setup_arch: Enabling L2 cache", 0); /* Enable L2 and L3 caches (if 745x) */ _set_L2CR(_get_L2CR() | L2CR_L2E); _set_L3CR(_get_L3CR() | L3CR_L3E); if (ppc_md.progress) ppc_md.progress("ev64260_setup_arch: Initializing bridge", 0); ev64260_setup_bridge(); /* set up PCI bridge(s) */ ev64260_setup_peripherals(); /* set up chip selects/GPP/MPP etc */ if (ppc_md.progress) ppc_md.progress("ev64260_setup_arch: bridge init complete", 0);#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_MPSC_CONSOLE) ev64260_early_serial_map();#endif printk(KERN_INFO "%s %s port (C) 2001 MontaVista Software, Inc." "(source@mvista.com)\n", BOARD_VENDOR, BOARD_MACHINE); if (ppc_md.progress) ppc_md.progress("ev64260_setup_arch: exit", 0); return;}/* Platform device data fixup routines. */#if defined(CONFIG_SERIAL_MPSC)static void __initev64260_fixup_mpsc_pdata(struct platform_device *pdev){ struct mpsc_pdata *pdata; pdata = (struct mpsc_pdata *)pdev->dev.platform_data; pdata->max_idle = 40; pdata->default_baud = EV64260_DEFAULT_BAUD; pdata->brg_clk_src = EV64260_MPSC_CLK_SRC; pdata->brg_clk_freq = EV64260_MPSC_CLK_FREQ; return;}static int __initev64260_platform_notify(struct device *dev){ static struct { char *bus_id; void ((*rtn)(struct platform_device *pdev)); } dev_map[] = { { MPSC_CTLR_NAME ".0", ev64260_fixup_mpsc_pdata }, { MPSC_CTLR_NAME ".1", ev64260_fixup_mpsc_pdata }, }; struct platform_device *pdev; int i; if (dev && dev->bus_id) for (i=0; i<ARRAY_SIZE(dev_map); i++) if (!strncmp(dev->bus_id, dev_map[i].bus_id, BUS_ID_SIZE)) { pdev = container_of(dev, struct platform_device, dev); dev_map[i].rtn(pdev); } return 0;}#endifstatic voidev64260_reset_board(void *addr){ local_irq_disable(); /* disable and invalidate the L2 cache */ _set_L2CR(0); _set_L2CR(0x200000); /* flush and disable L1 I/D cache */ __asm__ __volatile__ ("mfspr 3,1008\n\t" "ori 5,5,0xcc00\n\t" "ori 4,3,0xc00\n\t" "andc 5,3,5\n\t" "sync\n\t" "mtspr 1008,4\n\t" "isync\n\t" "sync\n\t" "mtspr 1008,5\n\t" "isync\n\t" "sync\n\t"); /* unmap any other random cs's that might overlap with bootcs */ mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, 0, 0, 0); bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN); mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, 0, 0, 0); bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN); mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN, 0, 0, 0); bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN); mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN, 0, 0, 0); bh.ci->disable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN); /* map bootrom back in to gt @ reset defaults */ mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN, 0xff800000, 8*1024*1024, 0); bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN); /* move reg base back to default, setup default pci0 */ mv64x60_write(&bh, MV64x60_INTERNAL_SPACE_DECODE, (1<<24) | CONFIG_MV64X60_BASE >> 20); /* NOTE: FROM NOW ON no more GT_REGS accesses.. 0x1 is not mapped * via BAT or MMU, and MSR IR/DR is ON */ /* SRR0 has system reset vector, SRR1 has default MSR value */ /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */ /* NOTE: assumes reset vector is at 0xfff00100 */ __asm__ __volatile__ ("mtspr 26, %0\n\t" "li 4,(1<<6)\n\t" "mtspr 27,4\n\t" "rfi\n\t" :: "r" (addr):"r4"); return;}static voidev64260_restart(char *cmd){ volatile ulong i = 10000000; ev64260_reset_board((void *)0xfff00100); while (i-- > 0); panic("restart failed\n");}static voidev64260_halt(void){ local_irq_disable(); while (1); /* NOTREACHED */}static voidev64260_power_off(void){ ev64260_halt(); /* NOTREACHED */}static intev64260_show_cpuinfo(struct seq_file *m){ uint pvid; pvid = mfspr(SPRN_PVR); seq_printf(m, "vendor\t\t: " BOARD_VENDOR "\n"); seq_printf(m, "machine\t\t: " BOARD_MACHINE "\n"); seq_printf(m, "cpu MHz\t\t: %d\n", ev64260_get_cpu_speed()/1000/1000); seq_printf(m, "bus MHz\t\t: %d\n", ev64260_get_bus_speed()/1000/1000); return 0;}/* DS1501 RTC has too much variation to use RTC for calibration */static void __initev64260_calibrate_decr(void){ ulong freq; freq = ev64260_get_bus_speed()/4; printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", freq/1000000, freq%1000000); tb_ticks_per_jiffy = freq / HZ; tb_to_us = mulhwu_scale_factor(freq, 1000000); return;}/* * Set BAT 3 to map 0xfb000000 to 0xfc000000 of physical memory space. */static __inline__ voidev64260_set_bat(void){ mb(); mtspr(SPRN_DBAT1U, 0xfb0001fe); mtspr(SPRN_DBAT1L, 0xfb00002a); mb(); return;}#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)static void __initev64260_map_io(void){ io_block_mapping(0xfb000000, 0xfb000000, 0x01000000, _PAGE_IO);}#endifvoid __initplatform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7){#ifdef CONFIG_BLK_DEV_INITRD extern int initrd_below_start_ok; initrd_start=initrd_end=0; initrd_below_start_ok=0;#endif /* CONFIG_BLK_DEV_INITRD */ parse_bootinfo(find_bootinfo()); isa_mem_base = 0; isa_io_base = EV64260_PCI0_IO_CPU_BASE; pci_dram_offset = EV64260_PCI0_MEM_CPU_BASE; loops_per_jiffy = ev64260_get_cpu_speed() / HZ; ppc_md.setup_arch = ev64260_setup_arch; ppc_md.show_cpuinfo = ev64260_show_cpuinfo; ppc_md.init_IRQ = gt64260_init_irq; ppc_md.get_irq = gt64260_get_irq; ppc_md.restart = ev64260_restart; ppc_md.power_off = ev64260_power_off; ppc_md.halt = ev64260_halt; ppc_md.find_end_of_memory = ev64260_find_end_of_memory; ppc_md.init = NULL; ppc_md.time_init = todc_time_init; ppc_md.set_rtc_time = todc_set_rtc_time; ppc_md.get_rtc_time = todc_get_rtc_time; ppc_md.nvram_read_val = todc_direct_read_val; ppc_md.nvram_write_val = todc_direct_write_val; ppc_md.calibrate_decr = ev64260_calibrate_decr; bh.p_base = CONFIG_MV64X60_NEW_BASE; ev64260_set_bat();#ifdef CONFIG_SERIAL_8250#if defined(CONFIG_SERIAL_TEXT_DEBUG) ppc_md.setup_io_mappings = ev64260_map_io; ppc_md.progress = gen550_progress;#endif#if defined(CONFIG_KGDB) ppc_md.setup_io_mappings = ev64260_map_io; ppc_md.early_serial_map = ev64260_early_serial_map;#endif#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)#ifdef CONFIG_SERIAL_TEXT_DEBUG ppc_md.setup_io_mappings = ev64260_map_io; ppc_md.progress = mv64x60_mpsc_progress; mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);#endif /* CONFIG_SERIAL_TEXT_DEBUG */#ifdef CONFIG_KGDB ppc_md.setup_io_mappings = ev64260_map_io; ppc_md.early_serial_map = ev64260_early_serial_map;#endif /* CONFIG_KGDB */#endif#if defined(CONFIG_SERIAL_MPSC) platform_notify = ev64260_platform_notify;#endif return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -