diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/xilinx/ml300/Makefile | 70 | ||||
-rw-r--r-- | board/xilinx/ml300/config.mk | 32 | ||||
-rw-r--r-- | board/xilinx/ml300/init.S | 44 | ||||
-rw-r--r-- | board/xilinx/ml300/ml300.c | 128 | ||||
-rw-r--r-- | board/xilinx/ml300/serial.c | 154 | ||||
-rw-r--r-- | board/xilinx/ml300/u-boot.lds | 146 | ||||
-rw-r--r-- | board/xilinx/ml300/u-boot.lds.debug | 135 | ||||
-rw-r--r-- | board/xilinx/ml300/xparameters.h | 196 | ||||
-rw-r--r-- | board/xilinx/xilinx_iic/iic_adapter.c | 529 |
9 files changed, 0 insertions, 1434 deletions
diff --git a/board/xilinx/ml300/Makefile b/board/xilinx/ml300/Makefile deleted file mode 100644 index b8a2d64..0000000 --- a/board/xilinx/ml300/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 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., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# - -include $(TOPDIR)/config.mk -ifneq ($(OBJTREE),$(SRCTREE)) -$(shell mkdir -p $(obj)../common) -$(shell mkdir -p $(obj)../xilinx_enet) -$(shell mkdir -p $(obj)../xilinx_iic) -endif - -INCS := -I../common -I../xilinx_enet -I../xilinx_iic -CFLAGS += $(INCS) -HOSTCFLAGS += $(INCS) - -LIB = $(obj)lib$(BOARD).a - -COBJS = $(BOARD).o \ - serial.o \ - ../xilinx_enet/emac_adapter.o ../xilinx_enet/xemac.o \ - ../xilinx_enet/xemac_options.o ../xilinx_enet/xemac_polled.o \ - ../xilinx_enet/xemac_intr.o ../xilinx_enet/xemac_g.o \ - ../xilinx_enet/xemac_intr_dma.o ../xilinx_iic/iic_adapter.o \ - ../xilinx_iic/xiic_l.o ../common/xipif_v1_23_b.o \ - ../common/xbasic_types.o ../common/xdma_channel.o \ - ../common/xdma_channel_sg.o ../common/xpacket_fifo_v1_00_b.o \ - ../common/xversion.o \ - -SOBJS = init.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -$(LIB): $(OBJS) $(SOBJS) - $(AR) $(ARFLAGS) $@ $^ - -clean: - rm -f $(SOBJS) $(OBJS) - -distclean: clean - rm -f $(LIB) core *.bak $(obj).depend - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/xilinx/ml300/config.mk b/board/xilinx/ml300/config.mk deleted file mode 100644 index 208a25ba..0000000 --- a/board/xilinx/ml300/config.mk +++ /dev/null @@ -1,32 +0,0 @@ -# -# (C) Copyright 2000 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 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., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# - -# -# esd ADCIOP boards -# - -#TEXT_BASE = 0xFFFE0000 -TEXT_BASE = 0x04000000 - -# Use board specific linker script -LDSCRIPT := $(SRCTREE)/board/xilinx/ml300/u-boot.lds diff --git a/board/xilinx/ml300/init.S b/board/xilinx/ml300/init.S deleted file mode 100644 index a282c9a..0000000 --- a/board/xilinx/ml300/init.S +++ /dev/null @@ -1,44 +0,0 @@ -/* - * init.S: Stubs for U-Boot initialization - * - * Author: Xilinx, Inc. - * - * - * 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. - * - * - * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A - * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS - * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, - * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE - * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING - * ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. - * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO - * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY - * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM - * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. - * - * - * Xilinx hardware products are not intended for use in life support - * appliances, devices, or systems. Use in such applications is - * expressly prohibited. - * - * - * (c) Copyright 2002-2004 Xilinx Inc. - * All rights reserved. - * - * - * 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. - * - * - */ - - .globl ext_bus_cntlr_init -ext_bus_cntlr_init: - blr diff --git a/board/xilinx/ml300/ml300.c b/board/xilinx/ml300/ml300.c deleted file mode 100644 index e64becc..0000000 --- a/board/xilinx/ml300/ml300.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ml300.c: U-Boot platform support for Xilinx ML300 board - * - * Author: Xilinx, Inc. - * - * - * 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. - * - * - * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A - * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS - * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, - * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE - * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING - * ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. - * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO - * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY - * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM - * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. - * - * - * Xilinx hardware products are not intended for use in life support - * appliances, devices, or systems. Use in such applications is - * expressly prohibited. - * - * - * (c) Copyright 2002-2004 Xilinx Inc. - * All rights reserved. - * - * - * 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 <config.h> -#include <common.h> -#include <asm/processor.h> - -#ifdef CONFIG_ENV_IS_IN_EEPROM -extern void convert_env(void); -#endif - -int -board_pre_init(void) -{ - return 0; -} - -int -checkboard(void) -{ - char tmp[64]; /* long enough for environment variables */ - char *s, *e; - int i = getenv_r("L", tmp, sizeof (tmp)); - - if (i < 0) { - printf("### No HW ID - assuming ML300"); - } else { - for (e = tmp; *e; ++e) { - if (*e == ' ') - break; - } - - printf("### Board Serial# is "); - - for (s = tmp; s < e; ++s) { - putc(*s); - } - - } - putc('\n'); - - return (0); -} - -phys_size_t -initdram(int board_type) -{ - return 128 * 1024 * 1024; -} - -int -testdram(void) -{ - printf("test: xxx MB - ok\n"); - - return (0); -} - -/* implement functions originally in cpu/ppc4xx/speed.c */ -void -get_sys_info(sys_info_t * sysInfo) -{ - sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ; - - /* only correct if the PLB and OPB run at the same frequency */ - sysInfo->freqPLB = XPAR_UARTNS550_0_CLOCK_FREQ_HZ; - sysInfo->freqPCI = XPAR_UARTNS550_0_CLOCK_FREQ_HZ / 3; -} - -ulong -get_PCI_freq(void) -{ - ulong val; - PPC4xx_SYS_INFO sys_info; - - get_sys_info(&sys_info); - val = sys_info.freqPCI; - return val; -} - -#ifdef CONFIG_MISC_INIT_R - -int -misc_init_r() -{ - /* convert env name and value to u-boot standard */ - convert_env(); - return 0; -} - -#endif diff --git a/board/xilinx/ml300/serial.c b/board/xilinx/ml300/serial.c deleted file mode 100644 index 4215513..0000000 --- a/board/xilinx/ml300/serial.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Author: Xilinx, Inc. - * - * - * 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. - * - * - * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A - * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS - * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, - * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE - * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING - * ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. - * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO - * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY - * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM - * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. - * - * - * Xilinx hardware products are not intended for use in life support - * appliances, devices, or systems. Use in such applications is - * expressly prohibited. - * - * - * (c) Copyright 2002-2004 Xilinx Inc. - * All rights reserved. - * - * - * 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 <common.h> -#include <asm/u-boot.h> -#include <asm/processor.h> -#include <command.h> -#include <config.h> - -DECLARE_GLOBAL_DATA_PTR; - -#define USE_CHAN1 \ - ((defined XPAR_UARTNS550_0_BASEADDR) && (defined CONFIG_SYS_INIT_CHAN1)) -#define USE_CHAN2 \ - ((defined XPAR_UARTNS550_1_BASEADDR) && (defined CONFIG_SYS_INIT_CHAN2)) - -#if USE_CHAN1 -#include <ns16550.h> -#endif - -#if USE_CHAN1 -const NS16550_t COM_PORTS[] = { (NS16550_t) (XPAR_UARTNS550_0_BASEADDR + 3) -#if USE_CHAN2 - , (NS16550_t) (XPAR_UARTNS550_1_BASEADDR + 3) -#endif -}; -#endif - -int -serial_init(void) -{ -#if USE_CHAN1 - int clock_divisor; - - clock_divisor = XPAR_UARTNS550_0_CLOCK_FREQ_HZ / 16 / gd->baudrate; - (void) NS16550_init(COM_PORTS[0], clock_divisor); -#if USE_CHAN2 - clock_divisor = XPAR_UARTNS550_1_CLOCK_FREQ_HZ / 16 / gd->baudrate; - (void) NS16550_init(COM_PORTS[1], clock_divisor); -#endif -#endif - return 0; - -} - -void -serial_putc(const char c) -{ - if (c == '\n') - NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r'); - - NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], c); -} - -int -serial_getc(void) -{ - return NS16550_getc(COM_PORTS[CONFIG_SYS_DUART_CHAN]); -} - -int -serial_tstc(void) -{ - return NS16550_tstc(COM_PORTS[CONFIG_SYS_DUART_CHAN]); -} - -void -serial_setbrg(void) -{ -#if USE_CHAN1 - int clock_divisor; - - clock_divisor = XPAR_UARTNS550_0_CLOCK_FREQ_HZ / 16 / gd->baudrate; - NS16550_reinit(COM_PORTS[0], clock_divisor); -#if USE_CHAN2 - clock_divisor = XPAR_UARTNS550_1_CLOCK_FREQ_HZ / 16 / gd->baudrate; - NS16550_reinit(COM_PORTS[1], clock_divisor); -#endif -#endif -} - -void -serial_puts(const char *s) -{ - while (*s) { - serial_putc(*s++); - } -} - -#if defined(CONFIG_CMD_KGDB) -void -kgdb_serial_init(void) -{ -} - -void -putDebugChar(int c) -{ - serial_putc(c); -} - -void -putDebugStr(const char *str) -{ - serial_puts(str); -} - -int -getDebugChar(void) -{ - return serial_getc(); -} - -void -kgdb_interruptible(int yes) -{ - return; -} -#endif diff --git a/board/xilinx/ml300/u-boot.lds b/board/xilinx/ml300/u-boot.lds deleted file mode 100644 index b989940..0000000 --- a/board/xilinx/ml300/u-boot.lds +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 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., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -ENTRY(_start) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - /* WARNING - the following is hand-optimized to fit within */ - /* the sector layout of our flash chips! XXX FIXME XXX */ -/* - cpu/ppc4xx/start.o (.text) - board/xilinx/ml300/init.o (.text) - cpu/ppc4xx/kgdb.o (.text) - cpu/ppc4xx/traps.o (.text) - cpu/ppc4xx/interrupts.o (.text) - cpu/ppc4xx/4xx_uart.o (.text) - cpu/ppc4xx/cpu_init.o (.text) - cpu/ppc4xx/speed.o (.text) - drivers/net/4xx_enet.o (.text) - common/dlmalloc.o (.text) - lib_generic/crc32.o (.text) - lib_ppc/extable.o (.text) - lib_generic/zlib.o (.text) -*/ -/* . = env_offset;*/ -/* common/env_embedded.o(.text)*/ - - *(.text) - *(.got1) - } - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.eh_frame) - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - } - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; - __fixup_entries = (. - _FIXUP_TABLE_)>>2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __bss_start = .; - .bss (NOLOAD) : - { - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - . = ALIGN(4); - } - _end = . ; - PROVIDE (end = .); -} diff --git a/board/xilinx/ml300/u-boot.lds.debug b/board/xilinx/ml300/u-boot.lds.debug deleted file mode 100644 index 970628d..0000000 --- a/board/xilinx/ml300/u-boot.lds.debug +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 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., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - /* WARNING - the following is hand-optimized to fit within */ - /* the sector layout of our flash chips! XXX FIXME XXX */ - - mpc8xx/start.o (.text) - common/dlmalloc.o (.text) - lib_generic/vsprintf.o (.text) - lib_generic/crc32.o (.text) - lib_ppc/extable.o (.text) - - common/env_embedded.o(.text) - - *(.text) - *(.got1) - } - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x0FFF) & 0xFFFFF000; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; - __fixup_entries = (. - _FIXUP_TABLE_)>>2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(4096); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(4096); - __init_end = .; - - __bss_start = .; - .bss : - { - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } - _end = . ; - PROVIDE (end = .); -} diff --git a/board/xilinx/ml300/xparameters.h b/board/xilinx/ml300/xparameters.h deleted file mode 100644 index 2c56737..0000000 --- a/board/xilinx/ml300/xparameters.h +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************* -* -* CAUTION: This file is automatically generated by libgen. -* Version: Xilinx EDK 6.2 EDK_Gm.11 -* DO NOT EDIT. -* -* Copyright (c) 2003 Xilinx, Inc. All rights reserved. -* -* Description: Driver parameters -* -*******************************************************************/ - -/******************************************************************/ - -/* U-Boot Redefines */ - -/******************************************************************/ - -#define XPAR_UARTNS550_0_BASEADDR (XPAR_OPB_UART16550_0_BASEADDR+0x1000) -#define XPAR_UARTNS550_0_HIGHADDR XPAR_OPB_UART16550_0_HIGHADDR -#define XPAR_UARTNS550_0_CLOCK_FREQ_HZ XPAR_XUARTNS550_CLOCK_HZ -#define XPAR_UARTNS550_0_DEVICE_ID XPAR_OPB_UART16550_0_DEVICE_ID -#define XPAR_UARTNS550_1_BASEADDR (XPAR_OPB_UART16550_1_BASEADDR+0x1000) -#define XPAR_UARTNS550_1_HIGHADDR XPAR_OPB_UART16550_1_HIGHADDR -#define XPAR_UARTNS550_1_CLOCK_FREQ_HZ XPAR_XUARTNS550_CLOCK_HZ -#define XPAR_UARTNS550_1_DEVICE_ID XPAR_OPB_UART16550_1_DEVICE_ID - -/******************************************************************/ - -#define XPAR_IIC_0_BASEADDR XPAR_OPB_IIC_0_BASEADDR -#define XPAR_IIC_0_HIGHADDR XPAR_OPB_IIC_0_HIGHADDR -#define XPAR_IIC_0_TEN_BIT_ADR XPAR_OPB_IIC_0_TEN_BIT_ADR -#define XPAR_IIC_0_DEVICE_ID XPAR_OPB_IIC_0_DEVICE_ID - -/******************************************************************/ - -#define XPAR_EMAC_0_BASEADDR XPAR_OPB_ETHERNET_0_BASEADDR -#define XPAR_EMAC_0_HIGHADDR XPAR_OPB_ETHERNET_0_HIGHADDR -#define XPAR_EMAC_0_DMA_PRESENT XPAR_OPB_ETHERNET_0_DMA_PRESENT -#define XPAR_EMAC_0_MII_EXIST XPAR_OPB_ETHERNET_0_MII_EXIST -#define XPAR_EMAC_0_ERR_COUNT_EXIST XPAR_OPB_ETHERNET_0_ERR_COUNT_EXIST -#define XPAR_EMAC_0_DEVICE_ID XPAR_OPB_ETHERNET_0_DEVICE_ID - -/******************************************************************/ - -#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ - -/******************************************************************/ - -#define XPAR_PERSISTENT_0_IIC_0_BASEADDR 0x00000400 -#define XPAR_PERSISTENT_0_IIC_0_HIGHADDR 0x000007FF -#define XPAR_PERSISTENT_0_IIC_0_EEPROMADDR 0xA0 - -/******************************************************************/ - -#define XPAR_XPCI_NUM_INSTANCES 1 -#define XPAR_XPCI_CLOCK_HZ 33333333 -#define XPAR_OPB_PCI_REF_0_DEVICE_ID 0 -#define XPAR_OPB_PCI_REF_0_BASEADDR 0x20000000 -#define XPAR_OPB_PCI_REF_0_HIGHADDR 0x3FFFFFFF -#define XPAR_OPB_PCI_REF_0_CONFIG_ADDR 0x3C000000 -#define XPAR_OPB_PCI_REF_0_CONFIG_DATA 0x3C000004 -#define XPAR_OPB_PCI_REF_0_LCONFIG_ADDR 0x3E000000 -#define XPAR_OPB_PCI_REF_0_MEM_BASEADDR 0x20000000 -#define XPAR_OPB_PCI_REF_0_MEM_HIGHADDR 0x37FFFFFF -#define XPAR_OPB_PCI_REF_0_IO_BASEADDR 0x38000000 -#define XPAR_OPB_PCI_REF_0_IO_HIGHADDR 0x3BFFFFFF - -/******************************************************************/ - -#define XPAR_XEMAC_NUM_INSTANCES 1 -#define XPAR_OPB_ETHERNET_0_BASEADDR 0x60000000 -#define XPAR_OPB_ETHERNET_0_HIGHADDR 0x60003FFF -#define XPAR_OPB_ETHERNET_0_DEVICE_ID 0 -#define XPAR_OPB_ETHERNET_0_ERR_COUNT_EXIST 1 -#define XPAR_OPB_ETHERNET_0_DMA_PRESENT 1 -#define XPAR_OPB_ETHERNET_0_MII_EXIST 1 - -/******************************************************************/ - -#define XPAR_MY_OPB_GPIO_0_DEVICE_ID_0 0 -#define XPAR_MY_OPB_GPIO_0_BASEADDR_0 0x90000000 -#define XPAR_MY_OPB_GPIO_0_HIGHADDR_0 (0x90000000+0x7) -#define XPAR_MY_OPB_GPIO_0_DEVICE_ID_1 1 -#define XPAR_MY_OPB_GPIO_0_BASEADDR_1 (0x90000000+0x8) -#define XPAR_MY_OPB_GPIO_0_HIGHADDR_1 (0x90000000+0x1F) -#define XPAR_XGPIO_NUM_INSTANCES 2 - -/******************************************************************/ - -#define XPAR_XIIC_NUM_INSTANCES 1 -#define XPAR_OPB_IIC_0_BASEADDR 0xA8000000 -#define XPAR_OPB_IIC_0_HIGHADDR 0xA80001FF -#define XPAR_OPB_IIC_0_DEVICE_ID 0 -#define XPAR_OPB_IIC_0_TEN_BIT_ADR 0 - -/******************************************************************/ - -#define XPAR_XUARTNS550_NUM_INSTANCES 2 -#define XPAR_XUARTNS550_CLOCK_HZ 100000000 -#define XPAR_OPB_UART16550_0_BASEADDR 0xA0000000 -#define XPAR_OPB_UART16550_0_HIGHADDR 0xA0001FFF -#define XPAR_OPB_UART16550_0_DEVICE_ID 0 -#define XPAR_OPB_UART16550_1_BASEADDR 0xA0010000 -#define XPAR_OPB_UART16550_1_HIGHADDR 0xA0011FFF -#define XPAR_OPB_UART16550_1_DEVICE_ID 1 - -/******************************************************************/ - -#define XPAR_XSPI_NUM_INSTANCES 1 -#define XPAR_OPB_SPI_0_BASEADDR 0xA4000000 -#define XPAR_OPB_SPI_0_HIGHADDR 0xA400007F -#define XPAR_OPB_SPI_0_DEVICE_ID 0 -#define XPAR_OPB_SPI_0_FIFO_EXIST 1 -#define XPAR_OPB_SPI_0_SPI_SLAVE_ONLY 0 -#define XPAR_OPB_SPI_0_NUM_SS_BITS 1 - -/******************************************************************/ - -#define XPAR_XPS2_NUM_INSTANCES 2 -#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_0 0 -#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0 0xA9000000 -#define XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_0 (0xA9000000+0x3F) -#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_1 1 -#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1 (0xA9000000+0x1000) -#define XPAR_OPB_PS2_DUAL_REF_0_HIGHADDR_1 (0xA9000000+0x103F) - -/******************************************************************/ - -#define XPAR_XTOUCHSCREEN_NUM_INSTANCES 1 -#define XPAR_OPB_TSD_REF_0_BASEADDR 0xAA000000 -#define XPAR_OPB_TSD_REF_0_HIGHADDR 0xAA000007 -#define XPAR_OPB_TSD_REF_0_DEVICE_ID 0 - -/******************************************************************/ - -#define XPAR_OPB_AC97_CONTROLLER_REF_0_BASEADDR 0xA6000000 -#define XPAR_OPB_AC97_CONTROLLER_REF_0_HIGHADDR 0xA60000FF -#define XPAR_OPB_PAR_PORT_REF_0_BASEADDR 0x90010000 -#define XPAR_OPB_PAR_PORT_REF_0_HIGHADDR 0x900100FF -#define XPAR_PLB_DDR_0_BASEADDR 0x00000000 -#define XPAR_PLB_DDR_0_HIGHADDR 0x0FFFFFFF - -/******************************************************************/ - -#define XPAR_XINTC_HAS_IPR 1 -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 18 -#define XPAR_XINTC_USE_DCR 0 -#define XPAR_XINTC_NUM_INSTANCES 1 -#define XPAR_DCR_INTC_0_BASEADDR 0xD0000FC0 -#define XPAR_DCR_INTC_0_HIGHADDR 0xD0000FDF -#define XPAR_DCR_INTC_0_DEVICE_ID 0 -#define XPAR_DCR_INTC_0_KIND_OF_INTR 0x00038000 - -/******************************************************************/ - -#define XPAR_DCR_INTC_0_MISC_LOGIC_0_PHY_MII_INT_INTR 0 -#define XPAR_DCR_INTC_0_OPB_ETHERNET_0_IP2INTC_IRPT_INTR 1 -#define XPAR_DCR_INTC_0_MISC_LOGIC_0_IIC_TEMP_CRIT_INTR 2 -#define XPAR_DCR_INTC_0_MISC_LOGIC_0_IIC_IRQ_INTR 3 -#define XPAR_DCR_INTC_0_OPB_IIC_0_IP2INTC_IRPT_INTR 4 -#define XPAR_DCR_INTC_0_OPB_SYSACE_0_SYSACE_IRQ_INTR 5 -#define XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR 6 -#define XPAR_DCR_INTC_0_OPB_UART16550_1_IP2INTC_IRPT_INTR 7 -#define XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR 8 -#define XPAR_DCR_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR 9 -#define XPAR_DCR_INTC_0_OPB_SPI_0_IP2INTC_IRPT_INTR 10 -#define XPAR_DCR_INTC_0_OPB_TSD_REF_0_INTR_INTR 11 -#define XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_PLAYBACK_INTERRUPT_INTR 12 -#define XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_RECORD_INTERRUPT_INTR 13 -#define XPAR_DCR_INTC_0_OPB_PCI_REF_0_INTR_OUT_INTR 14 -#define XPAR_DCR_INTC_0_PLB2OPB_BRIDGE_0_BUS_ERROR_DET_INTR 15 -#define XPAR_DCR_INTC_0_PLB_V34_0_BUS_ERROR_DET_INTR 16 -#define XPAR_DCR_INTC_0_OPB2PLB_BRIDGE_0_BUS_ERROR_DET_INTR 17 - -/******************************************************************/ - -#define XPAR_XTFT_NUM_INSTANCES 1 -#define XPAR_PLB_TFT_CNTLR_REF_0_DCR_BASEADDR 0xD0000200 -#define XPAR_PLB_TFT_CNTLR_REF_0_DCR_HIGHADDR 0xD0000207 -#define XPAR_PLB_TFT_CNTLR_REF_0_DEVICE_ID 0 - -/******************************************************************/ - -#define XPAR_XSYSACE_MEM_WIDTH 8 -#define XPAR_XSYSACE_NUM_INSTANCES 1 -#define XPAR_OPB_SYSACE_0_BASEADDR 0xCF000000 -#define XPAR_OPB_SYSACE_0_HIGHADDR 0xCF0001FF -#define XPAR_OPB_SYSACE_0_DEVICE_ID 0 -#define XPAR_OPB_SYSACE_0_MEM_WIDTH 8 - -/******************************************************************/ - -#define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000 - -/******************************************************************/ diff --git a/board/xilinx/xilinx_iic/iic_adapter.c b/board/xilinx/xilinx_iic/iic_adapter.c deleted file mode 100644 index 58aaeb7..0000000 --- a/board/xilinx/xilinx_iic/iic_adapter.c +++ /dev/null @@ -1,529 +0,0 @@ -/****************************************************************************** -* -* Author: Xilinx, Inc. -* -* -* 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. -* -* -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A -* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS -* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, -* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE -* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. -* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO -* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM -* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE. -* -* -* Xilinx hardware products are not intended for use in life support -* appliances, devices, or systems. Use in such applications is -* expressly prohibited. -* -* -* (c) Copyright 2002-2004 Xilinx Inc. -* All rights reserved. -* -* -* 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 <config.h> -#include <common.h> -#include <environment.h> -#include <net.h> - -#ifdef CONFIG_ENV_IS_IN_EEPROM -#include <i2c.h> -#include "xiic_l.h" - -#define IIC_DELAY 5000 - -static u8 envStep = 0; /* 0 means crc has not been read */ -const u8 hex[] = "0123456789ABCDEF"; /* lookup table for ML300 CRC */ - -/************************************************************************ - * Use Xilinx provided driver to send data to EEPROM using iic bus. - */ -static void -send(u32 adr, u8 * data, u32 len) -{ - u8 sendBuf[34]; /* first 2-bit is address and others are data */ - u32 pos, wlen; - u32 ret; - - wlen = 32; - for (pos = 0; pos < len; pos += 32) { - if ((len - pos) < 32) - wlen = len - pos; - - /* Put address and data bits together */ - sendBuf[0] = (u8) ((adr + pos) >> 8); - sendBuf[1] = (u8) (adr + pos); - memcpy(&sendBuf[2], &data[pos], wlen); - - /* Send to EEPROM through iic bus */ - ret = XIic_Send(XPAR_IIC_0_BASEADDR, CONFIG_SYS_I2C_EEPROM_ADDR >> 1, - sendBuf, wlen + 2); - - udelay(IIC_DELAY); - } -} - -/************************************************************************ - * Use Xilinx provided driver to read data from EEPROM using the iic bus. - */ -static void -receive(u32 adr, u8 * data, u32 len) -{ - u8 address[2]; - u32 ret; - - address[0] = (u8) (adr >> 8); - address[1] = (u8) adr; - - /* Provide EEPROM address */ - ret = - XIic_Send(XPAR_IIC_0_BASEADDR, CONFIG_SYS_I2C_EEPROM_ADDR >> 1, address, - 2); - /* Receive data from EEPROM */ - ret = - XIic_Recv(XPAR_IIC_0_BASEADDR, CONFIG_SYS_I2C_EEPROM_ADDR >> 1, data, len); -} - -/************************************************************************ - * Convert a hexadecimal string to its equivalent integer value. - */ -static u8 -axtoi(u8 * hexStg) -{ - u8 n; /* position in string */ - u8 m; /* position in digit[] to shift */ - u8 count; /* loop index */ - u8 intValue; /* integer value of hex string */ - u8 digit[2]; /* hold values to convert */ - - for (n = 0; n < 2; n++) { - if (hexStg[n] == '\0') - break; - if (hexStg[n] > 0x29 && hexStg[n] < 0x40) - digit[n] = hexStg[n] & 0x0f; - else if (hexStg[n] >= 'a' && hexStg[n] <= 'f') - digit[n] = (hexStg[n] & 0x0f) + 9; - else if (hexStg[n] >= 'A' && hexStg[n] <= 'F') - digit[n] = (hexStg[n] & 0x0f) + 9; - else - break; - } - - intValue = 0; - count = n; - m = n - 1; - n = 0; - while (n < count) { - intValue = intValue | (digit[n] << (m << 2)); - m--; /* adjust the position to set */ - n++; /* next digit to process */ - } - - return (intValue); -} - -/************************************************************************ - * Convert an integer string to its equivalent value. - */ -static u8 -atoi(uchar * string) -{ - u8 res = 0; - while (*string >= '0' && *string <= '9') { - res *= 10; - res += *string - '0'; - string++; - } - - return res; -} - -/************************************************************************ - * Key-value pairs are separated by "=" sign. - */ -static void -findKey(uchar * buffer, int *loc, u8 len) -{ - u32 i; - - for (i = 0; i < len; i++) - if (buffer[i] == '=') { - *loc = i; - return; - } - - /* return -1 is no "=" sign found */ - *loc = -1; -} - -/************************************************************************ - * Compute a new ML300 CRC when user calls the saveenv command. - * Also update EEPROM with new CRC value. - */ -static u8 -update_crc(u32 len, uchar * data) -{ - uchar temp[6] = { 'C', '=', 0x00, 0x00, 0x00, 0x00 }; - u32 crc; /* new crc value */ - u32 i; - - crc = 0; - - /* calculate new CRC */ - for (i = 0; i < len; i++) - crc += data[i]; - - /* CRC includes key for check sum */ - crc += 'C' + '='; - - /* compose new CRC to be updated */ - temp[2] = hex[(crc >> 4) & 0xf]; - temp[3] = hex[crc & 0xf]; - - /* check to see if env size exceeded */ - if (len + 6 > ENV_SIZE) { - printf("ERROR: not enough space to store CRC on EEPROM"); - return 1; - } - - memcpy(data + len, temp, 6); - return 0; -} - -/************************************************************************ - * Read out ML300 CRC and compare it with a runtime calculated ML300 CRC. - * If equal, then pass back a u-boot CRC value, otherwise pass back - * junk to indicate CRC error. -*/ -static void -read_crc(uchar * buffer, int len) -{ - u32 addr, n; - u32 crc; /* runtime crc */ - u8 old[2] = { 0xff, 0xff }; /* current CRC in EEPROM */ - u8 stop; /* indication of end of env data */ - u8 pre; /* previous EEPROM data bit */ - int i, loc; - - addr = CONFIG_ENV_OFFSET; /* start from first env address */ - n = 0; - pre = 1; - stop = 1; - crc = 0; - - /* calculate runtime CRC according to ML300 and read back - old CRC stored in the EEPROM */ - while (n < CONFIG_ENV_SIZE) { - receive(addr, buffer, len); - - /* found two null chars, end of env */ - if ((pre || buffer[0]) == 0) - break; - - findKey(buffer, &loc, len); - - /* found old check sum, read and store old CRC */ - if ((loc == 0 && pre == 'C') - || (loc > 0 && buffer[loc - 1] == 'C')) - receive(addr + loc + 1, old, 2); - - pre = buffer[len - 1]; - - /* calculate runtime ML300 CRC */ - crc += buffer[0]; - i = 1; - do { - crc += buffer[i]; - stop = buffer[i] || buffer[i - 1]; - i++; - } while (stop && (i < len)); - - if (stop == 0) - break; - - n += len; - addr += len; - } - - /* exclude old CRC from runtime calculation */ - crc -= (old[0] + old[1]); - - /* match CRC values, send back u-boot CRC */ - if ((old[0] == hex[(crc >> 4) & 0xf]) - && (old[1] == hex[crc & 0xf])) { - crc = 0; - n = 0; - addr = - CONFIG_ENV_OFFSET - offsetof(env_t, crc) + offsetof(env_t, - data); - /* calculate u-boot crc */ - while (n < ENV_SIZE) { - receive(addr, buffer, len); - crc = crc32(crc, buffer, len); - n += len; - addr += len; - } - - memcpy(buffer, &crc, 4); - } -} - -/************************************************************************ - * Convert IP address to hexadecimals. - */ -static void -ip_ml300(uchar * s, uchar * res) -{ - char temp[2]; - u8 i; - - res[0] = 0x00; - - for (i = 0; i < 4; i++) { - sprintf(temp, "%02x", atoi(s)); - s = (uchar *)strchr((char *)s, '.') + 1; - strcat((char *)res, temp); - } -} - -/************************************************************************ - * Change 0xff (255), a dummy null char to 0x00. - */ -static void -change_null(uchar * s) -{ - if (s != NULL) { - change_null((uchar *)strchr((char *)s + 1, 255)); - *(strchr((char *)s, 255)) = '\0'; - } -} - -/************************************************************************ - * Update environment variable name and values to u-boot standard. - */ -void -convert_env(void) -{ - char *s; /* pointer to env value */ - char temp[20]; /* temp storage for addresses */ - - /* E -> ethaddr */ - s = getenv("E"); - if (s != NULL) { - sprintf(temp, "%c%c.%c%c.%c%c.%c%c.%c%c.%c%c", - s[0], s[1], s[ 2], s[ 3], - s[4], s[5], s[ 6], s[ 7], - s[8], s[9], s[10], s[11] ); - setenv("ethaddr", temp); - setenv("E", NULL); - } - - /* L -> serial# */ - s = getenv("L"); - if (s != NULL) { - setenv("serial#", s); - setenv("L", NULL); - } - - /* I -> ipaddr */ - s = getenv("I"); - if (s != NULL) { - sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)), - axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6))); - setenv("ipaddr", temp); - setenv("I", NULL); - } - - /* S -> serverip */ - s = getenv("S"); - if (s != NULL) { - sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)), - axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6))); - setenv("serverip", temp); - setenv("S", NULL); - } - - /* A -> bootargs */ - s = getenv("A"); - if (s != NULL) { - setenv("bootargs", s); - setenv("A", NULL); - } - - /* F -> bootfile */ - s = getenv("F"); - if (s != NULL) { - setenv("bootfile", s); - setenv("F", NULL); - } - - /* M -> bootcmd */ - s = getenv("M"); - if (s != NULL) { - setenv("bootcmd", s); - setenv("M", NULL); - } - - /* Don't include C (CRC) */ - setenv("C", NULL); -} - -/************************************************************************ - * Save user modified environment values back to EEPROM. - */ -static void -save_env(void) -{ - char eprom[ENV_SIZE]; /* buffer to be written back to EEPROM */ - char *s, temp[20]; - char ff[] = { 0xff, 0x00 }; /* dummy null value */ - u32 len; /* length of env to be written to EEPROM */ - - eprom[0] = 0x00; - - /* ethaddr -> E */ - s = getenv("ethaddr"); - if (s != NULL) { - strcat(eprom, "E="); - sprintf(temp, "%c%c%c%c%c%c%c%c%c%c%c%c", - *s, *(s + 1), *(s + 3), *(s + 4), *(s + 6), *(s + 7), - *(s + 9), *(s + 10), *(s + 12), *(s + 13), *(s + 15), - *(s + 16)); - strcat(eprom, temp); - strcat(eprom, ff); - } - - /* serial# -> L */ - s = getenv("serial#"); - if (s != NULL) { - strcat(eprom, "L="); - strcat(eprom, s); - strcat(eprom, ff); - } - - /* ipaddr -> I */ - s = getenv("ipaddr"); - if (s != NULL) { - strcat(eprom, "I="); - ip_ml300((uchar *)s, (uchar *)temp); - strcat(eprom, temp); - strcat(eprom, ff); - } - - /* serverip -> S */ - s = getenv("serverip"); - if (s != NULL) { - strcat(eprom, "S="); - ip_ml300((uchar *)s, (uchar *)temp); - strcat(eprom, temp); - strcat(eprom, ff); - } - - /* bootargs -> A */ - s = getenv("bootargs"); - if (s != NULL) { - strcat(eprom, "A="); - strcat(eprom, s); - strcat(eprom, ff); - } - - /* bootfile -> F */ - s = getenv("bootfile"); - if (s != NULL) { - strcat(eprom, "F="); - strcat(eprom, s); - strcat(eprom, ff); - } - - /* bootcmd -> M */ - s = getenv("bootcmd"); - if (s != NULL) { - strcat(eprom, "M="); - strcat(eprom, s); - strcat(eprom, ff); - } - - len = strlen(eprom); /* find env length without crc */ - change_null((uchar *)eprom); /* change 0xff to 0x00 */ - - /* update EEPROM env values if there is enough space */ - if (update_crc(len, (uchar *)eprom) == 0) - send(CONFIG_ENV_OFFSET, (uchar *)eprom, len + 6); -} - -/************************************************************************ - * U-boot call for EEPROM read associated activities. - */ -int -i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len) -{ - - if (envStep == 0) { - /* first read call is for crc */ - read_crc(buffer, len); - ++envStep; - return 0; - } else if (envStep == 1) { - /* then read out EEPROM content for runtime u-boot CRC calculation */ - receive(addr, buffer, len); - - if (addr + len - CONFIG_ENV_OFFSET == CONFIG_ENV_SIZE) - /* end of runtime crc read */ - ++envStep; - return 0; - } - - if (len < 2) { - /* when call getenv_r */ - receive(addr, buffer, len); - } else if (addr + len < CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) { - /* calling env_relocate(), but don't read out - crc value from EEPROM */ - receive(addr, buffer + 4, len); - } else { - receive(addr, buffer + 4, len - 4); - } - - return 0; - -} - -/************************************************************************ - * U-boot call for EEPROM write acativities. - */ -int -i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len) -{ - /* save env on last page write called by u-boot */ - if (addr + len >= CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) - save_env(); - - return 0; -} - -/************************************************************************ - * Dummy function. - */ -int -i2c_probe(uchar chip) -{ - return 1; -} - -#endif |