diff options
48 files changed, 881 insertions, 1540 deletions
@@ -1,3 +1,562 @@ +commit ad74cae9ff8790727bc81ee91c6bca7d50dca446 +Author: David Brownell <dbrownell@users.sourceforge.net> +Date: Thu Apr 16 23:15:15 2009 -0700 + + dm9000 EEPROM reading bugfix + + Make the U-Boot dm9000 driver read addresses from EEPROM just + like Linux does ... read six bytes, instead of reading twelve + bytes and then discarding every other one. + + Using the right Ethernet address is a big win. + + Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> + Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + Acked-by: Ben Warren <biggerbadderben@gmail.com> + +commit d4c02e6f5d49880123e7f584b88f857ffd874381 +Author: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> +Date: Wed Feb 25 14:27:24 2009 +0900 + + rtl8169: fix cache coherency problem + + Fix the problem that cannot access actual data when CPU data cache enabled. + + Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + Tested-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> + Acked-by: Ben Warren <biggerbadderben@gmail.com> + +commit 34b76a14f676bc6501c27a96564e4dfb4793f033 +Author: Wolfgang Denk <wd@denx.de> +Date: Sun Apr 26 20:39:26 2009 +0200 + + lib_arm/board.c: remove misleading "test-only" comment. + + For a long time, the print_cpuinfo() declaration in lib_arm/board.c + had been marked as "test-only", which is plain wrong considering + current usage. Delete this misleading comment. + + Signed-off-by: Wolfgang Denk <wd@denx.de> + +commit 14b9308d511b53042ef478936e367a67282df66a +Author: Heiko Schocher <hs@denx.de> +Date: Fri Apr 24 06:50:45 2009 +0200 + + 83xx: searching "muram-data" by compatible property + + if using CONFIG_BOOTCOUNT_LIMIT feature on a MPC8360 CPU + in the muram-data node, the reg entry needs to be updated. + This is done in fdt_fixup_muram(), but we should use + the compatible "fsl,qe-muram-data" for searching the + node instead of searching the muram-data node with + an absolute path. + + Signed-off-by: Heiko Schocher <hs@denx.de> + Signed-off-by: Kim Phillips <kim.phillips@freescale.com> + +commit 8e15088794807944b221c11609d36789efc7f767 +Author: Anatolij Gustschin <agust@denx.de> +Date: Thu Apr 23 21:29:34 2009 +0200 + + mpc83xx: MPC8360ERDK: fix environment offset configuration bug + + The size of U-Boot binary for MPC8360ERDK increased + (> 2 flash sectors now), so 'saveenv' will partially + overwrite U-Boot in flash and will brick the board. + This patch moves environment offset to fourth flash + sector and also fixes CONFIG_SYS_MONITOR_LEN. + + Signed-off-by: Anatolij Gustschin <agust@denx.de> + Signed-off-by: Kim Phillips <kim.phillips@freescale.com> + +commit 3c172c4fdbbb5858fae38478d6399be4a16be3fc +Author: Michael Zaidman <michael.zaidman@gmail.com> +Date: Sat Apr 4 01:43:00 2009 +0300 + + NetLoop initialization bug + + The patch fixes the bug of partial initialization of global network + parameters. + + Upon u-boot's start up the first ping command causes a failure of the + consequent TFTP command. It happens in the recently added mechanism of + the NetLoop initialization where initialization of global network + parameters is separated in the NetInitLoop routine which is called per + env_id change. Thus, ping request will initialize the network parameters + necessary for ping operation only, afterwards the env_changed_id will be + set to the env_id that will prevent all following initialization requests + from other protocols. + The problem is that the initialized by ping subset of network parameters + is not sufficient for other protocols and particularly for TFTP which + requires the NetServerIp also. + + Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com> + Signed-off-by: Ben Warren <biggerbadderben@gmail.com> + +commit b11f664f52c2855990107c18f242223377183575 +Author: Timur Tabi <timur@freescale.com> +Date: Thu Apr 9 10:27:05 2009 -0500 + + net: fix ULI 526x macro usage in netdev.h + + Change netdev.h to use CONFIG_ULI526X instead of CONFIG_ULI526. CONFIG_ULI526X + is used everywhere else, so that's the correct macro name. Without this fix, + Ethernet will not work on the Freescale MPC8610 HPCD. + + Signed-off-by: Timur Tabi <timur@freescale.com> + Signed-off-by: Ben Warren <biggerbadderben@gmail.com> + +commit 7ee38c044ca5041d3378d6507580ea4ec344af96 +Author: David Brownell <dbrownell@users.sourceforge.net> +Date: Sun Apr 12 15:38:06 2009 -0700 + + fix DaVinci NS16550_REG_SIZE regression + + Update the DaVinci DM6446 boards to use the new convention + for CONFIG_SYS_NS16550_REG_SIZE ... the size hasn't changed + from the original 4 bytes, but these chips are little-endian. + + (Resolves a regression added recently by the include/ns16550.h + patch to "Unify structure declaration for registers". The code + previously worked just fine because the registers were accessed + as host-endian words, not as bytes.) + + Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> + +commit dfc99e143fca44a492918ac6cf3f76ee9c2473a9 +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sun Apr 12 22:29:20 2009 -0400 + + cmd_nand: drop duplicate NULL ptr check + + The first if statement checks for NULL ptrs, so there is no need to check + it again in later else cases (such as .oob). + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + CC: Scott Wood <scottwood@freescale.com> + +commit 7732cef2eeb4e339cfcd8553fab773af73a20805 +Author: David Brownell <dbrownell@users.sourceforge.net> +Date: Mon Apr 13 08:03:38 2009 -0700 + + CMD_UBI != MTD_PARTITIONS + + Fix dependency goofage: it should certainly be possible to have the + partition support without bringing in UBI commands. + + Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> + Acked-by: Stefan Roese <sr@denx.de> + +commit 6ebff365eb63093ca35b687316002535c6a18820 +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Thu Apr 16 21:30:48 2009 +0200 + + at91sam9/at91cap: fix CONFIG_SYS_HZ to 1000 + + The timer has been rewrote with a precision at ~0,18% + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + Tested-by: Sergey Lapin <slapin@ossfans.org> + Tested-by: Eric BENARD <ebenard@free.fr> + +commit f0a2c7b4b64eacd06bb272856bcc056be8719f5a +Author: Ilko Iliev <iliev@ronetix.at> +Date: Thu Apr 16 21:30:48 2009 +0200 + + at91: add support for the PM9263 board of Ronetix GmbH + + The PM9263 board is based on the AT91SAM9263-EK board. + + Here is the page on Ronetix website: + http://www.ronetix.at/starter_kit_9263.html + + Signed-off-by: Ilko Iliev <iliev@ronetix.at> + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit dc39ae9513c32dfeb9e018dc0d22c6484514fefb +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Thu Apr 16 21:30:44 2009 +0200 + + at91sam9/at91cap: improve clock framework + + calculate dynamically the clock rate and pllb setting for usb + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit dd7c302099ef5590069bdbf292aaa8230cd59de7 +Author: Stefan Roese <sr@denx.de> +Date: Wed Apr 15 14:08:48 2009 +0200 + + ppc4xx: Disable POST memory test on NAND-booting Kilauea + + Don't run the memory POST on the NAND-booting version. It will + overwrite part of the U-Boot image which is already loaded from NAND + to SDRAM. We were just lucky that it booted at all with this SDRAM + test enabled. + + Signed-off-by: Stefan Roese <sr@denx.de> + +commit 9a929170be89b27bce677504da27e88600c06c49 +Author: Stefan Roese <sr@denx.de> +Date: Wed Apr 15 14:06:26 2009 +0200 + + ppc4xx: Disable POST memory test on NAND-booting Sequoia + + Don't run the memory POST on the NAND-booting version. It will + overwrite part of the U-Boot image which is already loaded from NAND + to SDRAM. We were just lucky that it booted at all with this SDRAM + test enabled. + + Signed-off-by: Stefan Roese <sr@denx.de> + +commit 17c1b0e89b8be7d90f605eb19af9218c6275bfb3 +Author: Stefan Roese <sr@denx.de> +Date: Wed Apr 15 11:32:53 2009 +0200 + + ppc4xx: Remove unused code for Sequoia NAND booting version + + The current define of get_bus_freq() in the CONFIG_NAND_SPL #ifdef is not + used at all. This patch changes it's define to the currently used value of + 133333333 and removes the unnecessary code. + + Signed-off-by: Stefan Roese <sr@denx.de> + +commit cf9409885cbe01405bad76790e99f8adf3351f4d +Author: Stefan Roese <sr@denx.de> +Date: Wed Apr 15 10:50:48 2009 +0200 + + ppc4xx: Add "booting from NAND" to 4xx NAND-booting targets + + This additional text in the bootup log helps to see if the board is + configured for NAND-booting. Especially helpful for boards that can + boot from NOR and NAND (e.g. most of the AMCC eval boards). + + Signed-off-by: Stefan Roese <sr@denx.de> + +commit 5132106a27b8fb302677852b26ffd319b40d17e2 +Author: Stefan Roese <sr@denx.de> +Date: Wed Apr 8 10:36:22 2009 +0200 + + ppc4xx: Fixup chip-selects in dtb for NAND-booting Sequoia + + Currently the NOR & NAND support in Linux only works for the "standard" + Sequoia, the version booting for NOR flash. The NAND-booting version + has the chip-selects swapped. Here the chip-select mappings: + + "Standard" NOR-booting version: + CS0 NOR + CS3 NAND + + NAND-booting version: + CS0 NAND + CS3 NOR + + With this path the dtb gets fixed-up, so that the correct chip-select + numbers are patched in the dtb enabling correct NOR & NAND support + in Linux on the NAND-booting Sequoia version. + + Signed-off-by: Stefan Roese <sr@denx.de> + +commit aad4eca4ba8d597747199d8af723426681557dda +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 09:10:27 2009 -0400 + + Blackfin: audit UART for all known anomalies + + There is no code change here, just new comments, but this keeps me from + having to do another audit from scratch in the future. + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit 8ef929afa43c77c9573caa57c6e17a97a33775c0 +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 08:40:13 2009 -0400 + + Blackfin: add check for anomaly 05000362 + + DESCRIPTION: + The column address width settings for banks 2 and 3 are misconnected in + the SDRAM controller. Accesses to bank 2 will result in an error if the + Column Address Width for bank 3 (EB3CAW ) is not set to be the same as + that of bank 2. + + WORKAROUND: + If using bank 2, make sure that banks 2 and 3 have the same column address + width settings in the EBIU_SDBCTL register. This must be the case + regardless of whether or not bank 3 is enabled. + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit c2e07449f546fb375289cdac1a608fdc20357873 +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 08:29:55 2009 -0400 + + Blackfin: add comment about anomaly 05000430 avoidance + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit 48ab1509254a4c175e4f65c478a978928ffe09ec +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 08:10:22 2009 -0400 + + Blackfin: add workaround for anomaly 05000242 + + DESCRIPTION: + If the DF bit is set prior to a hardware reset, the PLL will continue to + divide CLKIN by 2 after the hardware reset, but the DF bit itself will be + cleared in the PLL_CTL register. + + WORKAROUND: + Reprogram the PLL with DF cleared if the desire is to not divide CLKIN by + 2 after reset. + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit ce1fe4ba6bb9df7c57351436fa17d1af8bbe7916 +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 08:09:24 2009 -0400 + + Blackfin: add workaround for anomaly 05000171 + + DESCRIPTION: + The Boot ROM is executed at power up/reset and changes the value of the + SICA_IWR registers from their default reset value of 0xFFFF, but does not + restore them. + + WORKAROUND: + User code should not rely on the default value of these registers. Set + the desired values explicitly. + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit 51ee6e057f7a920e2a125cd9f985d10f625e355f +Author: Mike Frysinger <vapier@gentoo.org> +Date: Sat Apr 4 08:22:36 2009 -0400 + + Blackfin: update anomaly sheets + + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit a343ba87ea0320ca0a4ecfa2c42cd9d4f18883df +Author: Graf Yang <graf.yang@analog.com> +Date: Sat Apr 4 07:45:57 2009 -0400 + + Blackfin: nand: flush peripheral before polling it + + We need to make sure the data written to the nand flash controller makes + it there before we start polling its status register. Otherwise, we may + get stale data and return before the controller is actually ready. + + Signed-off-by: Graf Yang <graf.yang@analog.com> + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + Acked-by: Scott Wood <scottwood@freescale.com> + +commit 3ccbfb25f48af78e7092ac75f3115e924e76c748 +Author: Remy Bohmer <linux@bohmer.net> +Date: Sun Apr 5 11:43:28 2009 +0200 + + Support for PXA27X UDC. + + This Patch adds Support for PXA27X UDC. + (Rebased to drivers/usb reorganisation) + + Signed-off-by: Vivek Kutal <vivek.kutal@azingo.com> + Signed-off-by: Remy Bohmer <linux@bohmer.net> + +commit 2731b9a86685190d26b1883f27afda5ac8e1a313 +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Fri Apr 3 12:46:58 2009 +0200 + + drivers/usb: regorganisation + + move to linux usb driver organisation + + as following + + drivers/usb/gadget + drivers/usb/host + drivers/usb/musb + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + Signed-off-by: Remy Bohmer <linux@bohmer.net> + +commit d04371a116d102e587ba7aa4c329b441cdbea3f4 +Author: Todor I Mollov <tmollov@ucsd.edu> +Date: Sat Apr 4 06:53:06 2009 -0400 + + Blackfin: spi: make cs deassert function deterministic + + Blackfin SPI driver was not driving the SPI chip-select high before + putting the chip-select signals into tri-state mode. This is probably + something that slipped by unnoticed in most designs. If the signals are + put directly into a tri-state mode, then the board is relying on the + pull-up resistors to pull up the chip-select before the next transaction. + Most of the time this is fine, except when you have two transactions that + follow each other very closely, such as the flash erase and read status + register commands. In this case I was seeing a 500ns separation between + the transactions. In my setup, with a 10kOhm pull-up, it would meet + timing spec about half the time and resulted in intermittent errors. (A + stronger pull up would fix this, but our design is targeted for low power + consumption and a 3.3kOhm @ 3.3v is 3.3mW of needless power consumption.) + I modified the spi_cs_deactivate() function in bfin_spi.c to drive the + chip-selects high before putting them into tri-state. For me, this + resulted in a rise time of 5ns instead of the previous rise time of about + 1us, and fully satisfied the timing spec of the chip. + + Signed-off-by: Todor I Mollov <tmollov@ucsd.edu> + Signed-off-by: Mike Frysinger <vapier@gentoo.org> + +commit c6fadb9c73a6a3e0c7f20696e978304a593a8d2d +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Sat Dec 13 21:08:05 2008 +0100 + + integratorap: fix PCI support + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit 1c397508c836dfcb01fb2471c71de0727051f117 +Author: Dirk Behme <dirk.behme@googlemail.com> +Date: Mon Mar 30 21:15:23 2009 +0200 + + OMAP3: Update Overo pin mux for new expansion board + + A new Overo expansion board uses GPIO 14, 21, 22 and 23 for LED's and + switches. This patch changes the pinmux configuration for those pins. + They were previously set up for unused MMC3_DAT4-7. + + Signed-off-by: Steve Sakoman <steve@sakoman.com> + Signed-off-by: Dirk Behme <dirk.behme@googlemail.com> + +commit ab298231518675b3784aea88ee9b978438f99e63 +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Sun Apr 5 13:08:03 2009 +0200 + + arm: unify reset command + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit b3acb6cd4059dfb29a5e99095d802717f53ff784 +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Sun Apr 5 13:06:31 2009 +0200 + + arm: clean cache management + + unify arm cache management except for non standard cache as ARM7TDMI + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit 677e62f43235de9a1701204d7bcea0fb3d233fa1 +Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Sun Apr 5 13:02:43 2009 +0200 + + arm: update co-processor 15 access + + import system.h from linux + + Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + +commit 23e4af49e066a53cd3e3659b68ef90572d88de84 +Author: Guennadi Liakhovetski <lg@denx.de> +Date: Sun Apr 5 00:42:02 2009 +0200 + + ARM: add the imx31_phycore_eet target to MAINTAINERS + + imx31_phycore_eet is a variant of the imx31_phycore board with a few + extensions, which justifies a separate entry in the MAINTAINERS list, + whereas normally all entries sharing a single configuration file and a + board/ directory have only one entry in MAINTAINERS. + + Reported-by: Wolfgang Denk <wd@denx.de> + Signed-off-by: Guennadi Liakhovetski <lg@denx.de> + +commit 69c5bf29908b3a7f8e23bd9891b7ecc5b21f23e5 +Author: Guennadi Liakhovetski <lg@denx.de> +Date: Sun Apr 5 00:37:07 2009 +0200 + + ARM: fix out-of-tree build of imx31_phycore_eet + + Fix out-of-tree build of the imx31_phycore_eet target. + + Reported-by: Wolfgang Denk <wd@denx.de> + Signed-off-by: Guennadi Liakhovetski <lg@denx.de> + +commit 3c853f31d6a8e4407f73a2ca2c63d383a245f237 +Author: Jon Smirl <jonsmirl@gmail.com> +Date: Sat Apr 4 17:44:51 2009 -0400 + + mpc5200: reduce delays in i2c + + The previous code waited 1000us before checking i2c + status. Measurement shows i2c is usually ready in + under 50us. Change the polling interval to 15us, + loop 6,667 times to keep the polling timeout constant + at 100ms. + +commit 36003268968949110ef145d9f2eaf8439c96d25b +Author: Sanjeev Premi <premi@ti.com> +Date: Fri Apr 3 14:00:07 2009 +0530 + + OMAP: Fix compile issue + + Fixes this compile error: + board.c: In function 'do_switch_ecc': + board.c:339: error: 'cmd_tbl_t' has no member named 'help' + make[1]: *** [board.o] Error 1 + make[1]: Leaving directory `/db/psp_git/users/a0756819/u-boot/cpu/arm_cortexa8/omap3' + make: *** [cpu/arm_cortexa8/omap3/libomap3.a] Error 2 + + This is due to the fact that current command uses long + help for the usage print even if the CONFIG_SYS_LONGHELP + is not enabled. (Thanks Jean-Christophe for explanation). + + Signed-off-by: Sanjeev Premi <premi@ti.com> + +commit 342c1a5d9ab74febf3226a86216dc5aa05295d46 +Author: Minkyu Kang <mk7.kang@samsung.com> +Date: Fri Apr 3 09:56:16 2009 +0900 + + s3c64xx: fix the wrong gpio offset + + This patch fix the wrong gpio offset + + Signed-off-by: Minkyu Kang <mk7.kang@samsung.com> + +commit ab0689c316c9b2ee33f4de1c50263b64e539f12a +Author: Kyungmin Park <kmpark@infradead.org> +Date: Wed Nov 26 10:18:13 2008 +0900 + + Move machine specific code to board at s3c64xx (v2) + + Move machine specific code to smdk6400. + Some board use OneNAND instead of NAND. + + Some register MP0_CS_CFG[5:0] are controled by both h/w and s/w. + So it's better to use macro instead of hard-coded value. + + Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> + +commit 767f3acd9f6e1dcb8ada926c333945382eddc7e8 +Author: Tom Rix <Tom.Rix@windriver.com> +Date: Wed Apr 1 22:02:19 2009 -0500 + + ZOOM1 Remove legacy NAND defines + + Signed-off-by: Tom Rix <Tom.Rix@windriver.com> + +commit 5891151707ee5902fe62d554c247f42865815757 +Author: Tom Rix <Tom.Rix@windriver.com> +Date: Wed Apr 1 22:02:20 2009 -0500 + + OMAP3 Fix multiline formatting in board init files. + + Signed-off-by: Tom Rix <Tom.Rix@windriver.com> + +commit c0a14aedc3440d6591b8c86d45861a0a8b46e11d +Author: Wolfgang Denk <wd@denx.de> +Date: Sun Apr 5 00:27:57 2009 +0200 + + Update CHANGELOG, coding style cleanup. + commit f63728c804ab7413a67d70f6774cd30c3f7b40fb Author: Wolfgang Denk <wd@denx.de> Date: Sun Apr 5 00:18:44 2009 +0200 diff --git a/board/MAI/AmigaOneG3SE/enet.c b/board/MAI/AmigaOneG3SE/enet.c index ac969a9..b9df55c 100644 --- a/board/MAI/AmigaOneG3SE/enet.c +++ b/board/MAI/AmigaOneG3SE/enet.c @@ -297,50 +297,50 @@ static void eth_3com_halt(struct eth_device* dev); static inline int ETH_INL(struct eth_device* dev, u_long addr) { - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); return le32_to_cpu(*(volatile u32 *)io_to_phys(addr + dev->iobase)); } static inline int ETH_INW(struct eth_device* dev, u_long addr) { - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); return le16_to_cpu(*(volatile u16 *)io_to_phys(addr + dev->iobase)); } static inline int ETH_INB(struct eth_device* dev, u_long addr) { - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); return *(volatile u8 *)io_to_phys(addr + dev->iobase); } static inline void ETH_OUTB(struct eth_device* dev, int command, u_long addr) { *(volatile u8 *)io_to_phys(addr + dev->iobase) = command; - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); } static inline void ETH_OUTW(struct eth_device* dev, int command, u_long addr) { *(volatile u16 *)io_to_phys(addr + dev->iobase) = cpu_to_le16(command); - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); } static inline void ETH_OUTL(struct eth_device* dev, int command, u_long addr) { *(volatile u32 *)io_to_phys(addr + dev->iobase) = cpu_to_le32(command); - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); } static inline int ETH_STATUS(struct eth_device* dev) { - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); return le16_to_cpu(*(volatile u16 *)io_to_phys(EL3_STATUS + dev->iobase)); } static inline void ETH_CMD(struct eth_device* dev, int command) { *(volatile u16 *)io_to_phys(EL3_CMD + dev->iobase) = cpu_to_le16(command); - __asm volatile ("eieio"); + __asm__ volatile ("eieio"); } /* Command register is always in the same spot in all the register windows */ diff --git a/board/MAI/AmigaOneG3SE/flash_new.c b/board/MAI/AmigaOneG3SE/flash_new.c index 7b7ea16..9beb048 100644 --- a/board/MAI/AmigaOneG3SE/flash_new.c +++ b/board/MAI/AmigaOneG3SE/flash_new.c @@ -153,14 +153,14 @@ static ulong flash_get_size (ulong addr, flash_info_t *info) /* Write auto select command: read Manufacturer ID */ x[0x0555] = 0xAA; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); x[0x02AA] = 0x55; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); x[0x0555] = 0x90; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); value = x[0]; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); DEBUGF("Manuf. ID @ 0x%08lx: 0x%08x\n", (ulong)addr, value); @@ -186,7 +186,7 @@ static ulong flash_get_size (ulong addr, flash_info_t *info) } value = x[1]; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", addr+1, value); diff --git a/board/MAI/AmigaOneG3SE/serial.c b/board/MAI/AmigaOneG3SE/serial.c index 88039f3..84a913e 100644 --- a/board/MAI/AmigaOneG3SE/serial.c +++ b/board/MAI/AmigaOneG3SE/serial.c @@ -75,17 +75,17 @@ void serial_init (void) /* COM_WRITE_BYTE(LINE_CONTROL, 0x83); */ /* COM_WRITE_BYTE(DIVISOR_LATCH_LSB, (uint8)(clock_divisor & 0xFF)); */ /* COM_WRITE_BYTE(DIVISOR_LATCH_MSB, (uint8)(clock_divisor >> 8)); */ - /* __asm("eieio"); */ + /* __asm__("eieio"); */ /* Set 8-N-1 */ COM_WRITE_BYTE (LINE_CONTROL, 0x03); - __asm ("eieio"); + __asm__ ("eieio"); /* Disable FIFO */ COM_WRITE_BYTE (MODEM_CONTROL, 0x03); COM_WRITE_BYTE (FIFO_CONTROL, 0x07); - __asm ("eieio"); + __asm__ ("eieio"); serial_init_done = 1; } diff --git a/board/MAI/AmigaOneG3SE/via686.c b/board/MAI/AmigaOneG3SE/via686.c index 2427ce5..752a464 100644 --- a/board/MAI/AmigaOneG3SE/via686.c +++ b/board/MAI/AmigaOneG3SE/via686.c @@ -211,7 +211,7 @@ void via_cfgfunc_via686(struct pci_controller *host, pci_dev_t dev, struct pci_c } } -__asm (" .globl via_calibrate_time_base \n" +__asm__ (" .globl via_calibrate_time_base \n" "via_calibrate_time_base: \n" " lis 9, 0xfe00 \n" " li 0, 0x00 \n" diff --git a/board/ids8247/ids8247.c b/board/ids8247/ids8247.c index 68b7070..79fe9da 100644 --- a/board/ids8247/ids8247.c +++ b/board/ids8247/ids8247.c @@ -304,21 +304,97 @@ phys_size_t initdram (int board_type) int misc_init_r (void) { gd->bd->bi_flashstart = 0xff800000; + return 0; } #if defined(CONFIG_CMD_NAND) -extern ulong -nand_probe (ulong physadr); +#include <nand.h> +#include <linux/mtd/mtd.h> +#include <asm/io.h> + +static u8 hwctl; + +static void ids_nand_hwctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) +{ + struct nand_chip *this = mtd->priv; + + if (ctrl & NAND_CTRL_CHANGE) { + if ( ctrl & NAND_CLE ) { + hwctl |= 0x1; + writeb(0x00, (this->IO_ADDR_W + 0x0a)); + } else { + hwctl &= ~0x1; + writeb(0x00, (this->IO_ADDR_W + 0x08)); + } + if ( ctrl & NAND_ALE ) { + hwctl |= 0x2; + writeb(0x00, (this->IO_ADDR_W + 0x09)); + } else { + hwctl &= ~0x2; + writeb(0x00, (this->IO_ADDR_W + 0x08)); + } + if ( (ctrl & NAND_NCE) != NAND_NCE) + writeb(0x00, (this->IO_ADDR_W + 0x0c)); + else + writeb(0x00, (this->IO_ADDR_W + 0x08)); + } + if (cmd != NAND_CMD_NONE) + writeb(cmd, this->IO_ADDR_W); + +} -void -nand_init (void) +static u_char ids_nand_read_byte(struct mtd_info *mtd) { - ulong totlen = 0; + struct nand_chip *this = mtd->priv; - debug ("Probing at 0x%.8x\n", CONFIG_SYS_NAND0_BASE); - totlen += nand_probe (CONFIG_SYS_NAND0_BASE); + return readb(this->IO_ADDR_R); +} + +static void ids_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) +{ + struct nand_chip *nand = mtd->priv; + int i; + + for (i = 0; i < len; i++) { + if (hwctl & 0x1) + writeb(buf[i], (nand->IO_ADDR_W + 0x02)); + else if (hwctl & 0x2) + writeb(buf[i], (nand->IO_ADDR_W + 0x01)); + else + writeb(buf[i], nand->IO_ADDR_W); + } +} - printf ("%4lu MB\n", totlen >>20); +static void ids_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) +{ + struct nand_chip *this = mtd->priv; + int i; + + for (i = 0; i < len; i++) { + buf[i] = readb(this->IO_ADDR_R); + } +} + +static int ids_nand_dev_ready(struct mtd_info *mtd) +{ + /* constant delay (see also tR in the datasheet) */ + udelay(12); + return 1; +} + +int board_nand_init(struct nand_chip *nand) +{ + nand->ecc.mode = NAND_ECC_SOFT; + + /* Reference hardware control function */ + nand->cmd_ctrl = ids_nand_hwctrl; + nand->read_byte = ids_nand_read_byte; + nand->write_buf = ids_nand_write_buf; + nand->read_buf = ids_nand_read_buf; + nand->dev_ready = ids_nand_dev_ready; + nand->chip_delay = 12; + + return 0; } #endif /* CONFIG_CMD_NAND */ diff --git a/board/trab/vfd.c b/board/trab/vfd.c index eb506f3..37d3aa4 100644 --- a/board/trab/vfd.c +++ b/board/trab/vfd.c @@ -369,7 +369,7 @@ int vfd_init_clocks (void) gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */ /* allow signals to settle */ for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */ - __asm("NOP"); + __asm__("NOP"); vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */ VFD_DISABLE; /* activate blank for the vfd */ diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index c2dcc64..923b355 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -129,7 +129,8 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) char *filename = NULL; char *ep; int dev, part = 1; - ulong addr = 0, part_length, filelen; + ulong addr = 0, part_length; + int filelen; disk_partition_t info; block_dev_desc_t *dev_desc = NULL; char buf [12]; @@ -243,8 +244,8 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Loading ok, update default load address */ load_addr = addr; - printf ("\n%ld bytes read\n", filelen); - sprintf(buf, "%lX", filelen); + printf ("\n%d bytes read\n", filelen); + sprintf(buf, "%X", filelen); setenv("filesize", buf); return(filelen); diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 9bc6b4a..782ad1c 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -851,28 +851,6 @@ set_pcmcia_timing (int pmode) /* ------------------------------------------------------------------------- */ -#ifdef __PPC__ -# ifdef CONFIG_AMIGAONEG3SE -static void -output_data_short(int dev, ulong *sect_buf, int words) -{ - ushort *dbuf; - volatile ushort *pbuf; - - pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG); - dbuf = (ushort *)sect_buf; - while (words--) { - EIEIO; - *pbuf = *dbuf++; - EIEIO; - } - - if (words&1) - *pbuf = 0; -} -# endif /* CONFIG_AMIGAONEG3SE */ -#endif /* __PPC_ */ - /* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ #if defined(__LITTLE_ENDIAN) || ( defined(CONFIG_AU1X00) && !defined(CONFIG_GTH2) ) @@ -1028,28 +1006,6 @@ input_data(int dev, ulong *sect_buf, int words) #endif /* __PPC__ */ -#ifdef CONFIG_AMIGAONEG3SE -static void -input_data_short(int dev, ulong *sect_buf, int words) -{ - ushort *dbuf; - volatile ushort *pbuf; - - pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG); - dbuf = (ushort *)sect_buf; - while (words--) { - EIEIO; - *dbuf++ = *pbuf; - EIEIO; - } - - if (words&1) { - ushort dummy; - dummy = *pbuf; - } -} -#endif - /* ------------------------------------------------------------------------- */ static void ide_ident (block_dev_desc_t *dev_desc) diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 3d437c0..e7b6acc 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -1314,7 +1314,7 @@ static void list_partitions(void) printf("\ndevice %s%d <%s>, # parts = %d\n", MTD_DEV_TYPE(dev->id->type), dev->id->num, dev->id->mtd_id, dev->num_parts); - printf(" #: name\t\t\tsize\t\toffset\t\tmask_flags\n"); + printf(" #: name\t\tsize\t\toffset\t\tmask_flags\n"); /* list partitions for given device */ part_num = 0; diff --git a/common/cmd_nand.c b/common/cmd_nand.c index ff5bc6e..1992531 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -29,7 +29,7 @@ #include <jffs2/jffs2.h> #include <nand.h> -#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS) +#if defined(CONFIG_CMD_MTDPARTS) /* parition handling routines */ int mtdparts_init(void); @@ -105,7 +105,7 @@ static int arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, size_t *size) { int idx = nand_curr_device; -#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS) +#if defined(CONFIG_CMD_MTDPARTS) struct mtd_device *dev; struct part_info *part; u8 pnum; @@ -153,7 +153,7 @@ arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, size_t *size *size = nand->size - *off; } -#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS) +#if defined(CONFIG_CMD_MTDPARTS) out: #endif printf("device %d ", idx); @@ -598,7 +598,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) char *boot_device = NULL; int idx; ulong addr, offset = 0; -#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS) +#if defined(CONFIG_CMD_MTDPARTS) struct mtd_device *dev; struct part_info *part; u8 pnum; @@ -643,7 +643,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) offset = simple_strtoul(argv[3], NULL, 16); break; default: -#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS) +#if defined(CONFIG_CMD_MTDPARTS) usage: #endif cmd_usage(cmdtp); diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 9c17d71..02a2e55 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -4,7 +4,7 @@ * Copyright (C) 2008 Samsung Electronics * Kyungmin Park <kyungmin.park@samsung.com> * - * Copyright 2008 Stefan Roese <sr@denx.de>, DENX Software Engineering + * Copyright 2008-2009 Stefan Roese <sr@denx.de>, DENX Software Engineering * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -34,9 +34,8 @@ static char buffer[80]; static int ubi_initialized; struct selected_dev { - char dev_name[32]; /* NAND/OneNAND etc */ char part_name[80]; - int type; + int selected; int nr; struct mtd_info *mtd_info; }; @@ -448,19 +447,24 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } if (strcmp(argv[1], "part") == 0) { + char mtd_dev[16]; + struct mtd_device *dev; + struct part_info *part; + u8 pnum; + /* Print current partition */ if (argc == 2) { - if (ubi_dev.type == DEV_TYPE_NONE) { + if (!ubi_dev.selected) { printf("Error, no UBI device/partition selected!\n"); return 1; } - printf("%s Device %d: %s, partition %s\n", ubi_dev.dev_name, + printf("Device %d: %s, partition %s\n", ubi_dev.nr, ubi_dev.mtd_info->name, ubi_dev.part_name); return 0; } - if (argc < 4) { + if (argc < 3) { cmd_usage(cmdtp); return 1; } @@ -477,54 +481,27 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* - * Check for nor|nand|onenand selection + * Search the mtd device number where this partition + * is located */ -#if defined(CONFIG_CMD_NAND) - if (strcmp(argv[2], "nand") == 0) { - strcpy(ubi_dev.dev_name, "NAND"); - ubi_dev.type = DEV_TYPE_NAND; - ubi_dev.mtd_info = &nand_info[ubi_dev.nr]; - } -#endif -#if defined(CONFIG_FLASH_CFI_MTD) - if (strcmp(argv[2], "nor") == 0) { - char mtd_dev[16]; - struct mtd_device *dev; - struct part_info *part; - u8 pnum; - - /* - * Search the mtd device number where this partition - * is located - */ - if (find_dev_and_part(argv[3], &dev, &pnum, &part)) { - printf("Partition %s not found!\n", argv[3]); - return 1; - } - sprintf(mtd_dev, "nor%d", dev->id->num); - ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev); - strcpy(ubi_dev.dev_name, "NOR"); - ubi_dev.type = DEV_TYPE_NOR; - } -#endif -#if defined(CONFIG_CMD_ONENAND) - if (strcmp(argv[2], "onenand") == 0) { - strcpy(ubi_dev.dev_name, "OneNAND"); - ubi_dev.type = DEV_TYPE_ONENAND; - ubi_dev.mtd_info = &onenand_mtd; + if (find_dev_and_part(argv[2], &dev, &pnum, &part)) { + printf("Partition %s not found!\n", argv[2]); + return 1; } -#endif - - if (ubi_dev.type == DEV_TYPE_NONE) { - printf("Error, no UBI device/partition selected!\n"); + sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num); + ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev); + if (IS_ERR(ubi_dev.mtd_info)) { + printf("Partition %s not found on device %s!\n", argv[2], mtd_dev); return 1; } - strcpy(ubi_dev.part_name, argv[3]); + ubi_dev.selected = 1; + + strcpy(ubi_dev.part_name, argv[2]); err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name); if (err) { printf("UBI init error %d\n", err); - ubi_dev.type = DEV_TYPE_NONE; + ubi_dev.selected = 0; return err; } @@ -533,7 +510,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } - if ((strcmp(argv[1], "part") != 0) && (ubi_dev.type == DEV_TYPE_NONE)) { + if ((strcmp(argv[1], "part") != 0) && (!ubi_dev.selected)) { printf("Error, no UBI device/partition selected!\n"); return 1; } @@ -617,7 +594,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD(ubi, 6, 1, do_ubi, "ubi commands", - "part [nand|nor|onenand] [part]" + "part [part]" " - Show or set current partition\n" "ubi info [l[ayout]]" " - Display volume and ubi layout information\n" diff --git a/cpu/arm920t/at91rm9200/ether.c b/cpu/arm920t/at91rm9200/ether.c index b00b948..d9d33a2 100644 --- a/cpu/arm920t/at91rm9200/ether.c +++ b/cpu/arm920t/at91rm9200/ether.c @@ -53,10 +53,11 @@ typedef struct { #if defined(CONFIG_CMD_NET) /* alignment as per Errata #11 (64 bytes) is insufficient! */ -rbf_t rbfdt[RBF_FRAMEMAX] __attribute((aligned(512))); +rbf_t rbfdt[RBF_FRAMEMAX] __attribute__((aligned(512))); rbf_t *rbfp; -unsigned char rbf_framebuf[RBF_FRAMEMAX][RBF_FRAMELEN] __attribute((aligned(4))); +unsigned char rbf_framebuf[RBF_FRAMEMAX][RBF_FRAMELEN] + __attribute__((aligned(4))); /* structure to interface the PHY */ AT91S_PhyOps PhyOps; diff --git a/cpu/arm920t/s3c24x0/usb_ohci.h b/cpu/arm920t/s3c24x0/usb_ohci.h index 3af5fca..8e093fb 100644 --- a/cpu/arm920t/s3c24x0/usb_ohci.h +++ b/cpu/arm920t/s3c24x0/usb_ohci.h @@ -55,7 +55,7 @@ struct ed { struct usb_device *usb_dev; __u32 unused[3]; -} __attribute((aligned(16))); +} __attribute__((aligned(16))); typedef struct ed ed_t; @@ -112,7 +112,7 @@ struct td { __u32 data; __u32 unused2[2]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); typedef struct td td_t; #define OHCI_ED_SKIP (1 << 14) @@ -130,7 +130,7 @@ struct ohci_hcca { __u16 pad1; /* set to 0 on each frame_no change */ __u32 done_head; /* info returned for an interrupt */ u8 reserved_for_hc[116]; -} __attribute((aligned(256))); +} __attribute__((aligned(256))); /* @@ -172,7 +172,7 @@ struct ohci_regs { __u32 status; __u32 portstatus[MAX_ROOT_PORTS]; } roothub; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* OHCI CONTROL AND STATUS REGISTER MASKS */ diff --git a/cpu/ixp/npe/IxFeatureCtrl.c b/cpu/ixp/npe/IxFeatureCtrl.c index e02aabf..2e196a1 100644 --- a/cpu/ixp/npe/IxFeatureCtrl.c +++ b/cpu/ixp/npe/IxFeatureCtrl.c @@ -317,7 +317,7 @@ ixFeatureCtrlProductIdRead () /* Use ARM instruction to move register0 from coprocessor to ARM register */ #ifndef __wince - __asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(pdId) :); + __asm__("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(pdId) :); #else #ifndef IN_KERNEL diff --git a/cpu/mips/au1x00_usb_ohci.h b/cpu/mips/au1x00_usb_ohci.h index 631ef0a..bb9f351 100644 --- a/cpu/mips/au1x00_usb_ohci.h +++ b/cpu/mips/au1x00_usb_ohci.h @@ -56,7 +56,7 @@ struct ed { struct usb_device *usb_dev; __u32 unused[3]; -} __attribute((aligned(16))); +} __attribute__((aligned(16))); typedef struct ed ed_t; @@ -114,7 +114,7 @@ struct td { __u32 data; __u32 unused2[2]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); typedef struct td td_t; #define OHCI_ED_SKIP (1 << 14) @@ -132,7 +132,7 @@ struct ohci_hcca { __u16 pad1; /* set to 0 on each frame_no change */ __u32 done_head; /* info returned for an interrupt */ u8 reserved_for_hc[116]; -} __attribute((aligned(256))); +} __attribute__((aligned(256))); /* @@ -174,7 +174,7 @@ struct ohci_regs { __u32 status; __u32 portstatus[MAX_ROOT_PORTS]; } roothub; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* OHCI CONTROL AND STATUS REGISTER MASKS */ diff --git a/cpu/mpc5xxx/usb_ohci.h b/cpu/mpc5xxx/usb_ohci.h index 884f1d5..6eedbdd 100644 --- a/cpu/mpc5xxx/usb_ohci.h +++ b/cpu/mpc5xxx/usb_ohci.h @@ -56,7 +56,7 @@ struct ed { struct usb_device *usb_dev; __u32 unused[3]; -} __attribute((aligned(16))); +} __attribute__((aligned(16))); typedef struct ed ed_t; @@ -113,7 +113,7 @@ struct td { __u32 data; __u32 unused2[2]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); typedef struct td td_t; #define OHCI_ED_SKIP (1 << 14) @@ -136,7 +136,7 @@ struct ohci_hcca { #endif __u32 done_head; /* info returned for an interrupt */ u8 reserved_for_hc[116]; -} __attribute((aligned(256))); +} __attribute__((aligned(256))); /* @@ -178,7 +178,7 @@ struct ohci_regs { __u32 status; __u32 portstatus[MAX_ROOT_PORTS]; } roothub; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* OHCI CONTROL AND STATUS REGISTER MASKS */ diff --git a/cpu/mpc83xx/fdt.c b/cpu/mpc83xx/fdt.c index 4cc9047..13443cb 100644 --- a/cpu/mpc83xx/fdt.c +++ b/cpu/mpc83xx/fdt.c @@ -41,8 +41,8 @@ void fdt_fixup_muram (void *blob) data[0] = 0; data[1] = QE_MURAM_SIZE - 2 * sizeof(unsigned long); - do_fixup_by_path(blob, "/qe/muram/data-only", "reg", - data, sizeof (data), 0); + do_fixup_by_compat(blob, "fsl,qe-muram-data", "reg", + data, sizeof (data), 0); } #endif diff --git a/cpu/mpc86xx/cpu.c b/cpu/mpc86xx/cpu.c index c41616d..653a137 100644 --- a/cpu/mpc86xx/cpu.c +++ b/cpu/mpc86xx/cpu.c @@ -40,7 +40,7 @@ __board_reset(void) { /* Do nothing */ } -void board_reset(void) __attribute((weak, alias("__board_reset"))); +void board_reset(void) __attribute__((weak, alias("__board_reset"))); int diff --git a/cpu/ppc4xx/usb_ohci.h b/cpu/ppc4xx/usb_ohci.h index 706e05e..2c3dc4f 100644 --- a/cpu/ppc4xx/usb_ohci.h +++ b/cpu/ppc4xx/usb_ohci.h @@ -55,7 +55,7 @@ struct ed { struct usb_device *usb_dev; __u32 unused[3]; -} __attribute((aligned(16))); +} __attribute__((aligned(16))); typedef struct ed ed_t; /* TD info field */ @@ -111,7 +111,7 @@ struct td { __u32 data; __u32 unused2[2]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); typedef struct td td_t; #define OHCI_ED_SKIP (1 << 14) @@ -134,7 +134,7 @@ struct ohci_hcca { #endif __u32 done_head; /* info returned for an interrupt */ u8 reserved_for_hc[116]; -} __attribute((aligned(256))); +} __attribute__((aligned(256))); /* * Maximum number of root hub ports. @@ -175,7 +175,7 @@ struct ohci_regs { __u32 status; __u32 portstatus[MAX_ROOT_PORTS]; } roothub; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* OHCI CONTROL AND STATUS REGISTER MASKS */ diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 96186d9..7791c38 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -896,8 +896,8 @@ static int __def_mmc_init(bd_t *bis) return -1; } -int cpu_mmc_init(bd_t *bis) __attribute((weak, alias("__def_mmc_init"))); -int board_mmc_init(bd_t *bis) __attribute((weak, alias("__def_mmc_init"))); +int cpu_mmc_init(bd_t *bis) __attribute__((weak, alias("__def_mmc_init"))); +int board_mmc_init(bd_t *bis) __attribute__((weak, alias("__def_mmc_init"))); void print_mmc_devices(char separator) { diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c index 9ac1c86..f03e4fb 100644 --- a/drivers/mtd/cfi_mtd.c +++ b/drivers/mtd/cfi_mtd.c @@ -142,22 +142,12 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi) int sect_size = 0; int sect; + /* + * Select the largest sector size as erasesize (e.g. for UBI) + */ for (sect = 0; sect < fi->sector_count; sect++) { - if (!sect_size) { + if (flash_sector_size(fi, sect) > sect_size) sect_size = flash_sector_size(fi, sect); - continue; - } - - if (sect_size != flash_sector_size(fi, sect)) { - sect_size = 0; - break; - } - } - - if (!sect_size) { - puts("cfi-mtd: devices with multiple sector sizes are" - "not supported\n"); - return -EINVAL; } mtd->erasesize = sect_size; diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index 9d83794..d369115 100644 --- a/drivers/mtd/nand/nand.c +++ b/drivers/mtd/nand/nand.c @@ -37,11 +37,13 @@ static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE]; static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIST; static const char default_nand_name[] = "nand"; +static __attribute__((unused)) char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8]; static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, ulong base_addr) { int maxchips = CONFIG_SYS_NAND_MAX_CHIPS; + int __attribute__((unused)) i = 0; if (maxchips < 1) maxchips = 1; @@ -54,6 +56,16 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, mtd->name = (char *)default_nand_name; else mtd->name += gd->reloc_off; + +#ifdef CONFIG_MTD_PARTITIONS + /* + * Add MTD device so that we can reference it later + * via the mtdcore infrastructure (e.g. ubi). + */ + sprintf(dev_name[i], "nand%d", i); + mtd->name = dev_name[i++]; + add_mtd_device(mtd); +#endif } else mtd->name = NULL; } else { diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index e6ac859..360b070 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -68,6 +68,10 @@ #include <linux/mtd/nand.h> #include <linux/mtd/nand_ecc.h> +#ifdef CONFIG_MTD_PARTITIONS +#include <linux/mtd/partitions.h> +#endif + #include <asm/io.h> #include <asm/errno.h> diff --git a/drivers/mtd/onenand/onenand_uboot.c b/drivers/mtd/onenand/onenand_uboot.c index 4541b22..a95b922 100644 --- a/drivers/mtd/onenand/onenand_uboot.c +++ b/drivers/mtd/onenand/onenand_uboot.c @@ -20,6 +20,7 @@ struct mtd_info onenand_mtd; struct onenand_chip onenand_chip; +static __attribute__((unused)) char dev_name[] = "onenand0"; void onenand_init(void) { @@ -41,4 +42,13 @@ void onenand_init(void) puts("OneNAND: "); print_size(onenand_mtd.size, "\n"); + +#ifdef CONFIG_MTD_PARTITIONS + /* + * Add MTD device so that we can reference it later + * via the mtdcore infrastructure (e.g. ubi). + */ + onenand_mtd.name = dev_name; + add_mtd_device(&onenand_mtd); +#endif } diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index c52d307..8ca2bf7 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -113,7 +113,7 @@ void eth_halt(void); static int dm9000_probe(void); static u16 phy_read(int); static void phy_write(int, u16); -u16 read_srom_word(int); +static void read_srom_word(int, u8 *); static u8 DM9000_ior(int); static void DM9000_iow(int reg, u8 value); @@ -348,8 +348,8 @@ eth_init(bd_t * bd) /* Set Node address */ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { #if !defined(CONFIG_AT91SAM9261EK) - for (i = 0; i < 6; i++) - enetaddr[i] = read_srom_word(i); + for (i = 0; i < 3; i++) + read_srom_word(i, enetaddr + 2 * i); eth_setenv_enetaddr("ethaddr", enetaddr); #endif } @@ -541,14 +541,14 @@ eth_rx(void) /* Read a word data from SROM */ -u16 -read_srom_word(int offset) +static void read_srom_word(int offset, u8 *to) { DM9000_iow(DM9000_EPAR, offset); DM9000_iow(DM9000_EPCR, 0x4); udelay(8000); DM9000_iow(DM9000_EPCR, 0x0); - return (DM9000_ior(DM9000_EPDRL) + (DM9000_ior(DM9000_EPDRH) << 8)); + to[0] = DM9000_ior(DM9000_EPDRL); + to[1] = DM9000_ior(DM9000_EPDRH); } void diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index f8c14b4..83a05b4 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -420,6 +420,8 @@ static int rtl_recv(struct eth_device *dev) ioaddr = dev->iobase; cur_rx = tpc->cur_rx; + flush_cache((unsigned long)&tpc->RxDescArray[cur_rx], + sizeof(struct RxDesc)); if ((le32_to_cpu(tpc->RxDescArray[cur_rx].status) & OWNbit) == 0) { if (!(le32_to_cpu(tpc->RxDescArray[cur_rx].status) & RxRES)) { unsigned char rxdata[RX_BUF_LEN]; @@ -437,6 +439,8 @@ static int rtl_recv(struct eth_device *dev) cpu_to_le32(OWNbit + RX_BUF_SIZE); tpc->RxDescArray[cur_rx].buf_addr = cpu_to_le32((unsigned long)tpc->RxBufferRing[cur_rx]); + flush_cache((unsigned long)tpc->RxBufferRing[cur_rx], + RX_BUF_SIZE); } else { puts("Error Rx"); } @@ -478,6 +482,7 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length) /* point to the current txb incase multiple tx_rings are used */ ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE]; memcpy(ptxb, (char *)packet, (int)length); + flush_cache((unsigned long)ptxb, length); while (len < ETH_ZLEN) ptxb[len++] = '\0'; @@ -497,7 +502,10 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length) tpc->cur_tx++; to = currticks() + TX_TIMEOUT; - while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit) + do { + flush_cache((unsigned long)&tpc->TxDescArray[entry], + sizeof(struct TxDesc)); + } while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit) && (currticks() < to)); /* wait */ if (currticks() >= to) { @@ -639,6 +647,7 @@ static void rtl8169_init_ring(struct eth_device *dev) tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE]; tpc->RxDescArray[i].buf_addr = cpu_to_le32((unsigned long)tpc->RxBufferRing[i]); + flush_cache((unsigned long)tpc->RxBufferRing[i], RX_BUF_SIZE); } #ifdef DEBUG_RTL8169 diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index bb99a34..14c818d 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2006 +# (C) Copyright 2006-2009 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -50,7 +50,6 @@ COBJS-$(CONFIG_S3C44B0_SERIAL) += serial_s3c44b0.o COBJS-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o COBJS-$(CONFIG_SCIF_CONSOLE) += serial_sh.o COBJS-$(CONFIG_USB_TTY) += usbtty.o -COBJS-$(CONFIG_VCT_SERIAL) += vct.o COBJS := $(sort $(COBJS-y)) SRCS := $(COBJS:.o=.c) diff --git a/drivers/serial/vct.c b/drivers/serial/vct.c deleted file mode 100755 index 556c114..0000000 --- a/drivers/serial/vct.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright 2008 Stefan Roese <sr@denx.de>, DENX Software Engineering - * - * 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 <config.h> -#include <common.h> -#include <asm/io.h> - -#ifdef CONFIG_VCT_PLATINUMAVC -#define UART_1_BASE 0xBDC30000 -#else -#define UART_1_BASE 0xBF89C000 -#endif - -#define UART_RBR_OFF 0x00 /* receiver buffer reg */ -#define UART_THR_OFF 0x00 /* transmit holding reg */ -#define UART_DLL_OFF 0x00 /* divisor latch low reg */ -#define UART_IER_OFF 0x04 /* interrupt enable reg */ -#define UART_DLH_OFF 0x04 /* receiver buffer reg */ -#define UART_FCR_OFF 0x08 /* fifo control register */ -#define UART_LCR_OFF 0x0c /* line control register */ -#define UART_MCR_OFF 0x10 /* modem control register */ -#define UART_LSR_OFF 0x14 /* line status register */ -#define UART_MSR_OFF 0x18 /* modem status register */ -#define UART_SCR_OFF 0x1c /* scratch pad register */ - -#define UART_RCV_DATA_RDY 0x01 /* Data Received */ -#define UART_XMT_HOLD_EMPTY 0x20 -#define UART_TRANSMIT_EMPTY 0x40 - -/* 7 bit on line control reg. enalbing rw to dll and dlh */ -#define UART_LCR_DLAB 0x0080 - -#define UART___9600_BDR 0x84 -#define UART__19200_BDR 0x42 -#define UART_115200_BDR 0x08 - -#define UART_DIS_ALL_INTER 0x00 /* disable all interrupts */ - -#define UART_5DATA_BITS 0x0000 /* 5 [bits] 1.5 bits 2 */ -#define UART_6DATA_BITS 0x0001 /* 6 [bits] 1 bits 2 */ -#define UART_7DATA_BITS 0x0002 /* 7 [bits] 1 bits 2 */ -#define UART_8DATA_BITS 0x0003 /* 8 [bits] 1 bits 2 */ - -static void vct_uart_set_baud_rate(u32 address, u32 dh, u32 dl) -{ - u32 val = __raw_readl(UART_1_BASE + UART_LCR_OFF); - - /* set 7 bit on 1 */ - val |= UART_LCR_DLAB; - __raw_writel(val, UART_1_BASE + UART_LCR_OFF); - - __raw_writel(dl, UART_1_BASE + UART_DLL_OFF); - __raw_writel(dh, UART_1_BASE + UART_DLH_OFF); - - /* set 7 bit on 0 */ - val &= ~UART_LCR_DLAB; - __raw_writel(val, UART_1_BASE + UART_LCR_OFF); - - return; -} - -int serial_init(void) -{ - __raw_writel(UART_DIS_ALL_INTER, UART_1_BASE + UART_IER_OFF); - vct_uart_set_baud_rate(UART_1_BASE, 0, UART_115200_BDR); - __raw_writel(UART_8DATA_BITS, UART_1_BASE + UART_LCR_OFF); - - return 0; -} - -void serial_setbrg(void) -{ - /* - * Baudrate change not supported currently, fixed to 115200 baud - */ -} - -void serial_putc(const char c) -{ - if (c == '\n') - serial_putc('\r'); - - while (!(UART_XMT_HOLD_EMPTY & __raw_readl(UART_1_BASE + UART_LSR_OFF))) - ; - - __raw_writel(c, UART_1_BASE + UART_THR_OFF); -} - -void serial_puts(const char *s) -{ - while (*s) - serial_putc(*s++); -} - -int serial_getc(void) -{ - while (!(UART_RCV_DATA_RDY & __raw_readl(UART_1_BASE + UART_LSR_OFF))) - ; - - return __raw_readl(UART_1_BASE + UART_RBR_OFF) & 0xff; -} - -int serial_tstc(void) -{ - if (!(UART_RCV_DATA_RDY & __raw_readl(UART_1_BASE + UART_LSR_OFF))) - return 0; - - return 1; -} diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index a547337..79aa79d 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -101,7 +101,7 @@ struct ed { struct usb_device *usb_dev; void *purb; __u32 unused[2]; -} __attribute((aligned(16))); +} __attribute__((aligned(16))); typedef struct ed ed_t; @@ -161,7 +161,7 @@ struct td { __u32 data; __u32 unused2[2]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); typedef struct td td_t; #define OHCI_ED_SKIP (1 << 14) @@ -184,7 +184,7 @@ struct ohci_hcca { #endif __u32 done_head; /* info returned for an interrupt */ u8 reserved_for_hc[116]; -} __attribute((aligned(256))); +} __attribute__((aligned(256))); /* @@ -228,7 +228,7 @@ struct ohci_regs { __u32 status; __u32 portstatus[CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS]; } roothub; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* Some EHCI controls */ #define EHCI_USBCMD_OFF 0x20 diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 2597c5f..b81c536 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -97,7 +97,7 @@ struct musb_regs { u8 rxhubaddr; u8 rxhubport; } tar[16]; -} __attribute((aligned(32))); +} __attribute__((aligned(32))); /* * MUSB Register bits diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 779aa4b..5ee2314 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1181,6 +1181,7 @@ static void *video_logo (void) { char info[128]; extern char version_string; + int space, len, y_off = 0; #ifdef CONFIG_SPLASH_SCREEN char *s; @@ -1198,7 +1199,19 @@ static void *video_logo (void) logo_plot (video_fb_address, VIDEO_COLS, 0, 0); sprintf (info, " %s", &version_string); - video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info); + + space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH; + len = strlen(info); + + if (len > space) { + video_drawchars (VIDEO_INFO_X, VIDEO_INFO_Y, + (uchar *)info, space); + video_drawchars (VIDEO_INFO_X + VIDEO_FONT_WIDTH, + VIDEO_INFO_Y + VIDEO_FONT_HEIGHT, + (uchar *)info + space, len - space); + y_off = 1; + } else + video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info); #ifdef CONFIG_CONSOLE_EXTRA_INFO { @@ -1206,10 +1219,27 @@ static void *video_logo (void) for (i = 1; i < n; i++) { video_get_info_str (i, info); - if (*info) + if (!*info) + continue; + + len = strlen(info); + if (len > space) { + video_drawchars (VIDEO_INFO_X, + VIDEO_INFO_Y + + (i + y_off) * VIDEO_FONT_HEIGHT, + (uchar *)info, space); + y_off++; + video_drawchars (VIDEO_INFO_X + VIDEO_FONT_WIDTH, + VIDEO_INFO_Y + + (i + y_off) * VIDEO_FONT_HEIGHT, + (uchar *)info + space, + len - space); + } else { video_drawstring (VIDEO_INFO_X, - VIDEO_INFO_Y + i * VIDEO_FONT_HEIGHT, + VIDEO_INFO_Y + + (i + y_off) * VIDEO_FONT_HEIGHT, (uchar *)info); + } } } #endif diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index fe3b364..7444650 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -418,59 +418,35 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, * @lnum: LEB number of the LEB from which @buf was read * @offs: offset from which @buf was read * - * This function scans @buf for more nodes and returns %0 is a node is found and - * %1 if no more nodes are found. + * This function ensures that the corrupted node at @offs is the last thing + * written to a LEB. This function returns %1 if more data is not found and + * %0 if more data is found. */ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int lnum, int offs) { - int skip, next_offs = 0; + struct ubifs_ch *ch = buf; + int skip, dlen = le32_to_cpu(ch->len); - if (len > UBIFS_DATA_NODE_SZ) { - struct ubifs_ch *ch = buf; - int dlen = le32_to_cpu(ch->len); - - if (ch->node_type == UBIFS_DATA_NODE && dlen >= UBIFS_CH_SZ && - dlen <= UBIFS_MAX_DATA_NODE_SZ) - /* The corrupt node looks like a data node */ - next_offs = ALIGN(offs + dlen, 8); - } - - if (c->min_io_size == 1) - skip = 8; - else - skip = ALIGN(offs + 1, c->min_io_size) - offs; - - offs += skip; - buf += skip; - len -= skip; - while (len > 8) { - struct ubifs_ch *ch = buf; - uint32_t magic = le32_to_cpu(ch->magic); - int ret; - - if (magic == UBIFS_NODE_MAGIC) { - ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); - if (ret == SCANNED_A_NODE || ret > 0) { - /* - * There is a small chance this is just data in - * a data node, so check that possibility. e.g. - * this is part of a file that itself contains - * a UBIFS image. - */ - if (next_offs && offs + le32_to_cpu(ch->len) <= - next_offs) - continue; - dbg_rcvry("unexpected node at %d:%d", lnum, - offs); - return 0; - } - } - offs += 8; - buf += 8; - len -= 8; + /* Check for empty space after the corrupt node's common header */ + skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs; + if (is_empty(buf + skip, len - skip)) + return 1; + /* + * The area after the common header size is not empty, so the common + * header must be intact. Check it. + */ + if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) { + dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs); + return 0; } - return 1; + /* Now we know the corrupt node's length we can skip over it */ + skip = ALIGN(offs + dlen, c->min_io_size) - offs; + /* After which there should be empty space */ + if (is_empty(buf + skip, len - skip)) + return 1; + dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); + return 0; } /** diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c deleted file mode 100644 index 8ac76b1..0000000 --- a/fs/ubifs/tnc_commit.c +++ /dev/null @@ -1,1102 +0,0 @@ -/* - * This file is part of UBIFS. - * - * Copyright (C) 2006-2008 Nokia Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * 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., 51 - * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Adrian Hunter - * Artem Bityutskiy (Битюцкий Артём) - */ - -/* This file implements TNC functions for committing */ - -#include "ubifs.h" - -/** - * make_idx_node - make an index node for fill-the-gaps method of TNC commit. - * @c: UBIFS file-system description object - * @idx: buffer in which to place new index node - * @znode: znode from which to make new index node - * @lnum: LEB number where new index node will be written - * @offs: offset where new index node will be written - * @len: length of new index node - */ -static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, - struct ubifs_znode *znode, int lnum, int offs, int len) -{ - struct ubifs_znode *zp; - int i, err; - - /* Make index node */ - idx->ch.node_type = UBIFS_IDX_NODE; - idx->child_cnt = cpu_to_le16(znode->child_cnt); - idx->level = cpu_to_le16(znode->level); - for (i = 0; i < znode->child_cnt; i++) { - struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); - struct ubifs_zbranch *zbr = &znode->zbranch[i]; - - key_write_idx(c, &zbr->key, &br->key); - br->lnum = cpu_to_le32(zbr->lnum); - br->offs = cpu_to_le32(zbr->offs); - br->len = cpu_to_le32(zbr->len); - if (!zbr->lnum || !zbr->len) { - ubifs_err("bad ref in znode"); - dbg_dump_znode(c, znode); - if (zbr->znode) - dbg_dump_znode(c, zbr->znode); - } - } - ubifs_prepare_node(c, idx, len, 0); - -#ifdef CONFIG_UBIFS_FS_DEBUG - znode->lnum = lnum; - znode->offs = offs; - znode->len = len; -#endif - - err = insert_old_idx_znode(c, znode); - - /* Update the parent */ - zp = znode->parent; - if (zp) { - struct ubifs_zbranch *zbr; - - zbr = &zp->zbranch[znode->iip]; - zbr->lnum = lnum; - zbr->offs = offs; - zbr->len = len; - } else { - c->zroot.lnum = lnum; - c->zroot.offs = offs; - c->zroot.len = len; - } - c->calc_idx_sz += ALIGN(len, 8); - - atomic_long_dec(&c->dirty_zn_cnt); - - ubifs_assert(ubifs_zn_dirty(znode)); - ubifs_assert(test_bit(COW_ZNODE, &znode->flags)); - - __clear_bit(DIRTY_ZNODE, &znode->flags); - __clear_bit(COW_ZNODE, &znode->flags); - - return err; -} - -/** - * fill_gap - make index nodes in gaps in dirty index LEBs. - * @c: UBIFS file-system description object - * @lnum: LEB number that gap appears in - * @gap_start: offset of start of gap - * @gap_end: offset of end of gap - * @dirt: adds dirty space to this - * - * This function returns the number of index nodes written into the gap. - */ -static int fill_gap(struct ubifs_info *c, int lnum, int gap_start, int gap_end, - int *dirt) -{ - int len, gap_remains, gap_pos, written, pad_len; - - ubifs_assert((gap_start & 7) == 0); - ubifs_assert((gap_end & 7) == 0); - ubifs_assert(gap_end >= gap_start); - - gap_remains = gap_end - gap_start; - if (!gap_remains) - return 0; - gap_pos = gap_start; - written = 0; - while (c->enext) { - len = ubifs_idx_node_sz(c, c->enext->child_cnt); - if (len < gap_remains) { - struct ubifs_znode *znode = c->enext; - const int alen = ALIGN(len, 8); - int err; - - ubifs_assert(alen <= gap_remains); - err = make_idx_node(c, c->ileb_buf + gap_pos, znode, - lnum, gap_pos, len); - if (err) - return err; - gap_remains -= alen; - gap_pos += alen; - c->enext = znode->cnext; - if (c->enext == c->cnext) - c->enext = NULL; - written += 1; - } else - break; - } - if (gap_end == c->leb_size) { - c->ileb_len = ALIGN(gap_pos, c->min_io_size); - /* Pad to end of min_io_size */ - pad_len = c->ileb_len - gap_pos; - } else - /* Pad to end of gap */ - pad_len = gap_remains; - dbg_gc("LEB %d:%d to %d len %d nodes written %d wasted bytes %d", - lnum, gap_start, gap_end, gap_end - gap_start, written, pad_len); - ubifs_pad(c, c->ileb_buf + gap_pos, pad_len); - *dirt += pad_len; - return written; -} - -/** - * find_old_idx - find an index node obsoleted since the last commit start. - * @c: UBIFS file-system description object - * @lnum: LEB number of obsoleted index node - * @offs: offset of obsoleted index node - * - * Returns %1 if found and %0 otherwise. - */ -static int find_old_idx(struct ubifs_info *c, int lnum, int offs) -{ - struct ubifs_old_idx *o; - struct rb_node *p; - - p = c->old_idx.rb_node; - while (p) { - o = rb_entry(p, struct ubifs_old_idx, rb); - if (lnum < o->lnum) - p = p->rb_left; - else if (lnum > o->lnum) - p = p->rb_right; - else if (offs < o->offs) - p = p->rb_left; - else if (offs > o->offs) - p = p->rb_right; - else - return 1; - } - return 0; -} - -/** - * is_idx_node_in_use - determine if an index node can be overwritten. - * @c: UBIFS file-system description object - * @key: key of index node - * @level: index node level - * @lnum: LEB number of index node - * @offs: offset of index node - * - * If @key / @lnum / @offs identify an index node that was not part of the old - * index, then this function returns %0 (obsolete). Else if the index node was - * part of the old index but is now dirty %1 is returned, else if it is clean %2 - * is returned. A negative error code is returned on failure. - */ -static int is_idx_node_in_use(struct ubifs_info *c, union ubifs_key *key, - int level, int lnum, int offs) -{ - int ret; - - ret = is_idx_node_in_tnc(c, key, level, lnum, offs); - if (ret < 0) - return ret; /* Error code */ - if (ret == 0) - if (find_old_idx(c, lnum, offs)) - return 1; - return ret; -} - -/** - * layout_leb_in_gaps - layout index nodes using in-the-gaps method. - * @c: UBIFS file-system description object - * @p: return LEB number here - * - * This function lays out new index nodes for dirty znodes using in-the-gaps - * method of TNC commit. - * This function merely puts the next znode into the next gap, making no attempt - * to try to maximise the number of znodes that fit. - * This function returns the number of index nodes written into the gaps, or a - * negative error code on failure. - */ -static int layout_leb_in_gaps(struct ubifs_info *c, int *p) -{ - struct ubifs_scan_leb *sleb; - struct ubifs_scan_node *snod; - int lnum, dirt = 0, gap_start, gap_end, err, written, tot_written; - - tot_written = 0; - /* Get an index LEB with lots of obsolete index nodes */ - lnum = ubifs_find_dirty_idx_leb(c); - if (lnum < 0) - /* - * There also may be dirt in the index head that could be - * filled, however we do not check there at present. - */ - return lnum; /* Error code */ - *p = lnum; - dbg_gc("LEB %d", lnum); - /* - * Scan the index LEB. We use the generic scan for this even though - * it is more comprehensive and less efficient than is needed for this - * purpose. - */ - sleb = ubifs_scan(c, lnum, 0, c->ileb_buf); - c->ileb_len = 0; - if (IS_ERR(sleb)) - return PTR_ERR(sleb); - gap_start = 0; - list_for_each_entry(snod, &sleb->nodes, list) { - struct ubifs_idx_node *idx; - int in_use, level; - - ubifs_assert(snod->type == UBIFS_IDX_NODE); - idx = snod->node; - key_read(c, ubifs_idx_key(c, idx), &snod->key); - level = le16_to_cpu(idx->level); - /* Determine if the index node is in use (not obsolete) */ - in_use = is_idx_node_in_use(c, &snod->key, level, lnum, - snod->offs); - if (in_use < 0) { - ubifs_scan_destroy(sleb); - return in_use; /* Error code */ - } - if (in_use) { - if (in_use == 1) - dirt += ALIGN(snod->len, 8); - /* - * The obsolete index nodes form gaps that can be - * overwritten. This gap has ended because we have - * found an index node that is still in use - * i.e. not obsolete - */ - gap_end = snod->offs; - /* Try to fill gap */ - written = fill_gap(c, lnum, gap_start, gap_end, &dirt); - if (written < 0) { - ubifs_scan_destroy(sleb); - return written; /* Error code */ - } - tot_written += written; - gap_start = ALIGN(snod->offs + snod->len, 8); - } - } - ubifs_scan_destroy(sleb); - c->ileb_len = c->leb_size; - gap_end = c->leb_size; - /* Try to fill gap */ - written = fill_gap(c, lnum, gap_start, gap_end, &dirt); - if (written < 0) - return written; /* Error code */ - tot_written += written; - if (tot_written == 0) { - struct ubifs_lprops lp; - - dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); - err = ubifs_read_one_lp(c, lnum, &lp); - if (err) - return err; - if (lp.free == c->leb_size) { - /* - * We must have snatched this LEB from the idx_gc list - * so we need to correct the free and dirty space. - */ - err = ubifs_change_one_lp(c, lnum, - c->leb_size - c->ileb_len, - dirt, 0, 0, 0); - if (err) - return err; - } - return 0; - } - err = ubifs_change_one_lp(c, lnum, c->leb_size - c->ileb_len, dirt, - 0, 0, 0); - if (err) - return err; - err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len, - UBI_SHORTTERM); - if (err) - return err; - dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); - return tot_written; -} - -/** - * get_leb_cnt - calculate the number of empty LEBs needed to commit. - * @c: UBIFS file-system description object - * @cnt: number of znodes to commit - * - * This function returns the number of empty LEBs needed to commit @cnt znodes - * to the current index head. The number is not exact and may be more than - * needed. - */ -static int get_leb_cnt(struct ubifs_info *c, int cnt) -{ - int d; - - /* Assume maximum index node size (i.e. overestimate space needed) */ - cnt -= (c->leb_size - c->ihead_offs) / c->max_idx_node_sz; - if (cnt < 0) - cnt = 0; - d = c->leb_size / c->max_idx_node_sz; - return DIV_ROUND_UP(cnt, d); -} - -/** - * layout_in_gaps - in-the-gaps method of committing TNC. - * @c: UBIFS file-system description object - * @cnt: number of dirty znodes to commit. - * - * This function lays out new index nodes for dirty znodes using in-the-gaps - * method of TNC commit. - * - * This function returns %0 on success and a negative error code on failure. - */ -static int layout_in_gaps(struct ubifs_info *c, int cnt) -{ - int err, leb_needed_cnt, written, *p; - - dbg_gc("%d znodes to write", cnt); - - c->gap_lebs = kmalloc(sizeof(int) * (c->lst.idx_lebs + 1), GFP_NOFS); - if (!c->gap_lebs) - return -ENOMEM; - - p = c->gap_lebs; - do { - ubifs_assert(p < c->gap_lebs + sizeof(int) * c->lst.idx_lebs); - written = layout_leb_in_gaps(c, p); - if (written < 0) { - err = written; - if (err != -ENOSPC) { - kfree(c->gap_lebs); - c->gap_lebs = NULL; - return err; - } - if (!dbg_force_in_the_gaps_enabled) { - /* - * Do not print scary warnings if the debugging - * option which forces in-the-gaps is enabled. - */ - ubifs_err("out of space"); - spin_lock(&c->space_lock); - dbg_dump_budg(c); - spin_unlock(&c->space_lock); - dbg_dump_lprops(c); - } - /* Try to commit anyway */ - err = 0; - break; - } - p++; - cnt -= written; - leb_needed_cnt = get_leb_cnt(c, cnt); - dbg_gc("%d znodes remaining, need %d LEBs, have %d", cnt, - leb_needed_cnt, c->ileb_cnt); - } while (leb_needed_cnt > c->ileb_cnt); - - *p = -1; - return 0; -} - -/** - * layout_in_empty_space - layout index nodes in empty space. - * @c: UBIFS file-system description object - * - * This function lays out new index nodes for dirty znodes using empty LEBs. - * - * This function returns %0 on success and a negative error code on failure. - */ -static int layout_in_empty_space(struct ubifs_info *c) -{ - struct ubifs_znode *znode, *cnext, *zp; - int lnum, offs, len, next_len, buf_len, buf_offs, used, avail; - int wlen, blen, err; - - cnext = c->enext; - if (!cnext) - return 0; - - lnum = c->ihead_lnum; - buf_offs = c->ihead_offs; - - buf_len = ubifs_idx_node_sz(c, c->fanout); - buf_len = ALIGN(buf_len, c->min_io_size); - used = 0; - avail = buf_len; - - /* Ensure there is enough room for first write */ - next_len = ubifs_idx_node_sz(c, cnext->child_cnt); - if (buf_offs + next_len > c->leb_size) - lnum = -1; - - while (1) { - znode = cnext; - - len = ubifs_idx_node_sz(c, znode->child_cnt); - - /* Determine the index node position */ - if (lnum == -1) { - if (c->ileb_nxt >= c->ileb_cnt) { - ubifs_err("out of space"); - return -ENOSPC; - } - lnum = c->ilebs[c->ileb_nxt++]; - buf_offs = 0; - used = 0; - avail = buf_len; - } - - offs = buf_offs + used; - -#ifdef CONFIG_UBIFS_FS_DEBUG - znode->lnum = lnum; - znode->offs = offs; - znode->len = len; -#endif - - /* Update the parent */ - zp = znode->parent; - if (zp) { - struct ubifs_zbranch *zbr; - int i; - - i = znode->iip; - zbr = &zp->zbranch[i]; - zbr->lnum = lnum; - zbr->offs = offs; - zbr->len = len; - } else { - c->zroot.lnum = lnum; - c->zroot.offs = offs; - c->zroot.len = len; - } - c->calc_idx_sz += ALIGN(len, 8); - - /* - * Once lprops is updated, we can decrease the dirty znode count - * but it is easier to just do it here. - */ - atomic_long_dec(&c->dirty_zn_cnt); - - /* - * Calculate the next index node length to see if there is - * enough room for it - */ - cnext = znode->cnext; - if (cnext == c->cnext) - next_len = 0; - else - next_len = ubifs_idx_node_sz(c, cnext->child_cnt); - - if (c->min_io_size == 1) { - buf_offs += ALIGN(len, 8); - if (next_len) { - if (buf_offs + next_len <= c->leb_size) - continue; - err = ubifs_update_one_lp(c, lnum, 0, - c->leb_size - buf_offs, 0, 0); - if (err) - return err; - lnum = -1; - continue; - } - err = ubifs_update_one_lp(c, lnum, - c->leb_size - buf_offs, 0, 0, 0); - if (err) - return err; - break; - } - - /* Update buffer positions */ - wlen = used + len; - used += ALIGN(len, 8); - avail -= ALIGN(len, 8); - - if (next_len != 0 && - buf_offs + used + next_len <= c->leb_size && - avail > 0) - continue; - - if (avail <= 0 && next_len && - buf_offs + used + next_len <= c->leb_size) - blen = buf_len; - else - blen = ALIGN(wlen, c->min_io_size); - - /* The buffer is full or there are no more znodes to do */ - buf_offs += blen; - if (next_len) { - if (buf_offs + next_len > c->leb_size) { - err = ubifs_update_one_lp(c, lnum, - c->leb_size - buf_offs, blen - used, - 0, 0); - if (err) - return err; - lnum = -1; - } - used -= blen; - if (used < 0) - used = 0; - avail = buf_len - used; - continue; - } - err = ubifs_update_one_lp(c, lnum, c->leb_size - buf_offs, - blen - used, 0, 0); - if (err) - return err; - break; - } - -#ifdef CONFIG_UBIFS_FS_DEBUG - c->new_ihead_lnum = lnum; - c->new_ihead_offs = buf_offs; -#endif - - return 0; -} - -/** - * layout_commit - determine positions of index nodes to commit. - * @c: UBIFS file-system description object - * @no_space: indicates that insufficient empty LEBs were allocated - * @cnt: number of znodes to commit - * - * Calculate and update the positions of index nodes to commit. If there were - * an insufficient number of empty LEBs allocated, then index nodes are placed - * into the gaps created by obsolete index nodes in non-empty index LEBs. For - * this purpose, an obsolete index node is one that was not in the index as at - * the end of the last commit. To write "in-the-gaps" requires that those index - * LEBs are updated atomically in-place. - */ -static int layout_commit(struct ubifs_info *c, int no_space, int cnt) -{ - int err; - - if (no_space) { - err = layout_in_gaps(c, cnt); - if (err) - return err; - } - err = layout_in_empty_space(c); - return err; -} - -/** - * find_first_dirty - find first dirty znode. - * @znode: znode to begin searching from - */ -static struct ubifs_znode *find_first_dirty(struct ubifs_znode *znode) -{ - int i, cont; - - if (!znode) - return NULL; - - while (1) { - if (znode->level == 0) { - if (ubifs_zn_dirty(znode)) - return znode; - return NULL; - } - cont = 0; - for (i = 0; i < znode->child_cnt; i++) { - struct ubifs_zbranch *zbr = &znode->zbranch[i]; - - if (zbr->znode && ubifs_zn_dirty(zbr->znode)) { - znode = zbr->znode; - cont = 1; - break; - } - } - if (!cont) { - if (ubifs_zn_dirty(znode)) - return znode; - return NULL; - } - } -} - -/** - * find_next_dirty - find next dirty znode. - * @znode: znode to begin searching from - */ -static struct ubifs_znode *find_next_dirty(struct ubifs_znode *znode) -{ - int n = znode->iip + 1; - - znode = znode->parent; - if (!znode) - return NULL; - for (; n < znode->child_cnt; n++) { - struct ubifs_zbranch *zbr = &znode->zbranch[n]; - - if (zbr->znode && ubifs_zn_dirty(zbr->znode)) - return find_first_dirty(zbr->znode); - } - return znode; -} - -/** - * get_znodes_to_commit - create list of dirty znodes to commit. - * @c: UBIFS file-system description object - * - * This function returns the number of znodes to commit. - */ -static int get_znodes_to_commit(struct ubifs_info *c) -{ - struct ubifs_znode *znode, *cnext; - int cnt = 0; - - c->cnext = find_first_dirty(c->zroot.znode); - znode = c->enext = c->cnext; - if (!znode) { - dbg_cmt("no znodes to commit"); - return 0; - } - cnt += 1; - while (1) { - ubifs_assert(!test_bit(COW_ZNODE, &znode->flags)); - __set_bit(COW_ZNODE, &znode->flags); - znode->alt = 0; - cnext = find_next_dirty(znode); - if (!cnext) { - znode->cnext = c->cnext; - break; - } - znode->cnext = cnext; - znode = cnext; - cnt += 1; - } - dbg_cmt("committing %d znodes", cnt); - ubifs_assert(cnt == atomic_long_read(&c->dirty_zn_cnt)); - return cnt; -} - -/** - * alloc_idx_lebs - allocate empty LEBs to be used to commit. - * @c: UBIFS file-system description object - * @cnt: number of znodes to commit - * - * This function returns %-ENOSPC if it cannot allocate a sufficient number of - * empty LEBs. %0 is returned on success, otherwise a negative error code - * is returned. - */ -static int alloc_idx_lebs(struct ubifs_info *c, int cnt) -{ - int i, leb_cnt, lnum; - - c->ileb_cnt = 0; - c->ileb_nxt = 0; - leb_cnt = get_leb_cnt(c, cnt); - dbg_cmt("need about %d empty LEBS for TNC commit", leb_cnt); - if (!leb_cnt) - return 0; - c->ilebs = kmalloc(leb_cnt * sizeof(int), GFP_NOFS); - if (!c->ilebs) - return -ENOMEM; - for (i = 0; i < leb_cnt; i++) { - lnum = ubifs_find_free_leb_for_idx(c); - if (lnum < 0) - return lnum; - c->ilebs[c->ileb_cnt++] = lnum; - dbg_cmt("LEB %d", lnum); - } - if (dbg_force_in_the_gaps()) - return -ENOSPC; - return 0; -} - -/** - * free_unused_idx_lebs - free unused LEBs that were allocated for the commit. - * @c: UBIFS file-system description object - * - * It is possible that we allocate more empty LEBs for the commit than we need. - * This functions frees the surplus. - * - * This function returns %0 on success and a negative error code on failure. - */ -static int free_unused_idx_lebs(struct ubifs_info *c) -{ - int i, err = 0, lnum, er; - - for (i = c->ileb_nxt; i < c->ileb_cnt; i++) { - lnum = c->ilebs[i]; - dbg_cmt("LEB %d", lnum); - er = ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, - LPROPS_INDEX | LPROPS_TAKEN, 0); - if (!err) - err = er; - } - return err; -} - -/** - * free_idx_lebs - free unused LEBs after commit end. - * @c: UBIFS file-system description object - * - * This function returns %0 on success and a negative error code on failure. - */ -static int free_idx_lebs(struct ubifs_info *c) -{ - int err; - - err = free_unused_idx_lebs(c); - kfree(c->ilebs); - c->ilebs = NULL; - return err; -} - -/** - * ubifs_tnc_start_commit - start TNC commit. - * @c: UBIFS file-system description object - * @zroot: new index root position is returned here - * - * This function prepares the list of indexing nodes to commit and lays out - * their positions on flash. If there is not enough free space it uses the - * in-gap commit method. Returns zero in case of success and a negative error - * code in case of failure. - */ -int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot) -{ - int err = 0, cnt; - - mutex_lock(&c->tnc_mutex); - err = dbg_check_tnc(c, 1); - if (err) - goto out; - cnt = get_znodes_to_commit(c); - if (cnt != 0) { - int no_space = 0; - - err = alloc_idx_lebs(c, cnt); - if (err == -ENOSPC) - no_space = 1; - else if (err) - goto out_free; - err = layout_commit(c, no_space, cnt); - if (err) - goto out_free; - ubifs_assert(atomic_long_read(&c->dirty_zn_cnt) == 0); - err = free_unused_idx_lebs(c); - if (err) - goto out; - } - destroy_old_idx(c); - memcpy(zroot, &c->zroot, sizeof(struct ubifs_zbranch)); - - err = ubifs_save_dirty_idx_lnums(c); - if (err) - goto out; - - spin_lock(&c->space_lock); - /* - * Although we have not finished committing yet, update size of the - * committed index ('c->old_idx_sz') and zero out the index growth - * budget. It is OK to do this now, because we've reserved all the - * space which is needed to commit the index, and it is save for the - * budgeting subsystem to assume the index is already committed, - * even though it is not. - */ - c->old_idx_sz = c->calc_idx_sz; - c->budg_uncommitted_idx = 0; - spin_unlock(&c->space_lock); - mutex_unlock(&c->tnc_mutex); - - dbg_cmt("number of index LEBs %d", c->lst.idx_lebs); - dbg_cmt("size of index %llu", c->calc_idx_sz); - return err; - -out_free: - free_idx_lebs(c); -out: - mutex_unlock(&c->tnc_mutex); - return err; -} - -/** - * write_index - write index nodes. - * @c: UBIFS file-system description object - * - * This function writes the index nodes whose positions were laid out in the - * layout_in_empty_space function. - */ -static int write_index(struct ubifs_info *c) -{ - struct ubifs_idx_node *idx; - struct ubifs_znode *znode, *cnext; - int i, lnum, offs, len, next_len, buf_len, buf_offs, used; - int avail, wlen, err, lnum_pos = 0; - - cnext = c->enext; - if (!cnext) - return 0; - - /* - * Always write index nodes to the index head so that index nodes and - * other types of nodes are never mixed in the same erase block. - */ - lnum = c->ihead_lnum; - buf_offs = c->ihead_offs; - - /* Allocate commit buffer */ - buf_len = ALIGN(c->max_idx_node_sz, c->min_io_size); - used = 0; - avail = buf_len; - - /* Ensure there is enough room for first write */ - next_len = ubifs_idx_node_sz(c, cnext->child_cnt); - if (buf_offs + next_len > c->leb_size) { - err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0, - LPROPS_TAKEN); - if (err) - return err; - lnum = -1; - } - - while (1) { - cond_resched(); - - znode = cnext; - idx = c->cbuf + used; - - /* Make index node */ - idx->ch.node_type = UBIFS_IDX_NODE; - idx->child_cnt = cpu_to_le16(znode->child_cnt); - idx->level = cpu_to_le16(znode->level); - for (i = 0; i < znode->child_cnt; i++) { - struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); - struct ubifs_zbranch *zbr = &znode->zbranch[i]; - - key_write_idx(c, &zbr->key, &br->key); - br->lnum = cpu_to_le32(zbr->lnum); - br->offs = cpu_to_le32(zbr->offs); - br->len = cpu_to_le32(zbr->len); - if (!zbr->lnum || !zbr->len) { - ubifs_err("bad ref in znode"); - dbg_dump_znode(c, znode); - if (zbr->znode) - dbg_dump_znode(c, zbr->znode); - } - } - len = ubifs_idx_node_sz(c, znode->child_cnt); - ubifs_prepare_node(c, idx, len, 0); - - /* Determine the index node position */ - if (lnum == -1) { - lnum = c->ilebs[lnum_pos++]; - buf_offs = 0; - used = 0; - avail = buf_len; - } - offs = buf_offs + used; - -#ifdef CONFIG_UBIFS_FS_DEBUG - if (lnum != znode->lnum || offs != znode->offs || - len != znode->len) { - ubifs_err("inconsistent znode posn"); - return -EINVAL; - } -#endif - - /* Grab some stuff from znode while we still can */ - cnext = znode->cnext; - - ubifs_assert(ubifs_zn_dirty(znode)); - ubifs_assert(test_bit(COW_ZNODE, &znode->flags)); - - /* - * It is important that other threads should see %DIRTY_ZNODE - * flag cleared before %COW_ZNODE. Specifically, it matters in - * the 'dirty_cow_znode()' function. This is the reason for the - * first barrier. Also, we want the bit changes to be seen to - * other threads ASAP, to avoid unnecesarry copying, which is - * the reason for the second barrier. - */ - clear_bit(DIRTY_ZNODE, &znode->flags); - smp_mb__before_clear_bit(); - clear_bit(COW_ZNODE, &znode->flags); - smp_mb__after_clear_bit(); - - /* Do not access znode from this point on */ - - /* Update buffer positions */ - wlen = used + len; - used += ALIGN(len, 8); - avail -= ALIGN(len, 8); - - /* - * Calculate the next index node length to see if there is - * enough room for it - */ - if (cnext == c->cnext) - next_len = 0; - else - next_len = ubifs_idx_node_sz(c, cnext->child_cnt); - - if (c->min_io_size == 1) { - /* - * Write the prepared index node immediately if there is - * no minimum IO size - */ - err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, - wlen, UBI_SHORTTERM); - if (err) - return err; - buf_offs += ALIGN(wlen, 8); - if (next_len) { - used = 0; - avail = buf_len; - if (buf_offs + next_len > c->leb_size) { - err = ubifs_update_one_lp(c, lnum, - LPROPS_NC, 0, 0, LPROPS_TAKEN); - if (err) - return err; - lnum = -1; - } - continue; - } - } else { - int blen, nxt_offs = buf_offs + used + next_len; - - if (next_len && nxt_offs <= c->leb_size) { - if (avail > 0) - continue; - else - blen = buf_len; - } else { - wlen = ALIGN(wlen, 8); - blen = ALIGN(wlen, c->min_io_size); - ubifs_pad(c, c->cbuf + wlen, blen - wlen); - } - /* - * The buffer is full or there are no more znodes - * to do - */ - err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, - blen, UBI_SHORTTERM); - if (err) - return err; - buf_offs += blen; - if (next_len) { - if (nxt_offs > c->leb_size) { - err = ubifs_update_one_lp(c, lnum, - LPROPS_NC, 0, 0, LPROPS_TAKEN); - if (err) - return err; - lnum = -1; - } - used -= blen; - if (used < 0) - used = 0; - avail = buf_len - used; - memmove(c->cbuf, c->cbuf + blen, used); - continue; - } - } - break; - } - -#ifdef CONFIG_UBIFS_FS_DEBUG - if (lnum != c->new_ihead_lnum || buf_offs != c->new_ihead_offs) { - ubifs_err("inconsistent ihead"); - return -EINVAL; - } -#endif - - c->ihead_lnum = lnum; - c->ihead_offs = buf_offs; - - return 0; -} - -/** - * free_obsolete_znodes - free obsolete znodes. - * @c: UBIFS file-system description object - * - * At the end of commit end, obsolete znodes are freed. - */ -static void free_obsolete_znodes(struct ubifs_info *c) -{ - struct ubifs_znode *znode, *cnext; - - cnext = c->cnext; - do { - znode = cnext; - cnext = znode->cnext; - if (test_bit(OBSOLETE_ZNODE, &znode->flags)) - kfree(znode); - else { - znode->cnext = NULL; - atomic_long_inc(&c->clean_zn_cnt); - atomic_long_inc(&ubifs_clean_zn_cnt); - } - } while (cnext != c->cnext); -} - -/** - * return_gap_lebs - return LEBs used by the in-gap commit method. - * @c: UBIFS file-system description object - * - * This function clears the "taken" flag for the LEBs which were used by the - * "commit in-the-gaps" method. - */ -static int return_gap_lebs(struct ubifs_info *c) -{ - int *p, err; - - if (!c->gap_lebs) - return 0; - - dbg_cmt(""); - for (p = c->gap_lebs; *p != -1; p++) { - err = ubifs_change_one_lp(c, *p, LPROPS_NC, LPROPS_NC, 0, - LPROPS_TAKEN, 0); - if (err) - return err; - } - - kfree(c->gap_lebs); - c->gap_lebs = NULL; - return 0; -} - -/** - * ubifs_tnc_end_commit - update the TNC for commit end. - * @c: UBIFS file-system description object - * - * Write the dirty znodes. - */ -int ubifs_tnc_end_commit(struct ubifs_info *c) -{ - int err; - - if (!c->cnext) - return 0; - - err = return_gap_lebs(c); - if (err) - return err; - - err = write_index(c); - if (err) - return err; - - mutex_lock(&c->tnc_mutex); - - dbg_cmt("TNC height is %d", c->zroot.znode->level + 1); - - free_obsolete_znodes(c); - - c->cnext = NULL; - kfree(c->ilebs); - c->ilebs = NULL; - - mutex_unlock(&c->tnc_mutex); - - return 0; -} diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 32f9ff8..427d84a 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -641,6 +641,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) ui = ubifs_inode(inode); if (((inode->i_mode & S_IFMT) == S_IFLNK) && ui->data_len) { memcpy(link_name, ui->data, ui->data_len); + link_name[ui->data_len] = '\0'; printf("%s is linked to %s!\n", filename, link_name); ubifs_iput(inode); diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index 44b4ca5..3ffcab2 100644 --- a/include/asm-m68k/types.h +++ b/include/asm-m68k/types.h @@ -21,7 +21,7 @@ __extension__ typedef unsigned long long __u64; typedef struct { __u32 u[4]; -} __attribute((aligned(16))) vector128; +} __attribute__((aligned(16))) vector128; #ifdef __KERNEL__ /* diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h index 864391f..b27a6b7 100644 --- a/include/asm-ppc/types.h +++ b/include/asm-ppc/types.h @@ -21,7 +21,7 @@ __extension__ typedef unsigned long long __u64; typedef struct { __u32 u[4]; -} __attribute((aligned(16))) vector128; +} __attribute__((aligned(16))) vector128; #ifdef __KERNEL__ /* diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h index 2cf974a..0a8a26c 100644 --- a/include/asm-sparc/types.h +++ b/include/asm-sparc/types.h @@ -42,7 +42,7 @@ typedef unsigned long long __u64; typedef struct { __u32 u[4]; -} __attribute((aligned(16))) vector128; +} __attribute__((aligned(16))) vector128; #ifdef __KERNEL__ /* diff --git a/include/configs/AmigaOneG3SE.h b/include/configs/AmigaOneG3SE.h index b71da1f..fe04f27 100644 --- a/include/configs/AmigaOneG3SE.h +++ b/include/configs/AmigaOneG3SE.h @@ -85,7 +85,7 @@ #define CONFIG_CMD_IDE #define CONFIG_CMD_FDC #define CONFIG_CMD_CACHE -#define CONFIG_CMD_CONSOLE| +#define CONFIG_CMD_CONSOLE #define CONFIG_CMD_USB #define CONFIG_CMD_BSP #define CONFIG_CMD_PCI diff --git a/include/configs/IDS8247.h b/include/configs/IDS8247.h index fbcbddb..51e012c 100644 --- a/include/configs/IDS8247.h +++ b/include/configs/IDS8247.h @@ -262,63 +262,8 @@ */ #if defined(CONFIG_CMD_NAND) -#define CONFIG_NAND_LEGACY #define CONFIG_SYS_NAND0_BASE 0xE1000000 - #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ -#define SECTORSIZE 512 -#define NAND_NO_RB - -#define ADDR_COLUMN 1 -#define ADDR_PAGE 2 -#define ADDR_COLUMN_PAGE 3 - -#define NAND_ChipID_UNKNOWN 0x00 -#define NAND_MAX_FLOORS 1 - -#define NAND_DISABLE_CE(nand) do \ -{ \ - *(((volatile __u8 *)(nand->IO_ADDR)) + 0xc) = 0; \ -} while(0) - -#define NAND_ENABLE_CE(nand) do \ -{ \ - *(((volatile __u8 *)(nand->IO_ADDR)) + 0x8) = 0; \ -} while(0) - -#define NAND_CTL_CLRALE(nandptr) do \ -{ \ - *(((volatile __u8 *)nandptr) + 0x8) = 0; \ -} while(0) - -#define NAND_CTL_SETALE(nandptr) do \ -{ \ - *(((volatile __u8 *)nandptr) + 0x9) = 0; \ -} while(0) - -#define NAND_CTL_CLRCLE(nandptr) do \ -{ \ - *(((volatile __u8 *)nandptr) + 0x8) = 0; \ -} while(0) - -#define NAND_CTL_SETCLE(nandptr) do \ -{ \ - *(((volatile __u8 *)nandptr) + 0xa) = 0; \ -} while(0) - -#ifdef NAND_NO_RB -/* constant delay (see also tR in the datasheet) */ -#define NAND_WAIT_READY(nand) do { \ - udelay(12); \ -} while (0) -#else -/* use the R/B pin */ -#endif - -#define WRITE_NAND_COMMAND(d, adr) do{ *(volatile __u8 *)((unsigned long)(adr + 0x2)) = (__u8)(d); } while(0) -#define WRITE_NAND_ADDRESS(d, adr) do{ *(volatile __u8 *)((unsigned long)(adr + 0x1)) = (__u8)(d); } while(0) -#define WRITE_NAND(d, adr) do{ *(volatile __u8 *)((unsigned long)(adr + 0x0)) = (__u8)d; } while(0) -#define READ_NAND(adr) ((volatile unsigned char)(*(volatile __u8 *)(unsigned long)(adr + 0x0))) #endif /* CONFIG_CMD_NAND */ diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h index f7ebdaa..477a1c5 100644 --- a/include/configs/MPC8360ERDK.h +++ b/include/configs/MPC8360ERDK.h @@ -162,7 +162,7 @@ #undef CONFIG_SYS_RAMBOOT #endif -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Mon */ +#define CONFIG_SYS_MONITOR_LEN (384 * 1024) /* Reserve 384 kB for Mon */ #define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserved for malloc */ /* @@ -339,7 +339,7 @@ #ifndef CONFIG_SYS_RAMBOOT #define CONFIG_ENV_IS_IN_FLASH 1 -#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + 0x40000) +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K(one sector) for env */ #define CONFIG_ENV_SIZE 0x20000 #else /* CONFIG_SYS_RAMBOOT */ diff --git a/include/configs/vct.h b/include/configs/vct.h index d202522..fe67997 100644 --- a/include/configs/vct.h +++ b/include/configs/vct.h @@ -61,7 +61,18 @@ /* * UART */ -#define CONFIG_VCT_SERIAL +#ifdef CONFIG_VCT_PLATINUMAVC +#define UART_1_BASE 0xBDC30000 +#else +#define UART_1_BASE 0xBF89C000 +#endif + +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_REG_SIZE -4 +#define CONFIG_SYS_NS16550_COM1 UART_1_BASE +#define CONFIG_CONS_INDEX 1 +#define CONFIG_SYS_NS16550_CLK 921600 #define CONFIG_BAUDRATE 115200 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } diff --git a/include/sa1100.h b/include/sa1100.h deleted file mode 100644 index e69de29..0000000 --- a/include/sa1100.h +++ /dev/null diff --git a/lib_arm/board.c b/lib_arm/board.c index 6847ea8..5d05d9b 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -258,7 +258,7 @@ static int arm_pci_init(void) */ typedef int (init_fnc_t) (void); -int print_cpuinfo (void); /* test-only */ +int print_cpuinfo (void); init_fnc_t *init_sequence[] = { cpu_init, /* basic cpu dependent setup */ @@ -68,8 +68,8 @@ static int __def_eth_init(bd_t *bis) { return -1; } -int cpu_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init"))); -int board_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init"))); +int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init"))); +int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init"))); extern int mv6436x_eth_initialize(bd_t *); extern int mv6446x_eth_initialize(bd_t *); diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c index 98be617..e8dd8c8 100644 --- a/tools/bmp_logo.c +++ b/tools/bmp_logo.c @@ -40,6 +40,16 @@ void skip_bytes (FILE *fp, int n) fgetc (fp); } +__attribute__ ((__noreturn__)) +int error (char * msg, FILE *fp) +{ + fprintf (stderr, "ERROR: %s\n", msg); + + fclose (fp); + + exit (EXIT_FAILURE); +} + int main (int argc, char *argv[]) { int i, x; @@ -58,23 +68,25 @@ int main (int argc, char *argv[]) exit (EXIT_FAILURE); } - if (fgetc (fp) != 'B' || fgetc (fp) != 'M') { - fprintf (stderr, "%s is not a bitmap file.\n", argv[1]); - exit (EXIT_FAILURE); - } + if (fgetc (fp) != 'B' || fgetc (fp) != 'M') + error ("Input file is not a bitmap", fp); /* * read width and height of the image, and the number of colors used; * ignore the rest */ skip_bytes (fp, 8); - fread (&data_offset, sizeof (uint16_t), 1, fp); + if (fread (&data_offset, sizeof (uint16_t), 1, fp) != 1) + error ("Couldn't read bitmap data offset", fp); skip_bytes (fp, 6); - fread (&b->width, sizeof (uint16_t), 1, fp); + if (fread (&b->width, sizeof (uint16_t), 1, fp) != 1) + error ("Couldn't read bitmap width", fp); skip_bytes (fp, 2); - fread (&b->height, sizeof (uint16_t), 1, fp); + if (fread (&b->height, sizeof (uint16_t), 1, fp) != 1) + error ("Couldn't read bitmap height", fp); skip_bytes (fp, 22); - fread (&n_colors, sizeof (uint16_t), 1, fp); + if (fread (&n_colors, sizeof (uint16_t), 1, fp) != 1) + error ("Couldn't read bitmap colors", fp); skip_bytes (fp, 6); /* @@ -108,11 +120,8 @@ int main (int argc, char *argv[]) DEFAULT_CMAP_SIZE); /* allocate memory */ - if ((b->data = (uint8_t *)malloc(b->width * b->height)) == NULL) { - fclose (fp); - printf ("Error allocating memory for file %s.\n", argv[1]); - exit (EXIT_FAILURE); - } + if ((b->data = (uint8_t *)malloc(b->width * b->height)) == NULL) + error ("Error allocating memory for file", fp); /* read and print the palette information */ printf ("unsigned short bmp_logo_palette[] = {\n"); diff --git a/tools/ncb.c b/tools/ncb.c index 30acbea..ec8d8a7 100644 --- a/tools/ncb.c +++ b/tools/ncb.c @@ -1,3 +1,4 @@ +#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> @@ -29,7 +30,8 @@ int main (int argc, char *argv[]) len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len); if (len < 0) break; - write (1, buf, len); + if (write (1, buf, len) != len) + fprintf(stderr, "WARNING: serial characters dropped\n"); } return 0; diff --git a/tools/updater/flash_hw.c b/tools/updater/flash_hw.c index 8af4b45..b5058b3 100644 --- a/tools/updater/flash_hw.c +++ b/tools/updater/flash_hw.c @@ -153,14 +153,14 @@ static ulong flash_get_size (ulong addr, flash_info_t *info) /* Write auto select command: read Manufacturer ID */ x[0x0555] = 0xAA; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); x[0x02AA] = 0x55; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); x[0x0555] = 0x90; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); value = x[0]; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); DEBUGF("Manuf. ID @ 0x%08lx: 0x%08x\n", (ulong)addr, value); @@ -186,7 +186,7 @@ static ulong flash_get_size (ulong addr, flash_info_t *info) } value = x[1]; - __asm volatile ("sync\n eieio"); + __asm__ volatile ("sync\n eieio"); DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", addr+1, value); |