platform/kernel/u-boot.git
8 years agousb: xhci-mvebu: Add Armada 8K to compatiblity list
Stefan Roese [Wed, 31 Aug 2016 04:48:56 +0000 (06:48 +0200)]
usb: xhci-mvebu: Add Armada 8K to compatiblity list

To enable this driver on Armada 7K/8K this patch adds the compatibility
property to the list.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Neta Zur Hershkovits <neta@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Omri Itach <omrii@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
8 years agodrivers/phy: Add Marvell SerDes / PHY drivers used on Armada 7K/8K
Stefan Roese [Tue, 30 Aug 2016 14:48:20 +0000 (16:48 +0200)]
drivers/phy: Add Marvell SerDes / PHY drivers used on Armada 7K/8K

This version is based on the Marvell U-Boot version with this patch
applied as latest patch:

Git ID 7f408573: "fix: comphy: cp110: add comphy initialization for usb
device mode" from 2016-07-05.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Neta Zur Hershkovits <neta@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Omri Itach <omrii@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
8 years agoarm64: mvebu: Add Armada 3700 db-88f3720 development board support
Stefan Roese [Tue, 17 May 2016 13:04:16 +0000 (15:04 +0200)]
arm64: mvebu: Add Armada 3700 db-88f3720 development board support

This patch adds basic support for the Marvell Armada 3700 DB-88F3720
development board. Supported are the following interfaces:
- UART
- SPI (incl. SPI NOR)
- I2C
- Ethernet

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Add support for the Marvell Armada 3700 SoC
Stefan Roese [Tue, 17 May 2016 13:00:30 +0000 (15:00 +0200)]
arm64: mvebu: Add support for the Marvell Armada 3700 SoC

The Armada 3700 integrates the following interfaces (not complete list):
- Dual Cortex-A53 ARMv8
- USB 3.0
- SATA 3.0
- PCIe 2.0
- 2 x Gigabit Ethernet 1Gbps / 2.5Gbps
- ...

This patch adds basic support for this ARMv8 based SoC into U-Boot.
Future patches will integrate other device drivers and board support
for the Marvell DB-88F3720 development board.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Armada 3700: Add USB device tree nodes
Stefan Roese [Fri, 26 Aug 2016 11:50:41 +0000 (13:50 +0200)]
arm64: mvebu: Armada 3700: Add USB device tree nodes

This patch adds the USB device tree nodes that are still missing to
the Armada 3700 dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Armada 3700: Add COMPHY device tree nodes
Stefan Roese [Fri, 26 Aug 2016 11:10:45 +0000 (13:10 +0200)]
arm64: mvebu: Armada 3700: Add COMPHY device tree nodes

This patch adds the COMPHY device tree nodes that are still missing to
the Armada 3700 dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Armada 3700: Add I2C device tree nodes
Stefan Roese [Thu, 21 Jul 2016 09:34:32 +0000 (11:34 +0200)]
arm64: mvebu: Armada 3700: Add I2C device tree nodes

This patch adds the I2C device tree nodes that are still missing to
the Armada 3700 dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Armada 3700: Add ethernet device tree nodes
Stefan Roese [Thu, 19 May 2016 15:45:20 +0000 (17:45 +0200)]
arm64: mvebu: Armada 3700: Add ethernet device tree nodes

This patch adds the ethernet device tree nodes that are still missing to
the Armada 3700 dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agoarm64: mvebu: Armada 3700: Add SPI device tree nodes
Stefan Roese [Thu, 19 May 2016 08:41:01 +0000 (10:41 +0200)]
arm64: mvebu: Armada 3700: Add SPI device tree nodes

This patch adds the SPI device tree nodes that are still missing to
the Armada 3700 dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm64: mvebu: Armada 3700: Add Armada 37xx dts files
Stefan Roese [Tue, 17 May 2016 12:03:25 +0000 (14:03 +0200)]
arm64: mvebu: Armada 3700: Add Armada 37xx dts files

This patch integrates the Armada 3700 dts files from the latest
submission on the linux-arm-kernel mailing list.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agodrivers/phy: Add Marvell SerDes / PHY drivers used on Armada 3k
Stefan Roese [Mon, 23 May 2016 09:12:05 +0000 (11:12 +0200)]
drivers/phy: Add Marvell SerDes / PHY drivers used on Armada 3k

This version is based on the Marvell U-Boot version with this patch
applied as latest patch:

Git ID 7f408573: "fix: comphy: cp110: add comphy initialization for usb
device mode" from 2016-07-05.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agousb: ehci: ehci-marvell.c: Add Armada 3700 support (ARMv8)
Stefan Roese [Mon, 18 Jul 2016 15:24:56 +0000 (17:24 +0200)]
usb: ehci: ehci-marvell.c: Add Armada 3700 support (ARMv8)

This patch adds DM based support for the Armada 3700 EHCI controller.
The address windows don't need to get configured in this case. The
difference here is detected via DT compatible property at runtime.

With this support and the DM xHCI driver, both XHCI and eHCI can be
used simultaniously on the MVEBU boards now.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Marek Vasut <marex@denx.de>
8 years agousb: xhci: Add Marvell MVEBU xHCI support
Stefan Roese [Thu, 14 Jul 2016 09:39:20 +0000 (11:39 +0200)]
usb: xhci: Add Marvell MVEBU xHCI support

This patch adds DM based support for the xHCI USB 3.0 controller
integrated in the Armada 3700 SoC. It may be extended to be used
by other MVEBU SoCs as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Marek Vasut <marex@denx.de>
8 years agonet: mvneta: Add support for Armada 3700 SoC
Stefan Roese [Thu, 19 May 2016 15:46:36 +0000 (17:46 +0200)]
net: mvneta: Add support for Armada 3700 SoC

This patch adds support for the Armada 3700 SoC to the Marvell mvneta
network driver.

Not like A380, in Armada3700, there are two layers of decode windows for GBE:
First layer is:  GbE Address window that resides inside the GBE unit,
Second layer is: Fabric address window which is located in the NIC400
                 (South Fabric).
To simplify the address decode configuration for Armada3700, we bypass the
first layer of GBE decode window by setting the first window to 4GB.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: mvneta: Make driver 64bit safe
Stefan Roese [Thu, 19 May 2016 16:09:17 +0000 (18:09 +0200)]
net: mvneta: Make driver 64bit safe

The mvneta driver is also used on the ARMv8 64bit Armada 3700 SoC. This
patch fixes the compilation warnings seen on this 64bit platform.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agospi: Add driver for Marvell Armada 3700 SoC
Stefan Roese [Thu, 19 May 2016 13:56:44 +0000 (15:56 +0200)]
spi: Add driver for Marvell Armada 3700 SoC

The SPI IP core in the Marvell Armada 3700 is similar to the one in the
other Armada SoCs. But the differences are big enough that it makes
sense to introduce a new driver instead of cluttering the old
kirkwood driver with #ifdef's.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoserial: Add serial_mvebu_a3700 for Armada 3700 SoC
Stefan Roese [Tue, 17 May 2016 14:36:00 +0000 (16:36 +0200)]
serial: Add serial_mvebu_a3700 for Armada 3700 SoC

The Armada 3700's UART is a simple serial port. It has a 32 bytes
Tx FIFO and a 64 bytes Rx FIFO integrated. This patch adds support
for this UART including the DEBUG UART functions for very early
debug output.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
8 years agonet: mvneta: Round up top tx buffer boundaries for dcache ops
Stefan Roese [Thu, 25 Aug 2016 10:56:50 +0000 (12:56 +0200)]
net: mvneta: Round up top tx buffer boundaries for dcache ops

check_cache_range() warns that the top boundaries are not properly
aligned when flushing or invalidating the buffers and make these
operations fail.

This gets rid of the warnings:
CACHE: Misaligned operation at range ...

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoMerge git://git.denx.de/u-boot-fsl-qoriq
Tom Rini [Mon, 26 Sep 2016 17:24:46 +0000 (13:24 -0400)]
Merge git://git.denx.de/u-boot-fsl-qoriq

trini: Drop local memset() from
examples/standalone/mem_to_mem_idma2intr.c

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agokconfig: introduce kconfig for UBI
Heiko Schocher [Wed, 21 Sep 2016 05:58:19 +0000 (07:58 +0200)]
kconfig: introduce kconfig for UBI

move the UBI config options into Kconfig.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Reviewed by: Evgeni Dobrev <evgeni at studio-punkt.com>

8 years agoarmv7: ls102xa: Rename GIC_ADDR and DCSR_RCPM_ADDR
York Sun [Mon, 26 Sep 2016 15:09:30 +0000 (08:09 -0700)]
armv7: ls102xa: Rename GIC_ADDR and DCSR_RCPM_ADDR

Instead of using CONFIG_* name space, rename these two macros to
SYS_FSL_* space.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Hongbo Zhang <hongbo.zhang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarmv7: ls1021a: Convert CONFIG_LS1_DEEP_SLEEP to Kconfig option
York Sun [Mon, 26 Sep 2016 15:09:29 +0000 (08:09 -0700)]
armv7: ls1021a: Convert CONFIG_LS1_DEEP_SLEEP to Kconfig option

Move this option to Kconfig and clean up existing uses.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Hongbo Zhang <hongbo.zhang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarmv8: ls1046ardb_emmc: Fix a typo in defconfig
York Sun [Mon, 26 Sep 2016 15:09:28 +0000 (08:09 -0700)]
armv8: ls1046ardb_emmc: Fix a typo in defconfig

It should be EMMC_BOOT instead of CONFIG_EMMC_BOOT.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_SYS_FSL_ERRATUM_A010315 to Kconfig option
York Sun [Mon, 26 Sep 2016 15:09:27 +0000 (08:09 -0700)]
Convert CONFIG_SYS_FSL_ERRATUM_A010315 to Kconfig option

Move this option to Kconfig and clean up existing uses.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
8 years agoarmv8: ls1012a: Convert CONFIG_LS1012A to Kconfig option ARCH_LS1021A
York Sun [Mon, 26 Sep 2016 15:09:26 +0000 (08:09 -0700)]
armv8: ls1012a: Convert CONFIG_LS1012A to Kconfig option ARCH_LS1021A

Move this config to Kconfig option and clean up existing uses.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Calvin Johnson <calvin.johnson@nxp.com>
CC: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodriver: ddr: fsl_mmdc: Pass board parameters through data structure
York Sun [Mon, 26 Sep 2016 15:09:25 +0000 (08:09 -0700)]
driver: ddr: fsl_mmdc: Pass board parameters through data structure

Instead of using multiple macros, a data structure is used to pass
board-specific parameters to MMDC DDR driver.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarmv8: ls1046a: Convert CONFIG_LS1046A to Kconfig option ARCH_LS1046A
York Sun [Mon, 26 Sep 2016 15:09:24 +0000 (08:09 -0700)]
armv8: ls1046a: Convert CONFIG_LS1046A to Kconfig option ARCH_LS1046A

Move this option to Kconfig and clean up existing uses.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Mingkai Hu <mingkai.hu@nxp.com>
CC: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-coldfire
Tom Rini [Mon, 26 Sep 2016 13:31:01 +0000 (09:31 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-coldfire

8 years agoi2c: mvtwsi.c: Add support for Marvell Armada 7K/8K
Stefan Roese [Fri, 16 Sep 2016 13:07:55 +0000 (15:07 +0200)]
i2c: mvtwsi.c: Add support for Marvell Armada 7K/8K

By adding the "marvell,mv78230-i2c" compatible property, we can enable
this I2C driver to support these new ARM64 chips as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Neta Zur Hershkovits <neta@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Omri Itach <omrii@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: Validate read length in I2C command
jinghua [Fri, 16 Sep 2016 13:07:54 +0000 (15:07 +0200)]
i2c: mv_i2c.c: Validate read length in I2C command

The I2C bus will get stuck when reading 0 byte. So we add validation of
the read length in i2c_read(). This issue only occurs on read operation.

Signed-off-by: jinghua <jinghua@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: Enable runtime speed selection (standard vs fast mode)
Stefan Roese [Fri, 16 Sep 2016 13:07:53 +0000 (15:07 +0200)]
i2c: mv_i2c.c: Enable runtime speed selection (standard vs fast mode)

This patch adds runtime speed configuration to the mv_i2c driver.
Currently standard (max 100kHz) and fast mode (max 400kHz) are
supported.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: Add DM support
Stefan Roese [Fri, 16 Sep 2016 13:07:52 +0000 (15:07 +0200)]
i2c: mv_i2c.c: Add DM support

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: Prepare driver for DM conversion
Stefan Roese [Fri, 16 Sep 2016 13:07:51 +0000 (15:07 +0200)]
i2c: mv_i2c.c: Prepare driver for DM conversion

To prepare for the DM conversion, we add a layer of compatibility
functions to be used by both the legacy and the DM functions.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: Remove CONFIG_HARD_I2C
Stefan Roese [Fri, 16 Sep 2016 13:07:50 +0000 (15:07 +0200)]
i2c: mv_i2c.c: Remove CONFIG_HARD_I2C

CONFIG_HARD_I2C is not needed, lets remove it.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoi2c: mv_i2c.c: cosmetic: Coding style cleanups
Stefan Roese [Fri, 16 Sep 2016 13:07:49 +0000 (15:07 +0200)]
i2c: mv_i2c.c: cosmetic: Coding style cleanups

Some mostly indentation coding style cleanups. Also, move this driver
to use debug() for debug output.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Heiko Schocher <hs@denx.de>
8 years agoboard: amcore: update to use dm serial driver
Angelo Dureghello [Tue, 20 Sep 2016 15:54:10 +0000 (17:54 +0200)]
board: amcore: update to use dm serial driver

Update amcore board to use dm serial driver.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---
Changes for v2:
- None

8 years agoboard: amcore: add update scripts
Angelo Dureghello [Tue, 20 Sep 2016 15:40:03 +0000 (17:40 +0200)]
board: amcore: add update scripts

Add some useful update scripts.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---
Changes for v.2:
- Fix syntax error on upgrade_jffs2 script

8 years agoarm: mvebu: NAND support for DB-88F6820-AMC
Chris Packham [Thu, 22 Sep 2016 00:56:15 +0000 (12:56 +1200)]
arm: mvebu: NAND support for DB-88F6820-AMC

Enable the NAND interface on this board.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
8 years agoarm: mvebu: add DB-88F6820-AMC board
Chris Packham [Thu, 22 Sep 2016 00:56:14 +0000 (12:56 +1200)]
arm: mvebu: add DB-88F6820-AMC board

This board is a plug in card for Marvell's switch system development
kits. Form-factor aside it is similar to the DB-88F6820-GP with the
following differences.
- TCLK is 200MHz
- SPI1 is used
- No SATA
- No MMC
- NAND flash

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
8 years agoarm: mvebu: create generic 88F6820 config option
Chris Packham [Thu, 22 Sep 2016 00:56:13 +0000 (12:56 +1200)]
arm: mvebu: create generic 88F6820 config option

88F6820 is a specific Armada-38x chip that is used on the DB-88F6820-GP
board. Rather than having DB_88F6820_GP and TARGET_DB_88F6820_GP which
selects the former. Rename DB_88F6820_GP to 88F6820 so that other boards
using the 88F6820 can be added.

Stefan:
Change 88F6820 for clearfog as well.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
8 years agoarm: mvebu: theadorable: Configure board for PCIe 2.0 capability
Stefan Roese [Thu, 25 Aug 2016 14:22:10 +0000 (16:22 +0200)]
arm: mvebu: theadorable: Configure board for PCIe 2.0 capability

Use a board-specific board_sat_r_get() function to configure the board
for PCIe 2.0 capability (e.g. 5GB/s link speed). Otherwise the default
of 2.5GB/s will be established.

Signed-off-by: Stefan Roese <sr@denx.de>
8 years agousb: ehci-generic: support reset control for generic EHCI
Masahiro Yamada [Wed, 21 Sep 2016 02:29:02 +0000 (11:29 +0900)]
usb: ehci-generic: support reset control for generic EHCI

This driver is designed in a generic manner, so resets should be
handled generically as well.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoreset: add no-op stubs for optional reset control
Masahiro Yamada [Wed, 21 Sep 2016 02:29:01 +0000 (11:29 +0900)]
reset: add no-op stubs for optional reset control

My motivation for this patch is to make reset control handling
optional for generic drivers.

I want to add reset control to drivers/usb/host/ehci-generic.c,
but it is used by several platforms, some will implement a reset
controller driver, some will not.

Add no-op stubs in order to avoid link error for drivers that
implement reset controlling, but still it is optional.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoerrno.h: sync error macros with linux 4.8-rc7
Masahiro Yamada [Wed, 21 Sep 2016 02:29:00 +0000 (11:29 +0900)]
errno.h: sync error macros with linux 4.8-rc7

For synchronization, import macros from
  - include/uapi/asm-generic/errno-base.h
  - include/uapi/asm-generic/errno.h
  - include/linux/errno.h

of Linux 4.8-rc7.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoMove ENOTSUPP defines to include/linux/errno.h
Masahiro Yamada [Wed, 21 Sep 2016 02:28:59 +0000 (11:28 +0900)]
Move ENOTSUPP defines to include/linux/errno.h

Collect a couple of duplicated defines into a single place.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoMove error macros from <asm-generic/errno.h> to <linux/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:58 +0000 (11:28 +0900)]
Move error macros from <asm-generic/errno.h> to <linux/errno.h>

There are no files that include <asm-generic/errno.h> any more.
Move error macro defines to include/linux/errno.h and remove
include/asm-generic/errno.h.

Going forward, please include <linux/errno.h> when you need error
macros.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agotreewide: replace #include <asm-generic/errno.h> with <linux/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:57 +0000 (11:28 +0900)]
treewide: replace #include <asm-generic/errno.h> with <linux/errno.h>

Now, include/linux/errno.h is a wrapper of <asm-generic/errno.h>.
Replace all include directives for <asm-generic/errno.h> with
<linux/errno.h>.

<asm-generic/...> is supposed to be included from <asm/...> when
arch-headers fall back into generic implementation. Generally, they
should not be directly included from .c files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add drivers/usb/host/xhci-rockchip.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoRemove arch/${ARCH}/include/asm/errno.h
Masahiro Yamada [Wed, 21 Sep 2016 02:28:56 +0000 (11:28 +0900)]
Remove arch/${ARCH}/include/asm/errno.h

Unlike Linux, nothing about errno.h is arch-specific in U-Boot.
As you see, all of arch/${ARCH}/include/asm/errno.h is just a
wrapper of <asm-generic/errno.h>.  Actually, U-Boot does not
export headers to user-space, so we just have to care about the
consistency in the U-Boot tree.

Now all of include directives for <asm/errno.h> are gone.
Deprecate <asm/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
8 years agotreewide: replace #include <asm/errno.h> with <linux/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:55 +0000 (11:28 +0900)]
treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoAdd <linux/errno.h> as a wrapper of <asm-generic/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:54 +0000 (11:28 +0900)]
Add <linux/errno.h> as a wrapper of <asm-generic/errno.h>

This will be used to consolidate errno.h variants.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotreewide: use #include <...> to include public headers
Masahiro Yamada [Wed, 21 Sep 2016 02:28:53 +0000 (11:28 +0900)]
treewide: use #include <...> to include public headers

We are supposed to use #include <...> to include headers in the
public include paths.  We should use #include "..." only for headers
in local directories.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:39 +0000 (22:17 +0900)]
drivers: squash lines for immediate return

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoarch, board: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:38 +0000 (22:17 +0900)]
arch, board: squash lines for immediate return

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Reviewed-by: Angelo Dureghello <angelo@sysam.it>
8 years agolibfdt: simplify fdt_del_mem_rsv()
Masahiro Yamada [Tue, 6 Sep 2016 13:17:37 +0000 (22:17 +0900)]
libfdt: simplify fdt_del_mem_rsv()

The variable "err" is unneeded.

[ Device Tree Compiler commit: 36fd7331fb11276c09a6affc0d8cd4977f2fe100 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agox86: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:36 +0000 (22:17 +0900)]
x86: squash lines for immediate return

arch_cpu_init() can be simpler by this refactoring.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agousb: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:35 +0000 (22:17 +0900)]
usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agousb: replace ehci_*_remove() with usb_deregister()
Masahiro Yamada [Tue, 6 Sep 2016 13:17:34 +0000 (22:17 +0900)]
usb: replace ehci_*_remove() with usb_deregister()

The remove callbacks of EHCI drivers are often just a wrapper of
ehci_deregister.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
8 years agovideo: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:33 +0000 (22:17 +0900)]
video: squash lines for immediate return

For vidconsole_post_probe(), it is common coding style to let a
probe method return the value of a register function.

The others will become simple wrapper functions.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
8 years agommc: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:32 +0000 (22:17 +0900)]
mmc: squash lines for immediate return

These functions can be much simpler by squashing lines for immediate
return.

For *_bind() callbacks, they will be a simple wrapper function of an
upper-level bind API.

For mmc_set_{boot_bus_width,part_conf}, they will be a wrapper of
mmc_switch().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agofs-test.sh: Update expected results
Tom Rini [Fri, 23 Sep 2016 13:29:49 +0000 (09:29 -0400)]
fs-test.sh: Update expected results

Thanks to Stefan Brüns we have more tests and a few more passes too,
update the expected output now.

Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoext4: Revert rejection of 64bit enabled ext4 fs
Stefan Brüns [Sat, 17 Sep 2016 00:10:12 +0000 (02:10 +0200)]
ext4: Revert rejection of 64bit enabled ext4 fs

Enable mounting of ext4 fs with 64bit feature, as it is supported now.
These had been disabled in 6f94ab6656ceffb3f2a972c8de4c554502b6f2b7.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Respect group descriptor size when adjusting free counts
Stefan Brüns [Mon, 19 Sep 2016 23:13:01 +0000 (01:13 +0200)]
ext4: Respect group descriptor size when adjusting free counts

Also adjust high 16/32 bits when free inode/block counts are modified.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Use helper function to access group descriptor and its fields
Stefan Brüns [Sat, 17 Sep 2016 00:10:10 +0000 (02:10 +0200)]
ext4: Use helper function to access group descriptor and its fields

The descriptor size is variable, thus array indices are not generically
applicable. The larger group descriptors also contain e.g. high parts
of block numbers, which have to be read and written.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Use correct descriptor size when reading the block group descriptor
Stefan Brüns [Sat, 17 Sep 2016 00:10:09 +0000 (02:10 +0200)]
ext4: Use correct descriptor size when reading the block group descriptor

The correct descriptor size must be used when calculating offsets, and
also to read the correct amount of data.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Add helper functions for block group descriptor field access
Stefan Brüns [Mon, 19 Sep 2016 23:12:42 +0000 (01:12 +0200)]
ext4: Add helper functions for block group descriptor field access

The helper functions encapsulate access of the block group descriptors,
independent of group descriptor size. The helpers also deal with the
endianess of the fields, and with split fields like free_blocks/
free_blocks_high.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: determine group descriptor size for 64bit feature
Stefan Brüns [Sat, 17 Sep 2016 00:10:07 +0000 (02:10 +0200)]
ext4: determine group descriptor size for 64bit feature

If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from
the superblocks, otherwise it defaults to 32.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Update ext2/3/4 superblock, group descriptor and inode structures
Stefan Brüns [Sat, 17 Sep 2016 00:10:06 +0000 (02:10 +0200)]
ext4: Update ext2/3/4 superblock, group descriptor and inode structures

Most importantly, the superblock provides the used group descriptor size,
which is required for the EXT4_FEATURE_INCOMPAT_64BIT.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Fix memory leak of journal buffer if block is updated multiple times
Stefan Brüns [Tue, 6 Sep 2016 02:36:56 +0000 (04:36 +0200)]
ext4: Fix memory leak of journal buffer if block is updated multiple times

If the same block is updated multiple times in a row during a single
file system operation, gd_index is decremented to use the same journal
entry again. Avoid loosing the already allocated buffer.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: Correct block number handling, empty block vs. error code
Stefan Brüns [Tue, 6 Sep 2016 02:36:55 +0000 (04:36 +0200)]
ext4: Correct block number handling, empty block vs. error code

read_allocated block may return block number 0, which is just an indicator
a chunk of the file is not backed by a block, i.e. it is sparse.

During file deletions, just continue with the next logical block, for other
operations treat blocknumber <= 0 as an error.

For writes, blocknumber 0 should never happen, as U-Boot always allocates
blocks for the whole file.  Reading already handles this correctly, i.e. the
read buffer is 0-fillled.

Not treating block 0 as sparse block leads to FS corruption, e.g.
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
ext4write host 0 0 /2.5GB.file 1 '
The 2.5GB.file from the fs test is actually a sparse file.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: remove duplicated block release code for extents
Stefan Brüns [Tue, 6 Sep 2016 02:36:54 +0000 (04:36 +0200)]
ext4: remove duplicated block release code for extents

The data blocks are identical for files using traditional direct/indirect
block allocation scheme and extent trees, thus this code part can be
common. Only the code to deallocate the indirect blocks to record the
used blocks has to be seperate, respectively the code to release extent
tree index blocks.

Actually the code to release the extent tree index blocks is still missing,
but at least add a FIXME at the appropriate place.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agoext4: initialize full inode for inodes bigger than 128 bytes
Stefan Brüns [Tue, 6 Sep 2016 02:36:53 +0000 (04:36 +0200)]
ext4: initialize full inode for inodes bigger than 128 bytes

Make sure the the extra_isize field (offset 128) is initialized to 0, to
mark any extra data as invalid.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Use correct value for inode size even on revision 0 filesystems
Stefan Brüns [Tue, 6 Sep 2016 02:36:52 +0000 (04:36 +0200)]
ext4: Use correct value for inode size even on revision 0 filesystems

fs->inodesz is already correctly (i.e. dependent on fs revision)
initialized in ext4fs_mount.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Fix memory leak in case of failure
Stefan Brüns [Tue, 6 Sep 2016 02:36:51 +0000 (04:36 +0200)]
ext4: Fix memory leak in case of failure

temp_ptr should always be freed, even if the function is left via
goto fail.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Avoid out-of-bounds access of block bitmap
Stefan Brüns [Tue, 6 Sep 2016 02:36:50 +0000 (04:36 +0200)]
ext4: Avoid out-of-bounds access of block bitmap

If the blocksize is 1024, count is initialized with 1. Incrementing count
by 8 will never match (count == fs->blksz * 8), and ptr may be
incremented beyond the buffer end if the bitmap is filled. Add the
startblock offset after the loop.

Remove the second loop, as only the first iteration will be done.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: After completely filled group, scan next group from the beginning
Stefan Brüns [Tue, 6 Sep 2016 02:36:49 +0000 (04:36 +0200)]
ext4: After completely filled group, scan next group from the beginning

The last free block of a block group may be in its middle. After it has
been allocated, the next block group should be scanned from its beginning.

The following command triggers the bad behaviour (on a blocksize 1024 fs):

./sandbox/u-boot -c 'i=0; host bind 0 ./disk.raw ;
while test $i -lt 260 ; do echo $i; setexpr i $i + 1;
ext4write host 0:2 0 /X${i} 0x1450; done ;
ext4write host 0:2 0 /X240 0x2000 ; '

When 'X240' is extended from 5200 byte to 8192 byte, the new blocks should
start from the first free block (8811), but it uses the blocks 8098-8103
and 16296-16297 -- 8103 + 1 + 8192 = 16296. This can be shown with
debugfs, commands 'ffb' and 'stat X240'.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Do not clear zalloc'ed buffers a second time
Stefan Brüns [Tue, 6 Sep 2016 02:36:48 +0000 (04:36 +0200)]
ext4: Do not clear zalloc'ed buffers a second time

zero_buffer is never written, thus clearing it is pointless.
journal_buffer is completely initialized by ext4fs_devread (or in case
of failure, not used).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Only update number of of unused inodes if GDT_CSUM feature is set
Stefan Brüns [Tue, 6 Sep 2016 02:36:47 +0000 (04:36 +0200)]
ext4: Only update number of of unused inodes if GDT_CSUM feature is set

e2fsck warns about "Group descriptor 0 marked uninitialized without
feature set."
The bg_itable_unused field is only defined if FEATURE_RO_COMPAT_GDT_CSUM
is set, and should be set (kept) zero otherwise.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Scan all directory blocks when looking up an entry
Stefan Brüns [Tue, 6 Sep 2016 02:36:46 +0000 (04:36 +0200)]
ext4: Scan all directory blocks when looking up an entry

Scanning only the direct blocks of the directory file may falsely report
an existing file as nonexisting, and worse can also lead to creation
of a duplicate entry on file creation.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Avoid corruption of directories with hash tree indexes
Stefan Brüns [Tue, 6 Sep 2016 02:36:45 +0000 (04:36 +0200)]
ext4: Avoid corruption of directories with hash tree indexes

While directories can be read using the old linear scan method, adding a
new file would require updating the index tree (alternatively, the whole
tree could be removed).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Scan all directory blocks for space when inserting a new entry
Stefan Brüns [Tue, 6 Sep 2016 02:36:44 +0000 (04:36 +0200)]
ext4: Scan all directory blocks for space when inserting a new entry

Previously, only the last directory block was scanned for available space.
Instead, scan all blocks back to front, and if no sufficient space is
found, eventually append a new block.
Blocks are only appended if the directory does not use extents or the new
block would require insertion of indirect blocks, as the old code does.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Do not crash when trying to grow a directory using extents
Stefan Brüns [Tue, 6 Sep 2016 02:36:43 +0000 (04:36 +0200)]
ext4: Do not crash when trying to grow a directory using extents

The following command crashes u-boot:
./sandbox/u-boot -c 'i=0; host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
  while test $i -lt 200 ; do echo $i; setexpr i $i + 1;
  ext4write host 0 0 /foobar${i} 0; done'

Previously, the code updated the direct_block even for extents, and
fortunately crashed before pushing garbage to the disk.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: propagate error if creation of directory entry fails
Stefan Brüns [Tue, 6 Sep 2016 02:36:42 +0000 (04:36 +0200)]
ext4: propagate error if creation of directory entry fails

In case the dir entry creation failed, ext4fs_write would later overwrite
a random inode, as inodeno was never initialized.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: fix possible crash on directory traversal, ignore deleted entries
Stefan Brüns [Tue, 6 Sep 2016 02:36:41 +0000 (04:36 +0200)]
ext4: fix possible crash on directory traversal, ignore deleted entries

The following command triggers a segfault in search_dir:
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
    ext4write host 0 0 /./foo 0x10'

The following command triggers a segfault in check_filename:
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
    ext4write host 0 0 /. 0x10'

"." is the first entry in the directory, thus previous_dir is NULL. The
whole previous_dir block in search_dir seems to be a bad copy from
check_filename(...). As the changed data is not written to disk, the
statement is mostly harmless, save the possible NULL-ptr reference.

Typically a file is unlinked by extending the direntlen of the previous
entry. If the entry is the first entry in the directory block, it is
invalidated by setting inode=0.

The inode==0 case is hard to trigger without crafted filesystems. It only
hits if the first entry in a directory block is deleted and later a lookup
for the entry (by name) is done.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: fix wrong usage of le32_to_cpu()
Michael Walle [Mon, 29 Aug 2016 08:46:46 +0000 (10:46 +0200)]
ext4: fix wrong usage of le32_to_cpu()

le32_to_cpu() must only convert the revision_level and not the boolean
result.

Signed-off-by: Michael Walle <michael@walle.cc>
8 years agoext4: fix endianess problems in ext4 write support
Michael Walle [Thu, 1 Sep 2016 09:21:40 +0000 (11:21 +0200)]
ext4: fix endianess problems in ext4 write support

All fields were accessed directly instead of using the proper byte swap
functions. Thus, ext4 write support was only usable on little-endian
architectures. Fix this.

Signed-off-by: Michael Walle <michael@walle.cc>
8 years agoext4: use kernel names for byte swaps
Michael Walle [Mon, 29 Aug 2016 08:46:44 +0000 (10:46 +0200)]
ext4: use kernel names for byte swaps

Instead of __{be,le}{16,32}_to_cpu use {be,le}{16,32}_to_cpu.

Signed-off-by: Michael Walle <michael@walle.cc>
8 years agoext4: change structure fields to __le/__be types
Michael Walle [Mon, 29 Aug 2016 08:46:43 +0000 (10:46 +0200)]
ext4: change structure fields to __le/__be types

Change all the types of ext2/4 fields to little endian types and all the
JBD fields to big endian types. Now we can use sparse (make C=1) to check
for statements where we need byteswaps.

Signed-off-by: Michael Walle <michael@walle.cc>
8 years agotest/fs: Check writes using "." (same dir) relative path
Stefan Brüns [Tue, 13 Sep 2016 23:01:31 +0000 (01:01 +0200)]
test/fs: Check writes using "." (same dir) relative path

<path>/<fname> and <path>/./<fname> should reference the same file.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agotest/fs: Check ext4 behaviour if dirent is first entry in directory block
Stefan Brüns [Tue, 13 Sep 2016 23:01:30 +0000 (01:01 +0200)]
test/fs: Check ext4 behaviour if dirent is first entry in directory block

This is a regression test for a crash happening if the first dirent
in the block matches. Code tried to access a predecessor entry which
does not exist.
The crash happened for any block, but "." is always the first entry in
the first directory block and thus easy to check for.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agotest/fs: strip noise from filesystem code prior to checking results
Stefan Brüns [Tue, 13 Sep 2016 23:01:29 +0000 (01:01 +0200)]
test/fs: strip noise from filesystem code prior to checking results

ext4 and fat code emit some diagnostic messages during command execution.
These additional lines force a match window size which strictly is not
necessary.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agotest/fs: remove use of undefined WRITE_FILE variable
Stefan Brüns [Tue, 13 Sep 2016 23:01:28 +0000 (01:01 +0200)]
test/fs: remove use of undefined WRITE_FILE variable

The write file is created from $SMALL_FILE by appending ".w" on all
other occurences in the code.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agotest/fs: Restructure file path specification to allow some flexibility
Stefan Brüns [Tue, 13 Sep 2016 23:01:27 +0000 (01:01 +0200)]
test/fs: Restructure file path specification to allow some flexibility

Instead of providing the full path, specify directory and filename
separately. This allows to specify intermediate directories, required
for some additional tests.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
8 years agocmd/fat: Do not crash on write when <bytes> is not specified
Stefan Brüns [Sun, 11 Sep 2016 20:51:42 +0000 (22:51 +0200)]
cmd/fat: Do not crash on write when <bytes> is not specified

argc is checked, but is off by one. In case <bytes> is not specified,
create an empty file, which is identical to the ext4write behaviour.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agofs/fat: Correct description of determine_fatent function
Stefan Brüns [Sun, 11 Sep 2016 20:51:41 +0000 (22:51 +0200)]
fs/fat: Correct description of determine_fatent function

Current description does not match the function behaviour.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agofs/fat: Do not write unmodified fat entries to disk
Stefan Brüns [Sun, 11 Sep 2016 20:51:40 +0000 (22:51 +0200)]
fs/fat: Do not write unmodified fat entries to disk

The code caches 6 sectors of the FAT. On FAT traversal, the old contents
needs to be flushed to disk, but only if any FAT entries had been modified.
Explicitly flag the buffer on modification.

Currently, creating a new file traverses the whole FAT up to the first
free cluster and rewrites the on-disk blocks.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agofs/fat: Remove two statements without effect
Stefan Brüns [Sun, 11 Sep 2016 20:51:39 +0000 (22:51 +0200)]
fs/fat: Remove two statements without effect

fatlength is a local variable which is no more used after the assignment.
s_name is not used in the function, save the strncpy.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
8 years agoMerge git://git.denx.de/u-boot-rockchip
Tom Rini [Thu, 22 Sep 2016 20:51:19 +0000 (16:51 -0400)]
Merge git://git.denx.de/u-boot-rockchip

8 years agons16650: Make sure we have CONFIG_CLK set before using infrastructure
Tom Rini [Thu, 22 Sep 2016 19:36:45 +0000 (15:36 -0400)]
ns16650: Make sure we have CONFIG_CLK set before using infrastructure

We cannot call on the CONFIG_CLK based clk_get_rate function unless
CONFIG_CLK is set.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-uniphier
Tom Rini [Thu, 22 Sep 2016 17:34:55 +0000 (13:34 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-uniphier

8 years agoARM: dts: uniphier: sync clock/reset controller nodes with Linux
Masahiro Yamada [Wed, 21 Sep 2016 22:42:23 +0000 (07:42 +0900)]
ARM: dts: uniphier: sync clock/reset controller nodes with Linux

Sync device trees with Linux for easier DT life.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>