From 080c646dbf474a109c3f85718fb01ce042a38c45 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 20 Nov 2007 20:14:18 +0100 Subject: [PATCH 01/32] drivers/i2c : move i2c drivers to drivers/i2c Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 8 ------ drivers/i2c/Makefile | 49 ++++++++++++++++++++++++++++++++ drivers/{ => i2c}/fsl_i2c.c | 0 drivers/{ => i2c}/omap1510_i2c.c | 0 drivers/{ => i2c}/omap24xx_i2c.c | 0 drivers/{ => i2c}/tsi108_i2c.c | 0 7 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 drivers/i2c/Makefile rename drivers/{ => i2c}/fsl_i2c.c (100%) rename drivers/{ => i2c}/omap1510_i2c.c (100%) rename drivers/{ => i2c}/omap24xx_i2c.c (100%) rename drivers/{ => i2c}/tsi108_i2c.c (100%) diff --git a/Makefile b/Makefile index ac4b430d7..78ae92400 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,7 @@ LIBS += net/libnet.a LIBS += disk/libdisk.a LIBS += rtc/librtc.a LIBS += dtt/libdtt.a +LIBS += drivers/i2c/libi2c.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/nand/libnand.a diff --git a/drivers/Makefile b/drivers/Makefile index 480b3581f..7b524e4a4 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -70,14 +70,6 @@ COBJS-y += smiLynxEM.o COBJS-y += usbtty.o COBJS-y += videomodes.o -# -# I2C Drivers -# -COBJS-y += omap1510_i2c.o -COBJS-y += omap24xx_i2c.o -COBJS-y += tsi108_i2c.o -COBJS-y += fsl_i2c.o - # # Network Drivers # diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile new file mode 100644 index 000000000..29d6c03db --- /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 100% rename from drivers/tsi108_i2c.c rename to drivers/i2c/tsi108_i2c.c From 2f155f6c0a1f5e9a306a3f1f4fbe067db7ced3b1 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Mon, 24 Sep 2007 09:05:31 -0600 Subject: [PATCH 02/32] [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 --- Makefile | 18 +++++++++++++++++- config.mk | 3 +++ tools/scripts/define2mk.sed | 29 +++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tools/scripts/define2mk.sed diff --git a/Makefile b/Makefile index ac4b430d7..407b93870 100644 --- a/Makefile +++ b/Makefile @@ -342,6 +342,21 @@ $(obj)System.map: $(obj)u-boot 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 +376,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 diff --git a/config.mk b/config.mk index 37d61a0c8..79e5a31b7 100644 --- a/config.mk +++ b/config.mk @@ -87,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/tools/scripts/define2mk.sed b/tools/scripts/define2mk.sed new file mode 100644 index 000000000..6464627ea --- /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 +} From 4a43719a7738712811d822ca8125427b27a55cdc Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Mon, 24 Sep 2007 09:05:31 -0600 Subject: [PATCH 03/32] [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 --- common/Makefile | 82 +++++++++++++++++++++----------------- common/cmd_bdinfo.c | 2 - common/cmd_bedbug.c | 3 -- common/cmd_bmp.c | 4 -- common/cmd_console.c | 4 -- common/cmd_date.c | 4 -- common/cmd_dcr.c | 4 -- common/cmd_diag.c | 4 -- common/cmd_display.c | 4 -- common/cmd_doc.c | 5 --- common/cmd_dtt.c | 4 -- common/cmd_elf.c | 4 -- common/cmd_ext2.c | 4 -- common/cmd_fat.c | 7 ---- common/cmd_fdos.c | 4 -- common/cmd_fdt.c | 5 --- common/cmd_flash.c | 4 -- common/cmd_fpga.c | 3 -- common/cmd_i2c.c | 5 --- common/cmd_ide.c | 4 -- common/cmd_immap.c | 5 +-- common/cmd_itest.c | 3 -- common/cmd_jffs2.c | 5 --- common/cmd_log.c | 4 -- common/cmd_mfsl.c | 4 -- common/cmd_mii.c | 4 -- common/cmd_misc.c | 4 -- common/cmd_mmc.c | 5 --- common/cmd_net.c | 4 -- common/cmd_pci.c | 9 ----- common/cmd_portio.c | 4 -- common/cmd_reginfo.c | 5 --- common/cmd_reiser.c | 4 -- common/cmd_scsi.c | 4 -- common/cmd_spi.c | 4 -- common/cmd_universe.c | 4 -- common/cmd_usb.c | 10 ----- include/configs/sbc2410x.h | 1 - include/configs/smdk2410.h | 1 - 39 files changed, 46 insertions(+), 198 deletions(-) diff --git a/common/Makefile b/common/Makefile index 5c2592f52..ace8cc7ed 100644 --- a/common/Makefile +++ b/common/Makefile @@ -33,53 +33,61 @@ COBJS-y += altera.o COBJS-y += bedbug.o COBJS-y += circbuf.o COBJS-y += cmd_autoscript.o -COBJS-y += cmd_bdinfo.o -COBJS-y += cmd_bedbug.o -COBJS-y += cmd_bmp.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-y += cmd_cache.o -COBJS-y += cmd_console.o -COBJS-y += cmd_date.o -COBJS-y += cmd_dcr.o -COBJS-y += cmd_diag.o -COBJS-y += cmd_display.o -COBJS-y += cmd_doc.o -COBJS-y += cmd_dtt.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-y += cmd_elf.o -COBJS-y += cmd_ext2.o -COBJS-y += cmd_fat.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-y += cmd_fdt.o -COBJS-y += cmd_fdos.o -COBJS-y += cmd_flash.o -COBJS-y += cmd_fpga.o -COBJS-y += cmd_i2c.o -COBJS-y += cmd_ide.o -COBJS-y += cmd_immap.o -COBJS-y += cmd_itest.o -COBJS-y += cmd_jffs2.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-y += cmd_log.o +COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o COBJS-y += cmd_mem.o -COBJS-y += cmd_mii.o -COBJS-y += cmd_misc.o -COBJS-y += cmd_mmc.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-y += cmd_net.o +COBJS-$(CONFIG_CMD_NET) += cmd_net.o COBJS-y += cmd_nvedit.o COBJS-y += cmd_onenand.o -COBJS-y += cmd_pci.o +ifdef CONFIG_PCI +COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o +endif COBJS-y += cmd_pcmcia.o -COBJS-y += cmd_portio.o -COBJS-y += cmd_reginfo.o -COBJS-y += cmd_reiser.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-y += cmd_scsi.o -COBJS-y += cmd_spi.o -COBJS-y += cmd_universe.o -COBJS-y += cmd_usb.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 @@ -123,7 +131,7 @@ COBJS-y += xilinx.o COBJS-y += crc16.o COBJS-y += xyzModem.o COBJS-y += cmd_mac.o -COBJS-y += cmd_mfsl.o +COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o COBJS := $(COBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index ef15a006c..d05998366 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 1c3547a1f..94f7e0847 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 241aa8357..907f9a2db 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 5e0f99072..50ddb011c 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 4a4253490..751159847 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 12fa9db08..a053343ab 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 cb99b7700..82d5ad313 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 d19f41281..a29345c6b 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 d6d3aff8c..3d717c039 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 804d467f2..956dc69da 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 63a5593e4..2eb745315 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 8bd2b476e..f56940643 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 54f0f9f9c..9576cdf38 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 f9da98ddc..b3dbd19fa 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 571b8f14d..f18c58385 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 @@ -692,5 +689,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 11c885731..f56443e25 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 cce23ad70..377a692f7 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 a684a580e..10cab4609 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 2202009f5..821dcff9b 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -68,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 * @@ -2081,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 ae9575824..d75826977 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 8e2051714..ce988723c 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 513a226c4..efe9eb7be 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 fba8bd8bf..e593dbedd 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 9d1d87551..5982b76e6 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 3b4dc8ae0..f530a3842 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 @@ -598,5 +596,3 @@ U_BOOT_CMD( ); #endif /* CONFIG_TERSE_MII */ - -#endif diff --git a/common/cmd_misc.c b/common/cmd_misc.c index c0c6b8f05..126b538ce 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 069c6d02a..25c970257 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 0715fbc20..21682c09e 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 8be6da93f..82d97178f 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 bfe33e3a8..a06cac016 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 17e9cd907..bb6aa30d1 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 1ba392990..b7395d795 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 b2d4eb635..1cdec159f 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 @@ -611,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 3118d279b..760442214 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 8bf0b1f1e..ea977828a 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 45e07f175..c6b17c2ab 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/include/configs/sbc2410x.h b/include/configs/sbc2410x.h index b4a063a1d..9b05bd6c8 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 ca404ff45..18a036c2b 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 From ed1353d74b9ce8a7fcd660570b848a184d614b5f Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 21 Nov 2007 08:49:50 -0600 Subject: [PATCH 04/32] [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 --- libfdt/Makefile | 2 +- libfdt/fdt.c | 5 ----- libfdt/fdt_ro.c | 5 ----- libfdt/fdt_rw.c | 5 ----- libfdt/fdt_strerror.c | 5 ----- libfdt/fdt_sw.c | 5 ----- libfdt/fdt_wip.c | 5 ----- 7 files changed, 1 insertion(+), 31 deletions(-) diff --git a/libfdt/Makefile b/libfdt/Makefile index 126fa2c02..d166cce79 100644 --- a/libfdt/Makefile +++ b/libfdt/Makefile @@ -27,7 +27,7 @@ LIB = $(obj)libfdt.a SOBJS = -COBJS-y += 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) diff --git a/libfdt/fdt.c b/libfdt/fdt.c index 1ee67ad19..212b83838 100644 --- a/libfdt/fdt.c +++ b/libfdt/fdt.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -86,5 +83,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 46d525db1..bc1a5f424 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -532,5 +529,3 @@ int fdt_get_reservemap(void *fdt, int n, struct fdt_reserve_entry *re) } return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c index 55fcc41d1..852b6e6a9 100644 --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -320,5 +317,3 @@ int fdt_pack(void *fdt) fdt_set_header(fdt, totalsize, _blob_data_size(fdt)); return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c index b49c952f3..7f231ce46 100644 --- a/libfdt/fdt_strerror.c +++ b/libfdt/fdt_strerror.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -65,5 +62,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 c7eea8ff3..672f4ddd9 100644 --- a/libfdt/fdt_sw.c +++ b/libfdt/fdt_sw.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -227,5 +224,3 @@ int fdt_finish(void *fdt) fdt_set_header(fdt, magic, FDT_MAGIC); return 0; } - -#endif /* CONFIG_OF_LIBFDT */ diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c index 2d39aabe1..2d2ed37c4 100644 --- a/libfdt/fdt_wip.c +++ b/libfdt/fdt_wip.c @@ -16,9 +16,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#if CONFIG_OF_LIBFDT - #include "libfdt_env.h" #include @@ -138,5 +135,3 @@ int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size) return 0; } - -#endif /* CONFIG_OF_LIBFDT */ From a3c2933e02503fe36ade2c1b65af46f2b7a168e7 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 24 Oct 2007 10:21:57 -0500 Subject: [PATCH 06/32] 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 --- common/fdt_support.c | 26 ++++++++++ include/libfdt.h | 6 --- libfdt/fdt_ro.c | 112 ------------------------------------------- libfdt/fdt_rw.c | 26 ---------- 4 files changed, 26 insertions(+), 144 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 175d59eb9..6a5b27aec 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_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_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) { int nodeoffset; diff --git a/include/libfdt.h b/include/libfdt.h index 38c65a989..ba348a9af 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -78,12 +78,6 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, 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); - -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); struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp); diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index bc1a5f424..5816c7a29 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -82,118 +82,6 @@ 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) -{ - 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; - } - - 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 offset, nextoffset; - struct fdt_property *prop; - uint32_t tag; - int len, ret; - - 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; - } - } -} - -/* - * 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) diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c index 852b6e6a9..aaafc5364 100644 --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -185,32 +185,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; From f738b4a75998f42a7408defadc9baac7a31c92db Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 25 Oct 2007 16:15:07 -0500 Subject: [PATCH 07/32] Make no options to fdt print default to '/' Signed-off-by: Kumar Gala --- common/cmd_fdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index f18c58385..b665bd6c6 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -229,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 @@ -241,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 From e93becf80d732b64aef81b23e8b6ece02c40533d Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Sat, 3 Nov 2007 19:46:28 -0500 Subject: [PATCH 08/32] 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 --- common/fdt_support.c | 23 +++++++++++++++++++++++ cpu/mpc5xxx/cpu.c | 40 +++++++++------------------------------- cpu/mpc8260/cpu.c | 30 ++++-------------------------- include/fdt_support.h | 4 ++++ 4 files changed, 40 insertions(+), 57 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 6a5b27aec..5ed874d0d 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -374,4 +374,27 @@ 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); +} + #endif /* CONFIG_OF_LIBFDT */ diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index 7f16b92a6..e4d616822 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/mpc8260/cpu.c b/cpu/mpc8260/cpu.c index c2b753d6b..55e61a188 100644 --- a/cpu/mpc8260/cpu.c +++ b/cpu/mpc8260/cpu.c @@ -50,6 +50,7 @@ #if defined(CONFIG_OF_LIBFDT) #include #include +#include #endif DECLARE_GLOBAL_DATA_PTR; @@ -300,35 +301,12 @@ void watchdog_reset (void) /* ------------------------------------------------------------------------- */ #if defined(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) { char * cpu_path = "/cpus/" OF_CPU; - do_fixup_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); - do_fixup_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1); - do_fixup_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); + 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/include/fdt_support.h b/include/fdt_support.h index 60fa423b3..0314dfdf8 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -29,6 +29,10 @@ #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); #ifdef CONFIG_OF_HAS_UBOOT_ENV int fdt_env(void *fdt); From 8d04f02f6224e6983f4812ea4da704950ec8539c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 24 Oct 2007 11:04:22 -0500 Subject: [PATCH 09/32] Update libfdt from device tree compiler (dtc) Update libfdt to commit 8eaf5e358366017aa2e846c5038d1aa19958314e from the device tree compiler (dtc) project. Signed-off-by: Kumar Gala --- board/cm5200/cm5200.c | 2 +- board/freescale/mpc832xemds/pci.c | 2 +- board/freescale/mpc8349emds/pci.c | 4 +- board/freescale/mpc8349itx/pci.c | 4 +- board/freescale/mpc8360emds/pci.c | 2 +- common/cmd_fdt.c | 22 +- common/fdt_support.c | 35 +- cpu/mpc83xx/cpu.c | 4 +- cpu/mpc83xx/pci.c | 4 +- include/fdt.h | 49 +- include/libfdt.h | 713 +++++++++++++++++++++++++++--- libfdt/fdt.c | 97 +++- libfdt/fdt_ro.c | 658 ++++++++++++++++----------- libfdt/fdt_rw.c | 240 ++++++++-- libfdt/fdt_strerror.c | 54 ++- libfdt/fdt_sw.c | 92 ++-- libfdt/fdt_wip.c | 89 ++-- libfdt/libfdt_internal.h | 77 +++- 18 files changed, 1602 insertions(+), 546 deletions(-) diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c index e2ab5b8e2..4a86d3c55 100644 --- a/board/cm5200/cm5200.c +++ b/board/cm5200/cm5200.c @@ -276,7 +276,7 @@ static void ft_blob_update(void *blob, bd_t *bd) 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"); + nodeoffset = fdt_path_offset (blob, "/memory"); if (nodeoffset >= 0) { ret = fdt_setprop(blob, nodeoffset, "reg", memory_data, sizeof(memory_data)); diff --git a/board/freescale/mpc832xemds/pci.c b/board/freescale/mpc832xemds/pci.c index 6bc35c70f..7818a2e1e 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 ae94a2f38..7bcdccbcc 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 5ca094d4c..a764a6186 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 cf7ef9044..f18e532ef 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/common/cmd_fdt.c b/common/cmd_fdt.c index b665bd6c6..d84c6f09a 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -162,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; } @@ -202,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; } @@ -266,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; } @@ -567,13 +567,14 @@ static int fdt_print(char *pathp, char *prop, int depth) uint32_t tag; /* tag */ int len; /* length of the property */ int level = 0; /* keep track of nesting level */ + const struct fdt_property *prop1; - 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; } @@ -606,9 +607,10 @@ static int fdt_print(char *pathp, char *prop, int depth) 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: + pathp = fdt_offset_ptr(fdt, nodeoffset, 1); if(level <= depth) printf("%s%s {\n", &tabs[MAX_LEVEL - level], pathp); @@ -629,6 +631,8 @@ static int fdt_print(char *pathp, char *prop, int depth) } break; case FDT_PROP: + prop1 = fdt_offset_ptr(fdt, nodeoffset, sizeof(*prop1)); + pathp = fdt_string(fdt, fdt32_to_cpu(prop1->nameoff)); nodep = fdt_getprop (fdt, offstack[level], pathp, &len); if (len < 0) { printf ("libfdt fdt_getprop(): %s\n", diff --git a/common/fdt_support.c b/common/fdt_support.c index 5ed874d0d..d5743b445 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -59,7 +59,7 @@ struct fdt_header *fdt; 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); + int nodeoff = fdt_path_offset(fdt, node); if (nodeoff < 0) return nodeoff; @@ -84,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; @@ -121,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" @@ -208,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) { @@ -330,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) { diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c index e634f0a25..b2c35d300 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 5675afe97..0defb0ec8 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/include/fdt.h b/include/fdt.h index 3dd3aca3b..e00559ad6 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -1,44 +1,25 @@ -/* - * 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 #ifndef __ASSEMBLY__ struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ + uint32_t magic; /* magic word FDT_MAGIC */ + uint32_t totalsize; /* total size of DT block */ + uint32_t off_dt_struct; /* offset to structure */ + uint32_t off_dt_strings; /* offset to strings */ + uint32_t off_mem_rsvmap; /* offset to memory reserve map */ + uint32_t version; /* format version */ + uint32_t last_comp_version; /* last compatible version */ - /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're + /* version 2 fields below */ + uint32_t boot_cpuid_phys; /* Which physical CPU id we're booting on */ /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ + uint32_t size_dt_strings; /* size of the strings block */ /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ + uint32_t size_dt_struct; /* size of the structure block */ }; struct fdt_reserve_entry { @@ -60,12 +41,12 @@ struct fdt_property { #endif /* !__ASSEMBLY */ -#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ +#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ #define FDT_TAGSIZE sizeof(uint32_t) -#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ -#define FDT_END_NODE 0x2 /* End node */ -#define FDT_PROP 0x3 /* Property: name off, +#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ +#define FDT_END_NODE 0x2 /* End node */ +#define FDT_PROP 0x3 /* Property: name off, size, content */ #define FDT_NOP 0x4 /* nop */ #define FDT_END 0x9 diff --git a/include/libfdt.h b/include/libfdt.h index ba348a9af..6b2fb92ea 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1,148 +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); +/** + * 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); -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_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); -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_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); +} + +/** + * 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/libfdt/fdt.c b/libfdt/fdt.c index 212b83838..586a36136 100644 --- a/libfdt/fdt.c +++ b/libfdt/fdt.c @@ -2,19 +2,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 "libfdt_env.h" @@ -42,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) @@ -58,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; diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 5816c7a29..12a37d59f 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -2,19 +2,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 "libfdt_env.h" @@ -23,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); @@ -41,57 +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; } -/* - * 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_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) +{ + 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; +} + +int fdt_num_mem_rsv(const void *fdt) +{ + int i = 0; + + while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0) + i++; + return i; +} + int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen) { @@ -101,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: @@ -115,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; @@ -143,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; @@ -164,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; @@ -204,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; @@ -225,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; @@ -290,130 +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; } + +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 aaafc5364..dfe5628a3 100644 --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -2,19 +2,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 "libfdt_env.h" @@ -23,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; } @@ -69,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) { @@ -78,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; } @@ -91,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; } @@ -117,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; @@ -145,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; @@ -153,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); @@ -192,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; @@ -219,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); @@ -250,44 +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; } diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c index 7f231ce46..f9d32ef53 100644 --- a/libfdt/fdt_strerror.c +++ b/libfdt/fdt_strerror.c @@ -2,19 +2,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 "libfdt_env.h" diff --git a/libfdt/fdt_sw.c b/libfdt/fdt_sw.c index 672f4ddd9..dda2de34b 100644 --- a/libfdt/fdt_sw.c +++ b/libfdt/fdt_sw.c @@ -2,19 +2,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 "libfdt_env.h" @@ -41,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) @@ -54,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; } @@ -82,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; } @@ -149,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; } @@ -199,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) @@ -220,7 +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; } diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c index 2d2ed37c4..88e24b831 100644 --- a/libfdt/fdt_wip.c +++ b/libfdt/fdt_wip.c @@ -2,19 +2,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 "libfdt_env.h" @@ -29,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; @@ -53,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; @@ -68,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: @@ -107,31 +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); - 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); - + nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset); return 0; } diff --git a/libfdt/libfdt_internal.h b/libfdt/libfdt_internal.h index cc9633c9e..1e60936be 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) From dbaf07ce620aab249e3502b20a986234a6af1d3a Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 21 Nov 2007 14:07:46 -0600 Subject: [PATCH 10/32] 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 --- common/cmd_fdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index d84c6f09a..362d39d3a 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -44,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. @@ -555,13 +555,13 @@ 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 */ From ab544633abdd14f4dd5d92e500b73eb59ef57e67 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 21 Nov 2007 11:11:03 -0600 Subject: [PATCH 11/32] 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 --- common/fdt_support.c | 46 +++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 1 + 2 files changed, 47 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index d5743b445..e848386fb 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -386,4 +386,50 @@ void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, do_fixup_by_path(fdt, path, prop, &val, sizeof(val), 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/include/fdt_support.h b/include/fdt_support.h index 0314dfdf8..150dd2b22 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -33,6 +33,7 @@ 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 fdt_fixup_ethernet(void *fdt, bd_t *bd); #ifdef CONFIG_OF_HAS_UBOOT_ENV int fdt_env(void *fdt); From 9eb77cea1fa12d5969eb26a1d1d81da381bd6b1c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 21 Nov 2007 13:30:15 -0600 Subject: [PATCH 12/32] 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 --- common/fdt_support.c | 55 +++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 11 +++++++++ 2 files changed, 66 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index e848386fb..c67bb3d39 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -386,6 +386,61 @@ void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, 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; diff --git a/include/fdt_support.h b/include/fdt_support.h index 150dd2b22..8f781d440 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -33,6 +33,17 @@ 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 From 9162352817579840d7802da6d85872b3ca003c97 Mon Sep 17 00:00:00 2001 From: Gerald Van Baren Date: Thu, 22 Nov 2007 17:23:23 -0500 Subject: [PATCH 13/32] Fix fdt printing for updated libfdt Also improve printing (adopt dtc v1 "c style" hex format), whitespace cleanup. Signed-off-by: Gerald Van Baren --- common/cmd_fdt.c | 50 ++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 362d39d3a..629c9b413 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -75,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", @@ -522,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 */ @@ -557,7 +557,6 @@ static void print_data(const void *data, int len) */ 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"; @@ -567,7 +566,7 @@ static int fdt_print(const char *pathp, char *prop, int depth) uint32_t tag; /* tag */ int len; /* length of the property */ int level = 0; /* keep track of nesting level */ - const struct fdt_property *prop1; + const struct fdt_property *fdt_prop; nodeoffset = fdt_path_offset (fdt, pathp); if (nodeoffset < 0) { @@ -604,48 +603,52 @@ static int fdt_print(const 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); switch(tag) { case FDT_BEGIN_NODE: - pathp = fdt_offset_ptr(fdt, nodeoffset, 1); - 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: - prop1 = fdt_offset_ptr(fdt, nodeoffset, sizeof(*prop1)); - pathp = fdt_string(fdt, fdt32_to_cpu(prop1->nameoff)); - 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); @@ -655,11 +658,12 @@ static int fdt_print(const 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; } From 93a686ee9c5ddc6fa368c32cfbfde6f6724599fc Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 20 Nov 2007 20:28:09 +0100 Subject: [PATCH 14/32] drivers/pci : move pci drivers to drivers/pci Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 6 ---- drivers/pci/Makefile | 51 ++++++++++++++++++++++++++++++++ drivers/{ => pci}/fsl_pci_init.c | 0 drivers/{ => pci}/pci.c | 0 drivers/{ => pci}/pci_auto.c | 0 drivers/{ => pci}/pci_indirect.c | 0 drivers/{ => pci}/tsi108_pci.c | 0 drivers/{ => pci}/w83c553f.c | 0 9 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 drivers/pci/Makefile rename drivers/{ => pci}/fsl_pci_init.c (100%) rename drivers/{ => pci}/pci.c (100%) rename drivers/{ => pci}/pci_auto.c (100%) rename drivers/{ => pci}/pci_indirect.c (100%) rename drivers/{ => pci}/tsi108_pci.c (100%) rename drivers/{ => pci}/w83c553f.c (100%) diff --git a/Makefile b/Makefile index 78ae92400..43f8bf697 100644 --- a/Makefile +++ b/Makefile @@ -208,6 +208,7 @@ LIBS += disk/libdisk.a LIBS += rtc/librtc.a LIBS += dtt/libdtt.a LIBS += drivers/i2c/libi2c.a +LIBS += drivers/pci/libpci.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/nand/libnand.a diff --git a/drivers/Makefile b/drivers/Makefile index 7b524e4a4..f775371c0 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -105,17 +105,11 @@ COBJS-y += uli526x.o # # PCI/PCMCIA device drivers # -COBJS-y += fsl_pci_init.o COBJS-y += mpc8xx_pcmcia.o -COBJS-y += pci.o -COBJS-y += pci_auto.o -COBJS-y += pci_indirect.o COBJS-y += pxa_pcmcia.o COBJS-y += rpx_pcmcia.o COBJS-y += ti_pci1410a.o COBJS-y += tqm8xx_pcmcia.o -COBJS-y += tsi108_pci.o -COBJS-y += w83c553f.o # # USB Drivers diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile new file mode 100644 index 000000000..fe4583946 --- /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 100% rename from drivers/tsi108_pci.c rename to drivers/pci/tsi108_pci.c 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 From 73646217186aa17afc8e305c5f06f06dd335eaad Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 20 Nov 2007 20:33:09 +0100 Subject: [PATCH 15/32] drivers/pcmcia : move pcmcia drivers to drivers/pcmcia Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 9 ----- drivers/pcmcia/Makefile | 50 ++++++++++++++++++++++++++++ drivers/{ => pcmcia}/i82365.c | 0 drivers/{ => pcmcia}/mpc8xx_pcmcia.c | 0 drivers/{ => pcmcia}/pxa_pcmcia.c | 0 drivers/{ => pcmcia}/rpx_pcmcia.c | 0 drivers/{ => pcmcia}/ti_pci1410a.c | 0 drivers/{ => pcmcia}/tqm8xx_pcmcia.c | 0 9 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 drivers/pcmcia/Makefile rename drivers/{ => pcmcia}/i82365.c (100%) rename drivers/{ => pcmcia}/mpc8xx_pcmcia.c (100%) rename drivers/{ => pcmcia}/pxa_pcmcia.c (100%) rename drivers/{ => pcmcia}/rpx_pcmcia.c (100%) rename drivers/{ => pcmcia}/ti_pci1410a.c (100%) rename drivers/{ => pcmcia}/tqm8xx_pcmcia.c (100%) diff --git a/Makefile b/Makefile index 43f8bf697..22eea65d0 100644 --- a/Makefile +++ b/Makefile @@ -209,6 +209,7 @@ LIBS += rtc/librtc.a LIBS += dtt/libdtt.a LIBS += drivers/i2c/libi2c.a LIBS += drivers/pci/libpci.a +LIBS += drivers/pcmcia/libpcmcia.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/nand/libnand.a diff --git a/drivers/Makefile b/drivers/Makefile index f775371c0..5e3130413 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -102,15 +102,6 @@ COBJS-y += tsec.o COBJS-y += tsi108_eth.o COBJS-y += uli526x.o -# -# PCI/PCMCIA device drivers -# -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 - # # USB Drivers # diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile new file mode 100644 index 000000000..55528c889 --- /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 From 352d259130b349fe9593b8dada641bd78a9659e5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 20 Nov 2007 20:41:48 +0100 Subject: [PATCH 16/32] drivers/video : move video drivers to drivers/video Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 8 ----- drivers/video/Makefile | 53 +++++++++++++++++++++++++++++ drivers/{ => video}/ati_ids.h | 0 drivers/{ => video}/ati_radeon_fb.c | 2 +- drivers/{ => video}/ati_radeon_fb.h | 0 drivers/{ => video}/cfb_console.c | 0 drivers/{ => video}/ct69000.c | 0 drivers/{ => video}/sed13806.c | 0 drivers/{ => video}/sed156x.c | 0 drivers/{ => video}/sm501.c | 0 drivers/{ => video}/smiLynxEM.c | 0 drivers/{ => video}/videomodes.c | 0 drivers/{ => video}/videomodes.h | 0 14 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 drivers/video/Makefile rename drivers/{ => video}/ati_ids.h (100%) rename drivers/{ => video}/ati_radeon_fb.c (99%) rename drivers/{ => video}/ati_radeon_fb.h (100%) rename drivers/{ => video}/cfb_console.c (100%) rename drivers/{ => video}/ct69000.c (100%) rename drivers/{ => video}/sed13806.c (100%) rename drivers/{ => video}/sed156x.c (100%) rename drivers/{ => video}/sm501.c (100%) rename drivers/{ => video}/smiLynxEM.c (100%) rename drivers/{ => video}/videomodes.c (100%) rename drivers/{ => video}/videomodes.h (100%) diff --git a/Makefile b/Makefile index 22eea65d0..8272965ab 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,7 @@ LIBS += dtt/libdtt.a LIBS += drivers/i2c/libi2c.a LIBS += drivers/pci/libpci.a LIBS += drivers/pcmcia/libpcmcia.a +LIBS += drivers/video/libvideo.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/nand/libnand.a diff --git a/drivers/Makefile b/drivers/Makefile index 5e3130413..c7fc59722 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -48,10 +48,7 @@ COBJS-y += systemace.o # # Console Drivers # -COBJS-y += ati_radeon_fb.o COBJS-y += atmel_usart.o -COBJS-y += cfb_console.o -COBJS-y += ct69000.o COBJS-y += i8042.o COBJS-y += keyboard.o COBJS-y += netconsole.o @@ -60,15 +57,10 @@ COBJS-y += pc_keyb.o COBJS-y += ps2ser.o COBJS-y += ps2mult.o COBJS-y += s3c4510b_uart.o -COBJS-y += sed13806.o -COBJS-y += sed156x.o COBJS-y += serial.o COBJS-y += serial_max3100.o COBJS-y += serial_xuartlite.o -COBJS-y += sm501.o -COBJS-y += smiLynxEM.o COBJS-y += usbtty.o -COBJS-y += videomodes.o # # Network Drivers diff --git a/drivers/video/Makefile b/drivers/video/Makefile new file mode 100644 index 000000000..36611ecdd --- /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 99% rename from drivers/ati_radeon_fb.c rename to drivers/video/ati_radeon_fb.c index 9613d80cc..0bdaa1c04 100644 --- a/drivers/ati_radeon_fb.c +++ b/drivers/video/ati_radeon_fb.c @@ -350,7 +350,7 @@ void radeon_setmode(void) radeon_write_pll_regs(rinfo, mode); } -#include "bios_emulator/include/biosemu.h" +#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) 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 From 2439e4bfa111babf4bc07ba20efbf3e36036813e Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 21 Nov 2007 21:19:24 +0100 Subject: [PATCH 17/32] drivers/net : move net drivers to drivers/net Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 14 +++++----- board/cds/mpc8541cds/u-boot.lds | 2 +- board/cds/mpc8548cds/u-boot.lds | 2 +- board/cds/mpc8555cds/u-boot.lds | 2 +- board/mpl/vcma9/cmd_vcma9.c | 2 +- board/netstar/eeprom.c | 2 +- board/voiceblue/eeprom.c | 2 +- drivers/Makefile | 33 ----------------------- drivers/{ => net}/3c589.c | 0 drivers/{ => net}/3c589.h | 0 drivers/{ => net}/5701rls.c | 0 drivers/{ => net}/5701rls.h | 0 drivers/{ => net}/8390.h | 0 drivers/net/Makefile | 33 ++++++++++++++++++++++- drivers/{ => net}/bcm570x.c | 0 drivers/{ => net}/bcm570x_autoneg.c | 0 drivers/{ => net}/bcm570x_autoneg.h | 0 drivers/{ => net}/bcm570x_bits.h | 0 drivers/{ => net}/bcm570x_debug.h | 0 drivers/{ => net}/bcm570x_lm.h | 0 drivers/{ => net}/bcm570x_mm.h | 0 drivers/{ => net}/bcm570x_queue.h | 0 drivers/{ => net}/cs8900.c | 0 drivers/{ => net}/cs8900.h | 0 drivers/{ => net}/dc2114x.c | 0 drivers/{ => net}/dm9000x.c | 0 drivers/{ => net}/dm9000x.h | 0 drivers/{ => net}/e1000.c | 0 drivers/{ => net}/e1000.h | 0 drivers/{ => net}/eepro100.c | 0 drivers/{ => net}/enc28j60.c | 0 drivers/{ => net}/inca-ip_sw.c | 0 drivers/{ => net}/ks8695eth.c | 0 drivers/{ => net}/lan91c96.c | 0 drivers/{ => net}/lan91c96.h | 0 drivers/{ => net}/macb.c | 0 drivers/{ => net}/macb.h | 0 drivers/{ => net}/natsemi.c | 0 drivers/{ => net}/ne2000.c | 0 drivers/{ => net}/ne2000.h | 0 drivers/{ => net}/netarm_eth.c | 0 drivers/{ => net}/netarm_eth.h | 0 drivers/{ => net}/netconsole.c | 0 drivers/{ => net}/nicext.h | 0 drivers/{ => net}/ns7520_eth.c | 0 drivers/{ => net}/ns8382x.c | 0 drivers/{ => net}/ns9750_eth.c | 0 drivers/{ => net}/pcnet.c | 0 drivers/{ => net}/plb2800_eth.c | 0 drivers/{ => net}/rtl8019.c | 0 drivers/{ => net}/rtl8019.h | 0 drivers/{ => net}/rtl8139.c | 0 drivers/{ => net}/rtl8169.c | 0 drivers/{ => net}/s3c4510b_eth.c | 0 drivers/{ => net}/s3c4510b_eth.h | 0 drivers/{ => net}/sk98lin/Makefile | 0 drivers/{ => net}/sk98lin/h/lm80.h | 0 drivers/{ => net}/sk98lin/h/skaddr.h | 0 drivers/{ => net}/sk98lin/h/skcsum.h | 0 drivers/{ => net}/sk98lin/h/skdebug.h | 0 drivers/{ => net}/sk98lin/h/skdrv1st.h | 0 drivers/{ => net}/sk98lin/h/skdrv2nd.h | 0 drivers/{ => net}/sk98lin/h/skerror.h | 0 drivers/{ => net}/sk98lin/h/skgedrv.h | 0 drivers/{ => net}/sk98lin/h/skgehw.h | 0 drivers/{ => net}/sk98lin/h/skgehwt.h | 0 drivers/{ => net}/sk98lin/h/skgei2c.h | 0 drivers/{ => net}/sk98lin/h/skgeinit.h | 0 drivers/{ => net}/sk98lin/h/skgepnm2.h | 0 drivers/{ => net}/sk98lin/h/skgepnmi.h | 0 drivers/{ => net}/sk98lin/h/skgesirq.h | 0 drivers/{ => net}/sk98lin/h/ski2c.h | 0 drivers/{ => net}/sk98lin/h/skqueue.h | 0 drivers/{ => net}/sk98lin/h/skrlmt.h | 0 drivers/{ => net}/sk98lin/h/sktimer.h | 0 drivers/{ => net}/sk98lin/h/sktypes.h | 0 drivers/{ => net}/sk98lin/h/skversion.h | 0 drivers/{ => net}/sk98lin/h/skvpd.h | 0 drivers/{ => net}/sk98lin/h/xmac_ii.h | 0 drivers/{ => net}/sk98lin/skaddr.c | 0 drivers/{ => net}/sk98lin/skcsum.c | 0 drivers/{ => net}/sk98lin/skge.c | 0 drivers/{ => net}/sk98lin/skgehwt.c | 0 drivers/{ => net}/sk98lin/skgeinit.c | 0 drivers/{ => net}/sk98lin/skgemib.c | 0 drivers/{ => net}/sk98lin/skgepnmi.c | 0 drivers/{ => net}/sk98lin/skgesirq.c | 0 drivers/{ => net}/sk98lin/ski2c.c | 0 drivers/{ => net}/sk98lin/sklm80.c | 0 drivers/{ => net}/sk98lin/skproc.c | 0 drivers/{ => net}/sk98lin/skqueue.c | 0 drivers/{ => net}/sk98lin/skrlmt.c | 0 drivers/{ => net}/sk98lin/sktimer.c | 0 drivers/{ => net}/sk98lin/skvpd.c | 0 drivers/{ => net}/sk98lin/skxmac2.c | 0 drivers/{ => net}/sk98lin/u-boot_compat.h | 0 drivers/{ => net}/sk98lin/uboot_drv.c | 0 drivers/{ => net}/sk98lin/uboot_skb.c | 0 drivers/{ => net}/smc91111.c | 0 drivers/{ => net}/smc91111.h | 0 drivers/{ => net}/tigon3.c | 0 drivers/{ => net}/tigon3.h | 0 drivers/{ => net}/tsec.c | 0 drivers/{ => net}/tsec.h | 0 drivers/{ => net}/tsi108_eth.c | 0 drivers/{ => net}/uli526x.c | 0 examples/smc91111_eeprom.c | 2 +- lib_arm/board.c | 4 +-- lib_blackfin/board.c | 2 +- 109 files changed, 49 insertions(+), 51 deletions(-) rename drivers/{ => net}/3c589.c (100%) rename drivers/{ => net}/3c589.h (100%) rename drivers/{ => net}/5701rls.c (100%) rename drivers/{ => net}/5701rls.h (100%) rename drivers/{ => net}/8390.h (100%) rename drivers/{ => net}/bcm570x.c (100%) rename drivers/{ => net}/bcm570x_autoneg.c (100%) rename drivers/{ => net}/bcm570x_autoneg.h (100%) rename drivers/{ => net}/bcm570x_bits.h (100%) rename drivers/{ => net}/bcm570x_debug.h (100%) rename drivers/{ => net}/bcm570x_lm.h (100%) rename drivers/{ => net}/bcm570x_mm.h (100%) rename drivers/{ => net}/bcm570x_queue.h (100%) rename drivers/{ => net}/cs8900.c (100%) rename drivers/{ => net}/cs8900.h (100%) rename drivers/{ => net}/dc2114x.c (100%) rename drivers/{ => net}/dm9000x.c (100%) rename drivers/{ => net}/dm9000x.h (100%) rename drivers/{ => net}/e1000.c (100%) rename drivers/{ => net}/e1000.h (100%) rename drivers/{ => net}/eepro100.c (100%) rename drivers/{ => net}/enc28j60.c (100%) rename drivers/{ => net}/inca-ip_sw.c (100%) rename drivers/{ => net}/ks8695eth.c (100%) rename drivers/{ => net}/lan91c96.c (100%) rename drivers/{ => net}/lan91c96.h (100%) rename drivers/{ => net}/macb.c (100%) rename drivers/{ => net}/macb.h (100%) rename drivers/{ => net}/natsemi.c (100%) rename drivers/{ => net}/ne2000.c (100%) rename drivers/{ => net}/ne2000.h (100%) rename drivers/{ => net}/netarm_eth.c (100%) rename drivers/{ => net}/netarm_eth.h (100%) rename drivers/{ => net}/netconsole.c (100%) rename drivers/{ => net}/nicext.h (100%) rename drivers/{ => net}/ns7520_eth.c (100%) rename drivers/{ => net}/ns8382x.c (100%) rename drivers/{ => net}/ns9750_eth.c (100%) rename drivers/{ => net}/pcnet.c (100%) rename drivers/{ => net}/plb2800_eth.c (100%) rename drivers/{ => net}/rtl8019.c (100%) rename drivers/{ => net}/rtl8019.h (100%) rename drivers/{ => net}/rtl8139.c (100%) rename drivers/{ => net}/rtl8169.c (100%) rename drivers/{ => net}/s3c4510b_eth.c (100%) rename drivers/{ => net}/s3c4510b_eth.h (100%) rename drivers/{ => net}/sk98lin/Makefile (100%) rename drivers/{ => net}/sk98lin/h/lm80.h (100%) rename drivers/{ => net}/sk98lin/h/skaddr.h (100%) rename drivers/{ => net}/sk98lin/h/skcsum.h (100%) rename drivers/{ => net}/sk98lin/h/skdebug.h (100%) rename drivers/{ => net}/sk98lin/h/skdrv1st.h (100%) rename drivers/{ => net}/sk98lin/h/skdrv2nd.h (100%) rename drivers/{ => net}/sk98lin/h/skerror.h (100%) rename drivers/{ => net}/sk98lin/h/skgedrv.h (100%) rename drivers/{ => net}/sk98lin/h/skgehw.h (100%) rename drivers/{ => net}/sk98lin/h/skgehwt.h (100%) rename drivers/{ => net}/sk98lin/h/skgei2c.h (100%) rename drivers/{ => net}/sk98lin/h/skgeinit.h (100%) rename drivers/{ => net}/sk98lin/h/skgepnm2.h (100%) rename drivers/{ => net}/sk98lin/h/skgepnmi.h (100%) rename drivers/{ => net}/sk98lin/h/skgesirq.h (100%) rename drivers/{ => net}/sk98lin/h/ski2c.h (100%) rename drivers/{ => net}/sk98lin/h/skqueue.h (100%) rename drivers/{ => net}/sk98lin/h/skrlmt.h (100%) rename drivers/{ => net}/sk98lin/h/sktimer.h (100%) rename drivers/{ => net}/sk98lin/h/sktypes.h (100%) rename drivers/{ => net}/sk98lin/h/skversion.h (100%) rename drivers/{ => net}/sk98lin/h/skvpd.h (100%) rename drivers/{ => net}/sk98lin/h/xmac_ii.h (100%) rename drivers/{ => net}/sk98lin/skaddr.c (100%) rename drivers/{ => net}/sk98lin/skcsum.c (100%) rename drivers/{ => net}/sk98lin/skge.c (100%) rename drivers/{ => net}/sk98lin/skgehwt.c (100%) rename drivers/{ => net}/sk98lin/skgeinit.c (100%) rename drivers/{ => net}/sk98lin/skgemib.c (100%) rename drivers/{ => net}/sk98lin/skgepnmi.c (100%) rename drivers/{ => net}/sk98lin/skgesirq.c (100%) rename drivers/{ => net}/sk98lin/ski2c.c (100%) rename drivers/{ => net}/sk98lin/sklm80.c (100%) rename drivers/{ => net}/sk98lin/skproc.c (100%) rename drivers/{ => net}/sk98lin/skqueue.c (100%) rename drivers/{ => net}/sk98lin/skrlmt.c (100%) rename drivers/{ => net}/sk98lin/sktimer.c (100%) rename drivers/{ => net}/sk98lin/skvpd.c (100%) rename drivers/{ => net}/sk98lin/skxmac2.c (100%) rename drivers/{ => net}/sk98lin/u-boot_compat.h (100%) rename drivers/{ => net}/sk98lin/uboot_drv.c (100%) rename drivers/{ => net}/sk98lin/uboot_skb.c (100%) rename drivers/{ => net}/smc91111.c (100%) rename drivers/{ => net}/smc91111.h (100%) rename drivers/{ => net}/tigon3.c (100%) rename drivers/{ => net}/tigon3.h (100%) rename drivers/{ => net}/tsec.c (100%) rename drivers/{ => net}/tsec.h (100%) rename drivers/{ => net}/tsi108_eth.c (100%) rename drivers/{ => net}/uli526x.c (100%) diff --git a/Makefile b/Makefile index 8272965ab..e68454a7b 100644 --- a/Makefile +++ b/Makefile @@ -207,16 +207,17 @@ 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/i2c/libi2c.a +LIBS += drivers/nand/libnand.a +LIBS += drivers/nand_legacy/libnand_legacy.a +LIBS += drivers/net/libnet.a +LIBS += drivers/net/sk98lin/libsk98lin.a +LIBS += drivers/onenand/libonenand.a LIBS += drivers/pci/libpci.a LIBS += drivers/pcmcia/libpcmcia.a LIBS += drivers/video/libvideo.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/net/libnet.a ifeq ($(CPU),mpc83xx) LIBS += drivers/qe/qe.a endif @@ -224,7 +225,6 @@ ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a endif LIBS += drivers/serial/libserial.a -LIBS += drivers/sk98lin/libsk98lin.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) diff --git a/board/cds/mpc8541cds/u-boot.lds b/board/cds/mpc8541cds/u-boot.lds index dc87a122a..7a5daefeb 100644 --- a/board/cds/mpc8541cds/u-boot.lds +++ b/board/cds/mpc8541cds/u-boot.lds @@ -69,7 +69,7 @@ SECTIONS cpu/mpc85xx/interrupts.o (.text) cpu/mpc85xx/cpu_init.o (.text) cpu/mpc85xx/cpu.o (.text) - drivers/tsec.o (.text) + drivers/net/tsec.o (.text) cpu/mpc85xx/speed.o (.text) cpu/mpc85xx/pci.o (.text) common/dlmalloc.o (.text) diff --git a/board/cds/mpc8548cds/u-boot.lds b/board/cds/mpc8548cds/u-boot.lds index 530ba5a72..b19c481a9 100644 --- a/board/cds/mpc8548cds/u-boot.lds +++ b/board/cds/mpc8548cds/u-boot.lds @@ -69,7 +69,7 @@ SECTIONS cpu/mpc85xx/interrupts.o (.text) cpu/mpc85xx/cpu_init.o (.text) cpu/mpc85xx/cpu.o (.text) - drivers/tsec.o (.text) + drivers/net/tsec.o (.text) cpu/mpc85xx/speed.o (.text) common/dlmalloc.o (.text) lib_generic/crc32.o (.text) diff --git a/board/cds/mpc8555cds/u-boot.lds b/board/cds/mpc8555cds/u-boot.lds index 9285928dc..de0923a0d 100644 --- a/board/cds/mpc8555cds/u-boot.lds +++ b/board/cds/mpc8555cds/u-boot.lds @@ -69,7 +69,7 @@ SECTIONS cpu/mpc85xx/interrupts.o (.text) cpu/mpc85xx/cpu_init.o (.text) cpu/mpc85xx/cpu.o (.text) - drivers/tsec.o (.text) + drivers/net/tsec.o (.text) cpu/mpc85xx/speed.o (.text) cpu/mpc85xx/pci.o (.text) common/dlmalloc.o (.text) diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c index 227c49272..90a1b08e2 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/netstar/eeprom.c b/board/netstar/eeprom.c index fef3822aa..0de594b65 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/voiceblue/eeprom.c b/board/voiceblue/eeprom.c index 0ad1b666b..d8ea6e573 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/drivers/Makefile b/drivers/Makefile index c7fc59722..4b6f5f017 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -51,7 +51,6 @@ COBJS-y += systemace.o COBJS-y += atmel_usart.o COBJS-y += i8042.o COBJS-y += keyboard.o -COBJS-y += netconsole.o COBJS-y += ns16550.o COBJS-y += pc_keyb.o COBJS-y += ps2ser.o @@ -62,38 +61,6 @@ COBJS-y += serial_max3100.o COBJS-y += serial_xuartlite.o COBJS-y += usbtty.o -# -# Network Drivers -# -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 += natsemi.o -COBJS-y += ne2000.o -COBJS-y += netarm_eth.o -COBJS-y += ns7520_eth.o -COBJS-y += ns8382x.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 - # # USB Drivers # 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 37d69b994..41e1bdeb3 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 100% rename from drivers/ne2000.c rename to drivers/net/ne2000.c 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 100% rename from drivers/s3c4510b_eth.c rename to drivers/net/s3c4510b_eth.c 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 100% rename from drivers/sk98lin/Makefile rename to drivers/net/sk98lin/Makefile 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 100% rename from drivers/tsec.c rename to drivers/net/tsec.c 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/uli526x.c b/drivers/net/uli526x.c similarity index 100% rename from drivers/uli526x.c rename to drivers/net/uli526x.c diff --git a/examples/smc91111_eeprom.c b/examples/smc91111_eeprom.c index 98e3e86ff..b8a3594e9 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/lib_arm/board.c b/lib_arm/board.c index 7e97f1347..6f35aa06b 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 7c9990f8e..86a3b67c9 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 From 1378df792a7ff3abd1bf54a63f5475784f5b083c Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 19:33:38 +0100 Subject: [PATCH 18/32] drivers/serial : move serial drivers to drivers/serial Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- drivers/Makefile | 7 ------- drivers/serial/Makefile | 13 ++++++++++++- drivers/{ => serial}/atmel_usart.c | 0 drivers/{ => serial}/atmel_usart.h | 0 drivers/{ => serial}/ns16550.c | 0 drivers/{ => serial}/ns9750_serial.c | 0 drivers/{ => serial}/s3c4510b_uart.c | 0 drivers/{ => serial}/s3c4510b_uart.h | 0 drivers/{ => serial}/serial.c | 0 drivers/{ => serial}/serial_max3100.c | 0 drivers/{ => serial}/serial_xuartlite.c | 0 drivers/{ => serial}/usbtty.c | 0 drivers/{ => serial}/usbtty.h | 0 13 files changed, 12 insertions(+), 8 deletions(-) rename drivers/{ => serial}/atmel_usart.c (100%) rename drivers/{ => serial}/atmel_usart.h (100%) rename drivers/{ => serial}/ns16550.c (100%) rename drivers/{ => serial}/ns9750_serial.c (100%) rename drivers/{ => serial}/s3c4510b_uart.c (100%) rename drivers/{ => serial}/s3c4510b_uart.h (100%) rename drivers/{ => serial}/serial.c (100%) rename drivers/{ => serial}/serial_max3100.c (100%) rename drivers/{ => serial}/serial_xuartlite.c (100%) rename drivers/{ => serial}/usbtty.c (100%) rename drivers/{ => serial}/usbtty.h (100%) diff --git a/drivers/Makefile b/drivers/Makefile index 4b6f5f017..cf8b584c7 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -48,18 +48,11 @@ COBJS-y += systemace.o # # Console Drivers # -COBJS-y += atmel_usart.o COBJS-y += i8042.o COBJS-y += keyboard.o -COBJS-y += ns16550.o COBJS-y += pc_keyb.o COBJS-y += ps2ser.o COBJS-y += ps2mult.o -COBJS-y += s3c4510b_uart.o -COBJS-y += serial.o -COBJS-y += serial_max3100.o -COBJS-y += serial_xuartlite.o -COBJS-y += usbtty.o # # USB Drivers diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 40f3d672e..735c63000 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -25,8 +25,19 @@ include $(TOPDIR)/config.mk LIB := $(obj)libserial.a -COBJS := mcfuart.o serial_pl010.o serial_pl011.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_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 From e4558666293364fc3af1c1d9381ca933fa0f1275 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 19:40:11 +0100 Subject: [PATCH 19/32] drivers/usb : move usb drivers to drivers/usb Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 11 ------ drivers/usb/Makefile | 52 +++++++++++++++++++++++++++ drivers/{ => usb}/isp116x-hcd.c | 0 drivers/{ => usb}/isp116x.h | 0 drivers/{ => usb}/sl811.h | 0 drivers/{ => usb}/sl811_usb.c | 2 +- drivers/{ => usb}/usb_ohci.c | 0 drivers/{ => usb}/usb_ohci.h | 0 drivers/{ => usb}/usbdcore.c | 0 drivers/{ => usb}/usbdcore_ep0.c | 0 drivers/{ => usb}/usbdcore_mpc8xx.c | 0 drivers/{ => usb}/usbdcore_omap1510.c | 0 13 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 drivers/usb/Makefile rename drivers/{ => usb}/isp116x-hcd.c (100%) rename drivers/{ => usb}/isp116x.h (100%) rename drivers/{ => usb}/sl811.h (100%) rename drivers/{ => usb}/sl811_usb.c (99%) rename drivers/{ => usb}/usb_ohci.c (100%) rename drivers/{ => usb}/usb_ohci.h (100%) rename drivers/{ => usb}/usbdcore.c (100%) rename drivers/{ => usb}/usbdcore_ep0.c (100%) rename drivers/{ => usb}/usbdcore_mpc8xx.c (100%) rename drivers/{ => usb}/usbdcore_omap1510.c (100%) diff --git a/Makefile b/Makefile index e68454a7b..24a351d61 100644 --- a/Makefile +++ b/Makefile @@ -225,6 +225,7 @@ ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a endif LIBS += drivers/serial/libserial.a +LIBS += drivers/usb/libusb.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) diff --git a/drivers/Makefile b/drivers/Makefile index cf8b584c7..666957dff 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -54,17 +54,6 @@ COBJS-y += pc_keyb.o COBJS-y += ps2ser.o COBJS-y += ps2mult.o -# -# USB Drivers -# -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 - # # Miscellaneous Drivers # diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile new file mode 100644 index 000000000..f8ea167b1 --- /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 b0cdf0bc2..c1f8427c9 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 100% rename from drivers/usb_ohci.c rename to drivers/usb/usb_ohci.c 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 From 16b195c82a18cbfd164800f17a1ef9db2e48331a Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 19:46:45 +0100 Subject: [PATCH 20/32] drivers/input : move input drivers to drivers/input Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 9 ------- drivers/input/Makefile | 48 ++++++++++++++++++++++++++++++++++ drivers/{ => input}/i8042.c | 0 drivers/{ => input}/keyboard.c | 0 drivers/{ => input}/pc_keyb.c | 0 drivers/{ => input}/ps2mult.c | 0 drivers/{ => input}/ps2ser.c | 0 8 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 drivers/input/Makefile rename drivers/{ => input}/i8042.c (100%) rename drivers/{ => input}/keyboard.c (100%) rename drivers/{ => input}/pc_keyb.c (100%) rename drivers/{ => input}/ps2mult.c (100%) rename drivers/{ => input}/ps2ser.c (100%) diff --git a/Makefile b/Makefile index 24a351d61..160b9066b 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,7 @@ LIBS += dtt/libdtt.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/i2c/libi2c.a +LIBS += drivers/input/libinput.a LIBS += drivers/nand/libnand.a LIBS += drivers/nand_legacy/libnand_legacy.a LIBS += drivers/net/libnet.a diff --git a/drivers/Makefile b/drivers/Makefile index 666957dff..745a5ccb6 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -45,15 +45,6 @@ COBJS-y += sil680.o COBJS-y += sym53c8xx.o COBJS-y += systemace.o -# -# Console Drivers -# -COBJS-y += i8042.o -COBJS-y += keyboard.o -COBJS-y += pc_keyb.o -COBJS-y += ps2ser.o -COBJS-y += ps2mult.o - # # Miscellaneous Drivers # diff --git a/drivers/input/Makefile b/drivers/input/Makefile new file mode 100644 index 000000000..df22cf9c6 --- /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 From f868cc5a50757d94f36c312395481cb0f187d9e6 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 20:14:44 +0100 Subject: [PATCH 21/32] drivers/hwmon : move hardware monitor drviers to drivers/hwmon Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 2 +- drivers/Makefile | 1 - {dtt => drivers/hwmon}/Makefile | 9 +++++---- {dtt => drivers/hwmon}/adm1021.c | 0 {dtt => drivers/hwmon}/ds1621.c | 0 drivers/{ => hwmon}/ds1722.c | 0 {dtt => drivers/hwmon}/ds1775.c | 0 {dtt => drivers/hwmon}/lm75.c | 0 {dtt => drivers/hwmon}/lm81.c | 0 9 files changed, 6 insertions(+), 6 deletions(-) rename {dtt => drivers/hwmon}/Makefile (97%) rename {dtt => drivers/hwmon}/adm1021.c (100%) rename {dtt => drivers/hwmon}/ds1621.c (100%) rename drivers/{ => hwmon}/ds1722.c (100%) rename {dtt => drivers/hwmon}/ds1775.c (100%) rename {dtt => drivers/hwmon}/lm75.c (100%) rename {dtt => drivers/hwmon}/lm81.c (100%) diff --git a/Makefile b/Makefile index 160b9066b..3aa93e09c 100644 --- a/Makefile +++ b/Makefile @@ -206,9 +206,9 @@ LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs 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/hwmon/libhwmon.a LIBS += drivers/i2c/libi2c.a LIBS += drivers/input/libinput.a LIBS += drivers/nand/libnand.a diff --git a/drivers/Makefile b/drivers/Makefile index 745a5ccb6..d4882f549 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -28,7 +28,6 @@ include $(TOPDIR)/config.mk LIB = $(obj)libdrivers.a COBJS-y += ali512x.o -COBJS-y += ds1722.o COBJS-y += ns87308.o COBJS-y += status_led.o diff --git a/dtt/Makefile b/drivers/hwmon/Makefile similarity index 97% rename from dtt/Makefile rename to drivers/hwmon/Makefile index 72e5c88bd..cebb2ba63 100644 --- a/dtt/Makefile +++ b/drivers/hwmon/Makefile @@ -28,13 +28,14 @@ include $(TOPDIR)/config.mk #CFLAGS += -DDEBUG -LIB = $(obj)libdtt.a +LIB = $(obj)libhwmon.a -COBJS-y += lm75.o -COBJS-y += ds1621.o COBJS-y += adm1021.o -COBJS-y += lm81.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) 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 From 0c698dcaa70275eb8814f665b545547cee013892 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 20:59:50 +0100 Subject: [PATCH 22/32] drivers/rtc : move rtc drivers to drivers/rtc Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 6 +++--- {rtc => drivers/rtc}/Makefile | 0 {rtc => drivers/rtc}/bf5xx_rtc.c | 0 {rtc => drivers/rtc}/date.c | 0 {rtc => drivers/rtc}/ds12887.c | 0 {rtc => drivers/rtc}/ds1302.c | 0 {rtc => drivers/rtc}/ds1306.c | 0 {rtc => drivers/rtc}/ds1307.c | 0 {rtc => drivers/rtc}/ds1337.c | 0 {rtc => drivers/rtc}/ds1374.c | 0 {rtc => drivers/rtc}/ds1556.c | 0 {rtc => drivers/rtc}/ds164x.c | 0 {rtc => drivers/rtc}/ds174x.c | 0 {rtc => drivers/rtc}/ds3231.c | 0 {rtc => drivers/rtc}/m41t11.c | 0 {rtc => drivers/rtc}/m48t35ax.c | 0 {rtc => drivers/rtc}/max6900.c | 0 {rtc => drivers/rtc}/mc146818.c | 0 {rtc => drivers/rtc}/mcfrtc.c | 0 {rtc => drivers/rtc}/mk48t59.c | 0 {rtc => drivers/rtc}/mpc5xxx.c | 0 {rtc => drivers/rtc}/mpc8xx.c | 0 {rtc => drivers/rtc}/pcf8563.c | 0 {rtc => drivers/rtc}/rs5c372.c | 0 {rtc => drivers/rtc}/s3c24x0_rtc.c | 0 25 files changed, 3 insertions(+), 3 deletions(-) rename {rtc => drivers/rtc}/Makefile (100%) rename {rtc => drivers/rtc}/bf5xx_rtc.c (100%) rename {rtc => drivers/rtc}/date.c (100%) rename {rtc => drivers/rtc}/ds12887.c (100%) rename {rtc => drivers/rtc}/ds1302.c (100%) rename {rtc => drivers/rtc}/ds1306.c (100%) rename {rtc => drivers/rtc}/ds1307.c (100%) rename {rtc => drivers/rtc}/ds1337.c (100%) rename {rtc => drivers/rtc}/ds1374.c (100%) rename {rtc => drivers/rtc}/ds1556.c (100%) rename {rtc => drivers/rtc}/ds164x.c (100%) rename {rtc => drivers/rtc}/ds174x.c (100%) rename {rtc => drivers/rtc}/ds3231.c (100%) rename {rtc => drivers/rtc}/m41t11.c (100%) rename {rtc => drivers/rtc}/m48t35ax.c (100%) rename {rtc => drivers/rtc}/max6900.c (100%) rename {rtc => drivers/rtc}/mc146818.c (100%) rename {rtc => drivers/rtc}/mcfrtc.c (100%) rename {rtc => drivers/rtc}/mk48t59.c (100%) rename {rtc => drivers/rtc}/mpc5xxx.c (100%) rename {rtc => drivers/rtc}/mpc8xx.c (100%) rename {rtc => drivers/rtc}/pcf8563.c (100%) rename {rtc => drivers/rtc}/rs5c372.c (100%) rename {rtc => drivers/rtc}/s3c24x0_rtc.c (100%) diff --git a/Makefile b/Makefile index 3aa93e09c..cde4490a4 100644 --- a/Makefile +++ b/Makefile @@ -205,7 +205,6 @@ 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 += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a LIBS += drivers/hwmon/libhwmon.a @@ -218,6 +217,9 @@ LIBS += drivers/net/sk98lin/libsk98lin.a LIBS += drivers/onenand/libonenand.a LIBS += drivers/pci/libpci.a LIBS += drivers/pcmcia/libpcmcia.a +LIBS += drivers/rtc/librtc.a +LIBS += drivers/serial/libserial.a +LIBS += drivers/usb/libusb.a LIBS += drivers/video/libvideo.a ifeq ($(CPU),mpc83xx) LIBS += drivers/qe/qe.a @@ -225,8 +227,6 @@ endif ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a endif -LIBS += drivers/serial/libserial.a -LIBS += drivers/usb/libusb.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) diff --git a/rtc/Makefile b/drivers/rtc/Makefile similarity index 100% rename from rtc/Makefile rename to drivers/rtc/Makefile 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 From 33daf5b7858807cb4ce4158c2c56524671c14c08 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 21:13:59 +0100 Subject: [PATCH 23/32] drivers/block : move block drivers to drivers/block Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 5 ---- drivers/block/Makefile | 50 +++++++++++++++++++++++++++++++++ drivers/{ => block}/ahci.c | 0 drivers/{ => block}/ata_piix.c | 0 drivers/{ => block}/sil680.c | 0 drivers/{ => block}/sym53c8xx.c | 0 drivers/{ => block}/systemace.c | 0 8 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 drivers/block/Makefile rename drivers/{ => block}/ahci.c (100%) rename drivers/{ => block}/ata_piix.c (100%) rename drivers/{ => block}/sil680.c (100%) rename drivers/{ => block}/sym53c8xx.c (100%) rename drivers/{ => block}/systemace.c (100%) diff --git a/Makefile b/Makefile index cde4490a4..1b27290ad 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,7 @@ LIBS += net/libnet.a LIBS += disk/libdisk.a LIBS += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.a +LIBS += drivers/block/libblock.a LIBS += drivers/hwmon/libhwmon.a LIBS += drivers/i2c/libi2c.a LIBS += drivers/input/libinput.a diff --git a/drivers/Makefile b/drivers/Makefile index d4882f549..6a623e366 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -34,15 +34,10 @@ COBJS-y += status_led.o # # Block and Flash Drivers # -COBJS-y += ahci.o COBJS-y += at45.o -COBJS-y += ata_piix.o COBJS-y += cfi_flash.o COBJS-y += dataflash.o COBJS-y += mw_eeprom.o -COBJS-y += sil680.o -COBJS-y += sym53c8xx.o -COBJS-y += systemace.o # # Miscellaneous Drivers diff --git a/drivers/block/Makefile b/drivers/block/Makefile new file mode 100644 index 000000000..e069969e6 --- /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 From 318c0b90431f2648552e5ade78833f42652ce859 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 21:17:55 +0100 Subject: [PATCH 24/32] drivers/misc : move misc drivers to drivers/misc Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 1 + drivers/Makefile | 11 -------- drivers/misc/Makefile | 48 +++++++++++++++++++++++++++++++++ drivers/{ => misc}/ali512x.c | 0 drivers/{ => misc}/ns87308.c | 0 drivers/{ => misc}/status_led.c | 0 6 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 drivers/misc/Makefile rename drivers/{ => misc}/ali512x.c (100%) rename drivers/{ => misc}/ns87308.c (100%) rename drivers/{ => misc}/status_led.c (100%) diff --git a/Makefile b/Makefile index 1b27290ad..00a4e2a2a 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,7 @@ 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/nand/libnand.a LIBS += drivers/nand_legacy/libnand_legacy.a LIBS += drivers/net/libnet.a diff --git a/drivers/Makefile b/drivers/Makefile index 6a623e366..d596a4ee3 100755 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -27,10 +27,6 @@ include $(TOPDIR)/config.mk LIB = $(obj)libdrivers.a -COBJS-y += ali512x.o -COBJS-y += ns87308.o -COBJS-y += status_led.o - # # Block and Flash Drivers # @@ -39,13 +35,6 @@ COBJS-y += cfi_flash.o COBJS-y += dataflash.o COBJS-y += mw_eeprom.o -# -# Miscellaneous Drivers -# -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/misc/Makefile b/drivers/misc/Makefile new file mode 100644 index 000000000..78cec21fb --- /dev/null +++ b/drivers/misc/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)libmisc.a + +COBJS-y += ali512x.o +COBJS-y += ns87308.o +COBJS-y += status_led.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/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 From 59829cc189378c142c13d2aa8d9a897d8bef3961 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 24 Nov 2007 21:26:56 +0100 Subject: [PATCH 25/32] drivers/mtd : move mtd drivers to drivers/mtd Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 16 ++++++++-------- drivers/{ => mtd}/Makefile | 13 ++++--------- drivers/{ => mtd}/at45.c | 0 drivers/{ => mtd}/cfi_flash.c | 0 drivers/{ => mtd}/dataflash.c | 0 drivers/{ => mtd}/mw_eeprom.c | 0 drivers/{ => mtd}/nand/Makefile | 0 drivers/{ => mtd}/nand/diskonchip.c | 0 drivers/{ => mtd}/nand/nand.c | 0 drivers/{ => mtd}/nand/nand_base.c | 0 drivers/{ => mtd}/nand/nand_bbt.c | 0 drivers/{ => mtd}/nand/nand_ecc.c | 0 drivers/{ => mtd}/nand/nand_ids.c | 0 drivers/{ => mtd}/nand/nand_util.c | 0 drivers/{ => mtd}/nand_legacy/Makefile | 0 drivers/{ => mtd}/nand_legacy/nand_legacy.c | 0 drivers/{ => mtd}/onenand/Makefile | 0 drivers/{ => mtd}/onenand/onenand_base.c | 0 drivers/{ => mtd}/onenand/onenand_bbt.c | 0 nand_spl/board/amcc/acadia/Makefile | 2 +- nand_spl/board/amcc/bamboo/Makefile | 2 +- nand_spl/board/amcc/sequoia/Makefile | 2 +- 22 files changed, 15 insertions(+), 20 deletions(-) rename drivers/{ => mtd}/Makefile (87%) mode change 100755 => 100644 rename drivers/{ => mtd}/at45.c (100%) rename drivers/{ => mtd}/cfi_flash.c (100%) rename drivers/{ => mtd}/dataflash.c (100%) rename drivers/{ => mtd}/mw_eeprom.c (100%) rename drivers/{ => mtd}/nand/Makefile (100%) rename drivers/{ => mtd}/nand/diskonchip.c (100%) rename drivers/{ => mtd}/nand/nand.c (100%) rename drivers/{ => mtd}/nand/nand_base.c (100%) rename drivers/{ => mtd}/nand/nand_bbt.c (100%) rename drivers/{ => mtd}/nand/nand_ecc.c (100%) rename drivers/{ => mtd}/nand/nand_ids.c (100%) rename drivers/{ => mtd}/nand/nand_util.c (100%) rename drivers/{ => mtd}/nand_legacy/Makefile (100%) rename drivers/{ => mtd}/nand_legacy/nand_legacy.c (100%) rename drivers/{ => mtd}/onenand/Makefile (100%) rename drivers/{ => mtd}/onenand/onenand_base.c (100%) rename drivers/{ => mtd}/onenand/onenand_bbt.c (100%) diff --git a/Makefile b/Makefile index 00a4e2a2a..5f3f0b303 100644 --- a/Makefile +++ b/Makefile @@ -205,30 +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 += drivers/libdrivers.a LIBS += drivers/bios_emulator/libatibiosemu.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/nand/libnand.a -LIBS += drivers/nand_legacy/libnand_legacy.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/onenand/libonenand.a LIBS += drivers/pci/libpci.a LIBS += drivers/pcmcia/libpcmcia.a -LIBS += drivers/rtc/librtc.a -LIBS += drivers/serial/libserial.a -LIBS += drivers/usb/libusb.a -LIBS += drivers/video/libvideo.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/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) diff --git a/drivers/Makefile b/drivers/mtd/Makefile old mode 100755 new mode 100644 similarity index 87% rename from drivers/Makefile rename to drivers/mtd/Makefile index d596a4ee3..95c5e02af --- a/drivers/Makefile +++ b/drivers/mtd/Makefile @@ -23,25 +23,20 @@ include $(TOPDIR)/config.mk -# CFLAGS += -DET_DEBUG -DDEBUG +LIB := $(obj)libmtd.a -LIB = $(obj)libdrivers.a - -# -# Block and Flash Drivers -# 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)) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) all: $(LIB) -$(LIB): $(obj).depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) ######################################################################### 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/nand/Makefile b/drivers/mtd/nand/Makefile similarity index 100% rename from drivers/nand/Makefile rename to drivers/mtd/nand/Makefile 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/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile index 926476f91..2d4d6016e 100644 --- a/nand_spl/board/amcc/acadia/Makefile +++ b/nand_spl/board/amcc/acadia/Makefile @@ -96,7 +96,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 8b5461dcf..3a633fb88 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 ec1be5a76..78bf071f5 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 ######################################################################### From 87ddedd6ad804427ce125ceaa076d7a4f74e9d5d Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 25 Nov 2007 18:45:47 +0100 Subject: [PATCH 26/32] Makefile : fix tags ctags etags with new drivers organization Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5f3f0b303..dbd7d4fb3 100644 --- a/Makefile +++ b/Makefile @@ -335,14 +335,26 @@ 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 \ + net disk common drivers/bios_emulator \ + drivers/block drivers/hwmon drivers/i2c \ + drivers/input drivers/misc drivers/mtd \ + drivers/mtd/nand drivers/mtd/nand_legacy \ + drivers/mtd/onenand drivers/net drivers/net/sk98lin \ + drivers/pci drivers/pcmcia drivers/qe drivers/rtc \ + drivers/serial drivers/usb drivers/video \ \( -name CVS -prune \) -o \( -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 \ + net disk common drivers/bios_emulator \ + drivers/block drivers/hwmon drivers/i2c \ + drivers/input drivers/misc drivers/mtd \ + drivers/mtd/nand drivers/mtd/nand_legacy \ + drivers/mtd/onenand drivers/net drivers/net/sk98lin \ + drivers/pci drivers/pcmcia drivers/qe drivers/rtc \ + drivers/serial drivers/usb drivers/video \ \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` $(obj)System.map: $(obj)u-boot From a340c325e668ca7386c2276387681720be9c3757 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 25 Nov 2007 18:45:47 +0100 Subject: [PATCH 27/32] Makefile : fix tags ctags etags with new drivers organization Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5f3f0b303..37b8db694 100644 --- a/Makefile +++ b/Makefile @@ -331,18 +331,43 @@ 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 \ + ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \ \( -name CVS -prune \) -o \( -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 \ + etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) $(TAG_SUBDIRS) \ \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` $(obj)System.map: $(obj)u-boot From 3deca9d44767efd1b83f4b701f0dbf21a7595f7b Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 25 Nov 2007 22:39:25 +0100 Subject: [PATCH 28/32] MAKEALL: add missing 512x boards in ppc Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- MAKEALL | 1 + 1 file changed, 1 insertion(+) diff --git a/MAKEALL b/MAKEALL index 20ef4e169..a02412b80 100755 --- a/MAKEALL +++ b/MAKEALL @@ -378,6 +378,7 @@ LIST_7xx=" \ LIST_ppc=" \ ${LIST_5xx} \ + ${LIST_512x} \ ${LIST_5xxx} \ ${LIST_8xx} \ ${LIST_8220} \ From a5f601fd1b1278deae5aa9fc27a232b0d1c1c788 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Mon, 26 Nov 2007 19:18:21 +0100 Subject: [PATCH 29/32] Cleanup coding style; update CHANGELOG Signed-off-by: Wolfgang Denk --- CHANGELOG | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt.h | 30 ++--- 2 files changed, 369 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bc8c01e40..54f15596d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,287 @@ +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 @@ -345,6 +629,76 @@ Date: Wed Nov 7 08:19:19 2007 +0100 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 diff --git a/include/fdt.h b/include/fdt.h index e00559ad6..48ccfd910 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -4,22 +4,22 @@ #ifndef __ASSEMBLY__ struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ + uint32_t magic; /* magic word FDT_MAGIC */ + uint32_t totalsize; /* total size of DT block */ + uint32_t off_dt_struct; /* offset to structure */ + uint32_t off_dt_strings; /* offset to strings */ + uint32_t off_mem_rsvmap; /* offset to memory reserve map */ + uint32_t version; /* format version */ + uint32_t last_comp_version; /* last compatible version */ - /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're + /* version 2 fields below */ + uint32_t boot_cpuid_phys; /* Which physical CPU id we're booting on */ /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ + uint32_t size_dt_strings; /* size of the strings block */ /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ + uint32_t size_dt_struct; /* size of the structure block */ }; struct fdt_reserve_entry { @@ -41,12 +41,12 @@ struct fdt_property { #endif /* !__ASSEMBLY */ -#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ +#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ #define FDT_TAGSIZE sizeof(uint32_t) -#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ -#define FDT_END_NODE 0x2 /* End node */ -#define FDT_PROP 0x3 /* Property: name off, +#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ +#define FDT_END_NODE 0x2 /* End node */ +#define FDT_PROP 0x3 /* Property: name off, size, content */ #define FDT_NOP 0x4 /* nop */ #define FDT_END 0x9 From 8d4f040a3c15036a6ea25a9c39e7d89fefa8440d Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Mon, 3 Dec 2007 00:15:28 +0100 Subject: [PATCH 30/32] Prepare for 1.3.1-rc1 Signed-off-by: Wolfgang Denk --- CHANGELOG | 24 ++++++++++++++++++++++++ Makefile | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 54f15596d..015a4ac01 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,27 @@ +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 diff --git a/Makefile b/Makefile index bfd4132c1..db3d1e8ef 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,8 @@ VERSION = 1 PATCHLEVEL = 3 -SUBLEVEL = 0 -EXTRAVERSION = +SUBLEVEL = 1 +EXTRAVERSION = -rc1 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) VERSION_FILE = $(obj)include/version_autogenerated.h From cf5933ba1e97a1cd8f5f24070e820f21d976eaeb Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 6 Dec 2007 10:21:03 +0100 Subject: [PATCH 31/32] ADS5121 Board: fix compile problem. Signed-off-by: Wolfgang Denk --- include/configs/ads5121.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/ads5121.h b/include/configs/ads5121.h index bb1efdf6d..58060a8c8 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 /* From 41be969f4957115ed7b1fe8b890bfaee99d7a7a2 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 6 Dec 2007 10:21:19 +0100 Subject: [PATCH 32/32] Release v1.3.1 Signed-off-by: Wolfgang Denk --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index db3d1e8ef..1ff80b50d 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ VERSION = 1 PATCHLEVEL = 3 SUBLEVEL = 1 -EXTRAVERSION = -rc1 +EXTRAVERSION = U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) VERSION_FILE = $(obj)include/version_autogenerated.h