platform/kernel/u-boot.git
3 years agoARM: imx: add i.MX8MN lpddr4 image cfg file
Marek Vasut [Sat, 16 Jan 2021 23:17:21 +0000 (00:17 +0100)]
ARM: imx: add i.MX8MN lpddr4 image cfg file

Add cfg file for i.MX8MN LPDDR4

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoimx: Add support for i.MX8MN Beacon EmbeddedWorks devkit.
Adam Ford [Fri, 11 Dec 2020 12:01:46 +0000 (06:01 -0600)]
imx: Add support for i.MX8MN Beacon EmbeddedWorks devkit.

Beacon EmbeddedWorks is releasing a devkit based on the i.MX8M
Nano SoC consisting of baseboard + SOM.

The kit is based on the same design as the Beacon dev kit with
the i.MX8M Mini.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dart6ul: fix ddr size macro
Marc Ferland [Mon, 4 Jan 2021 19:07:53 +0000 (14:07 -0500)]
arm: dart6ul: fix ddr size macro

The previous macro was off by one bit and so we were getting a ddr
size which was twice the real size. This commit refactors the macro so
it returns the right size in _bytes_ and modifies the printf call so the
size is still printed in MiB.

Signed-off-by: Marc Ferland <ferlandm@amotus.ca>
3 years agospi: imx: Use clock framework if enabled
Marek Vasut [Mon, 18 Jan 2021 23:58:33 +0000 (00:58 +0100)]
spi: imx: Use clock framework if enabled

In case the clock framework is enabled, enable the SPI controller clock
and obtain max frequency from the clock framework.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agospi: imx: Define register bits in the driver
Marek Vasut [Mon, 18 Jan 2021 23:58:32 +0000 (00:58 +0100)]
spi: imx: Define register bits in the driver

The CSPI/ECSPI register bits do not differ between newer SoCs, instead
of having multiple copies of the same thing for each iMX SoC, define
the bits in the driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoclk: imx: Add ECSPI to iMX8MN
Marek Vasut [Mon, 18 Jan 2021 23:58:31 +0000 (00:58 +0100)]
clk: imx: Add ECSPI to iMX8MN

Add ECSPI clock entries to iMX8MN clock driver. Only make those entries
available in case SPI support in U-Boot is enabled at all to conserve
space, esp. in SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm64: dts: imx8mm-beacon: Resync imx8mm-beacon-som with 5.11-rc4
Adam Ford [Mon, 18 Jan 2021 21:43:09 +0000 (15:43 -0600)]
arm64: dts: imx8mm-beacon: Resync imx8mm-beacon-som with 5.11-rc4

In order to support the QSPI chip on the SOM, the Flexspi bus
needs to be configured to talk with the SPI chip.
Resync the som device tree with 5.11-rc4

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8mm_beacon: Enable QSPI Support
Adam Ford [Mon, 18 Jan 2021 21:43:08 +0000 (15:43 -0600)]
imx8mm_beacon: Enable QSPI Support

There is a QSPI chip connected to the FSPI.  Enable the defconfig
to support it.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agospi: nxp_fspi: Enable support for nxp,imx8mm-fspi
Adam Ford [Mon, 18 Jan 2021 21:32:50 +0000 (15:32 -0600)]
spi: nxp_fspi: Enable support for nxp,imx8mm-fspi

The i.MX8M Mini can use the FlexSPI driver.  Add support
for it to the driver.

Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agommc: fsl_esdhc_imx.c: fix compiler warning
Heiko Schocher [Fri, 15 Jan 2021 09:37:09 +0000 (10:37 +0100)]
mmc: fsl_esdhc_imx.c: fix compiler warning

prevent unsued variable compiler warning if
DM_REGULATOR is not set.

Signed-off-by: Heiko Schocher <hs@denx.de>
3 years agoimx8mq: configs: add support for distro boot commands
Alice Guo [Thu, 14 Jan 2021 08:23:23 +0000 (16:23 +0800)]
imx8mq: configs: add support for distro boot commands

Supported boot device types in iMX8MQ: MMC, DHCP.

CONFIG_DISTRO_DEFAULTS is added for enabling the DISTRO_DEFAULTS option.

CONFIG_BOOTCOMMAND which is defined in include/configs/imx8mq_evk.h is
deleted because "run distro_bootcmd" is required to be the default boot
mode.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution.

kernel_addr_r is the location in RAM where the kernel will be loaded to.

Delete unnecessary environment variables because "run distro_bootcmd" is
set to be the default boot mode.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoARM: imx6: dh-imx6: Move bootcounter to SNVS_LPGDR
Marek Vasut [Wed, 13 Jan 2021 23:21:22 +0000 (00:21 +0100)]
ARM: imx6: dh-imx6: Move bootcounter to SNVS_LPGDR

Move the bootcounter to SVNS_LPGDR to free up OCRAM for usage by the VPU.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoboard: phytec: imx8mp: Add PHYTEC phyCORE-i.MX8MP support
Teresa Remmet [Wed, 13 Jan 2021 15:28:09 +0000 (16:28 +0100)]
board: phytec: imx8mp: Add PHYTEC phyCORE-i.MX8MP support

Add initial support PHYTEC phyCORE-i.MX8MP SOM.

    Supported features:
     - 2GB LPDDR4 RAM
     - eMMC
     - external SD
     - debug UART2
     - watchdog

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agow1: mxc: fix build
Martin Fuzzey [Wed, 13 Jan 2021 10:21:03 +0000 (11:21 +0100)]
w1: mxc: fix build

Now that header files no longer include common.h it must be included
first.

Otherwise the build fails with errors like
include/asm/arch/clock.h:43:1: error: unknown type name 'u32'
 u32 imx_get_uartclk(void);

Fixes: c3dc39a2f85b ("arm: Don't include common.h in header files")

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: dart6ul: enable DM_ETH for the dart6ul
Marc Ferland [Mon, 4 Jan 2021 15:41:57 +0000 (10:41 -0500)]
arm: dart6ul: enable DM_ETH for the dart6ul

This patch converts the dart6ul ethernet support to DM_ETH and cleans
up the legacy ethernet code. The clean up, more specifically:

* moves the fec2 node and pin definition to the carrier board DTS
  since the phy associated with it is on the carrier board and not on
  the SoM;
* add the reset pin associated to each phy;
* separate the ethernet, mdio and reset pins of each fec so that they
  are easier to reference;
* add clock properties to the phy nodes since they are connected to the
  50Mhz ENET[12]_TX_CLK clock of the SoC;
* remove CONFIG_BOARD_EARLY_INIT_F since the function is now empty.

Signed-off-by: Marc Ferland <ferlandm@amotus.ca>
3 years agoimx: imx8mm-beacon: Remove relocation restrictions
Adam Ford [Wed, 30 Dec 2020 15:15:43 +0000 (09:15 -0600)]
imx: imx8mm-beacon: Remove relocation restrictions

The system is capable of relocating RAM disks and the kernel.
Remove these restrictions to prevent it.

Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agoimx8mm_beacon: Enable fixed regulator in SPL
Adam Ford [Wed, 30 Dec 2020 14:14:19 +0000 (08:14 -0600)]
imx8mm_beacon: Enable fixed regulator in SPL

Because SPL can support SD UHS, the fixed regulator needs to be
enabled in SPL to reset the SD card.

Fixes: 1a5d9c84b472 ("imx8mm_beacon: Enable HS400 on MMC controller")
Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agomx6ul(l)evk: Enable DM_ETH_PHY
Sean Anderson [Mon, 28 Dec 2020 19:58:30 +0000 (14:58 -0500)]
mx6ul(l)evk: Enable DM_ETH_PHY

This fixes eth0 not initializing properly. Both eth0 and eth1 use the
MDIO interface on eth1 to access their PHYs. However, without
DM_ETH_PHY, eth0 still tries to use its own MDIO interface to access its
phy. Before this patch, a boot log might contain lines like

Net:
Warning: ethernet@20b4000 using MAC address from ROM
eth1: ethernet@20b4000 [PRIME]Could not get PHY for FEC0: addr 2

After this patch they now look like

Net:
Warning: ethernet@20b4000 using MAC address from ROM
eth1: ethernet@20b4000 [PRIME]Get shared mii bus on ethernet@2188000

Warning: ethernet@2188000 using MAC address from ROM
, eth0: ethernet@2188000

As an alternative to DM_ETH_PHY, FEC_MXC_SHARE_MDIO could also have been
used to achieve the same effect.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoboard: imx8mp: add boot.cmd for distro boot on iMX8MP
Alice Guo [Fri, 18 Dec 2020 07:19:27 +0000 (15:19 +0800)]
board: imx8mp: add boot.cmd for distro boot on iMX8MP

Distro Boot requires a U-Boot-specific script named boot.scr or
boot.scr.uimg which contains boot commands to boot the system. The
boot.cmd is such a file. Use mkimage to generate boot.scr or
boot.scr.uimg from boot.cmd, and the command is:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr.uimg

The boot.cmd file is an example script and can be modified based on
needs. bootargs is set in this script and root uses the default value
"/dev/mmcblk1p2 rootwait rw" which can be changed by overriding mmcroot.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx8mp: configs: add support for distro boot commands
Alice Guo [Fri, 18 Dec 2020 07:19:26 +0000 (15:19 +0800)]
imx8mp: configs: add support for distro boot commands

Supported boot device types in iMX8MP: MMC.

CONFIG_CMD_PART is added for command part and CONFIG_CMD_FS_GENERIC is
for command fstype.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution. kernel_addr_r is the location in RAM where
the kernel will be loaded to. Delete unnecessary environment variables
because "run distro_bootcmd" is set to be the default boot mode.

On the iMX8MP platform I used, "mmc1" represents SD card and "mmc2"
represents eMMC.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoboard: imx8mm: add boot.cmd for distro boot on iMX8MM
Alice Guo [Fri, 18 Dec 2020 06:50:08 +0000 (14:50 +0800)]
board: imx8mm: add boot.cmd for distro boot on iMX8MM

Distro Boot requires a U-Boot-specific script named boot.scr or
boot.scr.uimg which contains boot commands to boot the system. The
boot.cmd is such a file. Use mkimage to generate boot.scr or
boot.scr.uimg from boot.cmd, and the command is:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr.uimg

The boot.cmd file is an example script and can be modified based on
needs. bootargs is set in this script and root uses the default value "
/dev/mmcblk1p2 rootwait rw" which can be changed by overriding mmcroot.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx8mm: configs: add support for distro boot commands
Alice Guo [Fri, 18 Dec 2020 06:50:07 +0000 (14:50 +0800)]
imx8mm: configs: add support for distro boot commands

Supported boot device types in iMX8MM: MMC, DHCP.

CONFIG_CMD_PART is added for command part and CONFIG_CMD_FS_GENERIC is
for command fstype.

CONFIG_BOOTCOMMAND which is defined in include/configs/imx8mm_evk.h is
deleted because "run distro_bootcmd" is required to be the default boot
mode.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution.

kernel_addr_r is the location in RAM where the kernel will be loaded to.

Delete unnecessary environment variables.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx: timer: Modify GPT timer driver for mx7
Ye Li [Fri, 23 Mar 2018 06:45:26 +0000 (23:45 -0700)]
imx: timer: Modify GPT timer driver for mx7

Modify the GPT common platform driver for mx7 which only use 24Mhz
OSC as clock source.

Note: at default, the mx7d will use system counter as timer. The GPT
is disabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: add QSPI boot dev
Peng Fan [Thu, 17 May 2018 07:15:59 +0000 (15:15 +0800)]
imx8m: add QSPI boot dev

When boot type could not be detected from rom sw info,
read sbmr1 to detect, here we only use it to detect FLEXSPI
boot, because ROM not update it in rom sw info.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx6: Remove AHCI device before boot OS
Ye Li [Tue, 23 Jul 2019 03:51:25 +0000 (20:51 -0700)]
imx6: Remove AHCI device before boot OS

Since we remove SATA device before boot OS, when AHCI is enabled, update
the codes to remove AHCI device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: Fix market segment fuse offset on iMX8MP
Ye Li [Tue, 10 Mar 2020 06:11:54 +0000 (23:11 -0700)]
imx: Fix market segment fuse offset on iMX8MP

iMX8MP has shifted market segment fuse one bit from 0x440 [7:6] to [6:5],
correct it in imx common codes.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agonandbcb: nand support for i.MX8MP
Han Xu [Sat, 10 Oct 2020 13:48:49 +0000 (08:48 -0500)]
nandbcb: nand support for i.MX8MP

Add NAND boot support for i.MX8MP by adding i.MX8MP in nandbcb support
list, reading boot_search_count from fuse.

i.MX8MN NAND boot is same as i.MX8MP, fix some issues as well.

Signed-off-by: Han Xu <han.xu@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix potential overflow in nandbcb_set_boot_config
Ye Li [Mon, 3 Aug 2020 06:07:55 +0000 (23:07 -0700)]
imx: nandbcb: Fix potential overflow in nandbcb_set_boot_config

Fix Coverity Issue 9006656. In nandbcb_set_boot_config, an integer overflow
occurs, with the result converted to a wider integer type.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix potential overflow in fill_dbbt_data
Ye Li [Mon, 3 Aug 2020 05:59:43 +0000 (22:59 -0700)]
imx: nandbcb: Fix potential overflow in fill_dbbt_data

Fix Coverity Issue 9006658. In fill_dbbt_data, an integer overflow occurs,
with the result converted to a wider integer type

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix resource leak in read_fcb
Ye Li [Mon, 3 Aug 2020 05:43:45 +0000 (22:43 -0700)]
imx: nandbcb: Fix resource leak in read_fcb

Fix Coverity Issue 9006657. In read_fcb, leak of memory to system
resource "fcb_raw_page". Adjust the sequence to check the mtd bad
block prior than allocation of "fcb_raw_page", also check the NULL
return of allocation.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix resource leak
Ye Li [Mon, 3 Aug 2020 04:11:06 +0000 (21:11 -0700)]
imx: nandbcb: Fix resource leak

Fix Coverity Issue 9006655. In write_fcb, leak of memory to resource
"fcb_raw_page". Since we have initialized the "ret" to 0, should return
the value of ret.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agonandbcb: Fix uninitialized variable
Ye Li [Mon, 3 Aug 2020 03:55:17 +0000 (20:55 -0700)]
nandbcb: Fix uninitialized variable

Fix Coverity Issue 9006654. In write_fcb, use of an uninitialized
variable "ret".

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn/p: drop CONFIG_SYS_[I,D]CACHE_OFF
Peng Fan [Wed, 13 Jan 2021 02:56:36 +0000 (10:56 +0800)]
imx: imx8mn/p: drop CONFIG_SYS_[I,D]CACHE_OFF

Drop CONFIG_SYS_[I,D]CACHE_OFF, it is safe to run with caches enabled on
these platforms.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: lowlevel_init: tune alignment
Peng Fan [Sun, 27 Dec 2020 13:07:08 +0000 (21:07 +0800)]
imx8m: lowlevel_init: tune alignment

The minimum alignment is 16 bytes, so use align 4 is enough.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mq: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 08:11:56 +0000 (16:11 +0800)]
arm: dts: imx8mq: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mm: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 06:18:13 +0000 (14:18 +0800)]
arm: dts: imx8mm: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mp: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 03:22:52 +0000 (11:22 +0800)]
arm: dts: imx8mp: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: clock: add type of set_clk_eqos
Peng Fan [Sun, 27 Dec 2020 03:18:59 +0000 (11:18 +0800)]
imx8m: clock: add type of set_clk_eqos

Add type of set_clk_eqos to make it could be used by other files.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mn: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 01:37:06 +0000 (09:37 +0800)]
arm: dts: imx8mn: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn_evk: correct stack/malloc adress
Peng Fan [Sat, 26 Dec 2020 11:35:42 +0000 (19:35 +0800)]
imx: imx8mn_evk: correct stack/malloc adress

Move SP to end of OCRAM space. Drop MALLOC_F to make it alloc from
stack space.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: ddr: imx8m: Move selfref_en after DDR scrub
Ye Li [Wed, 30 Sep 2020 04:55:32 +0000 (21:55 -0700)]
imx: ddr: imx8m: Move selfref_en after DDR scrub

When doing DDR scrub, the DDR may enter into self refresh if the
selfref_en is enabled before DDR scrub. This will cause scrub
can't complete that SBRSTAT.scrub_done won't be set.

Since the selfref_en can be programmed during the course of
normal operation, move it after DDR scrub

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn_ddr4_evk: Use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board
Peng Fan [Fri, 25 Dec 2020 08:23:12 +0000 (16:23 +0800)]
imx: imx8mn_ddr4_evk: Use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board

use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board, we will use
CONFIG_TARGET_IMX8MN_EVK for LPDDR4 EVK board.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mp_evk: enable eth support
Peng Fan [Fri, 25 Dec 2020 08:16:34 +0000 (16:16 +0800)]
imx: imx8mp_evk: enable eth support

Add board code to configure the network interface
Add net defconfig

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoMerge tag 'u-boot-rockchip-20210121' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 21 Jan 2021 12:39:47 +0000 (07:39 -0500)]
Merge tag 'u-boot-rockchip-20210121' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- New board: rk3328 NanoPi R2S board;
- Fix init voltage for some rk3399 boards;
- enable rng for rk3399 by default;
- set default to SPI bus 1 for SPI-flash for some board;
- add dwc PCIe controller driver on rockchip platform;

3 years agopci: Add Rockchip dwc based PCIe controller driver
Shawn Lin [Fri, 15 Jan 2021 10:01:22 +0000 (18:01 +0800)]
pci: Add Rockchip dwc based PCIe controller driver

Add Rockchip dwc based PCIe controller driver for rk356x platform.
Driver support Gen3 by operating as a Root complex.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agophy: rockchip: Add Rockchip Synopsys PCIe 3.0 PHY
Shawn Lin [Fri, 15 Jan 2021 10:01:21 +0000 (18:01 +0800)]
phy: rockchip: Add Rockchip Synopsys PCIe 3.0 PHY

Add the Rockchip Synopsys based PCIe 3.0 PHY driver as
part of Generic PHY framework.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: rk3328: Add support for FriendlyARM NanoPi R2S
David Bauer [Wed, 6 Jan 2021 23:06:11 +0000 (00:06 +0100)]
rockchip: rk3328: Add support for FriendlyARM NanoPi R2S

This adds support for the NanoPi R2S from FriendlyArm.

Rockchip RK3328 SoC
1GB DDR4 RAM
Gigabit Ethernet (WAN)
Gigabit Ethernet (USB3) (LAN)
USB 2.0 Host Port
MicroSD slot
Reset button
WAN - LAN - SYS LED

Signed-off-by: David Bauer <mail@david-bauer.net>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoconfigs: rk3399: enable rng on firefly/rock960/rockpro64
Peter Robinson [Wed, 16 Dec 2020 15:48:43 +0000 (15:48 +0000)]
configs: rk3399: enable rng on firefly/rock960/rockpro64

Enable the RNG on the Firefly, rock960 and RockPro64 devices
to enable KASLR on devices that support it.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Akash Gajjar <akash@openedev.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoarm: dts: rockchip: rk3399: enable rng at the SoC level
Peter Robinson [Wed, 16 Dec 2020 15:48:42 +0000 (15:48 +0000)]
arm: dts: rockchip: rk3399: enable rng at the SoC level

The rng is embedded in the SoC so enable it in the device tree
universally, the use of it can be controlled by enabling/disabling
at the device config level.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: leez-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:53 +0000 (10:52 +0800)]
rockchip: leez-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_log regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: firefly-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:52 +0000 (10:52 +0800)]
rockchip: firefly-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_log regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: evb-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:51 +0000 (10:52 +0800)]
rockchip: evb-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_center regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: puma-haikou: default to SPI bus 1 for SPI-flash
Hugh Cole-Baker [Sun, 22 Nov 2020 13:03:46 +0000 (13:03 +0000)]
rockchip: puma-haikou: default to SPI bus 1 for SPI-flash

SPI flash on this machine is located on bus 1, default to using bus 1
for SPI flash and stop aliasing it to bus 0. Formerly the alias spi1
pointed to &spi5, use an alias spi5 for this instead.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: rk3399-roc-pc: default to SPI bus 1 for SPI-flash
Hugh Cole-Baker [Sun, 22 Nov 2020 13:03:45 +0000 (13:03 +0000)]
rockchip: rk3399-roc-pc: default to SPI bus 1 for SPI-flash

SPI flash on this board is located on bus 1, default to using bus 1 for
SPI flash on both rk3399-roc-pc and -mezzanine, and stop aliasing it to
bus 0.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Fixes: c4cea2bb ("rockchip: Enable building a SPI ROM image on bob")
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoMerge branch '2021-01-20-fs-fixes'
Tom Rini [Wed, 20 Jan 2021 21:45:21 +0000 (16:45 -0500)]
Merge branch '2021-01-20-fs-fixes'

- Minor SquashFS, BTRFS ubifs fixes

3 years agoubifs: do not decide upon uninitialized variable
Heinrich Schuchardt [Fri, 25 Dec 2020 14:19:39 +0000 (15:19 +0100)]
ubifs: do not decide upon uninitialized variable

Before 'if (err)' we have to initialize the variable otherwise we use a
random value from the stack.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: simplify close_ctree_fs_info()
Heinrich Schuchardt [Fri, 25 Dec 2020 12:45:25 +0000 (13:45 +0100)]
fs: btrfs: simplify close_ctree_fs_info()

At the beginning of close_ctree_fs_info() the value 0 is assigned to err
and never changed before testing it.

Let's get rid of the superfluous variable.

Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
3 years agoFix squashfs failing to load sparse files
Campbell Suter [Mon, 23 Nov 2020 02:40:03 +0000 (15:40 +1300)]
Fix squashfs failing to load sparse files

SquashFS supports sprase blocks in files - that is, if a given block is
composed only of zeros, it's not written to the output file to save
space and it's on-disk length field is set to zero to indicate that.

Previously the squashfs driver did not recognise that, and would attempt
to read and decompress a zero-sized block, which obviously failed.

The following command may be used to create a file for testing:

cat <(dd if=/dev/urandom of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/zero of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/urandom of=/dev/stdout bs=1k count=200) >test_file

Signed-off-by: Campbell Suter <campbell@snapit.group>
3 years agofs: btrfs: volumes: prevent overflow for multiplying
Qu Wenruo [Sat, 31 Oct 2020 01:07:50 +0000 (09:07 +0800)]
fs: btrfs: volumes: prevent overflow for multiplying

In __btrfs_map_block() we do a int * int and assign it to u64.
This is not safe as the result (int * int) is still evaluated as (int)
thus it can overflow.

Convert one of the multiplier to u64 to prevent such problem.

In real world, this should not cause problem as we have device number
limit thus it won't go beyond 4G for a single stripe.

But it's harder to teach coverity about all these hidden limits, so just
fix the possible overflow.

Reported-by: Coverity CID 312957
Reported-by: Coverity CID 312948
Signed-off-by: Qu Wenruo <wqu@suse.com>
3 years agoMerge tag 'efi-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 20 Jan 2021 15:49:23 +0000 (10:49 -0500)]
Merge tag 'efi-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-2

* Provide a test tool for initial RAM disk provided via load file2 protocol.
* Make more items configurable to reduce code size:
  * Boot manager
  * EFI_DT_FIXUP_PROTOCOL
  * EFI_DEVICE_PATH_UTILITIES_PROTOCOL
* Bug fixes
  * avoid EFI runtime symbols in global symbol table

3 years agoMerge tag 'xilinx-for-v2021.04-v2' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 20 Jan 2021 15:49:05 +0000 (10:49 -0500)]
Merge tag 'xilinx-for-v2021.04-v2' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.04-v2

env:
- Unlock redundant variable configuration for all

xilinx:
- Enable seps525 by default
- Export bootseq via variable
- Update board_fdt_blob_setup()

mmc:
- Xenon macro removal

3 years agoenv: Remove all dependencies for SYS_REDUNDAND_ENVIRONMENT
Michal Simek [Wed, 13 Jan 2021 09:25:50 +0000 (10:25 +0100)]
env: Remove all dependencies for SYS_REDUNDAND_ENVIRONMENT

CONFIG_SYS_REDUNDAND_ENVIRONMENT is changing in env_internal.h how u-boot
works with variables. struct environment_s has one byte flags property
which also affects ENV_SIZE macro.

I have reached the case where CONFIG_ENV_IS_NOWHERE is default setup
but custom scripts can be designed in a way that u-boot is asked to
import/export variables from/to file which can be in certain format.
That's why also for this configuration make sense to enable
CONFIG_SYS_REDUNDAND_ENVIRONMENT because it depends on environment file
format.

The patch is removing dependency on this configuration to support selecting
environment file format without any specific dependency where variables are
stored.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoxilinx: common: Do not touch CONFIG_XILINX_OF_BOARD_DTB_ADDR in SPL
Michal Simek [Mon, 4 Jan 2021 10:07:28 +0000 (11:07 +0100)]
xilinx: common: Do not touch CONFIG_XILINX_OF_BOARD_DTB_ADDR in SPL

This hook is used in full U-Boot that's why there is no reason to touch
this location from SPL. The hook was introduced for QEMU usage but none is
really running SPL on QEMU that's why it shouldn't break any usecase.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: common: Change macro handling in board_fdt_blob_setup()
Michal Simek [Mon, 4 Jan 2021 10:03:36 +0000 (11:03 +0100)]
xilinx: common: Change macro handling in board_fdt_blob_setup()

Remove ifdef logic which is handled by preprocessor and move it link time
optimization to get full compile code coverage.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: Save bootseq number for SD/EMMC boot modes
Michal Simek [Mon, 11 Jan 2021 12:46:58 +0000 (13:46 +0100)]
xilinx: zynqmp: Save bootseq number for SD/EMMC boot modes

For systems which has both sdhci controllers enable it is worth to export
bootseq number for variables. Then the variable can be used in custom
scripts to tune logic for OS.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agommc: xenon_sdhci: Remove duplicated macros
Michal Simek [Tue, 5 Jan 2021 13:27:45 +0000 (14:27 +0100)]
mmc: xenon_sdhci: Remove duplicated macros

There is no need to define the same macros in drivers.
All macros have been added by commit 17a42abb40dd ("mmc: Define timing
macro's").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoarm64: zynqmp: Enable seps and related video configs
Michal Simek [Thu, 7 Jan 2021 13:05:23 +0000 (14:05 +0100)]
arm64: zynqmp: Enable seps and related video configs

Enable this driver to get build and probe for our platform.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
3 years agoefi_loader: Avoid emitting efi_var_buf to .GOT
Ilias Apalodimas [Sat, 16 Jan 2021 15:28:04 +0000 (17:28 +0200)]
efi_loader: Avoid emitting efi_var_buf to .GOT

Atish reports that on RISC-V, accessing the EFI variables causes
a kernel panic. An objdump of the file verifies that, since the
global pointer for efi_var_buf ends up in .GOT section which is
not mapped in virtual address space for Linux.

<snip of efi_var_mem_find>

0000000000000084 <efi_var_mem_find>:
  84:   715d                    addi    sp,sp,-80

* objdump -dr
0000000000000086 <.LCFI2>:
  86:   e0a2                    sd  s0,64(sp)
  88:   fc26                    sd  s1,56(sp)
  8a:   e486                    sd  ra,72(sp)
  8c:   f84a                    sd  s2,48(sp)
  8e:   f44e                    sd  s3,40(sp)
  90:   f052                    sd  s4,32(sp)
  92:   ec56                    sd  s5,24(sp)
  94:   00000497            auipc   s1,0x0
            94: R_RISCV_GOT_HI20    efi_var_buf
  98:   0004b483            ld  s1,0(s1) # 94 <.LCFI2+0xe>
            98: R_RISCV_PCREL_LO12_I    .L0
            98: R_RISCV_RELAX   *ABS*

* objdump -t
0000000000000084 g     F .text.efi_runtime  00000000000000b8 efi_var_mem_find

With the patch applied:

* objdump -dr
0000000000000086 <.LCFI2>:
  86:   e0a2                    sd  s0,64(sp)
  88:   fc26                    sd  s1,56(sp)
  8a:   e486                    sd  ra,72(sp)
  8c:   f84a                    sd  s2,48(sp)
  8e:   f44e                    sd  s3,40(sp)
  90:   f052                    sd  s4,32(sp)
  92:   ec56                    sd  s5,24(sp)
  94:   00000497            auipc   s1,0x0
            94: R_RISCV_PCREL_HI20  .LANCHOR0
            94: R_RISCV_RELAX   *ABS*
  98:   00048493            mv  s1,s1
            98: R_RISCV_PCREL_LO12_I    .L0
            98: R_RISCV_RELAX   *ABS*

* objdump -t
0000000000000008 l     O .data.efi_runtime  0000000000000008 efi_var_buf

On arm64 this works, because there's no .GOT entries for this
and everything is converted to relative references.

* objdump -dr (identical pre-post patch, only the new function shows up)
00000000000000b4 <efi_var_mem_find>:
  b4:   aa0003ee    mov x14, x0
  b8:   9000000a    adrp    x10, 0 <efi_var_mem_compare>
            b8: R_AARCH64_ADR_PREL_PG_HI21  .data.efi_runtime
  bc:   91000140    add x0, x10, #0x0
            bc: R_AARCH64_ADD_ABS_LO12_NC   .data.efi_runtime
  c0:   aa0103ed    mov x13, x1
  c4:   79400021    ldrh    w1, [x1]
  c8:   aa0203eb    mov x11, x2
  cc:   f9400400    ldr x0, [x0, #8]
  d0:   b940100c    ldr w12, [x0, #16]
  d4:   8b0c000c    add x12, x0, x12

So let's switch efi_var_buf to static and create a helper function for
anyone that needs to update it.

Fixes: e01aed47d6a0 ("efi_loader: Enable run-time variable support for tee based variables")
Reported-by: Atish Patra <atishp@atishpatra.org>
Tested-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: efi_size_in_pages() missing parentheses
Heinrich Schuchardt [Sun, 17 Jan 2021 06:52:09 +0000 (07:52 +0100)]
efi_loader: efi_size_in_pages() missing parentheses

Add parentheses around size to avoid possible operator precedence problems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: use CRLF as line endings in dtbdump
Heinrich Schuchardt [Tue, 19 Jan 2021 09:06:00 +0000 (10:06 +0100)]
efi_selftest: use CRLF as line endings in dtbdump

EFI applications must use CR LF as line endings.

Provide a print() function to reduce code size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: provide initrddump test tool
Heinrich Schuchardt [Sun, 17 Jan 2021 06:30:26 +0000 (07:30 +0100)]
efi_selftest: provide initrddump test tool

Provide an UEFI application to save the initial RAM disk provided by U-Boot
via the Load File2 protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_selftest: don't compile dtbdump if GENERATE_ACPI_TABLE
Heinrich Schuchardt [Sun, 17 Jan 2021 04:41:41 +0000 (05:41 +0100)]
efi_selftest: don't compile dtbdump if GENERATE_ACPI_TABLE

If we are using ACPI tables instead of a device tree, we don't need the
dtbdump.efi test tool.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: ask before overwriting in dtbdump.efi
Heinrich Schuchardt [Sun, 17 Jan 2021 04:13:21 +0000 (05:13 +0100)]
efi_selftest: ask before overwriting in dtbdump.efi

Before overwriting an existing file ask the user.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: remove EFI_UNICODE_COLLATION_PROTOCOL
Heinrich Schuchardt [Sat, 16 Jan 2021 08:58:06 +0000 (09:58 +0100)]
efi_loader: remove EFI_UNICODE_COLLATION_PROTOCOL

In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2
language codes existed. This protocol is not part of the UEFI specification
any longer. It was however required to run the UEFI Self Certification Test
(SCT) II, version 2.6, 2017. So we implemented it for the sole purpose of
running the SCT.

As the SCT does not need the protocol anymore it is time for removal.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable
Heinrich Schuchardt [Sat, 16 Jan 2021 08:44:25 +0000 (09:44 +0100)]
efi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable

Allow the EFI_DEVICE_PATH_UTILITIES_PROTOCOL to be disabled via
configuration.

On systems that are very tight on U-Boot image size we may want to disable
the protocol. As it is required to run the UEFI Shell enable it by default.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make EFI_DT_FIXUP_PROTOCOL configurable
Heinrich Schuchardt [Sat, 16 Jan 2021 08:33:24 +0000 (09:33 +0100)]
efi_loader: make EFI_DT_FIXUP_PROTOCOL configurable

Allow EFI_DT_FIXUP_PROTOCOL to be disabled via configuration.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fixup protocol, avoid forward declaration
Heinrich Schuchardt [Sat, 16 Jan 2021 07:50:10 +0000 (08:50 +0100)]
efi_loader: fixup protocol, avoid forward declaration

Avoid a forward declaration.

Add a missing function description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make the UEFI boot manager configurable
Heinrich Schuchardt [Fri, 15 Jan 2021 18:02:50 +0000 (19:02 +0100)]
efi_loader: make the UEFI boot manager configurable

Some boards are very tight on the binary size. Booting via UEFI is possible
without using the boot manager.

Provide a configuration option to make the boot manager available.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoRevert "net: eth-uclass: Change uclass driver name to ethernet"
Tom Rini [Tue, 19 Jan 2021 20:35:00 +0000 (15:35 -0500)]
Revert "net: eth-uclass: Change uclass driver name to ethernet"

This reverts commit 1231184caacad32c180d7e2338a645f7dfe9571a.

While the change is fine in theory, a number of tests need to be updated
to match.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-19-networking-improvements'
Tom Rini [Tue, 19 Jan 2021 19:46:45 +0000 (14:46 -0500)]
Merge branch '2021-01-19-networking-improvements'

- e1000, ftgmac100: Add support for getting the MAC
- General networking improvements
- dwc_eth_qos, ks8851 fixes

3 years agoefi_loader: move load options to new module
Heinrich Schuchardt [Fri, 15 Jan 2021 18:02:49 +0000 (19:02 +0100)]
efi_loader: move load options to new module

Move all load options related functions to a new module. So that they can
be compiled independently.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agonet: eth-uclass: Change uclass driver name to ethernet
David Wu [Fri, 8 Jan 2021 02:53:05 +0000 (10:53 +0800)]
net: eth-uclass: Change uclass driver name to ethernet

dev_read_alias_seq() used uc_drv->name compared to alias
stem string, Ethernet's alias stem uses "ethernet", which
does not match the eth-uclass driver name "eth", can not
get the correct index of ethernet alias namer. So it seems
change uclass driver name to match the alias stem is a more
reasonable way.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: dwc_eth_qos: Pad descriptors to cacheline size
Marek Vasut [Thu, 7 Jan 2021 10:12:16 +0000 (11:12 +0100)]
net: dwc_eth_qos: Pad descriptors to cacheline size

The DWMAC4 IP has the possibility to skip up to 7 AXI bus width size words
after the descriptor. Use this to pad the descriptors to cacheline size and
remove the need for noncached memory altogether. Moreover, this lets Tegra
use the generic cache flush / invalidate operations.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agonet: ks8851: Reset internal RXFC count on bad packet
Marek Vasut [Wed, 6 Jan 2021 14:16:01 +0000 (15:16 +0100)]
net: ks8851: Reset internal RXFC count on bad packet

A sporadic condition occurs when the "bad packet" error is triggered
repeatedly, which results in "bad packet" messages scrolling on the
console during transfer. To avoid triggering this, reset the internal
RXFC count on the first occurance of the "bad packet", which forces
the code to re-read the RX packet count from the MAC, and prevents
any additional "bad packet" messages if there are no more packets in
the MAC. Also print better debug information if this condition occurs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agonet: Use NDRNG device in srand_mac()
Matthias Brugger [Fri, 18 Dec 2020 09:28:04 +0000 (10:28 +0100)]
net: Use NDRNG device in srand_mac()

When calling srand_mac we use a weak seed dependent on the
mac address. If present, use a RNG device instead to incerase entropy.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
3 years agolib: uuid: use RNG device if present
Matthias Brugger [Fri, 18 Dec 2020 09:28:03 +0000 (10:28 +0100)]
lib: uuid: use RNG device if present

When calculating a random UUID we use a weak seed.
Use a RNG device if present to increase entropy.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
3 years agonet: ftgmac100: Read and retain MAC address
Hongwei Zhang [Thu, 10 Dec 2020 23:11:09 +0000 (18:11 -0500)]
net: ftgmac100: Read and retain MAC address

Read and retain MAC address across flash and QEMU support.

Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
3 years agonet: eth_legacy - fix build CMD_PCAP
Jorge Ramirez-Ortiz [Fri, 4 Dec 2020 19:59:58 +0000 (20:59 +0100)]
net: eth_legacy - fix build CMD_PCAP

Fix typo which would cause a build error.

Fixes: 3eaac6307df ("net: introduce packet capture support")

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
3 years agonet: tftp: Fix incorrect tftp_next_ack on no OACK
Harm Berntsen [Fri, 27 Nov 2020 21:45:56 +0000 (21:45 +0000)]
net: tftp: Fix incorrect tftp_next_ack on no OACK

When the tftp server did not send any OACK, the tftp_next_ack variable
was not set to the correct value . As the server was transmitting
blocks we generated a lot of 'Received unexpected block: $n, expected
$n+1' error messages. Depending on the timeout setting the transfer
could still complete though.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Ramon Fried <rfried.dev@gmail.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: Do not respond to ICMP_ECHO_REQUEST if we do not have an IP address
David Rivshin [Sun, 15 Nov 2020 03:12:47 +0000 (22:12 -0500)]
net: Do not respond to ICMP_ECHO_REQUEST if we do not have an IP address

While doing DHCP the interface IP is set to 0.0.0.0. This causes the
check in net.c on dst_ip to be effectively skipped, and all IP datagrams
are accepted up the IP stack. In the case of an ICMP_ECHO_REQUEST for the
matching MAC address (regardless of destination IP), the result is that
an ICMP_ECHO_REPLY is sent. The source address of the ICMP_ECHO_REPLY is
0.0.0.0, which is an illegal source address.

This can happen in common practice with the following sequence:
DHCP (U-Boot or OS) acquires IP address 10.0.0.1
System reboots
U-Boot starts DHCP and send DHCP DISCOVER
DHCP server decides to OFFER 10.0.0.1 again
  (perhaps because of existing lease or manual configuration)
DHCP server tries to PING 10.0.0.1 to see if anyone is squatting on it
DHCP server still has our MAC address in its ARP table for 10.0.0.1
U-Boot receives PING, and responds with an illegal source address
This may further result in a the DHCP server seeing the response as
  confirmation that someone is squatting on 10.0.0.1, and picking a
  new IP address from the pool to try again

Signed-off-by: David Rivshin <drivshin@allworx.com>
3 years agonet: e1000: implement eth_write_hwaddr for DM_ETH
Ian Ray [Wed, 4 Nov 2020 16:26:01 +0000 (17:26 +0100)]
net: e1000: implement eth_write_hwaddr for DM_ETH

Implement programming MAC address to the hardware also for device model
configuration.

Fixes: b565b18a294f ("board: ge: bx50v3: Enable DM for PCI and ethernet")
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
3 years agonet: eth-uclass: avoid running start() twice without stop()
Matthias Schiffer [Wed, 4 Nov 2020 13:45:14 +0000 (14:45 +0100)]
net: eth-uclass: avoid running start() twice without stop()

Running the start() handler twice without a stop() inbetween completely
breaks communication for some ethernet drivers like fec_mxc.

eth_halt() is called before each eth_init(). Due to the switch to
eth_is_active() in commit 68acb51f442f ("net: Only call halt on a driver
that has been init'ed"), this is not sufficient anymore when netconsole
is active: eth_init_state_only()/eth_halt_state_only() manipulate the
state check that is performed by eth_is_active() without actually
calling into the driver.

The issue can be triggered by starting a network operation (e.g. ping or
tftp) while netconsole is active.

Add an additional "running" flag that reflects the actual state of the
driver and use it to ensure that eth_halt() actually stops the device as
it is supposed to.

Fixes: 68acb51f442f ("net: Only call halt on a driver that has been init'ed")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agoMerge branch '2021-01-18-assorted-platform-updates'
Tom Rini [Tue, 19 Jan 2021 12:56:59 +0000 (07:56 -0500)]
Merge branch '2021-01-18-assorted-platform-updates'

- Assorted MediaTek, AST2x00 updates
- Assorted driver fixes for various platforms
- Keymile platform updates
- Add pwm command, mp5416 pmic driver

3 years agodts: mt7622: use accurate clock source fot mtk_timer
Weijie Gao [Tue, 12 Jan 2021 05:44:11 +0000 (13:44 +0800)]
dts: mt7622: use accurate clock source fot mtk_timer

The input system clock for mt7622 timer is 10MHz and can be retrieved
through the clk driver.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agotimer: mtk_timer: initialize the timer before use
Weijie Gao [Tue, 12 Jan 2021 05:44:02 +0000 (13:44 +0800)]
timer: mtk_timer: initialize the timer before use

The timer being used by this driver may have already been used by first
stage bootloader (e.g. ATF/preloader), and it's settings may differ from
what this driver is going to use.

This may cause issues, such as inaccurate timer frequency due to
incorrect clock divider.

This patch adds the initialization code to avoid them.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agopinctrl: mediatek: correct error handling
Heinrich Schuchardt [Sun, 27 Dec 2020 20:18:26 +0000 (21:18 +0100)]
pinctrl: mediatek: correct error handling

If no GPIO controller is found, the return value should not depend on a
random value on the stack. Initialize variable ret.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agomtd: remove drivers/mtd/mw_eeprom.c
Heinrich Schuchardt [Sun, 27 Dec 2020 10:54:23 +0000 (11:54 +0100)]
mtd: remove drivers/mtd/mw_eeprom.c

drivers/mtd/mw_eeprom.c contains code that never worked. mw_eeprom_write()
and mw_eeprom_read() have incorrect loop conditions:

while (len <= 2) {

CONFIG_MW_EEPROM is not set anywhere. So let's simply drop the module.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodrivers: qe: avoid double free()
Heinrich Schuchardt [Sun, 27 Dec 2020 10:48:49 +0000 (11:48 +0100)]
drivers: qe: avoid double free()

Avoid calling free(addr) twice if the device for ucode is not found.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agommc: fsl_esdhc_spl: remove superfluous free()
Heinrich Schuchardt [Sun, 27 Dec 2020 09:50:26 +0000 (10:50 +0100)]
mmc: fsl_esdhc_spl: remove superfluous free()

Freeing a buffer before calling hang() is superfluous. Removing the call
reduces the SPL size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodoc: board: freescale: advise to use newer atf and firmware
Andrey Zhizhikin [Sun, 13 Dec 2020 20:36:06 +0000 (20:36 +0000)]
doc: board: freescale: advise to use newer atf and firmware

Update branch and version information of ATF and DDR firmware files to
point to latest releases provided by NXP.

This is especially critical for imx8mp evk, as the ATF support for that
SoC is only available in latest releases.

Align all SoCs from imx8m family to use identical revisions of ATF and
DDR firmware.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>