summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>2007-12-06 16:20:16 (GMT)
committerNobuhiro Iwamatsu <iwamatsu@nigauri.org>2007-12-06 16:20:16 (GMT)
commit521dcd30b9cc5b72cd27ae04104f19369251aa20 (patch)
treebc33710a3ae6f97f0dcae8f02fd6f3c91322d96d
parent260eea5676ca46903a335686cc020b29c4ca46fe (diff)
parent8d4f040a3c15036a6ea25a9c39e7d89fefa8440d (diff)
downloadu-boot-fsl-qoriq-521dcd30b9cc5b72cd27ae04104f19369251aa20.tar.xz
Merge git://www.denx.de/git/u-boot
Conflicts: drivers/Makefile
-rw-r--r--CHANGELOG378
-rwxr-xr-xMAKEALL1
-rw-r--r--Makefile89
-rw-r--r--board/cds/mpc8541cds/u-boot.lds2
-rw-r--r--board/cds/mpc8548cds/u-boot.lds2
-rw-r--r--board/cds/mpc8555cds/u-boot.lds2
-rw-r--r--board/cm5200/cm5200.c2
-rw-r--r--board/freescale/mpc832xemds/pci.c2
-rw-r--r--board/freescale/mpc8349emds/pci.c4
-rw-r--r--board/freescale/mpc8349itx/pci.c4
-rw-r--r--board/freescale/mpc8360emds/pci.c2
-rw-r--r--board/mpl/vcma9/cmd_vcma9.c2
-rw-r--r--board/netstar/eeprom.c2
-rw-r--r--board/voiceblue/eeprom.c2
-rw-r--r--common/Makefile82
-rw-r--r--common/cmd_bdinfo.c2
-rw-r--r--common/cmd_bedbug.c3
-rw-r--r--common/cmd_bmp.c4
-rw-r--r--common/cmd_console.c4
-rw-r--r--common/cmd_date.c4
-rw-r--r--common/cmd_dcr.c4
-rw-r--r--common/cmd_diag.c4
-rw-r--r--common/cmd_display.c4
-rw-r--r--common/cmd_doc.c5
-rw-r--r--common/cmd_dtt.c4
-rw-r--r--common/cmd_elf.c4
-rw-r--r--common/cmd_ext2.c4
-rw-r--r--common/cmd_fat.c7
-rw-r--r--common/cmd_fdos.c4
-rw-r--r--common/cmd_fdt.c81
-rw-r--r--common/cmd_flash.c4
-rw-r--r--common/cmd_fpga.c3
-rw-r--r--common/cmd_i2c.c5
-rw-r--r--common/cmd_ide.c4
-rw-r--r--common/cmd_immap.c5
-rw-r--r--common/cmd_itest.c3
-rw-r--r--common/cmd_jffs2.c5
-rw-r--r--common/cmd_log.c4
-rw-r--r--common/cmd_mfsl.c4
-rw-r--r--common/cmd_mii.c4
-rw-r--r--common/cmd_misc.c4
-rw-r--r--common/cmd_mmc.c5
-rw-r--r--common/cmd_net.c4
-rw-r--r--common/cmd_pci.c9
-rw-r--r--common/cmd_portio.c4
-rw-r--r--common/cmd_reginfo.c5
-rw-r--r--common/cmd_reiser.c4
-rw-r--r--common/cmd_scsi.c4
-rw-r--r--common/cmd_spi.c4
-rw-r--r--common/cmd_universe.c4
-rw-r--r--common/cmd_usb.c10
-rw-r--r--common/fdt_support.c183
-rw-r--r--config.mk3
-rw-r--r--cpu/mpc5xxx/cpu.c40
-rw-r--r--cpu/mpc8260/cpu.c30
-rw-r--r--cpu/mpc83xx/cpu.c4
-rw-r--r--cpu/mpc83xx/pci.c4
-rwxr-xr-xdrivers/Makefile164
-rw-r--r--drivers/block/Makefile50
-rw-r--r--drivers/block/ahci.c (renamed from drivers/ahci.c)0
-rw-r--r--drivers/block/ata_piix.c (renamed from drivers/ata_piix.c)0
-rw-r--r--drivers/block/sil680.c (renamed from drivers/sil680.c)0
-rw-r--r--drivers/block/sym53c8xx.c (renamed from drivers/sym53c8xx.c)0
-rw-r--r--drivers/block/systemace.c (renamed from drivers/systemace.c)0
-rw-r--r--drivers/hwmon/Makefile (renamed from dtt/Makefile)9
-rw-r--r--drivers/hwmon/adm1021.c (renamed from dtt/adm1021.c)0
-rw-r--r--drivers/hwmon/ds1621.c (renamed from dtt/ds1621.c)0
-rw-r--r--drivers/hwmon/ds1722.c (renamed from drivers/ds1722.c)0
-rw-r--r--drivers/hwmon/ds1775.c (renamed from dtt/ds1775.c)0
-rw-r--r--drivers/hwmon/lm75.c (renamed from dtt/lm75.c)0
-rw-r--r--drivers/hwmon/lm81.c (renamed from dtt/lm81.c)0
-rw-r--r--drivers/i2c/Makefile49
-rw-r--r--drivers/i2c/fsl_i2c.c (renamed from drivers/fsl_i2c.c)0
-rw-r--r--drivers/i2c/omap1510_i2c.c (renamed from drivers/omap1510_i2c.c)0
-rw-r--r--drivers/i2c/omap24xx_i2c.c (renamed from drivers/omap24xx_i2c.c)0
-rw-r--r--drivers/i2c/tsi108_i2c.c (renamed from drivers/tsi108_i2c.c)0
-rw-r--r--drivers/input/Makefile48
-rw-r--r--drivers/input/i8042.c (renamed from drivers/i8042.c)0
-rw-r--r--drivers/input/keyboard.c (renamed from drivers/keyboard.c)0
-rw-r--r--drivers/input/pc_keyb.c (renamed from drivers/pc_keyb.c)0
-rw-r--r--drivers/input/ps2mult.c (renamed from drivers/ps2mult.c)0
-rw-r--r--drivers/input/ps2ser.c (renamed from drivers/ps2ser.c)0
-rw-r--r--drivers/misc/Makefile48
-rw-r--r--drivers/misc/ali512x.c (renamed from drivers/ali512x.c)0
-rw-r--r--drivers/misc/ns87308.c (renamed from drivers/ns87308.c)0
-rw-r--r--drivers/misc/status_led.c (renamed from drivers/status_led.c)0
-rw-r--r--drivers/mtd/Makefile49
-rw-r--r--drivers/mtd/at45.c (renamed from drivers/at45.c)0
-rw-r--r--drivers/mtd/cfi_flash.c (renamed from drivers/cfi_flash.c)0
-rw-r--r--drivers/mtd/dataflash.c (renamed from drivers/dataflash.c)0
-rw-r--r--drivers/mtd/mw_eeprom.c (renamed from drivers/mw_eeprom.c)0
-rw-r--r--drivers/mtd/nand/Makefile (renamed from drivers/nand/Makefile)0
-rw-r--r--drivers/mtd/nand/diskonchip.c (renamed from drivers/nand/diskonchip.c)0
-rw-r--r--drivers/mtd/nand/nand.c (renamed from drivers/nand/nand.c)0
-rw-r--r--drivers/mtd/nand/nand_base.c (renamed from drivers/nand/nand_base.c)0
-rw-r--r--drivers/mtd/nand/nand_bbt.c (renamed from drivers/nand/nand_bbt.c)0
-rw-r--r--drivers/mtd/nand/nand_ecc.c (renamed from drivers/nand/nand_ecc.c)0
-rw-r--r--drivers/mtd/nand/nand_ids.c (renamed from drivers/nand/nand_ids.c)0
-rw-r--r--drivers/mtd/nand/nand_util.c (renamed from drivers/nand/nand_util.c)0
-rw-r--r--drivers/mtd/nand_legacy/Makefile (renamed from drivers/nand_legacy/Makefile)0
-rw-r--r--drivers/mtd/nand_legacy/nand_legacy.c (renamed from drivers/nand_legacy/nand_legacy.c)0
-rw-r--r--drivers/mtd/onenand/Makefile (renamed from drivers/onenand/Makefile)0
-rw-r--r--drivers/mtd/onenand/onenand_base.c (renamed from drivers/onenand/onenand_base.c)0
-rw-r--r--drivers/mtd/onenand/onenand_bbt.c (renamed from drivers/onenand/onenand_bbt.c)0
-rw-r--r--drivers/net/3c589.c (renamed from drivers/3c589.c)0
-rw-r--r--drivers/net/3c589.h (renamed from drivers/3c589.h)0
-rw-r--r--drivers/net/5701rls.c (renamed from drivers/5701rls.c)0
-rw-r--r--drivers/net/5701rls.h (renamed from drivers/5701rls.h)0
-rw-r--r--drivers/net/8390.h (renamed from drivers/8390.h)0
-rw-r--r--drivers/net/Makefile33
-rw-r--r--drivers/net/bcm570x.c (renamed from drivers/bcm570x.c)0
-rw-r--r--drivers/net/bcm570x_autoneg.c (renamed from drivers/bcm570x_autoneg.c)0
-rw-r--r--drivers/net/bcm570x_autoneg.h (renamed from drivers/bcm570x_autoneg.h)0
-rw-r--r--drivers/net/bcm570x_bits.h (renamed from drivers/bcm570x_bits.h)0
-rw-r--r--drivers/net/bcm570x_debug.h (renamed from drivers/bcm570x_debug.h)0
-rw-r--r--drivers/net/bcm570x_lm.h (renamed from drivers/bcm570x_lm.h)0
-rw-r--r--drivers/net/bcm570x_mm.h (renamed from drivers/bcm570x_mm.h)0
-rw-r--r--drivers/net/bcm570x_queue.h (renamed from drivers/bcm570x_queue.h)0
-rw-r--r--drivers/net/cs8900.c (renamed from drivers/cs8900.c)0
-rw-r--r--drivers/net/cs8900.h (renamed from drivers/cs8900.h)0
-rw-r--r--drivers/net/dc2114x.c (renamed from drivers/dc2114x.c)0
-rw-r--r--drivers/net/dm9000x.c (renamed from drivers/dm9000x.c)0
-rw-r--r--drivers/net/dm9000x.h (renamed from drivers/dm9000x.h)0
-rw-r--r--drivers/net/e1000.c (renamed from drivers/e1000.c)0
-rw-r--r--drivers/net/e1000.h (renamed from drivers/e1000.h)0
-rw-r--r--drivers/net/eepro100.c (renamed from drivers/eepro100.c)0
-rw-r--r--drivers/net/enc28j60.c (renamed from drivers/enc28j60.c)0
-rw-r--r--drivers/net/inca-ip_sw.c (renamed from drivers/inca-ip_sw.c)0
-rw-r--r--drivers/net/ks8695eth.c (renamed from drivers/ks8695eth.c)0
-rw-r--r--drivers/net/lan91c96.c (renamed from drivers/lan91c96.c)0
-rw-r--r--drivers/net/lan91c96.h (renamed from drivers/lan91c96.h)0
-rw-r--r--drivers/net/macb.c (renamed from drivers/macb.c)0
-rw-r--r--drivers/net/macb.h (renamed from drivers/macb.h)0
-rw-r--r--drivers/net/natsemi.c (renamed from drivers/natsemi.c)0
-rw-r--r--drivers/net/ne2000.c (renamed from drivers/ne2000.c)0
-rw-r--r--drivers/net/ne2000.h (renamed from drivers/ne2000.h)0
-rw-r--r--drivers/net/netarm_eth.c (renamed from drivers/netarm_eth.c)0
-rw-r--r--drivers/net/netarm_eth.h (renamed from drivers/netarm_eth.h)0
-rw-r--r--drivers/net/netconsole.c (renamed from drivers/netconsole.c)0
-rw-r--r--drivers/net/nicext.h (renamed from drivers/nicext.h)0
-rw-r--r--drivers/net/ns7520_eth.c (renamed from drivers/ns7520_eth.c)0
-rw-r--r--drivers/net/ns8382x.c (renamed from drivers/ns8382x.c)0
-rw-r--r--drivers/net/ns9750_eth.c (renamed from drivers/ns9750_eth.c)0
-rw-r--r--drivers/net/pcnet.c (renamed from drivers/pcnet.c)0
-rw-r--r--drivers/net/plb2800_eth.c (renamed from drivers/plb2800_eth.c)0
-rw-r--r--drivers/net/rtl8019.c (renamed from drivers/rtl8019.c)0
-rw-r--r--drivers/net/rtl8019.h (renamed from drivers/rtl8019.h)0
-rw-r--r--drivers/net/rtl8139.c (renamed from drivers/rtl8139.c)0
-rw-r--r--drivers/net/rtl8169.c (renamed from drivers/rtl8169.c)0
-rw-r--r--drivers/net/s3c4510b_eth.c (renamed from drivers/s3c4510b_eth.c)0
-rw-r--r--drivers/net/s3c4510b_eth.h (renamed from drivers/s3c4510b_eth.h)0
-rw-r--r--drivers/net/sk98lin/Makefile (renamed from drivers/sk98lin/Makefile)0
-rw-r--r--drivers/net/sk98lin/h/lm80.h (renamed from drivers/sk98lin/h/lm80.h)0
-rw-r--r--drivers/net/sk98lin/h/skaddr.h (renamed from drivers/sk98lin/h/skaddr.h)0
-rw-r--r--drivers/net/sk98lin/h/skcsum.h (renamed from drivers/sk98lin/h/skcsum.h)0
-rw-r--r--drivers/net/sk98lin/h/skdebug.h (renamed from drivers/sk98lin/h/skdebug.h)0
-rw-r--r--drivers/net/sk98lin/h/skdrv1st.h (renamed from drivers/sk98lin/h/skdrv1st.h)0
-rw-r--r--drivers/net/sk98lin/h/skdrv2nd.h (renamed from drivers/sk98lin/h/skdrv2nd.h)0
-rw-r--r--drivers/net/sk98lin/h/skerror.h (renamed from drivers/sk98lin/h/skerror.h)0
-rw-r--r--drivers/net/sk98lin/h/skgedrv.h (renamed from drivers/sk98lin/h/skgedrv.h)0
-rw-r--r--drivers/net/sk98lin/h/skgehw.h (renamed from drivers/sk98lin/h/skgehw.h)0
-rw-r--r--drivers/net/sk98lin/h/skgehwt.h (renamed from drivers/sk98lin/h/skgehwt.h)0
-rw-r--r--drivers/net/sk98lin/h/skgei2c.h (renamed from drivers/sk98lin/h/skgei2c.h)0
-rw-r--r--drivers/net/sk98lin/h/skgeinit.h (renamed from drivers/sk98lin/h/skgeinit.h)0
-rw-r--r--drivers/net/sk98lin/h/skgepnm2.h (renamed from drivers/sk98lin/h/skgepnm2.h)0
-rw-r--r--drivers/net/sk98lin/h/skgepnmi.h (renamed from drivers/sk98lin/h/skgepnmi.h)0
-rw-r--r--drivers/net/sk98lin/h/skgesirq.h (renamed from drivers/sk98lin/h/skgesirq.h)0
-rw-r--r--drivers/net/sk98lin/h/ski2c.h (renamed from drivers/sk98lin/h/ski2c.h)0
-rw-r--r--drivers/net/sk98lin/h/skqueue.h (renamed from drivers/sk98lin/h/skqueue.h)0
-rw-r--r--drivers/net/sk98lin/h/skrlmt.h (renamed from drivers/sk98lin/h/skrlmt.h)0
-rw-r--r--drivers/net/sk98lin/h/sktimer.h (renamed from drivers/sk98lin/h/sktimer.h)0
-rw-r--r--drivers/net/sk98lin/h/sktypes.h (renamed from drivers/sk98lin/h/sktypes.h)0
-rw-r--r--drivers/net/sk98lin/h/skversion.h (renamed from drivers/sk98lin/h/skversion.h)0
-rw-r--r--drivers/net/sk98lin/h/skvpd.h (renamed from drivers/sk98lin/h/skvpd.h)0
-rw-r--r--drivers/net/sk98lin/h/xmac_ii.h (renamed from drivers/sk98lin/h/xmac_ii.h)0
-rw-r--r--drivers/net/sk98lin/skaddr.c (renamed from drivers/sk98lin/skaddr.c)0
-rw-r--r--drivers/net/sk98lin/skcsum.c (renamed from drivers/sk98lin/skcsum.c)0
-rw-r--r--drivers/net/sk98lin/skge.c (renamed from drivers/sk98lin/skge.c)0
-rw-r--r--drivers/net/sk98lin/skgehwt.c (renamed from drivers/sk98lin/skgehwt.c)0
-rw-r--r--drivers/net/sk98lin/skgeinit.c (renamed from drivers/sk98lin/skgeinit.c)0
-rw-r--r--drivers/net/sk98lin/skgemib.c (renamed from drivers/sk98lin/skgemib.c)0
-rw-r--r--drivers/net/sk98lin/skgepnmi.c (renamed from drivers/sk98lin/skgepnmi.c)0
-rw-r--r--drivers/net/sk98lin/skgesirq.c (renamed from drivers/sk98lin/skgesirq.c)0
-rw-r--r--drivers/net/sk98lin/ski2c.c (renamed from drivers/sk98lin/ski2c.c)0
-rw-r--r--drivers/net/sk98lin/sklm80.c (renamed from drivers/sk98lin/sklm80.c)0
-rw-r--r--drivers/net/sk98lin/skproc.c (renamed from drivers/sk98lin/skproc.c)0
-rw-r--r--drivers/net/sk98lin/skqueue.c (renamed from drivers/sk98lin/skqueue.c)0
-rw-r--r--drivers/net/sk98lin/skrlmt.c (renamed from drivers/sk98lin/skrlmt.c)0
-rw-r--r--drivers/net/sk98lin/sktimer.c (renamed from drivers/sk98lin/sktimer.c)0
-rw-r--r--drivers/net/sk98lin/skvpd.c (renamed from drivers/sk98lin/skvpd.c)0
-rw-r--r--drivers/net/sk98lin/skxmac2.c (renamed from drivers/sk98lin/skxmac2.c)0
-rw-r--r--drivers/net/sk98lin/u-boot_compat.h (renamed from drivers/sk98lin/u-boot_compat.h)0
-rw-r--r--drivers/net/sk98lin/uboot_drv.c (renamed from drivers/sk98lin/uboot_drv.c)0
-rw-r--r--drivers/net/sk98lin/uboot_skb.c (renamed from drivers/sk98lin/uboot_skb.c)0
-rw-r--r--drivers/net/smc91111.c (renamed from drivers/smc91111.c)0
-rw-r--r--drivers/net/smc91111.h (renamed from drivers/smc91111.h)0
-rw-r--r--drivers/net/tigon3.c (renamed from drivers/tigon3.c)0
-rw-r--r--drivers/net/tigon3.h (renamed from drivers/tigon3.h)0
-rw-r--r--drivers/net/tsec.c (renamed from drivers/tsec.c)0
-rw-r--r--drivers/net/tsec.h (renamed from drivers/tsec.h)0
-rw-r--r--drivers/net/tsi108_eth.c (renamed from drivers/tsi108_eth.c)0
-rw-r--r--drivers/net/uli526x.c (renamed from drivers/uli526x.c)0
-rw-r--r--drivers/pci/Makefile51
-rw-r--r--drivers/pci/fsl_pci_init.c (renamed from drivers/fsl_pci_init.c)0
-rw-r--r--drivers/pci/pci.c (renamed from drivers/pci.c)0
-rw-r--r--drivers/pci/pci_auto.c (renamed from drivers/pci_auto.c)0
-rw-r--r--drivers/pci/pci_indirect.c (renamed from drivers/pci_indirect.c)0
-rw-r--r--drivers/pci/tsi108_pci.c (renamed from drivers/tsi108_pci.c)0
-rw-r--r--drivers/pci/w83c553f.c (renamed from drivers/w83c553f.c)0
-rw-r--r--drivers/pcmcia/Makefile50
-rw-r--r--drivers/pcmcia/i82365.c (renamed from drivers/i82365.c)0
-rw-r--r--drivers/pcmcia/mpc8xx_pcmcia.c (renamed from drivers/mpc8xx_pcmcia.c)0
-rw-r--r--drivers/pcmcia/pxa_pcmcia.c (renamed from drivers/pxa_pcmcia.c)0
-rw-r--r--drivers/pcmcia/rpx_pcmcia.c (renamed from drivers/rpx_pcmcia.c)0
-rw-r--r--drivers/pcmcia/ti_pci1410a.c (renamed from drivers/ti_pci1410a.c)0
-rw-r--r--drivers/pcmcia/tqm8xx_pcmcia.c (renamed from drivers/tqm8xx_pcmcia.c)0
-rw-r--r--drivers/rtc/Makefile (renamed from rtc/Makefile)0
-rw-r--r--drivers/rtc/bf5xx_rtc.c (renamed from rtc/bf5xx_rtc.c)0
-rw-r--r--drivers/rtc/date.c (renamed from rtc/date.c)0
-rw-r--r--drivers/rtc/ds12887.c (renamed from rtc/ds12887.c)0
-rw-r--r--drivers/rtc/ds1302.c (renamed from rtc/ds1302.c)0
-rw-r--r--drivers/rtc/ds1306.c (renamed from rtc/ds1306.c)0
-rw-r--r--drivers/rtc/ds1307.c (renamed from rtc/ds1307.c)0
-rw-r--r--drivers/rtc/ds1337.c (renamed from rtc/ds1337.c)0
-rw-r--r--drivers/rtc/ds1374.c (renamed from rtc/ds1374.c)0
-rw-r--r--drivers/rtc/ds1556.c (renamed from rtc/ds1556.c)0
-rw-r--r--drivers/rtc/ds164x.c (renamed from rtc/ds164x.c)0
-rw-r--r--drivers/rtc/ds174x.c (renamed from rtc/ds174x.c)0
-rw-r--r--drivers/rtc/ds3231.c (renamed from rtc/ds3231.c)0
-rw-r--r--drivers/rtc/m41t11.c (renamed from rtc/m41t11.c)0
-rw-r--r--drivers/rtc/m48t35ax.c (renamed from rtc/m48t35ax.c)0
-rw-r--r--drivers/rtc/max6900.c (renamed from rtc/max6900.c)0
-rw-r--r--drivers/rtc/mc146818.c (renamed from rtc/mc146818.c)0
-rw-r--r--drivers/rtc/mcfrtc.c (renamed from rtc/mcfrtc.c)0
-rw-r--r--drivers/rtc/mk48t59.c (renamed from rtc/mk48t59.c)0
-rw-r--r--drivers/rtc/mpc5xxx.c (renamed from rtc/mpc5xxx.c)0
-rw-r--r--drivers/rtc/mpc8xx.c (renamed from rtc/mpc8xx.c)0
-rw-r--r--drivers/rtc/pcf8563.c (renamed from rtc/pcf8563.c)0
-rw-r--r--drivers/rtc/rs5c372.c (renamed from rtc/rs5c372.c)0
-rw-r--r--drivers/rtc/s3c24x0_rtc.c (renamed from rtc/s3c24x0_rtc.c)0
-rw-r--r--drivers/serial/Makefile15
-rw-r--r--drivers/serial/atmel_usart.c (renamed from drivers/atmel_usart.c)0
-rw-r--r--drivers/serial/atmel_usart.h (renamed from drivers/atmel_usart.h)0
-rw-r--r--drivers/serial/ns16550.c (renamed from drivers/ns16550.c)0
-rw-r--r--drivers/serial/ns9750_serial.c (renamed from drivers/ns9750_serial.c)0
-rw-r--r--drivers/serial/s3c4510b_uart.c (renamed from drivers/s3c4510b_uart.c)0
-rw-r--r--drivers/serial/s3c4510b_uart.h (renamed from drivers/s3c4510b_uart.h)0
-rw-r--r--drivers/serial/serial.c (renamed from drivers/serial.c)0
-rw-r--r--drivers/serial/serial_max3100.c (renamed from drivers/serial_max3100.c)0
-rw-r--r--drivers/serial/serial_xuartlite.c (renamed from drivers/serial_xuartlite.c)0
-rw-r--r--drivers/serial/usbtty.c (renamed from drivers/usbtty.c)0
-rw-r--r--drivers/serial/usbtty.h (renamed from drivers/usbtty.h)0
-rw-r--r--drivers/usb/Makefile52
-rw-r--r--drivers/usb/isp116x-hcd.c (renamed from drivers/isp116x-hcd.c)0
-rw-r--r--drivers/usb/isp116x.h (renamed from drivers/isp116x.h)0
-rw-r--r--drivers/usb/sl811.h (renamed from drivers/sl811.h)0
-rw-r--r--drivers/usb/sl811_usb.c (renamed from drivers/sl811_usb.c)2
-rw-r--r--drivers/usb/usb_ohci.c (renamed from drivers/usb_ohci.c)0
-rw-r--r--drivers/usb/usb_ohci.h (renamed from drivers/usb_ohci.h)0
-rw-r--r--drivers/usb/usbdcore.c (renamed from drivers/usbdcore.c)0
-rw-r--r--drivers/usb/usbdcore_ep0.c (renamed from drivers/usbdcore_ep0.c)0
-rw-r--r--drivers/usb/usbdcore_mpc8xx.c (renamed from drivers/usbdcore_mpc8xx.c)0
-rw-r--r--drivers/usb/usbdcore_omap1510.c (renamed from drivers/usbdcore_omap1510.c)0
-rw-r--r--drivers/video/Makefile53
-rw-r--r--drivers/video/ati_ids.h (renamed from drivers/ati_ids.h)0
-rw-r--r--drivers/video/ati_radeon_fb.c (renamed from drivers/ati_radeon_fb.c)2
-rw-r--r--drivers/video/ati_radeon_fb.h (renamed from drivers/ati_radeon_fb.h)0
-rw-r--r--drivers/video/cfb_console.c (renamed from drivers/cfb_console.c)0
-rw-r--r--drivers/video/ct69000.c (renamed from drivers/ct69000.c)0
-rw-r--r--drivers/video/sed13806.c (renamed from drivers/sed13806.c)0
-rw-r--r--drivers/video/sed156x.c (renamed from drivers/sed156x.c)0
-rw-r--r--drivers/video/sm501.c (renamed from drivers/sm501.c)0
-rw-r--r--drivers/video/smiLynxEM.c (renamed from drivers/smiLynxEM.c)0
-rw-r--r--drivers/video/videomodes.c (renamed from drivers/videomodes.c)0
-rw-r--r--drivers/video/videomodes.h (renamed from drivers/videomodes.h)0
-rw-r--r--examples/smc91111_eeprom.c2
-rw-r--r--include/configs/sbc2410x.h1
-rw-r--r--include/configs/smdk2410.h1
-rw-r--r--include/fdt.h19
-rw-r--r--include/fdt_support.h16
-rw-r--r--include/libfdt.h715
-rw-r--r--lib_arm/board.c4
-rw-r--r--lib_blackfin/board.c2
-rw-r--r--libfdt/Makefile2
-rw-r--r--libfdt/fdt.c102
-rw-r--r--libfdt/fdt_ro.c735
-rw-r--r--libfdt/fdt_rw.c271
-rw-r--r--libfdt/fdt_strerror.c59
-rw-r--r--libfdt/fdt_sw.c97
-rw-r--r--libfdt/fdt_wip.c94
-rw-r--r--libfdt/libfdt_internal.h81
-rw-r--r--nand_spl/board/amcc/acadia/Makefile2
-rw-r--r--nand_spl/board/amcc/bamboo/Makefile2
-rw-r--r--nand_spl/board/amcc/sequoia/Makefile2
-rw-r--r--tools/scripts/define2mk.sed29
295 files changed, 2818 insertions, 1169 deletions
diff --git a/CHANGELOG b/CHANGELOG
index bc8c01e..015a4ac 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,311 @@
+commit a5f601fd1b1278deae5aa9fc27a232b0d1c1c788
+Author: Wolfgang Denk <wd@denx.de>
+Date: Mon Nov 26 19:18:21 2007 +0100
+
+ Cleanup coding style; update CHANGELOG
+
+ Signed-off-by: Wolfgang Denk <wd@denx.de>
+
+commit 3deca9d44767efd1b83f4b701f0dbf21a7595f7b
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sun Nov 25 22:39:25 2007 +0100
+
+ MAKEALL: add missing 512x boards in ppc
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit a340c325e668ca7386c2276387681720be9c3757
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+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 <plagnioj@jcrosoft.com>
+
+commit 87ddedd6ad804427ce125ceaa076d7a4f74e9d5d
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+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 <plagnioj@jcrosoft.com>
+
+commit 59829cc189378c142c13d2aa8d9a897d8bef3961
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 21:26:56 2007 +0100
+
+ drivers/mtd : move mtd drivers to drivers/mtd
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 318c0b90431f2648552e5ade78833f42652ce859
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 21:17:55 2007 +0100
+
+ drivers/misc : move misc drivers to drivers/misc
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 33daf5b7858807cb4ce4158c2c56524671c14c08
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 21:13:59 2007 +0100
+
+ drivers/block : move block drivers to drivers/block
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 0c698dcaa70275eb8814f665b545547cee013892
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 20:59:50 2007 +0100
+
+ drivers/rtc : move rtc drivers to drivers/rtc
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit f868cc5a50757d94f36c312395481cb0f187d9e6
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+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 <plagnioj@jcrosoft.com>
+
+commit 16b195c82a18cbfd164800f17a1ef9db2e48331a
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 19:46:45 2007 +0100
+
+ drivers/input : move input drivers to drivers/input
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit e4558666293364fc3af1c1d9381ca933fa0f1275
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 19:40:11 2007 +0100
+
+ drivers/usb : move usb drivers to drivers/usb
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 1378df792a7ff3abd1bf54a63f5475784f5b083c
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Sat Nov 24 19:33:38 2007 +0100
+
+ drivers/serial : move serial drivers to drivers/serial
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 2439e4bfa111babf4bc07ba20efbf3e36036813e
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Wed Nov 21 21:19:24 2007 +0100
+
+ drivers/net : move net drivers to drivers/net
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 352d259130b349fe9593b8dada641bd78a9659e5
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Tue Nov 20 20:41:48 2007 +0100
+
+ drivers/video : move video drivers to drivers/video
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 73646217186aa17afc8e305c5f06f06dd335eaad
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Tue Nov 20 20:33:09 2007 +0100
+
+ drivers/pcmcia : move pcmcia drivers to drivers/pcmcia
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 93a686ee9c5ddc6fa368c32cfbfde6f6724599fc
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Tue Nov 20 20:28:09 2007 +0100
+
+ drivers/pci : move pci drivers to drivers/pci
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 9162352817579840d7802da6d85872b3ca003c97
+Author: Gerald Van Baren <vanbaren@cideas.com>
+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 <vanbaren@cideas.com>
+
+commit 9eb77cea1fa12d5969eb26a1d1d81da381bd6b1c
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit ab544633abdd14f4dd5d92e500b73eb59ef57e67
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit dbaf07ce620aab249e3502b20a986234a6af1d3a
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit 8d04f02f6224e6983f4812ea4da704950ec8539c
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit e93becf80d732b64aef81b23e8b6ece02c40533d
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit f738b4a75998f42a7408defadc9baac7a31c92db
+Author: Kumar Gala <galak@kernel.crashing.org>
+Date: Thu Oct 25 16:15:07 2007 -0500
+
+ Make no options to fdt print default to '/'
+
+ Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
+
+commit a3c2933e02503fe36ade2c1b65af46f2b7a168e7
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit 98e2867cc85409b919f862e6c16026461ec955df
+Author: Grant Likely <grant.likely@secretlab.ca>
+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 <grant.likely@secretlab.ca>
+
+commit ed1353d74b9ce8a7fcd660570b848a184d614b5f
+Author: Kumar Gala <galak@kernel.crashing.org>
+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 <galak@kernel.crashing.org>
+
+commit 4a43719a7738712811d822ca8125427b27a55cdc
+Author: Grant Likely <grant.likely@secretlab.ca>
+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 <grant.likely@secretlab.ca>
+
+commit 2f155f6c0a1f5e9a306a3f1f4fbe067db7ced3b1
+Author: Grant Likely <grant.likely@secretlab.ca>
+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 <grant.likely@secretlab.ca>
+
+commit 080c646dbf474a109c3f85718fb01ce042a38c45
+Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Tue Nov 20 20:14:18 2007 +0100
+
+ drivers/i2c : move i2c drivers to drivers/i2c
+
+ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+commit 9a337ddc154a10a26f117fd147b009abcdeba75a
+Author: Wolfgang Denk <wd@denx.de>
+Date: Mon Nov 19 22:20:24 2007 +0100
+
+ Prepare for 1.3.0 release.
+
+ Signed-off-by: Wolfgang Denk <wd@denx.de>
+
commit f30ad49b16bf998b03c1a5228b6c86369d61c258
Author: Haiying Wang <Haiying.Wang@freescale.com>
Date: Mon Nov 19 10:02:13 2007 -0500
@@ -345,6 +653,76 @@ Date: Wed Nov 7 08:19:19 2007 +0100
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+commit 4d4faae65e115e327425cd514c1a35146a85166b
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:31 2007 -0600
+
+ Group PCI and PCMCIA drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit 5798f87dc10a496d79d3177b9f5a76488987fd35
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:31 2007 -0600
+
+ Group block/flash drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit df58c81551700f058b44cacf55a7997fa63bfe0a
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:31 2007 -0600
+
+ Group USB drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit 5dbb6ed622e539b0c8493ef7e578d3a533181d29
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:30 2007 -0600
+
+ Group i2c drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit ec00c76de0e5971273905998d62d6bb119324218
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:30 2007 -0600
+
+ Group console drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit 754f230aa01b8c789fc31f8013c2487954073300
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:30 2007 -0600
+
+ Group network drivers in drivers/Makefile
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit f0037c56b0d12cd46215124667b9f83d60ef9391
+Author: Grant Likely <grant.likely@secretlab.ca>
+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_<blah>) += ' will
+ be less invasive and easier to review
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+
+commit 1b4aaffe4fb2a5e95d9111a5d94fd1f89215dce4
+Author: Grant Likely <grant.likely@secretlab.ca>
+Date: Mon Sep 24 09:05:30 2007 -0600
+
+ Add .gitignore files
+
+ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+ Acked-by: Kim Phillips <kim.phillips@freescale.com>
+
commit 955413f35f054a82e40042f1dbcf501c6a05719b
Author: Grant Likely <grant.likely@secretlab.ca>
Date: Thu Nov 15 08:27:52 2007 -0700
diff --git a/MAKEALL b/MAKEALL
index 7543d70..fce70eb 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -378,6 +378,7 @@ LIST_7xx=" \
LIST_ppc=" \
${LIST_5xx} \
+ ${LIST_512x} \
${LIST_5xxx} \
${LIST_8xx} \
${LIST_8220} \
diff --git a/Makefile b/Makefile
index fd973f8..76f35a4 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
@@ -208,22 +208,30 @@ LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs
fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
LIBS += net/libnet.a
LIBS += disk/libdisk.a
-LIBS += rtc/librtc.a
-LIBS += dtt/libdtt.a
-LIBS += drivers/libdrivers.a
LIBS += drivers/bios_emulator/libatibiosemu.a
-LIBS += drivers/nand/libnand.a
-LIBS += drivers/nand_legacy/libnand_legacy.a
-LIBS += drivers/onenand/libonenand.a
+LIBS += drivers/block/libblock.a
+LIBS += drivers/hwmon/libhwmon.a
+LIBS += drivers/i2c/libi2c.a
+LIBS += drivers/input/libinput.a
+LIBS += drivers/misc/libmisc.a
+LIBS += drivers/mtd/libmtd.a
+LIBS += drivers/mtd/nand/libnand.a
+LIBS += drivers/mtd/nand_legacy/libnand_legacy.a
+LIBS += drivers/mtd/onenand/libonenand.a
LIBS += drivers/net/libnet.a
+LIBS += drivers/net/sk98lin/libsk98lin.a
+LIBS += drivers/pci/libpci.a
+LIBS += drivers/pcmcia/libpcmcia.a
ifeq ($(CPU),mpc83xx)
LIBS += drivers/qe/qe.a
endif
ifeq ($(CPU),mpc85xx)
LIBS += drivers/qe/qe.a
endif
+LIBS += drivers/rtc/librtc.a
LIBS += drivers/serial/libserial.a
-LIBS += drivers/sk98lin/libsk98lin.a
+LIBS += drivers/usb/libusb.a
+LIBS += drivers/video/libvideo.a
LIBS += post/libpost.a post/drivers/libpostdrivers.a
LIBS += $(shell if [ -d post/lib_$(ARCH) ]; then echo \
"post/lib_$(ARCH)/libpost$(ARCH).a"; fi)
@@ -326,25 +334,65 @@ env:
depend dep: version
for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
+TAG_SUBDIRS += include
+TAG_SUBDIRS += lib_generic board/$(BOARDDIR)
+TAG_SUBDIRS += cpu/$(CPU)
+TAG_SUBDIRS += lib_$(ARCH)
+TAG_SUBDIRS += fs/cramfs
+TAG_SUBDIRS += fs/fat
+TAG_SUBDIRS += fs/fdos
+TAG_SUBDIRS += fs/jffs2
+TAG_SUBDIRS += net
+TAG_SUBDIRS += disk
+TAG_SUBDIRS += common
+TAG_SUBDIRS += drivers/bios_emulator
+TAG_SUBDIRS += drivers/block
+TAG_SUBDIRS += drivers/hwmon
+TAG_SUBDIRS += drivers/i2c
+TAG_SUBDIRS += drivers/input
+TAG_SUBDIRS += drivers/misc
+TAG_SUBDIRS += drivers/mtd
+TAG_SUBDIRS += drivers/mtd/nand
+TAG_SUBDIRS += drivers/mtd/nand_legacy
+TAG_SUBDIRS += drivers/mtd/onenand
+TAG_SUBDIRS += drivers/net
+TAG_SUBDIRS += drivers/net/sk98lin
+TAG_SUBDIRS += drivers/pci
+TAG_SUBDIRS += drivers/pcmcia
+TAG_SUBDIRS += drivers/qe
+TAG_SUBDIRS += drivers/rtc
+TAG_SUBDIRS += drivers/serial
+TAG_SUBDIRS += drivers/usb
+TAG_SUBDIRS += drivers/video
+
tags ctags:
- ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \
- lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
- fs/cramfs fs/fat fs/fdos fs/jffs2 \
- net disk rtc dtt drivers drivers/sk98lin common \
- \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
+ ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \
+ -name '*.[ch]' -print`
etags:
- etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \
- lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
- fs/cramfs fs/fat fs/fdos fs/jffs2 \
- net disk rtc dtt drivers drivers/sk98lin common \
- \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
+ etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) $(TAG_SUBDIRS) \
+ -name '*.[ch]' -print`
$(obj)System.map: $(obj)u-boot
@$(NM) $< | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(obj)System.map
+#
+# Auto-generate the autoconf.mk file (which is included by all makefiles)
+#
+# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
+# the dep file is only include in this top level makefile to determine when
+# to regenerate the autoconf.mk file.
+$(OBJTREE)/include/autoconf.mk: $(obj)include/config.h
+ @echo Generating include/autoconf.mk
+ @# Generate the dependancies
+ @$(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -MQ $@ include/common.h > $@.dep
+ @# Extract the config macros
+ @$(CPP) $(CFLAGS) -dM include/common.h | sed -n -f tools/scripts/define2mk.sed >> $@
+
+sinclude $(OBJTREE)/include/autoconf.mk.dep
+
#########################################################################
else
all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
@@ -364,7 +412,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/board/cds/mpc8541cds/u-boot.lds b/board/cds/mpc8541cds/u-boot.lds
index dc87a12..7a5daef 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 530ba5a..b19c481 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 9285928..de0923a 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/cm5200/cm5200.c b/board/cm5200/cm5200.c
index e2ab5b8..4a86d3c 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 6bc35c7..7818a2e 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 ae94a2f..7bcdccb 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 5ca094d..a764a61 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 cf7ef90..f18e532 100644
--- a/board/freescale/mpc8360emds/pci.c
+++ b/board/freescale/mpc8360emds/pci.c
@@ -269,7 +269,7 @@ ft_pci_setup(void *blob, bd_t *bd)
int err;
int tmp[2];
- nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500");
+ nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
if (nodeoffset >= 0) {
tmp[0] = cpu_to_be32(hose[0].first_busno);
tmp[1] = cpu_to_be32(hose[0].last_busno);
diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c
index 227c492..90a1b08 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 fef3822..0de594b 100644
--- a/board/netstar/eeprom.c
+++ b/board/netstar/eeprom.c
@@ -26,7 +26,7 @@
#include <common.h>
#include <exports.h>
-#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 0ad1b66..d8ea6e5 100644
--- a/board/voiceblue/eeprom.c
+++ b/board/voiceblue/eeprom.c
@@ -26,7 +26,7 @@
#include <common.h>
#include <exports.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
diff --git a/common/Makefile b/common/Makefile
index 5c2592f..ace8cc7 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 ef15a00..d059983 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 1c3547a..94f7e08 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 241aa83..907f9a2 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -31,8 +31,6 @@
#include <asm/byteorder.h>
#include <malloc.h>
-#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 5e0f990..50ddb01 100644
--- a/common/cmd_console.c
+++ b/common/cmd_console.c
@@ -28,8 +28,6 @@
#include <command.h>
#include <devices.h>
-#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 4a42534..7511598 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 12fa9db..a053343 100644
--- a/common/cmd_dcr.c
+++ b/common/cmd_dcr.c
@@ -29,8 +29,6 @@
#include <config.h>
#include <command.h>
-#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 cb99b77..82d5ad3 100644
--- a/common/cmd_diag.c
+++ b/common/cmd_diag.c
@@ -28,8 +28,6 @@
#include <command.h>
#include <post.h>
-#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 d19f412..a29345c 100644
--- a/common/cmd_display.c
+++ b/common/cmd_display.c
@@ -24,8 +24,6 @@
#include <common.h>
#include <command.h>
-#if defined(CONFIG_CMD_DISPLAY)
-
#undef DEBUG_DISP
#define DISP_SIZE 8
@@ -78,5 +76,3 @@ U_BOOT_CMD(
" - with <string> argument: display <string> 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 d6d3aff..3d717c0 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -11,9 +11,6 @@
#include <command.h>
#include <malloc.h>
#include <asm/io.h>
-
-#if defined(CONFIG_CMD_DOC)
-
#include <linux/mtd/nftl.h>
#include <linux/mtd/doc2000.h>
@@ -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 804d467..956dc69 100644
--- a/common/cmd_dtt.c
+++ b/common/cmd_dtt.c
@@ -25,8 +25,6 @@
#include <config.h>
#include <command.h>
-#if defined(CONFIG_CMD_DTT)
-
#include <dtt.h>
#include <i2c.h>
@@ -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 63a5593..2eb7453 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 8bd2b47..f569406 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -34,8 +34,6 @@
*/
#include <common.h>
#include <part.h>
-
-#if defined(CONFIG_CMD_EXT2)
#include <config.h>
#include <command.h>
#include <image.h>
@@ -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 54f0f9f..9576cdf 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -30,11 +30,6 @@
#include <net.h>
#include <ata.h>
#include <part.h>
-
-#if defined(CONFIG_CMD_FAT)
-
-#undef DEBUG
-
#include <fat.h>
@@ -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 f9da98d..b3dbd19 100644
--- a/common/cmd_fdos.c
+++ b/common/cmd_fdos.c
@@ -31,8 +31,6 @@
#include <command.h>
#include <fdc.h>
-#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 571b8f1..629c9b4 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -28,9 +28,6 @@
#include <command.h>
#include <linux/ctype.h>
#include <linux/types.h>
-
-#ifdef CONFIG_OF_LIBFDT
-
#include <asm/global_data.h>
#include <fdt.h>
#include <libfdt.h>
@@ -47,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR;
static int fdt_valid(void);
static int fdt_parse_prop(char *pathp, char *prop, char *newval,
char *data, int *len);
-static int fdt_print(char *pathp, char *prop, int depth);
+static int fdt_print(const char *pathp, char *prop, int depth);
/*
* Flattened Device Tree command, see the help for parameter definitions.
@@ -78,7 +75,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/*
* Optional new length
*/
- len = simple_strtoul(argv[3], NULL, 16);
+ len = simple_strtoul(argv[3], NULL, 16);
if (len < fdt_totalsize(fdt)) {
printf ("New length %d < existing length %d, "
"ignoring.\n",
@@ -165,12 +162,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
pathp = argv[2];
nodep = argv[3];
- nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ nodeoffset = fdt_path_offset (fdt, pathp);
if (nodeoffset < 0) {
/*
* Not found or something else bad happened.
*/
- printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ printf ("libfdt fdt_path_offset() returned %s\n",
fdt_strerror(nodeoffset));
return 1;
}
@@ -205,12 +202,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
prop = argv[3];
newval = argv[4];
- nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ nodeoffset = fdt_path_offset (fdt, pathp);
if (nodeoffset < 0) {
/*
* Not found or something else bad happened.
*/
- printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ printf ("libfdt fdt_path_offset() returned %s\n",
fdt_strerror(nodeoffset));
return 1;
}
@@ -232,6 +229,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
char *pathp; /* path */
char *prop; /* property */
int ret; /* return value */
+ static char root[2] = "/";
/*
* list is an alias for print, but limited to 1 level
@@ -244,7 +242,10 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* Get the starting path. The root node is an oddball,
* the offset is zero and has no name.
*/
- pathp = argv[2];
+ if (argc == 2)
+ pathp = root;
+ else
+ pathp = argv[2];
if (argc > 3)
prop = argv[3];
else
@@ -265,12 +266,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* Get the path. The root node is an oddball, the offset
* is zero and has no name.
*/
- nodeoffset = fdt_find_node_by_path (fdt, argv[2]);
+ nodeoffset = fdt_path_offset (fdt, argv[2]);
if (nodeoffset < 0) {
/*
* Not found or something else bad happened.
*/
- printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ printf ("libfdt fdt_path_offset() returned %s\n",
fdt_strerror(nodeoffset));
return 1;
}
@@ -521,21 +522,21 @@ static void print_data(const void *data, int len)
switch (len) {
case 1: /* byte */
- printf("<%02x>", (*(u8 *) data) & 0xff);
+ printf("<0x%02x>", (*(u8 *) data) & 0xff);
break;
case 2: /* half-word */
- printf("<%04x>", be16_to_cpu(*(u16 *) data) & 0xffff);
+ printf("<0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff);
break;
case 4: /* word */
- printf("<%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
+ printf("<0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
break;
case 8: /* double-word */
#if __WORDSIZE == 64
- printf("<%016llx>", be64_to_cpu(*(uint64_t *) data));
+ printf("<0x%016llx>", be64_to_cpu(*(uint64_t *) data));
#else
- printf("<%08x ", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
+ printf("<0x%08x ", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
data += 4;
- printf("%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
+ printf("0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
#endif
break;
default: /* anything else... hexdump */
@@ -554,25 +555,25 @@ static void print_data(const void *data, int len)
* Recursively print (a portion of) the fdt. The depth parameter
* determines how deeply nested the fdt is printed.
*/
-static int fdt_print(char *pathp, char *prop, int depth)
+static int fdt_print(const char *pathp, char *prop, int depth)
{
- static int offstack[MAX_LEVEL];
static char tabs[MAX_LEVEL+1] =
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
- void *nodep; /* property node pointer */
+ const void *nodep; /* property node pointer */
int nodeoffset; /* node offset from libfdt */
int nextoffset; /* next node offset from libfdt */
uint32_t tag; /* tag */
int len; /* length of the property */
int level = 0; /* keep track of nesting level */
+ const struct fdt_property *fdt_prop;
- nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ nodeoffset = fdt_path_offset (fdt, pathp);
if (nodeoffset < 0) {
/*
* Not found or something else bad happened.
*/
- printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ printf ("libfdt fdt_path_offset() returned %s\n",
fdt_strerror(nodeoffset));
return 1;
}
@@ -602,45 +603,52 @@ static int fdt_print(char *pathp, char *prop, int depth)
* The user passed in a node path and no property,
* print the node and all subnodes.
*/
- offstack[0] = nodeoffset;
-
while(level >= 0) {
- tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, &pathp);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
switch(tag) {
case FDT_BEGIN_NODE:
- if(level <= depth)
+ pathp = fdt_get_name(fdt, nodeoffset, NULL);
+ if (level <= depth) {
+ if (pathp == NULL)
+ pathp = "/* NULL pointer error */";
+ if (*pathp == '\0')
+ pathp = "/"; /* root is nameless */
printf("%s%s {\n",
&tabs[MAX_LEVEL - level], pathp);
+ }
level++;
- offstack[level] = nodeoffset;
if (level >= MAX_LEVEL) {
- printf("Aaaiii <splat> nested too deep. "
- "Aborting.\n");
+ printf("Nested too deep, aborting.\n");
return 1;
}
break;
case FDT_END_NODE:
level--;
- if(level <= depth)
+ if (level <= depth)
printf("%s};\n", &tabs[MAX_LEVEL - level]);
if (level == 0) {
level = -1; /* exit the loop */
}
break;
case FDT_PROP:
- nodep = fdt_getprop (fdt, offstack[level], pathp, &len);
+ fdt_prop = fdt_offset_ptr(fdt, nodeoffset,
+ sizeof(*fdt_prop));
+ pathp = fdt_string(fdt,
+ fdt32_to_cpu(fdt_prop->nameoff));
+ len = fdt32_to_cpu(fdt_prop->len);
+ nodep = fdt_prop->data;
if (len < 0) {
printf ("libfdt fdt_getprop(): %s\n",
fdt_strerror(len));
return 1;
} else if (len == 0) {
/* the property has no value */
- if(level <= depth)
+ if (level <= depth)
printf("%s%s;\n",
&tabs[MAX_LEVEL - level],
pathp);
} else {
- if(level <= depth) {
+ if (level <= depth) {
printf("%s%s=",
&tabs[MAX_LEVEL - level],
pathp);
@@ -650,11 +658,12 @@ static int fdt_print(char *pathp, char *prop, int depth)
}
break;
case FDT_NOP:
+ printf("/* NOP */\n", &tabs[MAX_LEVEL - level]);
break;
case FDT_END:
return 1;
default:
- if(level <= depth)
+ if (level <= depth)
printf("Unknown tag 0x%08X\n", tag);
return 1;
}
@@ -692,5 +701,3 @@ U_BOOT_CMD(
" fdt print /cpus \"#address-cells\"\n"
" fdt set /cpus \"#address-cells\" \"[00 00 00 01]\"\n"
);
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 11c8857..f56443e 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -31,8 +31,6 @@
#include <dataflash.h>
#endif
-#if defined(CONFIG_CMD_FLASH)
-
#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
#include <jffs2/jffs2.h>
@@ -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 cce23ad..377a692 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 a684a58..10cab46 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -86,9 +86,6 @@
#include <i2c.h>
#include <asm/byteorder.h>
-#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 2e45b70..c38be4f 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 ae95758..d758269 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -28,8 +28,7 @@
#include <common.h>
#include <command.h>
-#if defined(CONFIG_CMD_IMMAP) && \
- (defined(CONFIG_8xx) || defined(CONFIG_8260))
+#if defined(CONFIG_8xx) || defined(CONFIG_8260)
#if defined(CONFIG_8xx)
#include <asm/8xx_immap.h>
@@ -41,9 +40,7 @@
#include <asm/iopin_8260.h>
#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 8e20517..ce98872 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -32,8 +32,6 @@
#include <config.h>
#include <command.h>
-#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 <op> [*]value2\n"
);
-#endif
diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index 513a226..efe9eb7 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -93,9 +93,6 @@
#include <jffs2/jffs2.h>
#include <linux/list.h>
#include <linux/ctype.h>
-
-#if defined(CONFIG_CMD_JFFS2)
-
#include <cramfs/cramfs_fs.h>
#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 fba8bd8..e593dbe 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 9d1d875..5982b76 100644
--- a/common/cmd_mfsl.c
+++ b/common/cmd_mfsl.c
@@ -29,8 +29,6 @@
#include <common.h>
#include <config.h>
#include <command.h>
-
-#if defined(CONFIG_CMD_MFSL)
#include <asm/asm.h>
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 3b4dc8a..f530a38 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -27,8 +27,6 @@
#include <common.h>
#include <command.h>
-
-#if defined(CONFIG_CMD_MII)
#include <miiphy.h>
#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 c0c6b8f..126b538 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -27,8 +27,6 @@
#include <common.h>
#include <command.h>
-#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 069c6d0..25c9702 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -23,9 +23,6 @@
#include <common.h>
#include <command.h>
-
-#if defined(CONFIG_CMD_MMC)
-
#include <mmc.h>
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 0715fbc..21682c0 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -28,8 +28,6 @@
#include <command.h>
#include <net.h>
-#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 8be6da9..82d9717 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -30,16 +30,11 @@
*/
#include <common.h>
-
-#ifdef CONFIG_PCI
-
#include <command.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <pci.h>
-#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 bfe33e3..a06cac0 100644
--- a/common/cmd_portio.c
+++ b/common/cmd_portio.c
@@ -30,8 +30,6 @@
#include <common.h>
#include <command.h>
-#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 17e9cd9..bb6aa30 100644
--- a/common/cmd_reginfo.c
+++ b/common/cmd_reginfo.c
@@ -33,8 +33,6 @@
#include <mpc5xxx.h>
#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 1ba3929..b7395d7 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -27,8 +27,6 @@
* Reiserfs support
*/
#include <common.h>
-
-#if defined(CONFIG_CMD_REISER)
#include <config.h>
#include <command.h>
#include <image.h>
@@ -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 b2d4eb6..1cdec15 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -34,8 +34,6 @@
#include <image.h>
#include <pci.h>
-#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 3118d27..7604422 100644
--- a/common/cmd_spi.c
+++ b/common/cmd_spi.c
@@ -29,8 +29,6 @@
#include <command.h>
#include <spi.h>
-#if defined(CONFIG_CMD_SPI)
-
/*-----------------------------------------------------------------------
* Definitions
*/
@@ -139,5 +137,3 @@ U_BOOT_CMD(
"<bit_len> - Number of bits to send (base 10)\n"
"<dout> - Hexadecimal string that gets sent\n"
);
-
-#endif
diff --git a/common/cmd_universe.c b/common/cmd_universe.c
index 8bf0b1f..ea97782 100644
--- a/common/cmd_universe.c
+++ b/common/cmd_universe.c
@@ -28,8 +28,6 @@
#include <universe.h>
-#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 45e07f1..c6b17c2 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -29,9 +29,6 @@
#include <command.h>
#include <asm/byteorder.h>
#include <part.h>
-
-#if defined(CONFIG_CMD_USB)
-
#include <usb.h>
#ifdef CONFIG_USB_STORAGE
@@ -608,12 +605,6 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
-
-#endif
-
-
-#if defined(CONFIG_CMD_USB)
-
#ifdef CONFIG_USB_STORAGE
U_BOOT_CMD(
usb, 5, 1, do_usb,
@@ -645,4 +636,3 @@ U_BOOT_CMD(
"usb info [dev] - show available USB devices\n"
);
#endif
-#endif
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 175d59e..c67bb3d 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -44,6 +44,32 @@ struct fdt_header *fdt;
/********************************************************************/
+/**
+ * fdt_find_and_setprop: Find a node and set it's property
+ *
+ * @fdt: ptr to device tree
+ * @node: path of node
+ * @prop: property name
+ * @val: ptr to new value
+ * @len: length of new property value
+ * @create: flag to create the property if it doesn't exist
+ *
+ * Convenience function to directly set a property given the path to the node.
+ */
+int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
+ const void *val, int len, int create)
+{
+ int nodeoff = fdt_path_offset(fdt, node);
+
+ if (nodeoff < 0)
+ return nodeoff;
+
+ if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL))
+ return 0; /* create flag not set; so exit quietly */
+
+ return fdt_setprop(fdt, nodeoff, prop, val, len);
+}
+
int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
{
int nodeoffset;
@@ -58,34 +84,23 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
}
if (initrd_start && initrd_end) {
- struct fdt_reserve_entry re;
- int used;
- int total;
+ uint64_t addr, size;
+ int total = fdt_num_mem_rsv(fdt);
int j;
- err = fdt_num_reservemap(fdt, &used, &total);
- if (err < 0) {
- printf("fdt_chosen: %s\n", fdt_strerror(err));
- return err;
- }
- if (used >= total) {
- printf("WARNING: "
- "no room in the reserved map (%d of %d)\n",
- used, total);
- return -1;
- }
/*
* Look for an existing entry and update it. If we don't find
* the entry, we will j be the next available slot.
*/
- for (j = 0; j < used; j++) {
- err = fdt_get_reservemap(fdt, j, &re);
- if (re.address == initrd_start) {
+ for (j = 0; j < total; j++) {
+ err = fdt_get_mem_rsv(fdt, j, &addr, &size);
+ if (addr == initrd_start) {
+ fdt_del_mem_rsv(fdt, j);
break;
}
}
- err = fdt_replace_reservemap_entry(fdt, j,
- initrd_start, initrd_end - initrd_start + 1);
+
+ err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start + 1);
if (err < 0) {
printf("fdt_chosen: %s\n", fdt_strerror(err));
return err;
@@ -95,7 +110,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
/*
* Find the "chosen" node.
*/
- nodeoffset = fdt_find_node_by_path (fdt, "/chosen");
+ nodeoffset = fdt_path_offset (fdt, "/chosen");
/*
* If we have a "chosen" node already the "force the writing"
@@ -182,7 +197,7 @@ int fdt_env(void *fdt)
* See if we already have a "u-boot-env" node, delete it if so.
* Then create a new empty node.
*/
- nodeoffset = fdt_find_node_by_path (fdt, "/u-boot-env");
+ nodeoffset = fdt_path_offset (fdt, "/u-boot-env");
if (nodeoffset >= 0) {
err = fdt_del_node(fdt, nodeoffset);
if (err < 0) {
@@ -304,7 +319,7 @@ int fdt_bd_t(void *fdt)
* See if we already have a "bd_t" node, delete it if so.
* Then create a new empty node.
*/
- nodeoffset = fdt_find_node_by_path (fdt, "/bd_t");
+ nodeoffset = fdt_path_offset (fdt, "/bd_t");
if (nodeoffset >= 0) {
err = fdt_del_node(fdt, nodeoffset);
if (err < 0) {
@@ -348,4 +363,128 @@ int fdt_bd_t(void *fdt)
}
#endif /* ifdef CONFIG_OF_HAS_BD_T */
+void do_fixup_by_path(void *fdt, const char *path, const char *prop,
+ const void *val, int len, int create)
+{
+#if defined(DEBUG)
+ int i;
+ debug("Updating property '%s/%s' = ", node, prop);
+ for (i = 0; i < len; i++)
+ debug(" %.2x", *(u8*)(val+i));
+ debug("\n");
+#endif
+ int rc = fdt_find_and_setprop(fdt, path, prop, val, len, create);
+ if (rc)
+ printf("Unable to update property %s:%s, err=%s\n",
+ path, prop, fdt_strerror(rc));
+}
+
+void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
+ u32 val, int create)
+{
+ val = cpu_to_fdt32(val);
+ do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
+}
+
+void do_fixup_by_prop(void *fdt,
+ const char *pname, const void *pval, int plen,
+ const char *prop, const void *val, int len,
+ int create)
+{
+ int off;
+#if defined(DEBUG)
+ int i;
+ debug("Updating property '%s/%s' = ", node, prop);
+ for (i = 0; i < len; i++)
+ debug(" %.2x", *(u8*)(val+i));
+ debug("\n");
+#endif
+ off = fdt_node_offset_by_prop_value(fdt, -1, pname, pval, plen);
+ while (off != -FDT_ERR_NOTFOUND) {
+ if (create || (fdt_get_property(fdt, off, prop, 0) != NULL))
+ fdt_setprop(fdt, off, prop, val, len);
+ off = fdt_node_offset_by_prop_value(fdt, off, pname, pval, plen);
+ }
+}
+
+void do_fixup_by_prop_u32(void *fdt,
+ const char *pname, const void *pval, int plen,
+ const char *prop, u32 val, int create)
+{
+ val = cpu_to_fdt32(val);
+ do_fixup_by_prop(fdt, pname, pval, plen, prop, &val, 4, create);
+}
+
+void do_fixup_by_compat(void *fdt, const char *compat,
+ const char *prop, const void *val, int len, int create)
+{
+ int off = -1;
+#if defined(DEBUG)
+ int i;
+ debug("Updating property '%s/%s' = ", node, prop);
+ for (i = 0; i < len; i++)
+ debug(" %.2x", *(u8*)(val+i));
+ debug("\n");
+#endif
+ off = fdt_node_offset_by_compatible(fdt, -1, compat);
+ while (off != -FDT_ERR_NOTFOUND) {
+ if (create || (fdt_get_property(fdt, off, prop, 0) != NULL))
+ fdt_setprop(fdt, off, prop, val, len);
+ off = fdt_node_offset_by_compatible(fdt, off, compat);
+ }
+}
+
+void do_fixup_by_compat_u32(void *fdt, const char *compat,
+ const char *prop, u32 val, int create)
+{
+ val = cpu_to_fdt32(val);
+ do_fixup_by_compat(fdt, compat, prop, &val, 4, create);
+}
+
+void fdt_fixup_ethernet(void *fdt, bd_t *bd)
+{
+ int node;
+ const char *path;
+
+ node = fdt_path_offset(fdt, "/aliases");
+ if (node >= 0) {
+#if defined(CONFIG_HAS_ETH0)
+ path = fdt_getprop(fdt, node, "ethernet0", NULL);
+ if (path) {
+ do_fixup_by_path(fdt, path, "mac-address",
+ bd->bi_enetaddr, 6, 0);
+ do_fixup_by_path(fdt, path, "local-mac-address",
+ bd->bi_enetaddr, 6, 1);
+ }
+#endif
+#if defined(CONFIG_HAS_ETH1)
+ path = fdt_getprop(fdt, node, "ethernet1", NULL);
+ if (path) {
+ do_fixup_by_path(fdt, path, "mac-address",
+ bd->bi_enet1addr, 6, 0);
+ do_fixup_by_path(fdt, path, "local-mac-address",
+ bd->bi_enet1addr, 6, 1);
+ }
+#endif
+#if defined(CONFIG_HAS_ETH2)
+ path = fdt_getprop(fdt, node, "ethernet2", NULL);
+ if (path) {
+ do_fixup_by_path(fdt, path, "mac-address",
+ bd->bi_enet2addr, 6, 0);
+ do_fixup_by_path(fdt, path, "local-mac-address",
+ bd->bi_enet2addr, 6, 1);
+ }
+#endif
+#if defined(CONFIG_HAS_ETH3)
+ path = fdt_getprop(fdt, node, "ethernet3", NULL);
+ if (path) {
+ do_fixup_by_path(fdt, path, "mac-address",
+ bd->bi_enet3addr, 6, 0);
+ do_fixup_by_path(fdt, path, "local-mac-address",
+ bd->bi_enet3addr, 6, 1);
+ }
+#endif
+ }
+}
+
#endif /* CONFIG_OF_LIBFDT */
diff --git a/config.mk b/config.mk
index 37d61a0..79e5a31 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/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
index 7f16b92..e4d6168 100644
--- a/cpu/mpc5xxx/cpu.c
+++ b/cpu/mpc5xxx/cpu.c
@@ -35,6 +35,7 @@
#if defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#include <libfdt_env.h>
+#include <fdt_support.h>
#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 c2b753d..55e61a1 100644
--- a/cpu/mpc8260/cpu.c
+++ b/cpu/mpc8260/cpu.c
@@ -50,6 +50,7 @@
#if defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#include <libfdt_env.h>
+#include <fdt_support.h>
#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/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index e634f0a..b2c35d3 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 5675afe..0defb0e 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/drivers/Makefile b/drivers/Makefile
deleted file mode 100755
index bd4349e..0000000
--- a/drivers/Makefile
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# (C) Copyright 2000-2007
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-# CFLAGS += -DET_DEBUG -DDEBUG
-
-LIB = $(obj)libdrivers.a
-
-COBJS-y += ali512x.o
-COBJS-y += ds1722.o
-COBJS-y += ns87308.o
-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
-
-#
-# 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
-COBJS-y += ns16550.o
-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 += serial_sh.o
-COBJS-y += sm501.o
-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
-#
-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
-
-#
-# 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
-COBJS-y += marubun_pcmcia.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
-#
-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/block/Makefile b/drivers/block/Makefile
new file mode 100644
index 0000000..e069969
--- /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
index 3d82c62..3d82c62 100644
--- a/drivers/ahci.c
+++ b/drivers/block/ahci.c
diff --git a/drivers/ata_piix.c b/drivers/block/ata_piix.c
index 42456d7..42456d7 100644
--- a/drivers/ata_piix.c
+++ b/drivers/block/ata_piix.c
diff --git a/drivers/sil680.c b/drivers/block/sil680.c
index a6143df..a6143df 100644
--- a/drivers/sil680.c
+++ b/drivers/block/sil680.c
diff --git a/drivers/sym53c8xx.c b/drivers/block/sym53c8xx.c
index 29eeccd..29eeccd 100644
--- a/drivers/sym53c8xx.c
+++ b/drivers/block/sym53c8xx.c
diff --git a/drivers/systemace.c b/drivers/block/systemace.c
index 7d82c27..7d82c27 100644
--- a/drivers/systemace.c
+++ b/drivers/block/systemace.c
diff --git a/dtt/Makefile b/drivers/hwmon/Makefile
index 72e5c88..cebb2ba 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
index 9f65cfb..9f65cfb 100644
--- a/dtt/adm1021.c
+++ b/drivers/hwmon/adm1021.c
diff --git a/dtt/ds1621.c b/drivers/hwmon/ds1621.c
index 4948181..4948181 100644
--- a/dtt/ds1621.c
+++ b/drivers/hwmon/ds1621.c
diff --git a/drivers/ds1722.c b/drivers/hwmon/ds1722.c
index c19ee01..c19ee01 100644
--- a/drivers/ds1722.c
+++ b/drivers/hwmon/ds1722.c
diff --git a/dtt/ds1775.c b/drivers/hwmon/ds1775.c
index e44cee3..e44cee3 100644
--- a/dtt/ds1775.c
+++ b/drivers/hwmon/ds1775.c
diff --git a/dtt/lm75.c b/drivers/hwmon/lm75.c
index 63f3b75..63f3b75 100644
--- a/dtt/lm75.c
+++ b/drivers/hwmon/lm75.c
diff --git a/dtt/lm81.c b/drivers/hwmon/lm81.c
index 03bc53d..03bc53d 100644
--- a/dtt/lm81.c
+++ b/drivers/hwmon/lm81.c
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
new file mode 100644
index 0000000..29d6c03
--- /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
index 22485ea..22485ea 100644
--- a/drivers/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
diff --git a/drivers/omap1510_i2c.c b/drivers/i2c/omap1510_i2c.c
index 04400fb..04400fb 100644
--- a/drivers/omap1510_i2c.c
+++ b/drivers/i2c/omap1510_i2c.c
diff --git a/drivers/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 7dab786..7dab786 100644
--- a/drivers/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
diff --git a/drivers/tsi108_i2c.c b/drivers/i2c/tsi108_i2c.c
index d6736b0..d6736b0 100644
--- a/drivers/tsi108_i2c.c
+++ b/drivers/i2c/tsi108_i2c.c
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
new file mode 100644
index 0000000..df22cf9
--- /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
index 22c2a4e..22c2a4e 100644
--- a/drivers/i8042.c
+++ b/drivers/input/i8042.c
diff --git a/drivers/keyboard.c b/drivers/input/keyboard.c
index 9975202..9975202 100644
--- a/drivers/keyboard.c
+++ b/drivers/input/keyboard.c
diff --git a/drivers/pc_keyb.c b/drivers/input/pc_keyb.c
index 81d3e98..81d3e98 100644
--- a/drivers/pc_keyb.c
+++ b/drivers/input/pc_keyb.c
diff --git a/drivers/ps2mult.c b/drivers/input/ps2mult.c
index 9515a0f..9515a0f 100644
--- a/drivers/ps2mult.c
+++ b/drivers/input/ps2mult.c
diff --git a/drivers/ps2ser.c b/drivers/input/ps2ser.c
index 4e304f7..4e304f7 100644
--- a/drivers/ps2ser.c
+++ b/drivers/input/ps2ser.c
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
new file mode 100644
index 0000000..78cec21
--- /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
index 7b7edc0..7b7edc0 100644
--- a/drivers/ali512x.c
+++ b/drivers/misc/ali512x.c
diff --git a/drivers/ns87308.c b/drivers/misc/ns87308.c
index cf4d359..cf4d359 100644
--- a/drivers/ns87308.c
+++ b/drivers/misc/ns87308.c
diff --git a/drivers/status_led.c b/drivers/misc/status_led.c
index ddb6c22..ddb6c22 100644
--- a/drivers/status_led.c
+++ b/drivers/misc/status_led.c
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
new file mode 100644
index 0000000..95c5e02
--- /dev/null
+++ b/drivers/mtd/Makefile
@@ -0,0 +1,49 @@
+#
+# (C) Copyright 2000-2007
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB := $(obj)libmtd.a
+
+COBJS-y += at45.o
+COBJS-y += cfi_flash.o
+COBJS-y += dataflash.o
+COBJS-y += mw_eeprom.o
+
+COBJS := $(COBJS-y)
+SRCS := $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+
+all: $(LIB)
+
+$(LIB): $(obj).depend $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/drivers/at45.c b/drivers/mtd/at45.c
index dac987a..dac987a 100644
--- a/drivers/at45.c
+++ b/drivers/mtd/at45.c
diff --git a/drivers/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5579a1e..5579a1e 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
diff --git a/drivers/dataflash.c b/drivers/mtd/dataflash.c
index 91903c8..91903c8 100644
--- a/drivers/dataflash.c
+++ b/drivers/mtd/dataflash.c
diff --git a/drivers/mw_eeprom.c b/drivers/mtd/mw_eeprom.c
index 2b33488..2b33488 100644
--- a/drivers/mw_eeprom.c
+++ b/drivers/mtd/mw_eeprom.c
diff --git a/drivers/nand/Makefile b/drivers/mtd/nand/Makefile
index 42864f9..42864f9 100644
--- a/drivers/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
diff --git a/drivers/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index e17af70..e17af70 100644
--- a/drivers/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
diff --git a/drivers/nand/nand.c b/drivers/mtd/nand/nand.c
index 27b5792..27b5792 100644
--- a/drivers/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
diff --git a/drivers/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 151f535..151f535 100644
--- a/drivers/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
diff --git a/drivers/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 19a9bc2..19a9bc2 100644
--- a/drivers/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
diff --git a/drivers/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index 4c532b0..4c532b0 100644
--- a/drivers/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
diff --git a/drivers/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index 6d7e347..6d7e347 100644
--- a/drivers/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
diff --git a/drivers/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 4fd4e16..4fd4e16 100644
--- a/drivers/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
diff --git a/drivers/nand_legacy/Makefile b/drivers/mtd/nand_legacy/Makefile
index 95314d8..95314d8 100644
--- a/drivers/nand_legacy/Makefile
+++ b/drivers/mtd/nand_legacy/Makefile
diff --git a/drivers/nand_legacy/nand_legacy.c b/drivers/mtd/nand_legacy/nand_legacy.c
index 49d2ebb..49d2ebb 100644
--- a/drivers/nand_legacy/nand_legacy.c
+++ b/drivers/mtd/nand_legacy/nand_legacy.c
diff --git a/drivers/onenand/Makefile b/drivers/mtd/onenand/Makefile
index 2049413..2049413 100644
--- a/drivers/onenand/Makefile
+++ b/drivers/mtd/onenand/Makefile
diff --git a/drivers/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 7983a4a..7983a4a 100644
--- a/drivers/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
diff --git a/drivers/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index 5a610ee..5a610ee 100644
--- a/drivers/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
diff --git a/drivers/3c589.c b/drivers/net/3c589.c
index 080b686..080b686 100644
--- a/drivers/3c589.c
+++ b/drivers/net/3c589.c
diff --git a/drivers/3c589.h b/drivers/net/3c589.h
index 6735bf9..6735bf9 100644
--- a/drivers/3c589.h
+++ b/drivers/net/3c589.h
diff --git a/drivers/5701rls.c b/drivers/net/5701rls.c
index 86950d0..86950d0 100644
--- a/drivers/5701rls.c
+++ b/drivers/net/5701rls.c
diff --git a/drivers/5701rls.h b/drivers/net/5701rls.h
index 30b127a..30b127a 100644
--- a/drivers/5701rls.h
+++ b/drivers/net/5701rls.h
diff --git a/drivers/8390.h b/drivers/net/8390.h
index f087217..f087217 100644
--- a/drivers/8390.h
+++ b/drivers/net/8390.h
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 37d69b9..41e1bde 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
index c8f4064..c8f4064 100644
--- a/drivers/bcm570x.c
+++ b/drivers/net/bcm570x.c
diff --git a/drivers/bcm570x_autoneg.c b/drivers/net/bcm570x_autoneg.c
index 9023796..9023796 100644
--- a/drivers/bcm570x_autoneg.c
+++ b/drivers/net/bcm570x_autoneg.c
diff --git a/drivers/bcm570x_autoneg.h b/drivers/net/bcm570x_autoneg.h
index 7830944..7830944 100644
--- a/drivers/bcm570x_autoneg.h
+++ b/drivers/net/bcm570x_autoneg.h
diff --git a/drivers/bcm570x_bits.h b/drivers/net/bcm570x_bits.h
index 615d61e..615d61e 100644
--- a/drivers/bcm570x_bits.h
+++ b/drivers/net/bcm570x_bits.h
diff --git a/drivers/bcm570x_debug.h b/drivers/net/bcm570x_debug.h
index 88e209b..88e209b 100644
--- a/drivers/bcm570x_debug.h
+++ b/drivers/net/bcm570x_debug.h
diff --git a/drivers/bcm570x_lm.h b/drivers/net/bcm570x_lm.h
index 2ea6ca8..2ea6ca8 100644
--- a/drivers/bcm570x_lm.h
+++ b/drivers/net/bcm570x_lm.h
diff --git a/drivers/bcm570x_mm.h b/drivers/net/bcm570x_mm.h
index ff5302f..ff5302f 100644
--- a/drivers/bcm570x_mm.h
+++ b/drivers/net/bcm570x_mm.h
diff --git a/drivers/bcm570x_queue.h b/drivers/net/bcm570x_queue.h
index 336b3ca..336b3ca 100644
--- a/drivers/bcm570x_queue.h
+++ b/drivers/net/bcm570x_queue.h
diff --git a/drivers/cs8900.c b/drivers/net/cs8900.c
index 80c4ba2..80c4ba2 100644
--- a/drivers/cs8900.c
+++ b/drivers/net/cs8900.c
diff --git a/drivers/cs8900.h b/drivers/net/cs8900.h
index f886d10..f886d10 100644
--- a/drivers/cs8900.h
+++ b/drivers/net/cs8900.h
diff --git a/drivers/dc2114x.c b/drivers/net/dc2114x.c
index d5275dc..d5275dc 100644
--- a/drivers/dc2114x.c
+++ b/drivers/net/dc2114x.c
diff --git a/drivers/dm9000x.c b/drivers/net/dm9000x.c
index 6131b5c..6131b5c 100644
--- a/drivers/dm9000x.c
+++ b/drivers/net/dm9000x.c
diff --git a/drivers/dm9000x.h b/drivers/net/dm9000x.h
index f47ff8c..f47ff8c 100644
--- a/drivers/dm9000x.h
+++ b/drivers/net/dm9000x.h
diff --git a/drivers/e1000.c b/drivers/net/e1000.c
index f0741da..f0741da 100644
--- a/drivers/e1000.c
+++ b/drivers/net/e1000.c
diff --git a/drivers/e1000.h b/drivers/net/e1000.h
index 0fbdc90..0fbdc90 100644
--- a/drivers/e1000.h
+++ b/drivers/net/e1000.h
diff --git a/drivers/eepro100.c b/drivers/net/eepro100.c
index 738146e..738146e 100644
--- a/drivers/eepro100.c
+++ b/drivers/net/eepro100.c
diff --git a/drivers/enc28j60.c b/drivers/net/enc28j60.c
index 98303ac..98303ac 100644
--- a/drivers/enc28j60.c
+++ b/drivers/net/enc28j60.c
diff --git a/drivers/inca-ip_sw.c b/drivers/net/inca-ip_sw.c
index e4aaed6..e4aaed6 100644
--- a/drivers/inca-ip_sw.c
+++ b/drivers/net/inca-ip_sw.c
diff --git a/drivers/ks8695eth.c b/drivers/net/ks8695eth.c
index b598dd7..b598dd7 100644
--- a/drivers/ks8695eth.c
+++ b/drivers/net/ks8695eth.c
diff --git a/drivers/lan91c96.c b/drivers/net/lan91c96.c
index ecdcbd9..ecdcbd9 100644
--- a/drivers/lan91c96.c
+++ b/drivers/net/lan91c96.c
diff --git a/drivers/lan91c96.h b/drivers/net/lan91c96.h
index 7d33a82..7d33a82 100644
--- a/drivers/lan91c96.h
+++ b/drivers/net/lan91c96.h
diff --git a/drivers/macb.c b/drivers/net/macb.c
index 95cdc49..95cdc49 100644
--- a/drivers/macb.c
+++ b/drivers/net/macb.c
diff --git a/drivers/macb.h b/drivers/net/macb.h
index c778e4e..c778e4e 100644
--- a/drivers/macb.h
+++ b/drivers/net/macb.h
diff --git a/drivers/natsemi.c b/drivers/net/natsemi.c
index 075d6c5..075d6c5 100644
--- a/drivers/natsemi.c
+++ b/drivers/net/natsemi.c
diff --git a/drivers/ne2000.c b/drivers/net/ne2000.c
index c978d62..c978d62 100644
--- a/drivers/ne2000.c
+++ b/drivers/net/ne2000.c
diff --git a/drivers/ne2000.h b/drivers/net/ne2000.h
index c13d9f0..c13d9f0 100644
--- a/drivers/ne2000.h
+++ b/drivers/net/ne2000.h
diff --git a/drivers/netarm_eth.c b/drivers/net/netarm_eth.c
index a99ee5d..a99ee5d 100644
--- a/drivers/netarm_eth.c
+++ b/drivers/net/netarm_eth.c
diff --git a/drivers/netarm_eth.h b/drivers/net/netarm_eth.h
index 8edab82..8edab82 100644
--- a/drivers/netarm_eth.h
+++ b/drivers/net/netarm_eth.h
diff --git a/drivers/netconsole.c b/drivers/net/netconsole.c
index 69089f9..69089f9 100644
--- a/drivers/netconsole.c
+++ b/drivers/net/netconsole.c
diff --git a/drivers/nicext.h b/drivers/net/nicext.h
index 4074972..4074972 100644
--- a/drivers/nicext.h
+++ b/drivers/net/nicext.h
diff --git a/drivers/ns7520_eth.c b/drivers/net/ns7520_eth.c
index a5a20df..a5a20df 100644
--- a/drivers/ns7520_eth.c
+++ b/drivers/net/ns7520_eth.c
diff --git a/drivers/ns8382x.c b/drivers/net/ns8382x.c
index f8b143a..f8b143a 100644
--- a/drivers/ns8382x.c
+++ b/drivers/net/ns8382x.c
diff --git a/drivers/ns9750_eth.c b/drivers/net/ns9750_eth.c
index 067ff8e..067ff8e 100644
--- a/drivers/ns9750_eth.c
+++ b/drivers/net/ns9750_eth.c
diff --git a/drivers/pcnet.c b/drivers/net/pcnet.c
index 2af0e8f..2af0e8f 100644
--- a/drivers/pcnet.c
+++ b/drivers/net/pcnet.c
diff --git a/drivers/plb2800_eth.c b/drivers/net/plb2800_eth.c
index 0ae5d80..0ae5d80 100644
--- a/drivers/plb2800_eth.c
+++ b/drivers/net/plb2800_eth.c
diff --git a/drivers/rtl8019.c b/drivers/net/rtl8019.c
index 409a69f..409a69f 100644
--- a/drivers/rtl8019.c
+++ b/drivers/net/rtl8019.c
diff --git a/drivers/rtl8019.h b/drivers/net/rtl8019.h
index 38116ad..38116ad 100644
--- a/drivers/rtl8019.h
+++ b/drivers/net/rtl8019.h
diff --git a/drivers/rtl8139.c b/drivers/net/rtl8139.c
index 2367180..2367180 100644
--- a/drivers/rtl8139.c
+++ b/drivers/net/rtl8139.c
diff --git a/drivers/rtl8169.c b/drivers/net/rtl8169.c
index 63ea2cc..63ea2cc 100644
--- a/drivers/rtl8169.c
+++ b/drivers/net/rtl8169.c
diff --git a/drivers/s3c4510b_eth.c b/drivers/net/s3c4510b_eth.c
index 3d9066a..3d9066a 100644
--- a/drivers/s3c4510b_eth.c
+++ b/drivers/net/s3c4510b_eth.c
diff --git a/drivers/s3c4510b_eth.h b/drivers/net/s3c4510b_eth.h
index cbddba7..cbddba7 100644
--- a/drivers/s3c4510b_eth.h
+++ b/drivers/net/s3c4510b_eth.h
diff --git a/drivers/sk98lin/Makefile b/drivers/net/sk98lin/Makefile
index a7d4a3b..a7d4a3b 100644
--- a/drivers/sk98lin/Makefile
+++ b/drivers/net/sk98lin/Makefile
diff --git a/drivers/sk98lin/h/lm80.h b/drivers/net/sk98lin/h/lm80.h
index 981a4ca..981a4ca 100644
--- a/drivers/sk98lin/h/lm80.h
+++ b/drivers/net/sk98lin/h/lm80.h
diff --git a/drivers/sk98lin/h/skaddr.h b/drivers/net/sk98lin/h/skaddr.h
index 711f873..711f873 100644
--- a/drivers/sk98lin/h/skaddr.h
+++ b/drivers/net/sk98lin/h/skaddr.h
diff --git a/drivers/sk98lin/h/skcsum.h b/drivers/net/sk98lin/h/skcsum.h
index 2acae32..2acae32 100644
--- a/drivers/sk98lin/h/skcsum.h
+++ b/drivers/net/sk98lin/h/skcsum.h
diff --git a/drivers/sk98lin/h/skdebug.h b/drivers/net/sk98lin/h/skdebug.h
index cf5b5ad..cf5b5ad 100644
--- a/drivers/sk98lin/h/skdebug.h
+++ b/drivers/net/sk98lin/h/skdebug.h
diff --git a/drivers/sk98lin/h/skdrv1st.h b/drivers/net/sk98lin/h/skdrv1st.h
index af34d7b..af34d7b 100644
--- a/drivers/sk98lin/h/skdrv1st.h
+++ b/drivers/net/sk98lin/h/skdrv1st.h
diff --git a/drivers/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h
index a311827..a311827 100644
--- a/drivers/sk98lin/h/skdrv2nd.h
+++ b/drivers/net/sk98lin/h/skdrv2nd.h
diff --git a/drivers/sk98lin/h/skerror.h b/drivers/net/sk98lin/h/skerror.h
index a454d9d..a454d9d 100644
--- a/drivers/sk98lin/h/skerror.h
+++ b/drivers/net/sk98lin/h/skerror.h
diff --git a/drivers/sk98lin/h/skgedrv.h b/drivers/net/sk98lin/h/skgedrv.h
index 72ba9ce..72ba9ce 100644
--- a/drivers/sk98lin/h/skgedrv.h
+++ b/drivers/net/sk98lin/h/skgedrv.h
diff --git a/drivers/sk98lin/h/skgehw.h b/drivers/net/sk98lin/h/skgehw.h
index 2c98427..2c98427 100644
--- a/drivers/sk98lin/h/skgehw.h
+++ b/drivers/net/sk98lin/h/skgehw.h
diff --git a/drivers/sk98lin/h/skgehwt.h b/drivers/net/sk98lin/h/skgehwt.h
index 8aa9edd..8aa9edd 100644
--- a/drivers/sk98lin/h/skgehwt.h
+++ b/drivers/net/sk98lin/h/skgehwt.h
diff --git a/drivers/sk98lin/h/skgei2c.h b/drivers/net/sk98lin/h/skgei2c.h
index e639f73..e639f73 100644
--- a/drivers/sk98lin/h/skgei2c.h
+++ b/drivers/net/sk98lin/h/skgei2c.h
diff --git a/drivers/sk98lin/h/skgeinit.h b/drivers/net/sk98lin/h/skgeinit.h
index cdddef9..cdddef9 100644
--- a/drivers/sk98lin/h/skgeinit.h
+++ b/drivers/net/sk98lin/h/skgeinit.h
diff --git a/drivers/sk98lin/h/skgepnm2.h b/drivers/net/sk98lin/h/skgepnm2.h
index 5c44f47..5c44f47 100644
--- a/drivers/sk98lin/h/skgepnm2.h
+++ b/drivers/net/sk98lin/h/skgepnm2.h
diff --git a/drivers/sk98lin/h/skgepnmi.h b/drivers/net/sk98lin/h/skgepnmi.h
index 7532313..7532313 100644
--- a/drivers/sk98lin/h/skgepnmi.h
+++ b/drivers/net/sk98lin/h/skgepnmi.h
diff --git a/drivers/sk98lin/h/skgesirq.h b/drivers/net/sk98lin/h/skgesirq.h
index fc001b23..fc001b23 100644
--- a/drivers/sk98lin/h/skgesirq.h
+++ b/drivers/net/sk98lin/h/skgesirq.h
diff --git a/drivers/sk98lin/h/ski2c.h b/drivers/net/sk98lin/h/ski2c.h
index 5ffaf6e..5ffaf6e 100644
--- a/drivers/sk98lin/h/ski2c.h
+++ b/drivers/net/sk98lin/h/ski2c.h
diff --git a/drivers/sk98lin/h/skqueue.h b/drivers/net/sk98lin/h/skqueue.h
index bce20a7..bce20a7 100644
--- a/drivers/sk98lin/h/skqueue.h
+++ b/drivers/net/sk98lin/h/skqueue.h
diff --git a/drivers/sk98lin/h/skrlmt.h b/drivers/net/sk98lin/h/skrlmt.h
index 04d025b..04d025b 100644
--- a/drivers/sk98lin/h/skrlmt.h
+++ b/drivers/net/sk98lin/h/skrlmt.h
diff --git a/drivers/sk98lin/h/sktimer.h b/drivers/net/sk98lin/h/sktimer.h
index 36f8ccb..36f8ccb 100644
--- a/drivers/sk98lin/h/sktimer.h
+++ b/drivers/net/sk98lin/h/sktimer.h
diff --git a/drivers/sk98lin/h/sktypes.h b/drivers/net/sk98lin/h/sktypes.h
index e657016..e657016 100644
--- a/drivers/sk98lin/h/sktypes.h
+++ b/drivers/net/sk98lin/h/sktypes.h
diff --git a/drivers/sk98lin/h/skversion.h b/drivers/net/sk98lin/h/skversion.h
index ef46685..ef46685 100644
--- a/drivers/sk98lin/h/skversion.h
+++ b/drivers/net/sk98lin/h/skversion.h
diff --git a/drivers/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h
index 1be34c5..1be34c5 100644
--- a/drivers/sk98lin/h/skvpd.h
+++ b/drivers/net/sk98lin/h/skvpd.h
diff --git a/drivers/sk98lin/h/xmac_ii.h b/drivers/net/sk98lin/h/xmac_ii.h
index 2ef903a..2ef903a 100644
--- a/drivers/sk98lin/h/xmac_ii.h
+++ b/drivers/net/sk98lin/h/xmac_ii.h
diff --git a/drivers/sk98lin/skaddr.c b/drivers/net/sk98lin/skaddr.c
index ed79c04..ed79c04 100644
--- a/drivers/sk98lin/skaddr.c
+++ b/drivers/net/sk98lin/skaddr.c
diff --git a/drivers/sk98lin/skcsum.c b/drivers/net/sk98lin/skcsum.c
index a5dc572..a5dc572 100644
--- a/drivers/sk98lin/skcsum.c
+++ b/drivers/net/sk98lin/skcsum.c
diff --git a/drivers/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 61a6094..61a6094 100644
--- a/drivers/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
diff --git a/drivers/sk98lin/skgehwt.c b/drivers/net/sk98lin/skgehwt.c
index f8681a8..f8681a8 100644
--- a/drivers/sk98lin/skgehwt.c
+++ b/drivers/net/sk98lin/skgehwt.c
diff --git a/drivers/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c
index a18dc0a..a18dc0a 100644
--- a/drivers/sk98lin/skgeinit.c
+++ b/drivers/net/sk98lin/skgeinit.c
diff --git a/drivers/sk98lin/skgemib.c b/drivers/net/sk98lin/skgemib.c
index 4a9e9e6..4a9e9e6 100644
--- a/drivers/sk98lin/skgemib.c
+++ b/drivers/net/sk98lin/skgemib.c
diff --git a/drivers/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b5d32b0..b5d32b0 100644
--- a/drivers/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
diff --git a/drivers/sk98lin/skgesirq.c b/drivers/net/sk98lin/skgesirq.c
index e5a4f7e..e5a4f7e 100644
--- a/drivers/sk98lin/skgesirq.c
+++ b/drivers/net/sk98lin/skgesirq.c
diff --git a/drivers/sk98lin/ski2c.c b/drivers/net/sk98lin/ski2c.c
index 2ab635a..2ab635a 100644
--- a/drivers/sk98lin/ski2c.c
+++ b/drivers/net/sk98lin/ski2c.c
diff --git a/drivers/sk98lin/sklm80.c b/drivers/net/sk98lin/sklm80.c
index 687572b..687572b 100644
--- a/drivers/sk98lin/sklm80.c
+++ b/drivers/net/sk98lin/sklm80.c
diff --git a/drivers/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c
index 4e34073..4e34073 100644
--- a/drivers/sk98lin/skproc.c
+++ b/drivers/net/sk98lin/skproc.c
diff --git a/drivers/sk98lin/skqueue.c b/drivers/net/sk98lin/skqueue.c
index c49baed..c49baed 100644
--- a/drivers/sk98lin/skqueue.c
+++ b/drivers/net/sk98lin/skqueue.c
diff --git a/drivers/sk98lin/skrlmt.c b/drivers/net/sk98lin/skrlmt.c
index f8a3b41..f8a3b41 100644
--- a/drivers/sk98lin/skrlmt.c
+++ b/drivers/net/sk98lin/skrlmt.c
diff --git a/drivers/sk98lin/sktimer.c b/drivers/net/sk98lin/sktimer.c
index 37cd4c9..37cd4c9 100644
--- a/drivers/sk98lin/sktimer.c
+++ b/drivers/net/sk98lin/sktimer.c
diff --git a/drivers/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c
index 3b81e67..3b81e67 100644
--- a/drivers/sk98lin/skvpd.c
+++ b/drivers/net/sk98lin/skvpd.c
diff --git a/drivers/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index e6b5a95..e6b5a95 100644
--- a/drivers/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
diff --git a/drivers/sk98lin/u-boot_compat.h b/drivers/net/sk98lin/u-boot_compat.h
index 1e385f8..1e385f8 100644
--- a/drivers/sk98lin/u-boot_compat.h
+++ b/drivers/net/sk98lin/u-boot_compat.h
diff --git a/drivers/sk98lin/uboot_drv.c b/drivers/net/sk98lin/uboot_drv.c
index d02cd1b..d02cd1b 100644
--- a/drivers/sk98lin/uboot_drv.c
+++ b/drivers/net/sk98lin/uboot_drv.c
diff --git a/drivers/sk98lin/uboot_skb.c b/drivers/net/sk98lin/uboot_skb.c
index 3a487a8..3a487a8 100644
--- a/drivers/sk98lin/uboot_skb.c
+++ b/drivers/net/sk98lin/uboot_skb.c
diff --git a/drivers/smc91111.c b/drivers/net/smc91111.c
index 8061f12..8061f12 100644
--- a/drivers/smc91111.c
+++ b/drivers/net/smc91111.c
diff --git a/drivers/smc91111.h b/drivers/net/smc91111.h
index d03cbc3..d03cbc3 100644
--- a/drivers/smc91111.h
+++ b/drivers/net/smc91111.h
diff --git a/drivers/tigon3.c b/drivers/net/tigon3.c
index 5f6a4ec..5f6a4ec 100644
--- a/drivers/tigon3.c
+++ b/drivers/net/tigon3.c
diff --git a/drivers/tigon3.h b/drivers/net/tigon3.h
index c03347f..c03347f 100644
--- a/drivers/tigon3.h
+++ b/drivers/net/tigon3.h
diff --git a/drivers/tsec.c b/drivers/net/tsec.c
index ca6284b..ca6284b 100644
--- a/drivers/tsec.c
+++ b/drivers/net/tsec.c
diff --git a/drivers/tsec.h b/drivers/net/tsec.h
index 2f0092a..2f0092a 100644
--- a/drivers/tsec.h
+++ b/drivers/net/tsec.h
diff --git a/drivers/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 524e9da..524e9da 100644
--- a/drivers/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
diff --git a/drivers/uli526x.c b/drivers/net/uli526x.c
index 1267c57..1267c57 100644
--- a/drivers/uli526x.c
+++ b/drivers/net/uli526x.c
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
new file mode 100644
index 0000000..fe45839
--- /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
index 1e77884..1e77884 100644
--- a/drivers/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
diff --git a/drivers/pci.c b/drivers/pci/pci.c
index 50ca6b0..50ca6b0 100644
--- a/drivers/pci.c
+++ b/drivers/pci/pci.c
diff --git a/drivers/pci_auto.c b/drivers/pci/pci_auto.c
index acfda83..acfda83 100644
--- a/drivers/pci_auto.c
+++ b/drivers/pci/pci_auto.c
diff --git a/drivers/pci_indirect.c b/drivers/pci/pci_indirect.c
index a8220fb..a8220fb 100644
--- a/drivers/pci_indirect.c
+++ b/drivers/pci/pci_indirect.c
diff --git a/drivers/tsi108_pci.c b/drivers/pci/tsi108_pci.c
index d5f11e4..d5f11e4 100644
--- a/drivers/tsi108_pci.c
+++ b/drivers/pci/tsi108_pci.c
diff --git a/drivers/w83c553f.c b/drivers/pci/w83c553f.c
index 5d82ed4..5d82ed4 100644
--- a/drivers/w83c553f.c
+++ b/drivers/pci/w83c553f.c
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
new file mode 100644
index 0000000..55528c8
--- /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
index a40fcf4..a40fcf4 100644
--- a/drivers/i82365.c
+++ b/drivers/pcmcia/i82365.c
diff --git a/drivers/mpc8xx_pcmcia.c b/drivers/pcmcia/mpc8xx_pcmcia.c
index 8a34cd3..8a34cd3 100644
--- a/drivers/mpc8xx_pcmcia.c
+++ b/drivers/pcmcia/mpc8xx_pcmcia.c
diff --git a/drivers/pxa_pcmcia.c b/drivers/pcmcia/pxa_pcmcia.c
index 6020e46..6020e46 100644
--- a/drivers/pxa_pcmcia.c
+++ b/drivers/pcmcia/pxa_pcmcia.c
diff --git a/drivers/rpx_pcmcia.c b/drivers/pcmcia/rpx_pcmcia.c
index c7c425b..c7c425b 100644
--- a/drivers/rpx_pcmcia.c
+++ b/drivers/pcmcia/rpx_pcmcia.c
diff --git a/drivers/ti_pci1410a.c b/drivers/pcmcia/ti_pci1410a.c
index 208ca50..208ca50 100644
--- a/drivers/ti_pci1410a.c
+++ b/drivers/pcmcia/ti_pci1410a.c
diff --git a/drivers/tqm8xx_pcmcia.c b/drivers/pcmcia/tqm8xx_pcmcia.c
index 132c7a5..132c7a5 100644
--- a/drivers/tqm8xx_pcmcia.c
+++ b/drivers/pcmcia/tqm8xx_pcmcia.c
diff --git a/rtc/Makefile b/drivers/rtc/Makefile
index 4a22b0d..4a22b0d 100644
--- a/rtc/Makefile
+++ b/drivers/rtc/Makefile
diff --git a/rtc/bf5xx_rtc.c b/drivers/rtc/bf5xx_rtc.c
index 8856bb9..8856bb9 100644
--- a/rtc/bf5xx_rtc.c
+++ b/drivers/rtc/bf5xx_rtc.c
diff --git a/rtc/date.c b/drivers/rtc/date.c
index a83a723..a83a723 100644
--- a/rtc/date.c
+++ b/drivers/rtc/date.c
diff --git a/rtc/ds12887.c b/drivers/rtc/ds12887.c
index 84fecf0..84fecf0 100644
--- a/rtc/ds12887.c
+++ b/drivers/rtc/ds12887.c
diff --git a/rtc/ds1302.c b/drivers/rtc/ds1302.c
index 55af130..55af130 100644
--- a/rtc/ds1302.c
+++ b/drivers/rtc/ds1302.c
diff --git a/rtc/ds1306.c b/drivers/rtc/ds1306.c
index 89e433d..89e433d 100644
--- a/rtc/ds1306.c
+++ b/drivers/rtc/ds1306.c
diff --git a/rtc/ds1307.c b/drivers/rtc/ds1307.c
index c882d79..c882d79 100644
--- a/rtc/ds1307.c
+++ b/drivers/rtc/ds1307.c
diff --git a/rtc/ds1337.c b/drivers/rtc/ds1337.c
index c636ac5..c636ac5 100644
--- a/rtc/ds1337.c
+++ b/drivers/rtc/ds1337.c
diff --git a/rtc/ds1374.c b/drivers/rtc/ds1374.c
index e773dd9..e773dd9 100644
--- a/rtc/ds1374.c
+++ b/drivers/rtc/ds1374.c
diff --git a/rtc/ds1556.c b/drivers/rtc/ds1556.c
index 4365cfb..4365cfb 100644
--- a/rtc/ds1556.c
+++ b/drivers/rtc/ds1556.c
diff --git a/rtc/ds164x.c b/drivers/rtc/ds164x.c
index bff22b9..bff22b9 100644
--- a/rtc/ds164x.c
+++ b/drivers/rtc/ds164x.c
diff --git a/rtc/ds174x.c b/drivers/rtc/ds174x.c
index 5f85a68..5f85a68 100644
--- a/rtc/ds174x.c
+++ b/drivers/rtc/ds174x.c
diff --git a/rtc/ds3231.c b/drivers/rtc/ds3231.c
index fe11b86..fe11b86 100644
--- a/rtc/ds3231.c
+++ b/drivers/rtc/ds3231.c
diff --git a/rtc/m41t11.c b/drivers/rtc/m41t11.c
index 81da33a..81da33a 100644
--- a/rtc/m41t11.c
+++ b/drivers/rtc/m41t11.c
diff --git a/rtc/m48t35ax.c b/drivers/rtc/m48t35ax.c
index 0a0ffa8..0a0ffa8 100644
--- a/rtc/m48t35ax.c
+++ b/drivers/rtc/m48t35ax.c
diff --git a/rtc/max6900.c b/drivers/rtc/max6900.c
index c75a8e0..c75a8e0 100644
--- a/rtc/max6900.c
+++ b/drivers/rtc/max6900.c
diff --git a/rtc/mc146818.c b/drivers/rtc/mc146818.c
index ab377ed..ab377ed 100644
--- a/rtc/mc146818.c
+++ b/drivers/rtc/mc146818.c
diff --git a/rtc/mcfrtc.c b/drivers/rtc/mcfrtc.c
index 27386e5..27386e5 100644
--- a/rtc/mcfrtc.c
+++ b/drivers/rtc/mcfrtc.c
diff --git a/rtc/mk48t59.c b/drivers/rtc/mk48t59.c
index bacdb5b..bacdb5b 100644
--- a/rtc/mk48t59.c
+++ b/drivers/rtc/mk48t59.c
diff --git a/rtc/mpc5xxx.c b/drivers/rtc/mpc5xxx.c
index 216386a..216386a 100644
--- a/rtc/mpc5xxx.c
+++ b/drivers/rtc/mpc5xxx.c
diff --git a/rtc/mpc8xx.c b/drivers/rtc/mpc8xx.c
index 8d10c0e..8d10c0e 100644
--- a/rtc/mpc8xx.c
+++ b/drivers/rtc/mpc8xx.c
diff --git a/rtc/pcf8563.c b/drivers/rtc/pcf8563.c
index 2d73d5d..2d73d5d 100644
--- a/rtc/pcf8563.c
+++ b/drivers/rtc/pcf8563.c
diff --git a/rtc/rs5c372.c b/drivers/rtc/rs5c372.c
index 3d1346e..3d1346e 100644
--- a/rtc/rs5c372.c
+++ b/drivers/rtc/rs5c372.c
diff --git a/rtc/s3c24x0_rtc.c b/drivers/rtc/s3c24x0_rtc.c
index 7f8b4fa..7f8b4fa 100644
--- a/rtc/s3c24x0_rtc.c
+++ b/drivers/rtc/s3c24x0_rtc.c
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 40f3d67..735c630 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
index f35b997..f35b997 100644
--- a/drivers/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
diff --git a/drivers/atmel_usart.h b/drivers/serial/atmel_usart.h
index af3773a..af3773a 100644
--- a/drivers/atmel_usart.h
+++ b/drivers/serial/atmel_usart.h
diff --git a/drivers/ns16550.c b/drivers/serial/ns16550.c
index 2429464..2429464 100644
--- a/drivers/ns16550.c
+++ b/drivers/serial/ns16550.c
diff --git a/drivers/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index 02c0d39..02c0d39 100644
--- a/drivers/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
diff --git a/drivers/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index ddcd591..ddcd591 100644
--- a/drivers/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
diff --git a/drivers/s3c4510b_uart.h b/drivers/serial/s3c4510b_uart.h
index b06c76d..b06c76d 100644
--- a/drivers/s3c4510b_uart.h
+++ b/drivers/serial/s3c4510b_uart.h
diff --git a/drivers/serial.c b/drivers/serial/serial.c
index 76425d8..76425d8 100644
--- a/drivers/serial.c
+++ b/drivers/serial/serial.c
diff --git a/drivers/serial_max3100.c b/drivers/serial/serial_max3100.c
index 35c5596..35c5596 100644
--- a/drivers/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
diff --git a/drivers/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index d678ab6..d678ab6 100644
--- a/drivers/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
diff --git a/drivers/usbtty.c b/drivers/serial/usbtty.c
index a3b5013..a3b5013 100644
--- a/drivers/usbtty.c
+++ b/drivers/serial/usbtty.c
diff --git a/drivers/usbtty.h b/drivers/serial/usbtty.h
index 8154e30..8154e30 100644
--- a/drivers/usbtty.h
+++ b/drivers/serial/usbtty.h
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
new file mode 100644
index 0000000..f8ea167
--- /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
index b21af10..b21af10 100644
--- a/drivers/isp116x-hcd.c
+++ b/drivers/usb/isp116x-hcd.c
diff --git a/drivers/isp116x.h b/drivers/usb/isp116x.h
index a3ce3b5..a3ce3b5 100644
--- a/drivers/isp116x.h
+++ b/drivers/usb/isp116x.h
diff --git a/drivers/sl811.h b/drivers/usb/sl811.h
index c1f9f01..c1f9f01 100644
--- a/drivers/sl811.h
+++ b/drivers/usb/sl811.h
diff --git a/drivers/sl811_usb.c b/drivers/usb/sl811_usb.c
index b0cdf0b..c1f8427 100644
--- a/drivers/sl811_usb.c
+++ b/drivers/usb/sl811_usb.c
@@ -41,7 +41,7 @@
#include <usb.h>
#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
index cfa384e..cfa384e 100644
--- a/drivers/usb_ohci.c
+++ b/drivers/usb/usb_ohci.c
diff --git a/drivers/usb_ohci.h b/drivers/usb/usb_ohci.h
index 380cb4c..380cb4c 100644
--- a/drivers/usb_ohci.h
+++ b/drivers/usb/usb_ohci.h
diff --git a/drivers/usbdcore.c b/drivers/usb/usbdcore.c
index 308c7ce..308c7ce 100644
--- a/drivers/usbdcore.c
+++ b/drivers/usb/usbdcore.c
diff --git a/drivers/usbdcore_ep0.c b/drivers/usb/usbdcore_ep0.c
index 1e44f32..1e44f32 100644
--- a/drivers/usbdcore_ep0.c
+++ b/drivers/usb/usbdcore_ep0.c
diff --git a/drivers/usbdcore_mpc8xx.c b/drivers/usb/usbdcore_mpc8xx.c
index d4c4096..d4c4096 100644
--- a/drivers/usbdcore_mpc8xx.c
+++ b/drivers/usb/usbdcore_mpc8xx.c
diff --git a/drivers/usbdcore_omap1510.c b/drivers/usb/usbdcore_omap1510.c
index 84bb936..84bb936 100644
--- a/drivers/usbdcore_omap1510.c
+++ b/drivers/usb/usbdcore_omap1510.c
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
new file mode 100644
index 0000000..36611ec
--- /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
index 3e72a7d..3e72a7d 100644
--- a/drivers/ati_ids.h
+++ b/drivers/video/ati_ids.h
diff --git a/drivers/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 9613d80..0bdaa1c 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
index b5c4b8b..b5c4b8b 100644
--- a/drivers/ati_radeon_fb.h
+++ b/drivers/video/ati_radeon_fb.h
diff --git a/drivers/cfb_console.c b/drivers/video/cfb_console.c
index bcf8771..bcf8771 100644
--- a/drivers/cfb_console.c
+++ b/drivers/video/cfb_console.c
diff --git a/drivers/ct69000.c b/drivers/video/ct69000.c
index 29d82e4..29d82e4 100644
--- a/drivers/ct69000.c
+++ b/drivers/video/ct69000.c
diff --git a/drivers/sed13806.c b/drivers/video/sed13806.c
index 6996ca8..6996ca8 100644
--- a/drivers/sed13806.c
+++ b/drivers/video/sed13806.c
diff --git a/drivers/sed156x.c b/drivers/video/sed156x.c
index e9d5ed4..e9d5ed4 100644
--- a/drivers/sed156x.c
+++ b/drivers/video/sed156x.c
diff --git a/drivers/sm501.c b/drivers/video/sm501.c
index 23db02c..23db02c 100644
--- a/drivers/sm501.c
+++ b/drivers/video/sm501.c
diff --git a/drivers/smiLynxEM.c b/drivers/video/smiLynxEM.c
index 20f9beb..20f9beb 100644
--- a/drivers/smiLynxEM.c
+++ b/drivers/video/smiLynxEM.c
diff --git a/drivers/videomodes.c b/drivers/video/videomodes.c
index c81e5bc..c81e5bc 100644
--- a/drivers/videomodes.c
+++ b/drivers/video/videomodes.c
diff --git a/drivers/videomodes.h b/drivers/video/videomodes.h
index e2dffe7..e2dffe7 100644
--- a/drivers/videomodes.h
+++ b/drivers/video/videomodes.h
diff --git a/examples/smc91111_eeprom.c b/examples/smc91111_eeprom.c
index 98e3e86..b8a3594 100644
--- a/examples/smc91111_eeprom.c
+++ b/examples/smc91111_eeprom.c
@@ -29,7 +29,7 @@
#include <common.h>
#include <exports.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
#define EEPROM 0x1;
diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h
index b4a063a..9b05bd6 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 ca404ff..18a036c 100644
--- a/include/configs/smdk2410.h
+++ b/include/configs/smdk2410.h
@@ -88,7 +88,6 @@
#include <config_cmd_default.h>
#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_REGINFO
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF
diff --git a/include/fdt.h b/include/fdt.h
index 3dd3aca..48ccfd9 100644
--- a/include/fdt.h
+++ b/include/fdt.h
@@ -1,22 +1,3 @@
-/*
- * libfdt - Flat Device Tree manipulation
- * Copyright (C) 2006 David Gibson, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
#ifndef _FDT_H
#define _FDT_H
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 60fa423..8f781d4 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -29,6 +29,22 @@
#include <fdt.h>
int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force);
+void do_fixup_by_path(void *fdt, const char *path, const char *prop,
+ const void *val, int len, int create);
+void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
+ u32 val, int create);
+void do_fixup_by_prop(void *fdt,
+ const char *pname, const void *pval, int plen,
+ const char *prop, const void *val, int len,
+ int create);
+void do_fixup_by_prop_u32(void *fdt,
+ const char *pname, const void *pval, int plen,
+ const char *prop, u32 val, int create);
+void do_fixup_by_compat(void *fdt, const char *compat,
+ const char *prop, const void *val, int len, int create);
+void do_fixup_by_compat_u32(void *fdt, const char *compat,
+ const char *prop, u32 val, int create);
+void fdt_fixup_ethernet(void *fdt, bd_t *bd);
#ifdef CONFIG_OF_HAS_UBOOT_ENV
int fdt_env(void *fdt);
diff --git a/include/libfdt.h b/include/libfdt.h
index 38c65a9..6b2fb92 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -1,154 +1,721 @@
+#ifndef _LIBFDT_H
+#define _LIBFDT_H
/*
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ * 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.
+ *
+ * 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:
*
- * 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.
+ * 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.
*
- * 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 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 <fdt.h>
#include <libfdt_env.h>
+#include <fdt.h>
#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. */
+
+/* "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 11
+#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);
+/**
+ * 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);
-#define fdt_offset_ptr_typed(fdt, offset, var) \
- ((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
+/**********************************************************************/
+/* Read-only functions */
+/**********************************************************************/
-int fdt_move(const void *fdt, void *buf, int bufsize);
+/**
+ * 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);
-/* Read-only functions */
-char *fdt_string(const void *fdt, int stroffset);
+/**
+ * fdt_num_mem_rsv - retreive the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map. This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ * the number of entries
+ */
+int fdt_num_mem_rsv(const void *fdt);
+/**
+ * fdt_get_mem_rsv - retreive one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
+/**
+ * fdt_subnode_offset_namelen - find a subnode based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_subnode_offset(), but only examine the first
+ * namelen characters of name for matching the subnode name. This is
+ * useful for finding subnodes based on a portion of a larger string,
+ * such as a full path.
+ */
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
const char *name, int namelen);
+/**
+ * fdt_subnode_offset - find a subnode of a given node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_subnode_offset() finds a subnode of the node at structure block
+ * offset parentoffset with the given name. name may include a unit
+ * address, in which case fdt_subnode_offset() will find the subnode
+ * with that unit address, or the unit address may be omitted, in
+ * which case fdt_subnode_offset() will find an arbitrary subnode
+ * whose name excluding unit address matches the given name.
+ *
+ * returns:
+ * structure block offset of the requested subnode (>=0), on success
+ * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE,
+ * -FDT_ERR_TRUNCATED, standard meanings.
+ */
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
-int fdt_find_node_by_path(const void *fdt, const char *path);
-int fdt_find_node_by_type(const void *fdt, int nodeoffset, const char *type);
+/**
+ * fdt_path_offset - find a tree node by its full path
+ * @fdt: pointer to the device tree blob
+ * @path: full path of the node to locate
+ *
+ * fdt_path_offset() finds a node of a given path in the device tree.
+ * Each path component may omit the unit address portion, but the
+ * results of this are undefined if any such path component is
+ * ambiguous (that is if there are multiple nodes at the relevant
+ * level matching the given component, differentiated only by unit
+ * address).
+ *
+ * returns:
+ * structure block offset of the node with the requested path (>=0), on success
+ * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
+ * -FDT_ERR_NOTFOUND, if the requested node does not exist
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE,
+ * -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_path_offset(const void *fdt, const char *path);
-int fdt_node_is_compatible(const void *fdt, int nodeoffset,
- const char *compat);
-int fdt_find_compatible_node(const void *fdt, int nodeoffset,
- const char *type, const char *compat);
+/**
+ * fdt_get_name - retreive the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the starting node
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_name() retrieves the name (including unit address) of the
+ * device tree node at structure block offset nodeoffset. If lenp is
+ * non-NULL, the length of this name is also returned, in the integer
+ * pointed to by lenp.
+ *
+ * returns:
+ * pointer to the node's name, on success
+ * If lenp is non-NULL, *lenp contains the length of that name (>=0)
+ * NULL, on error
+ * if lenp is non-NULL *lenp contains an error code (<0):
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
-struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
- const char *name, int *lenp);
-void *fdt_getprop(const void *fdt, int nodeoffset,
- const char *name, int *lenp);
+/**
+ * fdt_get_property - find a given property in a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property() retrieves a pointer to the fdt_property
+ * structure within the device tree blob corresponding to the property
+ * named 'name' of the node at offset nodeoffset. If lenp is
+ * non-NULL, the length of the property value also returned, in the
+ * integer pointed to by lenp.
+ *
+ * returns:
+ * pointer to the structure representing the property
+ * if lenp is non-NULL, *lenp contains the length of the property
+ * value (>=0)
+ * NULL, on error
+ * if lenp is non-NULL, *lenp contains an error code (<0):
+ * -FDT_ERR_NOTFOUND, node does not have named property
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE,
+ * -FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
+ const char *name, int *lenp);
+static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
+ const char *name,
+ int *lenp)
+{
+ return (struct fdt_property *)fdt_get_property(fdt, nodeoffset,
+ name, lenp);
+}
-uint32_t fdt_next_tag(const void *fdt, int offset,
- int *nextoffset, char **namep);
-int fdt_num_reservemap(void *fdt, int *used, int *total);
-int fdt_get_reservemap(void *fdt, int n, struct fdt_reserve_entry *re);
+/**
+ * fdt_getprop - retrieve the value of a given property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop() retrieves a pointer to the value of the property
+ * named 'name' of the node at offset nodeoffset (this will be a
+ * pointer to within the device blob itself, not a copy of the value).
+ * If lenp is non-NULL, the length of the property value also
+ * returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ * pointer to the property's value
+ * if lenp is non-NULL, *lenp contains the length of the property
+ * value (>=0)
+ * NULL, on error
+ * if lenp is non-NULL, *lenp contains an error code (<0):
+ * -FDT_ERR_NOTFOUND, node does not have named property
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE,
+ * -FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+ const char *name, int *lenp);
+static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
+ const char *name, int *lenp)
+{
+ return (void *)fdt_getprop(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_get_phandle - retreive the phandle of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the node
+ *
+ * fdt_get_phandle() retrieves the phandle of the device tree node at
+ * structure block offset nodeoffset.
+ *
+ * returns:
+ * the phandle of the node at nodeoffset, on succes (!= 0, != -1)
+ * 0, if the node has no phandle, or another error occurs
+ */
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_get_path - determine the full path of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose path to find
+ * @buf: character buffer to contain the returned path (will be overwritten)
+ * @buflen: size of the character buffer at buf
+ *
+ * fdt_get_path() computes the full path of the node at offset
+ * nodeoffset, and records that path in the buffer at buf.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ * 0, on success
+ * buf contains the absolute path of the node at
+ * nodeoffset, as a NUL-terminated string.
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
+ * characters and will not fit in the given buffer.
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
+
+/**
+ * fdt_supernode_atdepth_offset - find a specific ancestor of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ * @supernodedepth: depth of the ancestor to find
+ * @nodedepth: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_supernode_atdepth_offset() finds an ancestor of the given node
+ * at a specific depth from the root (where the root itself has depth
+ * 0, its immediate subnodes depth 1 and so forth). So
+ * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
+ * will always return 0, the offset of the root node. If the node at
+ * nodeoffset has depth D, then:
+ * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
+ * will return nodeoffset itself.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+
+ * structure block offset of the node at node offset's ancestor
+ * of depth supernodedepth (>=0), on success
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+ int supernodedepth, int *nodedepth);
+
+/**
+ * fdt_node_depth - find the depth of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_node_depth() finds the depth of a given node. The root node
+ * has depth 0, its immediate subnodes depth 1 and so forth.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ * depth of the node at nodeoffset (>=0), on success
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_depth(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_parent_offset - find the parent of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_parent_offset() locates the parent node of a given node (that
+ * is, it finds the offset of the node which contains the node at
+ * nodeoffset as a subnode).
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset, *twice*.
+ *
+ * returns:
+ * stucture block offset of the parent of the node at nodeoffset
+ * (>=0), on success
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_parent_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_node_offset_by_prop_value - find nodes with a given property value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the first
+ * node after startoffset, which has a property named propname whose
+ * value is of length proplen and has value equal to propval; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
+ * propval, proplen);
+ * while (offset != -FDT_ERR_NOTFOUND) {
+ * // other code here
+ * offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+ * propval, proplen);
+ * }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ * structure block offset of the located node (>= 0, >startoffset),
+ * on success
+ * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ * tree after startoffset
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+ const char *propname,
+ const void *propval, int proplen);
+
+/**
+ * fdt_node_offset_by_phandle - find the node with a given phandle
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the node
+ * which has the given phandle value. If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ * structure block offset of the located node (>= 0), on success
+ * -FDT_ERR_NOTFOUND, no node with that phandle exists
+ * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
+
+/**
+ * fdt_node_check_compatible: check a node's compatible property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @compatible: string to match against
+ *
+ *
+ * fdt_node_check_compatible() returns 0 if the given node contains a
+ * 'compatible' property with the given string as one of its elements,
+ * it returns non-zero otherwise, or on error.
+ *
+ * returns:
+ * 0, if the node has a 'compatible' property listing the given string
+ * 1, if the node has a 'compatible' property, but it does not list
+ * the given string
+ * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
+ * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+ const char *compatible);
+
+/**
+ * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatible: 'compatible' string to match against
+ *
+ * fdt_node_offset_by_compatible() returns the offset of the first
+ * node after startoffset, which has a 'compatible' property which
+ * lists the given compatible string; or if startoffset is -1, the
+ * very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ * while (offset != -FDT_ERR_NOTFOUND) {
+ * // other code here
+ * offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ * }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ * structure block offset of the located node (>= 0, >startoffset),
+ * on success
+ * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ * tree after startoffset
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+ const char *compatible);
+
+/**********************************************************************/
+/* Write-in-place functions */
+/**********************************************************************/
-/* Write-in-place functions */
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
-
-#define fdt_setprop_inplace_typed(fdt, nodeoffset, name, val) \
- ({ \
- typeof(val) x = val; \
- fdt_setprop_inplace(fdt, nodeoffset, name, &x, sizeof(x)); \
- })
+static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
+ const char *name, uint32_t val)
+{
+ val = cpu_to_fdt32(val);
+ return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val));
+}
int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
int fdt_nop_node(void *fdt, int nodeoffset);
-int fdt_insert_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size);
+/**********************************************************************/
+/* Sequential write functions */
+/**********************************************************************/
-/* Sequential-write functions */
int fdt_create(void *buf, int bufsize);
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
int fdt_finish_reservemap(void *fdt);
int fdt_begin_node(void *fdt, const char *name);
int fdt_property(void *fdt, const char *name, const void *val, int len);
-#define fdt_property_typed(fdt, name, val) \
- ({ \
- typeof(val) x = (val); \
- fdt_property((fdt), (name), &x, sizeof(x)); \
- })
+static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
+{
+ val = cpu_to_fdt32(val);
+ return fdt_property(fdt, name, &val, sizeof(val));
+}
#define fdt_property_string(fdt, name, str) \
fdt_property(fdt, name, str, strlen(str)+1)
int fdt_end_node(void *fdt);
int fdt_finish(void *fdt);
-int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size);
-/* Read-write functions */
-int fdt_open_into(void *fdt, void *buf, int bufsize);
+/**********************************************************************/
+/* Read-write functions */
+/**********************************************************************/
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize);
int fdt_pack(void *fdt);
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
+int fdt_del_mem_rsv(void *fdt, int n);
+
int fdt_setprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
-#define fdt_setprop_typed(fdt, nodeoffset, name, val) \
- ({ \
- typeof(val) x = (val); \
- fdt_setprop((fdt), (nodeoffset), (name), &x, sizeof(x)); \
- })
+static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
+ uint32_t val)
+{
+ val = cpu_to_fdt32(val);
+ return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val));
+}
#define fdt_setprop_string(fdt, nodeoffset, name, str) \
fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
-int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
- const void *val, int len, int create);
int fdt_delprop(void *fdt, int nodeoffset, const char *name);
int fdt_add_subnode_namelen(void *fdt, int parentoffset,
const char *name, int namelen);
int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
int fdt_del_node(void *fdt, int nodeoffset);
-/* Extra functions */
+/**********************************************************************/
+/* Debugging / informational functions */
+/**********************************************************************/
+
const char *fdt_strerror(int errval);
#endif /* _LIBFDT_H */
diff --git a/lib_arm/board.c b/lib_arm/board.c
index 7e97f13..6f35aa0 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -46,10 +46,10 @@
#include <net.h>
#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 7c9990f..86a3b67 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -35,7 +35,7 @@
#include <i2c.h>
#include "blackfin_board.h"
#include <asm/cplb.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
#if defined(CONFIG_BF537)&&defined(CONFIG_POST)
#include <post.h>
diff --git a/libfdt/Makefile b/libfdt/Makefile
index 126fa2c..d166cce 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 1ee67ad..586a361 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -45,9 +74,9 @@ int fdt_check_header(const void *fdt)
return 0;
}
-void *fdt_offset_ptr(const void *fdt, int offset, int len)
+const void *fdt_offset_ptr(const void *fdt, int offset, int len)
{
- void *p;
+ const void *p;
if (fdt_version(fdt) >= 0x11)
if (((offset + len) < offset)
@@ -61,6 +90,45 @@ void *fdt_offset_ptr(const void *fdt, int offset, int len)
return p;
}
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset)
+{
+ const uint32_t *tagp, *lenp;
+ uint32_t tag;
+ const char *p;
+
+ if (offset % FDT_TAGSIZE)
+ return -1;
+
+ tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
+ if (! tagp)
+ return FDT_END; /* premature end */
+ tag = fdt32_to_cpu(*tagp);
+ offset += FDT_TAGSIZE;
+
+ switch (tag) {
+ case FDT_BEGIN_NODE:
+ /* skip name */
+ do {
+ p = fdt_offset_ptr(fdt, offset++, 1);
+ } while (p && (*p != '\0'));
+ if (! p)
+ return FDT_END;
+ break;
+ case FDT_PROP:
+ lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp));
+ if (! lenp)
+ return FDT_END;
+ /* skip name offset, length and value */
+ offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp);
+ break;
+ }
+
+ if (nextoffset)
+ *nextoffset = ALIGN(offset, FDT_TAGSIZE);
+
+ return tag;
+}
+
const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
{
int len = strlen(s) + 1;
@@ -86,5 +154,3 @@ int fdt_move(const void *fdt, void *buf, int bufsize)
memmove(buf, fdt, fdt_totalsize(fdt));
return 0;
}
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index 46d525d..12a37d5 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -26,14 +55,15 @@
#include "libfdt_internal.h"
-#define CHECK_HEADER(fdt) { \
- int err; \
- if ((err = fdt_check_header(fdt)) != 0) \
- return err; \
-}
+#define CHECK_HEADER(fdt) \
+ { \
+ int err; \
+ if ((err = fdt_check_header(fdt)) != 0) \
+ return err; \
+ }
-static int offset_streq(const void *fdt, int offset,
- const char *s, int len)
+static int nodename_eq(const void *fdt, int offset,
+ const char *s, int len)
{
const char *p = fdt_offset_ptr(fdt, offset, len+1);
@@ -44,169 +74,36 @@ static int offset_streq(const void *fdt, int offset,
if (memcmp(p, s, len) != 0)
return 0;
- if (p[len] != '\0')
+ if (p[len] == '\0')
+ return 1;
+ else if (!memchr(s, '@', len) && (p[len] == '@'))
+ return 1;
+ else
return 0;
-
- return 1;
}
-/*
- * Checks if the property name matches.
- */
-static int prop_name_eq(const void *fdt, int offset, const char *name,
- struct fdt_property **prop, int *lenp)
-{
- int namestroff, len;
-
- *prop = fdt_offset_ptr_typed(fdt, offset, *prop);
- if (! *prop)
- return -FDT_ERR_BADSTRUCTURE;
-
- namestroff = fdt32_to_cpu((*prop)->nameoff);
- if (streq(fdt_string(fdt, namestroff), name)) {
- len = fdt32_to_cpu((*prop)->len);
- *prop = fdt_offset_ptr(fdt, offset,
- sizeof(**prop) + len);
- if (*prop) {
- if (lenp)
- *lenp = len;
- return 1;
- } else
- return -FDT_ERR_BADSTRUCTURE;
- }
- return 0;
-}
-
-/*
- * Return a pointer to the string at the given string offset.
- */
-char *fdt_string(const void *fdt, int stroffset)
+const char *fdt_string(const void *fdt, int stroffset)
{
return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
}
-/*
- * Check if the specified node is compatible by comparing the tokens
- * in its "compatible" property with the specified string:
- *
- * nodeoffset - starting place of the node
- * compat - the string to match to one of the tokens in the
- * "compatible" list.
- */
-int fdt_node_is_compatible(const void *fdt, int nodeoffset,
- const char *compat)
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
{
- const char* cp;
- int cplen, len;
-
- cp = fdt_getprop(fdt, nodeoffset, "compatible", &cplen);
- if (cp == NULL)
- return 0;
- while (cplen > 0) {
- if (strncmp(cp, compat, strlen(compat)) == 0)
- return 1;
- len = strlen(cp) + 1;
- cp += len;
- cplen -= len;
- }
-
- 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;
- }
- }
+ *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
+ *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+ return 0;
}
-/*
- * Find a node 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 fdt_num_mem_rsv(const void *fdt)
{
- int offset;
+ int i = 0;
- 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;
+ while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+ i++;
+ return i;
}
-/*
- * Return the node offset of the node specified by:
- * parentoffset - starting place (0 to start at the root)
- * name - name being searched for
- * namelen - length of the name: typically strlen(name)
- *
- * Notes:
- * If the start node has subnodes, the subnodes are _not_ searched for the
- * requested name.
- */
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
const char *name, int namelen)
{
@@ -216,13 +113,13 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
CHECK_HEADER(fdt);
- tag = fdt_next_tag(fdt, parentoffset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
do {
offset = nextoffset;
- tag = fdt_next_tag(fdt, offset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
@@ -230,15 +127,10 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
case FDT_BEGIN_NODE:
level++;
- /*
- * If we are nested down levels, ignore the strings
- * until we get back to the proper level.
- */
if (level != 1)
continue;
-
- /* Return the offset if this is "our" string. */
- if (offset_streq(fdt, offset+FDT_TAGSIZE, name, namelen))
+ if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen))
+ /* Found it! */
return offset;
break;
@@ -258,20 +150,13 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
return -FDT_ERR_NOTFOUND;
}
-/*
- * See fdt_subnode_offset_namelen()
- */
int fdt_subnode_offset(const void *fdt, int parentoffset,
const char *name)
{
return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name));
}
-/*
- * Searches for the node corresponding to the given path and returns the
- * offset of that node.
- */
-int fdt_find_node_by_path(const void *fdt, const char *path)
+int fdt_path_offset(const void *fdt, const char *path)
{
const char *end = path + strlen(path);
const char *p = path;
@@ -279,37 +164,21 @@ int fdt_find_node_by_path(const void *fdt, const char *path)
CHECK_HEADER(fdt);
- /* Paths must be absolute */
if (*path != '/')
return -FDT_ERR_BADPATH;
- /* Handle the root path: root offset is 0 */
- if (strcmp(path, "/") == 0)
- return 0;
-
while (*p) {
const char *q;
- /* Skip path separator(s) */
while (*p == '/')
p++;
if (! *p)
- return -FDT_ERR_BADPATH;
-
- /*
- * Find the next path separator. The characters between
- * p and q are the next segment of the the path to find.
- */
+ return offset;
q = strchr(p, '/');
if (! q)
q = end;
- /*
- * Find the offset corresponding to the this path segment.
- */
offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p);
-
- /* Oops, error, abort abort abort */
if (offset < 0)
return offset;
@@ -319,17 +188,37 @@ int fdt_find_node_by_path(const void *fdt, const char *path)
return offset;
}
-/*
- * Given the offset of a node and a name of a property in that node, return
- * a pointer to the property struct.
- */
-struct fdt_property *fdt_get_property(const void *fdt,
- int nodeoffset,
- const char *name, int *lenp)
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
+{
+ const struct fdt_node_header *nh;
+ int err;
+
+ if ((err = fdt_check_header(fdt)) != 0)
+ goto fail;
+
+ err = -FDT_ERR_BADOFFSET;
+ nh = fdt_offset_ptr(fdt, nodeoffset, sizeof(*nh));
+ if (!nh || (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE))
+ goto fail;
+
+ if (len)
+ *len = strlen(nh->name);
+
+ return nh->name;
+
+ fail:
+ if (len)
+ *len = err;
+ return NULL;
+}
+
+const struct fdt_property *fdt_get_property(const void *fdt,
+ int nodeoffset,
+ const char *name, int *lenp)
{
- int level = 0;
uint32_t tag;
- struct fdt_property *prop;
+ const struct fdt_property *prop;
+ int namestroff;
int offset, nextoffset;
int err;
@@ -340,63 +229,59 @@ struct fdt_property *fdt_get_property(const void *fdt,
if (nodeoffset % FDT_TAGSIZE)
goto fail;
- tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
goto fail;
do {
offset = nextoffset;
- tag = fdt_next_tag(fdt, offset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
err = -FDT_ERR_TRUNCATED;
goto fail;
case FDT_BEGIN_NODE:
- level++;
- break;
-
case FDT_END_NODE:
- level--;
+ case FDT_NOP:
break;
case FDT_PROP:
- /*
- * If we are nested down levels, ignore the strings
- * until we get back to the proper level.
- */
- if (level != 0)
- continue;
-
- err = prop_name_eq(fdt, offset, name, &prop, lenp);
- if (err > 0)
- return prop;
- else if (err < 0)
+ err = -FDT_ERR_BADSTRUCTURE;
+ prop = fdt_offset_ptr(fdt, offset, sizeof(*prop));
+ if (! prop)
goto fail;
- break;
+ namestroff = fdt32_to_cpu(prop->nameoff);
+ if (streq(fdt_string(fdt, namestroff), name)) {
+ /* Found it! */
+ int len = fdt32_to_cpu(prop->len);
+ prop = fdt_offset_ptr(fdt, offset,
+ sizeof(*prop)+len);
+ if (! prop)
+ goto fail;
+
+ if (lenp)
+ *lenp = len;
- case FDT_NOP:
+ return prop;
+ }
break;
default:
err = -FDT_ERR_BADSTRUCTURE;
goto fail;
}
- } while (level >= 0);
+ } while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE));
err = -FDT_ERR_NOTFOUND;
-fail:
+ fail:
if (lenp)
*lenp = err;
return NULL;
}
-/*
- * Given the offset of a node and a name of a property in that node, return
- * a pointer to the property data (ONLY).
- */
-void *fdt_getprop(const void *fdt, int nodeoffset,
+const void *fdt_getprop(const void *fdt, int nodeoffset,
const char *name, int *lenp)
{
const struct fdt_property *prop;
@@ -405,132 +290,294 @@ void *fdt_getprop(const void *fdt, int nodeoffset,
if (! prop)
return NULL;
- return (void *)prop->data;
+ return prop->data;
}
+uint32_t fdt_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);
+}
-uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset, char **namep)
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
- 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:
- 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));
+ int p = 0, overflow = 0;
+ int offset, nextoffset, namelen;
+ const char *name;
+
+ CHECK_HEADER(fdt);
+
+ tag = fdt_next_tag(fdt, 0, &nextoffset);
+ if (tag != FDT_BEGIN_NODE)
+ return -FDT_ERR_BADSTRUCTURE;
+
+ if (buflen < 2)
+ return -FDT_ERR_NOSPACE;
+ 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;
}
- /* skip name offset, length and value */
- offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp);
- break;
}
- if (nextoffset)
- *nextoffset = ALIGN(offset, FDT_TAGSIZE);
+ if (overflow)
+ return -FDT_ERR_NOSPACE;
- return tag;
+ if (p > 1) /* special case so that root path is "/", not "" */
+ p--;
+ buf[p] = '\0';
+ return p;
}
-/*
- * Return the number of used reserve map entries and total slots available.
- */
-int fdt_num_reservemap(void *fdt, int *used, int *total)
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+ int supernodedepth, int *nodedepth)
{
- 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);
+ 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;
}
- /*
- * If we get here, there was no zero size termination.
- */
- return -FDT_ERR_BADLAYOUT;
+ } 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;
}
- return 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;
}
-/*
- * Return the nth reserve map entry.
- */
-int fdt_get_reservemap(void *fdt, int n, struct fdt_reserve_entry *re)
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
{
- int used;
- int total;
- int err;
+ 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));
+}
- err = fdt_num_reservemap(fdt, &used, &total);
- if (err != 0)
- return err;
+int _stringlist_contains(const void *strlist, int listlen, const char *str)
+{
+ int len = strlen(str);
+ const void *p;
- if (n >= total)
- return -FDT_ERR_NOSPACE;
- if (re) {
- *re = *(struct fdt_reserve_entry *)
- _fdt_offset_ptr(fdt, n * sizeof(struct fdt_reserve_entry));
+ while (listlen >= len) {
+ if (memcmp(str, strlist, len+1) == 0)
+ return 1;
+ p = memchr(strlist, '\0', listlen);
+ if (!p)
+ return 0; /* malformed strlist.. */
+ listlen -= (p-strlist) + 1;
+ strlist = p + 1;
}
return 0;
}
-#endif /* CONFIG_OF_LIBFDT */
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+ const char *compatible)
+{
+ const void *prop;
+ int len;
+
+ prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
+ if (!prop)
+ return len;
+ if (_stringlist_contains(prop, len, compatible))
+ return 0;
+ else
+ return 1;
+}
+
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+ const char *compatible)
+{
+ uint32_t tag;
+ int offset, nextoffset;
+ int err;
+
+ CHECK_HEADER(fdt);
+
+ if (startoffset >= 0) {
+ tag = fdt_next_tag(fdt, startoffset, &nextoffset);
+ if (tag != FDT_BEGIN_NODE)
+ return -FDT_ERR_BADOFFSET;
+ } else {
+ nextoffset = 0;
+ }
+
+ /* FIXME: The algorithm here is pretty horrible: we scan each
+ * property of a node in fdt_node_check_compatible(), then if
+ * that didn't find what we want, we scan over them again
+ * making our way to the next node. Still it's the easiest to
+ * implement approach; performance can come later. */
+ do {
+ offset = nextoffset;
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+ switch (tag) {
+ case FDT_BEGIN_NODE:
+ err = fdt_node_check_compatible(fdt, offset,
+ compatible);
+ if ((err < 0)
+ && (err != -FDT_ERR_NOTFOUND))
+ return err;
+ else if (err == 0)
+ return offset;
+ break;
+
+ case FDT_PROP:
+ case FDT_END:
+ case FDT_END_NODE:
+ case FDT_NOP:
+ break;
+
+ default:
+ return -FDT_ERR_BADSTRUCTURE;
+ }
+ } while (tag != FDT_END);
+
+ return -FDT_ERR_NOTFOUND;
+}
diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index 55fcc41..dfe5628 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -26,25 +55,32 @@
#include "libfdt_internal.h"
+static int _blocks_misordered(const void *fdt,
+ int mem_rsv_size, int struct_size)
+{
+ return (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8))
+ || (fdt_off_dt_struct(fdt) <
+ (fdt_off_mem_rsvmap(fdt) + mem_rsv_size))
+ || (fdt_off_dt_strings(fdt) <
+ (fdt_off_dt_struct(fdt) + struct_size))
+ || (fdt_totalsize(fdt) <
+ (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
+}
+
static int rw_check_header(void *fdt)
{
int err;
if ((err = fdt_check_header(fdt)))
return err;
- if (fdt_version(fdt) < 0x11)
+ if (fdt_version(fdt) < 17)
return -FDT_ERR_BADVERSION;
- if (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8))
- return -FDT_ERR_BADLAYOUT;
- if (fdt_off_dt_struct(fdt) <
- (fdt_off_mem_rsvmap(fdt) + sizeof(struct fdt_reserve_entry)))
- return -FDT_ERR_BADLAYOUT;
- if (fdt_off_dt_strings(fdt) <
- (fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt)))
- return -FDT_ERR_BADLAYOUT;
- if (fdt_totalsize(fdt) <
- (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)))
+ if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
+ fdt_size_dt_struct(fdt)))
return -FDT_ERR_BADLAYOUT;
+ if (fdt_version(fdt) > 17)
+ fdt_set_version(fdt, 17);
+
return 0;
}
@@ -72,6 +108,19 @@ static int _blob_splice(void *fdt, void *p, int oldlen, int newlen)
return 0;
}
+static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
+ int oldn, int newn)
+{
+ int delta = (newn - oldn) * sizeof(*p);
+ int err;
+ err = _blob_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
+ if (err)
+ return err;
+ fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
+ fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
+ return 0;
+}
+
static int _blob_splice_struct(void *fdt, void *p,
int oldlen, int newlen)
{
@@ -81,8 +130,8 @@ static int _blob_splice_struct(void *fdt, void *p,
if ((err = _blob_splice(fdt, p, oldlen, newlen)))
return err;
- fdt_set_header(fdt, size_dt_struct, fdt_size_dt_struct(fdt) + delta);
- fdt_set_header(fdt, off_dt_strings, fdt_off_dt_strings(fdt) + delta);
+ fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
+ fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
return 0;
}
@@ -94,7 +143,7 @@ static int _blob_splice_string(void *fdt, int newlen)
if ((err = _blob_splice(fdt, p, 0, newlen)))
return err;
- fdt_set_header(fdt, size_dt_strings, fdt_size_dt_strings(fdt) + newlen);
+ fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
return 0;
}
@@ -120,13 +169,47 @@ static int _find_add_string(void *fdt, const char *s)
return (new - strtab);
}
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
+{
+ struct fdt_reserve_entry *re;
+ int err;
+
+ if ((err = rw_check_header(fdt)))
+ return err;
+
+ re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
+ err = _blob_splice_mem_rsv(fdt, re, 0, 1);
+ if (err)
+ return err;
+
+ re->address = cpu_to_fdt64(address);
+ re->size = cpu_to_fdt64(size);
+ return 0;
+}
+
+int fdt_del_mem_rsv(void *fdt, int n)
+{
+ struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
+ int err;
+
+ if ((err = rw_check_header(fdt)))
+ return err;
+ if (n >= fdt_num_mem_rsv(fdt))
+ return -FDT_ERR_NOTFOUND;
+
+ err = _blob_splice_mem_rsv(fdt, re, 1, 0);
+ if (err)
+ return err;
+ return 0;
+}
+
static int _resize_property(void *fdt, int nodeoffset, const char *name, int len,
struct fdt_property **prop)
{
int oldlen;
int err;
- *prop = fdt_get_property(fdt, nodeoffset, name, &oldlen);
+ *prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
if (! (*prop))
return oldlen;
@@ -148,7 +231,7 @@ static int _add_property(void *fdt, int nodeoffset, const char *name, int len,
int namestroff;
int err;
- tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
@@ -156,7 +239,7 @@ static int _add_property(void *fdt, int nodeoffset, const char *name, int len,
if (namestroff < 0)
return namestroff;
- *prop = _fdt_offset_ptr(fdt, nextoffset);
+ *prop = _fdt_offset_ptr_w(fdt, nextoffset);
proplen = sizeof(**prop) + ALIGN(len, FDT_TAGSIZE);
err = _blob_splice_struct(fdt, *prop, 0, proplen);
@@ -188,32 +271,6 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
return 0;
}
-/**
- * fdt_find_and_setprop: Find a node and set it's property
- *
- * @fdt: ptr to device tree
- * @node: path of node
- * @prop: property name
- * @val: ptr to new value
- * @len: length of new property value
- * @create: flag to create the property if it doesn't exist
- *
- * Convenience function to directly set a property given the path to the node.
- */
-int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
- const void *val, int len, int create)
-{
- int nodeoff = fdt_find_node_by_path(fdt, node);
-
- if (nodeoff < 0)
- return nodeoff;
-
- if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL))
- return 0; /* create flag not set; so exit quietly */
-
- return fdt_setprop(fdt, nodeoff, prop, val, len);
-}
-
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
{
struct fdt_property *prop;
@@ -221,7 +278,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
RW_CHECK_HEADER(fdt);
- prop = fdt_get_property(fdt, nodeoffset, name, &len);
+ prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
if (! prop)
return len;
@@ -248,13 +305,13 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
return offset;
/* Try to place the new node after the parent's properties */
- fdt_next_tag(fdt, parentoffset, &nextoffset, NULL); /* skip the BEGIN_NODE */
+ fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
do {
offset = nextoffset;
- tag = fdt_next_tag(fdt, offset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
} while (tag == FDT_PROP);
- nh = _fdt_offset_ptr(fdt, offset);
+ nh = _fdt_offset_ptr_w(fdt, offset);
nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE;
err = _blob_splice_struct(fdt, nh, 0, nodelen);
@@ -279,46 +336,112 @@ int fdt_del_node(void *fdt, int nodeoffset)
{
int endoffset;
+ RW_CHECK_HEADER(fdt);
+
endoffset = _fdt_node_end_offset(fdt, nodeoffset);
if (endoffset < 0)
return endoffset;
- return _blob_splice_struct(fdt, _fdt_offset_ptr(fdt, nodeoffset),
+ return _blob_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
endoffset - nodeoffset, 0);
}
-int fdt_open_into(void *fdt, void *buf, int bufsize)
+static void _packblocks(const void *fdt, void *buf,
+ int mem_rsv_size, int struct_size)
+{
+ int mem_rsv_off, struct_off, strings_off;
+
+ mem_rsv_off = ALIGN(sizeof(struct fdt_header), 8);
+ struct_off = mem_rsv_off + mem_rsv_size;
+ strings_off = struct_off + struct_size;
+
+ memmove(buf + mem_rsv_off, fdt + fdt_off_mem_rsvmap(fdt), mem_rsv_size);
+ fdt_set_off_mem_rsvmap(buf, mem_rsv_off);
+
+ memcpy(buf + struct_off, fdt + fdt_off_dt_struct(fdt), struct_size);
+ fdt_set_off_dt_struct(buf, struct_off);
+ fdt_set_size_dt_struct(buf, struct_size);
+
+ memcpy(buf + strings_off, fdt + fdt_off_dt_strings(fdt),
+ fdt_size_dt_strings(fdt));
+ fdt_set_off_dt_strings(buf, strings_off);
+ fdt_set_size_dt_strings(buf, fdt_size_dt_strings(fdt));
+}
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize)
{
int err;
+ int mem_rsv_size, struct_size;
+ int newsize;
+ void *tmp;
- err = fdt_move(fdt, buf, bufsize);
+ err = fdt_check_header(fdt);
if (err)
return err;
- fdt = buf;
+ mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+ * sizeof(struct fdt_reserve_entry);
- fdt_set_header(fdt, totalsize, bufsize);
+ if (fdt_version(fdt) >= 17) {
+ struct_size = fdt_size_dt_struct(fdt);
+ } else {
+ struct_size = 0;
+ while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END)
+ ;
+ }
- /* FIXME: re-order if necessary */
+ if (!_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
+ /* no further work necessary */
+ err = fdt_move(fdt, buf, bufsize);
+ if (err)
+ return err;
+ fdt_set_version(buf, 17);
+ fdt_set_size_dt_struct(buf, struct_size);
+ fdt_set_totalsize(buf, bufsize);
+ return 0;
+ }
- err = rw_check_header(fdt);
- if (err)
- return err;
+ /* Need to reorder */
+ newsize = ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size
+ + struct_size + fdt_size_dt_strings(fdt);
+
+ if (bufsize < newsize)
+ return -FDT_ERR_NOSPACE;
+
+ if (((buf + newsize) <= fdt)
+ || (buf >= (fdt + fdt_totalsize(fdt)))) {
+ tmp = buf;
+ } else {
+ tmp = (void *)fdt + fdt_totalsize(fdt);
+ if ((tmp + newsize) > (buf + bufsize))
+ return -FDT_ERR_NOSPACE;
+ }
+
+ _packblocks(fdt, tmp, mem_rsv_size, struct_size);
+ memmove(buf, tmp, newsize);
+
+ fdt_set_magic(buf, FDT_MAGIC);
+ fdt_set_totalsize(buf, bufsize);
+ fdt_set_version(buf, 17);
+ fdt_set_last_comp_version(buf, 16);
+ fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt));
return 0;
}
int fdt_pack(void *fdt)
{
+ int mem_rsv_size;
int err;
err = rw_check_header(fdt);
if (err)
return err;
- /* FIXME: pack components */
- fdt_set_header(fdt, totalsize, _blob_data_size(fdt));
+ mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+ * sizeof(struct fdt_reserve_entry);
+ _packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+ fdt_set_totalsize(fdt, _blob_data_size(fdt));
+
return 0;
}
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c
index b49c952..f9d32ef 100644
--- a/libfdt/fdt_strerror.c
+++ b/libfdt/fdt_strerror.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -65,5 +94,3 @@ const char *fdt_strerror(int errval)
return "<unknown error>";
}
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/libfdt/fdt_sw.c b/libfdt/fdt_sw.c
index c7eea8f..dda2de3 100644
--- a/libfdt/fdt_sw.c
+++ b/libfdt/fdt_sw.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -44,8 +73,8 @@ static void *grab_space(void *fdt, int len)
if ((offset + len < offset) || (offset + len > spaceleft))
return NULL;
- fdt_set_header(fdt, size_dt_struct, offset + len);
- return fdt_offset_ptr(fdt, offset, len);
+ fdt_set_size_dt_struct(fdt, offset + len);
+ return fdt_offset_ptr_w(fdt, offset, len);
}
int fdt_create(void *buf, int bufsize)
@@ -57,15 +86,15 @@ int fdt_create(void *buf, int bufsize)
memset(buf, 0, bufsize);
- fdt_set_header(fdt, magic, SW_MAGIC);
- fdt_set_header(fdt, version, FDT_LAST_SUPPORTED_VERSION);
- fdt_set_header(fdt, last_comp_version, FDT_FIRST_SUPPORTED_VERSION);
- fdt_set_header(fdt, totalsize, bufsize);
+ fdt_set_magic(fdt, SW_MAGIC);
+ fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION);
+ fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION);
+ fdt_set_totalsize(fdt, bufsize);
- fdt_set_header(fdt, off_mem_rsvmap, ALIGN(sizeof(struct fdt_header),
- sizeof(struct fdt_reserve_entry)));
- fdt_set_header(fdt, off_dt_struct, fdt_off_mem_rsvmap(fdt));
- fdt_set_header(fdt, off_dt_strings, bufsize);
+ fdt_set_off_mem_rsvmap(fdt, ALIGN(sizeof(struct fdt_header),
+ sizeof(struct fdt_reserve_entry)));
+ fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt));
+ fdt_set_off_dt_strings(fdt, bufsize);
return 0;
}
@@ -85,11 +114,11 @@ int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
if ((offset + sizeof(*re)) > fdt_totalsize(fdt))
return -FDT_ERR_NOSPACE;
- re = (struct fdt_reserve_entry *)((void *)fdt + offset);
+ re = (struct fdt_reserve_entry *)(fdt + offset);
re->address = cpu_to_fdt64(addr);
re->size = cpu_to_fdt64(size);
- fdt_set_header(fdt, off_dt_struct, offset + sizeof(*re));
+ fdt_set_off_dt_struct(fdt, offset + sizeof(*re));
return 0;
}
@@ -152,7 +181,7 @@ static int find_add_string(void *fdt, const char *s)
return 0; /* no more room :( */
memcpy(strtab + offset, s, len);
- fdt_set_header(fdt, size_dt_strings, strtabsize + len);
+ fdt_set_size_dt_strings(fdt, strtabsize + len);
return offset;
}
@@ -202,14 +231,14 @@ int fdt_finish(void *fdt)
oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt);
newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt));
- fdt_set_header(fdt, off_dt_strings, newstroffset);
+ fdt_set_off_dt_strings(fdt, newstroffset);
/* Walk the structure, correcting string offsets */
offset = 0;
- while ((tag = fdt_next_tag(fdt, offset, &nextoffset, NULL)) != FDT_END) {
+ while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
if (tag == FDT_PROP) {
- struct fdt_property *prop = fdt_offset_ptr(fdt, offset,
- sizeof(*prop));
+ struct fdt_property *prop =
+ fdt_offset_ptr_w(fdt, offset, sizeof(*prop));
int nameoff;
if (! prop)
@@ -223,9 +252,7 @@ int fdt_finish(void *fdt)
}
/* Finally, adjust the header */
- fdt_set_header(fdt, totalsize, newstroffset + fdt_size_dt_strings(fdt));
- fdt_set_header(fdt, magic, FDT_MAGIC);
+ fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt));
+ fdt_set_magic(fdt, FDT_MAGIC);
return 0;
}
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c
index 2d39aab..88e24b8 100644
--- a/libfdt/fdt_wip.c
+++ b/libfdt/fdt_wip.c
@@ -2,23 +2,52 @@
* libfdt - Flat Device Tree manipulation
* Copyright (C) 2006 David Gibson, IBM Corporation.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ * b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#if CONFIG_OF_LIBFDT
-
#include "libfdt_env.h"
#include <fdt.h>
@@ -32,7 +61,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
void *propval;
int proplen;
- propval = fdt_getprop(fdt, nodeoffset, name, &proplen);
+ propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen);
if (! propval)
return proplen;
@@ -56,7 +85,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
struct fdt_property *prop;
int len;
- prop = fdt_get_property(fdt, nodeoffset, name, &len);
+ prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
if (! prop)
return len;
@@ -71,12 +100,12 @@ int _fdt_node_end_offset(void *fdt, int nodeoffset)
uint32_t tag;
int offset, nextoffset;
- tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
do {
offset = nextoffset;
- tag = fdt_next_tag(fdt, offset, &nextoffset, NULL);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
@@ -110,33 +139,6 @@ int fdt_nop_node(void *fdt, int nodeoffset)
if (endoffset < 0)
return endoffset;
- nop_region(fdt_offset_ptr(fdt, nodeoffset, 0), endoffset - nodeoffset);
+ nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset);
return 0;
}
-
-/*
- * Replace a reserve map entry in the nth slot.
- */
-int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size)
-{
- struct fdt_reserve_entry *re;
- int used;
- int total;
- int err;
-
- err = fdt_num_reservemap(fdt, &used, &total);
- if (err != 0)
- return err;
-
- if (n >= total)
- return -FDT_ERR_NOSPACE;
- re = (struct fdt_reserve_entry *)
- (fdt + fdt_off_mem_rsvmap(fdt) +
- (n * sizeof(struct fdt_reserve_entry)));
- re->address = cpu_to_fdt64(addr);
- re->size = cpu_to_fdt64(size);
-
- return 0;
-}
-
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/libfdt/libfdt_internal.h b/libfdt/libfdt_internal.h
index cc9633c..1e60936 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.
- *
- * 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
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ * 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.
+ *
+ * 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 <fdt.h>
@@ -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 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 + fdt_off_dt_struct(fdt) + offset;
+ return (void *)_fdt_mem_rsv(fdt, n);
}
#define SW_MAGIC (~FDT_MAGIC)
diff --git a/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile
index 926476f..2d4d601 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 8b5461d..3a633fb 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 ec1be5a..78bf071 100644
--- a/nand_spl/board/amcc/sequoia/Makefile
+++ b/nand_spl/board/amcc/sequoia/Makefile
@@ -88,7 +88,7 @@ $(obj)nand_boot.c:
# from drivers/nand directory
$(obj)nand_ecc.c:
@rm -f $(obj)nand_ecc.c
- ln -s $(SRCTREE)/drivers/nand/nand_ecc.c $(obj)nand_ecc.c
+ ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c
#########################################################################
diff --git a/tools/scripts/define2mk.sed b/tools/scripts/define2mk.sed
new file mode 100644
index 0000000..6464627
--- /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
+}