From 5a753f98c6a01bd1c61a9a3f95e8329a35f62994 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 7 Feb 2007 16:51:08 +0100 Subject: [PATCH 01/15] [PATCH] Update some AMCC 4xx board config files (set initrd_high) Some boards that can have more than 768MBytes of SDRAM need to set "initrd_high", so that the initrd can be accessed by the Linux kernel. Signed-off-by: Stefan Roese --- include/configs/bamboo.h | 1 + include/configs/bubinga.h | 1 + include/configs/ebony.h | 1 + include/configs/luan.h | 1 + include/configs/ocotea.h | 1 + include/configs/taishan.h | 1 + include/configs/walnut.h | 1 + include/configs/yucca.h | 1 + 8 files changed, 8 insertions(+) diff --git a/include/configs/bamboo.h b/include/configs/bamboo.h index 4961011b5..bcc736ceb 100644 --- a/include/configs/bamboo.h +++ b/include/configs/bamboo.h @@ -257,6 +257,7 @@ "bootfile=/tftpboot/bamboo/uImage\0" \ "kernel_addr=fff00000\0" \ "ramdisk_addr=fff10000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/bamboo/u-boot.bin\0" \ "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;" \ "cp.b 100000 fffa0000 60000;" \ diff --git a/include/configs/bubinga.h b/include/configs/bubinga.h index a66cdc395..10c481431 100644 --- a/include/configs/bubinga.h +++ b/include/configs/bubinga.h @@ -106,6 +106,7 @@ "bootfile=/tftpboot/bubinga/uImage\0" \ "kernel_addr=fff80000\0" \ "ramdisk_addr=fff90000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/bubinga/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/ebony.h b/include/configs/ebony.h index d8882ea31..6c4d7cc4f 100644 --- a/include/configs/ebony.h +++ b/include/configs/ebony.h @@ -177,6 +177,7 @@ "bootfile=/tftpboot/ebony/uImage\0" \ "kernel_addr=ff800000\0" \ "ramdisk_addr=ff810000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/ebony/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/luan.h b/include/configs/luan.h index 0350e91f0..5c9d208fe 100644 --- a/include/configs/luan.h +++ b/include/configs/luan.h @@ -178,6 +178,7 @@ "bootfile=/tftpboot/luan/uImage\0" \ "kernel_addr=fc000000\0" \ "ramdisk_addr=fc100000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/luan/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/ocotea.h b/include/configs/ocotea.h index 89e9164e0..0e3660ba2 100644 --- a/include/configs/ocotea.h +++ b/include/configs/ocotea.h @@ -192,6 +192,7 @@ "bootfile=/tftpboot/ocotea/uImage\0" \ "kernel_addr=fff00000\0" \ "ramdisk_addr=fff10000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/ocotea/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/taishan.h b/include/configs/taishan.h index 7ace3971d..2b28f93a0 100644 --- a/include/configs/taishan.h +++ b/include/configs/taishan.h @@ -188,6 +188,7 @@ "bootfile=/tftpboot/taishan/uImage\0" \ "kernel_addr=fc000000\0" \ "ramdisk_addr=fc180000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/taishan/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/walnut.h b/include/configs/walnut.h index 28abd6e15..b34dc71d2 100644 --- a/include/configs/walnut.h +++ b/include/configs/walnut.h @@ -68,6 +68,7 @@ "bootfile=/tftpboot/walnut/uImage\0" \ "kernel_addr=fff80000\0" \ "ramdisk_addr=fff80000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 /tftpboot/walnut/u-boot.bin\0" \ "update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \ "cp.b 100000 fffc0000 40000;" \ diff --git a/include/configs/yucca.h b/include/configs/yucca.h index a6532b5e8..6417ed891 100644 --- a/include/configs/yucca.h +++ b/include/configs/yucca.h @@ -178,6 +178,7 @@ "bootfile=yucca/uImage\0" \ "kernel_addr=E7F10000\0" \ "ramdisk_addr=E7F20000\0" \ + "initrd_high=30000000\0" \ "load=tftp 100000 yuca/u-boot.bin\0" \ "update=protect off 2:4-7;era 2:4-7;" \ "cp.b ${fileaddr} FFFB0000 ${filesize};" \ From 53d4a4983fb9b3ae5f7b2f10c599aca2b1b4034a Mon Sep 17 00:00:00 2001 From: Bartlomiej Sieka Date: Fri, 9 Feb 2007 10:45:42 +0100 Subject: [PATCH 02/15] [Motion-PRO] Preliminary support for the Motion-PRO board. --- MAKEALL | 6 +- Makefile | 3 + board/motionpro/Makefile | 50 ++++++ board/motionpro/config.mk | 30 ++++ board/motionpro/motionpro.c | 171 ++++++++++++++++++++ board/motionpro/u-boot.lds | 123 +++++++++++++++ cpu/mpc5xxx/fec.c | 8 +- include/configs/motionpro.h | 305 ++++++++++++++++++++++++++++++++++++ 8 files changed, 689 insertions(+), 7 deletions(-) create mode 100644 board/motionpro/Makefile create mode 100644 board/motionpro/config.mk create mode 100644 board/motionpro/motionpro.c create mode 100644 board/motionpro/u-boot.lds create mode 100644 include/configs/motionpro.h diff --git a/MAKEALL b/MAKEALL index 40a5c773e..9221e7084 100755 --- a/MAKEALL +++ b/MAKEALL @@ -37,9 +37,9 @@ LIST_5xx=" \ LIST_5xxx=" \ BC3450 cpci5200 EVAL5200 fo300 \ icecube_5100 icecube_5200 lite5200b mcc200 \ - o2dnt pf5200 PM520 TB5200 \ - Total5100 Total5200 Total5200_Rev2 TQM5200 \ - TQM5200_B TQM5200S v38b \ + motionpro o2dnt pf5200 PM520 \ + TB5200 Total5100 Total5200 Total5200_Rev2 \ + TQM5200 TQM5200_B TQM5200S v38b \ " ######################################################################### diff --git a/Makefile b/Makefile index b1952edfe..e1bab6674 100644 --- a/Makefile +++ b/Makefile @@ -604,6 +604,9 @@ TQM5200_STK100_config: unconfig @$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200 uc101_config: unconfig @$(MKCONFIG) uc101 ppc mpc5xxx uc101 +motionpro_config: unconfig + @$(MKCONFIG) motionpro ppc mpc5xxx motionpro + ######################################################################### ## MPC8xx Systems diff --git a/board/motionpro/Makefile b/board/motionpro/Makefile new file mode 100644 index 000000000..698ead195 --- /dev/null +++ b/board/motionpro/Makefile @@ -0,0 +1,50 @@ +# +# (C) Copyright 2003-2007 +# 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 + +LIB = $(obj)lib$(BOARD).a + +COBJS := $(BOARD).o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/motionpro/config.mk b/board/motionpro/config.mk new file mode 100644 index 000000000..e7934d29c --- /dev/null +++ b/board/motionpro/config.mk @@ -0,0 +1,30 @@ +# +# (C) Copyright 2006-2007 +# 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 +# + +# +# Promess Motion-PRO +# + +TEXT_BASE = 0xfff00000 + +PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board diff --git a/board/motionpro/motionpro.c b/board/motionpro/motionpro.c new file mode 100644 index 000000000..95576ed56 --- /dev/null +++ b/board/motionpro/motionpro.c @@ -0,0 +1,171 @@ +/* + * (C) Copyright 2003-2007 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * modified for Promess PRO - by Andy Joseph, andy@promessdev.com + * modified for Promess PRO-Motion - by Robert McCullough, rob@promessdev.com + * modified by Chris M. Tumas 6/20/06 Change CAS latency to 2 from 3 + * Also changed the refresh for 100Mhz operation + * + * 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 +#include + + +/* Kollmorgen DPR initialization data */ +struct init_elem { + unsigned long addr; + unsigned len; + char *data; + } init_seq[] = { + {0x500003F2, 2, "\x86\x00"}, /* HW parameter */ + {0x500003F0, 2, "\x00\x00"}, + {0x500003EC, 4, "\x00\x80\xc1\x52"}, /* Magic word */ + }; + +/* + * Initialize Kollmorgen DPR + */ +static void kollmorgen_init(void) +{ + unsigned i, j; + vu_char *p; + + for (i = 0; i < sizeof(init_seq) / sizeof(struct init_elem); ++i) { + p = (vu_char *)init_seq[i].addr; + for (j = 0; j < init_seq[i].len; ++j) + *(p + j) = *(init_seq[i].data + j); + } + + printf("DPR: Kollmorgen DPR initialized\n"); +} + + +/* + * Early board initalization. + */ +int board_early_init_r(void) +{ + /* Now, when we are in RAM, disable Boot Chipselect and enable CS0 */ + *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); + *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); + + /* Initialize Kollmorgen DPR */ + kollmorgen_init(); + + return 0; +} + + +#ifndef CFG_RAMBOOT +/* + * Helper function to initialize SDRAM controller. + */ +static void sdram_start (int hi_addr) +{ + long hi_addr_bit = hi_addr ? 0x01000000 : 0; + + /* unlock mode register */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | + hi_addr_bit; + + /* precharge all banks */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | + hi_addr_bit; + + /* auto refresh */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | + hi_addr_bit; + + /* auto refresh, second time */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | + hi_addr_bit; + + /* set mode register */ + *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE; + + /* normal operation */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit; +} +#endif /* !CFG_RAMBOOT */ + + +/* + * Initalize SDRAM - configure SDRAM controller, detect memory size. + */ +long int initdram (int board_type) +{ + ulong dramsize = 0; +#ifndef CFG_RAMBOOT + ulong test1, test2; + + /* configure SDRAM start/end for detection */ + *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */ + *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000; /* disabled */ + + /* setup config registers */ + *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; + *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; + + sdram_start(0); + test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000); + sdram_start(1); + test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000); + if (test1 > test2) { + sdram_start(0); + dramsize = test1; + } else { + dramsize = test2; + } + + /* memory smaller than 1MB is impossible */ + if (dramsize < (1 << 20)) + dramsize = 0; + + /* set SDRAM CS0 size according to the amount of RAM found */ + if (dramsize > 0) + *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + + __builtin_ffs(dramsize >> 20) - 1; + else + *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */ + + /* let SDRAM CS1 start right after CS0 and disable it */ + *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize; + +#else /* !CFG_RAMBOOT */ + /* retrieve size of memory connected to SDRAM CS0 */ + dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF; + if (dramsize >= 0x13) + dramsize = (1 << (dramsize - 0x13)) << 20; + else + dramsize = 0; +#endif /* CFG_RAMBOOT */ + + /* return total ram size */ + return dramsize; +} + + +int checkboard (void) +{ + puts("Board: Promess Motion-PRO board\n"); + return 0; +} diff --git a/board/motionpro/u-boot.lds b/board/motionpro/u-boot.lds new file mode 100644 index 000000000..8fa9c0f7e --- /dev/null +++ b/board/motionpro/u-boot.lds @@ -0,0 +1,123 @@ +/* + * (C) Copyright 2003-2007 + * 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) +SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); +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 : + { + cpu/mpc5xxx/start.o (.text) + *(.text) + *(.fixup) + *(.got1) + . = ALIGN(16); + *(.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/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c index 71c1bfab1..e6392340a 100644 --- a/cpu/mpc5xxx/fec.c +++ b/cpu/mpc5xxx/fec.c @@ -880,10 +880,10 @@ int mpc5xxx_fec_initialize(bd_t * bis) fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD)); #if defined(CONFIG_CANMB) || defined(CONFIG_HMI1001) || \ defined(CONFIG_ICECUBE) || defined(CONFIG_INKA4X0) || \ - defined(CONFIG_MCC200) || defined(CONFIG_O2DNT) || \ - defined(CONFIG_PM520) || defined(CONFIG_TOP5200) || \ - defined(CONFIG_TQM5200) || defined(CONFIG_V38B) || \ - defined(CONFIG_UC101) + defined(CONFIG_MCC200) || defined(CONFIG_MOTIONPRO) || \ + defined(CONFIG_O2DNT) || defined(CONFIG_PM520) || \ + defined(CONFIG_TOP5200) || defined(CONFIG_TQM5200) || \ + defined(CONFIG_UC101) || defined(CONFIG_V38B) # ifndef CONFIG_FEC_10MBIT fec->xcv_type = MII100; # else diff --git a/include/configs/motionpro.h b/include/configs/motionpro.h new file mode 100644 index 000000000..5328e8d6b --- /dev/null +++ b/include/configs/motionpro.h @@ -0,0 +1,305 @@ +/* + * (C) Copyright 2003-2007 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * Based on PRO Motion board config file by Andy Joseph, andy@promessdev.com + * + * 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 + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + + +/* + * High Level Configuration Options + */ + + +/* CPU and board */ +#define CONFIG_MPC5xxx 1 /* This is an MPC5xxx CPU */ +#define CONFIG_MPC5200 1 /* More exactly a MPC5200 */ +#define CONFIG_MOTIONPRO 1 /* ... on Promess Motion-PRO board */ + + +/* + * Supported commands + */ +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \ + CFG_CMD_ASKENV | \ + CFG_CMD_DHCP | \ + CFG_CMD_REGINFO | \ + CFG_CMD_IMMAP | \ + CFG_CMD_ELF | \ + CFG_CMD_MII | \ + CFG_CMD_BEDBUG | \ + CFG_CMD_NET | \ + CFG_CMD_PING) + +/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ +#include + + +/* + * Serial console configuration + */ +#define CONFIG_PSC_CONSOLE 1 /* console is on PSC1 */ +#define CONFIG_NETCONSOLE 1 /* network console */ +#define CONFIG_BAUDRATE 115200 +#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } + + +/* + * Ethernet configuration + */ +#define CONFIG_MPC5xxx_FEC 1 +#define CONFIG_PHY_ADDR 0x2 +#define CONFIG_PHY_TYPE 0x79c874 + + +/* + * Autobooting + */ +#define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */ +#define CONFIG_AUTOBOOT_KEYED +#define CONFIG_AUTOBOOT_STOP_STR "\x1b\x1b" +#define DEBUG_BOOTKEYS 0 +#undef CONFIG_AUTOBOOT_DELAY_STR +#undef CONFIG_BOOTARGS +#define CONFIG_AUTOBOOT_PROMPT "Autobooting in %d seconds, " \ + "press \"\" to stop\n" + +#define CONFIG_ETHADDR 00:50:C2:40:10:00 +#define CONFIG_OVERWRITE_ETHADDR_ONCE 1 +#define CONFIG_VERSION_VARIABLE 1 /* include version env variable */ + + +/* + * Default environment settings + */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "sdram_test=0\0" \ + "netdev=eth0\0" \ + "hostname=motionpro\0" \ + "netmask=255.255.0.0\0" \ + "ipaddr=192.168.160.22\0" \ + "serverip=192.168.1.1\0" \ + "gatewayip=192.168.1.1\0" \ + "kernel_addr=200000\0" \ + "u-boot_addr=100000\0" \ + "kernel_sector=20\0" \ + "kernel_size=1000\0" \ + "console=ttyS0,115200\0" \ + "rootpath=/opt/eldk-4.1/ppc_6xx\0" \ + "bootfile=/tftpboot/motionpro/uImage\0" \ + "u-boot=/tftpboot/motionpro/u-boot.bin\0" \ + "load=tftp $(u-boot_addr) $(u-boot)\0" \ + "update=prot off fff00000 fff3ffff; era fff00000 fff3ffff; " \ + "cp.b $(u-boot_addr) fff00000 $(filesize);" \ + "prot on fff00000 fff3ffff\0" \ + "ramargs=setenv bootargs root=/dev/ram rw\0" \ + "addip=setenv bootargs $(bootargs) console=$(console) " \ + "ip=$(ipaddr):$(serverip):$(gatewayip):" \ + "$(netmask):$(hostname):$(netdev):off panic=1\0" \ + "flash_nfs=run nfsargs addip;bootm $(kernel_addr)\0" \ + "flash_self=run ramargs addip;bootm $(kernel_addr) " \ + "$(ramdisk_addr)\0" \ + "net_nfs=tftp $(kernel_addr) $(bootfile); run nfsargs addip; " \ + "bootm $(kernel_addr)\0" \ + "nfsargs=setenv bootargs root=/dev/nfs rw " \ + "nfsroot=$(serverip):$(rootpath)\0" \ + "fstype=ext3\0" \ + "fatargs=setenv bootargs init=/linuxrc rw\0" \ + "" +#define CONFIG_BOOTCOMMAND "run net_nfs" + + +/* + * do board-specific init + */ +#define CONFIG_BOARD_EARLY_INIT_R 1 + + +/* + * Low level configuration + */ + + +/* + * Clock configuration: SYS_XTALIN = 25MHz + */ +#define CFG_MPC5XXX_CLKIN 25000000 + + +/* + * Memory map + */ +/* + * Warning!!! with the current BestComm Task, MBAR MUST BE set to 0xf0000000. + * Setting MBAR to otherwise will cause system hang when using SmartDMA such + * as network commands. + */ +#define CFG_MBAR 0xf0000000 +#define CFG_SDRAM_BASE 0x00000000 + +/* + * If building for running out of SDRAM, then MBAR has been set up beforehand + * (e.g., by the BDI). Otherwise we must specify the default boot-up value of + * MBAR, as given in the doccumentation. + */ +#if TEXT_BASE == 0x00100000 +#define CFG_DEFAULT_MBAR 0xf0000000 +#else /* TEXT_BASE != 0x00100000 */ +#define CFG_DEFAULT_MBAR 0x80000000 +#define CFG_LOWBOOT 1 +#endif /* TEXT_BASE == 0x00100000 */ + +/* Use SRAM until RAM will be available */ +#define CFG_INIT_RAM_ADDR MPC5XXX_SRAM +#define CFG_INIT_RAM_END MPC5XXX_SRAM_SIZE + +#define CFG_GBL_DATA_SIZE 128 /* size in bytes for initial data */ +#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE) +#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET + +#define CFG_MONITOR_BASE TEXT_BASE +#if (CFG_MONITOR_BASE < CFG_FLASH_BASE) +#define CFG_RAMBOOT 1 +#endif + +#define CFG_MONITOR_LEN (256 << 10) /* 256 kB for Monitor */ +#define CFG_MALLOC_LEN (128 << 10) /* 128 kB for malloc() */ +#define CFG_BOOTMAPSZ (8 << 20) /* initial mem map for Linux */ + + +/* + * Chip selects configuration + */ +/* Boot Chipselect */ +#define CFG_BOOTCS_START CFG_FLASH_BASE +#define CFG_BOOTCS_SIZE CFG_FLASH_SIZE +#define CFG_BOOTCS_CFG 0x03035D00 + +/* Flash memory addressing */ +#define CFG_CS0_START CFG_FLASH_BASE +#define CFG_CS0_SIZE CFG_FLASH_SIZE +#define CFG_CS0_CFG CFG_BOOTCS_CFG + +/* Dual Port SRAM -- Kollmorgen Drive memory addressing */ +#define CFG_CS1_START 0x50000000 +#define CFG_CS1_SIZE 0x10000 +#define CFG_CS1_CFG 0x05055800 + +/* Local register access */ +#define CFG_CS2_START 0x50010000 +#define CFG_CS2_SIZE 0x10000 +#define CFG_CS2_CFG 0x05055800 + +/* Anybus CompactCom Module memory addressing */ +#define CFG_CS3_START 0x50020000 +#define CFG_CS3_SIZE 0x10000 +#define CFG_CS3_CFG 0x05055800 + +/* No burst and dead cycle = 2 for all CSs */ +#define CFG_CS_BURST 0x00000000 +#define CFG_CS_DEADCYCLE 0x22222222 + + +/* + * SDRAM configuration + */ +/* 2 x MT48LC16M16A2BG-75 IT:D, CASL 2, 32 bit data bus */ +#define SDRAM_CONFIG1 0x52222600 +#define SDRAM_CONFIG2 0x88b70000 +#define SDRAM_CONTROL 0x50570000 +#define SDRAM_MODE 0x008d0000 + + +/* + * Flash configuration + */ +#define CFG_FLASH_CFI 1 /* Flash is CFI conformant */ +#define CFG_FLASH_CFI_DRIVER 1 +#define CFG_FLASH_BASE 0xff000000 +#define CFG_FLASH_SIZE 0x01000000 +#define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */ +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_MAX_FLASH_SECT 256 /* max num of sects on one chip */ +#define CONFIG_FLASH_16BIT /* Flash is 16-bit */ + + +/* + * Environment settings + */ +#define CFG_ENV_IS_IN_FLASH 1 +/* This has to be a multiple of the Flash sector size */ +#define CFG_ENV_ADDR (CFG_MONITOR_BASE + CFG_MONITOR_LEN) +#define CFG_ENV_SIZE 0x1000 +#define CFG_ENV_SECT_SIZE 0x10000 + + +/* + * Pin multiplexing configuration + */ + +/* PSC1: UART1 + * PSC2: GPIO (default) + * PSC3: GPIO (default) + * USB: 2xUART4/5 + * Ethernet: Ethernet 100Mbit with MD + * Timer: CAN2/GPIO + * PSC6/IRDA: GPIO (default) + */ +#define CFG_GPS_PORT_CONFIG 0x1105a004 + + +/* + * Miscellaneous configurable options + */ +#define CFG_LONGHELP /* undef to save memory */ +#define CFG_PROMPT "=> " /* Monitor Command Prompt */ +#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */ +#define CFG_MAXARGS 16 /* max number of command args */ +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ + +#define CFG_MEMTEST_START 0x00100000 /* memtest works on */ +#define CFG_MEMTEST_END 0x03f00000 /* 1 ... 64 MiB in DRAM */ + +#define CFG_LOAD_ADDR 0x200000 /* default kernel load addr */ + +#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */ + + +/* + * Various low-level settings + */ +#define CFG_HID0_INIT HID0_ICE | HID0_ICFI +#define CFG_HID0_FINAL HID0_ICE + +#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */ +#define BOOTFLAG_WARM 0x02 /* Software reboot */ + +#define CFG_CACHELINE_SIZE 32 /* For MPC5xxx CPUs */ + + +/* Not needed for MPC 5xxx U-Boot, but used by tools/updater */ +#define CFG_RESET_ADDRESS 0xfff00100 + +#endif /* __CONFIG_H */ From b0b1a920aebead0d44146e73676ae9d80fffc8e2 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Sat, 10 Feb 2007 08:49:31 +0100 Subject: [PATCH 03/15] [PATCH] Add missing p3mx.h file to repository (ups) Signed-off-by: Stefan Roese --- board/prodrive/p3mx/p3mx.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 board/prodrive/p3mx/p3mx.h diff --git a/board/prodrive/p3mx/p3mx.h b/board/prodrive/p3mx/p3mx.h new file mode 100644 index 000000000..91071e920 --- /dev/null +++ b/board/prodrive/p3mx/p3mx.h @@ -0,0 +1,34 @@ +/* + * (C) Copyright 2005 + * + * Roel Loeffen, (C) Copyright 2006 Prodrive B.V. roel.loeffen@prodrive.nl + * + * 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 + */ + +#ifndef __P3MX_H__ +#define __P3MX_H__ + +#define LED_OFF 1 +#define LED_GREEN 2 +#define LED_RED 3 +#define LED_ORANGE 4 + +#endif /* __P3MX_H__ */ + From 497d012e5be0194e1084073d0081eb1a844796b2 Mon Sep 17 00:00:00 2001 From: Gary Jennejohn Date: Mon, 12 Feb 2007 13:11:50 +0100 Subject: [PATCH 04/15] LPC2292: patch from Siemens. --- board/lpc2292sodimm/lpc2292sodimm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/lpc2292sodimm/lpc2292sodimm.c b/board/lpc2292sodimm/lpc2292sodimm.c index de04c6638..d212c6332 100644 --- a/board/lpc2292sodimm/lpc2292sodimm.c +++ b/board/lpc2292sodimm/lpc2292sodimm.c @@ -46,7 +46,7 @@ int board_init (void) gd->bd->bi_arch_number = 83; /* location of boot parameters */ - gd->bd->bi_boot_params = 0xc0000100; + gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; return 0; } From 4be23a12f23f1372634edc3215137b09768b7949 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 19 Feb 2007 08:23:15 +0100 Subject: [PATCH 05/15] [PATCH] Update Sequoia EBC configuration (NOR FLASH) As spotted by Matthias Fuchs, the READY input should not be enabled for the NOR FLASH on the Sequoia board. Signed-off-by: Stefan Roese --- include/configs/sequoia.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h index 098aa3f0a..29f3b408d 100644 --- a/include/configs/sequoia.h +++ b/include/configs/sequoia.h @@ -391,7 +391,7 @@ #if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL) #define CFG_NAND_CS 3 /* NAND chip connected to CSx */ /* Memory Bank 0 (NOR-FLASH) initialization */ -#define CFG_EBC_PB0AP 0x03017300 +#define CFG_EBC_PB0AP 0x03017200 #define CFG_EBC_PB0CR (CFG_FLASH | 0xda000) /* Memory Bank 3 (NAND-FLASH) initialization */ @@ -400,7 +400,7 @@ #else #define CFG_NAND_CS 0 /* NAND chip connected to CSx */ /* Memory Bank 3 (NOR-FLASH) initialization */ -#define CFG_EBC_PB3AP 0x03017300 +#define CFG_EBC_PB3AP 0x03017200 #define CFG_EBC_PB3CR (CFG_FLASH | 0xda000) /* Memory Bank 0 (NAND-FLASH) initialization */ From 489c696ae7211218961d159e43e722d74c36fcbc Mon Sep 17 00:00:00 2001 From: Sergei Poselenov Date: Wed, 14 Feb 2007 14:30:28 +0300 Subject: [PATCH 06/15] MCC200: Extensions to Software Update Mechanism Update / extend Software Update Mechanism for MCC200 board: - Add support for rootfs image added. The environment variables "rootfs_st" and "rootfs_nd" can be used to override the default values of the image start and end. - Remove excessive key check code. - Code cleanup. --- board/mcc200/auto_update.c | 93 +++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c index f1bb72128..12091fd78 100644 --- a/board/mcc200/auto_update.c +++ b/board/mcc200/auto_update.c @@ -47,25 +47,6 @@ #error "must define CFG_CMD_FAT" #endif -/* - * Check whether a USB memory stick is plugged in. - * If one is found: - * 1) if prepare.img ist found load it into memory. If it is - * valid then run it. - * 2) if preinst.img is found load it into memory. If it is - * valid then run it. Update the EEPROM. - * 3) if firmw_01.img is found load it into memory. If it is valid, - * burn it into FLASH and update the EEPROM. - * 4) if kernl_01.img is found load it into memory. If it is valid, - * burn it into FLASH and update the EEPROM. - * 5) if app.img is found load it into memory. If it is valid, - * burn it into FLASH and update the EEPROM. - * 6) if disk.img is found load it into memory. If it is valid, - * burn it into FLASH and update the EEPROM. - * 7) if postinst.img is found load it into memory. If it is - * valid then run it. Update the EEPROM. - */ - #undef AU_DEBUG #undef debug @@ -78,6 +59,7 @@ /* possible names of files on the USB stick. */ #define AU_FIRMWARE "u-boot.img" #define AU_KERNEL "kernel.img" +#define AU_ROOTFS "rootfs.img" struct flash_layout { long start; @@ -89,33 +71,45 @@ struct flash_layout { #define AU_FL_FIRMWARE_ND 0xfC03FFFF #define AU_FL_KERNEL_ST 0xfC0C0000 #define AU_FL_KERNEL_ND 0xfC1BFFFF +#define AU_FL_ROOTFS_ST 0xFC1C0000 +#define AU_FL_ROOTFS_ND 0xFCFBFFFF static int au_usb_stor_curr_dev; /* current device */ /* index of each file in the following arrays */ #define IDX_FIRMWARE 0 #define IDX_KERNEL 1 +#define IDX_ROOTFS 2 /* max. number of files which could interest us */ -#define AU_MAXFILES 2 +#define AU_MAXFILES 3 /* pointers to file names */ -char *aufile[AU_MAXFILES]; +char *aufile[AU_MAXFILES] = { + AU_FIRMWARE, + AU_KERNEL, + AU_ROOTFS +}; /* sizes of flash areas for each file */ -long ausize[AU_MAXFILES]; +long ausize[AU_MAXFILES] = { + (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST, + (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST, + (AU_FL_ROOTFS_ND + 1) - AU_FL_ROOTFS_ST +}; /* array of flash areas start and end addresses */ -struct flash_layout aufl_layout[AU_MAXFILES] = { \ - {AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,}, \ - {AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,}, \ +struct flash_layout aufl_layout[AU_MAXFILES] = { + {AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,}, + {AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,}, + {AU_FL_ROOTFS_ST, AU_FL_ROOTFS_ND,} }; /* where to load files into memory */ #define LOAD_ADDR ((unsigned char *)0x00200000) /* the app is the largest image */ -#define MAX_LOADSZ ausize[IDX_KERNEL] +#define MAX_LOADSZ ausize[IDX_ROOTFS] /*i2c address of the keypad status*/ #define I2C_PSOC_KEYPAD_ADDR 0x53 @@ -163,7 +157,6 @@ int au_check_header_valid(int idx, long nbytes) { image_header_t *hdr; unsigned long checksum; - unsigned char buf[4]; hdr = (image_header_t *)LOAD_ADDR; /* check the easy ones first */ @@ -200,6 +193,10 @@ int au_check_header_valid(int idx, long nbytes) printf ("Image %s wrong type\n", aufile[idx]); return -1; } + if ((idx == IDX_ROOTFS) && (hdr->ih_type != IH_TYPE_RAMDISK)) { + printf ("Image %s wrong type\n", aufile[idx]); + return -1; + } /* recycle checksum */ checksum = ntohl(hdr->ih_size); /* for kernel and app the image header must also fit into flash */ @@ -257,7 +254,7 @@ int au_do_update(int idx, long sz) flash_sect_erase(start, end); wait_ms(100); /* strip the header - except for the kernel and ramdisk */ - if (hdr->ih_type == IH_TYPE_KERNEL) { + if (hdr->ih_type == IH_TYPE_KERNEL || hdr->ih_type == IH_TYPE_RAMDISK) { addr = (char *)hdr; off = sizeof(*hdr); nbytes = sizeof(*hdr) + ntohl(hdr->ih_size); @@ -305,7 +302,7 @@ int do_auto_update(void) int i, res, bitmap_first, cnt, old_ctrlc, got_ctrlc; char *env; long start, end; - char keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0}; + uchar keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0}; /* * Read keypad status @@ -317,10 +314,6 @@ int do_auto_update(void) /* * Check keypad */ - if ( !(keypad_status1[0] & KEYPAD_MASK_HI) || - (keypad_status1[0] != keypad_status2[0])) { - return 0; - } if ( !(keypad_status1[1] & KEYPAD_MASK_LO) || (keypad_status1[1] != keypad_status2[1])) { return 0; @@ -359,14 +352,6 @@ int do_auto_update(void) debug ("file_fat_detectfs failed\n"); } - /* initialize the array of file names */ - memset(aufile, 0, sizeof(aufile)); - aufile[IDX_FIRMWARE] = AU_FIRMWARE; - aufile[IDX_KERNEL] = AU_KERNEL; - /* initialize the array of flash sizes */ - memset(ausize, 0, sizeof(ausize)); - ausize[IDX_FIRMWARE] = (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST; - ausize[IDX_KERNEL] = (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST; /* * now check whether start and end are defined using environment * variables. @@ -381,8 +366,8 @@ int do_auto_update(void) end = simple_strtoul(env, NULL, 16); if (start >= 0 && end && end > start) { ausize[IDX_FIRMWARE] = (end + 1) - start; - aufl_layout[0].start = start; - aufl_layout[0].end = end; + aufl_layout[IDX_FIRMWARE].start = start; + aufl_layout[IDX_FIRMWARE].end = end; } start = -1; end = 0; @@ -394,9 +379,23 @@ int do_auto_update(void) end = simple_strtoul(env, NULL, 16); if (start >= 0 && end && end > start) { ausize[IDX_KERNEL] = (end + 1) - start; - aufl_layout[1].start = start; - aufl_layout[1].end = end; + aufl_layout[IDX_KERNEL].start = start; + aufl_layout[IDX_KERNEL].end = end; } + start = -1; + end = 0; + env = getenv("rootfs_st"); + if (env != NULL) + start = simple_strtoul(env, NULL, 16); + env = getenv("rootfs_nd"); + if (env != NULL) + end = simple_strtoul(env, NULL, 16); + if (start >= 0 && end && end > start) { + ausize[IDX_ROOTFS] = (end + 1) - start; + aufl_layout[IDX_ROOTFS].start = start; + aufl_layout[IDX_ROOTFS].end = end; + } + /* make certain that HUSH is runnable */ u_boot_hush_start(); /* make sure that we see CTRL-C and save the old state */ @@ -443,8 +442,8 @@ int do_auto_update(void) } cnt++; #ifdef AU_TEST_ONLY - } while (res < 0 && cnt < 3); - if (cnt < 3) + } while (res < 0 && cnt < (AU_MAXFILES + 1)); + if (cnt < (AU_MAXFILES + 1)) #else } while (res < 0); #endif From 735dd97b1b20e777d059c7b389fe9d70cd3f80c7 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:04:34 +0100 Subject: [PATCH 07/15] [PATCH 1_4] Merge common get_dev() routines for block devices Each of the filesystem drivers duplicate the get_dev routine. This change merges them into a single function in part.c Signed-off-by: Grant Likely --- board/esd/common/auto_update.c | 3 +-- board/mcc200/auto_update.c | 3 +-- board/mpl/mip405/mip405.c | 3 --- board/trab/auto_update.c | 1 - common/cmd_ext2.c | 40 +++------------------------ common/cmd_fat.c | 37 +------------------------ common/cmd_ide.c | 8 +++++- common/cmd_reiser.c | 40 +++------------------------ common/cmd_scsi.c | 2 +- common/cmd_usb.c | 1 + common/usb_storage.c | 3 ++- cpu/pxa/mmc.c | 2 +- disk/part.c | 49 ++++++++++++++++++++++++++++++++++ include/ide.h | 6 ++--- include/part.h | 9 +++++++ 15 files changed, 82 insertions(+), 125 deletions(-) diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c index 5cd342332..001fd68da 100644 --- a/board/esd/common/auto_update.c +++ b/board/esd/common/auto_update.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "auto_update.h" @@ -71,8 +72,6 @@ extern int transfer_pic(unsigned char, unsigned char *, int, int); extern int flash_sect_erase(ulong, ulong); extern int flash_sect_protect (int, ulong, ulong); extern int flash_write (char *, ulong, ulong); -/* change char* to void* to shutup the compiler */ -extern block_dev_desc_t *get_dev (char*, int); #if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY) /* references to names in cmd_nand.c */ diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c index 12091fd78..df003fe8b 100644 --- a/board/mcc200/auto_update.c +++ b/board/mcc200/auto_update.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef CFG_HUSH_PARSER #include @@ -128,8 +129,6 @@ extern int i2c_read (unsigned char, unsigned int, int , unsigned char* , int); extern int flash_sect_erase(ulong, ulong); extern int flash_sect_protect (int, ulong, ulong); extern int flash_write (char *, ulong, ulong); -/* change char* to void* to shutup the compiler */ -extern block_dev_desc_t *get_dev (char*, int); extern int u_boot_hush_start(void); int au_check_cksum_valid(int idx, long nbytes) diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c index 34f328999..13249787d 100644 --- a/board/mpl/mip405/mip405.c +++ b/board/mpl/mip405/mip405.c @@ -73,9 +73,6 @@ DECLARE_GLOBAL_DATA_PTR; -extern block_dev_desc_t * scsi_get_dev(int dev); -extern block_dev_desc_t * ide_get_dev(int dev); - #undef SDRAM_DEBUG #define ENABLE_ECC /* for ecc boards */ #define FALSE 0 diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c index d2c8d44a7..f4074aecb 100644 --- a/board/trab/auto_update.c +++ b/board/trab/auto_update.c @@ -203,7 +203,6 @@ extern int flash_write (char *, ulong, ulong); /* change char* to void* to shutup the compiler */ extern int i2c_write_multiple (uchar, uint, int, void *, int); extern int i2c_read_multiple (uchar, uint, int, void *, int); -extern block_dev_desc_t *get_dev (char*, int); extern int u_boot_hush_start(void); int diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index 5db42f2b0..94bd9b61e 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -33,6 +33,7 @@ * Ext2fs support */ #include +#include #if (CONFIG_COMMANDS & CFG_CMD_EXT2) #include @@ -57,41 +58,6 @@ #define PRINTF(fmt,args...) #endif -static block_dev_desc_t *get_dev (char* ifname, int dev) -{ -#if (CONFIG_COMMANDS & CFG_CMD_IDE) - if (strncmp(ifname,"ide",3)==0) { - extern block_dev_desc_t * ide_get_dev(int dev); - return((dev >= CFG_IDE_MAXDEVICE) ? NULL : ide_get_dev(dev)); - } -#endif -#if (CONFIG_COMMANDS & CFG_CMD_SCSI) - if (strncmp(ifname,"scsi",4)==0) { - extern block_dev_desc_t * scsi_get_dev(int dev); - return((dev >= CFG_SCSI_MAXDEVICE) ? NULL : scsi_get_dev(dev)); - } -#endif -#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE)) - if (strncmp(ifname,"usb",3)==0) { - extern block_dev_desc_t * usb_stor_get_dev(int dev); - return((dev >= USB_MAX_STOR_DEV) ? NULL : usb_stor_get_dev(dev)); - } -#endif -#if defined(CONFIG_MMC) - if (strncmp(ifname,"mmc",3)==0) { - extern block_dev_desc_t * mmc_get_dev(int dev); - return((dev >= 1) ? NULL : mmc_get_dev(dev)); - } -#endif -#if defined(CONFIG_SYSTEMACE) - if (strcmp(ifname,"ace")==0) { - extern block_dev_desc_t * systemace_get_dev(int dev); - return((dev >= 1) ? NULL : systemace_get_dev(dev)); - } -#endif - return(NULL); -} - int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char *filename = "/"; @@ -106,7 +72,7 @@ int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(1); } dev = (int)simple_strtoul (argv[2], &ep, 16); - dev_desc=get_dev(argv[1],dev); + dev_desc = get_dev(argv[1],dev); if (dev_desc == NULL) { printf ("\n** Block device %s %d not supported\n", argv[1], dev); @@ -210,7 +176,7 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } dev = (int)simple_strtoul (argv[2], &ep, 16); - dev_desc=get_dev(argv[1],dev); + dev_desc = get_dev(argv[1],dev); if (dev_desc==NULL) { printf ("\n** Block device %s %d not supported\n", argv[1], dev); return(1); diff --git a/common/cmd_fat.c b/common/cmd_fat.c index 6844c103f..afaf29956 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -29,6 +29,7 @@ #include #include #include +#include #if (CONFIG_COMMANDS & CFG_CMD_FAT) @@ -37,42 +38,6 @@ #include -block_dev_desc_t *get_dev (char* ifname, int dev) -{ -#if (CONFIG_COMMANDS & CFG_CMD_IDE) - if (strncmp(ifname,"ide",3)==0) { - extern block_dev_desc_t * ide_get_dev(int dev); - return(ide_get_dev(dev)); - } -#endif -#if (CONFIG_COMMANDS & CFG_CMD_SCSI) - if (strncmp(ifname,"scsi",4)==0) { - extern block_dev_desc_t * scsi_get_dev(int dev); - return(scsi_get_dev(dev)); - } -#endif -#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE)) - if (strncmp(ifname,"usb",3)==0) { - extern block_dev_desc_t * usb_stor_get_dev(int dev); - return(usb_stor_get_dev(dev)); - } -#endif -#if defined(CONFIG_MMC) - if (strncmp(ifname,"mmc",3)==0) { - extern block_dev_desc_t * mmc_get_dev(int dev); - return(mmc_get_dev(dev)); - } -#endif -#if defined(CONFIG_SYSTEMACE) - if (strcmp(ifname,"ace")==0) { - extern block_dev_desc_t * systemace_get_dev(int dev); - return(systemace_get_dev(dev)); - } -#endif - return NULL; -} - - int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { long size; diff --git a/common/cmd_ide.c b/common/cmd_ide.c index a4155029a..ebc080c72 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -31,20 +31,26 @@ #include #include #include + #if defined(CONFIG_IDE_8xx_DIRECT) || defined(CONFIG_IDE_PCMCIA) # include #endif + #ifdef CONFIG_8xx # include #endif + #ifdef CONFIG_MPC5xxx #include #endif + #include #include + #ifdef CONFIG_STATUS_LED # include #endif + #ifndef __PPC__ #include #ifdef __MIPS__ @@ -697,7 +703,7 @@ void ide_init (void) block_dev_desc_t * ide_get_dev(int dev) { - return ((block_dev_desc_t *)&ide_dev_desc[dev]); + return (dev < CFG_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL; } diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index 508ffcbda..09c86e66d 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -35,6 +35,7 @@ #include #include #include +#include #ifndef CONFIG_DOS_PARTITION #error DOS partition support must be selected @@ -48,41 +49,6 @@ #define PRINTF(fmt,args...) #endif -static block_dev_desc_t *get_dev (char* ifname, int dev) -{ -#if (CONFIG_COMMANDS & CFG_CMD_IDE) - if (strncmp(ifname,"ide",3)==0) { - extern block_dev_desc_t * ide_get_dev(int dev); - return((dev >= CFG_IDE_MAXDEVICE) ? NULL : ide_get_dev(dev)); - } -#endif -#if (CONFIG_COMMANDS & CFG_CMD_SCSI) - if (strncmp(ifname,"scsi",4)==0) { - extern block_dev_desc_t * scsi_get_dev(int dev); - return((dev >= CFG_SCSI_MAXDEVICE) ? NULL : scsi_get_dev(dev)); - } -#endif -#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE)) - if (strncmp(ifname,"usb",3)==0) { - extern block_dev_desc_t * usb_stor_get_dev(int dev); - return((dev >= USB_MAX_STOR_DEV) ? NULL : usb_stor_get_dev(dev)); - } -#endif -#if defined(CONFIG_MMC) - if (strncmp(ifname,"mmc",3)==0) { - extern block_dev_desc_t * mmc_get_dev(int dev); - return((dev >= 1) ? NULL : mmc_get_dev(dev)); - } -#endif -#if defined(CONFIG_SYSTEMACE) - if (strcmp(ifname,"ace")==0) { - extern block_dev_desc_t * systemace_get_dev(int dev); - return((dev >= 1) ? NULL : systemace_get_dev(dev)); - } -#endif - return NULL; -} - int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char *filename = "/"; @@ -97,7 +63,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } dev = (int)simple_strtoul (argv[2], &ep, 16); - dev_desc=get_dev(argv[1],dev); + dev_desc = get_dev(argv[1],dev); if (dev_desc == NULL) { printf ("\n** Block device %s %d not supported\n", argv[1], dev); @@ -196,7 +162,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } dev = (int)simple_strtoul (argv[2], &ep, 16); - dev_desc=get_dev(argv[1],dev); + dev_desc = get_dev(argv[1],dev); if (dev_desc==NULL) { printf ("\n** Block device %s %d not supported\n", argv[1], dev); return 1; diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index cc08743d5..b17bebbac 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -194,7 +194,7 @@ void scsi_init(void) block_dev_desc_t * scsi_get_dev(int dev) { - return((block_dev_desc_t *)&scsi_dev_desc[dev]); + return (dev < CFG_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; } diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 28c05aa20..904df7159 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -28,6 +28,7 @@ #include #include #include +#include #if (CONFIG_COMMANDS & CFG_CMD_USB) diff --git a/common/usb_storage.c b/common/usb_storage.c index 06ea99b2f..b4b791408 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -56,6 +56,7 @@ #if (CONFIG_COMMANDS & CFG_CMD_USB) +#include #include #ifdef CONFIG_USB_STORAGE @@ -174,7 +175,7 @@ void uhci_show_temp_int_td(void); block_dev_desc_t *usb_stor_get_dev(int index) { - return &usb_dev_desc[index]; + return (index < USB_MAX_STOR_DEV) ? &usb_dev_desc[index] : NULL; } diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c index f7020eec9..c57d0d5c3 100644 --- a/cpu/pxa/mmc.c +++ b/cpu/pxa/mmc.c @@ -37,7 +37,7 @@ static block_dev_desc_t mmc_dev; block_dev_desc_t * mmc_get_dev(int dev) { - return ((block_dev_desc_t *)&mmc_dev); + return (dev == 0) ? &mmc_dev : NULL; } /* diff --git a/disk/part.c b/disk/part.c index 2255e726c..f1026c5ef 100644 --- a/disk/part.c +++ b/disk/part.c @@ -24,6 +24,7 @@ #include #include #include +#include #undef PART_DEBUG @@ -33,6 +34,54 @@ #define PRINTF(fmt,args...) #endif +#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \ + (CONFIG_COMMANDS & CFG_CMD_SCSI) || \ + (CONFIG_COMMANDS & CFG_CMD_USB) || \ + defined(CONFIG_MMC) || \ + defined(CONFIG_SYSTEMACE) ) + +struct block_drvr { + char *name; + block_dev_desc_t* (*get_dev)(int dev); +}; + +static const struct block_drvr block_drvr[] = { +#if (CONFIG_COMMANDS & CFG_CMD_IDE) + { .name = "ide", .get_dev = ide_get_dev, }, +#endif +#if (CONFIG_COMMANDS & CFG_CMD_SCSI) + { .name = "scsi", .get_dev = scsi_get_dev, }, +#endif +#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE)) + { .name = "usb", .get_dev = usb_stor_get_dev, }, +#endif +#if defined(CONFIG_MMC) + { .name = "mmc", .get_dev = mmc_get_dev, }, +#endif +#if defined(CONFIG_SYSTEMACE) + { .name = "ace", .get_dev = systemace_get_dev, }, +#endif + { }, +}; + +block_dev_desc_t *get_dev(char* ifname, int dev) +{ + const struct block_drvr *drvr = block_drvr; + + while (drvr->name) { + if (strncmp(ifname, drvr->name, strlen(drvr->name)) == 0) + return drvr->get_dev(dev); + drvr++; + } + return NULL; +} +#else +block_dev_desc_t *get_dev(char* ifname, int dev) +{ + return NULL; +} +#endif + #if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \ (CONFIG_COMMANDS & CFG_CMD_SCSI) || \ (CONFIG_COMMANDS & CFG_CMD_USB) || \ diff --git a/include/ide.h b/include/ide.h index dfef32f26..e29ed36de 100644 --- a/include/ide.h +++ b/include/ide.h @@ -48,8 +48,8 @@ typedef ulong lbaint_t; * Function Prototypes */ -void ide_init (void); -ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); -ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); +void ide_init(void); +ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); +ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); #endif /* _IDE_H */ diff --git a/include/part.h b/include/part.h index 318aa3cb3..f89ebc6e7 100644 --- a/include/part.h +++ b/include/part.h @@ -22,6 +22,7 @@ */ #ifndef _PART_H #define _PART_H + #include typedef struct block_dev_desc { @@ -83,6 +84,14 @@ typedef struct disk_partition { uchar type[32]; /* string type description */ } disk_partition_t; +/* Misc _get_dev functions */ +block_dev_desc_t* get_dev(char* ifname, int dev); +block_dev_desc_t* ide_get_dev(int dev); +block_dev_desc_t* scsi_get_dev(int dev); +block_dev_desc_t* usb_stor_get_dev(int dev); +block_dev_desc_t* mmc_get_dev(int dev); +block_dev_desc_t* systemace_get_dev(int dev); + /* disk/part.c */ int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t *info); void print_part (block_dev_desc_t *dev_desc); From 99b0f0fd3fbf2572ae1a7723dd90cffc8e85130a Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:04:52 +0100 Subject: [PATCH 08/15] [PATCH 2_4] Use config.h, not xparameters.h, for xilinx targets Change the xilinx device drivers and board code to include config.h instead of xparameters.h directly. config.h always includes the correct xparameters file. This change reduces the posibility of including the wrong file when adding a new xilinx board port Signed-off-by: Grant Likely --- board/xilinx/ml300/Makefile | 2 +- board/xilinx/ml300/ml300.c | 2 +- board/xilinx/ml300/serial.c | 3 +-- board/xilinx/xilinx_enet/emac_adapter.c | 2 +- board/xilinx/xilinx_enet/xemac.h | 2 +- board/xilinx/xilinx_enet/xemac_g.c | 2 +- board/xilinx/xilinx_iic/iic_adapter.c | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/board/xilinx/ml300/Makefile b/board/xilinx/ml300/Makefile index 02c22fbef..05ad23524 100644 --- a/board/xilinx/ml300/Makefile +++ b/board/xilinx/ml300/Makefile @@ -28,7 +28,7 @@ $(shell mkdir -p $(obj)../xilinx_enet) $(shell mkdir -p $(obj)../xilinx_iic) endif -INCS := -I../ml300 -I../common -I../xilinx_enet -I../xilinx_iic +INCS := -I../common -I../xilinx_enet -I../xilinx_iic CFLAGS += $(INCS) HOST_CFLAGS += $(INCS) diff --git a/board/xilinx/ml300/ml300.c b/board/xilinx/ml300/ml300.c index dad562f1c..60f0bc24e 100644 --- a/board/xilinx/ml300/ml300.c +++ b/board/xilinx/ml300/ml300.c @@ -38,9 +38,9 @@ * */ +#include #include #include -#include "xparameters.h" #ifdef CFG_ENV_IS_IN_EEPROM extern void convert_env(void); diff --git a/board/xilinx/ml300/serial.c b/board/xilinx/ml300/serial.c index c204b88e4..9b03f89ef 100644 --- a/board/xilinx/ml300/serial.c +++ b/board/xilinx/ml300/serial.c @@ -40,8 +40,7 @@ #include #include #include -#include -#include "xparameters.h" +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/xilinx/xilinx_enet/emac_adapter.c b/board/xilinx/xilinx_enet/emac_adapter.c index b30e89766..f159cb6e3 100644 --- a/board/xilinx/xilinx_enet/emac_adapter.c +++ b/board/xilinx/xilinx_enet/emac_adapter.c @@ -37,9 +37,9 @@ * ******************************************************************************/ +#include #include #include -#include "xparameters.h" #include "xemac.h" #if defined(XPAR_EMAC_0_DEVICE_ID) diff --git a/board/xilinx/xilinx_enet/xemac.h b/board/xilinx/xilinx_enet/xemac.h index ed704bf29..584cb7ac5 100644 --- a/board/xilinx/xilinx_enet/xemac.h +++ b/board/xilinx/xilinx_enet/xemac.h @@ -257,9 +257,9 @@ /***************************** Include Files *********************************/ +#include #include "xbasic_types.h" #include "xstatus.h" -#include "xparameters.h" #include "xpacket_fifo_v1_00_b.h" /* Uses v1.00b of Packet Fifo */ #include "xdma_channel.h" diff --git a/board/xilinx/xilinx_enet/xemac_g.c b/board/xilinx/xilinx_enet/xemac_g.c index 9340f911f..d9851574f 100644 --- a/board/xilinx/xilinx_enet/xemac_g.c +++ b/board/xilinx/xilinx_enet/xemac_g.c @@ -43,7 +43,7 @@ * *******************************************************************/ -#include "xparameters.h" +#include #include "xemac.h" /* diff --git a/board/xilinx/xilinx_iic/iic_adapter.c b/board/xilinx/xilinx_iic/iic_adapter.c index 163fe1511..37dce0391 100644 --- a/board/xilinx/xilinx_iic/iic_adapter.c +++ b/board/xilinx/xilinx_iic/iic_adapter.c @@ -37,10 +37,10 @@ * ******************************************************************************/ +#include #include #include #include -#include "xparameters.h" #ifdef CFG_ENV_IS_IN_EEPROM #include From c95c4280d751ca078c2ff58228d2f2b44ccf0600 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:00 +0100 Subject: [PATCH 09/15] [PATCH 3_9] Move buffer print code from md command to common function Printing a buffer is a darn useful thing. Move the buffer print code into print_buffer() in lib_generic/ Signed-off-by: Grant Likely --- common/cmd_mem.c | 65 +++++++------------------------- include/common.h | 2 + lib_generic/display_options.c | 70 +++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 51 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index d0fae6b24..fcbb0236d 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -92,8 +92,9 @@ static ulong base_address = 0; int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong addr, length; - ulong i, nbytes, linebytes; - u_char *cp; +#if defined(CONFIG_HAS_DATAFLASH) + ulong nbytes, linebytes; +#endif int size; int rc = 0; @@ -128,6 +129,7 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) length = simple_strtoul(argv[2], NULL, 16); } +#if defined(CONFIG_HAS_DATAFLASH) /* Print the lines. * * We buffer all read data, so we can make sure data is read only @@ -136,64 +138,25 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) nbytes = length * size; do { char linebuf[DISP_LINE_LEN]; - uint *uip = (uint *)linebuf; - ushort *usp = (ushort *)linebuf; - u_char *ucp = (u_char *)linebuf; -#ifdef CONFIG_HAS_DATAFLASH - int rc; -#endif - printf("%08lx:", addr); + void* p; linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; -#ifdef CONFIG_HAS_DATAFLASH - if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){ - /* if outside dataflash */ - /*if (rc != 1) { - dataflash_perror (rc); - return (1); - }*/ - for (i=0; i 0x7e)) - putc ('.'); - else - printf("%c", *cp); - cp++; - } - putc ('\n'); nbytes -= linebytes; + addr += linebytes; if (ctrlc()) { rc = 1; break; } } while (nbytes > 0); +#else + /* Print the lines. */ + print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size); + addr += size*length; +#endif dp_last_addr = addr; dp_last_length = length; diff --git a/include/common.h b/include/common.h index 982d6a863..5b2e71c98 100644 --- a/include/common.h +++ b/include/common.h @@ -187,6 +187,8 @@ void hang (void) __attribute__ ((noreturn)); long int initdram (int); int display_options (void); void print_size (ulong, const char *); +int print_buffer (ulong addr, void* data, uint width, uint count, + uint linelen); /* common/main.c */ void main_loop (void); diff --git a/lib_generic/display_options.c b/lib_generic/display_options.c index 512e8980d..5ddd94fd5 100644 --- a/lib_generic/display_options.c +++ b/lib_generic/display_options.c @@ -21,7 +21,10 @@ * MA 02111-1307 USA */ +#include #include +#include +#include int display_options (void) { @@ -65,3 +68,70 @@ void print_size (ulong size, const char *s) } printf (" %cB%s", c, s); } + +/* + * Print data buffer in hex and ascii form to the terminal. + * + * data reads are buffered so that each memory address is only read once. + * Useful when displaying the contents of volatile registers. + * + * parameters: + * addr: Starting address to display at start of line + * data: pointer to data buffer + * width: data value width. May be 1, 2, or 4. + * count: number of values to display + * linelen: Number of values to print per line; specify 0 for default length + */ +#define MAX_LINE_LENGTH_BYTES (64) +#define DEFAULT_LINE_LENGTH_BYTES (16) +int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen) +{ + uint8_t linebuf[MAX_LINE_LENGTH_BYTES]; + uint32_t *uip = (void*)linebuf; + uint16_t *usp = (void*)linebuf; + uint8_t *ucp = (void*)linebuf; + int i; + + if (linelen*width > MAX_LINE_LENGTH_BYTES) + linelen = MAX_LINE_LENGTH_BYTES / width; + if (linelen < 1) + linelen = DEFAULT_LINE_LENGTH_BYTES / width; + + while (count) { + printf("%08lx:", addr); + + /* check for overflow condition */ + if (count < linelen) + linelen = count; + + /* Copy from memory into linebuf and print hex values */ + for (i = 0; i < linelen; i++) { + if (width == 4) { + uip[i] = *(volatile uint32_t *)data; + printf(" %08x", uip[i]); + } else if (width == 2) { + usp[i] = *(volatile uint16_t *)data; + printf(" %04x", usp[i]); + } else { + ucp[i] = *(volatile uint8_t *)data; + printf(" %02x", ucp[i]); + } + data += width; + } + + /* Print data in ASCII characters */ + puts(" "); + for (i = 0; i < linelen * width; i++) + putc(isprint(ucp[i]) && (ucp[i] < 0x80) ? ucp[i] : '.'); + putc ('\n'); + + /* update references */ + addr += linelen * width; + count -= linelen; + + if (ctrlc()) + return -1; + } + + return 0; +} From 80ba981d940471fe7e539e64fa3d2bd80002beda Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:07 +0100 Subject: [PATCH 10/15] [PATCH 4_4] Remove local implementation of isprint() in ft_build.c isprint is already defined in ctype.c Signed-off-by: Grant Likely --- common/ft_build.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/ft_build.c b/common/ft_build.c index 980e40f55..5a0575e89 100644 --- a/common/ft_build.c +++ b/common/ft_build.c @@ -29,6 +29,7 @@ #include #include +#include #undef DEBUG @@ -180,11 +181,6 @@ void ft_finalize_tree(struct ft_cxt *cxt) { bph->dt_strings_size = cxt->p_end - cxt->p; } -static inline int isprint(int c) -{ - return c >= 0x20 && c <= 0x7e; -} - static int is_printable_string(const void *data, int len) { const char *s = data; From 984618f3e7794c783ec8d1511e74c6ee2d69bfe4 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:16 +0100 Subject: [PATCH 11/15] [PATCH 5_9] Whitespace fixup on common_cmd_ace.c (using Lindent) This patch is in preparation of additional changes to the sysace driver. May as well take this opportunity to fixup the inconsistent whitespace since this file is about to undergo major changes anyway. There are zero functional changes in this patch. It only cleans up the the whitespace. Signed-off-by: Grant Likely --- common/cmd_ace.c | 267 +++++++++++++++++++++++------------------------ 1 file changed, 132 insertions(+), 135 deletions(-) diff --git a/common/cmd_ace.c b/common/cmd_ace.c index b6d61057f..8dd98d03f 100644 --- a/common/cmd_ace.c +++ b/common/cmd_ace.c @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id:$" /* * The Xilinx SystemACE chip support is activated by defining @@ -34,16 +33,16 @@ * * According to Xilinx technical support, before accessing the * SystemACE CF you need to set the following control bits: - * FORCECFGMODE : 1 - * CFGMODE : 0 - * CFGSTART : 0 + * FORCECFGMODE : 1 + * CFGMODE : 0 + * CFGSTART : 0 */ -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include #ifdef CONFIG_SYSTEMACE @@ -57,18 +56,18 @@ static unsigned ace_readw(unsigned offset) { #if (CFG_SYSTEMACE_WIDTH == 8) - u16 temp; + u16 temp; #if !defined(__BIG_ENDIAN) - temp =((u16)readb(CFG_SYSTEMACE_BASE+offset) << 8); - temp |= (u16)readb(CFG_SYSTEMACE_BASE+offset+1); + temp = ((u16) readb(CFG_SYSTEMACE_BASE + offset) << 8); + temp |= (u16) readb(CFG_SYSTEMACE_BASE + offset + 1); #else - temp = (u16)readb(CFG_SYSTEMACE_BASE+offset); - temp |=((u16)readb(CFG_SYSTEMACE_BASE+offset+1) << 8); + temp = (u16) readb(CFG_SYSTEMACE_BASE + offset); + temp |= ((u16) readb(CFG_SYSTEMACE_BASE + offset + 1) << 8); #endif - return temp; + return temp; #else - return readw(CFG_SYSTEMACE_BASE+offset); + return readw(CFG_SYSTEMACE_BASE + offset); #endif } @@ -76,73 +75,72 @@ static void ace_writew(unsigned val, unsigned offset) { #if (CFG_SYSTEMACE_WIDTH == 8) #if !defined(__BIG_ENDIAN) - writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset); - writeb((u8)val, CFG_SYSTEMACE_BASE+offset+1); + writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset); + writeb((u8) val, CFG_SYSTEMACE_BASE + offset + 1); #else - writeb((u8)val, CFG_SYSTEMACE_BASE+offset); - writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset+1); + writeb((u8) val, CFG_SYSTEMACE_BASE + offset); + writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset + 1); #endif #else - writew(val, CFG_SYSTEMACE_BASE+offset); + writew(val, CFG_SYSTEMACE_BASE + offset); #endif } /* */ -static unsigned long systemace_read(int dev, - unsigned long start, - unsigned long blkcnt, - unsigned long *buffer); +static unsigned long systemace_read(int dev, unsigned long start, + unsigned long blkcnt, + unsigned long *buffer); -static block_dev_desc_t systemace_dev = {0}; +static block_dev_desc_t systemace_dev = { 0 }; static int get_cf_lock(void) { - int retry = 10; + int retry = 10; /* CONTROLREG = LOCKREG */ - unsigned val=ace_readw(0x18); - val|=0x0002; - ace_writew((val&0xffff), 0x18); + unsigned val = ace_readw(0x18); + val |= 0x0002; + ace_writew((val & 0xffff), 0x18); /* Wait for MPULOCK in STATUSREG[15:0] */ - while (! (ace_readw(0x04) & 0x0002)) { + while (!(ace_readw(0x04) & 0x0002)) { - if (retry < 0) - return -1; + if (retry < 0) + return -1; - udelay(100000); - retry -= 1; - } + udelay(100000); + retry -= 1; + } - return 0; + return 0; } static void release_cf_lock(void) { - unsigned val=ace_readw(0x18); - val&=~(0x0002); - ace_writew((val&0xffff), 0x18); + unsigned val = ace_readw(0x18); + val &= ~(0x0002); + ace_writew((val & 0xffff), 0x18); } -block_dev_desc_t * systemace_get_dev(int dev) +block_dev_desc_t *systemace_get_dev(int dev) { /* The first time through this, the systemace_dev object is not yet initialized. In that case, fill it in. */ - if (systemace_dev.blksz == 0) { - systemace_dev.if_type = IF_TYPE_UNKNOWN; - systemace_dev.dev = 0; - systemace_dev.part_type = PART_TYPE_UNKNOWN; - systemace_dev.type = DEV_TYPE_HARDDISK; - systemace_dev.blksz = 512; - systemace_dev.removable = 1; - systemace_dev.block_read = systemace_read; + if (systemace_dev.blksz == 0) { + systemace_dev.if_type = IF_TYPE_UNKNOWN; + systemace_dev.dev = 0; + systemace_dev.part_type = PART_TYPE_UNKNOWN; + systemace_dev.type = DEV_TYPE_HARDDISK; + systemace_dev.blksz = 512; + systemace_dev.removable = 1; + systemace_dev.block_read = systemace_read; - init_part(&systemace_dev); + init_part(&systemace_dev); - } + } - return &systemace_dev; + return &systemace_dev; } /* @@ -150,118 +148,117 @@ block_dev_desc_t * systemace_get_dev(int dev) * the dev_desc) to read blocks of data. The return value is the * number of blocks read. A zero return indicates an error. */ -static unsigned long systemace_read(int dev, - unsigned long start, - unsigned long blkcnt, - unsigned long *buffer) +static unsigned long systemace_read(int dev, unsigned long start, + unsigned long blkcnt, unsigned long *buffer) { - int retry; - unsigned blk_countdown; - unsigned char*dp = (unsigned char*)buffer; - unsigned val; + int retry; + unsigned blk_countdown; + unsigned char *dp = (unsigned char *)buffer; + unsigned val; - if (get_cf_lock() < 0) { - unsigned status = ace_readw(0x04); + if (get_cf_lock() < 0) { + unsigned status = ace_readw(0x04); - /* If CFDETECT is false, card is missing. */ - if (! (status&0x0010)) { - printf("** CompactFlash card not present. **\n"); - return 0; - } - - printf("**** ACE locked away from me (STATUSREG=%04x)\n", status); - return 0; - } + /* If CFDETECT is false, card is missing. */ + if (!(status & 0x0010)) { + printf("** CompactFlash card not present. **\n"); + return 0; + } + printf("**** ACE locked away from me (STATUSREG=%04x)\n", + status); + return 0; + } #ifdef DEBUG_SYSTEMACE - printf("... systemace read %lu sectors at %lu\n", blkcnt, start); + printf("... systemace read %lu sectors at %lu\n", blkcnt, start); #endif - retry = 2000; - for (;;) { - val = ace_readw(0x04); + retry = 2000; + for (;;) { + val = ace_readw(0x04); - /* If CFDETECT is false, card is missing. */ - if (! (val & 0x0010)) { - printf("**** ACE CompactFlash not found.\n"); - release_cf_lock(); - return 0; - } + /* If CFDETECT is false, card is missing. */ + if (!(val & 0x0010)) { + printf("**** ACE CompactFlash not found.\n"); + release_cf_lock(); + return 0; + } - /* If RDYFORCMD, then we are ready to go. */ - if (val & 0x0100) - break; + /* If RDYFORCMD, then we are ready to go. */ + if (val & 0x0100) + break; - if (retry < 0) { - printf("**** SystemACE not ready.\n"); - release_cf_lock(); - return 0; - } + if (retry < 0) { + printf("**** SystemACE not ready.\n"); + release_cf_lock(); + return 0; + } - udelay(1000); - retry -= 1; - } + udelay(1000); + retry -= 1; + } /* The SystemACE can only transfer 256 sectors at a time, so limit the current chunk of sectors. The blk_countdown variable is the number of sectors left to transfer. */ - blk_countdown = blkcnt; - while (blk_countdown > 0) { - unsigned trans = blk_countdown; + blk_countdown = blkcnt; + while (blk_countdown > 0) { + unsigned trans = blk_countdown; - if (trans > 256) trans = 256; + if (trans > 256) + trans = 256; #ifdef DEBUG_SYSTEMACE - printf("... transfer %lu sector in a chunk\n", trans); + printf("... transfer %lu sector in a chunk\n", trans); #endif - /* Write LBA block address */ - ace_writew((start>> 0) & 0xffff, 0x10); - ace_writew((start>>16) & 0x00ff, 0x12); + /* Write LBA block address */ + ace_writew((start >> 0) & 0xffff, 0x10); + ace_writew((start >> 16) & 0x00ff, 0x12); - /* NOTE: in the Write Sector count below, a count of 0 - causes a transfer of 256, so &0xff gives the right - value for whatever transfer count we want. */ + /* NOTE: in the Write Sector count below, a count of 0 + causes a transfer of 256, so &0xff gives the right + value for whatever transfer count we want. */ - /* Write sector count | ReadMemCardData. */ - ace_writew((trans&0xff) | 0x0300, 0x14); + /* Write sector count | ReadMemCardData. */ + ace_writew((trans & 0xff) | 0x0300, 0x14); - /* Reset the configruation controller */ - val = ace_readw(0x18); - val|=0x0080; - ace_writew(val, 0x18); + /* Reset the configruation controller */ + val = ace_readw(0x18); + val |= 0x0080; + ace_writew(val, 0x18); - retry = trans * 16; - while (retry > 0) { - int idx; + retry = trans * 16; + while (retry > 0) { + int idx; - /* Wait for buffer to become ready. */ - while (! (ace_readw(0x04) & 0x0020)) { - udelay(100); - } + /* Wait for buffer to become ready. */ + while (!(ace_readw(0x04) & 0x0020)) { + udelay(100); + } - /* Read 16 words of 2bytes from the sector buffer. */ - for (idx = 0 ; idx < 16 ; idx += 1) { - unsigned short val = ace_readw(0x40); - *dp++ = val & 0xff; - *dp++ = (val>>8) & 0xff; - } + /* Read 16 words of 2bytes from the sector buffer. */ + for (idx = 0; idx < 16; idx += 1) { + unsigned short val = ace_readw(0x40); + *dp++ = val & 0xff; + *dp++ = (val >> 8) & 0xff; + } - retry -= 1; - } + retry -= 1; + } - /* Clear the configruation controller reset */ - val = ace_readw(0x18); - val&=~0x0080; - ace_writew(val, 0x18); + /* Clear the configruation controller reset */ + val = ace_readw(0x18); + val &= ~0x0080; + ace_writew(val, 0x18); - /* Count the blocks we transfer this time. */ - start += trans; - blk_countdown -= trans; - } + /* Count the blocks we transfer this time. */ + start += trans; + blk_countdown -= trans; + } - release_cf_lock(); + release_cf_lock(); - return blkcnt; + return blkcnt; } -#endif /* CONFIG_SYSTEMACE */ +#endif /* CONFIG_SYSTEMACE */ From 3a8ce9af6fcb5744a7851b4440c07688acc40844 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:23 +0100 Subject: [PATCH 12/15] [PATCH 6_9] Move common_cmd_ace.c to drivers_systemace.c The code in this file is not a command; it is a device driver. Put it in the correct place. There are zero functional changes in this patch, it only moves the file. Signed-off-by: Grant Likely --- common/Makefile | 3 +-- drivers/Makefile | 2 +- common/cmd_ace.c => drivers/systemace.c | 0 3 files changed, 2 insertions(+), 3 deletions(-) rename common/cmd_ace.c => drivers/systemace.c (100%) diff --git a/common/Makefile b/common/Makefile index 0106088e2..6f81c4abc 100644 --- a/common/Makefile +++ b/common/Makefile @@ -27,8 +27,7 @@ LIB = $(obj)libcommon.a AOBJS = -COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o \ - cmd_ace.o cmd_autoscript.o \ +COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \ cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o \ cmd_cache.o cmd_console.o \ cmd_date.o cmd_dcr.o cmd_diag.o cmd_display.o cmd_doc.o cmd_dtt.o \ diff --git a/drivers/Makefile b/drivers/Makefile index 5a369df2c..fffc22a5e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -44,7 +44,7 @@ COBJS = 3c589.o 5701rls.o ali512x.o atmel_usart.o \ serial.o serial_max3100.o \ serial_pl010.o serial_pl011.o serial_xuartlite.o \ sl811_usb.o sm501.o smc91111.o smiLynxEM.o \ - status_led.o sym53c8xx.o ahci.o \ + status_led.o sym53c8xx.o systemace.o ahci.o \ ti_pci1410a.o tigon3.o tsec.o \ usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o \ videomodes.o w83c553f.o \ diff --git a/common/cmd_ace.c b/drivers/systemace.c similarity index 100% rename from common/cmd_ace.c rename to drivers/systemace.c From f4852ebe6ca946a509667eb68be42026f837be76 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:31 +0100 Subject: [PATCH 13/15] [PATCH 7_9] Replace ace_readw_ace_writeb functions with macros Register read/write does not need to be wrapped in a full function. The patch replaces them with macros. Signed-off-by: Grant Likely --- drivers/systemace.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/drivers/systemace.c b/drivers/systemace.c index 8dd98d03f..3f329f970 100644 --- a/drivers/systemace.c +++ b/drivers/systemace.c @@ -53,38 +53,22 @@ * to be the base address for the chip, usually in the local * peripheral bus. */ -static unsigned ace_readw(unsigned offset) -{ -#if (CFG_SYSTEMACE_WIDTH == 8) - u16 temp; - -#if !defined(__BIG_ENDIAN) - temp = ((u16) readb(CFG_SYSTEMACE_BASE + offset) << 8); - temp |= (u16) readb(CFG_SYSTEMACE_BASE + offset + 1); -#else - temp = (u16) readb(CFG_SYSTEMACE_BASE + offset); - temp |= ((u16) readb(CFG_SYSTEMACE_BASE + offset + 1) << 8); -#endif - return temp; -#else - return readw(CFG_SYSTEMACE_BASE + offset); -#endif -} - -static void ace_writew(unsigned val, unsigned offset) -{ #if (CFG_SYSTEMACE_WIDTH == 8) #if !defined(__BIG_ENDIAN) - writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset); - writeb((u8) val, CFG_SYSTEMACE_BASE + offset + 1); +#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)<<8) | \ + (readb(CFG_SYSTEMACE_BASE+off+1))) +#define ace_write(val, off) {writeb(val>>8, CFG_SYSTEMACE_BASE+off); \ + writeb(val, CFG_SYSTEMACE_BASE+off+1);} #else - writeb((u8) val, CFG_SYSTEMACE_BASE + offset); - writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset + 1); +#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)) | \ + (readb(CFG_SYSTEMACE_BASE+off+1)<<8)) +#define ace_write(val, off) {writeb(val, CFG_SYSTEMACE_BASE+off); \ + writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);} #endif #else - writew(val, CFG_SYSTEMACE_BASE + offset); +#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off)) +#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off)) #endif -} /* */ From 53758fa20e935cc87eeb0519ed365df753a6f289 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:38 +0100 Subject: [PATCH 14/15] [PATCH 8_9] Add block_write hook to block_dev_desc_t Preparation for future patches which support block device writing Signed-off-by: Grant Likely --- include/part.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/part.h b/include/part.h index f89ebc6e7..4f5a57079 100644 --- a/include/part.h +++ b/include/part.h @@ -45,6 +45,10 @@ typedef struct block_dev_desc { unsigned long start, lbaint_t blkcnt, unsigned long *buffer); + unsigned long (*block_write)(int dev, + unsigned long start, + lbaint_t blkcnt, + const void *buffer); }block_dev_desc_t; /* Interface types: */ From eb867a76238fb38e952c37871b16d0d7fd61c95f Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 20 Feb 2007 09:05:45 +0100 Subject: [PATCH 15/15] [PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers Block device read/write is anonymous data; there is no need to use a typed pointer. void * is fine. Also add a hook for block_read functions Signed-off-by: Grant Likely --- common/cmd_ide.c | 8 ++++---- common/cmd_scsi.c | 4 ++-- common/usb_storage.c | 4 ++-- cpu/pxa/mmc.c | 2 +- drivers/systemace.c | 7 +++---- include/ide.h | 4 ++-- include/part.h | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/common/cmd_ide.c b/common/cmd_ide.c index ebc080c72..2e185cc44 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -188,7 +188,7 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len #ifdef CONFIG_ATAPI static void atapi_inquiry(block_dev_desc_t *dev_desc); -ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); +ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer); #endif @@ -1233,7 +1233,7 @@ static void ide_ident (block_dev_desc_t *dev_desc) /* ------------------------------------------------------------------------- */ -ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer) +ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer) { ulong n = 0; unsigned char c; @@ -1353,7 +1353,7 @@ IDE_READ_E: /* ------------------------------------------------------------------------- */ -ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer) +ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer) { ulong n = 0; unsigned char c; @@ -2015,7 +2015,7 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc) #define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */ #define ATAPI_READ_MAX_BLOCK ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE /* max blocks */ -ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer) +ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer) { ulong n = 0; unsigned char ccb[12]; /* Command descriptor block */ diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index b17bebbac..da36ed9e1 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -74,7 +74,7 @@ void scsi_setup_inquiry(ccb * pccb); void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); -ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer); +ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer); /********************************************************************************* @@ -424,7 +424,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #define SCSI_MAX_READ_BLK 0xFFFF /* almost the maximum amount of the scsi_ext command.. */ -ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer) +ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer) { ulong start,blks, buf_addr; unsigned short smallblks; diff --git a/common/usb_storage.c b/common/usb_storage.c index b4b791408..196ceb735 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -169,7 +169,7 @@ static struct us_data usb_stor[USB_MAX_STOR_DEV]; int usb_stor_get_info(struct usb_device *dev, struct us_data *us, block_dev_desc_t *dev_desc); int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,struct us_data *ss); -unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer); +unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer); struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); @@ -941,7 +941,7 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor, #define USB_MAX_READ_BLK 20 -unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer) +unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer) { unsigned long start,blks, buf_addr; unsigned short smallblks; diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c index c57d0d5c3..0fbaa162f 100644 --- a/cpu/pxa/mmc.c +++ b/cpu/pxa/mmc.c @@ -363,7 +363,7 @@ mmc_write(uchar *src, ulong dst, int size) ulong /****************************************************/ -mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst) +mmc_bread(int dev_num, ulong blknr, ulong blkcnt, void *dst) /****************************************************/ { int mmc_block_size = MMC_BLOCK_SIZE; diff --git a/drivers/systemace.c b/drivers/systemace.c index 3f329f970..9502623a7 100644 --- a/drivers/systemace.c +++ b/drivers/systemace.c @@ -73,8 +73,7 @@ /* */ static unsigned long systemace_read(int dev, unsigned long start, - unsigned long blkcnt, - unsigned long *buffer); + unsigned long blkcnt, void *buffer); static block_dev_desc_t systemace_dev = { 0 }; @@ -133,11 +132,11 @@ block_dev_desc_t *systemace_get_dev(int dev) * number of blocks read. A zero return indicates an error. */ static unsigned long systemace_read(int dev, unsigned long start, - unsigned long blkcnt, unsigned long *buffer) + unsigned long blkcnt, void *buffer) { int retry; unsigned blk_countdown; - unsigned char *dp = (unsigned char *)buffer; + unsigned char *dp = buffer; unsigned val; if (get_cf_lock() < 0) { diff --git a/include/ide.h b/include/ide.h index e29ed36de..6976a6c31 100644 --- a/include/ide.h +++ b/include/ide.h @@ -49,7 +49,7 @@ typedef ulong lbaint_t; */ void ide_init(void); -ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); -ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer); +ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer); +ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, void *buffer); #endif /* _IDE_H */ diff --git a/include/part.h b/include/part.h index 4f5a57079..29c03205f 100644 --- a/include/part.h +++ b/include/part.h @@ -44,7 +44,7 @@ typedef struct block_dev_desc { unsigned long (*block_read)(int dev, unsigned long start, lbaint_t blkcnt, - unsigned long *buffer); + void *buffer); unsigned long (*block_write)(int dev, unsigned long start, lbaint_t blkcnt,