platform/kernel/u-boot.git
5 years agosunxi: usb: Switch to Generic host controllers
Jagan Teki [Sat, 22 Dec 2018 12:48:10 +0000 (18:18 +0530)]
sunxi: usb: Switch to Generic host controllers

Onc of key blocker for using USB Generic host controller
drivers in Allwinner are CLK and RESET drivers, now these
available for USB usage.

So switch sunxi USB use EHCI and OHCI Generic controllers.

Enabling USB is wisely a board choise, So Enable USB_OHCI_HCD
where it already have USB_EHCI_HCD

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agomusb-new: sunxi: Use CLK and RESET support
Jagan Teki [Mon, 31 Dec 2018 11:35:40 +0000 (17:05 +0530)]
musb-new: sunxi: Use CLK and RESET support

Now clock and reset drivers are available for respective
SoC's so use clk and reset ops on musb driver.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Marek Vasut <marex@denx.de>
5 years agoreset: Add reset valid
Jagan Teki [Mon, 6 Aug 2018 13:25:06 +0000 (18:55 +0530)]
reset: Add reset valid

Add reset_valid to check whether given reset is valid
or not.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agophy: sun4i-usb: Use CLK and RESET support
Jagan Teki [Mon, 6 Aug 2018 06:46:39 +0000 (12:16 +0530)]
phy: sun4i-usb: Use CLK and RESET support

Now clock and reset drivers are available for respective
SoC's so use clk and reset ops on phy driver.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Marek Vasut <marex@denx.de>
5 years agoarm: sunxi: Enable CLK, RESET
Jagan Teki [Fri, 11 Jan 2019 11:10:20 +0000 (16:40 +0530)]
arm: sunxi: Enable CLK, RESET

CLK and DM_RESET drivers are now available for all of
the Allwinner platforms, so enable them in arch/arm/Kconfig

Enabling CLK will select DM_RESET by default.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agosunxi: A64: Update sun50i-a64-ccu.h
Jagan Teki [Sat, 29 Dec 2018 18:29:08 +0000 (23:59 +0530)]
sunxi: A64: Update sun50i-a64-ccu.h

Update sun50i-a64-ccu.h from the Linux sunxi/dt64-for-4.20 tree:
commit 679294497be31596e1c9c61507746d72b6b05f26
Author: Rodrigo Exterckötter Tjäder <rodrigo@tjader.xyz>
Date:   Wed Sep 26 19:48:24 2018 +0000
    arm64: dts: allwinner: a64: a64-olinuxino: set the PHY TX delay

This should be a part of previous sync patch from
commit 1b39a1834ed182bbd8036a5cd74a9ea111fa4691
Author: Andre Przywara <andre.przywara@arm.com>
Date:   Mon Oct 29 00:56:47 2018 +0000

    sunxi: A64: Update .dts/.dtsi files

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
5 years agoclk: sunxi: Add Allwinner A80 CLK driver
Jagan Teki [Fri, 11 Jan 2019 10:11:46 +0000 (15:41 +0530)]
clk: sunxi: Add Allwinner A80 CLK driver

Add initial clock driver for Allwinner A80.

- Implement UART bus clocks via ccu_clk_gate table for
  A80, so it can accessed in common clk enable and disable
  functions from clk_sunxi.c
- Implement UART bus resets via ccu_reset table for A80,
  so it can accessed in common reset deassert and assert
  functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoARM: dts: sun8i: Update A80 dts(i) from Linux-v4.18-rc3
Jagan Teki [Fri, 11 Jan 2019 10:52:57 +0000 (16:22 +0530)]
ARM: dts: sun8i: Update A80 dts(i) from Linux-v4.18-rc3

Update all A80 devicetree dtsi and dtsi files from
Linux-v4.18-rc3 with below commits.

arch/arm/boot/dts/sun9i-a80*:

commit 190e3138f9577885691540dca59c2f07540bde04
Merge: cafc87023b0d a7affb13b271
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Mar 27 14:58:00 2018 +0200

    Merge tag 'sunxi-h3-h5-for-4.17' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into next/dt

include/dt-bindings/*/sun9i-a80-*:

commit 783ab76ae553abc23f80ef7511052d055697531b
Author: Chen-Yu Tsai <wens@csie.org>
Date:   Sat Jan 28 20:22:36 2017 +0800

    clk: sunxi-ng: Add A80 Display Engine CCU

Note: sun9i-a80-cx-a99.dts is updated only uart0, since the same
dts is not available in Linux.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoclk: sunxi: Add Allwinner H6 CLK driver
Jagan Teki [Mon, 31 Dec 2018 10:05:01 +0000 (15:35 +0530)]
clk: sunxi: Add Allwinner H6 CLK driver

Add initial clock driver for Allwinner H6.

- Implement UART bus clocks via ccu_clk_gate table for
  H6, so it can accessed in common clk enable and disable
  functions from clk_sunxi.c
- Implement UART bus resets via ccu_reset table for H6,
  so it can accessed in common reset deassert and assert
  functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
5 years agoclk: sunxi: Implement UART resets
Jagan Teki [Sun, 30 Dec 2018 16:07:31 +0000 (21:37 +0530)]
clk: sunxi: Implement UART resets

Implement UART resets for all relevant Allwinner SoC
clock drivers via ccu reset table.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
5 years agoclk: sunxi: Implement UART clocks
Jagan Teki [Sun, 30 Dec 2018 15:59:24 +0000 (21:29 +0530)]
clk: sunxi: Implement UART clocks

Implement UART clocks for all Allwinner SoC
clock drivers via ccu clock gate table.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
5 years agoclk: sunxi: Add Allwinner V3S CLK driver
Jagan Teki [Sun, 5 Aug 2018 09:01:54 +0000 (14:31 +0530)]
clk: sunxi: Add Allwinner V3S CLK driver

Add initial clock driver for Allwinner V3S.

- Implement USB bus and USB clocks via ccu_clk_gate table
  for V3S, so it can accessed in common clk enable and disable
  functions from clk_sunxi.c
- Implement USB bus and USB resets via ccu_reset table
  for V3S, so it can accessed in common reset deassert
  and assert functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner R40 CLK driver
Jagan Teki [Sun, 5 Aug 2018 05:46:33 +0000 (11:16 +0530)]
clk: sunxi: Add Allwinner R40 CLK driver

Add initial clock driver for Allwinner R40.

- Implement USB bus and USB clocks via ccu_clk_gate
  for R40, so it can accessed in common clk enable
  and disable functions from clk_sunxi.c
- Implement USB bus and USB resets via ccu_reset table
  for R40, so it can accessed in common reset deassert
  and assert functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner A83T CLK driver
Jagan Teki [Thu, 2 Aug 2018 18:03:55 +0000 (23:33 +0530)]
clk: sunxi: Add Allwinner A83T CLK driver

Add initial clock driver for Allwinner A83T.

- Implement USB bus and USB clocks via ccu_clk_gate table
  for A83T, so it can accessed in common clk enable and
  disable functions from clk_sunxi.c
- Implement USB bus and USB resets via ccu_reset table
  for A83T, so it can accessed in common reset deassert
  and assert functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner A23/A33 CLK driver
Jagan Teki [Thu, 2 Aug 2018 17:55:03 +0000 (23:25 +0530)]
clk: sunxi: Add Allwinner A23/A33 CLK driver

Add initial clock driver for Allwinner A23/A33.

- Implement USB bus and USB clocks via ccu_clk_gate table
  for A23/A33, so it can accessed in common clk enable and
  disable functions from clk_sunxi.c
- Implement USB bus and USB resets via ccu_reset table
  for A23/A33, so it can accessed in common reset deassert
  and assert functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner A31 CLK driver
Jagan Teki [Thu, 2 Aug 2018 17:45:34 +0000 (23:15 +0530)]
clk: sunxi: Add Allwinner A31 CLK driver

Add initial clock driver for Allwinner A31.

- Implement USB ahb1 and USB clocks via ccu_clk_gate table
  for A31, so it can accessed in common clk enable and disable
  functions from clk_sunxi.c
- Implement USB ahb1 and USB resets via ccu_reset table
  for A31, so it can accessed in common reset deassert
  and assert functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner A10s/A13 CLK driver
Jagan Teki [Thu, 2 Aug 2018 14:24:26 +0000 (19:54 +0530)]
clk: sunxi: Add Allwinner A10s/A13 CLK driver

Add initial clock driver for Allwinner A10s/A13.

- Implement USB ahb and USB clocks via ccu_clk_gate table
  for A10s/A13, so it can accessed in common clk enable and
  disable functions from clk_sunxi.c
- Implement USB resets via ccu_reset table for A10s/A13,
  so it can accessed in common reset deassert and assert
  functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner A10/A20 CLK driver
Jagan Teki [Thu, 2 Aug 2018 11:22:37 +0000 (16:52 +0530)]
clk: sunxi: Add Allwinner A10/A20 CLK driver

Add initial clock driver for Allwinner A10/A20.

- Implement USB ahb and USB clocks via ccu_clk_gate table
  for A10/A20, so it can accessed in common clk enable and
  disable functions from clk_sunxi.c
- Implement USB resets via ccu_reset table for A10/A20,
  so it can accessed in common reset deassert and assert
  functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: sunxi: Add Allwinner H3/H5 CLK driver
Jagan Teki [Thu, 2 Aug 2018 10:13:02 +0000 (15:43 +0530)]
clk: sunxi: Add Allwinner H3/H5 CLK driver

Add initial clock driver for Allwinner H3/H5.

- Implement USB bus and USB clocks via ccu_clk_gate table for
  H3/H5, so it can accessed in common clk enable and disable
  functions from clk_sunxi.c
- Implement USB bus and USB resets via ccu_reset table for
  H3/H5, so it can accessed in common reset deassert and assert
  functions from reset-sunxi.c

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoreset: Add Allwinner RESET driver
Jagan Teki [Fri, 18 Jan 2019 16:48:13 +0000 (22:18 +0530)]
reset: Add Allwinner RESET driver

Add common reset driver for all Allwinner SoC's.

Since CLK and RESET share common DT compatible, it is CLK driver
job is to bind the reset driver. So add CLK bind call on respective
SoC driver by passing ccu map descriptor so-that reset deassert,
deassert operations held based on ccu reset table defined from
CLK driver.

Select DM_RESET via CLK_SUNXI, this make hidden section of RESET
since CLK and RESET share common DT compatible and code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoclk: Add Allwinner A64 CLK driver
Jagan Teki [Sat, 22 Dec 2018 16:02:49 +0000 (21:32 +0530)]
clk: Add Allwinner A64 CLK driver

Add initial clock driver for Allwinner A64.

Implement USB clock enable and disable functions for
OHCI, EHCI, OTG and USBPHY gate and clock registers
via ccu clk gate table.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoboard: sun50i-h5: Add Emlid Neutis N5 support
Aleksandr Aleksandrov [Fri, 5 Oct 2018 12:55:59 +0000 (15:55 +0300)]
board: sun50i-h5: Add Emlid Neutis N5 support

Emlid Neutis N5 is a SoM based on Allwinner H5, has a WiFi & BT
module, DDR3 RAM and eMMC.

- add neutis-devboard target to dtb makefile
- add dtsi file for Neutis N5 needs
- add config file for Neutis N5 Dev board

Signed-off-by: Aleksandr Aleksandrov <aleksandr.aleksandrov@emlid.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[jagan: update proper commit head]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agosunxi: board: Add i2c initialization for sun50i
Stefan Mavrodiev [Tue, 8 Jan 2019 10:04:30 +0000 (12:04 +0200)]
sunxi: board: Add i2c initialization for sun50i

To use TWI0/1/2 the user can select CONFIG_I2C#_ENABLE.
However even the controller is enabled, the mux for the pins
are not set.

This patch follows the existing mux method. Since the pads are
different, separate check is added for each i2c.

Tested with A64-SOM204 board.

Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agoMerge tag 'mips-pull-2019-11-16' of git://git.denx.de/u-boot-mips
Tom Rini [Fri, 18 Jan 2019 00:12:55 +0000 (19:12 -0500)]
Merge tag 'mips-pull-2019-11-16' of git://git.denx.de/u-boot-mips

- MIPS: mscc: various enhancements for Luton and Ocelot platforms
- MIPS: mscc: added support for Jaguar2 platform
- MIPS: optimised SPL linker script
- MIPS: bcm6368: fix restart flow issues
- MIPS: fixed CONFIG_OF_EMBED warnings for all MIPS boards
- MIPS: mt7688: small fixes and enhancements
- mmc: compile-out write support if disabled

5 years agoMerge branch '2019-01-16-master-imports'
Tom Rini [Thu, 17 Jan 2019 22:42:03 +0000 (17:42 -0500)]
Merge branch '2019-01-16-master-imports'

- Fixes for CVE-2018-18440 and CVE-2018-18439
- Patch to allow disabling unneeded NAND ECC layouts
- Optimize SPI flash env read process

5 years agoarm: bootm: fix sp detection at end of address range
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:23 +0000 (22:38 +0100)]
arm: bootm: fix sp detection at end of address range

This fixes  'arch_lmb_reserve()' for ARM that tries to detect in which
DRAM bank 'sp' is in.

This code failed if a bank was at the end of physical address range
(i.e. size + length overflowed to 0).

To fix this, calculate 'bank_end' as 'size + length - 1' so that such
banks end at 0xffffffff, not 0.

Fixes: 15751403b6 ("ARM: bootm: don't assume sp is in DRAM bank 0")
Reported-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
5 years agotftp: prevent overwriting reserved memory
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:22 +0000 (22:38 +0100)]
tftp: prevent overwriting reserved memory

This fixes CVE-2018-18439 ("insufficient boundary checks in network
image boot") by using lmb to check for a valid range to store
received blocks.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
[trini: Always build lib/lmb.o on LMB and lib/fdtdec.o on OF_LIBFDT]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agolmb: remove unused extern declaration
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:21 +0000 (22:38 +0100)]
lmb: remove unused extern declaration

lmb.h includes an extern declaration of "struct lmb lmb;" which
is not used anywhere, so remove it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agobootm: use new common function lmb_init_and_reserve
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:20 +0000 (22:38 +0100)]
bootm: use new common function lmb_init_and_reserve

This reduces duplicate code only.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofs: prevent overwriting reserved memory
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:19 +0000 (22:38 +0100)]
fs: prevent overwriting reserved memory

This fixes CVE-2018-18440 ("insufficient boundary checks in filesystem
image load") by using lmb to check the load size of a file against
reserved memory addresses.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agolib: lmb: extend lmb for checks at load time
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:18 +0000 (22:38 +0100)]
lib: lmb: extend lmb for checks at load time

This adds two new functions, lmb_alloc_addr and
lmb_get_unreserved_size.

lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a
pre-specified address range. Unlike lmb_reserve, this address range
must be inside one of the memory ranges that has been set up with
lmb_add.

lmb_get_unreserved_size returns the number of bytes that can be
used up to the next reserved region or the end of valid ram. This
can be 0 if the address passed is reserved.

Added test for these new functions.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agofdt: parse "reserved-memory" for memory reservation
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:17 +0000 (22:38 +0100)]
fdt: parse "reserved-memory" for memory reservation

boot_fdt_add_mem_rsv_regions() adds reserved memory sections to an lmb
struct. Currently, it only parses regions described by /memreserve/
entries.

Extend this to the more commonly used scheme of the "reserved-memory"
node.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agolib: lmb: reserving overlapping regions should fail
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:16 +0000 (22:38 +0100)]
lib: lmb: reserving overlapping regions should fail

lmb_add_region handles overlapping regions wrong: instead of merging
or rejecting to add a new reserved region that overlaps an existing
one, it just adds the new region.

Since internally the same function is used for lmb_alloc, change
lmb_add_region to reject overlapping regions.

Also, to keep reserved memory correct after 'free', reserved entries
created by allocating memory must not set their size to a multiple
of alignment but to the original size. This ensures the reserved
region is completely removed when the caller calls 'lmb_free', as
this one takes the same size as passed to 'lmb_alloc' etc.

Add test to assert this.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agolmb: fix allocation at end of address range
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:15 +0000 (22:38 +0100)]
lmb: fix allocation at end of address range

The lmb code fails if base + size of RAM overflows to zero.

Fix this by calculating end as 'base + size - 1' instead of 'base + size'
where appropriate.

Added tests to assert this is fixed.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agotest: add test for lib/lmb.c
Simon Goldschmidt [Mon, 14 Jan 2019 21:38:14 +0000 (22:38 +0100)]
test: add test for lib/lmb.c

Add basic tests for the lmb memory allocation code used to reserve and
allocate memory during boot.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoenv: add spi_flash_read_env function
Horatiu Vultur [Tue, 11 Dec 2018 09:13:56 +0000 (10:13 +0100)]
env: add spi_flash_read_env function

The spi_flash_read_env function is a wrapper over spi_flash_read, which
enables the env to read multiple flash page size from flash until '\0\0'
is read or the end of env partition is reached. Instead of reading the
entire env size. When it reads '\0\0', it stops reading further the env
and assumes that the rest of env is '\0'.

This is an optimization for large environments that contain few bytes
environment variables. In this case it doesn't need to read the entire
environment and only few pages.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agomtd: nand: raw: allow to disable unneeded ECC layouts
Stefan Agner [Thu, 6 Dec 2018 13:57:09 +0000 (14:57 +0100)]
mtd: nand: raw: allow to disable unneeded ECC layouts

Each ECC layout consumes about 2984 bytes in the .data section. Allow
to disable the default ECC layouts if a driver is known to provide its
own ECC layout.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
5 years agomips: mt7688: gardena-smart-gateway: Enable green power LED on startup
Stefan Roese [Tue, 15 Jan 2019 12:54:26 +0000 (13:54 +0100)]
mips: mt7688: gardena-smart-gateway: Enable green power LED on startup

Set the correct power-up state (default-state) of the green power LED.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt7688: gardena-smart-gateway: Update mtdparts/mtdids for Kernel 4.19
Stefan Roese [Tue, 15 Jan 2019 12:54:25 +0000 (13:54 +0100)]
mips: mt7688: gardena-smart-gateway: Update mtdparts/mtdids for Kernel 4.19

With the new SPI NOR framework in v4.19, we need to adapt the MTD parts
so that the kernel cmdline parameter "mtdparts=" uses the correct naming
for the devices.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: bmips: switch to CONFIG_OF_SEPARATE
Daniel Schwierzeck [Sat, 12 Jan 2019 19:52:21 +0000 (20:52 +0100)]
MIPS: bmips: switch to CONFIG_OF_SEPARATE

Fix the Kconfig warning to not use CONFIG_OF_EMBED in defconfigs.

Based on https://patchwork.ozlabs.org/patch/1019791/

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: xilfpga: switch to CONFIG_OF_SEPARATE
Daniel Schwierzeck [Sat, 12 Jan 2019 19:52:20 +0000 (20:52 +0100)]
MIPS: xilfpga: switch to CONFIG_OF_SEPARATE

Fix the Kconfig warning to not use CONFIG_OF_EMBED in defconfigs.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: pic32mzdask: switch to CONFIG_OF_SEPARATE
Daniel Schwierzeck [Sat, 12 Jan 2019 19:52:19 +0000 (20:52 +0100)]
MIPS: pic32mzdask: switch to CONFIG_OF_SEPARATE

Fix the Kconfig warning to not use CONFIG_OF_EMBED in defconfigs.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: malta: switch to CONFIG_OF_SEPARATE
Daniel Schwierzeck [Sat, 12 Jan 2019 19:52:18 +0000 (20:52 +0100)]
MIPS: malta: switch to CONFIG_OF_SEPARATE

Fix the Kconfig warning to not use CONFIG_OF_EMBED in defconfigs.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: boston: switch to CONFIG_OF_SEPARATE
Daniel Schwierzeck [Sat, 12 Jan 2019 19:52:17 +0000 (20:52 +0100)]
MIPS: boston: switch to CONFIG_OF_SEPARATE

Fix the Kconfig warning to not use CONFIG_OF_EMBED in defconfigs.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMSCC: Add board support for Jaguar2 SOC family
Horatiu Vultur [Sat, 12 Jan 2019 17:57:00 +0000 (18:57 +0100)]
MSCC: Add board support for Jaguar2 SOC family

Add board support and configuration for Jaguar2 SOC family.
The detection of the board type in this family is based on the phy ids.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agoMSCC: add device tree for Serval2 board
Horatiu Vultur [Sat, 12 Jan 2019 17:56:59 +0000 (18:56 +0100)]
MSCC: add device tree for Serval2 board

Add device tree based on evaluation board pcb112.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agoMSCC: Add device tree for Jaguar2-48 board
Horatiu Vultur [Sat, 12 Jan 2019 17:56:58 +0000 (18:56 +0100)]
MSCC: Add device tree for Jaguar2-48 board

Add device tree based on evaluation board pcb111.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agoMSCC: Add device tree for Jaguar2 board
Horatiu Vultur [Sat, 12 Jan 2019 17:56:57 +0000 (18:56 +0100)]
MSCC: Add device tree for Jaguar2 board

Add device tree based on evaluation board pcb110.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agoMSCC: Add support for Jaguar2 SOC family
Horatiu Vultur [Sat, 12 Jan 2019 17:56:56 +0000 (18:56 +0100)]
MSCC: Add support for Jaguar2 SOC family

As the Ocelot and Luton SoCs, this family of SoCs are found
in Microsemi Switches solution.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agopinctrl: mscc: Add gpio and pinctrl for Jaguar2 SOC family
Horatiu Vultur [Sat, 12 Jan 2019 17:56:55 +0000 (18:56 +0100)]
pinctrl: mscc: Add gpio and pinctrl for Jaguar2 SOC family

The Jaguar2 SOC family has 63 gpio pins therefore I extended mscc-common
to support new numbe of pins and remove any platform dependency from
mscc-common.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
5 years agomips: gpio: mscc: Obsoleted gpio-mscc-bitbang-spi.c
Lars Povlsen [Tue, 8 Jan 2019 09:38:35 +0000 (10:38 +0100)]
mips: gpio: mscc: Obsoleted gpio-mscc-bitbang-spi.c

With the new mscc_bb_spi.c driver, there is no longer use for the
gpio-mscc-bitbang-spi.c driver.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mscc: DT: Update luton device tree to use fast SPI driver
Lars Povlsen [Tue, 8 Jan 2019 09:38:34 +0000 (10:38 +0100)]
mips: mscc: DT: Update luton device tree to use fast SPI driver

Thes patch change the luton base device tree to use the newly added
SPI bitbang driver.

It also updates the "mscc_luton_defconfig" to use the new driver.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: spi: mscc: Add fast bitbang SPI driver
Lars Povlsen [Tue, 8 Jan 2019 09:38:33 +0000 (10:38 +0100)]
mips: spi: mscc: Add fast bitbang SPI driver

This patch add a new SPI driver for MSCC SOCs that does not sport the
designware SPI hardware controller.

Performance gain: 7.664 seconds vs. 17.633 for 1 Mbyte write.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agommc: jz_mmc: Compile-out write support if disabled
Ezequiel Garcia [Mon, 7 Jan 2019 21:13:25 +0000 (18:13 -0300)]
mmc: jz_mmc: Compile-out write support if disabled

Do not build write support, unless it's enabled.

In the SPL case, this change will typically remove
precious bytes (as write support is most often
not needed in SPL).

This is important on this platform, where the maximum
SPL size is 14 KiB.

With gcc v7.3, this change saves 144 bytes producing:

size spl/u-boot-spl
   text    data     bss     dec     hex filename
   9240     752     712   10704    29d0 spl/u-boot-spl

To make the code easier to compile-out and more
readable, a pair of read_data/write_data helpers are created.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agommc: Use proper IS_ENABLED macro to check block support
Ezequiel Garcia [Mon, 7 Jan 2019 21:13:24 +0000 (18:13 -0300)]
mmc: Use proper IS_ENABLED macro to check block support

Use CONFIG_IS_ENABLED(BLK) instead of CONFIG_BLK,
in order to fix the following build issues when
CONFIG_SPL_MMC_WRITE is selected:

drivers/mmc/mmc_write.c:69:7: error: conflicting types for 'mmc_berase'
 ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
       ^~~~~~~~~~
In file included from drivers/mmc/mmc_write.c:15:0:
drivers/mmc/mmc_private.h:39:7: note: previous declaration of 'mmc_berase' was here
 ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt);
       ^~~~~~~~~~
drivers/mmc/mmc_write.c:187:7: error: conflicting types for 'mmc_bwrite'
 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
       ^~~~~~~~~~
In file included from drivers/mmc/mmc_write.c:15:0:
drivers/mmc/mmc_private.h:37:7: note: previous declaration of 'mmc_bwrite' was here
 ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
       ^~~~~~~~~~

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agonet: bcm6368: fix restart flow issues
Álvaro Fernández Rojas [Tue, 1 Jan 2019 18:44:46 +0000 (19:44 +0100)]
net: bcm6368: fix restart flow issues

Correctly enable/disable bcm6368-net controller to avoid flow issues.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMIPS: jz47xx: remove custom u-boot-spl.lds
Daniel Schwierzeck [Sun, 6 Jan 2019 19:42:44 +0000 (20:42 +0100)]
MIPS: jz47xx: remove custom u-boot-spl.lds

There is no real difference between the generic variant and
the custom variant except that the generic variant is more
optimised. This also saves 24 Bytes in the SPL binary.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
5 years agoMIPS: optimize and fix ELF sections
Daniel Schwierzeck [Sun, 6 Jan 2019 19:42:43 +0000 (20:42 +0100)]
MIPS: optimize and fix ELF sections

Discard ABI related sections which are not required for debugging.
Rearrange debug sections similar to Linux. Remove the remaining
explicitely specified sections in the unused part because those
sections are not created anymore or because the linker puts them
by default at the end of the ELF binary.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
5 years agomips: ocelot: Enable use of serial gpio for LED
Lars Povlsen [Wed, 2 Jan 2019 08:52:26 +0000 (09:52 +0100)]
mips: ocelot: Enable use of serial gpio for LED

This enables the use of the MSCC serial GPIO driver to control the
LEDs on the MSCC VCoreIII 'ocelot' pcb123 and pcb120.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: ocelot: DT: Enable use of serial gpio
Lars Povlsen [Wed, 2 Jan 2019 08:52:25 +0000 (09:52 +0100)]
mips: ocelot: DT: Enable use of serial gpio

This enables the use of the MSCC serial GPIO driver on the MSCC
VCoreIII 'ocelot' SOC, and add gpio-leds nodes to the pcb123 and
pcb120 DT.

Signed-off-by: Lars Povlsen <lars.povlsen@microsemi.com>
5 years agomips: luton: Enable use of serial gpio for LED
Lars Povlsen [Wed, 2 Jan 2019 08:52:24 +0000 (09:52 +0100)]
mips: luton: Enable use of serial gpio for LED

This enables the use of the MSCC serial GPIO driver to control the
LEDs on the MSCC VCoreIII 'luton' SoC.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: luton: DT: Enable use of serial gpio
Lars Povlsen [Wed, 2 Jan 2019 08:52:23 +0000 (09:52 +0100)]
mips: luton: DT: Enable use of serial gpio

This enables the use of the MSCC serial GPIO driver, and add gpio-leds
nodes to the 'luton' pcb090 and pcb091 DT.

Signed-off-by: Lars Povlsen <lars.povlsen@microsemi.com>
5 years agomips: mscc_sgpio: Add DT bindings documentation
Lars Povlsen [Wed, 2 Jan 2019 08:52:22 +0000 (09:52 +0100)]
mips: mscc_sgpio: Add DT bindings documentation

This add device tree binding documentation for the MSCC serial GPIO
driver.

Signed-off-by: Lars Povlsen <lars.povlsen@microsemi.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
5 years agomips: mscc_sgpio: Add the MSCC serial GPIO device (SIO)
Lars Povlsen [Wed, 2 Jan 2019 08:52:21 +0000 (09:52 +0100)]
mips: mscc_sgpio: Add the MSCC serial GPIO device (SIO)

This add support for the the MSCC serial GPIO driver in MSCC
VCoreIII-based SOCs.

By using a serial interface, the SIO controller significantly extends
the number of available GPIOs with a minimum number of additional pins
on the device. The primary purpose of the SIO controller is to connect
control signals from SFP modules and to act as an LED controller.

This adds the base driver.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: mscc: luton+ocelot: Remove board config options, do probing
Lars Povlsen [Thu, 20 Dec 2018 08:56:05 +0000 (09:56 +0100)]
mips: mscc: luton+ocelot: Remove board config options, do probing

As we are moving to multi-dtb and board detection, remove static board
config options, and introduce board probing instead.

Luton: This add single-binary support for the two MSCC luton-based
reference boards - pcb090 and pcb091. The SoC chip ID is used to
determine the board type.

Ocelot: This add single-binary support for the two MSCC ocelot-based
reference boards - pcb120 and pcb123. The PHY ids on specific ports
are used to determine the board type.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: luton: DT: Add pcb090
Lars Povlsen [Thu, 20 Dec 2018 08:56:04 +0000 (09:56 +0100)]
mips: luton: DT: Add pcb090

This prepares individual device trees for MSCC luton-based reference
boards - pcb090 and pcb091.

Note: Even though the devices trees are quite common, they will differ
significantly in coming patches.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: mscc: Add generic GPIO control utility function
Lars Povlsen [Thu, 20 Dec 2018 08:56:03 +0000 (09:56 +0100)]
mips: mscc: Add generic GPIO control utility function

The GPIO control function can be used for controlling alternate
functions associated with a GPIO.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agomips: mscc: Add generic PHY MIIM utility functions
Lars Povlsen [Thu, 20 Dec 2018 08:56:02 +0000 (09:56 +0100)]
mips: mscc: Add generic PHY MIIM utility functions

The PHY MIIM utility functions can/will be used for board detection
purposes.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agoMerge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dm
Tom Rini [Wed, 16 Jan 2019 03:05:34 +0000 (22:05 -0500)]
Merge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dm

Fix recent changes to serial API for driver model
Buildman clang support and a few fixes
Small fixes to 'dm tree' and regmap test
Improve sandbox build compatibility
A few other minor fixes

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-i2c
Tom Rini [Wed, 16 Jan 2019 03:05:28 +0000 (22:05 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-i2c

5 years agoMerge git://git.denx.de/u-boot-riscv
Tom Rini [Wed, 16 Jan 2019 03:05:05 +0000 (22:05 -0500)]
Merge git://git.denx.de/u-boot-riscv

1. Improve cache implementation.
2. Fix and improve standalone applications

5 years agoMerge branch '2019-01-14-master-imports'
Tom Rini [Wed, 16 Jan 2019 01:33:07 +0000 (20:33 -0500)]
Merge branch '2019-01-14-master-imports'

- MediaTek improvements (eth support)
- DM conversion for HI6220
- ISEE, Toby Churchill, other platform updates
- Various format code printf fixes
- Build race fixes
- Command repeat functionality enhanced, command autocomplete support
  enhanced.

5 years agocommon: command: Add support for $ auto-completion
Boris Brezillon [Wed, 5 Dec 2018 08:26:50 +0000 (09:26 +0100)]
common: command: Add support for $ auto-completion

Add the dollar_complete() function to auto-complete arguments starting
with a '$' and use it in the cmd_auto_complete() path such that all
args starting with a $ can be auto-completed based on the available env
vars.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
[trini: Fix some linking problems]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agomisc: fs_loader: Switching private data allocation to DM auto allocation
Tien Fong Chee [Mon, 10 Dec 2018 13:29:44 +0000 (21:29 +0800)]
misc: fs_loader: Switching private data allocation to DM auto allocation

Switching private data manual allocation to driver model auto allocation
so users no longer need to deallocate themself because this would be
deallocated by driver model when the device is no longer required.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: adc: Use the sub-command infrastructure
Boris Brezillon [Mon, 3 Dec 2018 21:54:23 +0000 (22:54 +0100)]
cmd: adc: Use the sub-command infrastructure

And you get sub-command auto-completion for free.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands
Boris Brezillon [Mon, 3 Dec 2018 21:54:22 +0000 (22:54 +0100)]
cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands

It's way simpler this way, and we also gain auto-completion support for
free (MTD name auto-completion has been added with mtd_name_complete())

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocommand: commands: Add macros to declare commands with subcmds
Boris Brezillon [Mon, 3 Dec 2018 21:54:21 +0000 (22:54 +0100)]
command: commands: Add macros to declare commands with subcmds

Most cmd/xxx.c source files expose several commands through a single
entry point. Some of them are doing the sub-command parsing manually in
their do_<cmd>() function, others are declaring a table of sub-commands
and then use find_cmd_tbl() to delegate the request to the sub command
handler.

In either case, the amount of code to do that is not negligible and
repetitive, not to mention that almost no commands are implementing
the auto-completion hook, which means most u-boot commands lack
auto-completion.

Provide several macros to easily define commands exposing sub-commands.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocommon: command: Rework the 'cmd is repeatable' logic
Boris Brezillon [Mon, 3 Dec 2018 21:54:20 +0000 (22:54 +0100)]
common: command: Rework the 'cmd is repeatable' logic

The repeatable property is currently attached to the main command and
sub-commands have no way to change the repeatable value (the
->repeatable field in sub-command entries is ignored).

Replace the ->repeatable field by an extended ->cmd() hook (called
->cmd_rep()) which takes a new int pointer to store the repeatable cap
of the command being executed.

With this trick, we can let sub-commands decide whether they are
repeatable or not.

We also patch mmc and dtimg who are testing the ->repeatable field
directly (they now use cmd_is_repeatable() instead), and fix the help
entry manually since it doesn't use the U_BOOT_CMD() macro.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocommon: command: Expose a generic helper to auto-complete sub commands
Boris Brezillon [Mon, 3 Dec 2018 21:54:19 +0000 (22:54 +0100)]
common: command: Expose a generic helper to auto-complete sub commands

Some commands have a table of sub-commands. With minor adjustments,
complete_cmdv() is able to provide auto-completion for sub-commands
(it's just about passing the table of commands instead of taking the
global one).
We rename this function into complete_subcmd() and implement
complete_cmdv() as a wrapper around complete_subcmdv().

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocommon: command: Fix command auto-completion
Boris Brezillon [Mon, 3 Dec 2018 21:54:18 +0000 (22:54 +0100)]
common: command: Fix command auto-completion

When auto-completing command arguments, the last argument is not
necessarily the one we need to auto-complete. When the last character is
a space, a tab or '\0' what we want instead is list all possible values,
or if there's only one possible value, place this value on the command
line instead of trying to suffix the last valid argument with missing
chars.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoblk: Increase cache element size
Marek Vasut [Wed, 8 Aug 2018 11:20:29 +0000 (13:20 +0200)]
blk: Increase cache element size

Cache up to 4 kiB entries. 4 kiB is the default block size on ext4, yet
the underlying block layer devices usually report support for 512B . In
most cases, the 512B support is emulated (ie. SD cards, SSDs, USB sticks
etc.) and the real block size of those devices is much bigger.

To avoid performance degradation with such devices and FS setup, bump
the maximum cache entry size to 4 kiB.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoMakefile: run CONFIG_BOARD_SIZE_LIMIT against .img
Simon Goldschmidt [Fri, 11 Jan 2019 19:56:02 +0000 (20:56 +0100)]
Makefile: run CONFIG_BOARD_SIZE_LIMIT against .img

With the current Makefile, CONFIG_BOARD_SIZE_LIMIT is used to check
the U-Boot binary without devicetree only. This produces wrong results
when OF_SEPARATE is used.

To fix this, run the CONFIG_BOARD_SIZE_LIMIT check on all .img binaries
as well.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agokbuild: add .SECONDARY special target to scripts/Kbuild.include
Masahiro Yamada [Fri, 11 Jan 2019 10:42:27 +0000 (19:42 +0900)]
kbuild: add .SECONDARY special target to scripts/Kbuild.include

Based on the following Linux commits:

 - 54a702f70589 ("kbuild: mark $(targets) as .SECONDARY and remove
   .PRECIOUS markers")

 - 8e9b61b293d9 ("kbuild: move .SECONDARY special target to
   Kbuild.include")

GNU Make automatically deletes intermediate files that are updated
in a chain of pattern rules.

Example 1) %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
Example 2) %.o <- %.c <- %.c_shipped

A couple of makefiles mark such targets as .PRECIOUS to prevent Make
from deleting them, but the correct way is to use .SECONDARY.

  .SECONDARY
    Prerequisites of this special target are treated as intermediate
    files but are never automatically deleted.

  .PRECIOUS
    When make is interrupted during execution, it may delete the target
    file it is updating if the file was modified since make started.
    If you mark the file as precious, make will never delete the file
    if interrupted.

Both can avoid deletion of intermediate files, but the difference is
the behavior when Make is interrupted; .SECONDARY deletes the target,
but .PRECIOUS does not.

The use of .PRECIOUS is relatively rare since we do not want to keep
partially constructed (possibly corrupted) targets.

.SECONDARY with no prerequisites causes all targets to be treated as
secondary. This agrees the policy of Kbuild.

scripts/Kbuild.include seems a suitable place to add it because it is
included from almost all sub-makes.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
5 years agokbuild: add .DELETE_ON_ERROR special target
Masahiro Yamada [Fri, 11 Jan 2019 10:42:26 +0000 (19:42 +0900)]
kbuild: add .DELETE_ON_ERROR special target

Linux commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0

If Make gets a fatal signal while a shell is executing, it may delete
the target file that the recipe was supposed to update.  This is needed
to make sure that it is remade from scratch when Make is next run; if
Make is interrupted after the recipe has begun to write the target file,
it results in an incomplete file whose time stamp is newer than that
of the prerequisites files.  Make automatically deletes the incomplete
file on interrupt unless the target is marked .PRECIOUS.

The situation is just the same as when the shell fails for some reasons.
Usually when a recipe line fails, if it has changed the target file at
all, the file is corrupted, or at least it is not completely updated.
Yet the file’s time stamp says that it is now up to date, so the next
time Make runs, it will not try to update that file.

However, Make does not cater to delete the incomplete target file in
this case.  We need to add .DELETE_ON_ERROR somewhere in the Makefile
to request it.

scripts/Kbuild.include seems a suitable place to add it because it is
included from almost all sub-makes.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
5 years agocommon: Kconfig: miscellaneous spelling fixes
Chris Packham [Fri, 11 Jan 2019 02:30:50 +0000 (15:30 +1300)]
common: Kconfig: miscellaneous spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agokbuild: fix parallel build race caused by u-boot.cfg regeneration
Masahiro Yamada [Thu, 10 Jan 2019 14:11:39 +0000 (23:11 +0900)]
kbuild: fix parallel build race caused by u-boot.cfg regeneration

Multiple people have reported intermittent build failure in parallel
building.

Kever Yang reported this issue some time ago [1], but I could not
get enough clue at that time.

This time, Richard Purdie provided a full build log [2], which was
very helpful for me to root-cause it.

The cause of the problem is commit 0d982c585330 ("Makefile: add
dependencies to regenerate u-boot.cfg when lost").

That commit added the 'cfg' as the prerequisite of the 'all' target,
so the parallel build tries to run it simultaneously, then regenerates
a symlink while building objects.

When u-boot.cfg is accidentally lost, let's rebuild it before
descending into any subdirectories.

Also, what is annoying is u-boot.cfg is currently regenerated every
time since it depends on FORCE. We can get rid of all the prerequisites
of u-boot.cfg because u-boot.cfg is rebuilt anyway as the byproduct of
auto.conf when a user updates the .config file.

[1] https://lists.denx.de/pipermail/u-boot/2018-June/330341.html
[2] https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/160/steps/7/logs/step1b

Fixes: 0d982c585330 ("Makefile: add dependencies to regenerate u-boot.cfg when lost")
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoserial: ns16550: fix debug uart putc called before init
Simon Goldschmidt [Wed, 9 Jan 2019 19:35:31 +0000 (20:35 +0100)]
serial: ns16550: fix debug uart putc called before init

If _debug_uart_putc() is called before _debug_uart_init(), the
ns16550 debug uart driver hangs in a tight loop waiting for the
tx FIFO to get empty.

As this can happen via a printf sneaking in before the port calls
debug_uart_init(), introduce a config option to ignore characters
before the debug uart is initialized.

This is done by reading the baudrate divisor and aborting if is zero.

The Kconfig option is required as reading the baudrate divisor does
not seem to work for all ns16500 compatibles (which is why the last
attempt on this has been reverted in 1a67969a99).

Tested on socfpga_cyclone5_socrates.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodrivers: serial: DEBUG_UART_SKIP_INIT depends on DEBUG_UART
Simon Goldschmidt [Wed, 9 Jan 2019 19:27:09 +0000 (20:27 +0100)]
drivers: serial: DEBUG_UART_SKIP_INIT depends on DEBUG_UART

DEBUG_UART_SKIP_INIT is used only by debug UART and thus should depend
on DEBUG_UART.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoFix typo: missmatched -> mismatched.
Vagrant Cascadian [Tue, 8 Jan 2019 21:10:23 +0000 (13:10 -0800)]
Fix typo: missmatched -> mismatched.

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agoxyz-modem: Fix timeout loop waiting with WATCHDOG
Lokesh Vutla [Tue, 8 Jan 2019 13:58:35 +0000 (19:28 +0530)]
xyz-modem: Fix timeout loop waiting with WATCHDOG

Commit 2c77c0d6524eb ("xyz-modem: Change getc timeout loop waiting")
fixes the loop delay when using a hw watchdog, assuming that watchdog
kicking is taken care of by getc(). But the xyzmodem driver tries to
do a getc only after confirming that a character is available like below:
while (!tstc()) {
till timeout;
}
if (tstc())
*c = getc();

and getc() does a watchdog reset only if it fails to see a character.
In this case, getc() always sees a character and never does a
watchdog reset. So to make sure that watchdog doesn't get reset
while loading the file, do a watchdog reset just before starting the
image loading.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agopylibfdt: Use Python 2 in Makefile
Josef Lusticky [Tue, 8 Jan 2019 13:19:46 +0000 (14:19 +0100)]
pylibfdt: Use Python 2 in Makefile

pylibfdt needs Python 2 to build.
Replace $(PYTHON) with $(PYTHON2) in pylibfdt Makefile
to ensure Python 2 is used to build it.

This fixes build on systems where Python 3 is the default version
of the "python" interpreter.
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agolib: uuid: Do not enable UUID command SPL
Marek Vasut [Mon, 7 Jan 2019 20:23:38 +0000 (21:23 +0100)]
lib: uuid: Do not enable UUID command SPL

The uuid command is only really useful in U-Boot, but it's useless in
SPL. Worse yet, it pulls in various environment manipulation functions
as it call env_set(). Do not compile the command in in SPL.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
5 years agospl: ymodem: Add support for loading gzip compressed uImage
Marek Vasut [Mon, 7 Jan 2019 20:23:22 +0000 (21:23 +0100)]
spl: ymodem: Add support for loading gzip compressed uImage

Add support for gunzip-ing gzip-compressed uImages in the SPL Ymodem code.
Loading data over Ymodem can be gruelingly slow, gzip-ing the data can
reduce that aggravating slowness at least slightly (depends on the data,
u-boot.bin compresses to ~1/3 of it's original size on ARM64), hence add
optional support for decompressing gzip-compressed uImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
5 years agodtoc: make generated platdata structs const
Simon Goldschmidt [Mon, 7 Jan 2019 19:29:26 +0000 (20:29 +0100)]
dtoc: make generated platdata structs const

The platdata initialization structs are currently generated into .rwdata.
Make sure the are put into .rodata by generating them as const.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: zip: use correct format code
Heinrich Schuchardt [Sun, 6 Jan 2019 11:38:37 +0000 (12:38 +0100)]
cmd: zip: use correct format code

dst_len is defined as unsigned long. So use %lu for printf().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: unzip: use correct format code
Heinrich Schuchardt [Sun, 6 Jan 2019 11:34:16 +0000 (12:34 +0100)]
cmd: unzip: use correct format code

src_len is defined as unsigned long. So use %lu for printf().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: ubi: remove unreachable code
Heinrich Schuchardt [Sun, 6 Jan 2019 11:26:28 +0000 (12:26 +0100)]
cmd: ubi: remove unreachable code

It does not make sense to check if argc < 2 a second time, especially after
accessing argv[1].

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: tpm-v2: use correct format code
Heinrich Schuchardt [Sun, 6 Jan 2019 11:09:10 +0000 (12:09 +0100)]
cmd: tpm-v2: use correct format code

updates is defined as unsigned int. So use %u for printf().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: sf: use correct printf code
Heinrich Schuchardt [Sun, 6 Jan 2019 11:03:37 +0000 (12:03 +0100)]
cmd: sf: use correct printf code

test->time_ms[] is defined as unsigned. So use %u for printf().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: nvedit: use correct format code
Heinrich Schuchardt [Sun, 6 Jan 2019 10:52:06 +0000 (11:52 +0100)]
cmd: nvedit: use correct format code

len is defined as unsigned. So use %u for printf().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>