oweals/u-boot.git
4 years agonet: eepro100: Clean up comments
Marek Vasut [Sat, 23 May 2020 10:49:16 +0000 (12:49 +0200)]
net: eepro100: Clean up comments

Clean the comments up to they trigger fewer checkpatch warnings,
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
4 years agonet: eepro100: Remove EEPRO100_SROM_WRITE
Marek Vasut [Sat, 23 May 2020 11:06:48 +0000 (13:06 +0200)]
net: eepro100: Remove EEPRO100_SROM_WRITE

This code is never enabled, last board that used it was ELPPC which
was removed some 5 years ago, so just remove this code altogether.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
4 years agocommon: hash: Remove a debug printf statement
Harald Seiler [Mon, 15 Jun 2020 07:47:04 +0000 (09:47 +0200)]
common: hash: Remove a debug printf statement

Remove a left-over debug printf that was introduced with SHA512 support.

Fixes: d16b38f42704 ("Add support for SHA384 and SHA512")
Signed-off-by: Harald Seiler <hws@denx.de>
4 years agoMerge tag 'dm-pull-12jun20' of git://git.denx.de/u-boot-dm into next
Tom Rini [Sat, 13 Jun 2020 13:01:01 +0000 (09:01 -0400)]
Merge tag 'dm-pull-12jun20' of git://git.denx.de/u-boot-dm into next

patman improvements to allow it to work with Zephyr
change to how sequence numbers are assigned to devices
minor fixes and improvements

4 years agoMerge branch '2020-06-12-next-net' into next
Tom Rini [Fri, 12 Jun 2020 18:58:12 +0000 (14:58 -0400)]
Merge branch '2020-06-12-next-net' into next

- Merge tbs2910 distro boot support and associated clean-ups and size
  reduction.
- Assorted networking corrections / bugfixes.
- Drop smc911x standalone API example as it was likely non-functional for a
  long time.
- Enhanced support for TI PHYs
- rtl8139 DM conversion

4 years agonet: move random_port() to dns
Baruch Siach [Wed, 20 May 2020 10:31:41 +0000 (13:31 +0300)]
net: move random_port() to dns

The random_port() routine is not used anywhere else. Make it local to
dns.c to reduce code clutter, and shrink generated code a little.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agonet: tftp: fix option validation as per RFCs
Ravik Hasija [Tue, 19 May 2020 04:35:43 +0000 (21:35 -0700)]
net: tftp: fix option validation as per RFCs

RFC2348, RFC2349:
- Option string is case in-sensitive.
- Client must generate ERR pkt in case option value mismatch in server OACK
- Fix debug print for options

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
4 years agonet: rtl8139: Add DM support
Marek Vasut [Sat, 9 May 2020 20:34:44 +0000 (22:34 +0200)]
net: rtl8139: Add DM support

Add support for driver model to the driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Read HW address from EEPROM only on probe
Marek Vasut [Sat, 9 May 2020 20:34:43 +0000 (22:34 +0200)]
net: rtl8139: Read HW address from EEPROM only on probe

Do not re-read the HW address from the EEPROM on every start of
transfer, otherwise the user will not be able to adjust ethaddr
as needed. Read the address only once, when the card is detected.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Use PCI_DEVICE() to define PCI device compat list
Marek Vasut [Sat, 9 May 2020 20:34:42 +0000 (22:34 +0200)]
net: rtl8139: Use PCI_DEVICE() to define PCI device compat list

Use this macro to fully fill the PCI device ID table. This is mandatory
for the DM PCI support, which checks all the fields.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Split out common and non-DM functions
Marek Vasut [Sat, 9 May 2020 20:34:41 +0000 (22:34 +0200)]
net: rtl8139: Split out common and non-DM functions

Split the driver into common and non-DM functionality, so that the
DM support can later re-use the common code, while we retain the
non-DM code until all the platforms are converted.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Pass private data into rtl8139_eeprom_delay()
Marek Vasut [Sat, 9 May 2020 20:34:40 +0000 (22:34 +0200)]
net: rtl8139: Pass private data into rtl8139_eeprom_delay()

Instead of always calling rtl8139_eeprom_delay() with priv->ioaddr,
call it with priv and let the function access priv->ioaddr. This
reduces code duplication and has no impact, since the compiler will
inline this as needed anyway.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Introduce device private data
Marek Vasut [Sat, 9 May 2020 20:34:39 +0000 (22:34 +0200)]
net: rtl8139: Introduce device private data

Introduce rtl8139_pdata, which is a super-structure around eth_device
and tracks per-device state, here the device IO address, PCI BDF, RX
and TX ring position. Pass this structure around instead of the old
non-DM eth_device in preparation for DM conversion.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Clean up bus_to_phys()/phys_to_bus() macros
Marek Vasut [Sat, 9 May 2020 20:34:38 +0000 (22:34 +0200)]
net: rtl8139: Clean up bus_to_phys()/phys_to_bus() macros

These macros depended on the dev variable being declared wherever
they were used. This is wrong and will not work with DM anyway, so
pass only the PCI BFD into these macros, which fixes the dependency
and prepares them for DM support as well.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Use dev->iobase instead of custom ioaddr
Marek Vasut [Sat, 9 May 2020 20:34:37 +0000 (22:34 +0200)]
net: rtl8139: Use dev->iobase instead of custom ioaddr

Replace the use of custom static ioaddr variable with common dev->iobase,
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Switch from malloc()+memset() to calloc()
Marek Vasut [Sat, 9 May 2020 20:34:36 +0000 (22:34 +0200)]
net: rtl8139: Switch from malloc()+memset() to calloc()

Replace malloc()+memset() combination with calloc(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Factor out device name assignment
Marek Vasut [Sat, 9 May 2020 20:34:35 +0000 (22:34 +0200)]
net: rtl8139: Factor out device name assignment

Pull the device name setting into a separate function, as this
will be shared between DM/non-DM variants.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: tftp: fix progress marker for file transfer
Ravik Hasija [Thu, 7 May 2020 21:55:32 +0000 (14:55 -0700)]
net: tftp: fix progress marker for file transfer

During packet sequence number wraparound the show_block_marker() API was
not called, as a result the progress marker doesn't stay within column
boundary. Use position in file instead of sequence number to align the
marker.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
4 years agonet: phy: Add DP8382x phy registration to TI PHY init
Dan Murphy [Mon, 4 May 2020 21:14:40 +0000 (16:14 -0500)]
net: phy: Add DP8382x phy registration to TI PHY init

Add the DP8382X generic PHY registration to the TI PHY init file.

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
4 years agonet: phy: Add support for TI PHY init
Dan Murphy [Mon, 4 May 2020 21:14:39 +0000 (16:14 -0500)]
net: phy: Add support for TI PHY init

ti_phy_init function was allocated to the DP83867 PHY.  This function
name is to generic for a specific PHY.  The function can be moved to a
TI specific file that can register all TI PHYs that are defined in the
defconfig.  The ti_phy_init file will contain all TI PHYs initialization
so that only phy_ti_init can be called from the framework.

In addition to the above the config flag for the DP83867 needs to be changed
in the Kconfig and dependent defconfig files. The config flag that was
used for the DP83867 was also generic in nature so a more specific
config flag for the DP83867 was created.

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
4 years agonet: phy: Add helper routines to set and clear bits
Dan Murphy [Mon, 4 May 2020 21:14:38 +0000 (16:14 -0500)]
net: phy: Add helper routines to set and clear bits

Add phy_set/clear_bit helper routines so that ported drivers from the
kernel can use these functions.

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
4 years agonet: phy: Fix kernel doc issues in phy.h
Dan Murphy [Mon, 4 May 2020 21:14:37 +0000 (16:14 -0500)]
net: phy: Fix kernel doc issues in phy.h

Fix kernel doc warnings in phy.h.  Mostly the warnings were due to the
return missing the semi-colon.

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
4 years agonet: phy: Add missing kernel doc to phy functions
Dan Murphy [Mon, 4 May 2020 21:14:36 +0000 (16:14 -0500)]
net: phy: Add missing kernel doc to phy functions

Add kernel doc to the phy_read/write utility functions in phy.h

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
4 years agonet: phy: add phyid search in vendor specific space
Florin Chiculita [Wed, 29 Apr 2020 11:25:48 +0000 (14:25 +0300)]
net: phy: add phyid search in vendor specific space

There are devices accesible through mdio clause-45, such as
retimers, that do not have PMA or PCS blocks.
This patch adds MDIO_MMD_VEND1 on the list of device addresses
where phyid is searched. Previous order of devices was kept.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Reviewed-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
4 years agonet: rt8169: WAR for DHCP not getting IP after kernel boot/reboot
Tom Warren [Thu, 26 Mar 2020 22:59:13 +0000 (15:59 -0700)]
net: rt8169: WAR for DHCP not getting IP after kernel boot/reboot

This is a WAR for DHCP failure after rebooting from the L4T kernel. The
r8169.c kernel driver is setting bit 19 of the rt816x HW register 0xF0,
which goes by FuncEvent and MISC in various driver source/datasheets.
That bit is called RxDv_Gated_En in the r8169.c kernel driver. Clear it
here at the end of probe to ensure that U-Boot can get an IP assigned
via DHCP.

Signed-off-by: Tom Warren <twarren@nvidia.com>
4 years agonet: phy: micrel: ksz8061 implement errata 80000688A fix
Bryan O'Donoghue [Thu, 26 Mar 2020 03:54:01 +0000 (03:54 +0000)]
net: phy: micrel: ksz8061 implement errata 80000688A fix

Linux commit 232ba3a51cc2 ('net: phy: Micrel KSZ8061: link failure after
cable connect') implements a fix for the above errata.

This patch replicates that errata fix in an ksz8061 specific init routine.

Signed-off-by: Bryan O'Donoghue <bod@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: smc911x: Drop the standalone EEPROM example
Marek Vasut [Sat, 14 Mar 2020 23:18:57 +0000 (00:18 +0100)]
net: smc911x: Drop the standalone EEPROM example

Drop the example, for two reasons. First, it is tapping directly into
the IO accessors of the SMC911x, while it should instead go through
the net device API. Second, this makes conversion of the SMC911x driver
to DM real hard.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: Fix error if some network features are disabled
Krebs, Olaf [Mon, 9 Mar 2020 14:27:55 +0000 (14:27 +0000)]
net: Fix error if some network features are disabled

If 'CONFIG_CMD_TFTPBOOT' or 'CONFIG_CMD_BOOTP' are disabled, the usage must be disabled, too!

Signed-off-by: Olaf Krebs <olaf.krebs@emh-metering.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
4 years agoboard: tbs2910: add documentation
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:25 +0000 (05:24 +0200)]
board: tbs2910: add documentation

This documents the u-boot installation procedure and the
hardware in order to get started.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
[trini: Add MAINTAINERS entry for doc file per Soeren's request]

4 years agoboard: tbs2910: Enable distro_boot support.
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:24 +0000 (05:24 +0200)]
board: tbs2910: Enable distro_boot support.

This keeps the compatibility with the old bootcmd.

The fdtfile environment variable also needed to be set to
imx6q-tbs2910.dtb to enable booting mainline kernels
otherwise with extlinux.conf it tries to load
mx6-tbs2910.dtb instead.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola
GNU/Linux distribution, we have the following size
differences:
- text: +2041 bytes
- data: 0 bytes
- bss: 0 bytes
- total: +2041 bytes

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Reviewed-by: Soeren Moch <smoch@web.de>
4 years agoboard: tbs2910_defconfig: Add support for booting general purpose distributions
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:22 +0000 (05:24 +0200)]
board: tbs2910_defconfig: Add support for booting general purpose distributions

This is needed to enable distro_boot support later on.

Adding the necessary configuration to enable booting general
purpose distributions is typically done by enabling
CONFIG_DISTRO_DEFAULTS.

However the resulting image size is is already very close to
the size limit and PXE isn't strictly needed, so instead we
made sure that all the configuration selected by
CONFIG_DISTRO_DEFAULTS were selected, with the exception of
PXE related configuration (CONFIG_BOOTP_PXE and
CONFIG_CMD_PXE) that are both disabled.

With arm-linux-gnueabi-gcc 9.3.0-1 from the Parabola
GNU/Linux distribution, we have the following size
differences:
- text: +7526 bytes
- data: +28 bytes
- bss: -12 bytes
- total: +7542 bytes

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Reviewed-by: Soeren Moch <smoch@web.de>
4 years agoboard: tbs2910: move CONFIG_BOOTCOMMAND from header to defconfig
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:21 +0000 (05:24 +0200)]
board: tbs2910: move CONFIG_BOOTCOMMAND from header to defconfig

This doesn't affect the size of the image: with
arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux
distribution, the text, data, bss and total sizes remain
unchanged.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Reviewed-by: Soeren Moch <smoch@web.de>
4 years agoboard: tbs2910: disable CONFIG_GZIP
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:20 +0000 (05:24 +0200)]
board: tbs2910: disable CONFIG_GZIP

As that the resulting image is already very close to the
size limit, and that CONFIG_GZIP is not strictly required,
removing it shouldn't hurt.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola
GNU/Linux distribution we have the following size
reduction:
- text: 9752
- data: 0
- bss: 16
- total: 9768

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Soeren Moch <smoch@web.de>
4 years agoboard: tbs2910: disable loadb and loads commands
Denis 'GNUtoo' Carikli [Sat, 30 May 2020 03:24:19 +0000 (05:24 +0200)]
board: tbs2910: disable loadb and loads commands

The loadb and loads commands are not needed for booting.

There are also more reliable and faster alternatives to
loadb and loads that can be used with the current configuration.

As that the resulting image is already very close to the
size limit, removing the loadb and loads commands shouldn't
hurt.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola
GNU/Linux distribution we have the following size
reduction:
- text: 6733 bytes
- data: 116 bytes
- bss: 1172 bytes
- total: 8021 bytes

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Soeren Moch <smoch@web.de>
4 years agoAdd support for SHA384 and SHA512
Reuben Dowle [Thu, 16 Apr 2020 05:36:52 +0000 (17:36 +1200)]
Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
4 years agodoc: driver-model: fix typo in design.rst
Dario Binacchi [Thu, 4 Jun 2020 12:58:13 +0000 (14:58 +0200)]
doc: driver-model: fix typo in design.rst

Fix the 'memeber' typo in doc/driver-model/design.rst.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: uclass: don't assign aliased seq numbers
Michael Walle [Mon, 1 Jun 2020 23:47:09 +0000 (01:47 +0200)]
dm: uclass: don't assign aliased seq numbers

If there are aliases for an uclass, set the base for the "dynamically"
allocated numbers next to the highest alias.

Please note, that this might lead to holes in the sequences, depending
on the device tree. For example if there is only an alias "ethernet1",
the next device seq number would be 2.

In particular this fixes a problem with boards which are using ethernet
aliases but also might have network add-in cards like the E1000. If the
board is started with the add-in card and depending on the order of the
drivers, the E1000 might occupy the first ethernet device and mess up
all the hardware addresses, because the devices are now shifted by one.

Also adapt the test cases to the new handling and add test cases
checking the holes in the seq numbers.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Alex Marginean <alexandru.marginean@nxp.com>
Tested-by: Alex Marginean <alexandru.marginean@nxp.com>
Acked-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Michal Simek <michal.simek@xilinx.com> [on zcu102-revA]
4 years agodm: core: fix dev_read_alias_highest_id() without libfdt
Michael Walle [Mon, 1 Jun 2020 23:47:08 +0000 (01:47 +0200)]
dm: core: fix dev_read_alias_highest_id() without libfdt

If CONFIG_DM_DEV_READ_INLINE is set, dev_read_alias_highest_id() calls
libfdt_get_highest_id(). But this function is only available if we have
libfdt compiled in. If its not available return -1, which matches the
return code for no alias found.

This fixes the following error on omapl138_lcdk:
arm-linux-gnueabi-ld.bfd: drivers/built-in.o: in function `dev_read_alias_highest_id':
/home/mw/repo/u-boot/include/dm/read.h:986: undefined reference to `fdtdec_get_alias_highest_id'

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agousb: provide a device tree node to USB devices
Michael Walle [Mon, 1 Jun 2020 23:47:07 +0000 (01:47 +0200)]
usb: provide a device tree node to USB devices

It is possible to specify a device tree node for an USB device. This is
useful if you have a static USB setup and want to use aliases which
point to these nodes, like on the Raspberry Pi.
The nodes are matched against their hub port number, the compatible
strings are not matched for now.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: check argument of 'log level' command
Heinrich Schuchardt [Sun, 31 May 2020 13:44:51 +0000 (13:44 +0000)]
log: check argument of 'log level' command

Check that the argument provided to the 'log level' command is in the range
between zero and CONFIG_LOG_MAX_LEVEL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: clean up Kconfig
Heinrich Schuchardt [Sun, 31 May 2020 13:34:22 +0000 (15:34 +0200)]
log: clean up Kconfig

LOG_DEFAULT_LEVEL has been chosen as 6. Adjust the default of LOG_MAX_LEVEL
to this value.

Use ranges to clamp log levels to reasonable values.

Group output options by main U-Boot, SPL, TPL, followed by other logging
options.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodoc: move README.log to HTML documentation
Heinrich Schuchardt [Sun, 31 May 2020 08:46:12 +0000 (10:46 +0200)]
doc: move README.log to HTML documentation

Convert README.log to reStructuredText and add it to the generated HTML
documentation.

Assign doc/develop/logging.rst to the maintainer of LOGGING.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodoc: log: correct option name CONFIG_LOG_MAX_LEVEL
Patrick Delaunay [Wed, 27 May 2020 07:43:31 +0000 (09:43 +0200)]
doc: log: correct option name CONFIG_LOG_MAX_LEVEL

Replace CONFIG_(SPL_)MAX_LOG_LEVEL by the correct name as defined in
common/Kconfig:
line 668:config LOG_MAX_LEVEL
line 688:config SPL_LOG_MAX_LEVEL
line 708:config TPL_LOG_MAX_LEVEL

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: Check for out-of-range offsets before mapping them
Pratyush Yadav [Tue, 26 May 2020 12:05:57 +0000 (17:35 +0530)]
regmap: Check for out-of-range offsets before mapping them

In regmap_raw_{read,write}_range(), offsets are checked to make sure
they aren't out of range. But this check happens _after_ the address is
mapped from physical memory. Input should be sanity-checked before using
it. Mapping the address before validating it leaves the door open to
passing an invalid address to map_physmem(). So check for out of range
offsets _before_ mapping them.

This fixes a segmentation fault in sandbox when -1 is used as an offset
to regmap_{read,write}().

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agolibfdt: Remove superfluous NUL character from overlay symbols
Marcus Comstedt [Fri, 22 May 2020 16:41:36 +0000 (18:41 +0200)]
libfdt: Remove superfluous NUL character from overlay symbols

The symbol path already ends with a NUL character (something which is
actually checked by the code) and this NUL is included in
rel_path_len, so there is no need to add a second one.

This change fixes incorrect display in "fdt list /__symbols" after
applying an overlay with symbols.

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodoc: driver-model: there is no UCLASS_SATA
Heinrich Schuchardt [Wed, 20 May 2020 21:27:27 +0000 (23:27 +0200)]
doc: driver-model: there is no UCLASS_SATA

%s/UCLASS_SATA/UCLASS_AHCI/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: Honor #address-cells and #size-cells in fdtdec_add_reserved_memory()
Bin Meng [Wed, 20 May 2020 06:38:33 +0000 (23:38 -0700)]
fdtdec: Honor #address-cells and #size-cells in fdtdec_add_reserved_memory()

At present fdtdec_add_reserved_memory() calls fdtdec_get_addr_size()
to get address and size for the subnodes of /reserved-memory node.

We should honor #address-cells and #size-cells properties in the
parent node.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory()
Bin Meng [Wed, 20 May 2020 06:38:32 +0000 (23:38 -0700)]
fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory()

fdtdec_get_addr_size() expects size is of type 'fdt_size_t', and
return value is of type 'fdt_addr_t'. Adjust their types accordingly.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agobuildman: Remove _of_#_ from results directory paths
Ovidiu Panait [Fri, 15 May 2020 06:30:12 +0000 (09:30 +0300)]
buildman: Remove _of_#_ from results directory paths

Currently, the following scenario will rebuild the first commit even
though it is not really necessary - the commit sha or the position in the
patchset did not change:

$ git am <local-patch-0001>
$ tools/buildman/buildman -P -E -W -b master mx6
<do some more development work>
$ git am <local-patch-0002>
$ tools/buildman/buildman -P -E -W -b master mx6 <- will rebuild the first
    commit as well, even
    though nothing has
    changed about it.

This is due to the fact that previous results directories get removed
when the number of commits change. By removing the _of_#_ part of the
directory path, the commits will be rebuilt only if the commit sha or the
position in the patchset changes. Also, update the testcase to reflect this
change.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
4 years agopatman: Complain if a checkpatch line is not understood
Simon Glass [Wed, 6 May 2020 22:29:09 +0000 (16:29 -0600)]
patman: Complain if a checkpatch line is not understood

Rather than suffering in silence, output a warning if something about the
checkpatch output cannot be understood.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Support warnings in the patch subject
Simon Glass [Wed, 6 May 2020 22:29:08 +0000 (16:29 -0600)]
patman: Support warnings in the patch subject

Sometimes checkpatch outputs problems in the patch subject. Add support
for parsing this output and reporting it correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Handle checkpatch output with notes and code
Simon Glass [Wed, 6 May 2020 22:29:07 +0000 (16:29 -0600)]
patman: Handle checkpatch output with notes and code

If checkpatch is configured to output code we should ignore it. Similarly,
notes should be ignored.

Update the logic to handle these situations.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Don't try to process checkpatch lines twice
Simon Glass [Wed, 6 May 2020 22:29:06 +0000 (16:29 -0600)]
patman: Don't try to process checkpatch lines twice

Once we have determined what the line refers to there is no point in
processing it further. Update the logic to continue to the next line in
these cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Support emacs mode with checkpatch
Simon Glass [Wed, 6 May 2020 22:29:05 +0000 (16:29 -0600)]
patman: Support emacs mode with checkpatch

If checkpatch is run in 'emacs' mode it shows the filename at the
start of each line. Add support for this so that the warnings and errors
are correctly detected.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Fix 'warning' typo
Simon Glass [Wed, 6 May 2020 22:29:04 +0000 (16:29 -0600)]
patman: Fix 'warning' typo

If no warnings are detected due to checkpatch having unexpected options,
patman currently shows an error:

   TypeError: unsupported operand type(s) for +=: 'int' and 'property'

Fix this by initing the variable correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: Resync with savedefconfig
Tom Rini [Thu, 11 Jun 2020 17:55:57 +0000 (13:55 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'u-boot-imx-20200609' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Tue, 9 Jun 2020 13:17:24 +0000 (09:17 -0400)]
Merge tag 'u-boot-imx-20200609' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

Fixes for 2020.07
-----------------

- mx53: mx53menlo Convert to DM_ETH, fix fail boot
- imx8mp_evk: fix boot issue
- MX6, display5: fix environment
- drop warnings (watchdog) for i.MX8mm i.mx8mp
- enable bootaux for i.MX8M

Travis: https://travis-ci.org/github/sbabic/u-boot-imx/builds/695929999

4 years agoRevert "imx: rom api: fix image offset computation"
Stefano Babic [Tue, 9 Jun 2020 09:19:55 +0000 (11:19 +0200)]
Revert "imx: rom api: fix image offset computation"

This reverts commit 1f63ee656698724bcdc4e711b4ccd267f6bf64ab.

As reported by Ye Li on ML:

1. Removing the image_offset will break secondary (redundant) boot support for sd and emmc.
2. When booting from emmc boot partition, the image_offset is 0. But the flash.bin
generated by mkimage with imximage-8mp-lpddr4.cfg is for sd. It expects to be burn at 32KB offset.
The fit offset 0x60000 has already included the 32KB offset.  So when you burn this flash.bin
to emmc boot partition at offset 0, the fit offset should subtract the 32KB (0x60000 - 0x8000).

Signed-off-by: Stefano Babic <sbabic@denx.de>
4 years agoPrepare v2020.07-rc4 v2020.07-rc4
Tom Rini [Tue, 9 Jun 2020 00:30:26 +0000 (20:30 -0400)]
Prepare v2020.07-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocmd: Correct the 'md.q' command
Simon Glass [Mon, 8 Jun 2020 02:33:00 +0000 (20:33 -0600)]
cmd: Correct the 'md.q' command

This displays incorrect data at present due to a missing header file
in display_options. Fix it.

Fixes: 09140113108 ("command: Remove the cmd_tbl_t typedef")

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx
Tom Rini [Mon, 8 Jun 2020 12:51:59 +0000 (08:51 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx

- DM_ETH support for P2041RDB, T1024RDB, P5040DS, P3041DS, P4080DS, bug
  fixes
- Add TBI PHY access through MII
- DDR: Rework errata workaround for A008109A008378, 009942

4 years agoMerge tag 'u-boot-rockchip-20200607' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 8 Jun 2020 12:51:30 +0000 (08:51 -0400)]
Merge tag 'u-boot-rockchip-20200607' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- revive rk3399 puma board to adapt mainline dts;
- Fix rk3399-evb stdout path;
- Enable PCIe for rk3399: Rockpro64, firefly, pinebookpro;
- Add rk3328 Rock-pi-e board;
- Enable SPI boot for rockpro64 and roc-pc-rk3399;

4 years agoARM: dts: imx: m53menlo: Convert to DM_ETH
Marek Vasut [Sat, 30 May 2020 20:44:46 +0000 (22:44 +0200)]
ARM: dts: imx: m53menlo: Convert to DM_ETH

Convert the board to DM_ETH instead of legacy networking. This requires
a minor addition to the DT to satisfy the requirement for specifying a
PHY node. No functional change from board user perspective.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: m53menlo: Do not fail boot on invalid splash screen
Marek Vasut [Sat, 30 May 2020 20:44:45 +0000 (22:44 +0200)]
ARM: imx: m53menlo: Do not fail boot on invalid splash screen

None of these splash screen loading errors are so critical as to
justify complete failure to boot, so just print error message as
needed and return 0, the boot can very likely continue without
the splash.

Fix a couple of missing free(dst) instances as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: ddr: Add missing PHY reset
Marek Vasut [Sat, 30 May 2020 00:14:48 +0000 (02:14 +0200)]
ARM: imx: ddr: Add missing PHY reset

The iMX7D RM 9.2.4.9.3 Power removal flow Table 9-11. Re-enabling power
explicitly says both the DDR controller and the PHY must be reset in the
correct sequence. Currently the code only resets the controller. This
leads to a misbehavior where the system brings the DRAM up after reboot,
but the DRAM is unstable. Add the missing reset.

The easiest way to trigger this is by triggering WDT without having the
WDT assert WDOG_B signal, i.e. mw.w 0x30280000 0x25 .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agopower: pmic: Add SPL Kconfig entry for PFUZE100
Marek Vasut [Fri, 29 May 2020 17:22:41 +0000 (19:22 +0200)]
power: pmic: Add SPL Kconfig entry for PFUZE100

Add Kconfig entry for the PFUZE PMIC, SPL variant.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoimx: imx8mp_evk: fix boot issue
Peng Fan [Tue, 26 May 2020 23:33:50 +0000 (20:33 -0300)]
imx: imx8mp_evk: fix boot issue

The u-boot-spl.bin pad with ddr firmware conflicts with the
CONFIG_MALLOC_F_ADDR area, the ddr firmware will be overwritten
by malloc in SPL stage and cause ddr initialization not able
to finish. So update the related addresses to fix the issue.

Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mp_evk: spl: no need the code since spl framework could do that
Peng Fan [Tue, 26 May 2020 23:33:49 +0000 (20:33 -0300)]
imx8mp_evk: spl: no need the code since spl framework could do that

We no need invoke the code, since spl framework could help
us do that.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mp_evk: spl: use spl_early_init
Peng Fan [Tue, 26 May 2020 23:33:48 +0000 (20:33 -0300)]
imx8mp_evk: spl: use spl_early_init

Use spl_early_init to replace spl_init, spl_init will be invoked
in board_init_r, we only need use spl_early_init to setup malloc
and scan early dt.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mp_evk: spl: drop timer_init
Peng Fan [Tue, 26 May 2020 23:33:47 +0000 (20:33 -0300)]
imx8mp_evk: spl: drop timer_init

timer_init has been invoked in arch_cpu_init, no need to invoke
it again in board code.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mp_evk: spl: drop useless code
Peng Fan [Tue, 26 May 2020 23:33:46 +0000 (20:33 -0300)]
imx8mp_evk: spl: drop useless code

Drop useless getting ccm device, there is no need to explicted do this
in board code, and we not enable SPL CLK currently.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx: Update MTD partitions layout for display5 (i.MX6Q) board
Lukasz Majewski [Wed, 13 May 2020 15:45:15 +0000 (17:45 +0200)]
imx: Update MTD partitions layout for display5 (i.MX6Q) board

This change updates the MTD partition layout on SPI-NOR memory for display5
board.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 years agoimx: rom api: fix image offset computation
Sébastien Szymanski [Wed, 13 May 2020 14:02:28 +0000 (16:02 +0200)]
imx: rom api: fix image offset computation

When not booting from FlexSPI, the offset computation is:

offset = image_offset + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;

When booting from SD card or eMMC user partition, image_offset is
0x8000. It is useless to add and remove 0x8000.
When booting from other device, image_offset is 0 so this computation is wrong.

Simplfy this computation to work on all booting devices.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
4 years agoverdin-imx8mm: Select the watchdog driver
Fabio Estevam [Mon, 11 May 2020 14:00:31 +0000 (11:00 -0300)]
verdin-imx8mm: Select the watchdog driver

Currently watchdog driver is not selected, which causes system to reboot
after staying 60s in the U-Boot prompt.

Fix this problem by enabling CONFIG_WATCHDOG so that watchdog can be
properly serviced.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Igor Opaniuk <igor.opaniuk@toradex.com>
4 years agoimx8mp_evk: Select the watchdog driver
Fabio Estevam [Mon, 11 May 2020 14:00:30 +0000 (11:00 -0300)]
imx8mp_evk: Select the watchdog driver

Currently watchdog driver is not selected, which causes system to reboot
after staying 60s in the U-Boot prompt.

Fix this problem by enabling CONFIG_WATCHDOG so that watchdog can be
properly serviced.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mm_beacon: Select the watchdog driver
Fabio Estevam [Mon, 11 May 2020 14:00:29 +0000 (11:00 -0300)]
imx8mm_beacon: Select the watchdog driver

Currently watchdog driver is not selected, which causes system to reboot
after staying 60s in the U-Boot prompt.

Fix this problem by enabling CONFIG_WATCHDOG so that watchdog can be
properly serviced.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Adam Ford <aford173@gmail.com>
4 years agoimx8mn_ddr4_evk: Select the watchdog driver
Fabio Estevam [Mon, 11 May 2020 14:00:28 +0000 (11:00 -0300)]
imx8mn_ddr4_evk: Select the watchdog driver

Currently watchdog driver is not selected, which causes system to reboot
after staying 60s in the U-Boot prompt.

Fix this problem by enabling CONFIG_WATCHDOG so that watchdog can be
properly serviced.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mm_evk: Select the watchdog driver
Fabio Estevam [Mon, 11 May 2020 14:00:27 +0000 (11:00 -0300)]
imx8mm_evk: Select the watchdog driver

Currently the watchdog driver is not selected, which causes the following
warnings in both SPL and U-Boot proper:

U-Boot SPL 2020.07-rc1-00387-g67887903af (May 07 2020 - 23:49:27 -0300)
Normal Boot
WDT:   Started without servicing (60s timeout)
Trying to boot from MMC1

U-Boot 2020.07-rc1-00387-g67887903af (May 07 2020 - 23:49:27 -0300)

CPU:   Freescale i.MX8MMQ rev1.0 at 1200 MHz
Reset cause: POR
Model: FSL i.MX8MM EVK board
DRAM:  2 GiB
WDT:   Started without servicing (60s timeout)
....

System reboots after staying 60s in the U-Boot prompt.

Fix this problem by enabling CONFIG_WATCHDOG so that watchdog can be
properly serviced.

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8mp_evk: Add a README file
Fabio Estevam [Mon, 11 May 2020 12:45:51 +0000 (09:45 -0300)]
imx8mp_evk: Add a README file

Add a README file explaining the U-Boot build and SD card flash procedures.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx: move ATF to the back of the FIT to fix loading over yModem
Patrick Wildt [Fri, 8 May 2020 09:59:47 +0000 (11:59 +0200)]
imx: move ATF to the back of the FIT to fix loading over yModem

With yModem the FIT Image is only supplied once, so we can only
seek forward in the yModem supplied image and never backwards.
With the recent changes to the SPL mechanism, including loading
U-Boot first, FDT after, then the loadables, we must also reorder
the FIT image script to make sure that the loadables are last in
the FIT image.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Tested-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
4 years agoimx: Kconfig: enable IMX_BOOTAUX for i.MX8M
Peng Fan [Tue, 5 May 2020 12:18:02 +0000 (20:18 +0800)]
imx: Kconfig: enable IMX_BOOTAUX for i.MX8M

i.MX8M could use imx bootaux to boot m4/m7 core, so let's add it
to the dependency list.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoARM: dts: imxrt1050: indent lcdif node correctly
Giulio Benetti [Tue, 28 Apr 2020 16:20:11 +0000 (18:20 +0200)]
ARM: dts: imxrt1050: indent lcdif node correctly

Accidentally submitted a patch with indentation not correct, let's fix it
by indenting wrong lines.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
4 years agorockchip: enable PCIe and NVMe on Pinebook Pro
Patrick Wildt [Sun, 7 Jun 2020 10:08:35 +0000 (12:08 +0200)]
rockchip: enable PCIe and NVMe on Pinebook Pro

Enable CONFIG_PCI and CONFIG_NVME and related configs for the
Pinebook Pro.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: puma: enable new usb config options
Heiko Stuebner [Fri, 5 Jun 2020 10:06:43 +0000 (12:06 +0200)]
rockchip: puma: enable new usb config options

With recently added changes we get support for usb3 including handling
of the phys (type-c and inno-usb2), so enable the necessary config
options on puma.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: puma: drop special handling of usb host regulator
Heiko Stuebner [Fri, 5 Jun 2020 10:06:42 +0000 (12:06 +0200)]
rockchip: puma: drop special handling of usb host regulator

With the current usb stack in u-boot, all host ports on puma work
flawlessly without any additional special handling, so drop that
usb hub hacking from the puma board.

Tested with mass-storage and usb-ethernet on both usb3 and usb2 ports.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agorockchip: puma: remove separate fit generator
Heiko Stuebner [Fri, 5 Jun 2020 10:06:41 +0000 (12:06 +0200)]
rockchip: puma: remove separate fit generator

The introduction of the puma-specific generator was mainly a way
to split the pmu firmware from the ATF binary and not having to
distribute that 4GB (sparse) image that was created before moving
to the bl31.elf as base.

Looking at the publically available repository for that separate
pmu firmware
    https://git.theobroma-systems.com/rk3399-cortex-m0.git/
there is also no activity for 3 years and apart from some build
customizations no other changes were done.

And even then, if changes need to be made, this can very well also
happen in the atf context itself, so there is no real need to
diverge from the established build procedure and we can just go
back to using the main make_fit_atf.py script.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: puma: reorganize devicetrees to actually work and match upstream
Heiko Stuebner [Fri, 5 Jun 2020 10:06:40 +0000 (12:06 +0200)]
rockchip: puma: reorganize devicetrees to actually work and match upstream

So far the puma dts files only just included the main puma dtsi without
handling the actual baseboard and rk3399-puma.dtsi was very much
detached from the variant in the mainline Linux kernel.

Recent changes resulted in a strange situation with nonworking puma boards.

Commit ab800e5a6f28 ("arm: dts: rockchip: puma: move U-Boot specific bits to u-boot.dtsi")
moved the sdram include from rk3399-puma-ddrX.dts to new files
rk3399-puma-ddrx-u-boot.dtsi which were never included anywhere though.

Commit 167efc2c7a46 ("arm64: dts: rk3399: Sync v5.7-rc1 from Linux")
replaced the rk3399-puma.dtsi nearly completely, but in the kernel
it definitly depends on a baseboard dts to actually enable peripherals
like sd-slot, uarts, etc.

So to untagle this and bring the whole thing more in line with mainline
Linux, bring the rk3399-puma-haikou.dts over as well, drop the separate
DDR-option devicetrees and instead replace them with a puma Kconfig option
to select and include the needed DDR variant.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: puma: fix indentation of misc_init_r
Heiko Stuebner [Fri, 5 Jun 2020 10:06:39 +0000 (12:06 +0200)]
rockchip: puma: fix indentation of misc_init_r

The commit moving puma to the generic cpuid/macaddr helpers used 7 spaces
as indentation, so correct that by moving to the required tabs.

Fixes: fa177ff0208b ("board: puma: Use rockchip_* helpers to setup cpuid and macaddr")
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: puma: fix indentation for -u-boot.dtsi
Heiko Stuebner [Fri, 5 Jun 2020 10:06:38 +0000 (12:06 +0200)]
rockchip: puma: fix indentation for -u-boot.dtsi

Tabs not spaces, so transform it to the common styling.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm64: dts: rk3399-puma: fix gpio levels for vcc5v0-host regulator
Heiko Stuebner [Fri, 5 Jun 2020 10:06:37 +0000 (12:06 +0200)]
arm64: dts: rk3399-puma: fix gpio levels for vcc5v0-host regulator

The regulator enable-gpio uses opposite values for the declaration
vs. the enable_active_low property, breaking the regulator enablement.

Make the usbhost-supply work again by bringing them in sync again.

This mimics the upstream Linux change found on:
http://lore.kernel.org/r/20200604091239.424318-1-heiko@sntech.de

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agoarm64: dts: rk3399-puma: fix gpio levels for gmac reset pin
Heiko Stuebner [Fri, 5 Jun 2020 10:06:36 +0000 (12:06 +0200)]
arm64: dts: rk3399-puma: fix gpio levels for gmac reset pin

The gmac reset has opposite values for the gpio declaration
and the separate reset-active, bring this in line to make
u-boot also find the ethernet-phy.

This mimics the upstream Linux commit found on
https://lore.kernel.org/r/20200603132836.362519-1-heiko@sntech.de

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rockpro64: add SPI boot
Marcin Juszkiewicz [Wed, 3 Jun 2020 15:15:13 +0000 (17:15 +0200)]
rockchip: rockpro64: add SPI boot

U-Boot TPL 2020.07-rc3-00121-gab88251130 (Jun 03 2020 - 16:43:42)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
256B stride
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.07-rc3-00121-gab88251130 (Jun 03 2020 - 16:43:42 +0200)
Trying to boot from SPI

U-Boot 2020.07-rc3-00121-gab88251130 (Jun 03 2020 - 16:43:42 +0200)

SoC: Rockchip rk3399
Reset cause: RST
Model: Pine64 RockPro64 v2.1
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from SPI Flash... SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Model: Pine64 RockPro64 v2.1
Net:   eth0: ethernet@fe300000
Hit any key to stop autoboot:  0
=>

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rockpro64: Store default env into SPI
Marcin Juszkiewicz [Wed, 3 Jun 2020 15:15:12 +0000 (17:15 +0200)]
rockchip: rockpro64: Store default env into SPI

Board has flash chip on board so let store U-Boot environment there.

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodoc: rockchip: Document SPI flash program steps
Jagan Teki [Thu, 4 Jun 2020 14:51:41 +0000 (20:21 +0530)]
doc: rockchip: Document SPI flash program steps

Document SPI flash program steps for rockchip platforms.

Suggested-by: Hugh Cole-Baker <sigmaris@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoroc-rk3399-pc: Add SPI boot
Jagan Teki [Thu, 4 Jun 2020 14:51:40 +0000 (20:21 +0530)]
roc-rk3399-pc: Add SPI boot

U-Boot TPL 2020.07-rc3-00090-gd4e919f927-dirty (Jun 01 2020 - 23:45:53)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.07-rc3-00087-ga21e9fd385 (Jun 02 2020 - 00:09:45 +0530)
Trying to boot from MMC1
NOTICE:  BL31: v2.2(release):
NOTICE:  BL31: Built : 15:05:37, May 12 2020

U-Boot 2020.07-rc3-00087-ga21e9fd385 (Jun 02 2020 - 00:09:45 +0530)

SoC: Rockchip rk3399
Reset cause: POR
Model: Firefly ROC-RK3399-PC Board
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   mmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from SPI Flash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Firefly ROC-RK3399-PC Board

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoroc-rk3399-pc: Mark default env from SPI
Jagan Teki [Thu, 4 Jun 2020 14:51:39 +0000 (20:21 +0530)]
roc-rk3399-pc: Mark default env from SPI

Mark the default U-Boot environment as SPI flash since
this is an on board flash device.

Updated env offset, size in contrast with default since
the U-Boot proper has to start from 384K.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoMakefile: Drop to handle rkspi image type
Jagan Teki [Thu, 4 Jun 2020 14:51:38 +0000 (20:21 +0530)]
Makefile: Drop to handle rkspi image type

On rockchip platforms, SPI boot image creation is not
straightforward like MMC boot image creation where former
requires to specify tpl, spl in multimage format in mkimage,
and later simply do a concatenate mkimaged-tpl with spl.

On this note, let drop rkspi image type creation via kbuild
and let inform via rockchip.rst

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399-evb: add stdout-path for the board
Kever Yang [Wed, 3 Jun 2020 07:25:28 +0000 (15:25 +0800)]
rockchip: rk3399-evb: add stdout-path for the board

The 'stdout-path' is missing after dts sync.
Fixes: 167efc2c7a ("arm64: dts: rk3399: Sync v5.7-rc1 from Linux")

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3328: add rock-pi-e-rk3328_defconfig file
b.l.huang [Sun, 31 May 2020 16:02:11 +0000 (00:02 +0800)]
rockchip: rk3328: add rock-pi-e-rk3328_defconfig file

This commit add the default configuration file and relevant description
for rock-pi-e board

Signed-off-by: Banglang Huang <banglang.huang@foxmail.com>
4 years agorockchip: rk3328: add rock-pi-e dts file
b.l.huang [Sun, 31 May 2020 16:01:28 +0000 (00:01 +0800)]
rockchip: rk3328: add rock-pi-e dts file

The ROCK-PI-E is a credit card size SBC based on Rockchip RK3328
Quad-Core ARM Cortex A53.

    Net - Dual ethernet port, 1 X Gbe, 1 X 100M
    USB - USB 3.0
    DC  - USB-Type C, 5V 2A
    Storage - TF card, eMMC

Just build idbloader.img and u-boot.itb for Rockpi E board and
follow the blow steps to replace the relevant partition.

    dd if=idbloader.img of=/dev/sdcard seek=64 conv=notrunc
    dd if=u-boot.itb of=/dev/sdcard seek=16384 conv=notrunc

Signed-off-by: Banglang Huang <banglang.huang@foxmail.com>