/* * Prom setup file for ar7240 */ #include #include #include #include #include #include #include #include "ar7240.h" #include "hw_sio.h" int __ath_flash_size; void __init prom_init(void) { int memsz = (16 << 20), argc = fw_arg0, i; char **arg = (char**) fw_arg1; if(((int)fw_arg1 == -1) || ((int)fw_arg3 == -1)) { __ath_flash_size = 16; strcpy(arcs_cmdline, "mem=16M console=ttyS0,115200n8r"); strcat(arcs_cmdline, "root=/dev/nfs rw " "nfsroot=192.168.178.20:/mnt/rootfs_virian " "ip=192.168.178.1:192.168.178.20:192.168.178.20:255.255.255.0:fritz_box_neon:eth0:on " "ethaddr=00:04:0e:ff:ab:01 " /*--- "panic=1 " ---*/ /*--- "nowait=1 " ---*/ "migration_debug=1"); } else { printk ("flash_size passed from bootloader = %d\n", (int)fw_arg3); __ath_flash_size = fw_arg3; /* * if user passes kernel args, ignore the default one */ if (argc > 1) { arcs_cmdline[0] = '\0'; for (i = 1; i < argc; i++) printk("arg %d: %s\n", i, arg[i]); /* * arg[0] is "g", the rest is boot parameters */ for (i = 1; i < argc; i++) { if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >= sizeof(arcs_cmdline)) break; strcat(arcs_cmdline, arg[i]); strcat(arcs_cmdline, " "); } } } /*--- mips_machgroup = MACH_GROUP_AR7240; ---*/ /*--- mips_machtype = MACH_ATHEROS_AR7240; ---*/ /* * By default, use all available memory. You can override this * to use, say, 8MB by specifying "mem=8M" as an argument on the * linux bootup command line. */ add_memory_region(0, memsz, BOOT_MEM_RAM); } void __init prom_free_prom_memory(void) { } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static char buf[1024]; int prom_putchar(char c) { #if 0 struct _hw_uart *U = (struct _hw_uart *)KSEG1ADDR(AR7240_UART_BASE); switch(c) { case '\n': prom_putchar('\r'); /*--- kein break ---*/ default: while(U->ls.Bits.te == 0) ; U->data.tx.data = c; } return 1; #else extern void Uart16550Put(char byte); if(c == '\n') Uart16550Put('\r'); Uart16550Put(c); return 1; #endif } void prom_puts(char *p) { while(p && *p) prom_putchar(*p++); } int prom_printf(const char * fmt, ...) { va_list args; int l; char *p, *buf_end; /* Low level, brute force, not SMP safe... */ va_start(args, fmt); l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */ va_end(args); buf_end = buf + l; *buf_end = '\0'; for (p = buf; p < buf_end; p++) { /* Wait for FIFO to empty */ prom_putchar(*p); } return 0; } EXPORT_SYMBOL(prom_printf); #ifdef CONFIG_DEBUG_LL void printascii(const char *string) { char *buf = "%s"; prom_printf(buf,string); } #endif