diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..67fed082c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.orig +*.a +*.o +*.depend +System.map +/u-boot +/u-boot.map +/u-boot.bin +/u-boot.srec +/LOG +/errlog +/reloc_off + diff --git a/CHANGELOG b/CHANGELOG index 549c4f919c..015a4ac01b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,1247 @@ +commit a5f601fd1b1278deae5aa9fc27a232b0d1c1c788 +Author: Wolfgang Denk +Date: Mon Nov 26 19:18:21 2007 +0100 + + Cleanup coding style; update CHANGELOG + + Signed-off-by: Wolfgang Denk + +commit 3deca9d44767efd1b83f4b701f0dbf21a7595f7b +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Nov 25 22:39:25 2007 +0100 + + MAKEALL: add missing 512x boards in ppc + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit a340c325e668ca7386c2276387681720be9c3757 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Nov 25 18:45:47 2007 +0100 + + Makefile : fix tags ctags etags with new drivers organization + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 87ddedd6ad804427ce125ceaa076d7a4f74e9d5d +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Nov 25 18:45:47 2007 +0100 + + Makefile : fix tags ctags etags with new drivers organization + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 59829cc189378c142c13d2aa8d9a897d8bef3961 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 21:26:56 2007 +0100 + + drivers/mtd : move mtd drivers to drivers/mtd + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 318c0b90431f2648552e5ade78833f42652ce859 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 21:17:55 2007 +0100 + + drivers/misc : move misc drivers to drivers/misc + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 33daf5b7858807cb4ce4158c2c56524671c14c08 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 21:13:59 2007 +0100 + + drivers/block : move block drivers to drivers/block + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 0c698dcaa70275eb8814f665b545547cee013892 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 20:59:50 2007 +0100 + + drivers/rtc : move rtc drivers to drivers/rtc + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit f868cc5a50757d94f36c312395481cb0f187d9e6 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 20:14:44 2007 +0100 + + drivers/hwmon : move hardware monitor drviers to drivers/hwmon + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 16b195c82a18cbfd164800f17a1ef9db2e48331a +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 19:46:45 2007 +0100 + + drivers/input : move input drivers to drivers/input + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit e4558666293364fc3af1c1d9381ca933fa0f1275 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 19:40:11 2007 +0100 + + drivers/usb : move usb drivers to drivers/usb + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 1378df792a7ff3abd1bf54a63f5475784f5b083c +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 24 19:33:38 2007 +0100 + + drivers/serial : move serial drivers to drivers/serial + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 2439e4bfa111babf4bc07ba20efbf3e36036813e +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Wed Nov 21 21:19:24 2007 +0100 + + drivers/net : move net drivers to drivers/net + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 352d259130b349fe9593b8dada641bd78a9659e5 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Tue Nov 20 20:41:48 2007 +0100 + + drivers/video : move video drivers to drivers/video + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 73646217186aa17afc8e305c5f06f06dd335eaad +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Tue Nov 20 20:33:09 2007 +0100 + + drivers/pcmcia : move pcmcia drivers to drivers/pcmcia + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 93a686ee9c5ddc6fa368c32cfbfde6f6724599fc +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Tue Nov 20 20:28:09 2007 +0100 + + drivers/pci : move pci drivers to drivers/pci + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 9162352817579840d7802da6d85872b3ca003c97 +Author: Gerald Van Baren +Date: Thu Nov 22 17:23:23 2007 -0500 + + Fix fdt printing for updated libfdt + + Also improve printing (adopt dtc v1 "c style" hex format), whitespace cleanup. + + Signed-off-by: Gerald Van Baren + +commit 9eb77cea1fa12d5969eb26a1d1d81da381bd6b1c +Author: Kumar Gala +Date: Wed Nov 21 13:30:15 2007 -0600 + + Add additional fdt fixup helper functions + + Added the following fdt fixup helpers: + * do_fixup_by_prop{_u32} - Find matching nodes by property name/value + * do_fixup_by_compat{_u32} - Find matching nodes by compat + + The _u32 variants work the same only the property they are setting + is know to be a 32-bit integer instead of a byte buffer. + + Signed-off-by: Kumar Gala + +commit ab544633abdd14f4dd5d92e500b73eb59ef57e67 +Author: Kumar Gala +Date: Wed Nov 21 11:11:03 2007 -0600 + + Add fdt_fixup_ethernet helper to set mac addresses + + Added a fixup helper that uses aliases to set mac addresses + in the device tree based on the bd_t + + Signed-off-by: Kumar Gala + +commit dbaf07ce620aab249e3502b20a986234a6af1d3a +Author: Kumar Gala +Date: Wed Nov 21 14:07:46 2007 -0600 + + Fix warnings from import of libfdt + + cmd_fdt.c: In function fdt_print: + cmd_fdt.c:586: warning: assignment discards qualifiers from pointer target type + cmd_fdt.c:613: warning: assignment discards qualifiers from pointer target type + cmd_fdt.c:635: warning: assignment discards qualifiers from pointer target type + cmd_fdt.c:636: warning: assignment discards qualifiers from pointer target type + + Signed-off-by: Kumar Gala + +commit 8d04f02f6224e6983f4812ea4da704950ec8539c +Author: Kumar Gala +Date: Wed Oct 24 11:04:22 2007 -0500 + + Update libfdt from device tree compiler (dtc) + + Update libfdt to commit 8eaf5e358366017aa2e846c5038d1aa19958314e from + the device tree compiler (dtc) project. + + Signed-off-by: Kumar Gala + +commit e93becf80d732b64aef81b23e8b6ece02c40533d +Author: Kumar Gala +Date: Sat Nov 3 19:46:28 2007 -0500 + + Move do_fixup* for libfdt into common code + + Moved the generic fixup handling code out of cpu/mpc5xxx and cpu/mpc8260 + into common/fdt_support.c and renamed: + + do_fixup() -> do_fixup_by_path() + do_fixup_u32() -> do_fixup_by_path_u32() + + Signed-off-by: Kumar Gala + +commit f738b4a75998f42a7408defadc9baac7a31c92db +Author: Kumar Gala +Date: Thu Oct 25 16:15:07 2007 -0500 + + Make no options to fdt print default to '/' + + Signed-off-by: Kumar Gala + +commit a3c2933e02503fe36ade2c1b65af46f2b7a168e7 +Author: Kumar Gala +Date: Wed Oct 24 10:21:57 2007 -0500 + + Removed some nonused fdt functions and moved fdt_find_and_setprop out of libfdt + + Removed: + fdt_node_is_compatible + fdt_find_node_by_type + fdt_find_compatible_node + + To ease merge of newer libfdt as we aren't using them anywhere at this time. + + Also moved fdt_find_and_setprop out of libfdt into fdt_support.c for the same + reason. + + Signed-off-by: Kumar Gala + +commit 98e2867cc85409b919f862e6c16026461ec955df +Author: Grant Likely +Date: Wed Nov 21 09:19:37 2007 -0700 + + [BUILD] Remove libraries when updating autoconf.mk + + Fix library problems caused by conditional compilation. Using + autoconf.mk to decide which files to compile has caused a problem when + changing configuration from one board to another without clearing out + the library (*.a) files. + + It used to be that the linker was always passed the same list of .o + files when building the .a files. However, that is not longer true + with conditional compilation. Now, a different board config will have + a different file list passed to the linker. The problem occurs when + a library has already been built and the board config is changed. + + Since the linker will update instead of replace a preexisting library, + then if the file list changes to remove some object files the old + objects will still exist in the library. + + The solution is to remove all old library files when autoconf.mk is + made. + + Signed-off-by: Grant Likely + +commit ed1353d74b9ce8a7fcd660570b848a184d614b5f +Author: Kumar Gala +Date: Wed Nov 21 08:49:50 2007 -0600 + + [BUILD] conditionally compile libfdt/*.c in libfdt/Makefile + + Modify libfdt/Makefile to conditionally compile the *.c files based + on the board config. + + Signed-off-by: Kumar Gala + +commit 4a43719a7738712811d822ca8125427b27a55cdc +Author: Grant Likely +Date: Mon Sep 24 09:05:31 2007 -0600 + + [BUILD] conditionally compile common/cmd_*.c in common/Makefile + + Modify common/Makefile to conditionally compile the cmd_*.c files based + on the board config. + + Signed-off-by: Grant Likely + +commit 2f155f6c0a1f5e9a306a3f1f4fbe067db7ced3b1 +Author: Grant Likely +Date: Mon Sep 24 09:05:31 2007 -0600 + + [BUILD] Generate include/autoconf.mk from board config files + + Use cpp and sed to postprocess config.h and import the defined values + into include/autoconf.mk. autoconf.mk is then included by config.mk to + give 'make' access to the board configuration. + + Doing this enables conditional compilation at the Makefile level instead + of by wrapping every .c file with #ifdef/#endif wrappers. + + Signed-off-by: Grant Likely + +commit 080c646dbf474a109c3f85718fb01ce042a38c45 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Tue Nov 20 20:14:18 2007 +0100 + + drivers/i2c : move i2c drivers to drivers/i2c + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 9a337ddc154a10a26f117fd147b009abcdeba75a +Author: Wolfgang Denk +Date: Mon Nov 19 22:20:24 2007 +0100 + + Prepare for 1.3.0 release. + + Signed-off-by: Wolfgang Denk + +commit f30ad49b16bf998b03c1a5228b6c86369d61c258 +Author: Haiying Wang +Date: Mon Nov 19 10:02:13 2007 -0500 + + Move CONFIG_QE out of CONFIG_PCI wrap for MPC8568MDS + + CONFIG_QE shouldn't be in the wrap of CONFIG_PCI, fix it. + + Signed-off-by: Haiying Wang + +commit f8c320609366176b31104d9bf5e295232e1c7f1d +Author: Shinya Kuribayashi +Date: Mon Nov 19 11:14:16 2007 +0900 + + [MIPS] board/gth2/lowlevel_init.S: Fix a build warning + + lowlevel_init.S: Assembler messages: + lowlevel_init.S:413: Warning: Pretending global symbol used as branch target is local. + + Looking at codes, the `memtest' and `clearmem' are intentional mixed + use of `global symbols' and `label' for debugging purpose. To make it + build, just disable global-symbols-use for now. As a result `memtest' + still remains as unused, but leave it be... + + Signed-off-by: Shinya Kuribayashi + +commit e8da58f2bc092891e8cc92b927ed5c4bd0cb0cab +Author: Wolfgang Denk +Date: Mon Nov 19 12:59:14 2007 +0100 + + Fix build problems with mp2usb board + + Signed-off-by: Wolfgang Denk + +commit 6bf4c686afca1e86e1c384d59218f914605713bf +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Nov 18 18:36:11 2007 +0100 + + s3c24x0: Fix usb_ohci.c missing in Makefile + and usb_ohci.c warning differ in signedness + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 6073f61e078da5ddb521b56256bcc36508589883 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Nov 18 12:55:02 2007 +0100 + + pb1x00 board: Fix u16 status declaration when PCMCIA is defined + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 8412d814ce8bf5570a2b747f1e7fd321097fe987 +Author: Wolfgang Denk +Date: Sun Nov 18 17:11:09 2007 +0100 + + Fix compiler warnings for ARM systems. + + Signed-off-by: Wolfgang Denk + +commit 409ecdc0bb47dd28b0af6c25ffd658d22cc36b37 +Author: Wolfgang Denk +Date: Sun Nov 18 16:36:27 2007 +0100 + + Fix compiler warnings for PPC systems. Update CHANGELOG. + + Signed-off-by: Wolfgang Denk + +commit 079c2c4fa71c0d1ebef394508df9088df8a308d3 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sat Nov 17 11:31:10 2007 +0100 + + Fix warning differ in signedness in net/net.c and net/nfs.c + +commit 7e14fc65368cbd2861b1207453da55a4fc7b3f81 +Author: Shinya Kuribayashi +Date: Sat Nov 17 20:42:45 2007 +0900 + + gth2.c: Fix a warning on gth2 build. + + gth2.c: In function 'misc_init_r': + gth2.c:434: warning: pointer targets in passing argument 2 of 'setenv' differ in signedness + + Signed-off-by: Shinya Kuribayashi + +commit 2309c130aa4c84b91bd874a41269c923eb61b555 +Author: Stefan Roese +Date: Sat Nov 17 07:58:25 2007 +0100 + + Fix warning differ in signedness in common/cmd_scsi.c + + Signed-off-by: Stefan Roese + +commit 7e1d884b7cb602007329c517ec1c453e3a6a5d9c +Author: Shinya Kuribayashi +Date: Sat Nov 17 20:05:26 2007 +0900 + + [MIPS] cpu/mips/config.mk: Fix GNU assembler minor version picker + + Current trick to pick up GNU assembler minor version does not work with the + latest binutils (2007-03-01 or later) due to ${PKGVERSION} now default to + "(GNU Binutils) ". + + $ sde-as --version |grep "GNU assembler" + GNU assembler 2.15.94 mipssde-6.02.02-20050602 + $ sde-as --version |grep "GNU assembler" |awk '{print $3}' + 2.15.94 + $ sde-as --version |grep "GNU assembler" |awk '{print $3}' |awk -F. '{print $2}' + 15 + $ + + $ mips-linux-as --version |grep "GNU assembler" + GNU assembler (GNU Binutils) 2.18 + $ mips-linux-as --version |grep "GNU assembler" |awk '{print $3}' + (GNU + $ mips-linux-as --version |grep "GNU assembler" |awk '{print $3}' |awk -F. '{print $2}' + (no output) + $ + + As a result of above, you'll see many noises with such binutils: + + make -C cpu/mips/ + /bin/sh: line 0: [: : integer expression expected + /bin/sh: line 0: [: : integer expression expected + make[1]: Entering directory `/home/skuribay/devel/u-boot.git/cpu/mips' + mips-linux-gcc -D__ASSEMBLY__ -g -Os -D__KERNEL__ -DTEXT_BASE=0xB0000000 -I/home/skuribay/devel/u-boot.git/include -fno-builtin -ffreestanding -nostdinc -isystem /home/skuribay/devel/buildroot/build_mips/staging_dir/usr/bin/../lib/gcc/mips-linux-uclibc/4.2.1/include -pipe -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -pipe -msoft-float -march=4kc -mtune=4kc -EB -c -o incaip_wdt.o incaip_wdt.S + /bin/sh: line 0: [: : integer expression expected + mips-linux-gcc -D__ASSEMBLY__ -g -Os -D__KERNEL__ -DTEXT_BASE=0xB0000000 -I/home/skuribay/devel/u-boot.git/include -fno-builtin -ffreestanding -nostdinc -isystem /home/skuribay/devel/buildroot/build_mips/staging_dir/usr/bin/../lib/gcc/mips-linux-uclibc/4.2.1/include -pipe -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -pipe -msoft-float -march=4kc -mtune=4kc -EB -c -o cache.o cache.S + /bin/sh: line 0: [: : integer expression expected + mips-linux-gcc -g -Os -D__KERNEL__ -DTEXT_BASE=0xB0000000 -I/home/skuribay/devel/u-boot.git/include -fno-builtin -ffreestanding -nostdinc -isystem /home/skuribay/devel/buildroot/build_mips/staging_dir/usr/bin/../lib/gcc/mips-linux-uclibc/4.2.1/include -pipe -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -pipe -msoft-float -march=4kc -mtune=4kc -EB -Wall -Wstrict-prototypes -c -o asc_serial.o asc_serial.c + /bin/sh: line 0: [: : integer expression expected + + This patch simplifies the trick and makes it work with both versions of gas. + I also replace an expensive `awk (or gawk)' with `cut'. + + Signed-off-by: Shinya Kuribayashi + +commit 16664f72850846e645616da1c0fa5afcd6d15f15 +Author: Shinya Kuribayashi +Date: Sat Nov 17 20:05:26 2007 +0900 + + [MIPS] Remove useless instructions for initializing $gp. + + Signed-off-by: Shinya Kuribayashi + +commit 03c031d5660ea946c39af6e2e16267da857c609f +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:27:06 2007 +0900 + + [MIPS] MIPS 4K core: Coding style cleanups + + No logical changes. + + Signed-off-by: Shinya Kuribayashi + +commit f5e429d3860bba4c6ae8bead8f78349fa24491b2 +Author: Shinya Kuribayashi +Date: Sat Nov 17 20:05:20 2007 +0900 + + [MIPS] gth2.c: Fix a warning on gth2 build. + + gth2.c: In function 'misc_init_r': + gth2.c:434: warning: pointer targets in passing argument 2 of 'setenv' differ in signedness + + Signed-off-by: Shinya Kuribayashi + +commit 4fbd0741b2b6441da10be93e10267122581b7079 +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:22:33 2007 +0900 + + [MIPS] au1x00_eth.c: Fixed a warning on pb1000 build. + + au1x00_eth.c: In function 'au1x00_miiphy_write': + au1x00_eth.c:139: warning: 'return' with no value, in function returning non-void + + Signed-off-by: Shinya Kuribayashi + +commit f01320459736f156707425cf8112f98606301aa4 +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:00:25 2007 +0900 + + [MIPS] au1x00_eth.c: Fix au1x00_miiphy_{read,write} build error + + au1x00_eth.c: In function 'au1x00_enet_initialize': + au1x00_eth.c:246: error: 'au1x00_miiphy_read' undeclared (first use in this function) + au1x00_eth.c:246: error: (Each undeclared identifier is reported only once + au1x00_eth.c:246: error: for each function it appears in.) + au1x00_eth.c:246: error: 'au1x00_miiphy_write' undeclared (first use in this function) + au1x00_eth.c: In function 'au1x00_miiphy_write': + au1x00_eth.c:298: warning: 'return' with no value, in function returning non-void + make[1]: *** [au1x00_eth.o] Error 1 + + Fixed by moving these two functions forward. + + Signed-off-by: Shinya Kuribayashi + +commit b09258c5393edd1087c5f39ae68338f16b49f8b3 +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:00:25 2007 +0900 + + MAKEALL: Added missing pb1000 board + + Signed-off-by: Shinya Kuribayashi + +commit 2e4a6e3667a1e39c0e6e99498686b15d2718b369 +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:00:24 2007 +0900 + + [MIPS] pb1000: Replace obsolete memsetup.S with lowlevel_init.S + + Signed-off-by: Shinya Kuribayashi + +commit 662e5cb397249c3ea88a4c3255e9ccfc40b98d82 +Author: Shinya Kuribayashi +Date: Sat Oct 27 15:00:24 2007 +0900 + + [MIPS] u-boot.lds: Cleanup __u_boot_cmd_{start,end} + + Signed-off-by: Shinya Kuribayashi + +commit 5947f6999aafa7c54c1390983d264a8463dfea8e +Author: Wolfgang Denk +Date: Sat Nov 17 02:34:38 2007 +0100 + + Update CHANGELOIG, prepare for -rc4 + + Signed-off-by: Wolfgang Denk + +commit fd329e6f05bbdfe6bd71b0e09f0c76d3b0a025a5 +Author: Luotao Fu +Date: Wed Nov 14 18:58:33 2007 +0100 + + Fix the i2c frequency and default address in rsdproto board + + rsdproto board support has wrong I2C frequency and wrong return value + handling. + + Signed-off-by: Luotao Fu + +commit 429c180edad038f91c989cb14b478228092e7054 +Author: Wolfgang Denk +Date: Sat Nov 17 01:45:38 2007 +0100 + + powerpc: Backout relocation changes for MPC5121, too. + + Apply Grant Likely's backout to MPC5121 code, too. + + Pointed out by Rafal Jaworowski + + Signed-off-by: Wolfgang Denk + +commit 1c3dd43338a077165e7e0309cb3994e65d2bdbf8 +Author: Grant Likely +Date: Tue Nov 13 22:18:33 2007 -0700 + + powerpc: Backout relocation changes. + + Ugh. I *hate* to back this change out, but these compiler flags don't + work for relocation on all versions of GCC. I've not been able to + reproduce the environment in my setup (and hence, not been able to + find a combination that *does* work), so I've got no choice but to go + back to the old gcc flags and linker script. + + Signed-off-by: Grant Likely + +commit 5c15010efad980ad5498cc565fc1ed70df2f52b4 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Tue Nov 13 09:11:05 2007 +0100 + + Fixed mips_io_port_base build errors. + + This patch has been sent on: + - 29 Sep 2007 + + Although mips_io_port_base is currently a part of IDE command, it is quite + fundamental for MIPS I/O port access such as in[bwl] and out[bwl]. So move + it to MIPS general part, and introduce `set_io_port_base()' from Linux. + + This patch is triggered by multiple definition of `mips_io_port_base' build + error on gth2 (and tb0229 also needs this fix.) + + board/gth2/libgth2.a(gth2.o): In function `log_serial_char': + /home/skuribay/devel/u-boot.git/board/gth2/gth2.c:47: multiple definition of `mips_io_port_base' + common/libcommon.a(cmd_ide.o):/home/skuribay/devel/u-boot.git/common/cmd_ide.c:712: first defined here + make: *** [u-boot] Error 1 + + Signed-off-by: Shinya Kuribayashi + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 6ecbb7a3fa9b0940ed33e490d195d4b6830b2422 +Author: Wolfgang Denk +Date: Sat Nov 17 01:30:40 2007 +0100 + + Fix a bug in the slave serial programming mode for the Xilinx + Spartan2/3 FPGAs. The old code used "< 0" on a "char" type to test if + the most significant bit was set, which did not work on any + architecture where "char" defaulted to be an unsigned type. + + Based on a patch by Angelos Manousaridis + + Signed-off-by: Wolfgang Denk + +commit d08b7233bc252faad8339e7ca0ddfd62fa79903c +Author: Jon Loeliger +Date: Thu Nov 1 12:23:29 2007 -0500 + + 86xx: Fix broken variable reference when #def DEBUGing. + + Sometimes you can't reference the DDR2 controller variables. + + Signed-off-by: Jon Loeliger + +commit f9d9164d9c6b5a7f0393fd8d7e246b8a0326bc19 +Author: Jason Jin +Date: Fri Oct 26 18:32:00 2007 +0800 + + make 8610 board use pixis reset + + Signed-off-by: Jason Jin + +commit db74b3c1c9481a6bffbf8cd445e5bcbf6908e836 +Author: Jason Jin +Date: Mon Oct 29 19:26:21 2007 +0800 + + Unify pixis_reset altbank across board families + + Basically, refactor the CFG_PIXIS_VBOOT_MASK values + into the separate board config files. + + Signed-off-by: Jason Jin + Signed-off-by: Jon Loeliger + +commit 64bf555465c7926be13e1046ac0d0f05ac72829c +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Wed Nov 7 08:19:21 2007 +0100 + + Fix warning: pointer targets in assignment differ in signedness + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 7a60ee7c6248a958c5757d3660a1702723a2786d +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Wed Nov 7 08:19:19 2007 +0100 + + Fix warning differ in signedness in common/cmd_ide.c + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 4d4faae65e115e327425cd514c1a35146a85166b +Author: Grant Likely +Date: Mon Sep 24 09:05:31 2007 -0600 + + Group PCI and PCMCIA drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit 5798f87dc10a496d79d3177b9f5a76488987fd35 +Author: Grant Likely +Date: Mon Sep 24 09:05:31 2007 -0600 + + Group block/flash drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit df58c81551700f058b44cacf55a7997fa63bfe0a +Author: Grant Likely +Date: Mon Sep 24 09:05:31 2007 -0600 + + Group USB drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit 5dbb6ed622e539b0c8493ef7e578d3a533181d29 +Author: Grant Likely +Date: Mon Sep 24 09:05:30 2007 -0600 + + Group i2c drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit ec00c76de0e5971273905998d62d6bb119324218 +Author: Grant Likely +Date: Mon Sep 24 09:05:30 2007 -0600 + + Group console drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit 754f230aa01b8c789fc31f8013c2487954073300 +Author: Grant Likely +Date: Mon Sep 24 09:05:30 2007 -0600 + + Group network drivers in drivers/Makefile + + Signed-off-by: Grant Likely + +commit f0037c56b0d12cd46215124667b9f83d60ef9391 +Author: Grant Likely +Date: Mon Sep 24 09:05:30 2007 -0600 + + Build: split COBJS value into multiple lines + + This change is in preparation for condtitionial compile support in the + build system. By spliting them all into seperate lines now, subsequent + patches that change 'COBJS-y += ' into 'COBJS-$(CONFIG_) += ' will + be less invasive and easier to review + + Signed-off-by: Grant Likely + +commit 1b4aaffe4fb2a5e95d9111a5d94fd1f89215dce4 +Author: Grant Likely +Date: Mon Sep 24 09:05:30 2007 -0600 + + Add .gitignore files + + Signed-off-by: Grant Likely + Acked-by: Kim Phillips + +commit 955413f35f054a82e40042f1dbcf501c6a05719b +Author: Grant Likely +Date: Thu Nov 15 08:27:52 2007 -0700 + + Revert "Correct relocation fixup for mpc5xx" + + This reverts commit 3649cd99ba815b6601868735765602f00ef3692b. + Signed-off-by: Grant Likely + +commit e15633888a058aacb31a62d2cf1278e1e4c236ab +Author: Grant Likely +Date: Thu Nov 15 08:24:32 2007 -0700 + + Revert "Correct fixup relocation for MPC5xxx" + + This reverts commit 6f7576b20ecf0d040c3ac3b032b5cbc860e38a90. + Signed-off-by: Grant Likely + +commit 139365fbe566d0fc619a1ed04452ec5388f0cef8 +Author: Grant Likely +Date: Thu Nov 15 08:21:04 2007 -0700 + + Revert "Correct fixup relocation for mpc8220" + + This reverts commit a85dd254c0577fca13627c46e93fc2ad4c4f1f00. + Signed-off-by: Grant Likely + +commit 70922342369e5e39b286fe21e768a239ca07a514 +Author: Grant Likely +Date: Thu Nov 15 08:20:57 2007 -0700 + + Revert "Correct fixup relocation for mpc824x" + + This reverts commit f3a52fe05923935db86985daf9438e2f70ac39aa. + Signed-off-by: Grant Likely + +commit 96279ab4cad60cb5972aa934fbe4845ac02cc75a +Author: Grant Likely +Date: Thu Nov 15 08:20:50 2007 -0700 + + Revert "Correct fixup relocation for mpc8260" + + This reverts commit 5af61b2f4b838a05f79be274f3e5a66edd2d9c96. + Signed-off-by: Grant Likely + +commit 928fe33b24cdf382a8dc8687fed24b1961cdb5d6 +Author: Grant Likely +Date: Thu Nov 15 08:20:43 2007 -0700 + + Revert "Correct fixup relocation for mpc83xx" + + This reverts commit 057004f4a4863554d56cc56268bfa7c7d9738e27. + Signed-off-by: Grant Likely + +commit c93945e8f9e300860d2bf73a2549ce5794f8bd00 +Author: Grant Likely +Date: Thu Nov 15 08:20:25 2007 -0700 + + Revert "[MPC512x] Correct fixup relocation" + + This reverts commit 8d17979d0359492a822a0a409d26e3a3549b4cd4. + Signed-off-by: Grant Likely + +commit 54fd6c93c28a0a45352fff5dd92673401ff563f2 +Author: Stefan Roese +Date: Tue Nov 13 08:18:20 2007 +0100 + + ppc4xx: lwmon5: Change PHY reset sequence for PHY MDIO address latching + + Signed-off-by: Stefan Roese + +commit 1ce55151c85d068f70317a8d65c61058b891afb4 +Author: Heiko Schocher +Date: Tue Nov 13 07:50:29 2007 +0100 + + [UC101] SRAM now with 2 MB working. + + Signed-off-by: Heiko Schocher + +commit 8d737a28152ec12873f8544cca1fb39a49e5e693 +Author: TsiChungLiew +Date: Thu Nov 8 12:50:18 2007 -0600 + + ColdFire: MCF5329 - Remove reset registers from CCM + + Signed-off-by: TsiChungLiew + +commit 7d7cdea769a60b0a6e4c18bef7f9d648fd14b8d7 +Author: TsiChungLiew +Date: Thu Nov 8 12:31:11 2007 -0600 + + ColdFire: MCF5329 - Add Reset structure to immap_5329.h + + Signed-off-by: TsiChungLiew + +commit 09b26cf00d76d75fdf7fdc4b13e4dd929743bc21 +Author: TsiChungLiew +Date: Thu Nov 8 12:19:01 2007 -0600 + + ColdFire: MCF5329 - revert include/asm-m68k/m5329.h file mode + + Signed-off-by: TsiChungLiew + +commit 225a24b5e062ad94627424508ae814f51dbe1a34 +Author: TsiChungLiew +Date: Wed Nov 7 18:00:54 2007 -0600 + + ColdFire: MCF5445x - Update correct RAMBAR and missing linker files + + Signed-off-by: TsiChungLiew + +commit 248c7c14835f34d5d910b45e5600050e58ca6cab +Author: TsiChungLiew +Date: Wed Nov 7 17:56:15 2007 -0600 + + ColdFire: MCF532x - Update do_reset() using core reset + + Signed-off-by: TsiChungLiew + +commit d9240a5f827eb3b476a6ba2938d01f1a9e7688f4 +Author: TsiChungLiew +Date: Wed Nov 7 17:51:00 2007 -0600 + + ColdFire: Update cpu flag for 4.2-xx compiler + + Signed-off-by: TsiChungLiew + +commit 1f103105a3746ab12279b63b8c1d372c0ce2cc58 +Author: Roy Zang +Date: Mon Nov 5 17:39:24 2007 +0800 + + Implement general ULi 526x Ethernet driver support in U-boot + + This patch implements general ULi 526x Ethernet driver. + Until now, it is the only native Ethernet port on + MPC8610HPCD board, but it could be used on other boards + with ULi 526x Ethernet port as well. + + Signed-off-by: Roy Zang + Signed-off-by: Zhang Wei + Acked-by: Jon Loeliger + Signed-off-by: Ben Warren + +commit 71bc6e6474fea8ef481b9b45d1edd7ad1f6dfbbd +Author: Larry Johnson +Date: Thu Nov 1 08:46:50 2007 -0500 + + NET: Add Ethernet 1000BASE-X support for PPC4xx + + This patch adds support for 1000BASE-X to functions "miiphy_speed ()" and + "miiphy_duplex()". It also adds function "miiphy_is_1000base_x ()", which + returns non-zero iff the PHY registers are configured for 1000BASE-X. The + "mii info" command is modified to distinguish between 1000BASE-T and -X. + + Signed-off-by: Larry Johnson + Signed-off-by: Ben Warren + +commit 298035df4948b113d29ac0e694717d34b95bc5dc +Author: Larry Johnson +Date: Wed Oct 31 11:21:29 2007 -0500 + + NET: Cosmetic changes + + Signed-off-by: Larry Johnson + Signed-off-by: Ben Warren + +commit 992742a5b09d9040adbd156fb90756af66ade310 +Author: Wolfgang Denk +Date: Sat Nov 3 23:09:27 2007 +0100 + + Cleanup coding style; update CHANGELOG + + Signed-off-by: Wolfgang Denk + +commit e881cb563e32f45832b7b6db77bdcd017adcbb41 +Author: Bruce Adler +Date: Fri Nov 2 13:15:42 2007 -0700 + + fix wording in README + + Changed the wording to properly describe the shadowing + of the environment from ROM to RAM + + Signed-off-by: Bruce Adler + +commit ad845beef06245426c57b53dcdc01b7dc70e0d45 +Author: Shinya Kuribayashi +Date: Wed Oct 31 02:18:15 2007 +0900 + + blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk + + Signed-off-by: Shinya Kuribayashi + +commit ec22755799466c8a103664bb3a5e647bf9c238f4 +Author: Vlad Lungu +Date: Thu Oct 25 16:08:14 2007 +0300 + + Trimmed some variables in ne2000.c + + Signed-off-by: Vlad Lungu + +commit eb6f214d3644b2a77968c176ed36dcf858cfe7e0 +Author: Zhang Wei +Date: Thu Oct 25 17:51:27 2007 +0800 + + Fix the issue of usb_kbd driver missing the scan code of key 'z'. + + The scan code of the key 'z' is 0x1d, which should be handled. + + The change has be tested on NOVATEK USB keyboard and ULI PCI OHCI + controller. + + Signed-off-by: Zhang Wei + +commit bbf4796f6498fbade56d56eff3a0a49b299d93e5 +Author: Zhang Wei +Date: Thu Oct 25 17:30:04 2007 +0800 + + Fix USB support issue for MPC8641HPCN board. + + The configuration file has already enabled USB, but it + missed definition of CFG_OHCI_SWAP_REG_ACCESS, the USB + on MPC8641HPCN can not work because of the wrong USB + register endian. + + And add the USB command to U-Boot commands list. + + Signed-off-by: Zhang Wei + +commit 4e62041023dc3de9d98d977bb080235bc6d035e0 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Wed Oct 24 18:16:01 2007 +0200 + + Use config_cmd_default.h instead of config_cmd_all.h + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 56622f87857439b1c221e9deef11a9d5bb5d4308 +Author: Marian Balakowicz +Date: Wed Oct 24 01:37:36 2007 +0200 + + TQM5200: Call usb_cpu_init() during board init + + usb_cpu_init() configures GPS USB pins, clocks, etc. and + is required for proper operation of kernel USB subsystem. + This setup was previously done in the kernel by the fixup + code which is being removed, thus low level init must be + done by U-boot now. + + Signed-off-by: Marian Balakowicz + +commit 29c29c0267fe857e72014ce90c5d35b2ef6302bd +Author: Guennadi Liakhovetski +Date: Tue Oct 23 16:25:50 2007 +0200 + + Fix typo in nfs.c + + An obvious typo. Originally fixed in linkstation u-boot port. + + Signed-off-by: Guennadi Liakhovetski + +commit 59543fe00a4ce720ef9f5aa7fb387c6daf1c7d78 +Author: Guennadi Liakhovetski +Date: Tue Oct 23 14:35:05 2007 +0200 + + Fix a typo in cpu/mpc824x/interrupts.c + + Since December 2003 the timer_interrupt_cpu() function in + cpu/mpc824x/interrupts.c contains what seems to be a superfluous + parameter. Remove it. + + Signed-off-by: Guennadi Liakhovetski + +commit c9e7b9b9a1700fe009678d1f9b41e6364ac5df2d +Author: Sergej Stepanov +Date: Wed Oct 17 11:13:51 2007 +0200 + + add ft_cpu_setup(..) on mpc8260 + + Add ft_cpu_setup(..)-function to adapt it for use with libfdt + based on code from mpc5xxx + + Sigend-off-by: Sergej Stepanov + -- + +commit 6abd82e19ae93c0b4d104e50165e235915ec0875 +Author: Sergej Stepanov +Date: Wed Oct 17 11:18:42 2007 +0200 + + changes for IDS8247 board support + + To get the IDS8247 board working following are done: + - FCC2 is deactivated + - FCC1 is activated + - I2C is activated + - CFI driver is activated + - Adapted for use with LIBFDT + + Signed-off-by: Sergej Stepanov + -- + +commit 8b6684a698500be9c142ec2c9f46cfc348e17f0c +Author: Haavard Skinnemoen +Date: Wed Oct 24 15:48:37 2007 +0200 + + ATSTK1002: Remove default ethernet addresses + + Wolfgang is right: It's not a good idea to set up default initial + ethernet addresses for a board, even though they belong to the local + range. + + This will change the failure mode from "IT manager screams at you for + using duplicate ethernet addresses" to a nice error message explaining + that the ethernet address hasn't been set properly. + + Signed-off-by: Haavard Skinnemoen + +commit e5c794e491a57d829b6d8733e2ed8368a2269abf +Author: Justin Flammia +Date: Mon Oct 29 17:40:35 2007 -0400 + + DHCP Client Fix + + This is a multi-part message in MIME format. + + commit e6e505eae94ed721e123e177489291fc4544b7b8 + Author: Justin Flammia + Date: Mon Oct 29 17:19:03 2007 -0400 + + Found a bug in the way the DHCP Request packet is built, where the IP address + that is offered by the server is bound to prematurely. This patch is a fix of + that bug where the IP address offered by the DHCP server is not used until + after the DHCP ACK from the server is received. + + Signed-off-by: Justin Flammia + Signed-off-by: Ben Warren + +commit 31548249decf18a6b877a18436b6139dd483fe4a +Author: Justin Flammia +Date: Mon Oct 29 17:40:35 2007 -0400 + + DHCP Client Fix + + This is a multi-part message in MIME format. + + commit e6e505eae94ed721e123e177489291fc4544b7b8 + Author: Justin Flammia + Date: Mon Oct 29 17:19:03 2007 -0400 + + Found a bug in the way the DHCP Request packet is built, where the IP address + that is offered by the server is bound to prematurely. This patch is a fix of + that bug where the IP address offered by the DHCP server is not used until + after the DHCP ACK from the server is received. + + Signed-off-by: Justin Flammia + Signed-off-by: Ben Warren + +commit e8ee8f3ade2a06c1893dd5e68f223070d650c7ed +Author: TsiChungLiew +Date: Thu Oct 25 17:16:22 2007 -0500 + + ColdFire 54455: Fix correct boot location for atmel and intel + + Signed-off-by: TsiChungLiew + +commit 688e8eb414ac111cca7ce60bdf30e805ab9a7bcb +Author: TsiChungLiew +Date: Thu Oct 25 17:14:00 2007 -0500 + + ColdFire: Fix build error when CONFIG_WATCHDOG is defined + + Signed-off-by: TsiChungLiew + +commit c67e12e705b204cfe914e3e3e693d69a445dcabf +Author: TsiChungLiew +Date: Thu Oct 25 17:12:36 2007 -0500 + + ColdFire 5329: Assign correct SDRAM size and fix cache + + Signed-off-by: TsiChungLiew + +commit 95e9f2c212a65610b2e59a5c00d0113383a4da0b +Author: TsiChungLiew +Date: Thu Oct 25 17:10:23 2007 -0500 + + ColdFire 5253: Assign correct SDRAM size + + Signed-off-by: TsiChungLiew + +commit 2acefa72ee0026f862ab65597ca687428f63a973 +Author: TsiChungLiew +Date: Thu Oct 25 17:09:17 2007 -0500 + + ColdFire 5282: Fix external flash boot and return dramsize + + Signed-off-by: TsiChungLiew + +commit d78791ae914d4e7c5edca1cdad73b3dc81a4eb82 +Author: Bartlomiej Sieka +Date: Thu Oct 25 17:20:01 2007 +0200 + + TQM5200: increase kernel_addr_r and fdt_addr_r (hinted by Wolfgang Denk). + + Signed-off-by: Bartlomiej Sieka + +commit 1a0ce20aa4cb4e3068da04e7290ee9986fd0b834 +Author: Martin Krause +Date: Wed Oct 24 08:42:25 2007 +0200 + + TQM5200: fix spurious characters on second serial interface + + With this patch PSC3 is configured as UART. This is done, because if + the pins of PSC3 are not configured at all (-> all pins are GPI), + due to crosstalk, spurious characters may be send over the RX232_2_TXD + signal line. + + Signed-off-by: Martin Krause + Signed-off-by: Grant Likely + +commit be4a87f11e297a5cededbf7dd71c0248f3874acd +Author: Martin Krause +Date: Wed Oct 24 08:41:27 2007 +0200 + + TQM5200S: fix commands for STK52xx base board because of missing SM501 grafic controller + + Some commands for the STK52xx base board try to access the SM501 grafic + controller. But the TQM5200S has no grafic controller (only the TQM5200 + and the TQM5200B have). This patch deactivates the commands accessing + the SM501 for the TQM5200S. + + Signed-off-by: Martin Krause + Signed-off-by: Grant Likely + +commit b31f64343ead9482cd439b1adbe4c34026a641b1 +Author: Martin Krause +Date: Mon Oct 22 16:45:53 2007 +0200 + + TQM5200: fix spurious characters on second serial interface + + With this patch PSC3 is configured as UART. This is done, because if + the pins of PSC3 are not configured at all (-> all pins are GPI), + due to crosstalk, spurious characters may be send over the RX232_2_TXD + signal line. + + Signed-off-by: Martin Krause + +commit 0fc0f91b20ffa802f5a66534ca5c2844910583f6 +Author: Martin Krause +Date: Mon Oct 22 16:40:06 2007 +0200 + + TQM5200S: fix commands for STK52xx base board because of missing SM501 grafic controller + + Some commands for the STK52xx base board try to access the SM501 grafic + controller. But the TQM5200S has no grafic controller (only the TQM5200 + and the TQM5200B have). This patch deactivates the commands accessing + the SM501 for the TQM5200S. + + Signed-off-by: Martin Krause + +commit 7b0a42219f30277f71f4405cbaf8a269f6d2d227 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Sun Oct 21 09:14:28 2007 +0200 + + Mips: Fix string functions differ prototype declaration + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit cb8250fe4b3c4ed549b270e8a20bc22060e7e1d2 +Author: Ed Swarthout +Date: Fri Oct 19 17:51:40 2007 -0500 + + fsl_pci_init enable COMMAND_MEMORY if inbound window + + Patch 16e23c3f removed PCSRBAR allocation. But passing zero windows + to pciauto_setup_device has the side effect of not getting + COMMAND_MEMORY set. + + Signed-off-by: Ed Swarthout + +commit e9d0d527992566ebef9826962ff1745b2f082b92 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Fri Oct 19 10:55:24 2007 +0200 + + delta: Fix OHCI_REGS_BASE undeclared and wait_ms implicit declaration + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 9c4884f54da982ce990c7d1760ac81b0704d3c64 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Fri Oct 19 08:10:15 2007 +0200 + + fix warning: no return statement in function returning non-void + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit e78220f6e514206757acfe247297fc9a328a881f +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Fri Oct 19 06:33:45 2007 +0200 + + xsengine: Fix no partition type specified, use DOS as default + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 10cdb8dbd67a818823ab9ec88b68fc348903db59 +Author: Jean-Christophe PLAGNIOL-VILLARD +Date: Fri Oct 19 00:24:59 2007 +0200 + + lubbock: Fix no partition type specified, use DOS as default + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD + +commit 41b4d282d38fa7231c315c5f6cfff5bdd24e0191 +Author: Wolfgang Denk +Date: Tue Oct 23 16:50:03 2007 +0200 + + Coding style: keep lists sorted; update CHANGELOG + + Signed-off-by: Wolfgang Denk + commit 58b74b05c621e2835ecf4e2d3243042cf4186777 Author: Jean-Christophe PLAGNIOL-VILLARD Date: Fri Oct 19 00:09:05 2007 +0200 @@ -51,6 +1295,120 @@ Date: Wed Oct 17 11:56:31 2007 -0500 are added to u-boot. Signed-off-by Rune Torgersen +commit d3afa1ee19345a31fd1eaad3e98b97d13ca47315 +Author: Bartlomiej Sieka +Date: Tue Oct 23 13:14:10 2007 +0200 + + Motion-PRO: Update configuration to accomodate next generation board. + + New board has faster oscillator and a different Flash chip. This affects: + - CFG_MPC5XXX_CLKIN + - SDRAM timings + - Flash CS configuration (timings) + - Flash sector size, and thus MTD partition layout + - malloc() arena size (due to bigger Flash sectors) + - smaller memory test range (due to bigger malloc() arena) + + This patch also enables more extensive memory testing via "mtest". + + Signed-off-by: Bartlomiej Sieka + +commit eff501904df2bf1724a750062628ba2c51dbb1f8 +Author: Bartlomiej Sieka +Date: Tue Oct 23 11:36:07 2007 +0200 + + Motion-PRO: Add setting of SDelay reg. to SDRAM controller configuration. + + Per AN3221 (MPC5200B SDRAM Initialization and Configuration), the SDelay + register must be written a value of 0x00000004 as the first step of the + SDRAM contorller configuration. + + Signed-off-by: Bartlomiej Sieka + +commit 7a9348728ebda63cdbaacffd83099aa71d9d4c54 +Author: Peter Pearse +Date: Tue Oct 23 10:22:16 2007 +0100 + + Move PL01* serial drivers to drivers/serial and adjust Makefiles. + +commit 20d500d531a6b971ce6cc1bf191cb0092cdc0afc +Author: Stefan Roese +Date: Tue Oct 23 10:17:42 2007 +0200 + + ppc4xx: lwmon5: Some further GPIO config changes + + Signed-off-by: Stefan Roese + +commit de9a738faa7c2f47286119c3bfebc3dfbfe7d86d +Author: Vlad Lungu +Date: Sun Oct 21 22:10:10 2007 +0900 + + [MIPS] Fix UNCACHED_SDRAM + + PHYSADDR is for physical address, KSEG1ADDR is for uncached. + + Signed-off-by: Vlad Lungu + Signed-off-by: Shinya Kuribayashi + +commit 00101dd7a32d12f698150123e47e4b3420279f86 +Author: Shinya Kuribayashi +Date: Sun Oct 21 21:30:42 2007 +0900 + + [MIPS] Add PIC-related switches to PLATFORM_{CPP,LD}FLAGS and cleanup + + Signed-off-by: Shinya Kuribayashi + +commit eb700636db017d310edaeb559b13d82588560674 +Author: Shinya Kuribayashi +Date: Sun Oct 21 10:55:37 2007 +0900 + + [MIPS] u-boot.lds: Define _gp in a standard manner + + Signed-off-by: Shinya Kuribayashi + +commit 22069215eb7adf5a3888bf7c7784ea9d70a72cd0 +Author: Shinya Kuribayashi +Date: Sun Oct 21 10:55:36 2007 +0900 + + [MIPS] Fix $gp usage + + Now we load $gp with _GLOBAL_OFFSET_TABLE_, but this is incorrect use. + As a general principle, we should use _gp for $gp. + + Thanks to linker script's help we fortunately have _gp which equals to + _GLOBAL_OFFSET_TABLE_. But once _gp gets out of alignment, we will not + be able to access to GOT entires, global variables and procedure entry + points. The right thing to do is to use _gp. + + This patch also introduce a new symbol `.gpword _GLOBAL_OFFSET_TABLE_' + which holds the offset from _gp. When updating GOT entries, we use this + offset and _gp to calculate the final _GLOBAL_OFFSET_TABLE_. + + This patch is originally submitted by Vlad Lungu , then + I made some change to leave over num_got_entries. + + Signed-off-by: Shinya Kuribayashi + Cc: Vlad Lungu + +commit cbf2323b5b8285ea01acba7bbb905a3162d9b021 +Author: Shinya Kuribayashi +Date: Sun Oct 21 10:55:36 2007 +0900 + + [MIPS] u-boot.lds: Fix __got_start and __got_end + + Ensure that __got_start points to top of the `.got', and __got_end points + to bottom as well, so that we never fail to count num_got_entries. + + Signed-off-by: Shinya Kuribayashi + +commit e5f325fec5b48ae705c89522923ba5a2e37cd5c7 +Author: Shinya Kuribayashi +Date: Sun Oct 21 10:55:36 2007 +0900 + + [MIPS] u-boot.lds: Remove duplicated .sdata section + + Signed-off-by: Shinya Kuribayashi + commit 05bf4919c1ce49cdedadacd564d0786a8ed796a1 Author: Wolfgang Denk Date: Sun Oct 21 01:01:17 2007 +0200 @@ -73,6 +1431,84 @@ Date: Thu Oct 4 20:47:10 2007 +0300 Signed-off-by: Vlad Lungu +commit df90968b48fb34fa9072fab150db2ac89678f537 +Author: urwithsughosh@gmail.com +Date: Mon Sep 24 13:32:13 2007 -0400 + + Setting MSR[DE] in do_reset + + Hello, + This patch ensures the soft reset of the board for the 85xx boards + by setting the MSR[DE] in the do_reset function. + + Signed-off-by: Sughosh Ganu + +commit 1e701e701304b3c3a3768ca83dd2ab7b9e88c77d +Author: urwithsughosh@gmail.com +Date: Mon Sep 24 13:36:01 2007 -0400 + + MSR overwrite fix + + Hello, + This patch fixes the MSR overwrite in the start.S when moving out of + the last 4K page. + + Signed-off-by: Sughosh Ganu + +commit 5c7ea64bb74a850a2b2303f853a8270695ad8602 +Author: Dan Wilson +Date: Fri Oct 19 11:33:48 2007 -0500 + + tsec driver should clear RHALT on startup + + This was causing problems for some people. + + Signed-off-by: Alain Gravel + Signed-off-by: Dan Wilson + Signed-off-by: Andy Fleming + +commit 7600d47b8f6a10019e537dc9a62aa1498df58d25 +Author: Kumar Gala +Date: Thu Oct 11 00:29:18 2007 -0500 + + Improve handling of PCI interrupt device tree fixup on MPC85xx CDS + + On the MPC85xx CDS we have two issues: + + 1. The device tree fixup code did not check to see if the property we are + trying to update is actually found. Its possible that it would update + random memory starting at 0. + + 2. Newer Linux kernel's have moved the location of the PCI nodes to be + sibilings of the soc node and not children. The explicit PATH to the PCI + node would not be found for these device trees. Add the ability to handle + both paths. In the future we shouldn't handle such fixups by explicit path. + + Signed-off-by: Kumar Gala + +commit a3063eec775719b7e91023bbec3f64b3118791df +Author: Kumar Gala +Date: Thu Oct 11 00:18:48 2007 -0500 + + Set OF_STDOUT_PATH to match the default console on MPC8568 MDS + + On the MPC8568 MDS we use ttyS0, UART0, etc. as the standard configured + console. Make it so we match that config what we tell Linux as the early + STDOUT console. + + Signed-off-by: Kumar Gala + +commit e1ce3cb617bb06f91f82f98915391175addf3e82 +Author: Kumar Gala +Date: Tue Oct 2 11:12:27 2007 -0500 + + Remove magic numbers from cache related operations for mpc85xx + + The mpc85xx start code uses some magic numbers that we actually + have #defines for in so use those instead. + + Signed-off-by: Kumar Gala + commit 5441f61a3d8b7034f19fc1361183e936198e6dbb Author: Detlev Zundel Date: Fri Oct 19 16:47:26 2007 +0200 @@ -409,6 +1845,16 @@ Date: Tue Sep 11 14:12:55 2007 +0200 Signed-off-by: Stefan Roese +commit 1487adbdcf9594bb2eb686325a6f9540dad1b70a +Author: Ed Swarthout +Date: Wed Sep 26 16:35:54 2007 -0500 + + 85xx io out functions need sync after write. + + This fixes the mc146818 rtc_read/write functions for 85xx. + + Signed-off-by: Ed Swarthout + commit 0d38effc6e359e6b1b0c78d66e8bc1a4dc15a2ae Author: Grant Likely Date: Tue Sep 25 15:48:05 2007 -0600 diff --git a/MAKEALL b/MAKEALL index ef181bac73..fb53a9141c 100755 --- a/MAKEALL +++ b/MAKEALL @@ -383,6 +383,7 @@ LIST_7xx=" \ LIST_ppc=" \ ${LIST_5xx} \ + ${LIST_512x} \ ${LIST_5xxx} \ ${LIST_8xx} \ ${LIST_8220} \ @@ -559,6 +560,7 @@ LIST_mips5kc_el="" LIST_au1xx0_el=" \ dbau1550_el \ + pb1000 \ " LIST_mips_el=" \ diff --git a/Makefile b/Makefile index 35f8d31095..c73d4cfeff 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,8 @@ VERSION = 1 PATCHLEVEL = 3 -SUBLEVEL = 0 -EXTRAVERSION = -rc3 +SUBLEVEL = 1 +EXTRAVERSION = U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) VERSION_FILE = $(obj)include/version_autogenerated.h @@ -205,22 +205,30 @@ LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a LIBS += net/libnet.a LIBS += disk/libdisk.a -LIBS += rtc/librtc.a -LIBS += dtt/libdtt.a -LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a -LIBS += drivers/nand/libnand.a -LIBS += drivers/nand_legacy/libnand_legacy.a -LIBS += drivers/onenand/libonenand.a +LIBS += drivers/block/libblock.a +LIBS += drivers/hwmon/libhwmon.a +LIBS += drivers/i2c/libi2c.a +LIBS += drivers/input/libinput.a +LIBS += drivers/misc/libmisc.a +LIBS += drivers/mtd/libmtd.a +LIBS += drivers/mtd/nand/libnand.a +LIBS += drivers/mtd/nand_legacy/libnand_legacy.a +LIBS += drivers/mtd/onenand/libonenand.a LIBS += drivers/net/libnet.a +LIBS += drivers/net/sk98lin/libsk98lin.a +LIBS += drivers/pci/libpci.a +LIBS += drivers/pcmcia/libpcmcia.a ifeq ($(CPU),mpc83xx) LIBS += drivers/qe/qe.a endif ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a endif +LIBS += drivers/rtc/librtc.a LIBS += drivers/serial/libserial.a -LIBS += drivers/sk98lin/libsk98lin.a +LIBS += drivers/usb/libusb.a +LIBS += drivers/video/libvideo.a LIBS += post/libpost.a post/drivers/libpostdrivers.a LIBS += $(shell if [ -d post/lib_$(ARCH) ]; then echo \ "post/lib_$(ARCH)/libpost$(ARCH).a"; fi) @@ -323,25 +331,65 @@ env: depend dep: version for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done +TAG_SUBDIRS += include +TAG_SUBDIRS += lib_generic board/$(BOARDDIR) +TAG_SUBDIRS += cpu/$(CPU) +TAG_SUBDIRS += lib_$(ARCH) +TAG_SUBDIRS += fs/cramfs +TAG_SUBDIRS += fs/fat +TAG_SUBDIRS += fs/fdos +TAG_SUBDIRS += fs/jffs2 +TAG_SUBDIRS += net +TAG_SUBDIRS += disk +TAG_SUBDIRS += common +TAG_SUBDIRS += drivers/bios_emulator +TAG_SUBDIRS += drivers/block +TAG_SUBDIRS += drivers/hwmon +TAG_SUBDIRS += drivers/i2c +TAG_SUBDIRS += drivers/input +TAG_SUBDIRS += drivers/misc +TAG_SUBDIRS += drivers/mtd +TAG_SUBDIRS += drivers/mtd/nand +TAG_SUBDIRS += drivers/mtd/nand_legacy +TAG_SUBDIRS += drivers/mtd/onenand +TAG_SUBDIRS += drivers/net +TAG_SUBDIRS += drivers/net/sk98lin +TAG_SUBDIRS += drivers/pci +TAG_SUBDIRS += drivers/pcmcia +TAG_SUBDIRS += drivers/qe +TAG_SUBDIRS += drivers/rtc +TAG_SUBDIRS += drivers/serial +TAG_SUBDIRS += drivers/usb +TAG_SUBDIRS += drivers/video + tags ctags: - ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \ - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` + ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \ + -name '*.[ch]' -print` etags: - etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \ - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` + etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) $(TAG_SUBDIRS) \ + -name '*.[ch]' -print` $(obj)System.map: $(obj)u-boot @$(NM) $< | \ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(obj)System.map +# +# Auto-generate the autoconf.mk file (which is included by all makefiles) +# +# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. +# the dep file is only include in this top level makefile to determine when +# to regenerate the autoconf.mk file. +$(OBJTREE)/include/autoconf.mk: $(obj)include/config.h + @echo Generating include/autoconf.mk + @# Generate the dependancies + @$(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -MQ $@ include/common.h > $@.dep + @# Extract the config macros + @$(CPP) $(CFLAGS) -dM include/common.h | sed -n -f tools/scripts/define2mk.sed >> $@ + +sinclude $(OBJTREE)/include/autoconf.mk.dep + ######################################################################### else all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ @@ -361,7 +409,8 @@ CHANGELOG: unconfig: @rm -f $(obj)include/config.h $(obj)include/config.mk \ - $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp + $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ + $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep #======================================================================== # PowerPC @@ -1750,9 +1799,13 @@ M54455EVB_i66_config : unconfig >include/config.h ; \ if [ "$${FLASH}" == "INTEL" ] ; then \ echo "#undef CFG_ATMEL_BOOT" >> $(obj)include/config.h ; \ + echo "TEXT_BASE = 0x00000000" > $(obj)board/freescale/m54455evb/config.tmp ; \ + cp $(obj)board/freescale/m54455evb/u-boot.int $(obj)board/freescale/m54455evb/u-boot.lds ; \ echo "... with INTEL boot..." ; \ else \ echo "#define CFG_ATMEL_BOOT" >> $(obj)include/config.h ; \ + echo "TEXT_BASE = 0x04000000" > $(obj)board/freescale/m54455evb/config.tmp ; \ + cp $(obj)board/freescale/m54455evb/u-boot.atm $(obj)board/freescale/m54455evb/u-boot.lds ; \ echo "... with ATMEL boot..." ; \ fi; \ echo "#define CFG_INPUT_CLKSRC $${FREQ}" >> $(obj)include/config.h ; \ diff --git a/README b/README index 09eb76fe45..3dad5fc726 100644 --- a/README +++ b/README @@ -2123,7 +2123,7 @@ to save the current settings. to be a good choice since it makes it far enough from the start of the data area as well as from the stack pointer. -Please note that the environment is read-only as long as the monitor +Please note that the environment is read-only until the monitor has been relocated to RAM and a RAM copy of the environment has been created; also, when using EEPROM you will have to use getenv_r() until then to read environment variables. diff --git a/blackfin_config.mk b/blackfin_config.mk index df324b7efa..f71a31370e 100644 --- a/blackfin_config.mk +++ b/blackfin_config.mk @@ -21,4 +21,4 @@ # MA 02111-1307 USA # -PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN +PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN -D__BLACKFIN__ diff --git a/board/ads5121/u-boot.lds b/board/ads5121/u-boot.lds index 34ceb0fdac..038d849553 100644 --- a/board/ads5121/u-boot.lds +++ b/board/ads5121/u-boot.lds @@ -51,6 +51,7 @@ SECTIONS { cpu/mpc512x/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/board/cds/common/ft_board.c b/board/cds/common/ft_board.c index 9d97905ca9..3eda1009ef 100644 --- a/board/cds/common/ft_board.c +++ b/board/cds/common/ft_board.c @@ -37,17 +37,24 @@ static void cds_pci_fixup(void *blob) map = ft_get_prop(blob, "/" OF_SOC "/pci@8000/interrupt-map", &len); - len /= sizeof(u32); + if (!map) + map = ft_get_prop(blob, "/" OF_PCI "/interrupt-map", &len); - slot = get_pci_slot(); + if (map) { + len /= sizeof(u32); - for (i=0;ibi_memstart); memory_data[1] = cpu_to_be32(bd->bi_memsize); - nodeoffset = fdt_find_node_by_path (blob, "/memory"); + nodeoffset = fdt_path_offset (blob, "/memory"); if (nodeoffset >= 0) { ret = fdt_setprop(blob, nodeoffset, "reg", memory_data, sizeof(memory_data)); diff --git a/board/cogent/u-boot.lds b/board/cogent/u-boot.lds index d87a39b249..5ce2694cbf 100644 --- a/board/cogent/u-boot.lds +++ b/board/cogent/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { *(.text) common/environment.o(.text) + *(.fixup) *(.got1) } _etext = .; diff --git a/board/dbau1x00/dbau1x00.c b/board/dbau1x00/dbau1x00.c index d29e8d591e..a13eeeb123 100644 --- a/board/dbau1x00/dbau1x00.c +++ b/board/dbau1x00/dbau1x00.c @@ -25,6 +25,7 @@ #include #include #include +#include long int initdram(int board_type) { @@ -77,6 +78,9 @@ int checkboard (void) default: printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id); } + + set_io_port_base(0); + #ifdef CONFIG_IDE_PCMCIA /* Enable 3.3 V on slot 0 ( VCC ) No 5V */ diff --git a/board/dbau1x00/u-boot.lds b/board/dbau1x00/u-boot.lds index 10c9917986..861873272b 100644 --- a/board/dbau1x00/u-boot.lds +++ b/board/dbau1x00/u-boot.lds @@ -43,21 +43,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } - - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; - - .sdata : { *(.sdata) } - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + _gp = ALIGN(16) + 0x7ff0; + + .got : { + __got_start = .; + *(.got) + __got_end = .; + } + + .sdata : { *(.sdata) } + + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/freescale/common/pixis.c b/board/freescale/common/pixis.c index fd99a938c0..45dcf4dab0 100644 --- a/board/freescale/common/pixis.c +++ b/board/freescale/common/pixis.c @@ -207,13 +207,16 @@ void read_from_px_regs_altbank(int set) out8(PIXIS_BASE + PIXIS_VCFGEN1, tmp); } +#ifndef CFG_PIXIS_VBOOT_MASK +#define CFG_PIXIS_VBOOT_MASK 0x40 +#endif void set_altbank(void) { u8 tmp; tmp = in8(PIXIS_BASE + PIXIS_VBOOT); - tmp ^= 0x40; + tmp ^= CFG_PIXIS_VBOOT_MASK; out8(PIXIS_BASE + PIXIS_VBOOT, tmp); } diff --git a/board/freescale/m54455evb/config.mk b/board/freescale/m54455evb/config.mk index ce014edca8..b42fcc94ce 100644 --- a/board/freescale/m54455evb/config.mk +++ b/board/freescale/m54455evb/config.mk @@ -22,4 +22,6 @@ # MA 02111-1307 USA # -TEXT_BASE = 0 +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp + +PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) diff --git a/board/freescale/m54455evb/u-boot.atm b/board/freescale/m54455evb/u-boot.atm new file mode 100644 index 0000000000..bda68e4f82 --- /dev/null +++ b/board/freescale/m54455evb/u-boot.atm @@ -0,0 +1,144 @@ +/* + * (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(m68k) +SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); +/* 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/mcf5445x/start.o (.text) + lib_m68k/traps.o (.text) + lib_m68k/interrupts.o (.text) + common/dlmalloc.o (.text) + lib_generic/zlib.o (.text) + + . = DEFINED(env_offset) ? env_offset : .; + common/environment.o (.text) + + *(.text) + *(.fixup) + *(.got1) + } + _etext = .; + PROVIDE (etext = .); + .rodata : + { + *(.rodata) + *(.rodata1) + } + .fini : { *(.fini) } =0 + .ctors : { *(.ctors) } + .dtors : { *(.dtors) } + + /* Read-write section, merged into data segment: */ + . = (. + 0x00FF) & 0xFFFFFF00; + _erotext = .; + PROVIDE (erotext = .); + + .reloc : + { + __got_start = .; + *(.got) + __got_end = .; + _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 : + { + _sbss = .; + *(.sbss) *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + . = ALIGN(4); + _ebss = .; + } + _end = . ; + PROVIDE (end = .); +} diff --git a/board/freescale/m54455evb/u-boot.int b/board/freescale/m54455evb/u-boot.int new file mode 100644 index 0000000000..e480c29227 --- /dev/null +++ b/board/freescale/m54455evb/u-boot.int @@ -0,0 +1,141 @@ +/* + * (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(m68k) +SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); +/* 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/mcf5445x/start.o (.text) + lib_m68k/traps.o (.text) + lib_m68k/interrupts.o (.text) + common/dlmalloc.o (.text) + lib_generic/zlib.o (.text) + + *(.text) + *(.fixup) + *(.got1) + } + _etext = .; + PROVIDE (etext = .); + .rodata : + { + *(.rodata) + *(.rodata1) + } + .fini : { *(.fini) } =0 + .ctors : { *(.ctors) } + .dtors : { *(.dtors) } + + /* Read-write section, merged into data segment: */ + . = (. + 0x00FF) & 0xFFFFFF00; + _erotext = .; + PROVIDE (erotext = .); + + .reloc : + { + __got_start = .; + *(.got) + __got_end = .; + _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 : + { + _sbss = .; + *(.sbss) *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + . = ALIGN(4); + _ebss = .; + } + _end = . ; + PROVIDE (end = .); +} diff --git a/board/freescale/mpc832xemds/pci.c b/board/freescale/mpc832xemds/pci.c index 6bc35c70f2..7818a2e1ee 100644 --- a/board/freescale/mpc832xemds/pci.c +++ b/board/freescale/mpc832xemds/pci.c @@ -269,7 +269,7 @@ ft_pci_setup(void *blob, bd_t *bd) int err; int tmp[2]; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(hose[0].first_busno); tmp[1] = cpu_to_be32(hose[0].last_busno); diff --git a/board/freescale/mpc8349emds/pci.c b/board/freescale/mpc8349emds/pci.c index ae94a2f384..7bcdccbcc6 100644 --- a/board/freescale/mpc8349emds/pci.c +++ b/board/freescale/mpc8349emds/pci.c @@ -396,7 +396,7 @@ ft_pci_setup(void *blob, bd_t *bd) int err; int tmp[2]; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[0].first_busno); tmp[1] = cpu_to_be32(pci_hose[0].last_busno); @@ -408,7 +408,7 @@ ft_pci_setup(void *blob, bd_t *bd) tmp, sizeof(tmp[0])); } #ifdef CONFIG_MPC83XX_PCI2 - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8600"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8600"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[1].first_busno); tmp[1] = cpu_to_be32(pci_hose[1].last_busno); diff --git a/board/freescale/mpc8349itx/pci.c b/board/freescale/mpc8349itx/pci.c index 5ca094d4cb..a764a61867 100644 --- a/board/freescale/mpc8349itx/pci.c +++ b/board/freescale/mpc8349itx/pci.c @@ -342,7 +342,7 @@ ft_pci_setup(void *blob, bd_t *bd) int err; int tmp[2]; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[0].first_busno); tmp[1] = cpu_to_be32(pci_hose[0].last_busno); @@ -354,7 +354,7 @@ ft_pci_setup(void *blob, bd_t *bd) tmp, sizeof(tmp[0])); } #ifdef CONFIG_MPC83XX_PCI2 - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[1].first_busno); tmp[1] = cpu_to_be32(pci_hose[1].last_busno); diff --git a/board/freescale/mpc8360emds/pci.c b/board/freescale/mpc8360emds/pci.c index cf7ef90443..f18e532ef5 100644 --- a/board/freescale/mpc8360emds/pci.c +++ b/board/freescale/mpc8360emds/pci.c @@ -269,7 +269,7 @@ ft_pci_setup(void *blob, bd_t *bd) int err; int tmp[2]; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(hose[0].first_busno); tmp[1] = cpu_to_be32(hose[0].last_busno); diff --git a/board/freescale/mpc8544ds/mpc8544ds.c b/board/freescale/mpc8544ds/mpc8544ds.c index 76d909191f..b6c9e93d50 100644 --- a/board/freescale/mpc8544ds/mpc8544ds.c +++ b/board/freescale/mpc8544ds/mpc8544ds.c @@ -227,7 +227,7 @@ pci_init_board(void) * Activate ULI1575 legacy chip by performing a fake * memory access. Needed to make ULI RTC work. */ - in_be32(CFG_PCIE3_MEM_BASE); + in_be32((u32 *)CFG_PCIE3_MEM_BASE); } else { printf (" PCIE3: disabled\n"); } diff --git a/board/gth2/gth2.c b/board/gth2/gth2.c index ffeaf587b5..6da80dc758 100644 --- a/board/gth2/gth2.c +++ b/board/gth2/gth2.c @@ -26,14 +26,13 @@ #include #include #include +#include #include #include "ee_access.h" static int wdi_status = 0; -unsigned long mips_io_port_base = 0; - #define SDRAM_SIZE ((64*1024*1024)-(12*4096)) @@ -147,6 +146,9 @@ int checkboard (void) default: printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id); } + + set_io_port_base(0); + #ifdef CONFIG_IDE_PCMCIA /* PCMCIA is on a 36 bit physical address. We need to map it into a 32 bit addresses */ @@ -429,7 +431,7 @@ int misc_init_r(void){ (Rx[8] != ':') | (Rx[11] != ':') | (Rx[14] != ':')) { printf ("*** ethernet addr invalid, using default ***\n"); } else { - setenv ("ethaddr", Rx); + setenv ("ethaddr", (char *)Rx); } return (0); } diff --git a/board/gth2/lowlevel_init.S b/board/gth2/lowlevel_init.S index 983ff704ac..eea378a3b6 100644 --- a/board/gth2/lowlevel_init.S +++ b/board/gth2/lowlevel_init.S @@ -413,7 +413,9 @@ noCacheJump: j clearmem nop +#if 0 .globl memtest +#endif memtest: /* Fill memory with address */ li t0, 0x80000000 @@ -434,7 +436,9 @@ mt1: lw t2, 0(t0) bne t1, zero, mt1 nop nop +#if 0 .globl clearmem +#endif clearmem: /* Clear memory */ li t0, 0x80000000 diff --git a/board/gth2/u-boot.lds b/board/gth2/u-boot.lds index 8ba0b6d4c1..ce53d9ddbb 100644 --- a/board/gth2/u-boot.lds +++ b/board/gth2/u-boot.lds @@ -43,20 +43,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } + . = .; + _gp = ALIGN(16) + 0x7ff0; - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; + .got : { + __got_start = .; + *(.got) + __got_end = .; + } .sdata : { *(.sdata) } - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/hymod/u-boot.lds b/board/hymod/u-boot.lds index 9bf0f0938a..337a3954d2 100644 --- a/board/hymod/u-boot.lds +++ b/board/hymod/u-boot.lds @@ -69,6 +69,7 @@ SECTIONS common/environment.o(.text) *(.text) + *(.fixup) *(.got1) } _etext = .; diff --git a/board/ids8247/ids8247.c b/board/ids8247/ids8247.c index 19823a474e..b05424d32b 100644 --- a/board/ids8247/ids8247.c +++ b/board/ids8247/ids8247.c @@ -25,6 +25,12 @@ #include #include +#if defined(CONFIG_OF_LIBFDT) +#include +#include +#include +#endif + DECLARE_GLOBAL_DATA_PTR; /* @@ -38,12 +44,12 @@ const iop_conf_t iop_conf_tab[4][32] = { /* Port A configuration */ { /* conf ppar psor pdir podr pdat */ - /* PA31 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 COL */ - /* PA30 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 CRS */ - /* PA29 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 TXER */ - /* PA28 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 TXEN */ - /* PA27 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 RXDV */ - /* PA26 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 RXER */ + /* PA31 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 COL */ + /* PA30 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 CRS */ + /* PA29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 TXER */ + /* PA28 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 TXEN */ + /* PA27 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXDV */ + /* PA26 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXER */ /* PA25 */ { 0, 0, 0, 0, 1, 0 }, /* 8247_P0 */ #if defined(CONFIG_SOFT_I2C) /* PA24 */ { 1, 0, 0, 0, 1, 1 }, /* I2C_SDA2 */ @@ -53,14 +59,14 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PA23 */ { 0, 0, 0, 1, 0, 0 }, /* PA23 */ #endif /* PA22 */ { 0, 0, 0, 0, 1, 0 }, /* SMC2_DCD */ - /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TXD3 */ - /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TXD2 */ - /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TXD1 */ - /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TXD0 */ - /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RXD0 */ - /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RXD1 */ - /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RXD2 */ - /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RXD3 */ + /* PA21 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD3 */ + /* PA20 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD2 */ + /* PA19 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD1 */ + /* PA18 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD0 */ + /* PA17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD0 */ + /* PA16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD1 */ + /* PA15 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD2 */ + /* PA14 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD3 */ /* PA13 */ { 0, 0, 0, 1, 1, 0 }, /* SMC2_RTS */ /* PA12 */ { 0, 0, 0, 0, 1, 0 }, /* SMC2_CTS */ /* PA11 */ { 0, 0, 0, 1, 1, 0 }, /* SMC2_DTR */ @@ -79,20 +85,20 @@ const iop_conf_t iop_conf_tab[4][32] = { /* Port B configuration */ { /* conf ppar psor pdir podr pdat */ - /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */ - /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */ - /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */ - /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */ - /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */ - /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */ - /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */ - /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */ - /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */ - /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */ - /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */ - /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */ - /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */ - /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */ + /* PB31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */ + /* PB30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */ + /* PB29 */ { 0, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */ + /* PB28 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */ + /* PB27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */ + /* PB26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */ + /* PB25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */ + /* PB24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */ + /* PB23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */ + /* PB22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */ + /* PB21 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */ + /* PB20 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */ + /* PB19 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */ + /* PB18 */ { 0, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */ /* PB17 */ { 0, 0, 0, 0, 0, 0 }, /* PB17 */ /* PB16 */ { 0, 0, 0, 0, 0, 0 }, /* PB16 */ /* PB15 */ { 0, 0, 0, 0, 0, 0 }, /* PB15 */ @@ -123,8 +129,8 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */ /* PC25 */ { 0, 1, 1, 0, 0, 0 }, /* SYNC_IN */ /* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */ - /* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */ - /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */ + /* PC23 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII TX_CLK */ + /* PC22 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RX_CLK */ /* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */ /* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */ /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK */ @@ -180,7 +186,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */ /* PD9 */ { 0, 0, 0, 0, 0, 0 }, /* PD9 */ /* PD8 */ { 0, 0, 0, 0, 0, 0 }, /* PD8 */ - /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* MII_MDIO */ + /* PD7 */ { 1, 0, 0, 1, 0, 1 }, /* MII_MDIO */ /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */ /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */ /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */ @@ -224,7 +230,7 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr, * mapped by the controller. That means, that the initial mapping has * to be (at least) twice as large as the maximum expected size. */ - maxsize = (1 + (~orx | 0x7fff)) / 2; + maxsize = (1 + (~orx | 0x7fff))/* / 2*/; sdmr_ptr = &memctl->memc_psdmr; orx_ptr = &memctl->memc_or2; @@ -315,4 +321,38 @@ nand_init (void) printf ("%4lu MB\n", totlen >>20); } -#endif +#endif /* CFG_CMD_NAND */ + +#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) +/* + * update "memory" property in the blob + */ +void ft_blob_update(void *blob, bd_t *bd) +{ + int ret, nodeoffset = 0; + ulong memory_data[2] = {0}; + + memory_data[0] = cpu_to_be32(bd->bi_memstart); + memory_data[1] = cpu_to_be32(bd->bi_memsize); + + nodeoffset = fdt_find_node_by_path (blob, "/memory"); + if (nodeoffset >= 0) { + ret = fdt_setprop(blob, nodeoffset, "reg", memory_data, + sizeof(memory_data)); + if (ret < 0) + printf("ft_blob_update): cannot set /memory/reg " + "property err:%s\n", fdt_strerror(ret)); + } + else { + /* memory node is required in dts */ + printf("ft_blob_update(): cannot find /memory node " + "err:%s\n", fdt_strerror(nodeoffset)); + } +} + +void ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup( blob, bd); + ft_blob_update(blob, bd); +} +#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ diff --git a/board/incaip/incaip.c b/board/incaip/incaip.c index b5d9e00492..dbf0ecc5af 100644 --- a/board/incaip/incaip.c +++ b/board/incaip/incaip.c @@ -25,7 +25,7 @@ #include #include #include - +#include extern uint incaip_get_cpuclk(void); @@ -85,7 +85,6 @@ long int initdram(int board_type) int checkboard (void) { - unsigned long chipid = *INCA_IP_WDT_CHIPID; int part_num; @@ -107,5 +106,7 @@ int checkboard (void) printf("CPU Speed %d MHz\n", incaip_get_cpuclk()/1000000); + set_io_port_base(0); + return 0; } diff --git a/board/incaip/u-boot.lds b/board/incaip/u-boot.lds index 10c9917986..861873272b 100644 --- a/board/incaip/u-boot.lds +++ b/board/incaip/u-boot.lds @@ -43,21 +43,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } - - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; - - .sdata : { *(.sdata) } - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + _gp = ALIGN(16) + 0x7ff0; + + .got : { + __got_start = .; + *(.got) + __got_end = .; + } + + .sdata : { *(.sdata) } + + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index 77f998971a..9b24a7e55e 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -96,6 +96,23 @@ int board_early_init_f(void) gpio_write_bit(CFG_GPIO_FLASH_WP, 1); + /* + * Reset PHY's: + * The PHY's need a 2nd reset pulse, since the MDIO address is latched + * upon reset, and with the first reset upon powerup, the addresses are + * not latched reliable, since the IRQ line is multiplexed with an + * MDIO address. A 2nd reset at this time will make sure, that the + * correct address is latched. + */ + gpio_write_bit(CFG_GPIO_PHY0_RST, 1); + gpio_write_bit(CFG_GPIO_PHY1_RST, 1); + udelay(1000); + gpio_write_bit(CFG_GPIO_PHY0_RST, 0); + gpio_write_bit(CFG_GPIO_PHY1_RST, 0); + udelay(1000); + gpio_write_bit(CFG_GPIO_PHY0_RST, 1); + gpio_write_bit(CFG_GPIO_PHY1_RST, 1); + return 0; } @@ -230,15 +247,6 @@ int misc_init_r(void) /* Write lime controller memory parameters */ out_be32((void *)CFG_LIME_MMR, CFG_LIME_MMR_VALUE); - /* - * Reset PHY's - */ - gpio_write_bit(CFG_GPIO_PHY0_RST, 0); - gpio_write_bit(CFG_GPIO_PHY1_RST, 0); - udelay(100); - gpio_write_bit(CFG_GPIO_PHY0_RST, 1); - gpio_write_bit(CFG_GPIO_PHY1_RST, 1); - /* * Init display controller */ diff --git a/board/m5282evb/m5282evb.c b/board/m5282evb/m5282evb.c index 243d6a4d83..7d6d1d6231 100644 --- a/board/m5282evb/m5282evb.c +++ b/board/m5282evb/m5282evb.c @@ -89,4 +89,5 @@ long int initdram (int board_type) /* Write to the SDRAM Mode Register */ *(u32 *)(CFG_SDRAM_BASE + 0x400) = 0xA5A59696; } + return dramsize; } diff --git a/board/mousse/u-boot.lds b/board/mousse/u-boot.lds index eb4d8e4e2b..57358b8a49 100644 --- a/board/mousse/u-boot.lds +++ b/board/mousse/u-boot.lds @@ -60,6 +60,7 @@ SECTIONS lib_generic/crc32.o (.text) lib_generic/zlib.o (.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c index 227c49272c..90a1b08e24 100644 --- a/board/mpl/vcma9/cmd_vcma9.c +++ b/board/mpl/vcma9/cmd_vcma9.c @@ -31,7 +31,7 @@ #include "../common/common_util.h" #if defined(CONFIG_DRIVER_CS8900) -#include <../drivers/cs8900.h> +#include <../drivers/net/cs8900.h> static uchar cs8900_chksum(ushort data) { diff --git a/board/mpl/vcma9/flash.c b/board/mpl/vcma9/flash.c index ccfe1768f6..d15a19115e 100644 --- a/board/mpl/vcma9/flash.c +++ b/board/mpl/vcma9/flash.c @@ -290,7 +290,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) * Copy memory to flash */ -volatile static int write_hword (flash_info_t * info, ulong dest, ushort data) +static int write_hword (flash_info_t * info, ulong dest, ushort data) { vu_short *addr = (vu_short *) dest; ushort result; diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h index 7a32343748..220b7053ba 100644 --- a/board/mpl/vcma9/vcma9.h +++ b/board/mpl/vcma9/vcma9.h @@ -128,7 +128,7 @@ typedef struct { } /*__attribute__((__packed__))*/ VCMA9_PLD; #define VCMA9_PLD_BASE 0x2C000100 -static inline VCMA9_PLD * const VCMA9_GetBase_PLD(void) +static inline VCMA9_PLD * VCMA9_GetBase_PLD(void) { return (VCMA9_PLD * const)VCMA9_PLD_BASE; } diff --git a/board/netstar/eeprom.c b/board/netstar/eeprom.c index fef3822aae..0de594b65f 100644 --- a/board/netstar/eeprom.c +++ b/board/netstar/eeprom.c @@ -26,7 +26,7 @@ #include #include -#include "../drivers/smc91111.h" +#include "../drivers/net/smc91111.h" #define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE diff --git a/board/pb1x00/Makefile b/board/pb1x00/Makefile index f7d58416c9..afe02c27c6 100644 --- a/board/pb1x00/Makefile +++ b/board/pb1x00/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a COBJS = $(BOARD).o flash.o -SOBJS = memsetup.o +SOBJS = lowlevel_init.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/pb1x00/memsetup.S b/board/pb1x00/lowlevel_init.S similarity index 99% rename from board/pb1x00/memsetup.S rename to board/pb1x00/lowlevel_init.S index 44f02b9555..e851e2fed0 100644 --- a/board/pb1x00/memsetup.S +++ b/board/pb1x00/lowlevel_init.S @@ -15,8 +15,8 @@ .set noreorder .set mips32 - .globl memsetup -memsetup: + .globl lowlevel_init +lowlevel_init: /* * Step 1) Establish CPU endian mode. * NOTE: A fair amount of code is necessary on the Pb1000 to diff --git a/board/pb1x00/pb1x00.c b/board/pb1x00/pb1x00.c index 40ac2a4d7c..536c9544f5 100644 --- a/board/pb1x00/pb1x00.c +++ b/board/pb1x00/pb1x00.c @@ -25,6 +25,7 @@ #include #include #include +#include long int initdram(int board_type) { @@ -41,7 +42,9 @@ void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 ); int checkboard (void) { +#if defined(CONFIG_IDE_PCMCIA) && 0 u16 status; +#endif /* volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10); */ volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL; u32 proc_id; @@ -69,6 +72,9 @@ int checkboard (void) default: printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id); } + + set_io_port_base(0); + #if defined(CONFIG_IDE_PCMCIA) && 0 /* Enable 3.3 V on slot 0 ( VCC ) No 5V */ diff --git a/board/pb1x00/u-boot.lds b/board/pb1x00/u-boot.lds index a2d19a84c9..861873272b 100644 --- a/board/pb1x00/u-boot.lds +++ b/board/pb1x00/u-boot.lds @@ -43,20 +43,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } + . = .; + _gp = ALIGN(16) + 0x7ff0; - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; + .got : { + __got_start = .; + *(.got) + __got_end = .; + } .sdata : { *(.sdata) } - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/pleb2/flash.c b/board/pleb2/flash.c index 97271d921e..5a1eba6b3f 100644 --- a/board/pleb2/flash.c +++ b/board/pleb2/flash.c @@ -196,7 +196,7 @@ void flash_print_info (flash_info_t * info) int i; uchar *boottype; uchar *bootletter; - uchar *fmt; + char *fmt; uchar botbootletter[] = "B"; uchar topbootletter[] = "T"; uchar botboottype[] = "bottom boot sector"; diff --git a/board/purple/flash.c b/board/purple/flash.c index 7522580808..1baae35eb8 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c @@ -299,7 +299,7 @@ void flash_print_info (flash_info_t *info) int i; uchar *boottype; uchar *bootletter; - uchar *fmt; + char *fmt; uchar botbootletter[] = "B"; uchar topbootletter[] = "T"; uchar botboottype[] = "bottom boot sector"; diff --git a/board/purple/purple.c b/board/purple/purple.c index 4c3e5b44b5..74718afb48 100644 --- a/board/purple/purple.c +++ b/board/purple/purple.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -145,6 +146,8 @@ int checkboard (void) printf("CPU Speed %d MHz\n", CPU_CLOCK_RATE/1000000); + set_io_port_base(0); + return 0; } diff --git a/board/purple/u-boot.lds b/board/purple/u-boot.lds index 1bdac1f4a6..50e7f848e9 100644 --- a/board/purple/u-boot.lds +++ b/board/purple/u-boot.lds @@ -53,21 +53,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } - - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; - - .sdata : { *(.sdata) } - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + _gp = ALIGN(16) + 0x7ff0; + + .got : { + __got_start = .; + *(.got) + __got_end = .; + } + + .sdata : { *(.sdata) } + + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/rsdproto/rsdproto.c b/board/rsdproto/rsdproto.c index bf4fd5305f..312d4b8605 100644 --- a/board/rsdproto/rsdproto.c +++ b/board/rsdproto/rsdproto.c @@ -210,7 +210,7 @@ void read_RS5C372_time (struct tm *timedate) #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) - if (i2c_read (RS5C372_PPC_I2C_ADR, 0, 1, buffer, sizeof (buffer))) { + if (! i2c_read (RS5C372_PPC_I2C_ADR, 0, 1, buffer, sizeof (buffer))) { timedate->tm_sec = BCD_TO_BIN (buffer[0]); timedate->tm_min = BCD_TO_BIN (buffer[1]); timedate->tm_hour = BCD_TO_BIN (buffer[2]); @@ -231,7 +231,7 @@ int read_LM84_temp (int address) unsigned char buffer[8]; /*int rc;*/ - if (i2c_read (address, 0, 1, buffer, 1)) { + if (! i2c_read (address, 0, 1, buffer, 1)) { return (int) buffer[0]; } else { /*printf("i2c error %02x\n", rc); */ diff --git a/board/rsdproto/u-boot.lds b/board/rsdproto/u-boot.lds index 9bd6248095..70fc3a5d27 100644 --- a/board/rsdproto/u-boot.lds +++ b/board/rsdproto/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { cpu/mpc8260/start.o (.text) *(.text) + *(.fixup) *(.got1) /*. = env_offset; */ } diff --git a/board/sbc2410x/flash.c b/board/sbc2410x/flash.c index f2718f256f..0c669e4d76 100644 --- a/board/sbc2410x/flash.c +++ b/board/sbc2410x/flash.c @@ -288,7 +288,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) * Copy memory to flash */ -volatile static int write_hword (flash_info_t * info, ulong dest, ushort data) +static int write_hword (flash_info_t * info, ulong dest, ushort data) { vu_short *addr = (vu_short *) dest; ushort result; diff --git a/board/smdk2410/flash.c b/board/smdk2410/flash.c index 993946be93..376930bd3c 100644 --- a/board/smdk2410/flash.c +++ b/board/smdk2410/flash.c @@ -290,7 +290,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) * Copy memory to flash */ -volatile static int write_hword (flash_info_t * info, ulong dest, ushort data) +static int write_hword (flash_info_t * info, ulong dest, ushort data) { vu_short *addr = (vu_short *) dest; ushort result; diff --git a/board/tb0229/tb0229.c b/board/tb0229/tb0229.c index e7914bd15b..61c2e9bd36 100644 --- a/board/tb0229/tb0229.c +++ b/board/tb0229/tb0229.c @@ -13,10 +13,9 @@ #include #include #include +#include #include -unsigned long mips_io_port_base = 0; - #if defined(CONFIG_PCI) static struct pci_controller hose; @@ -26,17 +25,17 @@ void pci_init_board (void) } #endif - long int initdram(int board_type) { return get_ram_size (CFG_SDRAM_BASE, 0x8000000); } - int checkboard (void) { printf("Board: TANBAC TB0229 "); printf("(CPU Speed %d MHz)\n", (int)CPU_CLOCK_RATE/1000000); + set_io_port_base(0); + return 0; } diff --git a/board/tb0229/u-boot.lds b/board/tb0229/u-boot.lds index 30a2bc57ea..c629040a08 100644 --- a/board/tb0229/u-boot.lds +++ b/board/tb0229/u-boot.lds @@ -43,21 +43,22 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } - - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; - - .sdata : { *(.sdata) } - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; + _gp = ALIGN(16) + 0x7ff0; + + .got : { + __got_start = .; + *(.got) + __got_end = .; + } + + .sdata : { *(.sdata) } + + .u_boot_cmd : { + __u_boot_cmd_start = .; + *(.u_boot_cmd) + __u_boot_cmd_end = .; + } uboot_end_data = .; num_got_entries = (__got_end - __got_start) >> 2; diff --git a/board/tqm5200/tqm5200.c b/board/tqm5200/tqm5200.c index d10cb5937d..f33d17258d 100644 --- a/board/tqm5200/tqm5200.c +++ b/board/tqm5200/tqm5200.c @@ -441,15 +441,23 @@ ulong post_word_load (void) } #endif /* CONFIG_POST || CONFIG_LOGBUFFER*/ -#ifdef CONFIG_PS2MULT #ifdef CONFIG_BOARD_EARLY_INIT_R int board_early_init_r (void) { + extern int usb_cpu_init(void); + +#ifdef CONFIG_PS2MULT ps2mult_early_init(); +#endif /* CONFIG_PS2MULT */ + +#if defined(CONFIG_USB_OHCI_NEW) && defined(CFG_USB_OHCI_CPU_INIT) + /* Low level USB init, required for proper kernel operation */ + usb_cpu_init(); +#endif + return (0); } #endif -#endif /* CONFIG_PS2MULT */ #ifdef CONFIG_FO300 int silent_boot (void) @@ -585,9 +593,9 @@ int last_stage_init (void) disable_ctrlc(1); } #endif +#endif /* !CONFIG_TQM5200S */ return 0; -#endif /* !CONFIG_TQM5200S */ } #ifdef CONFIG_VIDEO_SM501 diff --git a/board/voiceblue/eeprom.c b/board/voiceblue/eeprom.c index 0ad1b666b9..d8ea6e5731 100644 --- a/board/voiceblue/eeprom.c +++ b/board/voiceblue/eeprom.c @@ -26,7 +26,7 @@ #include #include -#include "../drivers/smc91111.h" +#include "../drivers/net/smc91111.h" #define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE diff --git a/board/wepep250/flash.c b/board/wepep250/flash.c index 2a322903d5..e2e08f742d 100644 --- a/board/wepep250/flash.c +++ b/board/wepep250/flash.c @@ -44,6 +44,7 @@ #if ( WEP_FLASH_BUS_WIDTH == 1 ) # define FLASH_BUS vu_char +# define FLASH_BUS_RET u_char # if ( WEP_FLASH_INTERLEAVE == 1 ) # define FLASH_CMD( x ) x # else @@ -53,6 +54,7 @@ #elif ( WEP_FLASH_BUS_WIDTH == 2 ) # define FLASH_BUS vu_short +# define FLASH_BUS_RET u_short # if ( WEP_FLASH_INTERLEAVE == 1 ) # define FLASH_CMD( x ) x # elif ( WEP_FLASH_INTERLEAVE == 2 ) @@ -64,6 +66,7 @@ #elif ( WEP_FLASH_BUS_WIDTH == 4 ) # define FLASH_BUS vu_long +# define FLASH_BUS_RET u_long # if ( WEP_FLASH_INTERLEAVE == 1 ) # define FLASH_CMD( x ) x # elif ( WEP_FLASH_INTERLEAVE == 2 ) @@ -81,7 +84,7 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; -static FLASH_BUS flash_status_reg (void) +static FLASH_BUS_RET flash_status_reg (void) { FLASH_BUS *addr = (FLASH_BUS *) 0; diff --git a/common/Makefile b/common/Makefile index fde5ad903d..ace8cc7edc 100644 --- a/common/Makefile +++ b/common/Makefile @@ -27,32 +27,113 @@ LIB = $(obj)libcommon.a AOBJS = -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 \ - cmd_eeprom.o cmd_elf.o cmd_ext2.o \ - cmd_fat.o cmd_fdc.o cmd_fdt.o cmd_fdos.o cmd_flash.o cmd_fpga.o \ - cmd_i2c.o cmd_ide.o cmd_immap.o cmd_itest.o cmd_jffs2.o \ - cmd_load.o cmd_log.o \ - cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \ - cmd_nand.o cmd_net.o cmd_nvedit.o \ - cmd_onenand.o \ - cmd_pci.o cmd_pcmcia.o cmd_portio.o \ - cmd_reginfo.o cmd_reiser.o cmd_sata.o cmd_scsi.o cmd_spi.o \ - cmd_universe.o cmd_usb.o cmd_vfd.o \ - command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \ - environment.o env_common.o \ - env_nand.o env_dataflash.o env_flash.o env_eeprom.o \ - env_onenand.o env_nvram.o env_nowhere.o \ - exports.o \ - fdt_support.o flash.o fpga.o ft_build.o \ - hush.o kgdb.o lcd.o lists.o lynxkdi.o \ - memsize.o miiphybb.o miiphyutil.o \ - s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \ - usb.o usb_kbd.o usb_storage.o \ - virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o cmd_mfsl.o +COBJS-y += main.o +COBJS-y += ACEX1K.o +COBJS-y += altera.o +COBJS-y += bedbug.o +COBJS-y += circbuf.o +COBJS-y += cmd_autoscript.o +COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o +COBJS-$(CONFIG_CMD_BEDBUG) += cmd_bedbug.o +COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o +COBJS-y += cmd_boot.o +COBJS-y += cmd_bootm.o +COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o +COBJS-$(CONFIG_CMD_DATE) += cmd_date.o +ifdef CONFIG_4xx +COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o +endif +ifdef CONFIG_POST +COBJS-$(CONFIG_CMD_DIAG) += cmd_diag.o +endif +COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o +COBJS-$(CONFIG_CMD_DOC) += cmd_doc.o +COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o +COBJS-y += cmd_eeprom.o +COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o +COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o +COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o +COBJS-y += cmd_fdc.o +COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o +COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o +COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o +ifdef CONFIG_FPGA +COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o +endif +COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o +COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o +COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o +COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o +COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o +COBJS-y += cmd_load.o +COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o +COBJS-y += cmd_mem.o +COBJS-$(CONFIG_CMD_MII) += cmd_mii.o +COBJS-$(CONFIG_CMD_MISC) += cmd_misc.o +COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o +COBJS-y += cmd_nand.o +COBJS-$(CONFIG_CMD_NET) += cmd_net.o +COBJS-y += cmd_nvedit.o +COBJS-y += cmd_onenand.o +ifdef CONFIG_PCI +COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o +endif +COBJS-y += cmd_pcmcia.o +COBJS-$(CONFIG_CMD_PORTIO) += cmd_portio.o +COBJS-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o +COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o +COBJS-y += cmd_sata.o +COBJS-$(CONFIG_CMD_SCSI) += cmd_scsi.o +COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o +COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o +COBJS-$(CONFIG_CMD_USB) += cmd_usb.o +COBJS-y += cmd_vfd.o +COBJS-y += command.o +COBJS-y += console.o +COBJS-y += cyclon2.o +COBJS-y += devices.o +COBJS-y += dlmalloc.o +COBJS-y += docecc.o +COBJS-y += environment.o +COBJS-y += env_common.o +COBJS-y += env_nand.o +COBJS-y += env_dataflash.o +COBJS-y += env_flash.o +COBJS-y += env_eeprom.o +COBJS-y += env_onenand.o +COBJS-y += env_nvram.o +COBJS-y += env_nowhere.o +COBJS-y += exports.o +COBJS-y += fdt_support.o +COBJS-y += flash.o +COBJS-y += fpga.o +COBJS-y += ft_build.o +COBJS-y += hush.o +COBJS-y += kgdb.o +COBJS-y += lcd.o +COBJS-y += lists.o +COBJS-y += lynxkdi.o +COBJS-y += memsize.o +COBJS-y += miiphybb.o +COBJS-y += miiphyutil.o +COBJS-y += s_record.o +COBJS-y += serial.o +COBJS-y += soft_i2c.o +COBJS-y += soft_spi.o +COBJS-y += spartan2.o +COBJS-y += spartan3.o +COBJS-y += usb.o +COBJS-y += usb_kbd.o +COBJS-y += usb_storage.o +COBJS-y += virtex2.o +COBJS-y += xilinx.o +COBJS-y += crc16.o +COBJS-y += xyzModem.o +COBJS-y += cmd_mac.o +COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o +COBJS := $(COBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index ef15a006cd..d05998366b 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -30,7 +30,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_CMD_BDI) static void print_num(const char *, ulong); #ifndef CONFIG_ARM /* PowerPC and other */ @@ -350,4 +349,3 @@ U_BOOT_CMD( "bdinfo - print Board Info structure\n", NULL ); -#endif diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index 1c3547a1fc..94f7e0847b 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -13,8 +13,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_CMD_BEDBUG) - #ifndef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif @@ -413,7 +411,6 @@ int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump, "rdump - Show registers.\n", " - Show registers.\n"); /* ====================================================================== */ -#endif /* diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index 241aa8357a..907f9a2db7 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -31,8 +31,6 @@ #include #include -#if defined(CONFIG_CMD_BMP) - static int bmp_info (ulong addr); static int bmp_display (ulong addr, int x, int y); @@ -187,5 +185,3 @@ static int bmp_display(ulong addr, int x, int y) # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO #endif } - -#endif /* defined(CONFIG_CMD_BMP) */ diff --git a/common/cmd_console.c b/common/cmd_console.c index 5e0f990723..50ddb011cd 100644 --- a/common/cmd_console.c +++ b/common/cmd_console.c @@ -28,8 +28,6 @@ #include #include -#if defined(CONFIG_CMD_CONSOLE) - extern void _do_coninfo (void); int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[]) { @@ -67,5 +65,3 @@ U_BOOT_CMD( "coninfo - print console devices and information\n", "" ); - -#endif diff --git a/common/cmd_date.c b/common/cmd_date.c index 4a42534900..751159847a 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -31,8 +31,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_CMD_DATE) - const char *weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; @@ -210,5 +208,3 @@ U_BOOT_CMD( " - with numeric argument: set the system date & time\n" " - with 'reset' argument: reset the RTC\n" ); - -#endif diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 12fa9db08d..a053343abe 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -29,8 +29,6 @@ #include #include -#if defined(CONFIG_4xx) && defined(CONFIG_CMD_SETGETDCR) - unsigned long get_dcr (unsigned short); unsigned long set_dcr (unsigned short, unsigned long); @@ -245,5 +243,3 @@ U_BOOT_CMD( "setidcr - Set a register value via indirect DCR addressing\n", "adr_dcrn[.dat_dcrn] offset value - write offset to adr_dcrn, write value to dat_dcrn.\n" ); - -#endif diff --git a/common/cmd_diag.c b/common/cmd_diag.c index cb99b7700f..82d5ad3134 100644 --- a/common/cmd_diag.c +++ b/common/cmd_diag.c @@ -28,8 +28,6 @@ #include #include -#if defined(CONFIG_CMD_DIAG) && defined(CONFIG_POST) - int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { unsigned int i; @@ -76,5 +74,3 @@ U_BOOT_CMD( "diag run [test1 [test2]]\n" " - run specified tests\n" ); - -#endif diff --git a/common/cmd_display.c b/common/cmd_display.c index d19f412819..a29345c6ba 100644 --- a/common/cmd_display.c +++ b/common/cmd_display.c @@ -24,8 +24,6 @@ #include #include -#if defined(CONFIG_CMD_DISPLAY) - #undef DEBUG_DISP #define DISP_SIZE 8 @@ -78,5 +76,3 @@ U_BOOT_CMD( " - with argument: display on dot matrix display\n" " - without arguments: clear dot matrix display\n" ); - -#endif diff --git a/common/cmd_doc.c b/common/cmd_doc.c index d6d3aff8c8..3d717c039d 100644 --- a/common/cmd_doc.c +++ b/common/cmd_doc.c @@ -11,9 +11,6 @@ #include #include #include - -#if defined(CONFIG_CMD_DOC) - #include #include @@ -1607,5 +1604,3 @@ void doc_probe(unsigned long physadr) puts ("No DiskOnChip found\n"); } } - -#endif diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c index 804d467f25..956dc69dae 100644 --- a/common/cmd_dtt.c +++ b/common/cmd_dtt.c @@ -25,8 +25,6 @@ #include #include -#if defined(CONFIG_CMD_DTT) - #include #include @@ -60,5 +58,3 @@ U_BOOT_CMD( "dtt - Digital Thermometer and Thermostat\n", " - Read temperature from digital thermometer and thermostat.\n" ); - -#endif diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 63a5593e43..2eb7453156 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -23,8 +23,6 @@ DECLARE_GLOBAL_DATA_PTR; #endif -#if defined(CONFIG_CMD_ELF) - #ifndef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif @@ -323,5 +321,3 @@ U_BOOT_CMD( "bootvx - Boot vxWorks from an ELF image\n", " [address] - load address of vxWorks ELF image.\n" ); - -#endif diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index 8bd2b476e5..f569406432 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -34,8 +34,6 @@ */ #include #include - -#if defined(CONFIG_CMD_EXT2) #include #include #include @@ -259,5 +257,3 @@ U_BOOT_CMD( " - load binary file 'filename' from 'dev' on 'interface'\n" " to address 'addr' from ext2 filesystem\n" ); - -#endif diff --git a/common/cmd_fat.c b/common/cmd_fat.c index 54f0f9f9ce..9576cdf389 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -30,11 +30,6 @@ #include #include #include - -#if defined(CONFIG_CMD_FAT) - -#undef DEBUG - #include @@ -323,5 +318,3 @@ void hexdump (int cnt, unsigned char *data) } } #endif /* NOT_IMPLEMENTED_YET */ - -#endif diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index f9da98ddcc..b3dbd19fae 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -31,8 +31,6 @@ #include #include -#if defined(CONFIG_CMD_FDOS) - /*----------------------------------------------------------------------------- * do_fdosboot -- *----------------------------------------------------------------------------- @@ -153,5 +151,3 @@ U_BOOT_CMD( "fdosls - list files in a directory\n", "[directory]\n" ); - -#endif diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 571b8f14d5..629c9b413e 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -28,9 +28,6 @@ #include #include #include - -#ifdef CONFIG_OF_LIBFDT - #include #include #include @@ -47,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; static int fdt_valid(void); static int fdt_parse_prop(char *pathp, char *prop, char *newval, char *data, int *len); -static int fdt_print(char *pathp, char *prop, int depth); +static int fdt_print(const char *pathp, char *prop, int depth); /* * Flattened Device Tree command, see the help for parameter definitions. @@ -78,7 +75,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) /* * Optional new length */ - len = simple_strtoul(argv[3], NULL, 16); + len = simple_strtoul(argv[3], NULL, 16); if (len < fdt_totalsize(fdt)) { printf ("New length %d < existing length %d, " "ignoring.\n", @@ -165,12 +162,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) pathp = argv[2]; nodep = argv[3]; - nodeoffset = fdt_find_node_by_path (fdt, pathp); + nodeoffset = fdt_path_offset (fdt, pathp); if (nodeoffset < 0) { /* * Not found or something else bad happened. */ - printf ("libfdt fdt_find_node_by_path() returned %s\n", + printf ("libfdt fdt_path_offset() returned %s\n", fdt_strerror(nodeoffset)); return 1; } @@ -205,12 +202,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) prop = argv[3]; newval = argv[4]; - nodeoffset = fdt_find_node_by_path (fdt, pathp); + nodeoffset = fdt_path_offset (fdt, pathp); if (nodeoffset < 0) { /* * Not found or something else bad happened. */ - printf ("libfdt fdt_find_node_by_path() returned %s\n", + printf ("libfdt fdt_path_offset() returned %s\n", fdt_strerror(nodeoffset)); return 1; } @@ -232,6 +229,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) char *pathp; /* path */ char *prop; /* property */ int ret; /* return value */ + static char root[2] = "/"; /* * list is an alias for print, but limited to 1 level @@ -244,7 +242,10 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) * Get the starting path. The root node is an oddball, * the offset is zero and has no name. */ - pathp = argv[2]; + if (argc == 2) + pathp = root; + else + pathp = argv[2]; if (argc > 3) prop = argv[3]; else @@ -265,12 +266,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) * Get the path. The root node is an oddball, the offset * is zero and has no name. */ - nodeoffset = fdt_find_node_by_path (fdt, argv[2]); + nodeoffset = fdt_path_offset (fdt, argv[2]); if (nodeoffset < 0) { /* * Not found or something else bad happened. */ - printf ("libfdt fdt_find_node_by_path() returned %s\n", + printf ("libfdt fdt_path_offset() returned %s\n", fdt_strerror(nodeoffset)); return 1; } @@ -521,21 +522,21 @@ static void print_data(const void *data, int len) switch (len) { case 1: /* byte */ - printf("<%02x>", (*(u8 *) data) & 0xff); + printf("<0x%02x>", (*(u8 *) data) & 0xff); break; case 2: /* half-word */ - printf("<%04x>", be16_to_cpu(*(u16 *) data) & 0xffff); + printf("<0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff); break; case 4: /* word */ - printf("<%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); + printf("<0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); break; case 8: /* double-word */ #if __WORDSIZE == 64 - printf("<%016llx>", be64_to_cpu(*(uint64_t *) data)); + printf("<0x%016llx>", be64_to_cpu(*(uint64_t *) data)); #else - printf("<%08x ", be32_to_cpu(*(u32 *) data) & 0xffffffffU); + printf("<0x%08x ", be32_to_cpu(*(u32 *) data) & 0xffffffffU); data += 4; - printf("%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); + printf("0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); #endif break; default: /* anything else... hexdump */ @@ -554,25 +555,25 @@ static void print_data(const void *data, int len) * Recursively print (a portion of) the fdt. The depth parameter * determines how deeply nested the fdt is printed. */ -static int fdt_print(char *pathp, char *prop, int depth) +static int fdt_print(const char *pathp, char *prop, int depth) { - static int offstack[MAX_LEVEL]; static char tabs[MAX_LEVEL+1] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; - void *nodep; /* property node pointer */ + const void *nodep; /* property node pointer */ int nodeoffset; /* node offset from libfdt */ int nextoffset; /* next node offset from libfdt */ uint32_t tag; /* tag */ int len; /* length of the property */ int level = 0; /* keep track of nesting level */ + const struct fdt_property *fdt_prop; - nodeoffset = fdt_find_node_by_path (fdt, pathp); + nodeoffset = fdt_path_offset (fdt, pathp); if (nodeoffset < 0) { /* * Not found or something else bad happened. */ - printf ("libfdt fdt_find_node_by_path() returned %s\n", + printf ("libfdt fdt_path_offset() returned %s\n", fdt_strerror(nodeoffset)); return 1; } @@ -602,45 +603,52 @@ static int fdt_print(char *pathp, char *prop, int depth) * The user passed in a node path and no property, * print the node and all subnodes. */ - offstack[0] = nodeoffset; - while(level >= 0) { - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, &pathp); + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); switch(tag) { case FDT_BEGIN_NODE: - if(level <= depth) + pathp = fdt_get_name(fdt, nodeoffset, NULL); + if (level <= depth) { + if (pathp == NULL) + pathp = "/* NULL pointer error */"; + if (*pathp == '\0') + pathp = "/"; /* root is nameless */ printf("%s%s {\n", &tabs[MAX_LEVEL - level], pathp); + } level++; - offstack[level] = nodeoffset; if (level >= MAX_LEVEL) { - printf("Aaaiii nested too deep. " - "Aborting.\n"); + printf("Nested too deep, aborting.\n"); return 1; } break; case FDT_END_NODE: level--; - if(level <= depth) + if (level <= depth) printf("%s};\n", &tabs[MAX_LEVEL - level]); if (level == 0) { level = -1; /* exit the loop */ } break; case FDT_PROP: - nodep = fdt_getprop (fdt, offstack[level], pathp, &len); + fdt_prop = fdt_offset_ptr(fdt, nodeoffset, + sizeof(*fdt_prop)); + pathp = fdt_string(fdt, + fdt32_to_cpu(fdt_prop->nameoff)); + len = fdt32_to_cpu(fdt_prop->len); + nodep = fdt_prop->data; if (len < 0) { printf ("libfdt fdt_getprop(): %s\n", fdt_strerror(len)); return 1; } else if (len == 0) { /* the property has no value */ - if(level <= depth) + if (level <= depth) printf("%s%s;\n", &tabs[MAX_LEVEL - level], pathp); } else { - if(level <= depth) { + if (level <= depth) { printf("%s%s=", &tabs[MAX_LEVEL - level], pathp); @@ -650,11 +658,12 @@ static int fdt_print(char *pathp, char *prop, int depth) } break; case FDT_NOP: + printf("/* NOP */\n", &tabs[MAX_LEVEL - level]); break; case FDT_END: return 1; default: - if(level <= depth) + if (level <= depth) printf("Unknown tag 0x%08X\n", tag); return 1; } @@ -692,5 +701,3 @@ U_BOOT_CMD( " fdt print /cpus \"#address-cells\"\n" " fdt set /cpus \"#address-cells\" \"[00 00 00 01]\"\n" ); - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 11c8857313..f56443e25e 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -31,8 +31,6 @@ #include #endif -#if defined(CONFIG_CMD_FLASH) - #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE) #include @@ -731,5 +729,3 @@ U_BOOT_CMD( #undef TMP_ERASE #undef TMP_PROT_ON #undef TMP_PROT_OFF - -#endif diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index cce23ad70d..377a692f7d 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -43,8 +43,6 @@ #define PRINTF(fmt,args...) #endif -#if defined (CONFIG_FPGA) && defined(CONFIG_CMD_FPGA) - /* Local functions */ static void fpga_usage (cmd_tbl_t * cmdtp); static int fpga_get_op (char *opstr); @@ -321,4 +319,3 @@ U_BOOT_CMD (fpga, 6, 1, do_fpga, "\tloadb\tLoad device from bitstream buffer (Xilinx devices only)\n" "\tloadmk\tLoad device generated with mkimage\n" "\tdump\tLoad device to memory buffer\n"); -#endif diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index a684a580e6..10cab4609a 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -86,9 +86,6 @@ #include #include -#if defined(CONFIG_CMD_I2C) - - /* Display values from last command. * Memory modify remembered values are different from display memory. */ @@ -1024,5 +1021,3 @@ U_BOOT_CMD( " (valid chip values 50..57)\n" ); #endif - -#endif diff --git a/common/cmd_ide.c b/common/cmd_ide.c index bb064eaa04..821dcff9bf 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -54,10 +54,6 @@ #ifndef __PPC__ #include -#ifdef __MIPS__ -/* Macros depend on this variable */ -unsigned long mips_io_port_base = 0; -#endif #endif #ifdef CONFIG_IDE_8xx_DIRECT @@ -72,8 +68,6 @@ DECLARE_GLOBAL_DATA_PTR; # define SYNC /* nothing */ #endif -#if defined(CONFIG_CMD_IDE) - #ifdef CONFIG_IDE_8xx_DIRECT /* Timings for IDE Interface * @@ -1136,9 +1130,9 @@ static void ide_ident (block_dev_desc_t *dev_desc) input_swap_data (device, iobuf, ATA_SECTORWORDS); - ident_cpy (dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision)); - ident_cpy (dev_desc->vendor, iop->model, sizeof(dev_desc->vendor)); - ident_cpy (dev_desc->product, iop->serial_no, sizeof(dev_desc->product)); + ident_cpy ((unsigned char*)dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision)); + ident_cpy ((unsigned char*)dev_desc->vendor, iop->model, sizeof(dev_desc->vendor)); + ident_cpy ((unsigned char*)dev_desc->product, iop->serial_no, sizeof(dev_desc->product)); #ifdef __LITTLE_ENDIAN /* * firmware revision and model number have Big Endian Byte @@ -1953,9 +1947,9 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc) return; /* copy device ident strings */ - ident_cpy(dev_desc->vendor,&iobuf[8],8); - ident_cpy(dev_desc->product,&iobuf[16],16); - ident_cpy(dev_desc->revision,&iobuf[32],5); + ident_cpy((unsigned char*)dev_desc->vendor,&iobuf[8],8); + ident_cpy((unsigned char*)dev_desc->product,&iobuf[16],16); + ident_cpy((unsigned char*)dev_desc->revision,&iobuf[32],5); dev_desc->lun=0; dev_desc->lba=0; @@ -2085,5 +2079,3 @@ U_BOOT_CMD( "diskboot- boot from IDE device\n", "loadAddr dev:part\n" ); - -#endif diff --git a/common/cmd_immap.c b/common/cmd_immap.c index ae95758247..d758269777 100644 --- a/common/cmd_immap.c +++ b/common/cmd_immap.c @@ -28,8 +28,7 @@ #include #include -#if defined(CONFIG_CMD_IMMAP) && \ - (defined(CONFIG_8xx) || defined(CONFIG_8260)) +#if defined(CONFIG_8xx) || defined(CONFIG_8260) #if defined(CONFIG_8xx) #include @@ -41,9 +40,7 @@ #include #endif -#if defined(CONFIG_8xx) || defined(CONFIG_8260) DECLARE_GLOBAL_DATA_PTR; -#endif static void unimplemented ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 8e2051714c..ce988723c0 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -32,8 +32,6 @@ #include #include -#if defined(CONFIG_CMD_ITEST) - #define EQ 0 #define NE 1 #define LT 2 @@ -197,4 +195,3 @@ U_BOOT_CMD( "itest\t- return true/false on integer compare\n", "[.b, .w, .l, .s] [*]value1 [*]value2\n" ); -#endif diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 513a226c43..efe9eb7be4 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -93,9 +93,6 @@ #include #include #include - -#if defined(CONFIG_CMD_JFFS2) - #include #if defined(CONFIG_CMD_NAND) @@ -2191,5 +2188,3 @@ U_BOOT_CMD( #endif /* #ifdef CONFIG_JFFS2_CMDLINE */ /***************************************************/ - -#endif diff --git a/common/cmd_log.c b/common/cmd_log.c index fba8bd8bf5..e593dbedd3 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -48,8 +48,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_LOGBUFFER) - /* Local prototypes */ static void logbuff_putc (const char c); static void logbuff_puts (const char *s); @@ -287,5 +285,3 @@ static int logbuff_printk(const char *line) } return i; } - -#endif /* (CONFIG_LOGBUFFER) */ diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 9d1d87551a..5982b76e6e 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -29,8 +29,6 @@ #include #include #include - -#if defined(CONFIG_CMD_MFSL) #include int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) @@ -413,5 +411,3 @@ U_BOOT_CMD (rspr, 3, 1, do_rspr, " 1 - MSR - Machine status register\n" " 3 - EAR - Exception address register\n" " 5 - ESR - Exception status register\n"); - -#endif diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 72e11d5442..f530a38421 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -27,8 +27,6 @@ #include #include - -#if defined(CONFIG_CMD_MII) #include #ifdef CONFIG_TERSE_MII @@ -112,9 +110,11 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) "OUI = 0x%04X, " "Model = 0x%02X, " "Rev = 0x%02X, " - "%3dbaseT, %s\n", + "%3dbase%s, %s\n", j, oui, model, rev, miiphy_speed (devname, j), + miiphy_is_1000base_x (devname, j) + ? "X" : "T", (miiphy_duplex (devname, j) == FULL) ? "FDX" : "HDX"); } @@ -496,9 +496,11 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) "OUI = 0x%04X, " "Model = 0x%02X, " "Rev = 0x%02X, " - "%3dbaseT, %s\n", + "%3dbase%s, %s\n", j, oui, model, rev, miiphy_speed (devname, j), + miiphy_is_1000base_x (devname, j) + ? "X" : "T", (miiphy_duplex (devname, j) == FULL) ? "FDX" : "HDX"); } @@ -594,5 +596,3 @@ U_BOOT_CMD( ); #endif /* CONFIG_TERSE_MII */ - -#endif diff --git a/common/cmd_misc.c b/common/cmd_misc.c index c0c6b8f05a..126b538ce8 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -27,8 +27,6 @@ #include #include -#if defined(CONFIG_CMD_MISC) - int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong start = get_timer(0); @@ -68,5 +66,3 @@ U_BOOT_CMD( "N\n" " - delay execution for N seconds (N is _decimal_ !!!)\n" ); - -#endif diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 069c6d02a0..25c970257d 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -23,9 +23,6 @@ #include #include - -#if defined(CONFIG_CMD_MMC) - #include int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -42,5 +39,3 @@ U_BOOT_CMD( "mmcinit - init mmc card\n", NULL ); - -#endif diff --git a/common/cmd_net.c b/common/cmd_net.c index 0715fbc203..21682c09e9 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -28,8 +28,6 @@ #include #include -#if defined(CONFIG_CMD_NET) - extern int do_bootm (cmd_tbl_t *, int, int, char *[]); static int netboot_common (proto_t, cmd_tbl_t *, int , char *[]); @@ -343,5 +341,3 @@ U_BOOT_CMD( "[NTP server IP]\n" ); #endif - -#endif diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 8be6da93f9..82d97178f5 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -30,16 +30,11 @@ */ #include - -#ifdef CONFIG_PCI - #include #include #include #include -#if defined(CONFIG_CMD_PCI) - extern int cmd_get_data_size(char* arg, int default_size); unsigned char ShortPCIListing = 1; @@ -564,7 +559,3 @@ U_BOOT_CMD( "pci write[.b, .w, .l] b.d.f address value\n" " - write to CFG address\n" ); - -#endif - -#endif /* CONFIG_PCI */ diff --git a/common/cmd_portio.c b/common/cmd_portio.c index bfe33e3a8c..a06cac0166 100644 --- a/common/cmd_portio.c +++ b/common/cmd_portio.c @@ -30,8 +30,6 @@ #include #include -#if defined(CONFIG_CMD_PORTIO) - extern int cmd_get_data_size (char *arg, int default_size); /* Display values from last command. @@ -165,5 +163,3 @@ U_BOOT_CMD( "[.b, .w, .l] port\n" " - read datum from IO port\n" ); - -#endif diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index 17e9cd9072..bb6aa30d18 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -33,8 +33,6 @@ #include #endif -#if defined(CONFIG_CMD_REGINFO) - int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { #if defined(CONFIG_8xx) @@ -335,9 +333,6 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#endif - - /**************************************************/ #if ( defined(CONFIG_8xx) || defined(CONFIG_405GP) || \ diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index 1ba3929900..b7395d7959 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -27,8 +27,6 @@ * Reiserfs support */ #include - -#if defined(CONFIG_CMD_REISER) #include #include #include @@ -239,5 +237,3 @@ U_BOOT_CMD( " - load binary file 'filename' from 'dev' on 'interface'\n" " to address 'addr' from dos filesystem\n" ); - -#endif diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index f56393107f..1cdec159f5 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -34,8 +34,6 @@ #include #include -#if defined(CONFIG_CMD_SCSI) - #ifdef CONFIG_SCSI_SYM53C8XX #define SCSI_VEND_ID 0x1000 #ifndef CONFIG_SCSI_DEV_ID @@ -129,9 +127,12 @@ void scsi_scan(int mode) if((modi&0x80)==0x80) /* drive is removable */ scsi_dev_desc[scsi_max_devs].removable=TRUE; /* get info for this device */ - scsi_ident_cpy(&scsi_dev_desc[scsi_max_devs].vendor[0],&tempbuff[8],8); - scsi_ident_cpy(&scsi_dev_desc[scsi_max_devs].product[0],&tempbuff[16],16); - scsi_ident_cpy(&scsi_dev_desc[scsi_max_devs].revision[0],&tempbuff[32],4); + scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].vendor[0], + &tempbuff[8], 8); + scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].product[0], + &tempbuff[16], 16); + scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].revision[0], + &tempbuff[32], 4); scsi_dev_desc[scsi_max_devs].target=pccb->target; scsi_dev_desc[scsi_max_devs].lun=pccb->lun; @@ -608,5 +609,3 @@ U_BOOT_CMD( "scsiboot- boot from SCSI device\n", "loadAddr dev:part\n" ); - -#endif diff --git a/common/cmd_spi.c b/common/cmd_spi.c index 3118d279b9..7604422141 100644 --- a/common/cmd_spi.c +++ b/common/cmd_spi.c @@ -29,8 +29,6 @@ #include #include -#if defined(CONFIG_CMD_SPI) - /*----------------------------------------------------------------------- * Definitions */ @@ -139,5 +137,3 @@ U_BOOT_CMD( " - Number of bits to send (base 10)\n" " - Hexadecimal string that gets sent\n" ); - -#endif diff --git a/common/cmd_universe.c b/common/cmd_universe.c index 8bf0b1f1e2..ea977828a0 100644 --- a/common/cmd_universe.c +++ b/common/cmd_universe.c @@ -28,8 +28,6 @@ #include -#if defined(CONFIG_CMD_UNIVERSE) - #define PCI_VENDOR PCI_VENDOR_ID_TUNDRA #define PCI_DEVICE PCI_DEVICE_ID_TUNDRA_CA91C042 @@ -386,5 +384,3 @@ U_BOOT_CMD( " 02 -> D16 Data Width\n" " 03 -> D32 Data Width\n" ); - -#endif diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 45e07f175c..c6b17c2ab7 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -29,9 +29,6 @@ #include #include #include - -#if defined(CONFIG_CMD_USB) - #include #ifdef CONFIG_USB_STORAGE @@ -608,12 +605,6 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - -#endif - - -#if defined(CONFIG_CMD_USB) - #ifdef CONFIG_USB_STORAGE U_BOOT_CMD( usb, 5, 1, do_usb, @@ -645,4 +636,3 @@ U_BOOT_CMD( "usb info [dev] - show available USB devices\n" ); #endif -#endif diff --git a/common/fdt_support.c b/common/fdt_support.c index 175d59eb99..c67bb3d390 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -44,6 +44,32 @@ struct fdt_header *fdt; /********************************************************************/ +/** + * fdt_find_and_setprop: Find a node and set it's property + * + * @fdt: ptr to device tree + * @node: path of node + * @prop: property name + * @val: ptr to new value + * @len: length of new property value + * @create: flag to create the property if it doesn't exist + * + * Convenience function to directly set a property given the path to the node. + */ +int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, + const void *val, int len, int create) +{ + int nodeoff = fdt_path_offset(fdt, node); + + if (nodeoff < 0) + return nodeoff; + + if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL)) + return 0; /* create flag not set; so exit quietly */ + + return fdt_setprop(fdt, nodeoff, prop, val, len); +} + int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) { int nodeoffset; @@ -58,34 +84,23 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) } if (initrd_start && initrd_end) { - struct fdt_reserve_entry re; - int used; - int total; + uint64_t addr, size; + int total = fdt_num_mem_rsv(fdt); int j; - err = fdt_num_reservemap(fdt, &used, &total); - if (err < 0) { - printf("fdt_chosen: %s\n", fdt_strerror(err)); - return err; - } - if (used >= total) { - printf("WARNING: " - "no room in the reserved map (%d of %d)\n", - used, total); - return -1; - } /* * Look for an existing entry and update it. If we don't find * the entry, we will j be the next available slot. */ - for (j = 0; j < used; j++) { - err = fdt_get_reservemap(fdt, j, &re); - if (re.address == initrd_start) { + for (j = 0; j < total; j++) { + err = fdt_get_mem_rsv(fdt, j, &addr, &size); + if (addr == initrd_start) { + fdt_del_mem_rsv(fdt, j); break; } } - err = fdt_replace_reservemap_entry(fdt, j, - initrd_start, initrd_end - initrd_start + 1); + + err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start + 1); if (err < 0) { printf("fdt_chosen: %s\n", fdt_strerror(err)); return err; @@ -95,7 +110,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) /* * Find the "chosen" node. */ - nodeoffset = fdt_find_node_by_path (fdt, "/chosen"); + nodeoffset = fdt_path_offset (fdt, "/chosen"); /* * If we have a "chosen" node already the "force the writing" @@ -182,7 +197,7 @@ int fdt_env(void *fdt) * See if we already have a "u-boot-env" node, delete it if so. * Then create a new empty node. */ - nodeoffset = fdt_find_node_by_path (fdt, "/u-boot-env"); + nodeoffset = fdt_path_offset (fdt, "/u-boot-env"); if (nodeoffset >= 0) { err = fdt_del_node(fdt, nodeoffset); if (err < 0) { @@ -304,7 +319,7 @@ int fdt_bd_t(void *fdt) * See if we already have a "bd_t" node, delete it if so. * Then create a new empty node. */ - nodeoffset = fdt_find_node_by_path (fdt, "/bd_t"); + nodeoffset = fdt_path_offset (fdt, "/bd_t"); if (nodeoffset >= 0) { err = fdt_del_node(fdt, nodeoffset); if (err < 0) { @@ -348,4 +363,128 @@ int fdt_bd_t(void *fdt) } #endif /* ifdef CONFIG_OF_HAS_BD_T */ +void do_fixup_by_path(void *fdt, const char *path, const char *prop, + const void *val, int len, int create) +{ +#if defined(DEBUG) + int i; + debug("Updating property '%s/%s' = ", node, prop); + for (i = 0; i < len; i++) + debug(" %.2x", *(u8*)(val+i)); + debug("\n"); +#endif + int rc = fdt_find_and_setprop(fdt, path, prop, val, len, create); + if (rc) + printf("Unable to update property %s:%s, err=%s\n", + path, prop, fdt_strerror(rc)); +} + +void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, + u32 val, int create) +{ + val = cpu_to_fdt32(val); + do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create); +} + +void do_fixup_by_prop(void *fdt, + const char *pname, const void *pval, int plen, + const char *prop, const void *val, int len, + int create) +{ + int off; +#if defined(DEBUG) + int i; + debug("Updating property '%s/%s' = ", node, prop); + for (i = 0; i < len; i++) + debug(" %.2x", *(u8*)(val+i)); + debug("\n"); +#endif + off = fdt_node_offset_by_prop_value(fdt, -1, pname, pval, plen); + while (off != -FDT_ERR_NOTFOUND) { + if (create || (fdt_get_property(fdt, off, prop, 0) != NULL)) + fdt_setprop(fdt, off, prop, val, len); + off = fdt_node_offset_by_prop_value(fdt, off, pname, pval, plen); + } +} + +void do_fixup_by_prop_u32(void *fdt, + const char *pname, const void *pval, int plen, + const char *prop, u32 val, int create) +{ + val = cpu_to_fdt32(val); + do_fixup_by_prop(fdt, pname, pval, plen, prop, &val, 4, create); +} + +void do_fixup_by_compat(void *fdt, const char *compat, + const char *prop, const void *val, int len, int create) +{ + int off = -1; +#if defined(DEBUG) + int i; + debug("Updating property '%s/%s' = ", node, prop); + for (i = 0; i < len; i++) + debug(" %.2x", *(u8*)(val+i)); + debug("\n"); +#endif + off = fdt_node_offset_by_compatible(fdt, -1, compat); + while (off != -FDT_ERR_NOTFOUND) { + if (create || (fdt_get_property(fdt, off, prop, 0) != NULL)) + fdt_setprop(fdt, off, prop, val, len); + off = fdt_node_offset_by_compatible(fdt, off, compat); + } +} + +void do_fixup_by_compat_u32(void *fdt, const char *compat, + const char *prop, u32 val, int create) +{ + val = cpu_to_fdt32(val); + do_fixup_by_compat(fdt, compat, prop, &val, 4, create); +} + +void fdt_fixup_ethernet(void *fdt, bd_t *bd) +{ + int node; + const char *path; + + node = fdt_path_offset(fdt, "/aliases"); + if (node >= 0) { +#if defined(CONFIG_HAS_ETH0) + path = fdt_getprop(fdt, node, "ethernet0", NULL); + if (path) { + do_fixup_by_path(fdt, path, "mac-address", + bd->bi_enetaddr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", + bd->bi_enetaddr, 6, 1); + } +#endif +#if defined(CONFIG_HAS_ETH1) + path = fdt_getprop(fdt, node, "ethernet1", NULL); + if (path) { + do_fixup_by_path(fdt, path, "mac-address", + bd->bi_enet1addr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", + bd->bi_enet1addr, 6, 1); + } +#endif +#if defined(CONFIG_HAS_ETH2) + path = fdt_getprop(fdt, node, "ethernet2", NULL); + if (path) { + do_fixup_by_path(fdt, path, "mac-address", + bd->bi_enet2addr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", + bd->bi_enet2addr, 6, 1); + } +#endif +#if defined(CONFIG_HAS_ETH3) + path = fdt_getprop(fdt, node, "ethernet3", NULL); + if (path) { + do_fixup_by_path(fdt, path, "mac-address", + bd->bi_enet3addr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", + bd->bi_enet3addr, 6, 1); + } +#endif + } +} + #endif /* CONFIG_OF_LIBFDT */ diff --git a/common/miiphyutil.c b/common/miiphyutil.c index c69501fedf..281f0b29e3 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -49,10 +49,10 @@ struct mii_dev { struct list_head link; char *name; - int (* read)(char *devname, unsigned char addr, - unsigned char reg, unsigned short *value); - int (* write)(char *devname, unsigned char addr, - unsigned char reg, unsigned short value); + int (*read) (char *devname, unsigned char addr, + unsigned char reg, unsigned short *value); + int (*write) (char *devname, unsigned char addr, + unsigned char reg, unsigned short value); }; static struct list_head mii_devs; @@ -62,21 +62,21 @@ static struct mii_dev *current_mii; * * Initialize global data. Need to be called before any other miiphy routine. */ -void miiphy_init() +void miiphy_init () { - INIT_LIST_HEAD(&mii_devs); - current_mii = NULL; + INIT_LIST_HEAD (&mii_devs); + current_mii = NULL; } /***************************************************************************** * * Register read and write MII access routines for the device . */ -void miiphy_register(char *name, - int (* read)(char *devname, unsigned char addr, - unsigned char reg, unsigned short *value), - int (* write)(char *devname, unsigned char addr, - unsigned char reg, unsigned short value)) +void miiphy_register (char *name, + int (*read) (char *devname, unsigned char addr, + unsigned char reg, unsigned short *value), + int (*write) (char *devname, unsigned char addr, + unsigned char reg, unsigned short value)) { struct list_head *entry; struct mii_dev *new_dev; @@ -84,63 +84,64 @@ void miiphy_register(char *name, unsigned int name_len; /* check if we have unique name */ - list_for_each(entry, &mii_devs) { - miidev = list_entry(entry, struct mii_dev, link); - if (strcmp(miidev->name, name) == 0) { - printf("miiphy_register: non unique device name '%s'\n", - name); + list_for_each (entry, &mii_devs) { + miidev = list_entry (entry, struct mii_dev, link); + if (strcmp (miidev->name, name) == 0) { + printf ("miiphy_register: non unique device name " + "'%s'\n", name); return; } } /* allocate memory */ - name_len = strlen(name); - new_dev = (struct mii_dev *)malloc(sizeof(struct mii_dev) + name_len + 1); + name_len = strlen (name); + new_dev = + (struct mii_dev *)malloc (sizeof (struct mii_dev) + name_len + 1); - if(new_dev == NULL) { - printf("miiphy_register: cannot allocate memory for '%s'\n", - name); + if (new_dev == NULL) { + printf ("miiphy_register: cannot allocate memory for '%s'\n", + name); return; } - memset(new_dev, 0, sizeof(struct mii_dev) + name_len); + memset (new_dev, 0, sizeof (struct mii_dev) + name_len); /* initalize mii_dev struct fields */ - INIT_LIST_HEAD(&new_dev->link); + INIT_LIST_HEAD (&new_dev->link); new_dev->read = read; new_dev->write = write; new_dev->name = (char *)(new_dev + 1); - strncpy(new_dev->name, name, name_len); + strncpy (new_dev->name, name, name_len); new_dev->name[name_len] = '\0'; - debug("miiphy_register: added '%s', read=0x%08lx, write=0x%08lx\n", - new_dev->name, new_dev->read, new_dev->write); + debug ("miiphy_register: added '%s', read=0x%08lx, write=0x%08lx\n", + new_dev->name, new_dev->read, new_dev->write); /* add it to the list */ - list_add_tail(&new_dev->link, &mii_devs); + list_add_tail (&new_dev->link, &mii_devs); if (!current_mii) current_mii = new_dev; } -int miiphy_set_current_dev(char *devname) +int miiphy_set_current_dev (char *devname) { struct list_head *entry; struct mii_dev *dev; - list_for_each(entry, &mii_devs) { - dev = list_entry(entry, struct mii_dev, link); + list_for_each (entry, &mii_devs) { + dev = list_entry (entry, struct mii_dev, link); - if (strcmp(devname, dev->name) == 0) { + if (strcmp (devname, dev->name) == 0) { current_mii = dev; return 0; } } - printf("No such device: %s\n", devname); + printf ("No such device: %s\n", devname); return 1; } -char *miiphy_get_current_dev() +char *miiphy_get_current_dev () { if (current_mii) return current_mii->name; @@ -156,8 +157,8 @@ char *miiphy_get_current_dev() * Returns: * 0 on success */ -int miiphy_read(char *devname, unsigned char addr, unsigned char reg, - unsigned short *value) +int miiphy_read (char *devname, unsigned char addr, unsigned char reg, + unsigned short *value) { struct list_head *entry; struct mii_dev *dev; @@ -165,22 +166,22 @@ int miiphy_read(char *devname, unsigned char addr, unsigned char reg, int read_ret = 0; if (!devname) { - printf("NULL device name!\n"); + printf ("NULL device name!\n"); return 1; } - list_for_each(entry, &mii_devs) { - dev = list_entry(entry, struct mii_dev, link); + list_for_each (entry, &mii_devs) { + dev = list_entry (entry, struct mii_dev, link); - if (strcmp(devname, dev->name) == 0) { + if (strcmp (devname, dev->name) == 0) { found_dev = 1; - read_ret = dev->read(devname, addr, reg, value); + read_ret = dev->read (devname, addr, reg, value); break; } } if (found_dev == 0) - printf("No such device: %s\n", devname); + printf ("No such device: %s\n", devname); return ((found_dev) ? read_ret : 1); } @@ -193,8 +194,8 @@ int miiphy_read(char *devname, unsigned char addr, unsigned char reg, * Returns: * 0 on success */ -int miiphy_write(char *devname, unsigned char addr, unsigned char reg, - unsigned short value) +int miiphy_write (char *devname, unsigned char addr, unsigned char reg, + unsigned short value) { struct list_head *entry; struct mii_dev *dev; @@ -202,22 +203,22 @@ int miiphy_write(char *devname, unsigned char addr, unsigned char reg, int write_ret = 0; if (!devname) { - printf("NULL device name!\n"); + printf ("NULL device name!\n"); return 1; } - list_for_each(entry, &mii_devs) { - dev = list_entry(entry, struct mii_dev, link); + list_for_each (entry, &mii_devs) { + dev = list_entry (entry, struct mii_dev, link); - if (strcmp(devname, dev->name) == 0) { + if (strcmp (devname, dev->name) == 0) { found_dev = 1; - write_ret = dev->write(devname, addr, reg, value); + write_ret = dev->write (devname, addr, reg, value); break; } } if (found_dev == 0) - printf("No such device: %s\n", devname); + printf ("No such device: %s\n", devname); return ((found_dev) ? write_ret : 1); } @@ -226,23 +227,22 @@ int miiphy_write(char *devname, unsigned char addr, unsigned char reg, * * Print out list of registered MII capable devices. */ -void miiphy_listdev(void) +void miiphy_listdev (void) { struct list_head *entry; struct mii_dev *dev; - puts("MII devices: "); - list_for_each(entry, &mii_devs) { - dev = list_entry(entry, struct mii_dev, link); - printf("'%s' ", dev->name); + puts ("MII devices: "); + list_for_each (entry, &mii_devs) { + dev = list_entry (entry, struct mii_dev, link); + printf ("'%s' ", dev->name); } - puts("\n"); + puts ("\n"); if (current_mii) - printf("Current device: '%s'\n", current_mii->name); + printf ("Current device: '%s'\n", current_mii->name); } - /***************************************************************************** * * Read the OUI, manufacture's model number, and revision number. @@ -254,9 +254,7 @@ void miiphy_listdev(void) * Returns: * 0 on success */ -int miiphy_info (char *devname, - unsigned char addr, - unsigned int *oui, +int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, unsigned char *model, unsigned char *rev) { unsigned int reg = 0; @@ -288,13 +286,12 @@ int miiphy_info (char *devname, #ifdef DEBUG printf ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg); #endif - *oui = ( reg >> 10); - *model = (unsigned char) ((reg >> 4) & 0x0000003F); - *rev = (unsigned char) ( reg & 0x0000000F); + *oui = (reg >> 10); + *model = (unsigned char)((reg >> 4) & 0x0000003F); + *rev = (unsigned char)(reg & 0x0000000F); return (0); } - /***************************************************************************** * * Reset the PHY. @@ -345,104 +342,138 @@ int miiphy_reset (char *devname, unsigned char addr) return (0); } - /***************************************************************************** * - * Determine the ethernet speed (10/100). + * Determine the ethernet speed (10/100/1000). Return 10 on error. */ int miiphy_speed (char *devname, unsigned char addr) { - unsigned short reg; + u16 bmcr, anlpar; #if defined(CONFIG_PHY_GIGE) - if (miiphy_read (devname, addr, PHY_1000BTSR, ®)) { - printf ("PHY 1000BT Status read failed\n"); - } else { - if (reg != 0xFFFF) { - if ((reg & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) !=0) { - return (_1000BASET); - } - } + u16 btsr; + + /* + * Check for 1000BASE-X. If it is supported, then assume that the speed + * is 1000. + */ + if (miiphy_is_1000base_x (devname, addr)) { + return _1000BASET; + } + /* + * No 1000BASE-X, so assume 1000BASE-T/100BASE-TX/10BASE-T register set. + */ + /* Check for 1000BASE-T. */ + if (miiphy_read (devname, addr, PHY_1000BTSR, &btsr)) { + printf ("PHY 1000BT status"); + goto miiphy_read_failed; + } + if (btsr != 0xFFFF && + (btsr & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD))) { + return _1000BASET; } #endif /* CONFIG_PHY_GIGE */ /* Check Basic Management Control Register first. */ - if (miiphy_read (devname, addr, PHY_BMCR, ®)) { - puts ("PHY speed read failed, assuming 10bT\n"); - return (_10BASET); + if (miiphy_read (devname, addr, PHY_BMCR, &bmcr)) { + printf ("PHY speed"); + goto miiphy_read_failed; } /* Check if auto-negotiation is on. */ - if ((reg & PHY_BMCR_AUTON) != 0) { + if (bmcr & PHY_BMCR_AUTON) { /* Get auto-negotiation results. */ - if (miiphy_read (devname, addr, PHY_ANLPAR, ®)) { - puts ("PHY AN speed read failed, assuming 10bT\n"); - return (_10BASET); - } - if ((reg & PHY_ANLPAR_100) != 0) { - return (_100BASET); - } else { - return (_10BASET); + if (miiphy_read (devname, addr, PHY_ANLPAR, &anlpar)) { + printf ("PHY AN speed"); + goto miiphy_read_failed; } + return (anlpar & PHY_ANLPAR_100) ? _100BASET : _10BASET; } /* Get speed from basic control settings. */ - else if (reg & PHY_BMCR_100MB) { - return (_100BASET); - } else { - return (_10BASET); - } + return (bmcr & PHY_BMCR_100MB) ? _100BASET : _10BASET; + miiphy_read_failed: + printf (" read failed, assuming 10BASE-T\n"); + return _10BASET; } - /***************************************************************************** * - * Determine full/half duplex. + * Determine full/half duplex. Return half on error. */ int miiphy_duplex (char *devname, unsigned char addr) { - unsigned short reg; + u16 bmcr, anlpar; #if defined(CONFIG_PHY_GIGE) - if (miiphy_read (devname, addr, PHY_1000BTSR, ®)) { - printf ("PHY 1000BT Status read failed\n"); - } else { - if ( (reg != 0xFFFF) && - (reg & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) ) { - if ((reg & PHY_1000BTSR_1000FD) !=0) { - return (FULL); - } else { - return (HALF); - } + u16 btsr; + + /* Check for 1000BASE-X. */ + if (miiphy_is_1000base_x (devname, addr)) { + /* 1000BASE-X */ + if (miiphy_read (devname, addr, PHY_ANLPAR, &anlpar)) { + printf ("1000BASE-X PHY AN duplex"); + goto miiphy_read_failed; + } + } + /* + * No 1000BASE-X, so assume 1000BASE-T/100BASE-TX/10BASE-T register set. + */ + /* Check for 1000BASE-T. */ + if (miiphy_read (devname, addr, PHY_1000BTSR, &btsr)) { + printf ("PHY 1000BT status"); + goto miiphy_read_failed; + } + if (btsr != 0xFFFF) { + if (btsr & PHY_1000BTSR_1000FD) { + return FULL; + } else if (btsr & PHY_1000BTSR_1000HD) { + return HALF; } } #endif /* CONFIG_PHY_GIGE */ /* Check Basic Management Control Register first. */ - if (miiphy_read (devname, addr, PHY_BMCR, ®)) { - puts ("PHY duplex read failed, assuming half duplex\n"); - return (HALF); + if (miiphy_read (devname, addr, PHY_BMCR, &bmcr)) { + puts ("PHY duplex"); + goto miiphy_read_failed; } /* Check if auto-negotiation is on. */ - if ((reg & PHY_BMCR_AUTON) != 0) { + if (bmcr & PHY_BMCR_AUTON) { /* Get auto-negotiation results. */ - if (miiphy_read (devname, addr, PHY_ANLPAR, ®)) { - puts ("PHY AN duplex read failed, assuming half duplex\n"); - return (HALF); - } - - if ((reg & (PHY_ANLPAR_10FD | PHY_ANLPAR_TXFD)) != 0) { - return (FULL); - } else { - return (HALF); + if (miiphy_read (devname, addr, PHY_ANLPAR, &anlpar)) { + puts ("PHY AN duplex"); + goto miiphy_read_failed; } + return (anlpar & (PHY_ANLPAR_10FD | PHY_ANLPAR_TXFD)) ? + FULL : HALF; } /* Get speed from basic control settings. */ - else if (reg & PHY_BMCR_DPLX) { - return (FULL); - } else { - return (HALF); - } + return (bmcr & PHY_BMCR_DPLX) ? FULL : HALF; + miiphy_read_failed: + printf (" read failed, assuming half duplex\n"); + return HALF; +} + +/***************************************************************************** + * + * Return 1 if PHY supports 1000BASE-X, 0 if PHY supports 10BASE-T/100BASE-TX/ + * 1000BASE-T, or on error. + */ +int miiphy_is_1000base_x (char *devname, unsigned char addr) +{ +#if defined(CONFIG_PHY_GIGE) + u16 exsr; + + if (miiphy_read (devname, addr, PHY_EXSR, &exsr)) { + printf ("PHY extended status read failed, assuming no " + "1000BASE-X\n"); + return 0; + } + return 0 != (exsr & (PHY_EXSR_1000XF | PHY_EXSR_1000XH)); +#else + return 0; +#endif } #ifdef CFG_FAULT_ECHO_LINK_DOWN @@ -455,7 +486,7 @@ int miiphy_link (char *devname, unsigned char addr) unsigned short reg; /* dummy read; needed to latch some phys */ - (void)miiphy_read(devname, addr, PHY_BMSR, ®); + (void)miiphy_read (devname, addr, PHY_BMSR, ®); if (miiphy_read (devname, addr, PHY_BMSR, ®)) { puts ("PHY_BMSR read failed, assuming no link\n"); return (0); @@ -469,5 +500,4 @@ int miiphy_link (char *devname, unsigned char addr) } } #endif - #endif /* CONFIG_MII */ diff --git a/common/spartan2.c b/common/spartan2.c index 0fb23b6592..06550b9858 100644 --- a/common/spartan2.c +++ b/common/spartan2.c @@ -516,7 +516,7 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->clk) (FALSE, TRUE, cookie); CONFIG_FPGA_DELAY (); /* Write data */ - (*fn->wr) ((val < 0), TRUE, cookie); + (*fn->wr) ((val & 0x80), TRUE, cookie); CONFIG_FPGA_DELAY (); /* Assert the clock */ (*fn->clk) (TRUE, TRUE, cookie); diff --git a/common/spartan3.c b/common/spartan3.c index c0f2b05e48..f7c4f8cf2b 100644 --- a/common/spartan3.c +++ b/common/spartan3.c @@ -521,7 +521,7 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->clk) (FALSE, TRUE, cookie); CONFIG_FPGA_DELAY (); /* Write data */ - (*fn->wr) ((val < 0), TRUE, cookie); + (*fn->wr) ((val & 0x80), TRUE, cookie); CONFIG_FPGA_DELAY (); /* Assert the clock */ (*fn->clk) (TRUE, TRUE, cookie); diff --git a/common/usb_kbd.c b/common/usb_kbd.c index aec558ad20..7bdfcc0b90 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -257,7 +257,7 @@ static int usb_kbd_translate(unsigned char scancode,unsigned char modifier,int p repeat_delay=REPEAT_DELAY; } keycode=0; - if((scancode>3) && (scancode<0x1d)) { /* alpha numeric values */ + if((scancode>3) && (scancode<=0x1d)) { /* alpha numeric values */ keycode=scancode-4 + 0x61; if(caps_lock) keycode&=~CAPITAL_MASK; /* switch to capital Letters */ diff --git a/common/usb_storage.c b/common/usb_storage.c index 0f79f367c9..443d78574a 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -1195,7 +1195,7 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t dev_desc->product[16] = 0; dev_desc->revision[4] = 0; #ifdef CONFIG_USB_BIN_FIXUP - usb_bin_fixup(dev->descriptor, dev_desc->vendor, dev_desc->product); + usb_bin_fixup(dev->descriptor, (uchar *)dev_desc->vendor, (uchar *)dev_desc->product); #endif /* CONFIG_USB_BIN_FIXUP */ USB_STOR_PRINTF("ISO Vers %X, Response Data %X\n",usb_stor_buf[2],usb_stor_buf[3]); if(usb_test_unit_ready(pccb,ss)) { diff --git a/config.mk b/config.mk index 582df329a4..79e5a31b72 100644 --- a/config.mk +++ b/config.mk @@ -69,10 +69,6 @@ PLATFORM_CPPFLAGS+= -D__ARM__ endif endif -ifeq ($(ARCH),blackfin) -PLATFORM_CPPFLAGS+= -D__BLACKFIN__ -endif - ifdef ARCH sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules endif @@ -91,6 +87,9 @@ ifdef BOARD sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules endif +# Load generated board configuration +sinclude $(OBJTREE)/include/autoconf.mk + ######################################################################### CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ diff --git a/cpu/arm920t/s3c24x0/Makefile b/cpu/arm920t/s3c24x0/Makefile index 0ff36c596a..1ed9bf307c 100644 --- a/cpu/arm920t/s3c24x0/Makefile +++ b/cpu/arm920t/s3c24x0/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a COBJS = i2c.o interrupts.o serial.o speed.o \ - usb.o + usb.o usb_ohci.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/cpu/arm920t/s3c24x0/usb_ohci.c b/cpu/arm920t/s3c24x0/usb_ohci.c index 869ca79d03..4075f2e183 100644 --- a/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/cpu/arm920t/s3c24x0/usb_ohci.c @@ -498,7 +498,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi) if (ohci->ed_controltail == NULL) { writel (ed, &ohci->regs->ed_controlhead); } else { - ohci->ed_controltail->hwNextED = m32_swap (ed); + ohci->ed_controltail->hwNextED = (__u32)m32_swap (ed); } ed->ed_prev = ohci->ed_controltail; if (!ohci->ed_controltail && !ohci->ed_rm_list[0] && @@ -514,7 +514,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi) if (ohci->ed_bulktail == NULL) { writel (ed, &ohci->regs->ed_bulkhead); } else { - ohci->ed_bulktail->hwNextED = m32_swap (ed); + ohci->ed_bulktail->hwNextED = (__u32)m32_swap (ed); } ed->ed_prev = ohci->ed_bulktail; if (!ohci->ed_bulktail && !ohci->ed_rm_list[0] && @@ -606,7 +606,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe) ed->hwINFO = m32_swap (OHCI_ED_SKIP); /* skip ed */ /* dummy td; end of td list for ed */ td = td_alloc (usb_dev); - ed->hwTailP = m32_swap (td); + ed->hwTailP = (__u32)m32_swap (td); ed->hwHeadP = ed->hwTailP; ed->state = ED_UNLINK; ed->type = usb_pipetype (pipe); @@ -663,13 +663,13 @@ static void td_fill (ohci_t *ohci, unsigned int info, if (!len) data = 0; - td->hwINFO = m32_swap (info); - td->hwCBP = m32_swap (data); + td->hwINFO = (__u32)m32_swap (info); + td->hwCBP = (__u32)m32_swap (data); if (data) - td->hwBE = m32_swap (data + len - 1); + td->hwBE = (__u32)m32_swap (data + len - 1); else td->hwBE = 0; - td->hwNextTD = m32_swap (td_pt); + td->hwNextTD = (__u32)m32_swap (td_pt); /* append to queue */ td->ed->hwTailP = td->hwNextTD; diff --git a/cpu/mcf523x/config.mk b/cpu/mcf523x/config.mk index ba324a894a..93645a31e0 100644 --- a/cpu/mcf523x/config.mk +++ b/cpu/mcf523x/config.mk @@ -24,4 +24,8 @@ # PLATFORM_RELFLAGS += -ffixed-d7 -msep-data +ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2) +PLATFORM_CPPFLAGS += -mcpu=5235 -fPIC +else PLATFORM_CPPFLAGS += -m5307 -fPIC +endif diff --git a/cpu/mcf52x2/config.mk b/cpu/mcf52x2/config.mk index 650db85831..f97157d041 100644 --- a/cpu/mcf52x2/config.mk +++ b/cpu/mcf52x2/config.mk @@ -24,4 +24,33 @@ # PLATFORM_RELFLAGS += -ffixed-d7 -msep-data + +cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') +is5249=$(shell grep CONFIG_M5249 $(TOPDIR)/include/$(cfg)) +is5253=$(shell grep CONFIG_M5253 $(TOPDIR)/include/$(cfg)) +is5271=$(shell grep CONFIG_M5271 $(TOPDIR)/include/$(cfg)) +is5272=$(shell grep CONFIG_M5272 $(TOPDIR)/include/$(cfg)) +is5282=$(shell grep CONFIG_M5282 $(TOPDIR)/include/$(cfg)) + + +ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2) + +ifneq (,$(findstring CONFIG_M5249,$(is5249))) +PLATFORM_CPPFLAGS += -mcpu=5249 +endif +ifneq (,$(findstring CONFIG_M5253,$(is5253))) +PLATFORM_CPPFLAGS += -mcpu=5253 +endif +ifneq (,$(findstring CONFIG_M5271,$(is5271))) +PLATFORM_CPPFLAGS += -mcpu=5271 +endif +ifneq (,$(findstring CONFIG_M5272,$(is5272))) +PLATFORM_CPPFLAGS += -mcpu=5272 +endif +ifneq (,$(findstring CONFIG_M5282,$(is5282))) +PLATFORM_CPPFLAGS += -mcpu=5282 +endif + +else PLATFORM_CPPFLAGS += -m5307 +endif diff --git a/cpu/mcf52x2/start.S b/cpu/mcf52x2/start.S index 686e2a5333..260a09abf7 100644 --- a/cpu/mcf52x2/start.S +++ b/cpu/mcf52x2/start.S @@ -58,7 +58,7 @@ _vectors: .long 0x00000000 /* Flash offset is 0 until we setup CS0 */ #if defined(CONFIG_R5200) .long 0x400 -#elif defined(CONFIG_M5282) +#elif defined(CONFIG_M5282) && (TEXT_BASE == CFG_INT_FLASH_BASE) .long _start - TEXT_BASE #else .long _START @@ -177,7 +177,11 @@ _after_flashbar_copy: * therefore no VBR to set */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) +#if defined(CONFIG_M5282) && (TEXT_BASE == CFG_INT_FLASH_BASE) + move.l #CFG_INT_FLASH_BASE, %d0 +#else move.l #CFG_FLASH_BASE, %d0 +#endif movec %d0, %VBR #endif diff --git a/cpu/mcf532x/config.mk b/cpu/mcf532x/config.mk index ba324a894a..16a0bc3264 100644 --- a/cpu/mcf532x/config.mk +++ b/cpu/mcf532x/config.mk @@ -24,4 +24,8 @@ # PLATFORM_RELFLAGS += -ffixed-d7 -msep-data +ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2) +PLATFORM_CPPFLAGS += -mcpu=5329 -fPIC +else PLATFORM_CPPFLAGS += -m5307 -fPIC +endif diff --git a/cpu/mcf532x/cpu.c b/cpu/mcf532x/cpu.c index 2f62e956cc..89cc8ad930 100644 --- a/cpu/mcf532x/cpu.c +++ b/cpu/mcf532x/cpu.c @@ -35,14 +35,10 @@ DECLARE_GLOBAL_DATA_PTR; int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[]) { - volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); + volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM); - wdp->cr = 0; udelay(1000); - - /* enable watchdog, set timeout to 0 and wait */ - wdp->cr = WTM_WCR_EN; - while (1) ; + rcm->rcr |= RCM_RCR_SOFTRST; /* we don't return! */ return 0; diff --git a/cpu/mcf532x/start.S b/cpu/mcf532x/start.S index 5cc1c87cdd..61be2eac69 100644 --- a/cpu/mcf532x/start.S +++ b/cpu/mcf532x/start.S @@ -131,7 +131,7 @@ _start: movec %d0, %VBR move.l #(CFG_INIT_RAM_ADDR + CFG_INIT_RAM_CTRL), %d0 - movec %d0, %RAMBAR0 + movec %d0, %RAMBAR1 /* invalidate and disable cache */ move.l #0x01000000, %d0 /* Invalidate cache cmd */ @@ -268,7 +268,7 @@ _int_handler: icache_enable: move.l #0x01000000, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ - move.l #(CFG_SDRAM_BASE + 0xc000 + ((CFG_SDRAM_SIZE & 0x1fe0) << 11)), %d0 + move.l #(CFG_SDRAM_BASE + 0x1c000), %d0 movec %d0, %ACR0 /* Enable cache */ move.l #0x80000200, %d0 /* Setup cache mask */ diff --git a/cpu/mcf5445x/config.mk b/cpu/mcf5445x/config.mk index d0c72fb6b0..88433f2f6d 100644 --- a/cpu/mcf5445x/config.mk +++ b/cpu/mcf5445x/config.mk @@ -24,4 +24,8 @@ # PLATFORM_RELFLAGS += -ffixed-d7 -msep-data +ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2) +PLATFORM_CPPFLAGS += -mcpu=54455 -fPIC +else PLATFORM_CPPFLAGS += -m5407 -fPIC +endif diff --git a/cpu/mcf5445x/start.S b/cpu/mcf5445x/start.S index cd989ab626..423583d04a 100644 --- a/cpu/mcf5445x/start.S +++ b/cpu/mcf5445x/start.S @@ -136,7 +136,7 @@ _start: movec %d0, %VBR move.l #(CFG_INIT_RAM_ADDR + CFG_INIT_RAM_CTRL), %d0 - movec %d0, %RAMBAR0 + movec %d0, %RAMBAR1 /* initialize general use internal ram */ move.l #0, %d0 diff --git a/cpu/mips/au1x00_eth.c b/cpu/mips/au1x00_eth.c index b69741ae68..d70c5fe987 100644 --- a/cpu/mips/au1x00_eth.c +++ b/cpu/mips/au1x00_eth.c @@ -90,6 +90,65 @@ mac_fifo_t mac_fifo[NO_OF_FIFOS]; #define MAX_WAIT 1000 +#if defined(CONFIG_CMD_MII) +int au1x00_miiphy_read(char *devname, unsigned char addr, + unsigned char reg, unsigned short * value) +{ + volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); + volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); + u32 mii_control; + unsigned int timedout = 20; + + while (*mii_control_reg & MAC_MII_BUSY) { + udelay(1000); + if (--timedout == 0) { + printf("au1x00_eth: miiphy_read busy timeout!!\n"); + return -1; + } + } + + mii_control = MAC_SET_MII_SELECT_REG(reg) | + MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_READ; + + *mii_control_reg = mii_control; + + timedout = 20; + while (*mii_control_reg & MAC_MII_BUSY) { + udelay(1000); + if (--timedout == 0) { + printf("au1x00_eth: miiphy_read busy timeout!!\n"); + return -1; + } + } + *value = *mii_data_reg; + return 0; +} + +int au1x00_miiphy_write(char *devname, unsigned char addr, + unsigned char reg, unsigned short value) +{ + volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); + volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); + u32 mii_control; + unsigned int timedout = 20; + + while (*mii_control_reg & MAC_MII_BUSY) { + udelay(1000); + if (--timedout == 0) { + printf("au1x00_eth: miiphy_write busy timeout!!\n"); + return -1; + } + } + + mii_control = MAC_SET_MII_SELECT_REG(reg) | + MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_WRITE; + + *mii_data_reg = value; + *mii_control_reg = mii_control; + return 0; +} +#endif + static int au1x00_send(struct eth_device* dev, volatile void *packet, int length){ volatile mac_fifo_t *fifo_tx = (volatile mac_fifo_t*)(MAC0_TX_DMA_ADDR+MAC_TX_BUFF0_STATUS); @@ -249,63 +308,4 @@ int au1x00_enet_initialize(bd_t *bis){ return 1; } -#if defined(CONFIG_CMD_MII) -int au1x00_miiphy_read(char *devname, unsigned char addr, - unsigned char reg, unsigned short * value) -{ - volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); - volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); - u32 mii_control; - unsigned int timedout = 20; - - while (*mii_control_reg & MAC_MII_BUSY) { - udelay(1000); - if (--timedout == 0) { - printf("au1x00_eth: miiphy_read busy timeout!!\n"); - return -1; - } - } - - mii_control = MAC_SET_MII_SELECT_REG(reg) | - MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_READ; - - *mii_control_reg = mii_control; - - timedout = 20; - while (*mii_control_reg & MAC_MII_BUSY) { - udelay(1000); - if (--timedout == 0) { - printf("au1x00_eth: miiphy_read busy timeout!!\n"); - return -1; - } - } - *value = *mii_data_reg; - return 0; -} - -int au1x00_miiphy_write(char *devname, unsigned char addr, - unsigned char reg, unsigned short value) -{ - volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); - volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); - u32 mii_control; - unsigned int timedout = 20; - - while (*mii_control_reg & MAC_MII_BUSY) { - udelay(1000); - if (--timedout == 0) { - printf("au1x00_eth: miiphy_write busy timeout!!\n"); - return; - } - } - - mii_control = MAC_SET_MII_SELECT_REG(reg) | - MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_WRITE; - - *mii_data_reg = value; - *mii_control_reg = mii_control; - return 0; -} -#endif - #endif /* CONFIG_AU1X00 */ diff --git a/cpu/mips/cache.S b/cpu/mips/cache.S index aad76e0afb..443240e540 100644 --- a/cpu/mips/cache.S +++ b/cpu/mips/cache.S @@ -22,7 +22,6 @@ * MA 02111-1307 USA */ - #include #include #include @@ -30,13 +29,11 @@ #include #include - /* 16KB is the maximum size of instruction and data caches on * MIPS 4K. */ #define MIPS_MAX_CACHE_SIZE 0x4000 - /* * cacheop macro to automate cache operations * first some helpers... @@ -131,7 +128,6 @@ mips_cache_reset: li t4, CFG_CACHELINE_SIZE move t5, t4 - li v0, MIPS_MAX_CACHE_SIZE /* Now clear that much memory starting from zero. @@ -139,8 +135,8 @@ mips_cache_reset: li a0, KSEG1 addu a1, a0, v0 - -2: sw zero, 0(a0) +2: + sw zero, 0(a0) sw zero, 4(a0) sw zero, 8(a0) sw zero, 12(a0) @@ -156,11 +152,11 @@ mips_cache_reset: mtc0 zero, CP0_TAGLO - /* - * The caches are probably in an indeterminate state, - * so we force good parity into them by doing an - * invalidate, load/fill, invalidate for each line. - */ + /* + * The caches are probably in an indeterminate state, + * so we force good parity into them by doing an + * invalidate, load/fill, invalidate for each line. + */ /* Assume bottom of RAM will generate good parity for the cache. */ @@ -201,9 +197,9 @@ mips_cache_reset: move a1, a2 icacheop(a0,a1,a2,a3,Index_Store_Tag_D) - j ra - .end mips_cache_reset + j ra + .end mips_cache_reset /******************************************************************************* * @@ -220,7 +216,7 @@ dcache_status: andi v0, v0, 1 j ra - .end dcache_status + .end dcache_status /******************************************************************************* * @@ -237,11 +233,10 @@ dcache_disable: li t1, -8 and t0, t0, t1 ori t0, t0, CONF_CM_UNCACHED - mtc0 t0, CP0_CONFIG + mtc0 t0, CP0_CONFIG j ra - .end dcache_disable - + .end dcache_disable /******************************************************************************* * @@ -266,4 +261,5 @@ mips_cache_lock: icacheop(a0,a1,a2,a3,0x1d) j ra + .end mips_cache_lock diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk index b29986e26b..ad03bd61ba 100644 --- a/cpu/mips/config.mk +++ b/cpu/mips/config.mk @@ -20,8 +20,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -v=$(shell \ -$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}') +v=$(shell $(AS) --version |grep "GNU assembler" |cut -d. -f2) MIPSFLAGS=$(shell \ if [ "$v" -lt "14" ]; then \ echo "-mcpu=4kc"; \ @@ -35,6 +34,6 @@ else ENDIANNESS = -EB endif -MIPSFLAGS += $(ENDIANNESS) -mabicalls +MIPSFLAGS += $(ENDIANNESS) PLATFORM_CPPFLAGS += $(MIPSFLAGS) diff --git a/cpu/mips/cpu.c b/cpu/mips/cpu.c index f48675e996..7559ac657f 100644 --- a/cpu/mips/cpu.c +++ b/cpu/mips/cpu.c @@ -39,12 +39,12 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -void flush_cache (ulong start_addr, ulong size) +void flush_cache(ulong start_addr, ulong size) { - } -void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 ){ +void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1) +{ write_32bit_cp0_register(CP0_ENTRYLO0, low0); write_32bit_cp0_register(CP0_PAGEMASK, pagemask); write_32bit_cp0_register(CP0_ENTRYLO1, low1); diff --git a/cpu/mips/start.S b/cpu/mips/start.S index e91e2137d7..c92b162782 100644 --- a/cpu/mips/start.S +++ b/cpu/mips/start.S @@ -22,13 +22,11 @@ * MA 02111-1307 USA */ - #include #include #include #include - #define RVECENT(f,n) \ b f; nop #define XVECENT(f,bev) \ @@ -192,7 +190,7 @@ _start: .word 0x00000000 .word 0x03e00008 .word 0x00000000 - .word 0x00000000 + .word 0x00000000 /* 0xbfc00428 */ .word 0xdc870000 .word 0xfca70000 @@ -203,7 +201,7 @@ _start: .word 0x00000000 .word 0x03e00008 .word 0x00000000 - .word 0x00000000 + .word 0x00000000 #endif /* CONFIG_PURPLE */ .align 4 reset: @@ -234,34 +232,32 @@ reset: li t0, CONF_CM_UNCACHED mtc0 t0, CP0_CONFIG - /* Initialize GOT pointer. - */ - bal 1f + /* Initialize $gp. + */ + bal 1f nop - .word _GLOBAL_OFFSET_TABLE_ - 1: - move gp, ra - lw t1, 0(ra) - move gp, t1 + .word _gp +1: + lw gp, 0(ra) #ifdef CONFIG_INCA_IP /* Disable INCA-IP Watchdog. */ - la t9, disable_incaip_wdt - jalr t9 + la t9, disable_incaip_wdt + jalr t9 nop #endif /* Initialize any external memory. */ - la t9, lowlevel_init - jalr t9 + la t9, lowlevel_init + jalr t9 nop /* Initialize caches... */ - la t9, mips_cache_reset - jalr t9 + la t9, mips_cache_reset + jalr t9 nop /* ... and enable them. @@ -269,12 +265,11 @@ reset: li t0, CONF_CM_CACHABLE_NONCOHERENT mtc0 t0, CP0_CONFIG - /* Set up temporary stack. */ li a0, CFG_INIT_SP_OFFSET - la t9, mips_cache_lock - jalr t9 + la t9, mips_cache_lock + jalr t9 nop li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET @@ -284,7 +279,6 @@ reset: j t9 nop - /* * void relocate_code (addr_sp, gd, addr_moni) * @@ -298,7 +292,7 @@ reset: .globl relocate_code .ent relocate_code relocate_code: - move sp, a0 /* Set new stack pointer */ + move sp, a0 /* Set new stack pointer */ li t0, CFG_MONITOR_BASE la t3, in_ram @@ -306,14 +300,14 @@ relocate_code: move t1, a2 /* - * Fix GOT pointer: + * Fix $gp: * - * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address + * New $gp = (Old $gp - CFG_MONITOR_BASE) + Destination Address */ move t6, gp sub gp, CFG_MONITOR_BASE - add gp, a2 /* gp now adjusted */ - sub t6, gp, t6 /* t6 <-- relocation offset */ + add gp, a2 /* gp now adjusted */ + sub t6, gp, t6 /* t6 <-- relocation offset */ /* * t0 = source address @@ -329,7 +323,7 @@ relocate_code: sw t3, 0(t1) addu t0, 4 ble t0, t2, 1b - addu t1, 4 /* delay slot */ + addu t1, 4 /* delay slot */ #endif /* If caches were enabled, we would have to flush them here. @@ -341,15 +335,22 @@ relocate_code: j t0 nop + .gpword _GLOBAL_OFFSET_TABLE_ /* _GLOBAL_OFFSET_TABLE_ - _gp */ .word uboot_end_data .word uboot_end .word num_got_entries in_ram: - /* Now we want to update GOT. + /* + * Now we want to update GOT. + * + * GOT[0] is reserved. GOT[1] is also reserved for the dynamic object + * generated by GNU ld. Skip these reserved entries from relocation. */ lw t3, -4(t0) /* t3 <-- num_got_entries */ - addi t4, gp, 8 /* Skipping first two entries. */ + lw t4, -16(t0) /* t4 <-- (_GLOBAL_OFFSET_TABLE_ - _gp) */ + add t4, t4, gp /* t4 now holds _GLOBAL_OFFSET_TABLE_ */ + addi t4, t4, 8 /* Skipping first two entries. */ li t2, 2 1: lw t1, 0(t4) @@ -369,7 +370,8 @@ in_ram: add t2, t6 sub t1, 4 -1: addi t1, 4 +1: + addi t1, 4 bltl t1, t2, 1b sw zero, 0(t1) /* delay slot */ @@ -380,11 +382,10 @@ in_ram: .end relocate_code - /* Exception handlers. */ romReserved: - b romReserved + b romReserved romExcHandle: - b romExcHandle + b romExcHandle diff --git a/cpu/mpc512x/config.mk b/cpu/mpc512x/config.mk index 3259d53a13..8a07c5a3b6 100644 --- a/cpu/mpc512x/config.mk +++ b/cpu/mpc512x/config.mk @@ -19,7 +19,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \ -ffixed-r2 -ffixed-r29 -msoft-float -mcpu=603e diff --git a/cpu/mpc5xx/config.mk b/cpu/mpc5xx/config.mk index e95b8a1a85..64cd60071a 100644 --- a/cpu/mpc5xx/config.mk +++ b/cpu/mpc5xx/config.mk @@ -28,7 +28,7 @@ # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_5xx -ffixed-r2 -ffixed-r29 -mpowerpc -msoft-float diff --git a/cpu/mpc5xx/u-boot.lds b/cpu/mpc5xx/u-boot.lds index 10001b1c1d..5b03fef66c 100644 --- a/cpu/mpc5xx/u-boot.lds +++ b/cpu/mpc5xx/u-boot.lds @@ -59,6 +59,7 @@ SECTIONS cpu/mpc5xx/start.o (.text) *(.text) + *(.fixup) *(.got1) } _etext = .; diff --git a/cpu/mpc5xxx/config.mk b/cpu/mpc5xxx/config.mk index 0e861c4a0f..0df51babd7 100644 --- a/cpu/mpc5xxx/config.mk +++ b/cpu/mpc5xxx/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 -ffixed-r29 \ -mstring -mcpu=603e -mmultiple diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index 7f16b92a6c..e4d6168224 100644 --- a/cpu/mpc5xxx/cpu.c +++ b/cpu/mpc5xxx/cpu.c @@ -35,6 +35,7 @@ #if defined(CONFIG_OF_LIBFDT) #include #include +#include #endif DECLARE_GLOBAL_DATA_PTR; @@ -114,42 +115,19 @@ unsigned long get_tbclk (void) /* ------------------------------------------------------------------------- */ #ifdef CONFIG_OF_LIBFDT -static void do_fixup(void *fdt, const char *node, const char *prop, - const void *val, int len, int create) -{ -#if defined(DEBUG) - int i; - debug("Updating property '%s/%s' = ", node, prop); - for (i = 0; i < len; i++) - debug(" %.2x", *(u8*)(val+i)); - debug("\n"); -#endif - int rc = fdt_find_and_setprop(fdt, node, prop, val, len, create); - if (rc) - printf("Unable to update property %s:%s, err=%s\n", - node, prop, fdt_strerror(rc)); -} - -static void do_fixup_u32(void *fdt, const char *node, const char *prop, - u32 val, int create) -{ - val = cpu_to_fdt32(val); - do_fixup(fdt, node, prop, &val, sizeof(val), create); -} - void ft_cpu_setup(void *blob, bd_t *bd) { int div = in_8((void*)CFG_MBAR + 0x204) & 0x0020 ? 8 : 4; char * cpu_path = "/cpus/" OF_CPU; char * eth_path = "/" OF_SOC "/ethernet@3000"; - do_fixup_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1); - do_fixup_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); - do_fixup_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); - do_fixup_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipbfreq, 1); - do_fixup_u32(blob, "/" OF_SOC, "system-frequency", - bd->bi_busfreq*div, 1); - do_fixup(blob, eth_path, "mac-address", bd->bi_enetaddr, 6, 0); - do_fixup(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0); + do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1); + do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); + do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); + do_fixup_by_path_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipbfreq, 1); + do_fixup_by_path_u32(blob, "/" OF_SOC, "system-frequency", + bd->bi_busfreq*div, 1); + do_fixup_by_path(blob, eth_path, "mac-address", bd->bi_enetaddr, 6, 0); + do_fixup_by_path(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0); } #endif diff --git a/cpu/mpc5xxx/u-boot-customlayout.lds b/cpu/mpc5xxx/u-boot-customlayout.lds index 11079430d5..123a14c5aa 100644 --- a/cpu/mpc5xxx/u-boot-customlayout.lds +++ b/cpu/mpc5xxx/u-boot-customlayout.lds @@ -66,6 +66,7 @@ SECTIONS common/environment.o (.ppcenv) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc5xxx/u-boot.lds b/cpu/mpc5xxx/u-boot.lds index a28a3afc71..78818a49eb 100644 --- a/cpu/mpc5xxx/u-boot.lds +++ b/cpu/mpc5xxx/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { cpu/mpc5xxx/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc8220/config.mk b/cpu/mpc8220/config.mk index c41cafe97f..8e3ba54287 100644 --- a/cpu/mpc8220/config.mk +++ b/cpu/mpc8220/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 -ffixed-r29 \ -mstring -mcpu=603e -mmultiple diff --git a/cpu/mpc8220/u-boot.lds b/cpu/mpc8220/u-boot.lds index a199a64f13..889bc77d2f 100644 --- a/cpu/mpc8220/u-boot.lds +++ b/cpu/mpc8220/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { cpu/mpc8220/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc824x/config.mk b/cpu/mpc824x/config.mk index 17fdb21d35..66207f4354 100644 --- a/cpu/mpc824x/config.mk +++ b/cpu/mpc824x/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -ffixed-r29 -mstring -mcpu=603e -msoft-float diff --git a/cpu/mpc824x/interrupts.c b/cpu/mpc824x/interrupts.c index acb8947e0d..4359ecc05e 100644 --- a/cpu/mpc824x/interrupts.c +++ b/cpu/mpc824x/interrupts.c @@ -86,7 +86,7 @@ void irq_free_handler (int vec) vga? */ -void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp) +void timer_interrupt_cpu (struct pt_regs *regs) { /* nothing to do here */ return; diff --git a/cpu/mpc824x/u-boot.lds b/cpu/mpc824x/u-boot.lds index 8cbef4aed4..c90d1e9457 100644 --- a/cpu/mpc824x/u-boot.lds +++ b/cpu/mpc824x/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { cpu/mpc824x/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc8260/config.mk b/cpu/mpc8260/config.mk index d401e4ca04..683b6fbf2b 100644 --- a/cpu/mpc8260/config.mk +++ b/cpu/mpc8260/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 -ffixed-r29 \ -mstring -mcpu=603e -mmultiple diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c index 94651dc4a6..55e61a1887 100644 --- a/cpu/mpc8260/cpu.c +++ b/cpu/mpc8260/cpu.c @@ -47,6 +47,12 @@ #include #include +#if defined(CONFIG_OF_LIBFDT) +#include +#include +#include +#endif + DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_GET_CPU_STR_F) @@ -294,3 +300,13 @@ void watchdog_reset (void) #endif /* CONFIG_WATCHDOG */ /* ------------------------------------------------------------------------- */ +#if defined(CONFIG_OF_LIBFDT) +void ft_cpu_setup (void *blob, bd_t *bd) +{ + char * cpu_path = "/cpus/" OF_CPU; + + do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); + do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1); + do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); +} +#endif /* CONFIG_OF_LIBFDT */ diff --git a/cpu/mpc8260/u-boot.lds b/cpu/mpc8260/u-boot.lds index b8abc17d41..3e84f234d7 100644 --- a/cpu/mpc8260/u-boot.lds +++ b/cpu/mpc8260/u-boot.lds @@ -55,6 +55,7 @@ SECTIONS { cpu/mpc8260/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc83xx/config.mk b/cpu/mpc83xx/config.mk index 2ec395d4ca..ecf8a60bbe 100644 --- a/cpu/mpc83xx/config.mk +++ b/cpu/mpc83xx/config.mk @@ -20,7 +20,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -mrelocatable +PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC83XX -DCONFIG_E300 \ -ffixed-r2 -ffixed-r29 -msoft-float diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c index e634f0a25b..b2c35d3007 100644 --- a/cpu/mpc83xx/cpu.c +++ b/cpu/mpc83xx/cpu.c @@ -529,7 +529,7 @@ ft_cpu_setup(void *blob, bd_t *bd) int tmp[2]; for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) { - nodeoffset = fdt_find_node_by_path(blob, fixup_props[j].node); + nodeoffset = fdt_path_offset(blob, fixup_props[j].node); if (nodeoffset >= 0) { err = fixup_props[j].set_fn(blob, nodeoffset, fixup_props[j].prop, bd); @@ -544,7 +544,7 @@ ft_cpu_setup(void *blob, bd_t *bd) } /* update, or add and update /memory node */ - nodeoffset = fdt_find_node_by_path(blob, "/memory"); + nodeoffset = fdt_path_offset(blob, "/memory"); if (nodeoffset < 0) { nodeoffset = fdt_add_subnode(blob, 0, "memory"); if (nodeoffset < 0) diff --git a/cpu/mpc83xx/pci.c b/cpu/mpc83xx/pci.c index 5675afe971..0defb0ec89 100644 --- a/cpu/mpc83xx/pci.c +++ b/cpu/mpc83xx/pci.c @@ -179,7 +179,7 @@ void ft_pci_setup(void *blob, bd_t *bd) if (pci_num_buses < 1) return; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[0].first_busno); tmp[1] = cpu_to_be32(pci_hose[0].last_busno); @@ -194,7 +194,7 @@ void ft_pci_setup(void *blob, bd_t *bd) if (pci_num_buses < 2) return; - nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8600"); + nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8600"); if (nodeoffset >= 0) { tmp[0] = cpu_to_be32(pci_hose[0].first_busno); tmp[1] = cpu_to_be32(pci_hose[0].last_busno); diff --git a/cpu/mpc83xx/u-boot.lds b/cpu/mpc83xx/u-boot.lds index ca663bc87b..937c87a27c 100644 --- a/cpu/mpc83xx/u-boot.lds +++ b/cpu/mpc83xx/u-boot.lds @@ -52,6 +52,7 @@ SECTIONS { cpu/mpc83xx/start.o (.text) *(.text) + *(.fixup) *(.got1) . = ALIGN(16); *(.rodata) diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c index 08e04685f5..bbc54448da 100644 --- a/cpu/mpc85xx/cpu.c +++ b/cpu/mpc85xx/cpu.c @@ -163,7 +163,12 @@ int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) * Initiate hard reset in debug control register DBCR0 * Make sure MSR[DE] = 1 */ - unsigned long val; + unsigned long val, msr; + + msr = mfmsr (); + msr |= MSR_DE; + mtmsr (msr); + val = mfspr(DBCR0); val |= 0x70000000; mtspr(DBCR0,val); diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index 2c98c2ad8a..b769ef8a76 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -218,6 +218,8 @@ _start_e500: bdnz 0b /* Clear and set up some registers. */ + li r0,0 + mtmsr r0 li r0,0x0000 lis r1,0xffff mtspr DEC,r0 /* prevent dec exceptions */ @@ -266,18 +268,17 @@ _start_e500: */ lis r3,CFG_INIT_RAM_ADDR@h ori r3,r3,CFG_INIT_RAM_ADDR@l - li r2,512 /* 512*32=16K */ + li r2,(CFG_DCACHE_SIZE / (2 * CFG_CACHELINE_SIZE)) mtctr r2 li r0,0 1: dcbz r0,r3 dcbtls 0,r0,r3 - addi r3,r3,32 + addi r3,r3,CFG_CACHELINE_SIZE bdnz 1b /* Jump out the last 4K page and continue to 'normal' start */ #ifdef CFG_RAMBOOT - bl 3f b _start_cont #else /* Calculate absolute address in FLASH and jump there */ @@ -286,15 +287,9 @@ _start_e500: ori r3,r3,CFG_MONITOR_BASE@l addi r3,r3,_start_cont - _start + _START_OFFSET mtlr r3 + blr #endif -3: li r0,0 - mtspr SRR1,r0 /* Keep things disabled for now */ - mflr r1 - mtspr SRR0,r1 - rfi - isync - .text .globl _start _start: @@ -701,6 +696,7 @@ in8: .globl out8 out8: stb r4,0x0000(r3) + sync blr /*------------------------------------------------------------------------------- */ @@ -710,6 +706,7 @@ out8: .globl out16 out16: sth r4,0x0000(r3) + sync blr /*------------------------------------------------------------------------------- */ @@ -719,6 +716,7 @@ out16: .globl out16r out16r: sthbrx r4,r0,r3 + sync blr /*------------------------------------------------------------------------------- */ @@ -728,6 +726,7 @@ out16r: .globl out32 out32: stw r4,0x0000(r3) + sync blr /*------------------------------------------------------------------------------- */ @@ -737,6 +736,7 @@ out32: .globl out32r out32r: stwbrx r4,r0,r3 + sync blr /*------------------------------------------------------------------------------- */ @@ -1061,11 +1061,11 @@ unlock_ram_in_cache: /* invalidate the INIT_RAM section */ lis r3,(CFG_INIT_RAM_ADDR & ~31)@h ori r3,r3,(CFG_INIT_RAM_ADDR & ~31)@l - li r4,512 + li r4,(CFG_DCACHE_SIZE / (2 * CFG_CACHELINE_SIZE)) mtctr r4 1: icbi r0,r3 dcbi r0,r3 - addi r3,r3,32 + addi r3,r3,CFG_CACHELINE_SIZE bdnz 1b sync /* Wait for all icbi to complete on bus */ isync diff --git a/cpu/mpc86xx/cpu.c b/cpu/mpc86xx/cpu.c index 9456471e84..d83bedd6e0 100644 --- a/cpu/mpc86xx/cpu.c +++ b/cpu/mpc86xx/cpu.c @@ -120,7 +120,7 @@ checkcpu(void) static inline void soft_restart(unsigned long addr) { -#ifndef CONFIG_MPC8641HPCN +#if !defined(CONFIG_MPC8641HPCN) && !defined(CONFIG_MPC8610HPCD) /* * SRR0 has system reset vector, SRR1 has default MSR value @@ -148,7 +148,7 @@ soft_restart(unsigned long addr) void do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { -#ifndef CONFIG_MPC8641HPCN +#if !defined(CONFIG_MPC8641HPCN) && !defined(CONFIG_MPC8610HPCD) #ifdef CFG_RESET_ADDRESS ulong addr = CFG_RESET_ADDRESS; diff --git a/cpu/mpc86xx/spd_sdram.c b/cpu/mpc86xx/spd_sdram.c index 059097f514..265e033fb3 100644 --- a/cpu/mpc86xx/spd_sdram.c +++ b/cpu/mpc86xx/spd_sdram.c @@ -1114,8 +1114,10 @@ spd_sdram(void) int memsize_ddr1 = 0; unsigned int law_size_ddr1; volatile immap_t *immap = (immap_t *)CFG_IMMR; - volatile ccsr_ddr_t *ddr1 = &immap->im_ddr1; volatile ccsr_local_mcm_t *mcm = &immap->im_local_mcm; +#ifdef CONFIG_DDR_INTERLEAVE + volatile ccsr_ddr_t *ddr1 = &immap->im_ddr1; +#endif #if (CONFIG_NUM_DDR_CONTROLLERS > 1) int memsize_ddr2_dimm1 = 0; @@ -1270,10 +1272,12 @@ spd_sdram(void) debug("\nDDR: LAWBAR8=0x%08x\n", mcm->lawbar8); debug("DDR: LAWAR8=0x%08x\n", mcm->lawar8); } + + debug("\nMemory size of DDR2 = 0x%08lx\n", memsize_ddr2); + #endif /* CONFIG_NUM_DDR_CONTROLLERS > 1 */ - debug("\nMemory sizes are DDR1 = 0x%08lx, DDR2 = 0x%08lx\n", - memsize_ddr1, memsize_ddr2); + debug("\nMemory size of DDR1 = 0x%08lx\n", memsize_ddr1); /* * If neither DDR controller is enabled return 0. diff --git a/cpu/mpc86xx/speed.c b/cpu/mpc86xx/speed.c index 23161ca8cb..4f7e8f17dc 100644 --- a/cpu/mpc86xx/speed.c +++ b/cpu/mpc86xx/speed.c @@ -31,6 +31,9 @@ DECLARE_GLOBAL_DATA_PTR; +/* used in some defintiions of CONFIG_SYS_CLK_FREQ */ +extern unsigned long get_board_sys_clk(unsigned long dummy); + void get_sys_info(sys_info_t *sysInfo) { volatile immap_t *immap = (immap_t *) CFG_IMMR; diff --git a/cpu/pxa/i2c.c b/cpu/pxa/i2c.c index 722d949473..92dd19f95f 100644 --- a/cpu/pxa/i2c.c +++ b/cpu/pxa/i2c.c @@ -457,7 +457,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) uchar i2c_reg_read (uchar chip, uchar reg) { - char buf; + uchar buf; PRINTD(("i2c_reg_read(chip=0x%02x, reg=0x%02x)\n",chip,reg)); i2c_read(chip, reg, 1, &buf, 1); diff --git a/disk/Makefile b/disk/Makefile index 1a929ce6de..f19d18d89f 100644 --- a/disk/Makefile +++ b/disk/Makefile @@ -27,8 +27,13 @@ include $(TOPDIR)/config.mk LIB = $(obj)libdisk.a -COBJS = part.o part_mac.o part_dos.o part_iso.o part_amiga.o +COBJS-y += part.o +COBJS-y += part_mac.o +COBJS-y += part_dos.o +COBJS-y += part_iso.o +COBJS-y += part_amiga.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/drivers/Makefile b/drivers/Makefile deleted file mode 100755 index 00978d8285..0000000000 --- a/drivers/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# (C) Copyright 2000-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 - -# CFLAGS += -DET_DEBUG -DDEBUG - -LIB = $(obj)libdrivers.a - -COBJS = 3c589.o 5701rls.o ali512x.o at45.o ata_piix.o \ - ati_radeon_fb.o atmel_usart.o \ - bcm570x.o bcm570x_autoneg.o cfb_console.o cfi_flash.o \ - cs8900.o ct69000.o dataflash.o dc2114x.o dm9000x.o \ - ds1722.o e1000.o eepro100.o enc28j60.o \ - fsl_i2c.o fsl_pci_init.o \ - i8042.o inca-ip_sw.o isp116x-hcd.o \ - keyboard.o ks8695eth.o \ - lan91c96.o macb.o mpc8xx_pcmcia.o mw_eeprom.o \ - natsemi.o ne2000.o netarm_eth.o netconsole.o \ - ns16550.o ns8382x.o ns87308.o ns7520_eth.o omap1510_i2c.o \ - omap24xx_i2c.o pc_keyb.o \ - pci.o pci_auto.o pci_indirect.o \ - pcnet.o plb2800_eth.o ps2ser.o ps2mult.o pxa_pcmcia.o \ - rpx_pcmcia.o rtl8019.o rtl8139.o rtl8169.o \ - s3c4510b_eth.o s3c4510b_uart.o \ - sed13806.o sed156x.o \ - serial.o serial_max3100.o \ - serial_pl010.o serial_pl011.o serial_xuartlite.o \ - sil680.o sl811_usb.o sm501.o smc91111.o smiLynxEM.o \ - status_led.o sym53c8xx.o systemace.o ahci.o \ - ti_pci1410a.o tigon3.o tqm8xx_pcmcia.o tsec.o \ - tsi108_eth.o tsi108_i2c.o tsi108_pci.o \ - usb_ohci.o \ - usbdcore.o usbdcore_ep0.o usbdcore_mpc8xx.o usbdcore_omap1510.o \ - usbtty.o \ - videomodes.o w83c553f.o - -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -all: $(LIB) - -$(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/drivers/bios_emulator/besys.c b/drivers/bios_emulator/besys.c index 8f1d8b29d5..cb1b0c1b95 100644 --- a/drivers/bios_emulator/besys.c +++ b/drivers/bios_emulator/besys.c @@ -96,7 +96,7 @@ static u8 *BE_memaddr(u32 addr) else if (addr >= 0xFFFF5 && addr < 0xFFFFE) { /* Return a faked BIOS date string for non-x86 machines */ DB(printf("BE_memaddr - Returning BIOS date\n");) - return BE_biosDate + addr - 0xFFFF5; + return (u8 *)(BE_biosDate + addr - 0xFFFF5); } else if (addr == 0xFFFFE) { /* Return system model identifier for non-x86 machines */ DB(printf("BE_memaddr - Returning model\n");) diff --git a/drivers/bios_emulator/biosemu.c b/drivers/bios_emulator/biosemu.c index ccfc872f78..75ceb458cf 100644 --- a/drivers/bios_emulator/biosemu.c +++ b/drivers/bios_emulator/biosemu.c @@ -96,7 +96,7 @@ int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info, int shared) return 0; } - M.mem_base = (unsigned long)malloc(memSize); + M.mem_base = malloc(memSize); if (M.mem_base == NULL){ printf("Biosemu:Out of memory!"); @@ -106,7 +106,7 @@ int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info, int shared) _BE_env.emulateVGA = 0; _BE_env.busmem_base = (unsigned long)malloc(128 * 1024); - if (_BE_env.busmem_base == NULL){ + if ((void *)_BE_env.busmem_base == NULL){ printf("Biosemu:Out of memory!"); return 0; } @@ -230,7 +230,7 @@ Cleans up and exits the emulator. void X86API BE_exit(void) { free(M.mem_base); - free(_BE_env.busmem_base); + free((void *)_BE_env.busmem_base); } /**************************************************************************** diff --git a/drivers/block/Makefile b/drivers/block/Makefile new file mode 100644 index 0000000000..e069969e68 --- /dev/null +++ b/drivers/block/Makefile @@ -0,0 +1,50 @@ +# +# (C) Copyright 2000-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)libblock.a + +COBJS-y += ahci.o +COBJS-y += ata_piix.o +COBJS-y += sil680.o +COBJS-y += sym53c8xx.o +COBJS-y += systemace.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/ahci.c b/drivers/block/ahci.c similarity index 100% rename from drivers/ahci.c rename to drivers/block/ahci.c diff --git a/drivers/ata_piix.c b/drivers/block/ata_piix.c similarity index 100% rename from drivers/ata_piix.c rename to drivers/block/ata_piix.c diff --git a/drivers/sil680.c b/drivers/block/sil680.c similarity index 100% rename from drivers/sil680.c rename to drivers/block/sil680.c diff --git a/drivers/sym53c8xx.c b/drivers/block/sym53c8xx.c similarity index 100% rename from drivers/sym53c8xx.c rename to drivers/block/sym53c8xx.c diff --git a/drivers/systemace.c b/drivers/block/systemace.c similarity index 100% rename from drivers/systemace.c rename to drivers/block/systemace.c diff --git a/dtt/Makefile b/drivers/hwmon/Makefile similarity index 89% rename from dtt/Makefile rename to drivers/hwmon/Makefile index c6a670af17..cebb2ba635 100644 --- a/dtt/Makefile +++ b/drivers/hwmon/Makefile @@ -28,10 +28,16 @@ include $(TOPDIR)/config.mk #CFLAGS += -DDEBUG -LIB = $(obj)libdtt.a +LIB = $(obj)libhwmon.a -COBJS = lm75.o ds1621.o adm1021.o lm81.o ds1775.o +COBJS-y += adm1021.o +COBJS-y += ds1621.o +COBJS-y += ds1722.o +COBJS-y += ds1775.o +COBJS-y += lm75.o +COBJS-y += lm81.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/dtt/adm1021.c b/drivers/hwmon/adm1021.c similarity index 100% rename from dtt/adm1021.c rename to drivers/hwmon/adm1021.c diff --git a/dtt/ds1621.c b/drivers/hwmon/ds1621.c similarity index 100% rename from dtt/ds1621.c rename to drivers/hwmon/ds1621.c diff --git a/drivers/ds1722.c b/drivers/hwmon/ds1722.c similarity index 100% rename from drivers/ds1722.c rename to drivers/hwmon/ds1722.c diff --git a/dtt/ds1775.c b/drivers/hwmon/ds1775.c similarity index 100% rename from dtt/ds1775.c rename to drivers/hwmon/ds1775.c diff --git a/dtt/lm75.c b/drivers/hwmon/lm75.c similarity index 100% rename from dtt/lm75.c rename to drivers/hwmon/lm75.c diff --git a/dtt/lm81.c b/drivers/hwmon/lm81.c similarity index 100% rename from dtt/lm81.c rename to drivers/hwmon/lm81.c diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile new file mode 100644 index 0000000000..29d6c03dbb --- /dev/null +++ b/drivers/i2c/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-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)libi2c.a + +COBJS-y += fsl_i2c.o +COBJS-y += omap1510_i2c.o +COBJS-y += omap24xx_i2c.o +COBJS-y += tsi108_i2c.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/fsl_i2c.c b/drivers/i2c/fsl_i2c.c similarity index 100% rename from drivers/fsl_i2c.c rename to drivers/i2c/fsl_i2c.c diff --git a/drivers/omap1510_i2c.c b/drivers/i2c/omap1510_i2c.c similarity index 100% rename from drivers/omap1510_i2c.c rename to drivers/i2c/omap1510_i2c.c diff --git a/drivers/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c similarity index 100% rename from drivers/omap24xx_i2c.c rename to drivers/i2c/omap24xx_i2c.c diff --git a/drivers/tsi108_i2c.c b/drivers/i2c/tsi108_i2c.c similarity index 99% rename from drivers/tsi108_i2c.c rename to drivers/i2c/tsi108_i2c.c index 3a3b75c39b..d6736b0477 100644 --- a/drivers/tsi108_i2c.c +++ b/drivers/i2c/tsi108_i2c.c @@ -276,7 +276,7 @@ int i2c_probe (uchar chip) * The Tsi108 HW doesn't support sending just the chip address * and checkong for an back. */ - return i2c_read (chip, 0, 1, (char *)&tmp, 1); + return i2c_read (chip, 0, 1, (uchar *)&tmp, 1); } #endif diff --git a/drivers/input/Makefile b/drivers/input/Makefile new file mode 100644 index 0000000000..df22cf9c6d --- /dev/null +++ b/drivers/input/Makefile @@ -0,0 +1,48 @@ +# +# (C) Copyright 2000-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)libinput.a + +COBJS-y += i8042.o +COBJS-y += keyboard.o +COBJS-y += pc_keyb.o ps2ser.o ps2mult.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/i8042.c b/drivers/input/i8042.c similarity index 100% rename from drivers/i8042.c rename to drivers/input/i8042.c diff --git a/drivers/keyboard.c b/drivers/input/keyboard.c similarity index 100% rename from drivers/keyboard.c rename to drivers/input/keyboard.c diff --git a/drivers/pc_keyb.c b/drivers/input/pc_keyb.c similarity index 100% rename from drivers/pc_keyb.c rename to drivers/input/pc_keyb.c diff --git a/drivers/ps2mult.c b/drivers/input/ps2mult.c similarity index 100% rename from drivers/ps2mult.c rename to drivers/input/ps2mult.c diff --git a/drivers/ps2ser.c b/drivers/input/ps2ser.c similarity index 100% rename from drivers/ps2ser.c rename to drivers/input/ps2ser.c diff --git a/drivers/nand/Makefile b/drivers/misc/Makefile similarity index 90% rename from drivers/nand/Makefile rename to drivers/misc/Makefile index fb0185b991..78cec21fba 100644 --- a/drivers/nand/Makefile +++ b/drivers/misc/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2006 +# (C) Copyright 2000-2007 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -23,10 +23,13 @@ include $(TOPDIR)/config.mk -LIB := $(obj)libnand.a +LIB := $(obj)libmisc.a -COBJS := nand.o nand_base.o nand_ids.o nand_ecc.o nand_bbt.o nand_util.o +COBJS-y += ali512x.o +COBJS-y += ns87308.o +COBJS-y += status_led.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/drivers/ali512x.c b/drivers/misc/ali512x.c similarity index 100% rename from drivers/ali512x.c rename to drivers/misc/ali512x.c diff --git a/drivers/ns87308.c b/drivers/misc/ns87308.c similarity index 100% rename from drivers/ns87308.c rename to drivers/misc/ns87308.c diff --git a/drivers/status_led.c b/drivers/misc/status_led.c similarity index 100% rename from drivers/status_led.c rename to drivers/misc/status_led.c diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile new file mode 100644 index 0000000000..95c5e02af9 --- /dev/null +++ b/drivers/mtd/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-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)libmtd.a + +COBJS-y += at45.o +COBJS-y += cfi_flash.o +COBJS-y += dataflash.o +COBJS-y += mw_eeprom.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/at45.c b/drivers/mtd/at45.c similarity index 100% rename from drivers/at45.c rename to drivers/mtd/at45.c diff --git a/drivers/cfi_flash.c b/drivers/mtd/cfi_flash.c similarity index 100% rename from drivers/cfi_flash.c rename to drivers/mtd/cfi_flash.c diff --git a/drivers/dataflash.c b/drivers/mtd/dataflash.c similarity index 100% rename from drivers/dataflash.c rename to drivers/mtd/dataflash.c diff --git a/drivers/mw_eeprom.c b/drivers/mtd/mw_eeprom.c similarity index 100% rename from drivers/mw_eeprom.c rename to drivers/mtd/mw_eeprom.c diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile new file mode 100644 index 0000000000..42864f98f4 --- /dev/null +++ b/drivers/mtd/nand/Makefile @@ -0,0 +1,51 @@ +# +# (C) Copyright 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 + +LIB := $(obj)libnand.a + +COBJS-y += nand.o +COBJS-y += nand_base.o +COBJS-y += nand_ids.o +COBJS-y += nand_ecc.o +COBJS-y += nand_bbt.o +COBJS-y += nand_util.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c similarity index 100% rename from drivers/nand/diskonchip.c rename to drivers/mtd/nand/diskonchip.c diff --git a/drivers/nand/nand.c b/drivers/mtd/nand/nand.c similarity index 100% rename from drivers/nand/nand.c rename to drivers/mtd/nand/nand.c diff --git a/drivers/nand/nand_base.c b/drivers/mtd/nand/nand_base.c similarity index 100% rename from drivers/nand/nand_base.c rename to drivers/mtd/nand/nand_base.c diff --git a/drivers/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c similarity index 100% rename from drivers/nand/nand_bbt.c rename to drivers/mtd/nand/nand_bbt.c diff --git a/drivers/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c similarity index 100% rename from drivers/nand/nand_ecc.c rename to drivers/mtd/nand/nand_ecc.c diff --git a/drivers/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c similarity index 100% rename from drivers/nand/nand_ids.c rename to drivers/mtd/nand/nand_ids.c diff --git a/drivers/nand/nand_util.c b/drivers/mtd/nand/nand_util.c similarity index 100% rename from drivers/nand/nand_util.c rename to drivers/mtd/nand/nand_util.c diff --git a/drivers/nand_legacy/Makefile b/drivers/mtd/nand_legacy/Makefile similarity index 100% rename from drivers/nand_legacy/Makefile rename to drivers/mtd/nand_legacy/Makefile diff --git a/drivers/nand_legacy/nand_legacy.c b/drivers/mtd/nand_legacy/nand_legacy.c similarity index 100% rename from drivers/nand_legacy/nand_legacy.c rename to drivers/mtd/nand_legacy/nand_legacy.c diff --git a/drivers/onenand/Makefile b/drivers/mtd/onenand/Makefile similarity index 100% rename from drivers/onenand/Makefile rename to drivers/mtd/onenand/Makefile diff --git a/drivers/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c similarity index 100% rename from drivers/onenand/onenand_base.c rename to drivers/mtd/onenand/onenand_base.c diff --git a/drivers/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c similarity index 100% rename from drivers/onenand/onenand_bbt.c rename to drivers/mtd/onenand/onenand_bbt.c diff --git a/drivers/3c589.c b/drivers/net/3c589.c similarity index 100% rename from drivers/3c589.c rename to drivers/net/3c589.c diff --git a/drivers/3c589.h b/drivers/net/3c589.h similarity index 100% rename from drivers/3c589.h rename to drivers/net/3c589.h diff --git a/drivers/5701rls.c b/drivers/net/5701rls.c similarity index 100% rename from drivers/5701rls.c rename to drivers/net/5701rls.c diff --git a/drivers/5701rls.h b/drivers/net/5701rls.h similarity index 100% rename from drivers/5701rls.h rename to drivers/net/5701rls.h diff --git a/drivers/8390.h b/drivers/net/8390.h similarity index 100% rename from drivers/8390.h rename to drivers/net/8390.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 37d69b9949..41e1bdeb3b 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -25,8 +25,39 @@ include $(TOPDIR)/config.mk LIB := $(obj)libnet.a -COBJS := mcffec.o +COBJS-y += 3c589.o +COBJS-y += bcm570x.o bcm570x_autoneg.o 5701rls.o +COBJS-y += cs8900.o +COBJS-y += dc2114x.o +COBJS-y += dm9000x.o +COBJS-y += e1000.o +COBJS-y += eepro100.o +COBJS-y += enc28j60.o +COBJS-y += inca-ip_sw.o +COBJS-y += ks8695eth.o +COBJS-y += lan91c96.o +COBJS-y += macb.o +COBJS-y += mcffec.o +COBJS-y += natsemi.o +COBJS-y += ne2000.o +COBJS-y += netarm_eth.o +COBJS-y += netconsole.o +COBJS-y += ns7520_eth.o +COBJS-y += ns8382x.o +COBJS-y += ns9750_eth.o +COBJS-y += pcnet.o +COBJS-y += plb2800_eth.o +COBJS-y += rtl8019.o +COBJS-y += rtl8139.o +COBJS-y += rtl8169.o +COBJS-y += s3c4510b_eth.o +COBJS-y += smc91111.o +COBJS-y += tigon3.o +COBJS-y += tsec.o +COBJS-y += tsi108_eth.o +COBJS-y += uli526x.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/drivers/bcm570x.c b/drivers/net/bcm570x.c similarity index 100% rename from drivers/bcm570x.c rename to drivers/net/bcm570x.c diff --git a/drivers/bcm570x_autoneg.c b/drivers/net/bcm570x_autoneg.c similarity index 100% rename from drivers/bcm570x_autoneg.c rename to drivers/net/bcm570x_autoneg.c diff --git a/drivers/bcm570x_autoneg.h b/drivers/net/bcm570x_autoneg.h similarity index 100% rename from drivers/bcm570x_autoneg.h rename to drivers/net/bcm570x_autoneg.h diff --git a/drivers/bcm570x_bits.h b/drivers/net/bcm570x_bits.h similarity index 100% rename from drivers/bcm570x_bits.h rename to drivers/net/bcm570x_bits.h diff --git a/drivers/bcm570x_debug.h b/drivers/net/bcm570x_debug.h similarity index 100% rename from drivers/bcm570x_debug.h rename to drivers/net/bcm570x_debug.h diff --git a/drivers/bcm570x_lm.h b/drivers/net/bcm570x_lm.h similarity index 100% rename from drivers/bcm570x_lm.h rename to drivers/net/bcm570x_lm.h diff --git a/drivers/bcm570x_mm.h b/drivers/net/bcm570x_mm.h similarity index 100% rename from drivers/bcm570x_mm.h rename to drivers/net/bcm570x_mm.h diff --git a/drivers/bcm570x_queue.h b/drivers/net/bcm570x_queue.h similarity index 100% rename from drivers/bcm570x_queue.h rename to drivers/net/bcm570x_queue.h diff --git a/drivers/cs8900.c b/drivers/net/cs8900.c similarity index 100% rename from drivers/cs8900.c rename to drivers/net/cs8900.c diff --git a/drivers/cs8900.h b/drivers/net/cs8900.h similarity index 100% rename from drivers/cs8900.h rename to drivers/net/cs8900.h diff --git a/drivers/dc2114x.c b/drivers/net/dc2114x.c similarity index 100% rename from drivers/dc2114x.c rename to drivers/net/dc2114x.c diff --git a/drivers/dm9000x.c b/drivers/net/dm9000x.c similarity index 100% rename from drivers/dm9000x.c rename to drivers/net/dm9000x.c diff --git a/drivers/dm9000x.h b/drivers/net/dm9000x.h similarity index 100% rename from drivers/dm9000x.h rename to drivers/net/dm9000x.h diff --git a/drivers/e1000.c b/drivers/net/e1000.c similarity index 100% rename from drivers/e1000.c rename to drivers/net/e1000.c diff --git a/drivers/e1000.h b/drivers/net/e1000.h similarity index 100% rename from drivers/e1000.h rename to drivers/net/e1000.h diff --git a/drivers/eepro100.c b/drivers/net/eepro100.c similarity index 100% rename from drivers/eepro100.c rename to drivers/net/eepro100.c diff --git a/drivers/enc28j60.c b/drivers/net/enc28j60.c similarity index 100% rename from drivers/enc28j60.c rename to drivers/net/enc28j60.c diff --git a/drivers/inca-ip_sw.c b/drivers/net/inca-ip_sw.c similarity index 100% rename from drivers/inca-ip_sw.c rename to drivers/net/inca-ip_sw.c diff --git a/drivers/ks8695eth.c b/drivers/net/ks8695eth.c similarity index 100% rename from drivers/ks8695eth.c rename to drivers/net/ks8695eth.c diff --git a/drivers/lan91c96.c b/drivers/net/lan91c96.c similarity index 100% rename from drivers/lan91c96.c rename to drivers/net/lan91c96.c diff --git a/drivers/lan91c96.h b/drivers/net/lan91c96.h similarity index 100% rename from drivers/lan91c96.h rename to drivers/net/lan91c96.h diff --git a/drivers/macb.c b/drivers/net/macb.c similarity index 100% rename from drivers/macb.c rename to drivers/net/macb.c diff --git a/drivers/macb.h b/drivers/net/macb.h similarity index 100% rename from drivers/macb.h rename to drivers/net/macb.h diff --git a/drivers/natsemi.c b/drivers/net/natsemi.c similarity index 100% rename from drivers/natsemi.c rename to drivers/net/natsemi.c diff --git a/drivers/ne2000.c b/drivers/net/ne2000.c similarity index 98% rename from drivers/ne2000.c rename to drivers/net/ne2000.c index 695a1dc6c9..c978d62ef3 100644 --- a/drivers/ne2000.c +++ b/drivers/net/ne2000.c @@ -723,7 +723,8 @@ static hw_info_t hw_info[] = { { /* SuperSocket RE450T */ 0x0110, 0x00, 0xe0, 0x98, 0 }, { /* Volktek NPL-402CT */ 0x0060, 0x00, 0x40, 0x05, 0 }, { /* NEC PC-9801N-J12 */ 0x0ff0, 0x00, 0x00, 0x4c, 0 }, - { /* PCMCIA Technology OEM */ 0x01c8, 0x00, 0xa0, 0x0c, 0 } + { /* PCMCIA Technology OEM */ 0x01c8, 0x00, 0xa0, 0x0c, 0 }, + { /* Qemu */ 0x0, 0x52, 0x54, 0x00, 0 } }; #define NR_INFO (sizeof(hw_info)/sizeof(hw_info_t)) @@ -824,30 +825,22 @@ static hw_info_t * get_prom(void ) { /* U-boot specific routines */ -#define NB 5 static unsigned char *pbuf = NULL; -static int plen[NB]; -static int nrx = 0; static int pkey = -1; static int initialized=0; void uboot_push_packet_len(int len) { - PRINTK("pushed len = %d, nrx = %d\n", len, nrx); + PRINTK("pushed len = %d\n", len); if (len>=2000) { printf("NE2000: packet too big\n"); return; } - if (nrx >= NB) { - printf("losing packets in rx\n"); - return; - } - plen[nrx] = len; - dp83902a_recv(&pbuf[nrx*2000], len); + dp83902a_recv(&pbuf[0], len); /*Just pass it to the upper layer*/ - NetReceive(&pbuf[nrx*2000], plen[nrx]); + NetReceive(&pbuf[0], len); } void uboot_push_tx_done(int key, int val) { @@ -862,9 +855,9 @@ int eth_init(bd_t *bd) { PRINTK("### eth_init\n"); if (!pbuf) { - pbuf = malloc(NB*2000); + pbuf = malloc(2000); if (!pbuf) { - printf("Cannot allocate rx buffers\n"); + printf("Cannot allocate rx buffer\n"); return -1; } } diff --git a/drivers/ne2000.h b/drivers/net/ne2000.h similarity index 100% rename from drivers/ne2000.h rename to drivers/net/ne2000.h diff --git a/drivers/netarm_eth.c b/drivers/net/netarm_eth.c similarity index 100% rename from drivers/netarm_eth.c rename to drivers/net/netarm_eth.c diff --git a/drivers/netarm_eth.h b/drivers/net/netarm_eth.h similarity index 100% rename from drivers/netarm_eth.h rename to drivers/net/netarm_eth.h diff --git a/drivers/netconsole.c b/drivers/net/netconsole.c similarity index 100% rename from drivers/netconsole.c rename to drivers/net/netconsole.c diff --git a/drivers/nicext.h b/drivers/net/nicext.h similarity index 100% rename from drivers/nicext.h rename to drivers/net/nicext.h diff --git a/drivers/ns7520_eth.c b/drivers/net/ns7520_eth.c similarity index 100% rename from drivers/ns7520_eth.c rename to drivers/net/ns7520_eth.c diff --git a/drivers/ns8382x.c b/drivers/net/ns8382x.c similarity index 100% rename from drivers/ns8382x.c rename to drivers/net/ns8382x.c diff --git a/drivers/ns9750_eth.c b/drivers/net/ns9750_eth.c similarity index 100% rename from drivers/ns9750_eth.c rename to drivers/net/ns9750_eth.c diff --git a/drivers/pcnet.c b/drivers/net/pcnet.c similarity index 100% rename from drivers/pcnet.c rename to drivers/net/pcnet.c diff --git a/drivers/plb2800_eth.c b/drivers/net/plb2800_eth.c similarity index 100% rename from drivers/plb2800_eth.c rename to drivers/net/plb2800_eth.c diff --git a/drivers/rtl8019.c b/drivers/net/rtl8019.c similarity index 100% rename from drivers/rtl8019.c rename to drivers/net/rtl8019.c diff --git a/drivers/rtl8019.h b/drivers/net/rtl8019.h similarity index 100% rename from drivers/rtl8019.h rename to drivers/net/rtl8019.h diff --git a/drivers/rtl8139.c b/drivers/net/rtl8139.c similarity index 100% rename from drivers/rtl8139.c rename to drivers/net/rtl8139.c diff --git a/drivers/rtl8169.c b/drivers/net/rtl8169.c similarity index 100% rename from drivers/rtl8169.c rename to drivers/net/rtl8169.c diff --git a/drivers/s3c4510b_eth.c b/drivers/net/s3c4510b_eth.c similarity index 99% rename from drivers/s3c4510b_eth.c rename to drivers/net/s3c4510b_eth.c index 48901aa12f..3d9066abea 100644 --- a/drivers/s3c4510b_eth.c +++ b/drivers/net/s3c4510b_eth.c @@ -175,7 +175,7 @@ s32 eth_send(volatile void *packet, s32 length) } /* copy user data into frame data pointer */ - memcpy((void *)(eth->m_curTX_FD->m_frameDataPtr.bf.dataPtr), + memcpy((void *)((u32)(eth->m_curTX_FD->m_frameDataPtr.bf.dataPtr)), (void *)packet, length); diff --git a/drivers/s3c4510b_eth.h b/drivers/net/s3c4510b_eth.h similarity index 100% rename from drivers/s3c4510b_eth.h rename to drivers/net/s3c4510b_eth.h diff --git a/drivers/sk98lin/Makefile b/drivers/net/sk98lin/Makefile similarity index 90% rename from drivers/sk98lin/Makefile rename to drivers/net/sk98lin/Makefile index 7e50b1df98..a7d4a3b7a7 100644 --- a/drivers/sk98lin/Makefile +++ b/drivers/net/sk98lin/Makefile @@ -29,12 +29,26 @@ include $(TOPDIR)/config.mk LIB := $(obj)libsk98lin.a -COBJS := skge.o skaddr.o skgehwt.o skgeinit.o skgepnmi.o skgesirq.o \ - ski2c.o sklm80.o skqueue.o skrlmt.o sktimer.o skvpd.o \ - skxmac2.o skcsum.o #skproc.o +COBJS-y += skge.o +COBJS-y += skaddr.o +COBJS-y += skgehwt.o +COBJS-y += skgeinit.o +COBJS-y += skgepnmi.o +COBJS-y += skgesirq.o +COBJS-y += ski2c.o +COBJS-y += sklm80.o +COBJS-y += skqueue.o +COBJS-y += skrlmt.o +COBJS-y += sktimer.o +COBJS-y += skvpd.o +COBJS-y += skxmac2.o +COBJS-y += skcsum.o +#COBJS-y += skproc.o -COBJS += uboot_skb.o uboot_drv.o +COBJS-y += uboot_skb.o +COBJS-y += uboot_drv.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/drivers/sk98lin/h/lm80.h b/drivers/net/sk98lin/h/lm80.h similarity index 100% rename from drivers/sk98lin/h/lm80.h rename to drivers/net/sk98lin/h/lm80.h diff --git a/drivers/sk98lin/h/skaddr.h b/drivers/net/sk98lin/h/skaddr.h similarity index 100% rename from drivers/sk98lin/h/skaddr.h rename to drivers/net/sk98lin/h/skaddr.h diff --git a/drivers/sk98lin/h/skcsum.h b/drivers/net/sk98lin/h/skcsum.h similarity index 100% rename from drivers/sk98lin/h/skcsum.h rename to drivers/net/sk98lin/h/skcsum.h diff --git a/drivers/sk98lin/h/skdebug.h b/drivers/net/sk98lin/h/skdebug.h similarity index 100% rename from drivers/sk98lin/h/skdebug.h rename to drivers/net/sk98lin/h/skdebug.h diff --git a/drivers/sk98lin/h/skdrv1st.h b/drivers/net/sk98lin/h/skdrv1st.h similarity index 100% rename from drivers/sk98lin/h/skdrv1st.h rename to drivers/net/sk98lin/h/skdrv1st.h diff --git a/drivers/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h similarity index 100% rename from drivers/sk98lin/h/skdrv2nd.h rename to drivers/net/sk98lin/h/skdrv2nd.h diff --git a/drivers/sk98lin/h/skerror.h b/drivers/net/sk98lin/h/skerror.h similarity index 100% rename from drivers/sk98lin/h/skerror.h rename to drivers/net/sk98lin/h/skerror.h diff --git a/drivers/sk98lin/h/skgedrv.h b/drivers/net/sk98lin/h/skgedrv.h similarity index 100% rename from drivers/sk98lin/h/skgedrv.h rename to drivers/net/sk98lin/h/skgedrv.h diff --git a/drivers/sk98lin/h/skgehw.h b/drivers/net/sk98lin/h/skgehw.h similarity index 100% rename from drivers/sk98lin/h/skgehw.h rename to drivers/net/sk98lin/h/skgehw.h diff --git a/drivers/sk98lin/h/skgehwt.h b/drivers/net/sk98lin/h/skgehwt.h similarity index 100% rename from drivers/sk98lin/h/skgehwt.h rename to drivers/net/sk98lin/h/skgehwt.h diff --git a/drivers/sk98lin/h/skgei2c.h b/drivers/net/sk98lin/h/skgei2c.h similarity index 100% rename from drivers/sk98lin/h/skgei2c.h rename to drivers/net/sk98lin/h/skgei2c.h diff --git a/drivers/sk98lin/h/skgeinit.h b/drivers/net/sk98lin/h/skgeinit.h similarity index 100% rename from drivers/sk98lin/h/skgeinit.h rename to drivers/net/sk98lin/h/skgeinit.h diff --git a/drivers/sk98lin/h/skgepnm2.h b/drivers/net/sk98lin/h/skgepnm2.h similarity index 100% rename from drivers/sk98lin/h/skgepnm2.h rename to drivers/net/sk98lin/h/skgepnm2.h diff --git a/drivers/sk98lin/h/skgepnmi.h b/drivers/net/sk98lin/h/skgepnmi.h similarity index 100% rename from drivers/sk98lin/h/skgepnmi.h rename to drivers/net/sk98lin/h/skgepnmi.h diff --git a/drivers/sk98lin/h/skgesirq.h b/drivers/net/sk98lin/h/skgesirq.h similarity index 100% rename from drivers/sk98lin/h/skgesirq.h rename to drivers/net/sk98lin/h/skgesirq.h diff --git a/drivers/sk98lin/h/ski2c.h b/drivers/net/sk98lin/h/ski2c.h similarity index 100% rename from drivers/sk98lin/h/ski2c.h rename to drivers/net/sk98lin/h/ski2c.h diff --git a/drivers/sk98lin/h/skqueue.h b/drivers/net/sk98lin/h/skqueue.h similarity index 100% rename from drivers/sk98lin/h/skqueue.h rename to drivers/net/sk98lin/h/skqueue.h diff --git a/drivers/sk98lin/h/skrlmt.h b/drivers/net/sk98lin/h/skrlmt.h similarity index 100% rename from drivers/sk98lin/h/skrlmt.h rename to drivers/net/sk98lin/h/skrlmt.h diff --git a/drivers/sk98lin/h/sktimer.h b/drivers/net/sk98lin/h/sktimer.h similarity index 100% rename from drivers/sk98lin/h/sktimer.h rename to drivers/net/sk98lin/h/sktimer.h diff --git a/drivers/sk98lin/h/sktypes.h b/drivers/net/sk98lin/h/sktypes.h similarity index 100% rename from drivers/sk98lin/h/sktypes.h rename to drivers/net/sk98lin/h/sktypes.h diff --git a/drivers/sk98lin/h/skversion.h b/drivers/net/sk98lin/h/skversion.h similarity index 100% rename from drivers/sk98lin/h/skversion.h rename to drivers/net/sk98lin/h/skversion.h diff --git a/drivers/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h similarity index 100% rename from drivers/sk98lin/h/skvpd.h rename to drivers/net/sk98lin/h/skvpd.h diff --git a/drivers/sk98lin/h/xmac_ii.h b/drivers/net/sk98lin/h/xmac_ii.h similarity index 100% rename from drivers/sk98lin/h/xmac_ii.h rename to drivers/net/sk98lin/h/xmac_ii.h diff --git a/drivers/sk98lin/skaddr.c b/drivers/net/sk98lin/skaddr.c similarity index 100% rename from drivers/sk98lin/skaddr.c rename to drivers/net/sk98lin/skaddr.c diff --git a/drivers/sk98lin/skcsum.c b/drivers/net/sk98lin/skcsum.c similarity index 100% rename from drivers/sk98lin/skcsum.c rename to drivers/net/sk98lin/skcsum.c diff --git a/drivers/sk98lin/skge.c b/drivers/net/sk98lin/skge.c similarity index 100% rename from drivers/sk98lin/skge.c rename to drivers/net/sk98lin/skge.c diff --git a/drivers/sk98lin/skgehwt.c b/drivers/net/sk98lin/skgehwt.c similarity index 100% rename from drivers/sk98lin/skgehwt.c rename to drivers/net/sk98lin/skgehwt.c diff --git a/drivers/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c similarity index 100% rename from drivers/sk98lin/skgeinit.c rename to drivers/net/sk98lin/skgeinit.c diff --git a/drivers/sk98lin/skgemib.c b/drivers/net/sk98lin/skgemib.c similarity index 100% rename from drivers/sk98lin/skgemib.c rename to drivers/net/sk98lin/skgemib.c diff --git a/drivers/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c similarity index 100% rename from drivers/sk98lin/skgepnmi.c rename to drivers/net/sk98lin/skgepnmi.c diff --git a/drivers/sk98lin/skgesirq.c b/drivers/net/sk98lin/skgesirq.c similarity index 100% rename from drivers/sk98lin/skgesirq.c rename to drivers/net/sk98lin/skgesirq.c diff --git a/drivers/sk98lin/ski2c.c b/drivers/net/sk98lin/ski2c.c similarity index 100% rename from drivers/sk98lin/ski2c.c rename to drivers/net/sk98lin/ski2c.c diff --git a/drivers/sk98lin/sklm80.c b/drivers/net/sk98lin/sklm80.c similarity index 100% rename from drivers/sk98lin/sklm80.c rename to drivers/net/sk98lin/sklm80.c diff --git a/drivers/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c similarity index 100% rename from drivers/sk98lin/skproc.c rename to drivers/net/sk98lin/skproc.c diff --git a/drivers/sk98lin/skqueue.c b/drivers/net/sk98lin/skqueue.c similarity index 100% rename from drivers/sk98lin/skqueue.c rename to drivers/net/sk98lin/skqueue.c diff --git a/drivers/sk98lin/skrlmt.c b/drivers/net/sk98lin/skrlmt.c similarity index 100% rename from drivers/sk98lin/skrlmt.c rename to drivers/net/sk98lin/skrlmt.c diff --git a/drivers/sk98lin/sktimer.c b/drivers/net/sk98lin/sktimer.c similarity index 100% rename from drivers/sk98lin/sktimer.c rename to drivers/net/sk98lin/sktimer.c diff --git a/drivers/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c similarity index 100% rename from drivers/sk98lin/skvpd.c rename to drivers/net/sk98lin/skvpd.c diff --git a/drivers/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c similarity index 100% rename from drivers/sk98lin/skxmac2.c rename to drivers/net/sk98lin/skxmac2.c diff --git a/drivers/sk98lin/u-boot_compat.h b/drivers/net/sk98lin/u-boot_compat.h similarity index 100% rename from drivers/sk98lin/u-boot_compat.h rename to drivers/net/sk98lin/u-boot_compat.h diff --git a/drivers/sk98lin/uboot_drv.c b/drivers/net/sk98lin/uboot_drv.c similarity index 100% rename from drivers/sk98lin/uboot_drv.c rename to drivers/net/sk98lin/uboot_drv.c diff --git a/drivers/sk98lin/uboot_skb.c b/drivers/net/sk98lin/uboot_skb.c similarity index 100% rename from drivers/sk98lin/uboot_skb.c rename to drivers/net/sk98lin/uboot_skb.c diff --git a/drivers/smc91111.c b/drivers/net/smc91111.c similarity index 100% rename from drivers/smc91111.c rename to drivers/net/smc91111.c diff --git a/drivers/smc91111.h b/drivers/net/smc91111.h similarity index 100% rename from drivers/smc91111.h rename to drivers/net/smc91111.h diff --git a/drivers/tigon3.c b/drivers/net/tigon3.c similarity index 100% rename from drivers/tigon3.c rename to drivers/net/tigon3.c diff --git a/drivers/tigon3.h b/drivers/net/tigon3.h similarity index 100% rename from drivers/tigon3.h rename to drivers/net/tigon3.h diff --git a/drivers/tsec.c b/drivers/net/tsec.c similarity index 99% rename from drivers/tsec.c rename to drivers/net/tsec.c index 4ff3339c7d..ca6284b726 100644 --- a/drivers/tsec.c +++ b/drivers/net/tsec.c @@ -117,10 +117,13 @@ struct phy_info *get_phy_info(struct eth_device *dev); void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd); static void adjust_link(struct eth_device *dev); static void relocate_cmds(void); +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \ + && !defined(BITBANGMII) static int tsec_miiphy_write(char *devname, unsigned char addr, unsigned char reg, unsigned short value); static int tsec_miiphy_read(char *devname, unsigned char addr, unsigned char reg, unsigned short *value); +#endif #ifdef CONFIG_MCAST_TFTP static int tsec_mcast_addr (struct eth_device *dev, u8 mcast_mac, u8 set); #endif @@ -803,6 +806,7 @@ static void startup_tsec(struct eth_device *dev) /* Tell the DMA it is clear to go */ regs->dmactrl |= DMACTRL_INIT_SETTINGS; regs->tstat = TSTAT_CLEAR_THALT; + regs->rstat = RSTAT_CLEAR_RHALT; regs->dmactrl &= ~(DMACTRL_GRS | DMACTRL_GTS); } diff --git a/drivers/tsec.h b/drivers/net/tsec.h similarity index 100% rename from drivers/tsec.h rename to drivers/net/tsec.h diff --git a/drivers/tsi108_eth.c b/drivers/net/tsi108_eth.c similarity index 100% rename from drivers/tsi108_eth.c rename to drivers/net/tsi108_eth.c diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c new file mode 100644 index 0000000000..1267c5798f --- /dev/null +++ b/drivers/net/uli526x.c @@ -0,0 +1,996 @@ +/* + * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved. + * + * Author: Roy Zang , Sep, 2007 + * + * Description: + * ULI 526x Ethernet port driver. + * Based on the Linux driver: drivers/net/tulip/uli526x.c + * + * This 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. + */ + +#include +#include +#include +#include +#include +#include + +/* some kernel function compatible define */ + +#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \ + defined(CONFIG_ULI526X) + +#undef DEBUG + +/* Board/System/Debug information/definition */ +#define ULI_VENDOR_ID 0x10B9 +#define ULI5261_DEVICE_ID 0x5261 +#define ULI5263_DEVICE_ID 0x5263 +/* ULi M5261 ID*/ +#define PCI_ULI5261_ID ULI5261_DEVICE_ID << 16 | ULI_VENDOR_ID +/* ULi M5263 ID*/ +#define PCI_ULI5263_ID ULI5263_DEVICE_ID << 16 | ULI_VENDOR_ID + +#define ULI526X_IO_SIZE 0x100 +#define TX_DESC_CNT 0x10 /* Allocated Tx descriptors */ +#define RX_DESC_CNT PKTBUFSRX /* Allocated Rx descriptors */ +#define TX_FREE_DESC_CNT (TX_DESC_CNT - 2) /* Max TX packet count */ +#define TX_WAKE_DESC_CNT (TX_DESC_CNT - 3) /* TX wakeup count */ +#define DESC_ALL_CNT (TX_DESC_CNT + RX_DESC_CNT) +#define TX_BUF_ALLOC 0x300 +#define RX_ALLOC_SIZE PKTSIZE +#define ULI526X_RESET 1 +#define CR0_DEFAULT 0 +#define CR6_DEFAULT 0x22200000 +#define CR7_DEFAULT 0x180c1 +#define CR15_DEFAULT 0x06 /* TxJabber RxWatchdog */ +#define TDES0_ERR_MASK 0x4302 /* TXJT, LC, EC, FUE */ +#define MAX_PACKET_SIZE 1514 +#define ULI5261_MAX_MULTICAST 14 +#define RX_COPY_SIZE 100 +#define MAX_CHECK_PACKET 0x8000 + +#define ULI526X_10MHF 0 +#define ULI526X_100MHF 1 +#define ULI526X_10MFD 4 +#define ULI526X_100MFD 5 +#define ULI526X_AUTO 8 + +#define ULI526X_TXTH_72 0x400000 /* TX TH 72 byte */ +#define ULI526X_TXTH_96 0x404000 /* TX TH 96 byte */ +#define ULI526X_TXTH_128 0x0000 /* TX TH 128 byte */ +#define ULI526X_TXTH_256 0x4000 /* TX TH 256 byte */ +#define ULI526X_TXTH_512 0x8000 /* TX TH 512 byte */ +#define ULI526X_TXTH_1K 0xC000 /* TX TH 1K byte */ + +/* CR9 definition: SROM/MII */ +#define CR9_SROM_READ 0x4800 +#define CR9_SRCS 0x1 +#define CR9_SRCLK 0x2 +#define CR9_CRDOUT 0x8 +#define SROM_DATA_0 0x0 +#define SROM_DATA_1 0x4 +#define PHY_DATA_1 0x20000 +#define PHY_DATA_0 0x00000 +#define MDCLKH 0x10000 + +#define PHY_POWER_DOWN 0x800 + +#define SROM_V41_CODE 0x14 + +#define SROM_CLK_WRITE(data, ioaddr) do { \ + outl(data|CR9_SROM_READ|CR9_SRCS, ioaddr); \ + udelay(5); \ + outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK, ioaddr); \ + udelay(5); \ + outl(data|CR9_SROM_READ|CR9_SRCS, ioaddr); \ + udelay(5); \ + } while (0) + +/* Structure/enum declaration */ + +struct tx_desc { + u32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ + char *tx_buf_ptr; /* Data for us */ + struct tx_desc *next_tx_desc; +}; + +struct rx_desc { + u32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */ + char *rx_buf_ptr; /* Data for us */ + struct rx_desc *next_rx_desc; +}; + +struct uli526x_board_info { + u32 chip_id; /* Chip vendor/Device ID */ + pci_dev_t pdev; + + long ioaddr; /* I/O base address */ + u32 cr0_data; + u32 cr5_data; + u32 cr6_data; + u32 cr7_data; + u32 cr15_data; + + /* pointer for memory physical address */ + dma_addr_t buf_pool_dma_ptr; /* Tx buffer pool memory */ + dma_addr_t buf_pool_dma_start; /* Tx buffer pool align dword */ + dma_addr_t desc_pool_dma_ptr; /* descriptor pool memory */ + dma_addr_t first_tx_desc_dma; + dma_addr_t first_rx_desc_dma; + + /* descriptor pointer */ + unsigned char *buf_pool_ptr; /* Tx buffer pool memory */ + unsigned char *buf_pool_start; /* Tx buffer pool align dword */ + unsigned char *desc_pool_ptr; /* descriptor pool memory */ + struct tx_desc *first_tx_desc; + struct tx_desc *tx_insert_ptr; + struct tx_desc *tx_remove_ptr; + struct rx_desc *first_rx_desc; + struct rx_desc *rx_ready_ptr; /* packet come pointer */ + unsigned long tx_packet_cnt; /* transmitted packet count */ + + u16 PHY_reg4; /* Saved Phyxcer register 4 value */ + + u8 media_mode; /* user specify media mode */ + u8 op_mode; /* real work dedia mode */ + u8 phy_addr; + + /* NIC SROM data */ + unsigned char srom[128]; +}; + +enum uli526x_offsets { + DCR0 = 0x00, DCR1 = 0x08, DCR2 = 0x10, DCR3 = 0x18, DCR4 = 0x20, + DCR5 = 0x28, DCR6 = 0x30, DCR7 = 0x38, DCR8 = 0x40, DCR9 = 0x48, + DCR10 = 0x50, DCR11 = 0x58, DCR12 = 0x60, DCR13 = 0x68, DCR14 = 0x70, + DCR15 = 0x78 +}; + +enum uli526x_CR6_bits { + CR6_RXSC = 0x2, CR6_PBF = 0x8, CR6_PM = 0x40, CR6_PAM = 0x80, + CR6_FDM = 0x200, CR6_TXSC = 0x2000, CR6_STI = 0x100000, + CR6_SFT = 0x200000, CR6_RXA = 0x40000000, CR6_NO_PURGE = 0x20000000 +}; + +/* Global variable declaration -- */ + +static unsigned char uli526x_media_mode = ULI526X_AUTO; + +static struct tx_desc desc_pool_array[DESC_ALL_CNT + 0x20] + __attribute__ ((aligned(32))); +static char buf_pool[TX_BUF_ALLOC * TX_DESC_CNT + 4]; + +/* For module input parameter */ +static int mode = 8; + +/* function declaration -- */ +static int uli526x_start_xmit(struct eth_device *dev, + volatile void *packet, int length); +static const struct ethtool_ops netdev_ethtool_ops; +static u16 read_srom_word(long, int); +static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); +static void allocate_rx_buffer(struct uli526x_board_info *); +static void update_cr6(u32, unsigned long); +static u16 phy_read(unsigned long, u8, u8, u32); +static u16 phy_readby_cr10(unsigned long, u8, u8); +static void phy_write(unsigned long, u8, u8, u16, u32); +static void phy_writeby_cr10(unsigned long, u8, u8, u16); +static void phy_write_1bit(unsigned long, u32, u32); +static u16 phy_read_1bit(unsigned long, u32); +static int uli526x_rx_packet(struct eth_device *); +static void uli526x_free_tx_pkt(struct eth_device *, + struct uli526x_board_info *); +static void uli526x_reuse_buf(struct rx_desc *); +static void uli526x_init(struct eth_device *); +static void uli526x_set_phyxcer(struct uli526x_board_info *); + + +static int uli526x_init_one(struct eth_device *, bd_t *); +static void uli526x_disable(struct eth_device *); +static void set_mac_addr(struct eth_device *); + +static struct pci_device_id uli526x_pci_tbl[] = { + { ULI_VENDOR_ID, ULI5261_DEVICE_ID}, /* 5261 device */ + { ULI_VENDOR_ID, ULI5263_DEVICE_ID}, /* 5263 device */ + {} +}; + +/* ULI526X network board routine */ + +/* + * Search ULI526X board, register it + */ + +int uli526x_initialize(bd_t *bis) +{ + pci_dev_t devno; + int card_number = 0; + struct eth_device *dev; + struct uli526x_board_info *db; /* board information structure */ + + u32 iobase; + int idx = 0; + + while (1) { + /* Find PCI device */ + devno = pci_find_devices(uli526x_pci_tbl, idx++); + if (devno < 0) + break; + + pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase); + iobase &= ~0xf; + + dev = (struct eth_device *)malloc(sizeof *dev); + sprintf(dev->name, "uli526x#%d\n", card_number); + db = (struct uli526x_board_info *) + malloc(sizeof(struct uli526x_board_info)); + + dev->priv = db; + db->pdev = devno; + dev->iobase = iobase; + + dev->init = uli526x_init_one; + dev->halt = uli526x_disable; + dev->send = uli526x_start_xmit; + dev->recv = uli526x_rx_packet; + + /* init db */ + db->ioaddr = dev->iobase; + /* get chip id */ + + pci_read_config_dword(devno, PCI_VENDOR_ID, &db->chip_id); +#ifdef DEBUG + printf("uli526x: uli526x @0x%x\n", iobase); + printf("uli526x: chip_id%x\n", db->chip_id); +#endif + eth_register(dev); + card_number++; + pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x20); + udelay(10 * 1000); + } + return card_number; +} + +static int uli526x_init_one(struct eth_device *dev, bd_t *bis) +{ + + struct uli526x_board_info *db = dev->priv; + int i; + + switch (mode) { + case ULI526X_10MHF: + case ULI526X_100MHF: + case ULI526X_10MFD: + case ULI526X_100MFD: + uli526x_media_mode = mode; + break; + default: + uli526x_media_mode = ULI526X_AUTO; + break; + } + + /* Allocate Tx/Rx descriptor memory */ + db->desc_pool_ptr = (uchar *)&desc_pool_array[0]; + db->desc_pool_dma_ptr = (dma_addr_t)&desc_pool_array[0]; + if (db->desc_pool_ptr == NULL) + return 0; + + db->buf_pool_ptr = &buf_pool[0]; + db->buf_pool_dma_ptr = (dma_addr_t)&buf_pool[0]; + if (db->buf_pool_ptr == NULL) + return 0; + + db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr; + db->first_tx_desc_dma = db->desc_pool_dma_ptr; + + db->buf_pool_start = db->buf_pool_ptr; + db->buf_pool_dma_start = db->buf_pool_dma_ptr; + +#ifdef DEBUG + printf("%s(): db->ioaddr= 0x%x\n", + __FUNCTION__, db->ioaddr); + printf("%s(): media_mode= 0x%x\n", + __FUNCTION__, uli526x_media_mode); + printf("%s(): db->desc_pool_ptr= 0x%x\n", + __FUNCTION__, db->desc_pool_ptr); + printf("%s(): db->desc_pool_dma_ptr= 0x%x\n", + __FUNCTION__, db->desc_pool_dma_ptr); + printf("%s(): db->buf_pool_ptr= 0x%x\n", + __FUNCTION__, db->buf_pool_ptr); + printf("%s(): db->buf_pool_dma_ptr= 0x%x\n", + __FUNCTION__, db->buf_pool_dma_ptr); +#endif + + /* read 64 word srom data */ + for (i = 0; i < 64; i++) + ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, + i)); + + /* Set Node address */ + if (((u16 *) db->srom)[0] == 0xffff || ((u16 *) db->srom)[0] == 0) + /* SROM absent, so write MAC address to ID Table */ + set_mac_addr(dev); + else { /*Exist SROM*/ + for (i = 0; i < 6; i++) + dev->enetaddr[i] = db->srom[20 + i]; + } +#ifdef DEBUG + for (i = 0; i < 6; i++) + printf("%c%02x", i ? ':' : ' ', dev->enetaddr[i]); +#endif + db->PHY_reg4 = 0x1e0; + + /* system variable init */ + db->cr6_data = CR6_DEFAULT ; + db->cr6_data |= ULI526X_TXTH_256; + db->cr0_data = CR0_DEFAULT; + uli526x_init(dev); + return 1; +} + +static void uli526x_disable(struct eth_device *dev) +{ +#ifdef DEBUG + printf("uli526x_disable\n"); +#endif + struct uli526x_board_info *db = dev->priv; + + if (!((inl(db->ioaddr + DCR12)) & 0x8)) { + /* Reset & stop ULI526X board */ + outl(ULI526X_RESET, db->ioaddr + DCR0); + udelay(5); + phy_write(db->ioaddr, db->phy_addr, 0, 0x8000, db->chip_id); + + /* reset the board */ + db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); /* Disable Tx/Rx */ + update_cr6(db->cr6_data, dev->iobase); + outl(0, dev->iobase + DCR7); /* Disable Interrupt */ + outl(inl(dev->iobase + DCR5), dev->iobase + DCR5); + } +} + +/* Initialize ULI526X board + * Reset ULI526X board + * Initialize TX/Rx descriptor chain structure + * Send the set-up frame + * Enable Tx/Rx machine + */ + +static void uli526x_init(struct eth_device *dev) +{ + + struct uli526x_board_info *db = dev->priv; + u8 phy_tmp; + u16 phy_value; + u16 phy_reg_reset; + + /* Reset M526x MAC controller */ + outl(ULI526X_RESET, db->ioaddr + DCR0); /* RESET MAC */ + udelay(100); + outl(db->cr0_data, db->ioaddr + DCR0); + udelay(5); + + /* Phy addr : In some boards,M5261/M5263 phy address != 1 */ + db->phy_addr = 1; + db->tx_packet_cnt = 0; + for (phy_tmp = 0; phy_tmp < 32; phy_tmp++) { + /* peer add */ + phy_value = phy_read(db->ioaddr, phy_tmp, 3, db->chip_id); + if (phy_value != 0xffff && phy_value != 0) { + db->phy_addr = phy_tmp; + break; + } + } + +#ifdef DEBUG + printf("%s(): db->ioaddr= 0x%x\n", __FUNCTION__, db->ioaddr); + printf("%s(): db->phy_addr= 0x%x\n", __FUNCTION__, db->phy_addr); +#endif + if (phy_tmp == 32) + printf("Can not find the phy address!!!"); + + /* Parser SROM and media mode */ + db->media_mode = uli526x_media_mode; + + if (!(inl(db->ioaddr + DCR12) & 0x8)) { + /* Phyxcer capability setting */ + phy_reg_reset = phy_read(db->ioaddr, + db->phy_addr, 0, db->chip_id); + phy_reg_reset = (phy_reg_reset | 0x8000); + phy_write(db->ioaddr, db->phy_addr, 0, + phy_reg_reset, db->chip_id); + udelay(500); + + /* Process Phyxcer Media Mode */ + uli526x_set_phyxcer(db); + } + /* Media Mode Process */ + if (!(db->media_mode & ULI526X_AUTO)) + db->op_mode = db->media_mode; /* Force Mode */ + + /* Initialize Transmit/Receive decriptor and CR3/4 */ + uli526x_descriptor_init(db, db->ioaddr); + + /* Init CR6 to program M526X operation */ + update_cr6(db->cr6_data, db->ioaddr); + + /* Init CR7, interrupt active bit */ + db->cr7_data = CR7_DEFAULT; + outl(db->cr7_data, db->ioaddr + DCR7); + + /* Init CR15, Tx jabber and Rx watchdog timer */ + outl(db->cr15_data, db->ioaddr + DCR15); + + /* Enable ULI526X Tx/Rx function */ + db->cr6_data |= CR6_RXSC | CR6_TXSC; + update_cr6(db->cr6_data, db->ioaddr); + while (!(inl(db->ioaddr + DCR12) & 0x8)) + udelay(10); +} + +/* + * Hardware start transmission. + * Send a packet to media from the upper layer. + */ + +static int uli526x_start_xmit(struct eth_device *dev, + volatile void *packet, int length) +{ + struct uli526x_board_info *db = dev->priv; + struct tx_desc *txptr; + unsigned int len = length; + /* Too large packet check */ + if (len > MAX_PACKET_SIZE) { + printf(": big packet = %d\n", len); + return 0; + } + + /* No Tx resource check, it never happen nromally */ + if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { + printf("No Tx resource %ld\n", db->tx_packet_cnt); + return 0; + } + + /* Disable NIC interrupt */ + outl(0, dev->iobase + DCR7); + + /* transmit this packet */ + txptr = db->tx_insert_ptr; + memcpy((char *)txptr->tx_buf_ptr, (char *)packet, (int)length); + txptr->tdes1 = cpu_to_le32(0xe1000000 | length); + + /* Point to next transmit free descriptor */ + db->tx_insert_ptr = txptr->next_tx_desc; + + /* Transmit Packet Process */ + if ((db->tx_packet_cnt < TX_DESC_CNT)) { + txptr->tdes0 = cpu_to_le32(0x80000000); /* Set owner bit */ + db->tx_packet_cnt++; /* Ready to send */ + outl(0x1, dev->iobase + DCR1); /* Issue Tx polling */ + } + + /* Got ULI526X status */ + db->cr5_data = inl(db->ioaddr + DCR5); + outl(db->cr5_data, db->ioaddr + DCR5); + +#ifdef TX_DEBUG + printf("%s(): length = 0x%x\n", __FUNCTION__, length); + printf("%s(): cr5_data=%x\n", __FUNCTION__, db->cr5_data); +#endif + + outl(db->cr7_data, dev->iobase + DCR7); + uli526x_free_tx_pkt(dev, db); + + return length; +} + +/* + * Free TX resource after TX complete + */ + +static void uli526x_free_tx_pkt(struct eth_device *dev, + struct uli526x_board_info *db) +{ + struct tx_desc *txptr; + u32 tdes0; + + txptr = db->tx_remove_ptr; + while (db->tx_packet_cnt) { + tdes0 = le32_to_cpu(txptr->tdes0); + /* printf(DRV_NAME ": tdes0=%x\n", tdes0); */ + if (tdes0 & 0x80000000) + break; + + /* A packet sent completed */ + db->tx_packet_cnt--; + + if (tdes0 != 0x7fffffff) { +#ifdef TX_DEBUG + printf("%s()tdes0=%x\n", __FUNCTION__, tdes0); +#endif + if (tdes0 & TDES0_ERR_MASK) { + if (tdes0 & 0x0002) { /* UnderRun */ + if (!(db->cr6_data & CR6_SFT)) { + db->cr6_data = db->cr6_data | + CR6_SFT; + update_cr6(db->cr6_data, + db->ioaddr); + } + } + } + } + + txptr = txptr->next_tx_desc; + }/* End of while */ + + /* Update TX remove pointer to next */ + db->tx_remove_ptr = txptr; +} + + +/* + * Receive the come packet and pass to upper layer + */ + +static int uli526x_rx_packet(struct eth_device *dev) +{ + struct uli526x_board_info *db = dev->priv; + struct rx_desc *rxptr; + int rxlen = 0; + u32 rdes0; + + rxptr = db->rx_ready_ptr; + + rdes0 = le32_to_cpu(rxptr->rdes0); +#ifdef RX_DEBUG + printf("%s(): rxptr->rdes0=%x:%x\n", __FUNCTION__, rxptr->rdes0); +#endif + if (!(rdes0 & 0x80000000)) { /* packet owner check */ + if ((rdes0 & 0x300) != 0x300) { + /* A packet without First/Last flag */ + /* reuse this buf */ + printf("A packet without First/Last flag"); + uli526x_reuse_buf(rxptr); + } else { + /* A packet with First/Last flag */ + rxlen = ((rdes0 >> 16) & 0x3fff) - 4; +#ifdef RX_DEBUG + printf("%s(): rxlen =%x\n", __FUNCTION__, rxlen); +#endif + /* error summary bit check */ + if (rdes0 & 0x8000) { + /* This is a error packet */ + printf("Eroor: rdes0: %lx\n", rdes0); + } + + if (!(rdes0 & 0x8000) || + ((db->cr6_data & CR6_PM) && (rxlen > 6))) { + +#ifdef RX_DEBUG + printf("%s(): rx_skb_ptr =%x\n", + __FUNCTION__, rxptr->rx_buf_ptr); + printf("%s(): rxlen =%x\n", + __FUNCTION__, rxlen); + + printf("%s(): buf addr =%x\n", + __FUNCTION__, rxptr->rx_buf_ptr); + printf("%s(): rxlen =%x\n", + __FUNCTION__, rxlen); + int i; + for (i = 0; i < 0x20; i++) + printf("%s(): data[%x] =%x\n", + __FUNCTION__, i, rxptr->rx_buf_ptr[i]); +#endif + + NetReceive(rxptr->rx_buf_ptr, rxlen); + uli526x_reuse_buf(rxptr); + + } else { + /* Reuse SKB buffer when the packet is error */ + printf("Reuse buffer, rdes0"); + uli526x_reuse_buf(rxptr); + } + } + + rxptr = rxptr->next_rx_desc; + } + + db->rx_ready_ptr = rxptr; + return rxlen; +} + +/* + * Reuse the RX buffer + */ + +static void uli526x_reuse_buf(struct rx_desc *rxptr) +{ + + if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) + rxptr->rdes0 = cpu_to_le32(0x80000000); + else + printf("Buffer reuse method error"); +} +/* + * Initialize transmit/Receive descriptor + * Using Chain structure, and allocate Tx/Rx buffer + */ + +static void uli526x_descriptor_init(struct uli526x_board_info *db, + unsigned long ioaddr) +{ + struct tx_desc *tmp_tx; + struct rx_desc *tmp_rx; + unsigned char *tmp_buf; + dma_addr_t tmp_tx_dma, tmp_rx_dma; + dma_addr_t tmp_buf_dma; + int i; + /* tx descriptor start pointer */ + db->tx_insert_ptr = db->first_tx_desc; + db->tx_remove_ptr = db->first_tx_desc; + + outl(db->first_tx_desc_dma, ioaddr + DCR4); /* TX DESC address */ + + /* rx descriptor start pointer */ + db->first_rx_desc = (void *)db->first_tx_desc + + sizeof(struct tx_desc) * TX_DESC_CNT; + db->first_rx_desc_dma = db->first_tx_desc_dma + + sizeof(struct tx_desc) * TX_DESC_CNT; + db->rx_ready_ptr = db->first_rx_desc; + outl(db->first_rx_desc_dma, ioaddr + DCR3); /* RX DESC address */ +#ifdef DEBUG + printf("%s(): db->first_tx_desc= 0x%x\n", + __FUNCTION__, db->first_tx_desc); + printf("%s(): db->first_rx_desc_dma= 0x%x\n", + __FUNCTION__, db->first_rx_desc_dma); +#endif + /* Init Transmit chain */ + tmp_buf = db->buf_pool_start; + tmp_buf_dma = db->buf_pool_dma_start; + tmp_tx_dma = db->first_tx_desc_dma; + for (tmp_tx = db->first_tx_desc, i = 0; + i < TX_DESC_CNT; i++, tmp_tx++) { + tmp_tx->tx_buf_ptr = tmp_buf; + tmp_tx->tdes0 = cpu_to_le32(0); + tmp_tx->tdes1 = cpu_to_le32(0x81000000); /* IC, chain */ + tmp_tx->tdes2 = cpu_to_le32(tmp_buf_dma); + tmp_tx_dma += sizeof(struct tx_desc); + tmp_tx->tdes3 = cpu_to_le32(tmp_tx_dma); + tmp_tx->next_tx_desc = tmp_tx + 1; + tmp_buf = tmp_buf + TX_BUF_ALLOC; + tmp_buf_dma = tmp_buf_dma + TX_BUF_ALLOC; + } + (--tmp_tx)->tdes3 = cpu_to_le32(db->first_tx_desc_dma); + tmp_tx->next_tx_desc = db->first_tx_desc; + + /* Init Receive descriptor chain */ + tmp_rx_dma = db->first_rx_desc_dma; + for (tmp_rx = db->first_rx_desc, i = 0; i < RX_DESC_CNT; + i++, tmp_rx++) { + tmp_rx->rdes0 = cpu_to_le32(0); + tmp_rx->rdes1 = cpu_to_le32(0x01000600); + tmp_rx_dma += sizeof(struct rx_desc); + tmp_rx->rdes3 = cpu_to_le32(tmp_rx_dma); + tmp_rx->next_rx_desc = tmp_rx + 1; + } + (--tmp_rx)->rdes3 = cpu_to_le32(db->first_rx_desc_dma); + tmp_rx->next_rx_desc = db->first_rx_desc; + + /* pre-allocate Rx buffer */ + allocate_rx_buffer(db); +} + +/* + * Update CR6 value + * Firstly stop ULI526X, then written value and start + */ + +static void update_cr6(u32 cr6_data, unsigned long ioaddr) +{ + + outl(cr6_data, ioaddr + DCR6); + udelay(5); +} + +/* + * Allocate rx buffer, + */ + +static void allocate_rx_buffer(struct uli526x_board_info *db) +{ + int index; + struct rx_desc *rxptr; + rxptr = db->first_rx_desc; + u32 addr; + + for (index = 0; index < RX_DESC_CNT; index++) { + addr = (u32)NetRxPackets[index]; + addr += (16 - (addr & 15)); + rxptr->rx_buf_ptr = (char *) addr; + rxptr->rdes2 = cpu_to_le32(addr); + rxptr->rdes0 = cpu_to_le32(0x80000000); +#ifdef DEBUG + printf("%s(): Number 0x%x:\n", __FUNCTION__, index); + printf("%s(): addr 0x%x:\n", __FUNCTION__, addr); + printf("%s(): rxptr address = 0x%x\n", __FUNCTION__, rxptr); + printf("%s(): rxptr buf address = 0x%x\n", \ + __FUNCTION__, rxptr->rx_buf_ptr); + printf("%s(): rdes2 = 0x%x\n", __FUNCTION__, rxptr->rdes2); +#endif + rxptr = rxptr->next_rx_desc; + } +} + +/* + * Read one word data from the serial ROM + */ + +static u16 read_srom_word(long ioaddr, int offset) +{ + int i; + u16 srom_data = 0; + long cr9_ioaddr = ioaddr + DCR9; + + outl(CR9_SROM_READ, cr9_ioaddr); + outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr); + + /* Send the Read Command 110b */ + SROM_CLK_WRITE(SROM_DATA_1, cr9_ioaddr); + SROM_CLK_WRITE(SROM_DATA_1, cr9_ioaddr); + SROM_CLK_WRITE(SROM_DATA_0, cr9_ioaddr); + + /* Send the offset */ + for (i = 5; i >= 0; i--) { + srom_data = (offset & (1 << i)) ? SROM_DATA_1 : SROM_DATA_0; + SROM_CLK_WRITE(srom_data, cr9_ioaddr); + } + + outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr); + + for (i = 16; i > 0; i--) { + outl(CR9_SROM_READ | CR9_SRCS | CR9_SRCLK, cr9_ioaddr); + udelay(5); + srom_data = (srom_data << 1) | ((inl(cr9_ioaddr) & CR9_CRDOUT) + ? 1 : 0); + outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr); + udelay(5); + } + + outl(CR9_SROM_READ, cr9_ioaddr); + return srom_data; +} + +/* + * Set 10/100 phyxcer capability + * AUTO mode : phyxcer register4 is NIC capability + * Force mode: phyxcer register4 is the force media + */ + +static void uli526x_set_phyxcer(struct uli526x_board_info *db) +{ + u16 phy_reg; + + /* Phyxcer capability setting */ + phy_reg = phy_read(db->ioaddr, db->phy_addr, 4, db->chip_id) & ~0x01e0; + + if (db->media_mode & ULI526X_AUTO) { + /* AUTO Mode */ + phy_reg |= db->PHY_reg4; + } else { + /* Force Mode */ + switch (db->media_mode) { + case ULI526X_10MHF: phy_reg |= 0x20; break; + case ULI526X_10MFD: phy_reg |= 0x40; break; + case ULI526X_100MHF: phy_reg |= 0x80; break; + case ULI526X_100MFD: phy_reg |= 0x100; break; + } + + } + + /* Write new capability to Phyxcer Reg4 */ + if (!(phy_reg & 0x01e0)) { + phy_reg |= db->PHY_reg4; + db->media_mode |= ULI526X_AUTO; + } + phy_write(db->ioaddr, db->phy_addr, 4, phy_reg, db->chip_id); + + /* Restart Auto-Negotiation */ + phy_write(db->ioaddr, db->phy_addr, 0, 0x1200, db->chip_id); + udelay(50); +} + +/* + * Write a word to Phy register + */ + +static void phy_write(unsigned long iobase, u8 phy_addr, u8 offset, + u16 phy_data, u32 chip_id) +{ + u16 i; + unsigned long ioaddr; + + if (chip_id == PCI_ULI5263_ID) { + phy_writeby_cr10(iobase, phy_addr, offset, phy_data); + return; + } + /* M5261/M5263 Chip */ + ioaddr = iobase + DCR9; + + /* Send 33 synchronization clock to Phy controller */ + for (i = 0; i < 35; i++) + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + + /* Send start command(01) to Phy */ + phy_write_1bit(ioaddr, PHY_DATA_0, chip_id); + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + + /* Send write command(01) to Phy */ + phy_write_1bit(ioaddr, PHY_DATA_0, chip_id); + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + + /* Send Phy address */ + for (i = 0x10; i > 0; i = i >> 1) + phy_write_1bit(ioaddr, phy_addr & i ? + PHY_DATA_1 : PHY_DATA_0, chip_id); + + /* Send register address */ + for (i = 0x10; i > 0; i = i >> 1) + phy_write_1bit(ioaddr, offset & i ? + PHY_DATA_1 : PHY_DATA_0, chip_id); + + /* written trasnition */ + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + phy_write_1bit(ioaddr, PHY_DATA_0, chip_id); + + /* Write a word data to PHY controller */ + for (i = 0x8000; i > 0; i >>= 1) + phy_write_1bit(ioaddr, phy_data & i ? + PHY_DATA_1 : PHY_DATA_0, chip_id); +} + +/* + * Read a word data from phy register + */ + +static u16 phy_read(unsigned long iobase, u8 phy_addr, u8 offset, u32 chip_id) +{ + int i; + u16 phy_data; + unsigned long ioaddr; + + if (chip_id == PCI_ULI5263_ID) + return phy_readby_cr10(iobase, phy_addr, offset); + /* M5261/M5263 Chip */ + ioaddr = iobase + DCR9; + + /* Send 33 synchronization clock to Phy controller */ + for (i = 0; i < 35; i++) + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + + /* Send start command(01) to Phy */ + phy_write_1bit(ioaddr, PHY_DATA_0, chip_id); + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + + /* Send read command(10) to Phy */ + phy_write_1bit(ioaddr, PHY_DATA_1, chip_id); + phy_write_1bit(ioaddr, PHY_DATA_0, chip_id); + + /* Send Phy address */ + for (i = 0x10; i > 0; i = i >> 1) + phy_write_1bit(ioaddr, phy_addr & i ? + PHY_DATA_1 : PHY_DATA_0, chip_id); + + /* Send register address */ + for (i = 0x10; i > 0; i = i >> 1) + phy_write_1bit(ioaddr, offset & i ? + PHY_DATA_1 : PHY_DATA_0, chip_id); + + /* Skip transition state */ + phy_read_1bit(ioaddr, chip_id); + + /* read 16bit data */ + for (phy_data = 0, i = 0; i < 16; i++) { + phy_data <<= 1; + phy_data |= phy_read_1bit(ioaddr, chip_id); + } + + return phy_data; +} + +static u16 phy_readby_cr10(unsigned long iobase, u8 phy_addr, u8 offset) +{ + unsigned long ioaddr, cr10_value; + + ioaddr = iobase + DCR10; + cr10_value = phy_addr; + cr10_value = (cr10_value<<5) + offset; + cr10_value = (cr10_value<<16) + 0x08000000; + outl(cr10_value, ioaddr); + udelay(1); + while (1) { + cr10_value = inl(ioaddr); + if (cr10_value & 0x10000000) + break; + } + return (cr10_value&0x0ffff); +} + +static void phy_writeby_cr10(unsigned long iobase, u8 phy_addr, + u8 offset, u16 phy_data) +{ + unsigned long ioaddr, cr10_value; + + ioaddr = iobase + DCR10; + cr10_value = phy_addr; + cr10_value = (cr10_value<<5) + offset; + cr10_value = (cr10_value<<16) + 0x04000000 + phy_data; + outl(cr10_value, ioaddr); + udelay(1); +} +/* + * Write one bit data to Phy Controller + */ + +static void phy_write_1bit(unsigned long ioaddr, u32 phy_data, u32 chip_id) +{ + outl(phy_data , ioaddr); /* MII Clock Low */ + udelay(1); + outl(phy_data | MDCLKH, ioaddr); /* MII Clock High */ + udelay(1); + outl(phy_data , ioaddr); /* MII Clock Low */ + udelay(1); +} + +/* + * Read one bit phy data from PHY controller + */ + +static u16 phy_read_1bit(unsigned long ioaddr, u32 chip_id) +{ + u16 phy_data; + + outl(0x50000 , ioaddr); + udelay(1); + phy_data = (inl(ioaddr) >> 19) & 0x1; + outl(0x40000 , ioaddr); + udelay(1); + + return phy_data; +} + +/* + * Set MAC address to ID Table + */ + +static void set_mac_addr(struct eth_device *dev) +{ + int i; + u16 addr; + struct uli526x_board_info *db = dev->priv; + outl(0x10000, db->ioaddr + DCR0); /* Diagnosis mode */ + /* Reset dianostic pointer port */ + outl(0x1c0, db->ioaddr + DCR13); + outl(0, db->ioaddr + DCR14); /* Clear reset port */ + outl(0x10, db->ioaddr + DCR14); /* Reset ID Table pointer */ + outl(0, db->ioaddr + DCR14); /* Clear reset port */ + outl(0, db->ioaddr + DCR13); /* Clear CR13 */ + /* Select ID Table access port */ + outl(0x1b0, db->ioaddr + DCR13); + /* Read MAC address from CR14 */ + for (i = 0; i < 3; i++) { + addr = dev->enetaddr[2 * i] | (dev->enetaddr[2 * i + 1] << 8); + outl(addr, db->ioaddr + DCR14); + } + /* write end */ + outl(0, db->ioaddr + DCR13); /* Clear CR13 */ + outl(0, db->ioaddr + DCR0); /* Clear CR0 */ + udelay(10); + return; +} +#endif diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile new file mode 100644 index 0000000000..fe45839466 --- /dev/null +++ b/drivers/pci/Makefile @@ -0,0 +1,51 @@ +# +# (C) Copyright 2000-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)libpci.a + +COBJS-y += fsl_pci_init.o +COBJS-y += pci.o +COBJS-y += pci_auto.o +COBJS-y += pci_indirect.o +COBJS-y += tsi108_pci.o +COBJS-y += w83c553f.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c similarity index 100% rename from drivers/fsl_pci_init.c rename to drivers/pci/fsl_pci_init.c diff --git a/drivers/pci.c b/drivers/pci/pci.c similarity index 100% rename from drivers/pci.c rename to drivers/pci/pci.c diff --git a/drivers/pci_auto.c b/drivers/pci/pci_auto.c similarity index 100% rename from drivers/pci_auto.c rename to drivers/pci/pci_auto.c diff --git a/drivers/pci_indirect.c b/drivers/pci/pci_indirect.c similarity index 100% rename from drivers/pci_indirect.c rename to drivers/pci/pci_indirect.c diff --git a/drivers/tsi108_pci.c b/drivers/pci/tsi108_pci.c similarity index 98% rename from drivers/tsi108_pci.c rename to drivers/pci/tsi108_pci.c index 9f606df518..d5f11e42f0 100644 --- a/drivers/tsi108_pci.c +++ b/drivers/pci/tsi108_pci.c @@ -33,6 +33,9 @@ #include #include #include +#ifdef CONFIG_OF_FLAT_TREE +#include +#endif struct pci_controller local_hose; diff --git a/drivers/w83c553f.c b/drivers/pci/w83c553f.c similarity index 100% rename from drivers/w83c553f.c rename to drivers/pci/w83c553f.c diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile new file mode 100644 index 0000000000..55528c889e --- /dev/null +++ b/drivers/pcmcia/Makefile @@ -0,0 +1,50 @@ +# +# (C) Copyright 2000-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)libpcmcia.a + +COBJS-y += mpc8xx_pcmcia.o +COBJS-y += pxa_pcmcia.o +COBJS-y += rpx_pcmcia.o +COBJS-y += ti_pci1410a.o +COBJS-y += tqm8xx_pcmcia.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/i82365.c b/drivers/pcmcia/i82365.c similarity index 100% rename from drivers/i82365.c rename to drivers/pcmcia/i82365.c diff --git a/drivers/mpc8xx_pcmcia.c b/drivers/pcmcia/mpc8xx_pcmcia.c similarity index 100% rename from drivers/mpc8xx_pcmcia.c rename to drivers/pcmcia/mpc8xx_pcmcia.c diff --git a/drivers/pxa_pcmcia.c b/drivers/pcmcia/pxa_pcmcia.c similarity index 100% rename from drivers/pxa_pcmcia.c rename to drivers/pcmcia/pxa_pcmcia.c diff --git a/drivers/rpx_pcmcia.c b/drivers/pcmcia/rpx_pcmcia.c similarity index 100% rename from drivers/rpx_pcmcia.c rename to drivers/pcmcia/rpx_pcmcia.c diff --git a/drivers/ti_pci1410a.c b/drivers/pcmcia/ti_pci1410a.c similarity index 100% rename from drivers/ti_pci1410a.c rename to drivers/pcmcia/ti_pci1410a.c diff --git a/drivers/tqm8xx_pcmcia.c b/drivers/pcmcia/tqm8xx_pcmcia.c similarity index 100% rename from drivers/tqm8xx_pcmcia.c rename to drivers/pcmcia/tqm8xx_pcmcia.c diff --git a/rtc/Makefile b/drivers/rtc/Makefile similarity index 71% rename from rtc/Makefile rename to drivers/rtc/Makefile index 5a0cf113a5..1d6016ef87 100644 --- a/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -27,13 +27,32 @@ include $(TOPDIR)/config.mk LIB = $(obj)librtc.a -COBJS = date.o \ - bf5xx_rtc.o ds12887.o ds1302.o ds1306.o ds1307.o \ - ds1337.o ds1374.o ds1556.o ds164x.o ds174x.o ds3231.o \ - m41t11.o max6900.o m48t35ax.o mc146818.o mk48t59.o \ - mpc5xxx.o mpc8xx.o pcf8563.o s3c24x0_rtc.o rs5c372.o \ - mcfrtc.o x1205.o +COBJS-y += date.o +COBJS-y += bf5xx_rtc.o +COBJS-y += ds12887.o +COBJS-y += ds1302.o +COBJS-y += ds1306.o +COBJS-y += ds1307.o +COBJS-y += ds1337.o +COBJS-y += ds1374.o +COBJS-y += ds1556.o +COBJS-y += ds164x.o +COBJS-y += ds174x.o +COBJS-y += ds3231.o +COBJS-y += m41t11.o +COBJS-y += max6900.o +COBJS-y += m48t35ax.o +COBJS-y += mc146818.o +COBJS-y += mk48t59.o +COBJS-y += mpc5xxx.o +COBJS-y += mpc8xx.o +COBJS-y += pcf8563.o +COBJS-y += s3c24x0_rtc.o +COBJS-y += rs5c372.o +COBJS-y += mcfrtc.o +COBJS-y += x1205.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/rtc/bf5xx_rtc.c b/drivers/rtc/bf5xx_rtc.c similarity index 100% rename from rtc/bf5xx_rtc.c rename to drivers/rtc/bf5xx_rtc.c diff --git a/rtc/date.c b/drivers/rtc/date.c similarity index 100% rename from rtc/date.c rename to drivers/rtc/date.c diff --git a/rtc/ds12887.c b/drivers/rtc/ds12887.c similarity index 100% rename from rtc/ds12887.c rename to drivers/rtc/ds12887.c diff --git a/rtc/ds1302.c b/drivers/rtc/ds1302.c similarity index 100% rename from rtc/ds1302.c rename to drivers/rtc/ds1302.c diff --git a/rtc/ds1306.c b/drivers/rtc/ds1306.c similarity index 100% rename from rtc/ds1306.c rename to drivers/rtc/ds1306.c diff --git a/rtc/ds1307.c b/drivers/rtc/ds1307.c similarity index 100% rename from rtc/ds1307.c rename to drivers/rtc/ds1307.c diff --git a/rtc/ds1337.c b/drivers/rtc/ds1337.c similarity index 100% rename from rtc/ds1337.c rename to drivers/rtc/ds1337.c diff --git a/rtc/ds1374.c b/drivers/rtc/ds1374.c similarity index 100% rename from rtc/ds1374.c rename to drivers/rtc/ds1374.c diff --git a/rtc/ds1556.c b/drivers/rtc/ds1556.c similarity index 100% rename from rtc/ds1556.c rename to drivers/rtc/ds1556.c diff --git a/rtc/ds164x.c b/drivers/rtc/ds164x.c similarity index 100% rename from rtc/ds164x.c rename to drivers/rtc/ds164x.c diff --git a/rtc/ds174x.c b/drivers/rtc/ds174x.c similarity index 100% rename from rtc/ds174x.c rename to drivers/rtc/ds174x.c diff --git a/rtc/ds3231.c b/drivers/rtc/ds3231.c similarity index 100% rename from rtc/ds3231.c rename to drivers/rtc/ds3231.c diff --git a/rtc/m41t11.c b/drivers/rtc/m41t11.c similarity index 100% rename from rtc/m41t11.c rename to drivers/rtc/m41t11.c diff --git a/rtc/m48t35ax.c b/drivers/rtc/m48t35ax.c similarity index 100% rename from rtc/m48t35ax.c rename to drivers/rtc/m48t35ax.c diff --git a/rtc/max6900.c b/drivers/rtc/max6900.c similarity index 100% rename from rtc/max6900.c rename to drivers/rtc/max6900.c diff --git a/rtc/mc146818.c b/drivers/rtc/mc146818.c similarity index 100% rename from rtc/mc146818.c rename to drivers/rtc/mc146818.c diff --git a/rtc/mcfrtc.c b/drivers/rtc/mcfrtc.c similarity index 100% rename from rtc/mcfrtc.c rename to drivers/rtc/mcfrtc.c diff --git a/rtc/mk48t59.c b/drivers/rtc/mk48t59.c similarity index 100% rename from rtc/mk48t59.c rename to drivers/rtc/mk48t59.c diff --git a/rtc/mpc5xxx.c b/drivers/rtc/mpc5xxx.c similarity index 100% rename from rtc/mpc5xxx.c rename to drivers/rtc/mpc5xxx.c diff --git a/rtc/mpc8xx.c b/drivers/rtc/mpc8xx.c similarity index 100% rename from rtc/mpc8xx.c rename to drivers/rtc/mpc8xx.c diff --git a/rtc/pcf8563.c b/drivers/rtc/pcf8563.c similarity index 100% rename from rtc/pcf8563.c rename to drivers/rtc/pcf8563.c diff --git a/rtc/rs5c372.c b/drivers/rtc/rs5c372.c similarity index 100% rename from rtc/rs5c372.c rename to drivers/rtc/rs5c372.c diff --git a/rtc/s3c24x0_rtc.c b/drivers/rtc/s3c24x0_rtc.c similarity index 100% rename from rtc/s3c24x0_rtc.c rename to drivers/rtc/s3c24x0_rtc.c diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 93c68dd2e0..735c630006 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -25,8 +25,19 @@ include $(TOPDIR)/config.mk LIB := $(obj)libserial.a -COBJS := mcfuart.o +COBJS-y += atmel_usart.o +COBJS-y += mcfuart.o +COBJS-y += ns9750_serial.o +COBJS-y += ns16550.o +COBJS-y += s3c4510b_uart.o +COBJS-y += serial.o +COBJS-y += serial_max3100.o +COBJS-y += serial_pl010.o +COBJS-y += serial_pl011.o +COBJS-y += serial_xuartlite.o +COBJS-y += usbtty.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/drivers/atmel_usart.c b/drivers/serial/atmel_usart.c similarity index 100% rename from drivers/atmel_usart.c rename to drivers/serial/atmel_usart.c diff --git a/drivers/atmel_usart.h b/drivers/serial/atmel_usart.h similarity index 100% rename from drivers/atmel_usart.h rename to drivers/serial/atmel_usart.h diff --git a/drivers/ns16550.c b/drivers/serial/ns16550.c similarity index 100% rename from drivers/ns16550.c rename to drivers/serial/ns16550.c diff --git a/drivers/ns9750_serial.c b/drivers/serial/ns9750_serial.c similarity index 100% rename from drivers/ns9750_serial.c rename to drivers/serial/ns9750_serial.c diff --git a/drivers/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c similarity index 100% rename from drivers/s3c4510b_uart.c rename to drivers/serial/s3c4510b_uart.c diff --git a/drivers/s3c4510b_uart.h b/drivers/serial/s3c4510b_uart.h similarity index 100% rename from drivers/s3c4510b_uart.h rename to drivers/serial/s3c4510b_uart.h diff --git a/drivers/serial.c b/drivers/serial/serial.c similarity index 100% rename from drivers/serial.c rename to drivers/serial/serial.c diff --git a/drivers/serial_max3100.c b/drivers/serial/serial_max3100.c similarity index 100% rename from drivers/serial_max3100.c rename to drivers/serial/serial_max3100.c diff --git a/drivers/serial_pl010.c b/drivers/serial/serial_pl010.c similarity index 100% rename from drivers/serial_pl010.c rename to drivers/serial/serial_pl010.c diff --git a/drivers/serial_pl011.c b/drivers/serial/serial_pl011.c similarity index 100% rename from drivers/serial_pl011.c rename to drivers/serial/serial_pl011.c diff --git a/drivers/serial_pl011.h b/drivers/serial/serial_pl011.h similarity index 100% rename from drivers/serial_pl011.h rename to drivers/serial/serial_pl011.h diff --git a/drivers/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c similarity index 100% rename from drivers/serial_xuartlite.c rename to drivers/serial/serial_xuartlite.c diff --git a/drivers/usbtty.c b/drivers/serial/usbtty.c similarity index 100% rename from drivers/usbtty.c rename to drivers/serial/usbtty.c diff --git a/drivers/usbtty.h b/drivers/serial/usbtty.h similarity index 100% rename from drivers/usbtty.h rename to drivers/serial/usbtty.h diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile new file mode 100644 index 0000000000..f8ea167b12 --- /dev/null +++ b/drivers/usb/Makefile @@ -0,0 +1,52 @@ +# +# (C) Copyright 2000-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)libusb.a + +COBJS-y += isp116x-hcd.o +COBJS-y += sl811_usb.o +COBJS-y += usb_ohci.o +COBJS-y += usbdcore.o +COBJS-y += usbdcore_ep0.o +COBJS-y += usbdcore_mpc8xx.o +COBJS-y += usbdcore_omap1510.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/isp116x-hcd.c b/drivers/usb/isp116x-hcd.c similarity index 100% rename from drivers/isp116x-hcd.c rename to drivers/usb/isp116x-hcd.c diff --git a/drivers/isp116x.h b/drivers/usb/isp116x.h similarity index 100% rename from drivers/isp116x.h rename to drivers/usb/isp116x.h diff --git a/drivers/sl811.h b/drivers/usb/sl811.h similarity index 100% rename from drivers/sl811.h rename to drivers/usb/sl811.h diff --git a/drivers/sl811_usb.c b/drivers/usb/sl811_usb.c similarity index 99% rename from drivers/sl811_usb.c rename to drivers/usb/sl811_usb.c index b0cdf0bc2c..c1f8427c96 100644 --- a/drivers/sl811_usb.c +++ b/drivers/usb/sl811_usb.c @@ -41,7 +41,7 @@ #include #include "sl811.h" -#include "../board/kup/common/kup.h" +#include "../../board/kup/common/kup.h" #ifdef __PPC__ # define EIEIO __asm__ volatile ("eieio") diff --git a/drivers/usb_ohci.c b/drivers/usb/usb_ohci.c similarity index 99% rename from drivers/usb_ohci.c rename to drivers/usb/usb_ohci.c index 7ddcab63e7..cfa384eff6 100644 --- a/drivers/usb_ohci.c +++ b/drivers/usb/usb_ohci.c @@ -59,6 +59,10 @@ #include #include "usb_ohci.h" +#ifdef CONFIG_AT91RM9200 +#include /* needed for AT91_USB_HOST_BASE */ +#endif + #if defined(CONFIG_ARM920T) || \ defined(CONFIG_S3C2400) || \ defined(CONFIG_S3C2410) || \ diff --git a/drivers/usb_ohci.h b/drivers/usb/usb_ohci.h similarity index 100% rename from drivers/usb_ohci.h rename to drivers/usb/usb_ohci.h diff --git a/drivers/usbdcore.c b/drivers/usb/usbdcore.c similarity index 100% rename from drivers/usbdcore.c rename to drivers/usb/usbdcore.c diff --git a/drivers/usbdcore_ep0.c b/drivers/usb/usbdcore_ep0.c similarity index 100% rename from drivers/usbdcore_ep0.c rename to drivers/usb/usbdcore_ep0.c diff --git a/drivers/usbdcore_mpc8xx.c b/drivers/usb/usbdcore_mpc8xx.c similarity index 100% rename from drivers/usbdcore_mpc8xx.c rename to drivers/usb/usbdcore_mpc8xx.c diff --git a/drivers/usbdcore_omap1510.c b/drivers/usb/usbdcore_omap1510.c similarity index 100% rename from drivers/usbdcore_omap1510.c rename to drivers/usb/usbdcore_omap1510.c diff --git a/drivers/video/Makefile b/drivers/video/Makefile new file mode 100644 index 0000000000..36611ecdda --- /dev/null +++ b/drivers/video/Makefile @@ -0,0 +1,53 @@ +# +# (C) Copyright 2000-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)libvideo.a + +COBJS-y += ati_radeon_fb.o +COBJS-y += cfb_console.o +COBJS-y += ct69000.o +COBJS-y += sed13806.o +COBJS-y += sed156x.o +COBJS-y += sm501.o +COBJS-y += smiLynxEM.o +COBJS-y += videomodes.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/ati_ids.h b/drivers/video/ati_ids.h similarity index 100% rename from drivers/ati_ids.h rename to drivers/video/ati_ids.h diff --git a/drivers/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c similarity index 98% rename from drivers/ati_radeon_fb.c rename to drivers/video/ati_radeon_fb.c index c174f37b3f..0bdaa1c04d 100644 --- a/drivers/ati_radeon_fb.c +++ b/drivers/video/ati_radeon_fb.c @@ -300,7 +300,7 @@ typedef struct { u32 val; } reg_val; - +#if 0 /* unused ? -> scheduled for removal */ /* these common regs are cleared before mode setting so they do not * interfere with anything */ @@ -316,11 +316,10 @@ static reg_val common_regs[] = { { CAP0_TRIG_CNTL, 0 }, { CAP1_TRIG_CNTL, 0 }, }; - +#endif /* 0 */ void radeon_setmode(void) { - int i; struct radeon_regs *mode = malloc(sizeof(struct radeon_regs)); mode->crtc_gen_cntl = 0x03000200; @@ -351,6 +350,9 @@ void radeon_setmode(void) radeon_write_pll_regs(rinfo, mode); } +#include "../bios_emulator/include/biosemu.h" +extern int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo ** pVGAInfo, int cleanUp); + int radeon_probe(struct radeonfb_info *rinfo) { pci_dev_t pdev; diff --git a/drivers/ati_radeon_fb.h b/drivers/video/ati_radeon_fb.h similarity index 100% rename from drivers/ati_radeon_fb.h rename to drivers/video/ati_radeon_fb.h diff --git a/drivers/cfb_console.c b/drivers/video/cfb_console.c similarity index 100% rename from drivers/cfb_console.c rename to drivers/video/cfb_console.c diff --git a/drivers/ct69000.c b/drivers/video/ct69000.c similarity index 100% rename from drivers/ct69000.c rename to drivers/video/ct69000.c diff --git a/drivers/sed13806.c b/drivers/video/sed13806.c similarity index 100% rename from drivers/sed13806.c rename to drivers/video/sed13806.c diff --git a/drivers/sed156x.c b/drivers/video/sed156x.c similarity index 100% rename from drivers/sed156x.c rename to drivers/video/sed156x.c diff --git a/drivers/sm501.c b/drivers/video/sm501.c similarity index 100% rename from drivers/sm501.c rename to drivers/video/sm501.c diff --git a/drivers/smiLynxEM.c b/drivers/video/smiLynxEM.c similarity index 100% rename from drivers/smiLynxEM.c rename to drivers/video/smiLynxEM.c diff --git a/drivers/videomodes.c b/drivers/video/videomodes.c similarity index 100% rename from drivers/videomodes.c rename to drivers/video/videomodes.c diff --git a/drivers/videomodes.h b/drivers/video/videomodes.h similarity index 100% rename from drivers/videomodes.h rename to drivers/video/videomodes.h diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000000..f547024784 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,5 @@ +/hello_world +/interrupt +/sched +*.bin +*.srec diff --git a/examples/mips.lds b/examples/mips.lds index 9d9849bf5c..a7707287a2 100644 --- a/examples/mips.lds +++ b/examples/mips.lds @@ -39,14 +39,14 @@ SECTIONS . = ALIGN(4); .data : { *(.data) } - . = ALIGN(4); - .sdata : { *(.sdata) } + . = .; + _gp = ALIGN(16) + 0x7ff0; - _gp = ALIGN(16); - - __got_start = .; - .got : { *(.got) } - __got_end = .; + .got : { + __got_start = .; + *(.got) + __got_end = .; + } .sdata : { *(.sdata) } diff --git a/examples/smc91111_eeprom.c b/examples/smc91111_eeprom.c index 98e3e86ffa..b8a3594e9e 100644 --- a/examples/smc91111_eeprom.c +++ b/examples/smc91111_eeprom.c @@ -29,7 +29,7 @@ #include #include -#include "../drivers/smc91111.h" +#include "../drivers/net/smc91111.h" #define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE #define EEPROM 0x1; diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile index c1357d0aa5..a071af1f6e 100644 --- a/fs/jffs2/Makefile +++ b/fs/jffs2/Makefile @@ -26,9 +26,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)libjffs2.a AOBJS = -COBJS = jffs2_1pass.o compr_rtime.o compr_rubin.o compr_zlib.o mini_inflate.o -COBJS += compr_lzo.o compr_lzari.o +COBJS-y += jffs2_1pass.o +COBJS-y += compr_rtime.o +COBJS-y += compr_rubin.o +COBJS-y += compr_zlib.o +COBJS-y += mini_inflate.o +COBJS-y += compr_lzo.o +COBJS-y += compr_lzari.o +COBJS := $(COBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000000..d8fda80d5e --- /dev/null +++ b/include/.gitignore @@ -0,0 +1,6 @@ +/asm +/asm-ppc/arch +/bmp_logo.h +/config.h +/config.mk +/version_autogenerated.h diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91rm9200/hardware.h index 8bb0c47523..b868e38a3e 100644 --- a/include/asm-arm/arch-at91rm9200/hardware.h +++ b/include/asm-arm/arch-at91rm9200/hardware.h @@ -24,8 +24,6 @@ #ifndef __ASSEMBLY__ #include "AT91RM9200.h" -#else -#include "AT91RM9200_inc.h" #endif /* Virtual and Physical base address for system peripherals */ diff --git a/include/asm-m68k/immap_5329.h b/include/asm-m68k/immap_5329.h index 2a3980c130..271c27655b 100644 --- a/include/asm-m68k/immap_5329.h +++ b/include/asm-m68k/immap_5329.h @@ -57,7 +57,8 @@ #define MMAP_PWM 0xFC090000 #define MMAP_EPORT 0xFC094000 #define MMAP_WDOG 0xFC098000 -#define MMAP_CCM 0xFC0A0000 +#define MMAP_RCM 0xFC0A0000 +#define MMAP_CCM 0xFC0A0004 #define MMAP_GPIO 0xFC0A4000 #define MMAP_RTC 0xFC0A8000 #define MMAP_LCDC 0xFC0AC000 @@ -479,20 +480,22 @@ typedef struct wdog_ctrl { /*Chip configuration module registers */ typedef struct ccm_ctrl { - u8 rstctrl; /* 0x00 Reset Controller register */ - u8 rststat; /* 0x01 Reset Status register */ - u16 res1; /* 0x02 - 0x03 */ - u16 ccr; /* 0x04 Chip configuration register */ - u16 res2; /* 0x06 */ - u16 rcon; /* 0x08 Rreset configuration register */ - u16 cir; /* 0x0A Chip identification register */ - u32 res3; /* 0x0C */ - u16 misccr; /* 0x10 Miscellaneous control register */ - u16 cdr; /* 0x12 Clock divider register */ - u16 uhcsr; /* 0x14 USB Host controller status register */ - u16 uocsr; /* 0x16 USB On-the-Go Controller Status Register */ + u16 ccr; /* 0x00 Chip configuration register */ + u16 res2; /* 0x02 */ + u16 rcon; /* 0x04 Rreset configuration register */ + u16 cir; /* 0x06 Chip identification register */ + u32 res3; /* 0x08 */ + u16 misccr; /* 0x0A Miscellaneous control register */ + u16 cdr; /* 0x0C Clock divider register */ + u16 uhcsr; /* 0x10 USB Host controller status register */ + u16 uocsr; /* 0x12 USB On-the-Go Controller Status Reg */ } ccm_t; +typedef struct rcm { + u8 rcr; + u8 rsr; +} rcm_t; + /* GPIO port registers */ typedef struct gpio_ctrl { /* Port Output Data Registers */ diff --git a/include/asm-m68k/m5329.h b/include/asm-m68k/m5329.h index cd69fb0b5a..3f056511cb 100644 --- a/include/asm-m68k/m5329.h +++ b/include/asm-m68k/m5329.h @@ -245,6 +245,21 @@ #define CSCR_BSTR (0x00000010) #define CSCR_BSTW (0x00000008) +/********************************************************************* +* Reset Controller Module (RCM) +*********************************************************************/ + +/* Bit definitions and macros for RCR */ +#define RCM_RCR_FRCRSTOUT (0x40) +#define RCM_RCR_SOFTRST (0x80) + +/* Bit definitions and macros for RSR */ +#define RCM_RSR_LOL (0x01) +#define RCM_RSR_WDR_CORE (0x02) +#define RCM_RSR_EXT (0x04) +#define RCM_RSR_POR (0x08) +#define RCM_RSR_SOFT (0x20) + /********************************************************************* * FlexCAN Module (CAN) *********************************************************************/ diff --git a/include/asm-m68k/m5445x.h b/include/asm-m68k/m5445x.h index 8b886b0b60..b2bfb69264 100644 --- a/include/asm-m68k/m5445x.h +++ b/include/asm-m68k/m5445x.h @@ -792,8 +792,8 @@ #define GPIO_PAR_FEC_FEC0_MASK (0xF8) #define GPIO_PAR_FEC_FEC0_MII (0x07) #define GPIO_PAR_FEC_FEC0_RMII_GPIO (0x03) -#define GPIO_PAR_FEC_FEC0_RMII_ATA (0x02) -#define GPIO_PAR_FEC_FEC0_ATA (0x01) +#define GPIO_PAR_FEC_FEC0_RMII_ULPI (0x02) +#define GPIO_PAR_FEC_FEC0_ULPI (0x01) #define GPIO_PAR_FEC_FEC0_GPIO (0x00) /* Bit definitions and macros for PAR_DMA */ diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h index b8214b1c85..0e6abd7d0f 100644 --- a/include/asm-mips/addrspace.h +++ b/include/asm-mips/addrspace.h @@ -49,7 +49,7 @@ cannot access physical memory directly from core */ #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000) #else /* !CONFIG_AU1X00 */ -#define UNCACHED_SDRAM(a) PHYSADDR(a) +#define UNCACHED_SDRAM(a) KSEG1ADDR(a) #endif /* CONFIG_AU1X00 */ #endif /* __ASSEMBLY__ */ /* diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index cd4d5dc9d9..1e060f7c31 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h @@ -71,7 +71,21 @@ * instruction, so the lower 16 bits must be zero. Should be true on * on any sane architecture; generic code does not use this assumption. */ -extern unsigned long mips_io_port_base; +extern const unsigned long mips_io_port_base; + +/* + * Gcc will generate code to load the value of mips_io_port_base after each + * function call which may be fairly wasteful in some cases. So we don't + * play quite by the book. We tell gcc mips_io_port_base is a long variable + * which solves the code generation issue. Now we need to violate the + * aliasing rules a little to make initialization possible and finally we + * will need the barrier() to fight side effects of the aliasing chat. + * This trickery will eventually collapse under gcc's optimizer. Oh well. + */ +static inline void set_io_port_base(unsigned long base) +{ + * (unsigned long *) &mips_io_port_base = base; +} /* * Thanks to James van Artsdalen for a better timing-fix than diff --git a/include/common.h b/include/common.h index 77aed1a318..edd00247eb 100644 --- a/include/common.h +++ b/include/common.h @@ -63,19 +63,13 @@ typedef volatile unsigned char vu_char; #endif #elif defined(CONFIG_5xx) #include -#define CONFIG_RELOC_FIXUP_WORKS #elif defined(CONFIG_MPC5xxx) #include -#define CONFIG_RELOC_FIXUP_WORKS #elif defined(CONFIG_MPC512X) #include #include -#define CONFIG_RELOC_FIXUP_WORKS #elif defined(CONFIG_MPC8220) #include -#define CONFIG_RELOC_FIXUP_WORKS -#elif defined(CONFIG_824X) -#define CONFIG_RELOC_FIXUP_WORKS #elif defined(CONFIG_8260) #if defined(CONFIG_MPC8247) \ || defined(CONFIG_MPC8248) \ @@ -87,7 +81,6 @@ typedef volatile unsigned char vu_char; #define CONFIG_MPC8260 1 #endif #include -#define CONFIG_RELOC_FIXUP_WORKS #endif #ifdef CONFIG_MPC86xx #include @@ -100,7 +93,6 @@ typedef volatile unsigned char vu_char; #ifdef CONFIG_MPC83XX #include #include -#define CONFIG_RELOC_FIXUP_WORKS #endif #ifdef CONFIG_4xx #include diff --git a/include/configs/ADNPESC1.h b/include/configs/ADNPESC1.h index 77938b140d..c45c39554e 100644 --- a/include/configs/ADNPESC1.h +++ b/include/configs/ADNPESC1.h @@ -574,38 +574,30 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_BSP +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_DISPLAY +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_REISER +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP -#undef CONFIG_CMD_ASKENV -#undef CONFIG_CMD_BEDBUG -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_CACHE -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EEPROM -#undef CONFIG_CMD_ELF -#undef CONFIG_CMD_FAT -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_I2C -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_KGDB -#undef CONFIG_CMD_NAND #undef CONFIG_CMD_NFS -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_VFD -#undef CONFIG_CMD_USB #undef CONFIG_CMD_XIMG -#if (CFG_NIOS_CPU_SPI_NUMS != 1) -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_DATE +#if (CFG_NIOS_CPU_SPI_NUMS == 1) +#define CONFIG_CMD_DATE +#define CONFIG_CMD_SPI #endif /*------------------------------------------------------------------------ diff --git a/include/configs/DK1C20.h b/include/configs/DK1C20.h index 0ddf0e3aeb..eb78080208 100644 --- a/include/configs/DK1C20.h +++ b/include/configs/DK1C20.h @@ -459,38 +459,27 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_DISPLAY +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT +#define CONFIG_CMD_IDE +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP -#undef CONFIG_CMD_ASKENV -#undef CONFIG_CMD_BEDBUG -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_BSP -#undef CONFIG_CMD_CACHE -#undef CONFIG_CMD_DATE -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EEPROM -#undef CONFIG_CMD_ELF -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_I2C -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_KGDB -#undef CONFIG_CMD_NAND #undef CONFIG_CMD_NFS -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_VFD -#undef CONFIG_CMD_USB #undef CONFIG_CMD_XIMG - /*------------------------------------------------------------------------ * COMPACT FLASH *----------------------------------------------------------------------*/ diff --git a/include/configs/DK1S10.h b/include/configs/DK1S10.h index 0032fd3db7..bd360717a7 100644 --- a/include/configs/DK1S10.h +++ b/include/configs/DK1S10.h @@ -466,38 +466,25 @@ /* * Command line configuration. */ -#include +#include -#undef CONFIG_CMD_ASKENV -#undef COND_CMD_BEDBUG -#undef COND_CMD_BMP -#undef COND_CMD_BSP -#undef COND_CMD_CACHE -#undef COND_CMD_DATE -#undef COND_CMD_DOC -#undef COND_CMD_DTT -#undef COND_CMD_EEPROM -#undef COND_CMD_ELF -#undef COND_CMD_FAT -#undef COND_CMD_FDC -#undef COND_CMD_FDOS -#undef COND_CMD_HWFLOW -#undef COND_CMD_IDE -#undef COND_CMD_I2C -#undef COND_CMD_JFFS2 -#undef COND_CMD_KGDB -#undef COND_CMD_NAND -#undef COND_CMD_NFS -#undef COND_CMD_MMC -#undef COND_CMD_MII -#undef COND_CMD_PCI -#undef COND_CMD_PCMCIA -#undef COND_CMD_SCSI -#undef COND_CMD_SPI -#undef COND_CMD_VFD -#undef COND_CMD_USB -#undef COND_CMD_XIMG +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_DISPLAY +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_REISER +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP +#undef CONFIG_CMD_NFS +#undef CONFIG_CMD_XIMG /*------------------------------------------------------------------------ * KGDB diff --git a/include/configs/IDS8247.h b/include/configs/IDS8247.h index 85d2bb3f51..bb87fae8c4 100644 --- a/include/configs/IDS8247.h +++ b/include/configs/IDS8247.h @@ -120,6 +120,17 @@ #define CFG_NS16550_COM1 (CFG_UART_BASE + 0x8000) + +/* pass open firmware flat tree */ +#define CONFIG_OF_LIBFDT 1 +#define CONFIG_OF_BOARD_SETUP 1 + +#define OF_CPU "PowerPC,8247@0" +#define OF_SOC "soc@f0000000" +#define OF_TBCLK (bd->bi_busfreq / 4) +#define OF_STDOUT_PATH "/soc@f0000000/serial8250@e0008000" + + /* * select ethernet configuration * @@ -133,16 +144,18 @@ #undef CONFIG_ETHER_ON_SCC /* define if ether on SCC */ #define CONFIG_ETHER_ON_FCC /* define if ether on FCC */ #undef CONFIG_ETHER_NONE /* define if ether on something else */ -#define CONFIG_ETHER_INDEX 2 /* which SCC/FCC channel for ethernet */ +#define CONFIG_ETHER_INDEX 1 /* which SCC/FCC channel for ethernet */ +#define CONFIG_ETHER_ON_FCC1 +#define FCC_ENET /* - * - Rx-CLK is CLK13 - * - Tx-CLK is CLK14 + * - Rx-CLK is CLK10 + * - Tx-CLK is CLK9 * - RAM for BD/Buffers is on the 60x Bus (see 28-13) * - Enable Full Duplex in FSMR */ -# define CFG_CMXFCR_MASK (CMXFCR_FC2|CMXFCR_RF2CS_MSK|CMXFCR_TF2CS_MSK) -# define CFG_CMXFCR_VALUE (CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14) +# define CFG_CMXFCR_MASK (CMXFCR_FC1|CMXFCR_RF1CS_MSK|CMXFCR_TF1CS_MSK) +# define CFG_CMXFCR_VALUE (CMXFCR_RF1CS_CLK10|CMXFCR_TF1CS_CLK9) # define CFG_CPMFCR_RAMTYPE 0 # define CFG_FCC_PSMR (FCC_PSMR_FDE|FCC_PSMR_LPB) @@ -166,6 +179,8 @@ #define CONFIG_BOOTP_BOOTPATH #define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_RTC_PCF8563 +#define CFG_I2C_RTC_ADDR 0x51 /* * Command line configuration. @@ -211,7 +226,10 @@ */ #define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ - +#define CFG_FLASH_CFI /* The flash is CFI compatible */ +#define CFG_FLASH_CFI_DRIVER /* Use common CFI driver */ +#define CFG_FLASH_BANKS_LIST { 0xFF800000 } +#define CFG_MAX_FLASH_BANKS_DETECT 1 /* What should the base address of the main FLASH be and how big is * it (in MBytes)? This must contain TEXT_BASE from board/ids8247/config.mk * The main FLASH is whichever is connected to *CS0. @@ -227,7 +245,7 @@ * FLASH organization */ #define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */ -#define CFG_MAX_FLASH_SECT 64 /* max num of sects on one chip */ +#define CFG_MAX_FLASH_SECT 128 /* max num of sects on one chip */ #define CFG_FLASH_ERASE_TOUT 240000 /* Flash Erase Timeout (in ms) */ #define CFG_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (in ms) */ @@ -511,12 +529,12 @@ */ #define CFG_OR2 ((~(CFG_GLOBAL_SDRAM_LIMIT-1) & ORxS_SDAM_MSK) |\ ORxS_BPD_4 |\ - ORxS_ROWST_PBI0_A10 |\ + ORxS_ROWST_PBI0_A9 |\ ORxS_NUMR_12) -#define CFG_PSDMR (PSDMR_SDAM_A13_IS_A5 |\ +#define CFG_PSDMR (PSDMR_SDAM_A14_IS_A5 |\ PSDMR_BSMA_A15_A17 |\ - PSDMR_SDA10_PBI0_A11 |\ + PSDMR_SDA10_PBI0_A10 |\ PSDMR_RFRC_5_CLK |\ PSDMR_PRETOACT_2W |\ PSDMR_ACTTORW_2W |\ diff --git a/include/configs/LANTEC.h b/include/configs/LANTEC.h index 46edd08a91..e92069b5a9 100644 --- a/include/configs/LANTEC.h +++ b/include/configs/LANTEC.h @@ -87,37 +87,23 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DATE +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_FAT +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP -#undef CONFIG_CMD_BEDBUG -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_BSP -#undef CONFIG_CMD_DISPLAY -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EEPROM -#undef CONFIG_CMD_ELF -#undef CONFIG_CMD_EXT2 -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_I2C -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_IRQ -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_KGDB -#undef CONFIG_CMD_MFSL -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_NAND -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_UNIVERSE -#undef CONFIG_CMD_USB -#undef CONFIG_CMD_VFD #undef CONFIG_CMD_XIMG #if !(CONFIG_LANTEC >= 2) diff --git a/include/configs/M5253EVBE.h b/include/configs/M5253EVBE.h index 48170e7a35..f5e1b646ca 100644 --- a/include/configs/M5253EVBE.h +++ b/include/configs/M5253EVBE.h @@ -146,7 +146,7 @@ * Please note that CFG_SDRAM_BASE _must_ start at 0 */ #define CFG_SDRAM_BASE 0x00000000 -#define CFG_SDRAM_SIZE 16 /* SDRAM size in MB */ +#define CFG_SDRAM_SIZE 8 /* SDRAM size in MB */ #ifdef CONFIG_MONITOR_IS_IN_RAM #define CFG_MONITOR_BASE 0x20000 diff --git a/include/configs/M5282EVB.h b/include/configs/M5282EVB.h index 3c17c1ea14..7bb9f60f76 100644 --- a/include/configs/M5282EVB.h +++ b/include/configs/M5282EVB.h @@ -163,7 +163,7 @@ * Please note that CFG_SDRAM_BASE _must_ start at 0 */ #define CFG_SDRAM_BASE 0x00000000 -#define CFG_SDRAM_SIZE 8 /* SDRAM size in MB */ +#define CFG_SDRAM_SIZE 16 /* SDRAM size in MB */ #define CFG_FLASH_BASE 0xffe00000 #define CFG_INT_FLASH_BASE 0xf0000000 #define CFG_INT_FLASH_ENABLE 0x21 diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h index d3b160505b..47d74a3c37 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -175,7 +175,7 @@ * Please note that CFG_SDRAM_BASE _must_ start at 0 */ #define CFG_SDRAM_BASE 0x40000000 -#define CFG_SDRAM_SIZE 16 /* SDRAM size in MB */ +#define CFG_SDRAM_SIZE 32 /* SDRAM size in MB */ #define CFG_SDRAM_CFG1 0x53722730 #define CFG_SDRAM_CFG2 0x56670000 #define CFG_SDRAM_CTRL 0xE1092000 diff --git a/include/configs/M54455EVB.h b/include/configs/M54455EVB.h index 6f4859c238..db309584b9 100644 --- a/include/configs/M54455EVB.h +++ b/include/configs/M54455EVB.h @@ -27,8 +27,8 @@ * board/config.h - configuration options, board specific */ -#ifndef _JAMICA54455_H -#define _JAMICA54455_H +#ifndef _M54455EVB_H +#define _M54455EVB_H /* * High Level Configuration Options @@ -75,7 +75,7 @@ #define CONFIG_CMD_MISC #define CONFIG_CMD_MII #define CONFIG_CMD_NET -#define CONFIG_CMD_PCI +#undef CONFIG_CMD_PCI #define CONFIG_CMD_PING #define CONFIG_CMD_REGINFO @@ -129,8 +129,8 @@ "u-boot=u-boot.bin\0" \ "load=tftp ${loadaddr) ${u-boot}\0" \ "upd=run load; run prog\0" \ - "prog=prot off 0 2ffff;" \ - "era 0 2ffff;" \ + "prog=prot off 4000000 402ffff;" \ + "era 4000000 402ffff;" \ "cp.b ${loadaddr} 0 ${filesize};" \ "save\0" \ "" @@ -174,6 +174,7 @@ #define CFG_IMMR CFG_MBAR /* PCI */ +#ifdef CONFIG_CMD_PCI #define CONFIG_PCI 1 #define CFG_PCI_MEM_BUS 0xA0000000 @@ -187,6 +188,7 @@ #define CFG_PCI_CFG_BUS 0xB0000000 #define CFG_PCI_CFG_PHYS CFG_PCI_CFG_BUS #define CFG_PCI_CFG_SIZE 0x01000000 +#endif /* FPGA - Spartan 2 */ /* experiment @@ -268,8 +270,6 @@ /* Configuration for environment * Environment is embedded in u-boot in the second sector of the flash */ -#define CFG_ENV_OFFSET 0x4000 -#define CFG_ENV_SECT_SIZE 0x2000 #define CFG_ENV_IS_IN_FLASH 1 #define CONFIG_ENV_OVERWRITE 1 #undef CFG_ENV_IS_EMBEDDED @@ -278,13 +278,17 @@ * FLASH organization */ #ifdef CFG_ATMEL_BOOT -# define CFG_FLASH_BASE 0 +# define CFG_FLASH_BASE CFG_CS0_BASE # define CFG_FLASH0_BASE CFG_CS0_BASE # define CFG_FLASH1_BASE CFG_CS1_BASE +# define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x4000) +# define CFG_ENV_SECT_SIZE 0x2000 #else # define CFG_FLASH_BASE CFG_FLASH0_BASE # define CFG_FLASH0_BASE CFG_CS1_BASE # define CFG_FLASH1_BASE CFG_CS0_BASE +# define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x60000) +# define CFG_ENV_SECT_SIZE 0x20000 #endif /* M54455EVB has one non CFI flash, defined CFG_FLASH_CFI will cause the system @@ -328,9 +332,9 @@ * NOTE: Enable CONFIG_CMD_JFFS2 for JFFS2 support. */ #ifdef CFG_ATMEL_BOOT -# define CONFIG_JFFS2_DEV "nor0" +# define CONFIG_JFFS2_DEV "nor1" # define CONFIG_JFFS2_PART_SIZE 0x01000000 -# define CONFIG_JFFS2_PART_OFFSET CFG_FLASH1_BASE +# define CONFIG_JFFS2_PART_OFFSET (CFG_FLASH1_BASE + 0x500000) #else # define CONFIG_JFFS2_DEV "nor0" # define CONFIG_JFFS2_PART_SIZE (0x01000000 - 0x500000) @@ -356,20 +360,20 @@ #ifdef CFG_ATMEL_BOOT /* Atmel Flash */ -#define CFG_CS0_BASE 0 +#define CFG_CS0_BASE 0x04000000 #define CFG_CS0_MASK 0x00070001 #define CFG_CS0_CTRL 0x00001140 /* Intel Flash */ -#define CFG_CS1_BASE 0x04000000 +#define CFG_CS1_BASE 0x00000000 #define CFG_CS1_MASK 0x01FF0001 -#define CFG_CS1_CTRL 0x003F3D60 +#define CFG_CS1_CTRL 0x00000D60 #define CFG_ATMEL_BASE CFG_CS0_BASE #else /* Intel Flash */ -#define CFG_CS0_BASE 0 +#define CFG_CS0_BASE 0x00000000 #define CFG_CS0_MASK 0x01FF0001 -#define CFG_CS0_CTRL 0x003F3D60 +#define CFG_CS0_CTRL 0x00000D60 /* Atmel Flash */ #define CFG_CS1_BASE 0x04000000 #define CFG_CS1_MASK 0x00070001 @@ -388,4 +392,4 @@ #define CFG_CS3_MASK 0x00070001 #define CFG_CS3_CTRL 0x00000020 -#endif /* _JAMICA54455_H */ +#endif /* _M54455EVB_H */ diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h index 713518d0da..23508f9f5a 100644 --- a/include/configs/MPC8260ADS.h +++ b/include/configs/MPC8260ADS.h @@ -209,35 +209,25 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_I2C +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_JFFS2 +#define CONFIG_CMD_MII +#define CONFIG_CMD_PCI +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM -#undef CONFIG_CMD_BEDBUG -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_BSP -#undef CONFIG_CMD_DATE -#undef CONFIG_CMD_DISPLAY -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EEPROM -#undef CONFIG_CMD_ELF -#undef CONFIG_CMD_EXT2 -#undef CONFIG_CMD_FAT -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_KGDB -#undef CONFIG_CMD_MFSL -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_NAND -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_SNTP -#undef CONFIG_CMD_UNIVERSE -#undef CONFIG_CMD_USB -#undef CONFIG_CMD_VFD #undef CONFIG_CMD_XIMG #if CONFIG_ADSTYPE == CFG_8272ADS diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index 4e061bd9ff..8dda6651ef 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -316,6 +316,7 @@ extern unsigned long get_clock_freq(void); #define OF_SOC "soc8541@e0000000" #define OF_TBCLK (bd->bi_busfreq / 8) #define OF_STDOUT_PATH "/soc8541@e0000000/serial@4600" +#define OF_PCI "pci@e0008000" /* * I2C diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index f580ccadee..13e2a2c079 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -198,6 +198,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define PIXIS_VSPEED1 0x18 /* VELA VSpeed 1 */ #define PIXIS_VCLKH 0x19 /* VELA VCLKH register */ #define PIXIS_VCLKL 0x1A /* VELA VCLKL register */ +#define CFG_PIXIS_VBOOT_MASK 0x40 /* Reset altbank mask*/ /* define to use L1 as initial stack */ diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 6083715189..4edc7fd2b6 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -340,6 +340,7 @@ extern unsigned long get_clock_freq(void); #define OF_SOC "soc8548@e0000000" #define OF_TBCLK (bd->bi_busfreq / 8) #define OF_STDOUT_PATH "/soc8548@e0000000/serial@4600" +#define OF_PCI "pci@e0008000" /* * I2C diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 1d1b7c9079..c414bf033e 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -316,6 +316,7 @@ extern unsigned long get_clock_freq(void); #define OF_SOC "soc8555@e0000000" #define OF_TBCLK (bd->bi_busfreq / 8) #define OF_STDOUT_PATH "/soc8555@e0000000/serial@4600" +#define OF_PCI "pci@e0008000" /* * I2C diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index ba744e99f8..b9366cc994 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -297,7 +297,7 @@ extern unsigned long get_clock_freq(void); #define OF_SOC "soc8568@e0000000" #define OF_QE "qe@e0080000" #define OF_TBCLK (bd->bi_busfreq / 8) -#define OF_STDOUT_PATH "/soc8568@e0000000/serial@4600" +#define OF_STDOUT_PATH "/soc8568@e0000000/serial@4500" /* * I2C @@ -334,11 +334,6 @@ extern unsigned long get_clock_freq(void); #define CFG_SRIO_MEM_BASE 0xc0000000 -#if defined(CONFIG_PCI) - -#define CONFIG_NET_MULTI -#define CONFIG_PCI_PNP /* do pci plug-and-play */ - #ifdef CONFIG_QE /* * QE UEC ethernet configuration @@ -377,6 +372,11 @@ extern unsigned long get_clock_freq(void); #endif #endif /* CONFIG_QE */ +#if defined(CONFIG_PCI) + +#define CONFIG_NET_MULTI +#define CONFIG_PCI_PNP /* do pci plug-and-play */ + #undef CONFIG_EEPRO100 #undef CONFIG_TULIP diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index 7d8a380dc0..6f87240263 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -201,6 +201,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define PIXIS_VSPEED1 0x18 /* VELA VSpeed 1 */ #define PIXIS_VCLKH 0x19 /* VELA VCLKH register */ #define PIXIS_VCLKL 0x1A /* VELA VCLKL register */ +#define CFG_PIXIS_VBOOT_MASK 0x40 /* Reset altbank mask*/ #define CFG_MAX_FLASH_BANKS 2 /* number of banks */ #define CFG_MAX_FLASH_SECT 128 /* sectors per device */ @@ -346,6 +347,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CFG_USB_EVENT_POLL 1 #define CFG_USB_OHCI_SLOT_NAME "ohci_pci" #define CFG_USB_OHCI_MAX_ROOT_PORTS 15 +#define CFG_OHCI_SWAP_REG_ACCESS 1 #if !defined(CONFIG_PCI_PNP) #define PCI_ENET0_IOADDR 0xe0000000 @@ -544,6 +546,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_CMD_PCI #define CONFIG_CMD_SCSI #define CONFIG_CMD_EXT2 + #define CONFIG_CMD_USB #endif diff --git a/include/configs/RBC823.h b/include/configs/RBC823.h index 2f6de81551..fa32e33796 100644 --- a/include/configs/RBC823.h +++ b/include/configs/RBC823.h @@ -105,36 +105,31 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_BEDBUG +#define CONFIG_CMD_BMP +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_DOC +#define CONFIG_CMD_EEPROM +#define CONFIG_CMD_ELF +#define CONFIG_CMD_FAT +#define CONFIG_CMD_I2C +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_KGDB +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM -#undef CONFIG_CMD_BSP -#undef CONFIG_CMD_DATE -#undef CONFIG_CMD_DISPLAY -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EXT2 -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_IRQ -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_MFSL -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_NAND -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI #undef CONFIG_CMD_SETGETDCR -#undef CONFIG_CMD_SNTP -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_UNIVERSE -#undef CONFIG_CMD_USB -#undef CONFIG_CMD_VFD #undef CONFIG_CMD_XIMG - /* * Miscellaneous configurable options */ diff --git a/include/configs/ads5121.h b/include/configs/ads5121.h index bb1efdf6de..58060a8c8a 100644 --- a/include/configs/ads5121.h +++ b/include/configs/ads5121.h @@ -231,7 +231,7 @@ #define CFG_I2C_SPEED 100000 /* I2C speed and slave address */ #define CFG_I2C_SLAVE 0x7F #if 0 -#define CFG_I2C_NOPROBES {{0,0x69}} * Don't probe these addrs */ +#define CFG_I2C_NOPROBES {{0,0x69}} /* Don't probe these addrs */ #endif /* diff --git a/include/configs/atstk1002.h b/include/configs/atstk1002.h index 1809fc5d86..b33e26fe01 100644 --- a/include/configs/atstk1002.h +++ b/include/configs/atstk1002.h @@ -114,15 +114,10 @@ #define CONFIG_AUTOBOOT_STOP_STR " " /* - * These are "locally administered ethernet addresses" generated by - * ./tools/gen_eth_addr - * - * After booting the board for the first time, new addresses should be - * generated and assigned to the environment variables "ethaddr" and - * "eth1addr". + * After booting the board for the first time, new ethernet addresses + * should be generated and assigned to the environment variables + * "ethaddr" and "eth1addr". This is normally done during production. */ -#define CONFIG_ETHADDR 6a:87:71:14:cd:cb -#define CONFIG_ETH1ADDR ca:f8:15:e6:3e:e6 #define CONFIG_OVERWRITE_ETHADDR_ONCE 1 #define CONFIG_NET_MULTI 1 diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index 025c24960d..490db5fefd 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -303,38 +303,29 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_BEDBUG +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DATE +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_ELF +#define CONFIG_CMD_FAT +#define CONFIG_CMD_I2C +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_BSP #undef CONFIG_CMD_DCR -#undef CONFIG_CMD_DHCP -#undef CONFIG_CMD_DISPLAY -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_DTT -#undef CONFIG_CMD_EEPROM -#undef CONFIG_CMD_EXT2 -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_KGDB -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_MFSL -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_NAND -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_UNIVERSE -#undef CONFIG_CMD_USB -#undef CONFIG_CMD_VFD #undef CONFIG_CMD_XIMG - /* Where do the internal registers live? */ #define CFG_IMMR 0xF0000000 #define CFG_DEFAULT_IMMR 0x00010000 diff --git a/include/configs/hymod.h b/include/configs/hymod.h index 2547afb3cf..01e7970162 100644 --- a/include/configs/hymod.h +++ b/include/configs/hymod.h @@ -185,33 +185,34 @@ /* * Command line configuration. */ -#include +#include + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_BSP +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_CDP +#define CONFIG_CMD_DATE +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_DIAG +#define CONFIG_CMD_DTT +#define CONFIG_CMD_EEPROM +#define CONFIG_CMD_ELF +#define CONFIG_CMD_FAT +#define CONFIG_CMD_I2C +#define CONFIG_CMD_IMMAP +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_KGDB +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_SNTP -#undef CONFIG_CMD_BEDBUG -#undef CONFIG_CMD_BMP -#undef CONFIG_CMD_DISPLAY -#undef CONFIG_CMD_DOC -#undef CONFIG_CMD_EXT2 -#undef CONFIG_CMD_FDC -#undef CONFIG_CMD_FDOS #undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_HWFLOW -#undef CONFIG_CMD_IDE -#undef CONFIG_CMD_JFFS2 -#undef CONFIG_CMD_NAND -#undef CONFIG_CMD_MFSL -#undef CONFIG_CMD_MMC -#undef CONFIG_CMD_PCMCIA -#undef CONFIG_CMD_PCI -#undef CONFIG_CMD_USB -#undef CONFIG_CMD_REISER -#undef CONFIG_CMD_SCSI -#undef CONFIG_CMD_SPI -#undef CONFIG_CMD_UNIVERSE -#undef CONFIG_CMD_VFD #undef CONFIG_CMD_XIMG - #ifdef DEBUG #define CONFIG_BOOTDELAY -1 /* autoboot disabled */ #else diff --git a/include/configs/rsdproto.h b/include/configs/rsdproto.h index 814082ccc6..40a05fa5e8 100644 --- a/include/configs/rsdproto.h +++ b/include/configs/rsdproto.h @@ -92,8 +92,8 @@ /* enable I2C */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#define CFG_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CFG_I2C_SLAVE 0x7F +#define CFG_I2C_SPEED 50000 /* I2C speed and slave address */ +#define CFG_I2C_SLAVE 0x30 /* system clock rate (CLKIN) - equal to the 60x and local bus speed */ diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h index b4a063a1d4..9b05bd6c8c 100644 --- a/include/configs/sbc2410x.h +++ b/include/configs/sbc2410x.h @@ -103,7 +103,6 @@ #define CONFIG_CMD_DHCP #define CONFIG_CMD_ELF #define CONFIG_CMD_PING -#define CONFIG_CMD_REGINFO #define CONFIG_BOOTDELAY 3 diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index ca404ff452..18a036c2b6 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -88,7 +88,6 @@ #include #define CONFIG_CMD_CACHE -#define CONFIG_CMD_REGINFO #define CONFIG_CMD_DATE #define CONFIG_CMD_ELF diff --git a/include/configs/uc101.h b/include/configs/uc101.h index aed80ec1e5..81df1419f5 100644 --- a/include/configs/uc101.h +++ b/include/configs/uc101.h @@ -297,7 +297,7 @@ /* 8Mbit SRAM @0x80100000 */ #define CFG_CS1_START CFG_SRAM_BASE -#define CFG_CS1_SIZE 0x00100000 +#define CFG_CS1_SIZE 0x00200000 #define CFG_CS1_CFG 0x21D00 /* Display H1, Status Inputs, EPLD @0x80600000 8 Bit */ diff --git a/include/fdt.h b/include/fdt.h index 3dd3aca3b6..48ccfd9100 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -1,22 +1,3 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - #ifndef _FDT_H #define _FDT_H diff --git a/include/fdt_support.h b/include/fdt_support.h index 60fa423b33..8f781d4405 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -29,6 +29,22 @@ #include int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force); +void do_fixup_by_path(void *fdt, const char *path, const char *prop, + const void *val, int len, int create); +void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, + u32 val, int create); +void do_fixup_by_prop(void *fdt, + const char *pname, const void *pval, int plen, + const char *prop, const void *val, int len, + int create); +void do_fixup_by_prop_u32(void *fdt, + const char *pname, const void *pval, int plen, + const char *prop, u32 val, int create); +void do_fixup_by_compat(void *fdt, const char *compat, + const char *prop, const void *val, int len, int create); +void do_fixup_by_compat_u32(void *fdt, const char *compat, + const char *prop, u32 val, int create); +void fdt_fixup_ethernet(void *fdt, bd_t *bd); #ifdef CONFIG_OF_HAS_UBOOT_ENV int fdt_env(void *fdt); diff --git a/include/libfdt.h b/include/libfdt.h index 38c65a9899..6b2fb92ea3 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1,154 +1,721 @@ +#ifndef _LIBFDT_H +#define _LIBFDT_H /* * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _LIBFDT_H -#define _LIBFDT_H - -#include #include +#include #define FDT_FIRST_SUPPORTED_VERSION 0x10 #define FDT_LAST_SUPPORTED_VERSION 0x11 /* Error codes: informative error codes */ #define FDT_ERR_NOTFOUND 1 + /* FDT_ERR_NOTFOUND: The requested node or property does not exist */ #define FDT_ERR_EXISTS 2 + /* FDT_ERR_EXISTS: Attemped to create a node or property which + * already exists */ #define FDT_ERR_NOSPACE 3 + /* FDT_ERR_NOSPACE: Operation needed to expand the device + * tree, but its buffer did not have sufficient space to + * contain the expanded tree. Use fdt_open_into() to move the + * device tree to a buffer with more space. */ /* Error codes: codes for bad parameters */ #define FDT_ERR_BADOFFSET 4 + /* FDT_ERR_BADOFFSET: Function was passed a structure block + * offset which is out-of-bounds, or which points to an + * unsuitable part of the structure for the operation. */ #define FDT_ERR_BADPATH 5 -#define FDT_ERR_BADSTATE 6 + /* FDT_ERR_BADPATH: Function was passed a badly formatted path + * (e.g. missing a leading / for a function which requires an + * absolute path) */ +#define FDT_ERR_BADPHANDLE 6 + /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle + * value. phandle values of 0 and -1 are not permitted. */ +#define FDT_ERR_BADSTATE 7 + /* FDT_ERR_BADSTATE: Function was passed an incomplete device + * tree created by the sequential-write functions, which is + * not sufficiently complete for the requested operation. */ /* Error codes: codes for bad device tree blobs */ -#define FDT_ERR_TRUNCATED 7 -#define FDT_ERR_BADMAGIC 8 -#define FDT_ERR_BADVERSION 9 -#define FDT_ERR_BADSTRUCTURE 10 -#define FDT_ERR_BADLAYOUT 11 +#define FDT_ERR_TRUNCATED 8 + /* FDT_ERR_TRUNCATED: Structure block of the given device tree + * ends without an FDT_END tag. */ +#define FDT_ERR_BADMAGIC 9 + /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a + * device tree at all - it is missing the flattened device + * tree magic number. */ +#define FDT_ERR_BADVERSION 10 + /* FDT_ERR_BADVERSION: Given device tree has a version which + * can't be handled by the requested operation. For + * read-write functions, this may mean that fdt_open_into() is + * required to convert the tree to the expected version. */ +#define FDT_ERR_BADSTRUCTURE 11 + /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt + * structure block or other serious error (e.g. misnested + * nodes, or subnodes preceding properties). */ +#define FDT_ERR_BADLAYOUT 12 + /* FDT_ERR_BADLAYOUT: For read-write functions, the given + * device tree has it's sub-blocks in an order that the + * function can't handle (memory reserve map, then structure, + * then strings). Use fdt_open_into() to reorganize the tree + * into a form suitable for the read-write operations. */ -#define FDT_ERR_MAX 11 +/* "Can't happen" error indicating a bug in libfdt */ +#define FDT_ERR_INTERNAL 13 + /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion. + * Should never be returned, if it is, it indicates a bug in + * libfdt itself. */ + +#define FDT_ERR_MAX 13 + +/**********************************************************************/ +/* Low-level functions (you probably don't need these) */ +/**********************************************************************/ + +const void *fdt_offset_ptr(const void *fdt, int offset, int checklen); +static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) +{ + return (void *)fdt_offset_ptr(fdt, offset, checklen); +} + +uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); + +/**********************************************************************/ +/* General functions */ +/**********************************************************************/ #define fdt_get_header(fdt, field) \ - (fdt32_to_cpu(((struct fdt_header *)(fdt))->field)) -#define fdt_magic(fdt) (fdt_get_header(fdt, magic)) + (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field)) +#define fdt_magic(fdt) (fdt_get_header(fdt, magic)) #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize)) #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct)) #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings)) #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap)) #define fdt_version(fdt) (fdt_get_header(fdt, version)) -#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version)) -#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys)) -#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) +#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version)) +#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys)) +#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) -#define fdt_set_header(fdt, field, val) \ - ((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val) +#define __fdt_set_hdr(name) \ + static inline void fdt_set_##name(void *fdt, uint32_t val) \ + { \ + struct fdt_header *fdth = fdt; \ + fdth->name = cpu_to_fdt32(val); \ + } +__fdt_set_hdr(magic); +__fdt_set_hdr(totalsize); +__fdt_set_hdr(off_dt_struct); +__fdt_set_hdr(off_dt_strings); +__fdt_set_hdr(off_mem_rsvmap); +__fdt_set_hdr(version); +__fdt_set_hdr(last_comp_version); +__fdt_set_hdr(boot_cpuid_phys); +__fdt_set_hdr(size_dt_strings); +__fdt_set_hdr(size_dt_struct); +#undef __fdt_set_hdr +/** + * fdt_check_header - sanity check a device tree or possible device tree + * @fdt: pointer to data which might be a flattened device tree + * + * fdt_check_header() checks that the given buffer contains what + * appears to be a flattened device tree with sane information in its + * header. + * + * returns: + * 0, if the buffer appears to contain a valid device tree + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings, as above + */ int fdt_check_header(const void *fdt); -void *fdt_offset_ptr(const void *fdt, int offset, int checklen); - -#define fdt_offset_ptr_typed(fdt, offset, var) \ - ((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var))))) - +/** + * fdt_move - move a device tree around in memory + * @fdt: pointer to the device tree to move + * @buf: pointer to memory where the device is to be moved + * @bufsize: size of the memory space at buf + * + * fdt_move() relocates, if possible, the device tree blob located at + * fdt to the buffer at buf of size bufsize. The buffer may overlap + * with the existing device tree blob at fdt. Therefore, + * fdt_move(fdt, fdt, fdt_totalsize(fdt)) + * should always succeed. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ int fdt_move(const void *fdt, void *buf, int bufsize); -/* Read-only functions */ -char *fdt_string(const void *fdt, int stroffset); +/**********************************************************************/ +/* Read-only functions */ +/**********************************************************************/ +/** + * fdt_string - retreive a string from the strings block of a device tree + * @fdt: pointer to the device tree blob + * @stroffset: offset of the string within the strings block (native endian) + * + * fdt_string() retrieves a pointer to a single string from the + * strings block of the device tree blob at fdt. + * + * returns: + * a pointer to the string, on success + * NULL, if stroffset is out of bounds + */ +const char *fdt_string(const void *fdt, int stroffset); + +/** + * fdt_num_mem_rsv - retreive the number of memory reserve map entries + * @fdt: pointer to the device tree blob + * + * Returns the number of entries in the device tree blob's memory + * reservation map. This does not include the terminating 0,0 entry + * or any other (0,0) entries reserved for expansion. + * + * returns: + * the number of entries + */ +int fdt_num_mem_rsv(const void *fdt); + +/** + * fdt_get_mem_rsv - retreive one memory reserve map entry + * @fdt: pointer to the device tree blob + * @address, @size: pointers to 64-bit variables + * + * On success, *address and *size will contain the address and size of + * the n-th reserve map entry from the device tree blob, in + * native-endian format. + * + * returns: + * 0, on success + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size); + +/** + * fdt_subnode_offset_namelen - find a subnode based on substring + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * @namelen: number of characters of name to consider + * + * Identical to fdt_subnode_offset(), but only examine the first + * namelen characters of name for matching the subnode name. This is + * useful for finding subnodes based on a portion of a larger string, + * such as a full path. + */ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen); +/** + * fdt_subnode_offset - find a subnode of a given node + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * + * fdt_subnode_offset() finds a subnode of the node at structure block + * offset parentoffset with the given name. name may include a unit + * address, in which case fdt_subnode_offset() will find the subnode + * with that unit address, or the unit address may be omitted, in + * which case fdt_subnode_offset() will find an arbitrary subnode + * whose name excluding unit address matches the given name. + * + * returns: + * structure block offset of the requested subnode (>=0), on success + * -FDT_ERR_NOTFOUND, if the requested subnode does not exist + * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings. + */ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); -int fdt_find_node_by_path(const void *fdt, const char *path); -int fdt_find_node_by_type(const void *fdt, int nodeoffset, const char *type); +/** + * fdt_path_offset - find a tree node by its full path + * @fdt: pointer to the device tree blob + * @path: full path of the node to locate + * + * fdt_path_offset() finds a node of a given path in the device tree. + * Each path component may omit the unit address portion, but the + * results of this are undefined if any such path component is + * ambiguous (that is if there are multiple nodes at the relevant + * level matching the given component, differentiated only by unit + * address). + * + * returns: + * structure block offset of the node with the requested path (>=0), on success + * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid + * -FDT_ERR_NOTFOUND, if the requested node does not exist + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings. + */ +int fdt_path_offset(const void *fdt, const char *path); -int fdt_node_is_compatible(const void *fdt, int nodeoffset, - const char *compat); -int fdt_find_compatible_node(const void *fdt, int nodeoffset, - const char *type, const char *compat); +/** + * fdt_get_name - retreive the name of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: structure block offset of the starting node + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_get_name() retrieves the name (including unit address) of the + * device tree node at structure block offset nodeoffset. If lenp is + * non-NULL, the length of this name is also returned, in the integer + * pointed to by lenp. + * + * returns: + * pointer to the node's name, on success + * If lenp is non-NULL, *lenp contains the length of that name (>=0) + * NULL, on error + * if lenp is non-NULL *lenp contains an error code (<0): + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp); -struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, - const char *name, int *lenp); -void *fdt_getprop(const void *fdt, int nodeoffset, - const char *name, int *lenp); +/** + * fdt_get_property - find a given property in a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to find + * @name: name of the property to find + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_get_property() retrieves a pointer to the fdt_property + * structure within the device tree blob corresponding to the property + * named 'name' of the node at offset nodeoffset. If lenp is + * non-NULL, the length of the property value also returned, in the + * integer pointed to by lenp. + * + * returns: + * pointer to the structure representing the property + * if lenp is non-NULL, *lenp contains the length of the property + * value (>=0) + * NULL, on error + * if lenp is non-NULL, *lenp contains an error code (<0): + * -FDT_ERR_NOTFOUND, node does not have named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, + const char *name, int *lenp); +static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, + const char *name, + int *lenp) +{ + return (struct fdt_property *)fdt_get_property(fdt, nodeoffset, + name, lenp); +} -uint32_t fdt_next_tag(const void *fdt, int offset, - int *nextoffset, char **namep); -int fdt_num_reservemap(void *fdt, int *used, int *total); -int fdt_get_reservemap(void *fdt, int n, struct fdt_reserve_entry *re); +/** + * fdt_getprop - retrieve the value of a given property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to find + * @name: name of the property to find + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_getprop() retrieves a pointer to the value of the property + * named 'name' of the node at offset nodeoffset (this will be a + * pointer to within the device blob itself, not a copy of the value). + * If lenp is non-NULL, the length of the property value also + * returned, in the integer pointed to by lenp. + * + * returns: + * pointer to the property's value + * if lenp is non-NULL, *lenp contains the length of the property + * value (>=0) + * NULL, on error + * if lenp is non-NULL, *lenp contains an error code (<0): + * -FDT_ERR_NOTFOUND, node does not have named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +const void *fdt_getprop(const void *fdt, int nodeoffset, + const char *name, int *lenp); +static inline void *fdt_getprop_w(void *fdt, int nodeoffset, + const char *name, int *lenp) +{ + return (void *)fdt_getprop(fdt, nodeoffset, name, lenp); +} + +/** + * fdt_get_phandle - retreive the phandle of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: structure block offset of the node + * + * fdt_get_phandle() retrieves the phandle of the device tree node at + * structure block offset nodeoffset. + * + * returns: + * the phandle of the node at nodeoffset, on succes (!= 0, != -1) + * 0, if the node has no phandle, or another error occurs + */ +uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); + +/** + * fdt_get_path - determine the full path of a node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose path to find + * @buf: character buffer to contain the returned path (will be overwritten) + * @buflen: size of the character buffer at buf + * + * fdt_get_path() computes the full path of the node at offset + * nodeoffset, and records that path in the buffer at buf. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + * 0, on success + * buf contains the absolute path of the node at + * nodeoffset, as a NUL-terminated string. + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1) + * characters and will not fit in the given buffer. + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen); + +/** + * fdt_supernode_atdepth_offset - find a specific ancestor of a node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * @supernodedepth: depth of the ancestor to find + * @nodedepth: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_supernode_atdepth_offset() finds an ancestor of the given node + * at a specific depth from the root (where the root itself has depth + * 0, its immediate subnodes depth 1 and so forth). So + * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL); + * will always return 0, the offset of the root node. If the node at + * nodeoffset has depth D, then: + * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL); + * will return nodeoffset itself. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + + * structure block offset of the node at node offset's ancestor + * of depth supernodedepth (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag +* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, + int supernodedepth, int *nodedepth); + +/** + * fdt_node_depth - find the depth of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * + * fdt_node_depth() finds the depth of a given node. The root node + * has depth 0, its immediate subnodes depth 1 and so forth. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + * depth of the node at nodeoffset (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_depth(const void *fdt, int nodeoffset); + +/** + * fdt_parent_offset - find the parent of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * + * fdt_parent_offset() locates the parent node of a given node (that + * is, it finds the offset of the node which contains the node at + * nodeoffset as a subnode). + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset, *twice*. + * + * returns: + * stucture block offset of the parent of the node at nodeoffset + * (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_parent_offset(const void *fdt, int nodeoffset); + +/** + * fdt_node_offset_by_prop_value - find nodes with a given property value + * @fdt: pointer to the device tree blob + * @startoffset: only find nodes after this offset + * @propname: property name to check + * @propval: property value to search for + * @proplen: length of the value in propval + * + * fdt_node_offset_by_prop_value() returns the offset of the first + * node after startoffset, which has a property named propname whose + * value is of length proplen and has value equal to propval; or if + * startoffset is -1, the very first such node in the tree. + * + * To iterate through all nodes matching the criterion, the following + * idiom can be used: + * offset = fdt_node_offset_by_prop_value(fdt, -1, propname, + * propval, proplen); + * while (offset != -FDT_ERR_NOTFOUND) { + * // other code here + * offset = fdt_node_offset_by_prop_value(fdt, offset, propname, + * propval, proplen); + * } + * + * Note the -1 in the first call to the function, if 0 is used here + * instead, the function will never locate the root node, even if it + * matches the criterion. + * + * returns: + * structure block offset of the located node (>= 0, >startoffset), + * on success + * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the + * tree after startoffset + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, + const char *propname, + const void *propval, int proplen); + +/** + * fdt_node_offset_by_phandle - find the node with a given phandle + * @fdt: pointer to the device tree blob + * @phandle: phandle value + * + * fdt_node_offset_by_prop_value() returns the offset of the node + * which has the given phandle value. If there is more than one node + * in the tree with the given phandle (an invalid tree), results are + * undefined. + * + * returns: + * structure block offset of the located node (>= 0), on success + * -FDT_ERR_NOTFOUND, no node with that phandle exists + * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1) + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); + +/** + * fdt_node_check_compatible: check a node's compatible property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of a tree node + * @compatible: string to match against + * + * + * fdt_node_check_compatible() returns 0 if the given node contains a + * 'compatible' property with the given string as one of its elements, + * it returns non-zero otherwise, or on error. + * + * returns: + * 0, if the node has a 'compatible' property listing the given string + * 1, if the node has a 'compatible' property, but it does not list + * the given string + * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property + * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_check_compatible(const void *fdt, int nodeoffset, + const char *compatible); + +/** + * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value + * @fdt: pointer to the device tree blob + * @startoffset: only find nodes after this offset + * @compatible: 'compatible' string to match against + * + * fdt_node_offset_by_compatible() returns the offset of the first + * node after startoffset, which has a 'compatible' property which + * lists the given compatible string; or if startoffset is -1, the + * very first such node in the tree. + * + * To iterate through all nodes matching the criterion, the following + * idiom can be used: + * offset = fdt_node_offset_by_compatible(fdt, -1, compatible); + * while (offset != -FDT_ERR_NOTFOUND) { + * // other code here + * offset = fdt_node_offset_by_compatible(fdt, offset, compatible); + * } + * + * Note the -1 in the first call to the function, if 0 is used here + * instead, the function will never locate the root node, even if it + * matches the criterion. + * + * returns: + * structure block offset of the located node (>= 0, >startoffset), + * on success + * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the + * tree after startoffset + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_compatible(const void *fdt, int startoffset, + const char *compatible); + +/**********************************************************************/ +/* Write-in-place functions */ +/**********************************************************************/ -/* Write-in-place functions */ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, const void *val, int len); - -#define fdt_setprop_inplace_typed(fdt, nodeoffset, name, val) \ - ({ \ - typeof(val) x = val; \ - fdt_setprop_inplace(fdt, nodeoffset, name, &x, sizeof(x)); \ - }) +static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, + const char *name, uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); +} int fdt_nop_property(void *fdt, int nodeoffset, const char *name); int fdt_nop_node(void *fdt, int nodeoffset); -int fdt_insert_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size); +/**********************************************************************/ +/* Sequential write functions */ +/**********************************************************************/ -/* Sequential-write functions */ int fdt_create(void *buf, int bufsize); int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); int fdt_finish_reservemap(void *fdt); int fdt_begin_node(void *fdt, const char *name); int fdt_property(void *fdt, const char *name, const void *val, int len); -#define fdt_property_typed(fdt, name, val) \ - ({ \ - typeof(val) x = (val); \ - fdt_property((fdt), (name), &x, sizeof(x)); \ - }) +static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_property(fdt, name, &val, sizeof(val)); +} #define fdt_property_string(fdt, name, str) \ fdt_property(fdt, name, str, strlen(str)+1) int fdt_end_node(void *fdt); int fdt_finish(void *fdt); -int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size); -/* Read-write functions */ -int fdt_open_into(void *fdt, void *buf, int bufsize); +/**********************************************************************/ +/* Read-write functions */ +/**********************************************************************/ + +int fdt_open_into(const void *fdt, void *buf, int bufsize); int fdt_pack(void *fdt); +int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size); +int fdt_del_mem_rsv(void *fdt, int n); + int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len); -#define fdt_setprop_typed(fdt, nodeoffset, name, val) \ - ({ \ - typeof(val) x = (val); \ - fdt_setprop((fdt), (nodeoffset), (name), &x, sizeof(x)); \ - }) +static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, + uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); +} #define fdt_setprop_string(fdt, nodeoffset, name, str) \ fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) -int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, - const void *val, int len, int create); int fdt_delprop(void *fdt, int nodeoffset, const char *name); int fdt_add_subnode_namelen(void *fdt, int parentoffset, const char *name, int namelen); int fdt_add_subnode(void *fdt, int parentoffset, const char *name); int fdt_del_node(void *fdt, int nodeoffset); -/* Extra functions */ +/**********************************************************************/ +/* Debugging / informational functions */ +/**********************************************************************/ + const char *fdt_strerror(int errval); #endif /* _LIBFDT_H */ diff --git a/include/miiphy.h b/include/miiphy.h index 71716b04d4..5518a0a89c 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -26,56 +26,49 @@ | | Author: Mark Wisner | -| Change Activity- -| -| Date Description of Change BY -| --------- --------------------- --- -| 04-May-99 Created MKW -| 07-Jul-99 Added full duplex support MKW -| 08-Sep-01 Tweaks gvb -| +----------------------------------------------------------------------------*/ #ifndef _miiphy_h_ #define _miiphy_h_ #include -int miiphy_read(char *devname, unsigned char addr, unsigned char reg, - unsigned short *value); -int miiphy_write(char *devname, unsigned char addr, unsigned char reg, - unsigned short value); -int miiphy_info(char *devname, unsigned char addr, unsigned int *oui, - unsigned char *model, unsigned char *rev); -int miiphy_reset(char *devname, unsigned char addr); -int miiphy_speed(char *devname, unsigned char addr); -int miiphy_duplex(char *devname, unsigned char addr); +int miiphy_read (char *devname, unsigned char addr, unsigned char reg, + unsigned short *value); +int miiphy_write (char *devname, unsigned char addr, unsigned char reg, + unsigned short value); +int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, + unsigned char *model, unsigned char *rev); +int miiphy_reset (char *devname, unsigned char addr); +int miiphy_speed (char *devname, unsigned char addr); +int miiphy_duplex (char *devname, unsigned char addr); +int miiphy_is_1000base_x (char *devname, unsigned char addr); #ifdef CFG_FAULT_ECHO_LINK_DOWN -int miiphy_link(char *devname, unsigned char addr); +int miiphy_link (char *devname, unsigned char addr); #endif -void miiphy_init(void); +void miiphy_init (void); -void miiphy_register(char *devname, - int (* read)(char *devname, unsigned char addr, - unsigned char reg, unsigned short *value), - int (* write)(char *devname, unsigned char addr, - unsigned char reg, unsigned short value)); +void miiphy_register (char *devname, + int (*read) (char *devname, unsigned char addr, + unsigned char reg, unsigned short *value), + int (*write) (char *devname, unsigned char addr, + unsigned char reg, unsigned short value)); -int miiphy_set_current_dev(char *devname); -char *miiphy_get_current_dev(void); +int miiphy_set_current_dev (char *devname); +char *miiphy_get_current_dev (void); -void miiphy_listdev(void); +void miiphy_listdev (void); #define BB_MII_DEVNAME "bbmii" int bb_miiphy_read (char *devname, unsigned char addr, - unsigned char reg, unsigned short *value); + unsigned char reg, unsigned short *value); int bb_miiphy_write (char *devname, unsigned char addr, - unsigned char reg, unsigned short value); + unsigned char reg, unsigned short value); /* phy seed setup */ #define AUTO 99 -#define _1000BASET 1000 +#define _1000BASET 1000 #define _100BASET 100 #define _10BASET 10 #define HALF 22 @@ -90,9 +83,10 @@ int bb_miiphy_write (char *devname, unsigned char addr, #define PHY_ANLPAR 0x05 #define PHY_ANER 0x06 #define PHY_ANNPTR 0x07 -#define PHY_ANLPNP 0x08 -#define PHY_1000BTCR 0x09 -#define PHY_1000BTSR 0x0A +#define PHY_ANLPNP 0x08 +#define PHY_1000BTCR 0x09 +#define PHY_1000BTSR 0x0A +#define PHY_EXSR 0x0F #define PHY_PHYSTS 0x10 #define PHY_MIPSCR 0x11 #define PHY_MIPGSR 0x12 @@ -115,10 +109,10 @@ int bb_miiphy_write (char *devname, unsigned char addr, #define PHY_BMCR_DPLX 0x0100 #define PHY_BMCR_COL_TST 0x0080 -#define PHY_BMCR_SPEED_MASK 0x2040 -#define PHY_BMCR_1000_MBPS 0x0040 -#define PHY_BMCR_100_MBPS 0x2000 -#define PHY_BMCR_10_MBPS 0x0000 +#define PHY_BMCR_SPEED_MASK 0x2040 +#define PHY_BMCR_1000_MBPS 0x0040 +#define PHY_BMCR_100_MBPS 0x2000 +#define PHY_BMCR_10_MBPS 0x0000 /* phy BMSR */ #define PHY_BMSR_100T4 0x8000 @@ -126,6 +120,7 @@ int bb_miiphy_write (char *devname, unsigned char addr, #define PHY_BMSR_100TXH 0x2000 #define PHY_BMSR_10TF 0x1000 #define PHY_BMSR_10TH 0x0800 +#define PHY_BMSR_EXT_STAT 0x0100 #define PHY_BMSR_PRE_SUP 0x0040 #define PHY_BMSR_AUTN_COMP 0x0020 #define PHY_BMSR_RF 0x0010 @@ -138,23 +133,42 @@ int bb_miiphy_write (char *devname, unsigned char addr, #define PHY_ANLPAR_NP 0x8000 #define PHY_ANLPAR_ACK 0x4000 #define PHY_ANLPAR_RF 0x2000 +#define PHY_ANLPAR_ASYMP 0x0800 +#define PHY_ANLPAR_PAUSE 0x0400 #define PHY_ANLPAR_T4 0x0200 #define PHY_ANLPAR_TXFD 0x0100 #define PHY_ANLPAR_TX 0x0080 #define PHY_ANLPAR_10FD 0x0040 #define PHY_ANLPAR_10 0x0020 -#define PHY_ANLPAR_100 0x0380 /* we can run at 100 */ +#define PHY_ANLPAR_100 0x0380 /* we can run at 100 */ +/* phy ANLPAR 1000BASE-X */ +#define PHY_X_ANLPAR_NP 0x8000 +#define PHY_X_ANLPAR_ACK 0x4000 +#define PHY_X_ANLPAR_RF_MASK 0x3000 +#define PHY_X_ANLPAR_PAUSE_MASK 0x0180 +#define PHY_X_ANLPAR_HD 0x0040 +#define PHY_X_ANLPAR_FD 0x0020 -#define PHY_ANLPAR_PSB_MASK 0x001f -#define PHY_ANLPAR_PSB_802_3 0x0001 -#define PHY_ANLPAR_PSB_802_9 0x0002 +#define PHY_ANLPAR_PSB_MASK 0x001f +#define PHY_ANLPAR_PSB_802_3 0x0001 +#define PHY_ANLPAR_PSB_802_9 0x0002 -/* PHY_1000BTSR */ -#define PHY_1000BTSR_MSCF 0x8000 -#define PHY_1000BTSR_MSCR 0x4000 -#define PHY_1000BTSR_LRS 0x2000 -#define PHY_1000BTSR_RRS 0x1000 -#define PHY_1000BTSR_1000FD 0x0800 -#define PHY_1000BTSR_1000HD 0x0400 +/* phy 1000BTCR */ +#define PHY_1000BTCR_1000FD 0x0200 +#define PHY_1000BTCR_1000HD 0x0100 + +/* phy 1000BTSR */ +#define PHY_1000BTSR_MSCF 0x8000 +#define PHY_1000BTSR_MSCR 0x4000 +#define PHY_1000BTSR_LRS 0x2000 +#define PHY_1000BTSR_RRS 0x1000 +#define PHY_1000BTSR_1000FD 0x0800 +#define PHY_1000BTSR_1000HD 0x0400 + +/* phy EXSR */ +#define PHY_EXSR_1000XF 0x8000 +#define PHY_EXSR_1000XH 0x4000 +#define PHY_EXSR_1000TF 0x2000 +#define PHY_EXSR_1000TH 0x1000 #endif diff --git a/lib_arm/board.c b/lib_arm/board.c index 7e97f13476..6f35aa06bf 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -46,10 +46,10 @@ #include #ifdef CONFIG_DRIVER_SMC91111 -#include "../drivers/smc91111.h" +#include "../drivers/net/smc91111.h" #endif #ifdef CONFIG_DRIVER_LAN91C96 -#include "../drivers/lan91c96.h" +#include "../drivers/net/lan91c96.h" #endif DECLARE_GLOBAL_DATA_PTR; diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c index 7c9990f8e0..86a3b67c98 100644 --- a/lib_blackfin/board.c +++ b/lib_blackfin/board.c @@ -35,7 +35,7 @@ #include #include "blackfin_board.h" #include -#include "../drivers/smc91111.h" +#include "../drivers/net/smc91111.h" #if defined(CONFIG_BF537)&&defined(CONFIG_POST) #include diff --git a/lib_generic/Makefile b/lib_generic/Makefile index bf377529c2..9713353ddf 100644 --- a/lib_generic/Makefile +++ b/lib_generic/Makefile @@ -25,11 +25,22 @@ include $(TOPDIR)/config.mk LIB = $(obj)libgeneric.a -COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \ - bzlib_randtable.o bzlib_huffman.o \ - crc32.o ctype.o display_options.o div64.o ldiv.o sha1.o \ - string.o vsprintf.o zlib.o +COBJS-y += bzlib.o +COBJS-y += bzlib_crctable.o +COBJS-y += bzlib_decompress.o +COBJS-y += bzlib_randtable.o +COBJS-y += bzlib_huffman.o +COBJS-y += crc32.o +COBJS-y += ctype.o +COBJS-y += display_options.o +COBJS-y += div64.o +COBJS-y += ldiv.o +COBJS-y += sha1.o +COBJS-y += string.o +COBJS-y += vsprintf.o +COBJS-y += zlib.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/lib_m68k/m68k_linux.c b/lib_m68k/m68k_linux.c index bea97441b1..cc974c2d60 100644 --- a/lib_m68k/m68k_linux.c +++ b/lib_m68k/m68k_linux.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,8 @@ DECLARE_GLOBAL_DATA_PTR; #define LINUX_MAX_ENVS 256 #define LINUX_MAX_ARGS 256 +#define CHUNKSZ (64 * 1024) + #ifdef CONFIG_SHOW_BOOT_PROGRESS # include # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) diff --git a/lib_mips/board.c b/lib_mips/board.c index 91ccec04df..c1a0acf469 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -62,6 +62,11 @@ static ulong mem_malloc_start; static ulong mem_malloc_end; static ulong mem_malloc_brk; +/* + * mips_io_port_base is the begin of the address space to which x86 style + * I/O ports are mapped. + */ +unsigned long mips_io_port_base = -1; /* * The Malloc area is immediately below the monitor copy in DRAM diff --git a/libfdt/Makefile b/libfdt/Makefile index dc411370f5..d166cce796 100644 --- a/libfdt/Makefile +++ b/libfdt/Makefile @@ -27,9 +27,9 @@ LIB = $(obj)libfdt.a SOBJS = -COBJS = fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_sw.o fdt_wip.o - +COBJS-$(CONFIG_OF_LIBFDT) += fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_sw.o fdt_wip.o +COBJS := $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/libfdt/fdt.c b/libfdt/fdt.c index 1ee67ad19c..586a36136d 100644 --- a/libfdt/fdt.c +++ b/libfdt/fdt.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -45,9 +74,9 @@ int fdt_check_header(const void *fdt) return 0; } -void *fdt_offset_ptr(const void *fdt, int offset, int len) +const void *fdt_offset_ptr(const void *fdt, int offset, int len) { - void *p; + const void *p; if (fdt_version(fdt) >= 0x11) if (((offset + len) < offset) @@ -61,6 +90,45 @@ void *fdt_offset_ptr(const void *fdt, int offset, int len) return p; } +uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset) +{ + const uint32_t *tagp, *lenp; + uint32_t tag; + const char *p; + + if (offset % FDT_TAGSIZE) + return -1; + + tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE); + if (! tagp) + return FDT_END; /* premature end */ + tag = fdt32_to_cpu(*tagp); + offset += FDT_TAGSIZE; + + switch (tag) { + case FDT_BEGIN_NODE: + /* skip name */ + do { + p = fdt_offset_ptr(fdt, offset++, 1); + } while (p && (*p != '\0')); + if (! p) + return FDT_END; + break; + case FDT_PROP: + lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); + if (! lenp) + return FDT_END; + /* skip name offset, length and value */ + offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp); + break; + } + + if (nextoffset) + *nextoffset = ALIGN(offset, FDT_TAGSIZE); + + return tag; +} + const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) { int len = strlen(s) + 1; @@ -86,5 +154,3 @@ int fdt_move(const void *fdt, void *buf, int bufsize) memmove(buf, fdt, fdt_totalsize(fdt)); return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 46d525db14..12a37d59f9 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -26,14 +55,15 @@ #include "libfdt_internal.h" -#define CHECK_HEADER(fdt) { \ - int err; \ - if ((err = fdt_check_header(fdt)) != 0) \ - return err; \ -} +#define CHECK_HEADER(fdt) \ + { \ + int err; \ + if ((err = fdt_check_header(fdt)) != 0) \ + return err; \ + } -static int offset_streq(const void *fdt, int offset, - const char *s, int len) +static int nodename_eq(const void *fdt, int offset, + const char *s, int len) { const char *p = fdt_offset_ptr(fdt, offset, len+1); @@ -44,169 +74,36 @@ static int offset_streq(const void *fdt, int offset, if (memcmp(p, s, len) != 0) return 0; - if (p[len] != '\0') + if (p[len] == '\0') + return 1; + else if (!memchr(s, '@', len) && (p[len] == '@')) + return 1; + else return 0; - - return 1; } -/* - * Checks if the property name matches. - */ -static int prop_name_eq(const void *fdt, int offset, const char *name, - struct fdt_property **prop, int *lenp) -{ - int namestroff, len; - - *prop = fdt_offset_ptr_typed(fdt, offset, *prop); - if (! *prop) - return -FDT_ERR_BADSTRUCTURE; - - namestroff = fdt32_to_cpu((*prop)->nameoff); - if (streq(fdt_string(fdt, namestroff), name)) { - len = fdt32_to_cpu((*prop)->len); - *prop = fdt_offset_ptr(fdt, offset, - sizeof(**prop) + len); - if (*prop) { - if (lenp) - *lenp = len; - return 1; - } else - return -FDT_ERR_BADSTRUCTURE; - } - return 0; -} - -/* - * Return a pointer to the string at the given string offset. - */ -char *fdt_string(const void *fdt, int stroffset) +const char *fdt_string(const void *fdt, int stroffset) { return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset; } -/* - * Check if the specified node is compatible by comparing the tokens - * in its "compatible" property with the specified string: - * - * nodeoffset - starting place of the node - * compat - the string to match to one of the tokens in the - * "compatible" list. - */ -int fdt_node_is_compatible(const void *fdt, int nodeoffset, - const char *compat) +int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) { - const char* cp; - int cplen, len; - - cp = fdt_getprop(fdt, nodeoffset, "compatible", &cplen); - if (cp == NULL) - return 0; - while (cplen > 0) { - if (strncmp(cp, compat, strlen(compat)) == 0) - return 1; - len = strlen(cp) + 1; - cp += len; - cplen -= len; - } - + CHECK_HEADER(fdt); + *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); + *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); return 0; } -/* - * Find a node by its device type property. On success, the offset of that - * node is returned or an error code otherwise: - * - * nodeoffset - the node to start searching from or 0, the node you pass - * will not be searched, only the next one will; typically, - * you pass 0 to start the search and then what the previous - * call returned. - * type - the device type string to match against. - */ -int fdt_find_node_by_type(const void *fdt, int nodeoffset, const char *type) +int fdt_num_mem_rsv(const void *fdt) { - int offset, nextoffset; - struct fdt_property *prop; - uint32_t tag; - int len, ret; + int i = 0; - CHECK_HEADER(fdt); - - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - if (nodeoffset) - nodeoffset = 0; /* start searching with next node */ - - while (1) { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset, NULL); - - switch (tag) { - case FDT_BEGIN_NODE: - nodeoffset = offset; - break; - - case FDT_PROP: - if (nodeoffset == 0) - break; - ret = prop_name_eq(fdt, offset, "device_type", - &prop, &len); - if (ret < 0) - return ret; - else if (ret > 0 && - strncmp(prop->data, type, len - 1) == 0) - return nodeoffset; - break; - - case FDT_END_NODE: - case FDT_NOP: - break; - - case FDT_END: - return -FDT_ERR_NOTFOUND; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } + while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0) + i++; + return i; } -/* - * Find a node based on its device type and one of the tokens in its its - * "compatible" property. On success, the offset of that node is returned - * or an error code otherwise: - * - * nodeoffset - the node to start searching from or 0, the node you pass - * will not be searched, only the next one will; typically, - * you pass 0 to start the search and then what the previous - * call returned. - * type - the device type string to match against. - * compat - the string to match to one of the tokens in the - * "compatible" list. - */ -int fdt_find_compatible_node(const void *fdt, int nodeoffset, - const char *type, const char *compat) -{ - int offset; - - offset = fdt_find_node_by_type(fdt, nodeoffset, type); - if (offset < 0 || fdt_node_is_compatible(fdt, offset, compat)) - return offset; - - return -FDT_ERR_NOTFOUND; -} - -/* - * Return the node offset of the node specified by: - * parentoffset - starting place (0 to start at the root) - * name - name being searched for - * namelen - length of the name: typically strlen(name) - * - * Notes: - * If the start node has subnodes, the subnodes are _not_ searched for the - * requested name. - */ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen) { @@ -216,13 +113,13 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, CHECK_HEADER(fdt); - tag = fdt_next_tag(fdt, parentoffset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, parentoffset, &nextoffset); if (tag != FDT_BEGIN_NODE) return -FDT_ERR_BADOFFSET; do { offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, offset, &nextoffset); switch (tag) { case FDT_END: @@ -230,15 +127,10 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, case FDT_BEGIN_NODE: level++; - /* - * If we are nested down levels, ignore the strings - * until we get back to the proper level. - */ if (level != 1) continue; - - /* Return the offset if this is "our" string. */ - if (offset_streq(fdt, offset+FDT_TAGSIZE, name, namelen)) + if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen)) + /* Found it! */ return offset; break; @@ -258,20 +150,13 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, return -FDT_ERR_NOTFOUND; } -/* - * See fdt_subnode_offset_namelen() - */ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name) { return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); } -/* - * Searches for the node corresponding to the given path and returns the - * offset of that node. - */ -int fdt_find_node_by_path(const void *fdt, const char *path) +int fdt_path_offset(const void *fdt, const char *path) { const char *end = path + strlen(path); const char *p = path; @@ -279,37 +164,21 @@ int fdt_find_node_by_path(const void *fdt, const char *path) CHECK_HEADER(fdt); - /* Paths must be absolute */ if (*path != '/') return -FDT_ERR_BADPATH; - /* Handle the root path: root offset is 0 */ - if (strcmp(path, "/") == 0) - return 0; - while (*p) { const char *q; - /* Skip path separator(s) */ while (*p == '/') p++; if (! *p) - return -FDT_ERR_BADPATH; - - /* - * Find the next path separator. The characters between - * p and q are the next segment of the the path to find. - */ + return offset; q = strchr(p, '/'); if (! q) q = end; - /* - * Find the offset corresponding to the this path segment. - */ offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p); - - /* Oops, error, abort abort abort */ if (offset < 0) return offset; @@ -319,17 +188,37 @@ int fdt_find_node_by_path(const void *fdt, const char *path) return offset; } -/* - * Given the offset of a node and a name of a property in that node, return - * a pointer to the property struct. - */ -struct fdt_property *fdt_get_property(const void *fdt, - int nodeoffset, - const char *name, int *lenp) +const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) +{ + const struct fdt_node_header *nh; + int err; + + if ((err = fdt_check_header(fdt)) != 0) + goto fail; + + err = -FDT_ERR_BADOFFSET; + nh = fdt_offset_ptr(fdt, nodeoffset, sizeof(*nh)); + if (!nh || (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE)) + goto fail; + + if (len) + *len = strlen(nh->name); + + return nh->name; + + fail: + if (len) + *len = err; + return NULL; +} + +const struct fdt_property *fdt_get_property(const void *fdt, + int nodeoffset, + const char *name, int *lenp) { - int level = 0; uint32_t tag; - struct fdt_property *prop; + const struct fdt_property *prop; + int namestroff; int offset, nextoffset; int err; @@ -340,63 +229,59 @@ struct fdt_property *fdt_get_property(const void *fdt, if (nodeoffset % FDT_TAGSIZE) goto fail; - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); if (tag != FDT_BEGIN_NODE) goto fail; do { offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, offset, &nextoffset); switch (tag) { case FDT_END: err = -FDT_ERR_TRUNCATED; goto fail; case FDT_BEGIN_NODE: - level++; - break; - case FDT_END_NODE: - level--; + case FDT_NOP: break; case FDT_PROP: - /* - * If we are nested down levels, ignore the strings - * until we get back to the proper level. - */ - if (level != 0) - continue; - - err = prop_name_eq(fdt, offset, name, &prop, lenp); - if (err > 0) - return prop; - else if (err < 0) + err = -FDT_ERR_BADSTRUCTURE; + prop = fdt_offset_ptr(fdt, offset, sizeof(*prop)); + if (! prop) goto fail; - break; + namestroff = fdt32_to_cpu(prop->nameoff); + if (streq(fdt_string(fdt, namestroff), name)) { + /* Found it! */ + int len = fdt32_to_cpu(prop->len); + prop = fdt_offset_ptr(fdt, offset, + sizeof(*prop)+len); + if (! prop) + goto fail; - case FDT_NOP: + if (lenp) + *lenp = len; + + return prop; + } break; default: err = -FDT_ERR_BADSTRUCTURE; goto fail; } - } while (level >= 0); + } while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE)); err = -FDT_ERR_NOTFOUND; -fail: + fail: if (lenp) *lenp = err; return NULL; } -/* - * Given the offset of a node and a name of a property in that node, return - * a pointer to the property data (ONLY). - */ -void *fdt_getprop(const void *fdt, int nodeoffset, +const void *fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp) { const struct fdt_property *prop; @@ -405,132 +290,294 @@ void *fdt_getprop(const void *fdt, int nodeoffset, if (! prop) return NULL; - return (void *)prop->data; + return prop->data; } - -uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset, char **namep) +uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) +{ + const uint32_t *php; + int len; + + php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len); + if (!php || (len != sizeof(*php))) + return 0; + + return fdt32_to_cpu(*php); +} + +int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) { - const uint32_t *tagp, *lenp; uint32_t tag; - const char *p; + int p = 0, overflow = 0; + int offset, nextoffset, namelen; + const char *name; - if (offset % FDT_TAGSIZE) - return -1; + CHECK_HEADER(fdt); - tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE); - if (! tagp) - return FDT_END; /* premature end */ - tag = fdt32_to_cpu(*tagp); - offset += FDT_TAGSIZE; + tag = fdt_next_tag(fdt, 0, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADSTRUCTURE; - switch (tag) { - case FDT_BEGIN_NODE: - if(namep) - *namep = fdt_offset_ptr(fdt, offset, 1); - - /* skip name */ - do { - p = fdt_offset_ptr(fdt, offset++, 1); - } while (p && (*p != '\0')); - if (! p) - return FDT_END; - break; - case FDT_PROP: - lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); - if (! lenp) - return FDT_END; - /* - * Get the property and set the namep to the name. - */ - if(namep) { - struct fdt_property *prop; - - prop = fdt_offset_ptr_typed(fdt, offset - FDT_TAGSIZE, prop); - if (! prop) - return -FDT_ERR_BADSTRUCTURE; - *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); - } - /* skip name offset, length and value */ - offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp); - break; - } - - if (nextoffset) - *nextoffset = ALIGN(offset, FDT_TAGSIZE); - - return tag; -} - -/* - * Return the number of used reserve map entries and total slots available. - */ -int fdt_num_reservemap(void *fdt, int *used, int *total) -{ - struct fdt_reserve_entry *re; - int start; - int end; - int err = fdt_check_header(fdt); - - if (err != 0) - return err; - - start = fdt_off_mem_rsvmap(fdt); - - /* - * Convention is that the reserve map is before the dt_struct, - * but it does not have to be. - */ - end = fdt_totalsize(fdt); - if (end > fdt_off_dt_struct(fdt)) - end = fdt_off_dt_struct(fdt); - if (end > fdt_off_dt_strings(fdt)) - end = fdt_off_dt_strings(fdt); - - /* - * Since the reserved area list is zero terminated, you get one fewer. - */ - if (total) - *total = ((end - start) / sizeof(struct fdt_reserve_entry)) - 1; - - if (used) { - *used = 0; - while (start < end) { - re = (struct fdt_reserve_entry *)(fdt + start); - if (re->size == 0) - return 0; /* zero size terminates the list */ - - *used += 1; - start += sizeof(struct fdt_reserve_entry); - } - /* - * If we get here, there was no zero size termination. - */ - return -FDT_ERR_BADLAYOUT; - } - return 0; -} - -/* - * Return the nth reserve map entry. - */ -int fdt_get_reservemap(void *fdt, int n, struct fdt_reserve_entry *re) -{ - int used; - int total; - int err; - - err = fdt_num_reservemap(fdt, &used, &total); - if (err != 0) - return err; - - if (n >= total) + if (buflen < 2) return -FDT_ERR_NOSPACE; - if (re) { - *re = *(struct fdt_reserve_entry *) - _fdt_offset_ptr(fdt, n * sizeof(struct fdt_reserve_entry)); + buf[0] = '/'; + p = 1; + + while (nextoffset <= nodeoffset) { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + switch (tag) { + case FDT_END: + return -FDT_ERR_BADOFFSET; + + case FDT_BEGIN_NODE: + name = fdt_get_name(fdt, offset, &namelen); + if (!name) + return namelen; + if (overflow || ((p + namelen + 1) > buflen)) { + overflow++; + break; + } + memcpy(buf + p, name, namelen); + p += namelen; + buf[p++] = '/'; + break; + + case FDT_END_NODE: + if (overflow) { + overflow--; + break; + } + do { + p--; + } while (buf[p-1] != '/'); + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } + + if (overflow) + return -FDT_ERR_NOSPACE; + + if (p > 1) /* special case so that root path is "/", not "" */ + p--; + buf[p] = '\0'; + return p; +} + +int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, + int supernodedepth, int *nodedepth) +{ + int level = -1; + uint32_t tag; + int offset, nextoffset = 0; + int supernodeoffset = -FDT_ERR_INTERNAL; + + CHECK_HEADER(fdt); + + if (supernodedepth < 0) + return -FDT_ERR_NOTFOUND; + + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + switch (tag) { + case FDT_END: + return -FDT_ERR_BADOFFSET; + + case FDT_BEGIN_NODE: + level++; + if (level == supernodedepth) + supernodeoffset = offset; + break; + + case FDT_END_NODE: + level--; + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (offset < nodeoffset); + + if (nodedepth) + *nodedepth = level; + + if (supernodedepth > level) + return -FDT_ERR_NOTFOUND; + return supernodeoffset; +} + +int fdt_node_depth(const void *fdt, int nodeoffset) +{ + int nodedepth; + int err; + + err = fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, &nodedepth); + if (err) + return (err < 0) ? err : -FDT_ERR_INTERNAL; + return nodedepth; +} + +int fdt_parent_offset(const void *fdt, int nodeoffset) +{ + int nodedepth = fdt_node_depth(fdt, nodeoffset); + + if (nodedepth < 0) + return nodedepth; + return fdt_supernode_atdepth_offset(fdt, nodeoffset, + nodedepth - 1, NULL); +} + +int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, + const char *propname, + const void *propval, int proplen) +{ + uint32_t tag; + int offset, nextoffset; + const void *val; + int len; + + CHECK_HEADER(fdt); + + if (startoffset >= 0) { + tag = fdt_next_tag(fdt, startoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + } else { + nextoffset = 0; + } + + /* FIXME: The algorithm here is pretty horrible: we scan each + * property of a node in fdt_getprop(), then if that didn't + * find what we want, we scan over them again making our way + * to the next node. Still it's the easiest to implement + * approach; performance can come later. */ + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_BEGIN_NODE: + val = fdt_getprop(fdt, offset, propname, &len); + if (val + && (len == proplen) + && (memcmp(val, propval, len) == 0)) + return offset; + break; + + case FDT_PROP: + case FDT_END: + case FDT_END_NODE: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (tag != FDT_END); + + return -FDT_ERR_NOTFOUND; +} + +int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) +{ + if ((phandle == 0) || (phandle == -1)) + return -FDT_ERR_BADPHANDLE; + phandle = cpu_to_fdt32(phandle); + return fdt_node_offset_by_prop_value(fdt, -1, "linux,phandle", + &phandle, sizeof(phandle)); +} + +int _stringlist_contains(const void *strlist, int listlen, const char *str) +{ + int len = strlen(str); + const void *p; + + while (listlen >= len) { + if (memcmp(str, strlist, len+1) == 0) + return 1; + p = memchr(strlist, '\0', listlen); + if (!p) + return 0; /* malformed strlist.. */ + listlen -= (p-strlist) + 1; + strlist = p + 1; } return 0; } -#endif /* CONFIG_OF_LIBFDT */ +int fdt_node_check_compatible(const void *fdt, int nodeoffset, + const char *compatible) +{ + const void *prop; + int len; + + prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); + if (!prop) + return len; + if (_stringlist_contains(prop, len, compatible)) + return 0; + else + return 1; +} + +int fdt_node_offset_by_compatible(const void *fdt, int startoffset, + const char *compatible) +{ + uint32_t tag; + int offset, nextoffset; + int err; + + CHECK_HEADER(fdt); + + if (startoffset >= 0) { + tag = fdt_next_tag(fdt, startoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + } else { + nextoffset = 0; + } + + /* FIXME: The algorithm here is pretty horrible: we scan each + * property of a node in fdt_node_check_compatible(), then if + * that didn't find what we want, we scan over them again + * making our way to the next node. Still it's the easiest to + * implement approach; performance can come later. */ + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_BEGIN_NODE: + err = fdt_node_check_compatible(fdt, offset, + compatible); + if ((err < 0) + && (err != -FDT_ERR_NOTFOUND)) + return err; + else if (err == 0) + return offset; + break; + + case FDT_PROP: + case FDT_END: + case FDT_END_NODE: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (tag != FDT_END); + + return -FDT_ERR_NOTFOUND; +} diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c index 55fcc41d1a..dfe5628a33 100644 --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -26,25 +55,32 @@ #include "libfdt_internal.h" +static int _blocks_misordered(const void *fdt, + int mem_rsv_size, int struct_size) +{ + return (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8)) + || (fdt_off_dt_struct(fdt) < + (fdt_off_mem_rsvmap(fdt) + mem_rsv_size)) + || (fdt_off_dt_strings(fdt) < + (fdt_off_dt_struct(fdt) + struct_size)) + || (fdt_totalsize(fdt) < + (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); +} + static int rw_check_header(void *fdt) { int err; if ((err = fdt_check_header(fdt))) return err; - if (fdt_version(fdt) < 0x11) + if (fdt_version(fdt) < 17) return -FDT_ERR_BADVERSION; - if (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8)) - return -FDT_ERR_BADLAYOUT; - if (fdt_off_dt_struct(fdt) < - (fdt_off_mem_rsvmap(fdt) + sizeof(struct fdt_reserve_entry))) - return -FDT_ERR_BADLAYOUT; - if (fdt_off_dt_strings(fdt) < - (fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt))) - return -FDT_ERR_BADLAYOUT; - if (fdt_totalsize(fdt) < - (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))) + if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry), + fdt_size_dt_struct(fdt))) return -FDT_ERR_BADLAYOUT; + if (fdt_version(fdt) > 17) + fdt_set_version(fdt, 17); + return 0; } @@ -72,6 +108,19 @@ static int _blob_splice(void *fdt, void *p, int oldlen, int newlen) return 0; } +static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, + int oldn, int newn) +{ + int delta = (newn - oldn) * sizeof(*p); + int err; + err = _blob_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); + if (err) + return err; + fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); + fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); + return 0; +} + static int _blob_splice_struct(void *fdt, void *p, int oldlen, int newlen) { @@ -81,8 +130,8 @@ static int _blob_splice_struct(void *fdt, void *p, if ((err = _blob_splice(fdt, p, oldlen, newlen))) return err; - fdt_set_header(fdt, size_dt_struct, fdt_size_dt_struct(fdt) + delta); - fdt_set_header(fdt, off_dt_strings, fdt_off_dt_strings(fdt) + delta); + fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); + fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); return 0; } @@ -94,7 +143,7 @@ static int _blob_splice_string(void *fdt, int newlen) if ((err = _blob_splice(fdt, p, 0, newlen))) return err; - fdt_set_header(fdt, size_dt_strings, fdt_size_dt_strings(fdt) + newlen); + fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); return 0; } @@ -120,13 +169,47 @@ static int _find_add_string(void *fdt, const char *s) return (new - strtab); } +int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) +{ + struct fdt_reserve_entry *re; + int err; + + if ((err = rw_check_header(fdt))) + return err; + + re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt)); + err = _blob_splice_mem_rsv(fdt, re, 0, 1); + if (err) + return err; + + re->address = cpu_to_fdt64(address); + re->size = cpu_to_fdt64(size); + return 0; +} + +int fdt_del_mem_rsv(void *fdt, int n) +{ + struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); + int err; + + if ((err = rw_check_header(fdt))) + return err; + if (n >= fdt_num_mem_rsv(fdt)) + return -FDT_ERR_NOTFOUND; + + err = _blob_splice_mem_rsv(fdt, re, 1, 0); + if (err) + return err; + return 0; +} + static int _resize_property(void *fdt, int nodeoffset, const char *name, int len, struct fdt_property **prop) { int oldlen; int err; - *prop = fdt_get_property(fdt, nodeoffset, name, &oldlen); + *prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); if (! (*prop)) return oldlen; @@ -148,7 +231,7 @@ static int _add_property(void *fdt, int nodeoffset, const char *name, int len, int namestroff; int err; - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); if (tag != FDT_BEGIN_NODE) return -FDT_ERR_BADOFFSET; @@ -156,7 +239,7 @@ static int _add_property(void *fdt, int nodeoffset, const char *name, int len, if (namestroff < 0) return namestroff; - *prop = _fdt_offset_ptr(fdt, nextoffset); + *prop = _fdt_offset_ptr_w(fdt, nextoffset); proplen = sizeof(**prop) + ALIGN(len, FDT_TAGSIZE); err = _blob_splice_struct(fdt, *prop, 0, proplen); @@ -188,32 +271,6 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, return 0; } -/** - * fdt_find_and_setprop: Find a node and set it's property - * - * @fdt: ptr to device tree - * @node: path of node - * @prop: property name - * @val: ptr to new value - * @len: length of new property value - * @create: flag to create the property if it doesn't exist - * - * Convenience function to directly set a property given the path to the node. - */ -int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, - const void *val, int len, int create) -{ - int nodeoff = fdt_find_node_by_path(fdt, node); - - if (nodeoff < 0) - return nodeoff; - - if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL)) - return 0; /* create flag not set; so exit quietly */ - - return fdt_setprop(fdt, nodeoff, prop, val, len); -} - int fdt_delprop(void *fdt, int nodeoffset, const char *name) { struct fdt_property *prop; @@ -221,7 +278,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name) RW_CHECK_HEADER(fdt); - prop = fdt_get_property(fdt, nodeoffset, name, &len); + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); if (! prop) return len; @@ -248,13 +305,13 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, return offset; /* Try to place the new node after the parent's properties */ - fdt_next_tag(fdt, parentoffset, &nextoffset, NULL); /* skip the BEGIN_NODE */ + fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */ do { offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, offset, &nextoffset); } while (tag == FDT_PROP); - nh = _fdt_offset_ptr(fdt, offset); + nh = _fdt_offset_ptr_w(fdt, offset); nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE; err = _blob_splice_struct(fdt, nh, 0, nodelen); @@ -279,46 +336,112 @@ int fdt_del_node(void *fdt, int nodeoffset) { int endoffset; + RW_CHECK_HEADER(fdt); + endoffset = _fdt_node_end_offset(fdt, nodeoffset); if (endoffset < 0) return endoffset; - return _blob_splice_struct(fdt, _fdt_offset_ptr(fdt, nodeoffset), + return _blob_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset), endoffset - nodeoffset, 0); } -int fdt_open_into(void *fdt, void *buf, int bufsize) +static void _packblocks(const void *fdt, void *buf, + int mem_rsv_size, int struct_size) +{ + int mem_rsv_off, struct_off, strings_off; + + mem_rsv_off = ALIGN(sizeof(struct fdt_header), 8); + struct_off = mem_rsv_off + mem_rsv_size; + strings_off = struct_off + struct_size; + + memmove(buf + mem_rsv_off, fdt + fdt_off_mem_rsvmap(fdt), mem_rsv_size); + fdt_set_off_mem_rsvmap(buf, mem_rsv_off); + + memcpy(buf + struct_off, fdt + fdt_off_dt_struct(fdt), struct_size); + fdt_set_off_dt_struct(buf, struct_off); + fdt_set_size_dt_struct(buf, struct_size); + + memcpy(buf + strings_off, fdt + fdt_off_dt_strings(fdt), + fdt_size_dt_strings(fdt)); + fdt_set_off_dt_strings(buf, strings_off); + fdt_set_size_dt_strings(buf, fdt_size_dt_strings(fdt)); +} + +int fdt_open_into(const void *fdt, void *buf, int bufsize) { int err; + int mem_rsv_size, struct_size; + int newsize; + void *tmp; - err = fdt_move(fdt, buf, bufsize); + err = fdt_check_header(fdt); if (err) return err; - fdt = buf; + mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) + * sizeof(struct fdt_reserve_entry); - fdt_set_header(fdt, totalsize, bufsize); + if (fdt_version(fdt) >= 17) { + struct_size = fdt_size_dt_struct(fdt); + } else { + struct_size = 0; + while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) + ; + } - /* FIXME: re-order if necessary */ + if (!_blocks_misordered(fdt, mem_rsv_size, struct_size)) { + /* no further work necessary */ + err = fdt_move(fdt, buf, bufsize); + if (err) + return err; + fdt_set_version(buf, 17); + fdt_set_size_dt_struct(buf, struct_size); + fdt_set_totalsize(buf, bufsize); + return 0; + } - err = rw_check_header(fdt); - if (err) - return err; + /* Need to reorder */ + newsize = ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size + + struct_size + fdt_size_dt_strings(fdt); + + if (bufsize < newsize) + return -FDT_ERR_NOSPACE; + + if (((buf + newsize) <= fdt) + || (buf >= (fdt + fdt_totalsize(fdt)))) { + tmp = buf; + } else { + tmp = (void *)fdt + fdt_totalsize(fdt); + if ((tmp + newsize) > (buf + bufsize)) + return -FDT_ERR_NOSPACE; + } + + _packblocks(fdt, tmp, mem_rsv_size, struct_size); + memmove(buf, tmp, newsize); + + fdt_set_magic(buf, FDT_MAGIC); + fdt_set_totalsize(buf, bufsize); + fdt_set_version(buf, 17); + fdt_set_last_comp_version(buf, 16); + fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt)); return 0; } int fdt_pack(void *fdt) { + int mem_rsv_size; int err; err = rw_check_header(fdt); if (err) return err; - /* FIXME: pack components */ - fdt_set_header(fdt, totalsize, _blob_data_size(fdt)); + mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) + * sizeof(struct fdt_reserve_entry); + _packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); + fdt_set_totalsize(fdt, _blob_data_size(fdt)); + return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c index b49c952f34..f9d32ef536 100644 --- a/libfdt/fdt_strerror.c +++ b/libfdt/fdt_strerror.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -65,5 +94,3 @@ const char *fdt_strerror(int errval) return ""; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_sw.c b/libfdt/fdt_sw.c index c7eea8ff39..dda2de34b2 100644 --- a/libfdt/fdt_sw.c +++ b/libfdt/fdt_sw.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -44,8 +73,8 @@ static void *grab_space(void *fdt, int len) if ((offset + len < offset) || (offset + len > spaceleft)) return NULL; - fdt_set_header(fdt, size_dt_struct, offset + len); - return fdt_offset_ptr(fdt, offset, len); + fdt_set_size_dt_struct(fdt, offset + len); + return fdt_offset_ptr_w(fdt, offset, len); } int fdt_create(void *buf, int bufsize) @@ -57,15 +86,15 @@ int fdt_create(void *buf, int bufsize) memset(buf, 0, bufsize); - fdt_set_header(fdt, magic, SW_MAGIC); - fdt_set_header(fdt, version, FDT_LAST_SUPPORTED_VERSION); - fdt_set_header(fdt, last_comp_version, FDT_FIRST_SUPPORTED_VERSION); - fdt_set_header(fdt, totalsize, bufsize); + fdt_set_magic(fdt, SW_MAGIC); + fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION); + fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION); + fdt_set_totalsize(fdt, bufsize); - fdt_set_header(fdt, off_mem_rsvmap, ALIGN(sizeof(struct fdt_header), - sizeof(struct fdt_reserve_entry))); - fdt_set_header(fdt, off_dt_struct, fdt_off_mem_rsvmap(fdt)); - fdt_set_header(fdt, off_dt_strings, bufsize); + fdt_set_off_mem_rsvmap(fdt, ALIGN(sizeof(struct fdt_header), + sizeof(struct fdt_reserve_entry))); + fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt)); + fdt_set_off_dt_strings(fdt, bufsize); return 0; } @@ -85,11 +114,11 @@ int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) if ((offset + sizeof(*re)) > fdt_totalsize(fdt)) return -FDT_ERR_NOSPACE; - re = (struct fdt_reserve_entry *)((void *)fdt + offset); + re = (struct fdt_reserve_entry *)(fdt + offset); re->address = cpu_to_fdt64(addr); re->size = cpu_to_fdt64(size); - fdt_set_header(fdt, off_dt_struct, offset + sizeof(*re)); + fdt_set_off_dt_struct(fdt, offset + sizeof(*re)); return 0; } @@ -152,7 +181,7 @@ static int find_add_string(void *fdt, const char *s) return 0; /* no more room :( */ memcpy(strtab + offset, s, len); - fdt_set_header(fdt, size_dt_strings, strtabsize + len); + fdt_set_size_dt_strings(fdt, strtabsize + len); return offset; } @@ -202,14 +231,14 @@ int fdt_finish(void *fdt) oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt); newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt)); - fdt_set_header(fdt, off_dt_strings, newstroffset); + fdt_set_off_dt_strings(fdt, newstroffset); /* Walk the structure, correcting string offsets */ offset = 0; - while ((tag = fdt_next_tag(fdt, offset, &nextoffset, NULL)) != FDT_END) { + while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) { if (tag == FDT_PROP) { - struct fdt_property *prop = fdt_offset_ptr(fdt, offset, - sizeof(*prop)); + struct fdt_property *prop = + fdt_offset_ptr_w(fdt, offset, sizeof(*prop)); int nameoff; if (! prop) @@ -223,9 +252,7 @@ int fdt_finish(void *fdt) } /* Finally, adjust the header */ - fdt_set_header(fdt, totalsize, newstroffset + fdt_size_dt_strings(fdt)); - fdt_set_header(fdt, magic, FDT_MAGIC); + fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt)); + fdt_set_magic(fdt, FDT_MAGIC); return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c index 2d39aabe1f..88e24b8318 100644 --- a/libfdt/fdt_wip.c +++ b/libfdt/fdt_wip.c @@ -2,23 +2,52 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -32,7 +61,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, void *propval; int proplen; - propval = fdt_getprop(fdt, nodeoffset, name, &proplen); + propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen); if (! propval) return proplen; @@ -56,7 +85,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name) struct fdt_property *prop; int len; - prop = fdt_get_property(fdt, nodeoffset, name, &len); + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); if (! prop) return len; @@ -71,12 +100,12 @@ int _fdt_node_end_offset(void *fdt, int nodeoffset) uint32_t tag; int offset, nextoffset; - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); if (tag != FDT_BEGIN_NODE) return -FDT_ERR_BADOFFSET; do { offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset, NULL); + tag = fdt_next_tag(fdt, offset, &nextoffset); switch (tag) { case FDT_END: @@ -110,33 +139,6 @@ int fdt_nop_node(void *fdt, int nodeoffset) if (endoffset < 0) return endoffset; - nop_region(fdt_offset_ptr(fdt, nodeoffset, 0), endoffset - nodeoffset); + nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset); return 0; } - -/* - * Replace a reserve map entry in the nth slot. - */ -int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size) -{ - struct fdt_reserve_entry *re; - int used; - int total; - int err; - - err = fdt_num_reservemap(fdt, &used, &total); - if (err != 0) - return err; - - if (n >= total) - return -FDT_ERR_NOSPACE; - re = (struct fdt_reserve_entry *) - (fdt + fdt_off_mem_rsvmap(fdt) + - (n * sizeof(struct fdt_reserve_entry))); - re->address = cpu_to_fdt64(addr); - re->size = cpu_to_fdt64(size); - - return 0; -} - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/libfdt_internal.h b/libfdt/libfdt_internal.h index cc9633c9e1..1e60936beb 100644 --- a/libfdt/libfdt_internal.h +++ b/libfdt/libfdt_internal.h @@ -4,19 +4,51 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. * - * This library 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 - * Lesser General Public License for more details. + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include @@ -26,13 +58,30 @@ #define memeq(p, q, n) (memcmp((p), (q), (n)) == 0) #define streq(p, q) (strcmp((p), (q)) == 0) -int _fdt_check_header(const void *fdt); +uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); int _fdt_node_end_offset(void *fdt, int nodeoffset); -static inline void *_fdt_offset_ptr(const struct fdt_header *fdt, int offset) +static inline const void *_fdt_offset_ptr(const void *fdt, int offset) { - return (void *)fdt + fdt_off_dt_struct(fdt) + offset; + return fdt + fdt_off_dt_struct(fdt) + offset; +} + +static inline void *_fdt_offset_ptr_w(void *fdt, int offset) +{ + return (void *)_fdt_offset_ptr(fdt, offset); +} + +static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) +{ + const struct fdt_reserve_entry *rsv_table = + fdt + fdt_off_mem_rsvmap(fdt); + + return rsv_table + n; +} +static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) +{ + return (void *)_fdt_mem_rsv(fdt, n); } #define SW_MAGIC (~FDT_MAGIC) diff --git a/mips_config.mk b/mips_config.mk index d8aa5fa777..67fb67d291 100644 --- a/mips_config.mk +++ b/mips_config.mk @@ -22,3 +22,28 @@ # PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__ + +# +# From Linux arch/mips/Makefile +# +# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel +# code since it only slows down the whole thing. At some point we might make +# use of global pointer optimizations but their use of $28 conflicts with +# the current pointer optimization. +# +# The DECStation requires an ECOFF kernel for remote booting, other MIPS +# machines may also. Since BFD is incredibly buggy with respect to +# crossformat linking we rely on the elf2ecoff tool for format conversion. +# +# cflags-y += -G 0 -mno-abicalls -fno-pic -pipe +# cflags-y += -msoft-float +# LDFLAGS_vmlinux += -G 0 -static -n -nostdlib +# MODFLAGS += -mlong-calls +# + +# +# Meanwhile, U-Boot rely on PIC. We add proper switches explicitly. +# +PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic -pipe +PLATFORM_CPPFLAGS += -msoft-float +PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib diff --git a/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile index 2a860140d2..6e53bea017 100644 --- a/nand_spl/board/amcc/acadia/Makefile +++ b/nand_spl/board/amcc/acadia/Makefile @@ -100,7 +100,7 @@ $(obj)nand_boot.c: # from drivers/nand directory $(obj)nand_ecc.c: @rm -f $(obj)nand_ecc.c - ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c + ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c ######################################################################### diff --git a/nand_spl/board/amcc/bamboo/Makefile b/nand_spl/board/amcc/bamboo/Makefile index 8b5461dcf4..3a633fb887 100644 --- a/nand_spl/board/amcc/bamboo/Makefile +++ b/nand_spl/board/amcc/bamboo/Makefile @@ -82,7 +82,7 @@ $(obj)nand_boot.c: # from drivers/nand directory $(obj)nand_ecc.c: @rm -f $(obj)nand_ecc.c - ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c + ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c ifneq ($(OBJTREE), $(SRCTREE)) $(obj)sdram.c: diff --git a/nand_spl/board/amcc/sequoia/Makefile b/nand_spl/board/amcc/sequoia/Makefile index ec1be5a768..78bf071f59 100644 --- a/nand_spl/board/amcc/sequoia/Makefile +++ b/nand_spl/board/amcc/sequoia/Makefile @@ -88,7 +88,7 @@ $(obj)nand_boot.c: # from drivers/nand directory $(obj)nand_ecc.c: @rm -f $(obj)nand_ecc.c - ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c + ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c ######################################################################### diff --git a/net/Makefile b/net/Makefile index d18460cab3..0eee330cfe 100644 --- a/net/Makefile +++ b/net/Makefile @@ -27,8 +27,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)libnet.a -COBJS = net.o tftp.o bootp.o rarp.o eth.o nfs.o sntp.o +COBJS-y += net.o +COBJS-y += tftp.o +COBJS-y += bootp.o +COBJS-y += rarp.o +COBJS-y += eth.o +COBJS-y += nfs.o +COBJS-y += sntp.o +COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/net/bootp.c b/net/bootp.c index 749d3e5e0c..89e30d2c70 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -33,7 +33,7 @@ #if defined(CONFIG_CMD_NET) -#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -850,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; bp->bp_secs = htons(get_timer(0) / CFG_HZ); - NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */ - NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr); - NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr); + /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by + * the server yet */ + /* * RFC3046 requires Relay Agents to discard packets with * nonzero and offered giaddr @@ -870,7 +870,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) /* * Copy options from OFFER packet if present */ - NetCopyIP(&OfferedIP, &bp->bp_yiaddr); + + /* Copy offered IP into the parameters request list */ + NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr); extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP); pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen; @@ -977,6 +979,6 @@ void DhcpRequest(void) { BootpRequest(); } -#endif +#endif /* CONFIG_CMD_DHCP */ -#endif +#endif /* CONFIG_CMD_NET */ diff --git a/net/bootp.h b/net/bootp.h index ba9826e914..320cc3bd30 100644 --- a/net/bootp.h +++ b/net/bootp.h @@ -88,7 +88,7 @@ typedef enum { INIT, #define DHCP_NAK 6 #define DHCP_RELEASE 7 -#define SELECT_TIMEOUT 3 /* Seconds to wait for offers */ +#define SELECT_TIMEOUT 3UL /* Seconds to wait for offers */ /**********************************************************************/ diff --git a/net/eth.c b/net/eth.c index e7f1220591..1b56a356c4 100644 --- a/net/eth.c +++ b/net/eth.c @@ -54,6 +54,7 @@ extern int rtl8169_initialize(bd_t*); extern int scc_initialize(bd_t*); extern int skge_initialize(bd_t*); extern int tsi108_eth_initialize(bd_t*); +extern int uli526x_initialize(bd_t *); extern int tsec_initialize(bd_t*, int, char *); extern int npe_initialize(bd_t *); extern int uec_initialize(int); @@ -238,6 +239,9 @@ int eth_initialize(bd_t *bis) #if defined(CONFIG_TSI108_ETH) tsi108_eth_initialize(bis); #endif +#if defined(CONFIG_ULI526X) + uli526x_initialize(bis); +#endif #if defined(CONFIG_RTL8139) rtl8139_initialize(bis); #endif diff --git a/net/net.c b/net/net.c index cde26801b3..c719bc4c0f 100644 --- a/net/net.c +++ b/net/net.c @@ -94,7 +94,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define ARP_TIMEOUT 5 /* Seconds before trying ARP again */ +#define ARP_TIMEOUT 5UL /* Seconds before trying ARP again */ #ifndef CONFIG_NET_RETRY_COUNT # define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -589,7 +589,7 @@ void NetStartAgain (void) return; } #ifndef CONFIG_NET_MULTI - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); #else /* !CONFIG_NET_MULTI*/ eth_halt (); @@ -598,7 +598,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) { - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); } else { NetState = NETLOOP_FAIL; @@ -774,7 +774,7 @@ static void PingStart(void) #if defined(CONFIG_NET_MULTI) printf ("Using %s device\n", eth_get_name()); #endif /* CONFIG_NET_MULTI */ - NetSetTimeout (10 * CFG_HZ, PingTimeout); + NetSetTimeout (10UL * CFG_HZ, PingTimeout); NetSetHandler (PingHandler); PingSend(); diff --git a/net/nfs.c b/net/nfs.c index df2caac48c..aa8d612e58 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -34,7 +34,7 @@ #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS) #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ -#define NFS_TIMEOUT 60 +#define NFS_TIMEOUT 60UL static int fs_mounted = 0; static unsigned long rpc_id = 0; @@ -405,7 +405,6 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len) if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || - rpc_pkt.u.reply.astatus || rpc_pkt.u.reply.astatus) { return -1; } diff --git a/net/rarp.c b/net/rarp.c index 21dfa529c9..ecf38e4ee5 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -31,7 +31,7 @@ #if defined(CONFIG_CMD_NET) -#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else diff --git a/net/tftp.c b/net/tftp.c index 5ee7676466..8b95bcfec4 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -15,7 +15,7 @@ #if defined(CONFIG_CMD_NET) #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ -#define TIMEOUT 5 /* Seconds to timeout for a lost pkt */ +#define TIMEOUT 5UL /* Seconds to timeout for a lost pkt */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ #else diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000000..c33679a9d2 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,9 @@ +/bmp_logo +/crc32.c +/envcrc +/environment.c +/gen_eth_addr +/img2srec +/mkimage +/sha1.c +/ubsha1 diff --git a/tools/scripts/define2mk.sed b/tools/scripts/define2mk.sed new file mode 100644 index 0000000000..6464627ea4 --- /dev/null +++ b/tools/scripts/define2mk.sed @@ -0,0 +1,29 @@ +# +# Sed script to parse CPP macros and generate output usable by make +# +# It is expected that this script is fed the output of 'gpp -dM' +# which preprocesses the common.h header files and outputs the final +# list of CPP macros (and whitespace is sanitized) +# + +# Only process values prefixed with #define CONFIG_ +/^#define CONFIG_[A-Za-z0-9_]\+/ { + # Strip the #define prefix + s/#define *//; + # Change to form CONFIG_*=VALUE + s/ \+/=/; + # Drop trailing spaces + s/ *$//; + # drop quotes around string values + s/="\(.*\)"$/=\1/; + # Concatenate string values + s/" *"//g; + # Wrap non-numeral values with quotes + s/=\(.*\?[^0-9].*\)$/=\"\1\"/; + # Change '1' and empty values to "y" (not perfect, but + # supports conditional compilation in the makefiles + s/=$/=y/; + s/=1$/=y/; + # print the line + p +}