X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/3f8c5b95adbaa43fd5fcfa94a713971e8331fc58..442a48289daa57f0d8d8afda51683c15d3624989:/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c index e644fc37c..7b125a1fc 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c @@ -1,118 +1,276 @@ -/***************************************************************************** - * Carsten Langgaard, carstenl@mips.com - * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. - * Copyright (C) 2003 ADMtek Incorporated. - * daniell@admtek.com.tw +/* + * $Id$ + * + * ADM5120 specific prom routines * - * This program is free software; you can distribute it and/or modify it - * under the terms of the GNU General Public License (Version 2) as - * published by the Free Software Foundation. + * Copyright (C) 2007 OpenWrt.org + * Copyright (C) 2007 Gabor Juhos * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * 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. * - * 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., - * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - *****************************************************************************/ + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ #include -#include #include #include #include -#include #include #include -#include +#include +#include +#include + +#include +#include +#include +#include +#include + +unsigned int adm5120_prom_type = ADM5120_PROM_GENERIC; + +struct board_desc { + unsigned long mach_type; + char *name; +}; -void setup_prom_printf(int); -void prom_printf(char *, ...); -void prom_meminit(void); +#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)} +static struct board_desc common_boards[] __initdata = { + /* Cellvision/SparkLAN boards */ + DEFBOARD("CAS-630", MACH_ADM5120_CAS630), + DEFBOARD("CAS-670", MACH_ADM5120_CAS670), + DEFBOARD("CAS-771", MACH_ADM5120_CAS771), + DEFBOARD("CAS-790", MACH_ADM5120_CAS790), + DEFBOARD("CAS-861", MACH_ADM5120_CAS861), + /* Compex boards */ + DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), + /* Edimax boards */ + DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), + DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K), + /* Infineon boards */ + DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA), + DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT), + DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP), + DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000), + /* Mikrotik RouterBOARDs */ + DEFBOARD("111", MACH_ADM5120_RB_111), + DEFBOARD("112", MACH_ADM5120_RB_112), + DEFBOARD("133", MACH_ADM5120_RB_133), + DEFBOARD("133C", MACH_ADM5120_RB_133C), + DEFBOARD("133C3", MACH_ADM5120_RB_133C), + DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ + DEFBOARD("153", MACH_ADM5120_RB_153), + DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), +}; -#define ADM5120_ENVC 1 +static unsigned long __init find_machtype_byname(char *name) +{ + unsigned long ret; + int i; -char *adm5120_envp[2*ADM5120_ENVC] = {"memsize","0x001000000"}; + ret = MACH_ADM5120_GENERIC; + if (name == NULL) + goto out; -#define READCSR(r) *(volatile unsigned long *)(0xB2600000+(r)) -#define WRITECSR(r,v) *(volatile unsigned long *)(0xB2600000+(r)) = v + if (*name == '\0') + goto out; -#define UART_DR_REG 0x00 -#define UART_FR_REG 0x18 -#define UART_TX_FIFO_FULL 0x20 + for (i=0; i 0) strcpy( &(arcs_cmdline[0]), cmd); + else strcpy(&(arcs_cmdline[0]), CONFIG_CMDLINE); + +} + +#define UART_READ(r) *(volatile u32 *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r)) +#define UART_WRITE(r,v) *(volatile u32 *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))=(v) + +void __init prom_putchar(char ch) +{ + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); + UART_WRITE(UART_REG_DATA, ch); + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); +} + +void __init prom_init(void) +{ + mips_machgroup = MACH_GROUP_ADM5120; + prom_detect_machtype(); - /* init memory map */ - prom_meminit(); + prom_init_cmdline(); +} + +void __init prom_free_prom_memory(void) +{ + /* We do not have to prom memory to free */ }