platform/kernel/u-boot.git
15 months agoacpi: Move the table-finding functions into the libary
Simon Glass [Thu, 4 May 2023 22:54:58 +0000 (16:54 -0600)]
acpi: Move the table-finding functions into the libary

This is useful for other features. Move the function into library code
so it can be used outside just the 'acpi' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoacpi: Create a new Kconfig for ACPI
Simon Glass [Thu, 4 May 2023 22:54:57 +0000 (16:54 -0600)]
acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoinput: Flush the keyboard buffer before resetting it
Simon Glass [Thu, 4 May 2023 22:54:56 +0000 (16:54 -0600)]
input: Flush the keyboard buffer before resetting it

If U-Boot is not the first-stage bootloader the keyboard may already be
set up. Make sure to flush any data before trying to reset it. This
avoids a long timeout / hang.

Add some comments and a log category while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Adjust search range for sysinfo table
Simon Glass [Thu, 4 May 2023 22:54:55 +0000 (16:54 -0600)]
x86: Adjust search range for sysinfo table

Avoid searching starting at 0 since this memory may not be available,
e.g. if protection against NULL-pointer access is enabled. The table
cannot be there anyway, since the first 1KB of memory was originally
used for the interrupt table and coreboot avoids it.

Start at 0x400 instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agomtrr: Don't show an invalid CPU number
Simon Glass [Thu, 4 May 2023 22:54:54 +0000 (16:54 -0600)]
mtrr: Don't show an invalid CPU number

When U-Boot did not do the MP init, we don't get an actual CPU number
here. Skip printing it in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoMerge tag 'u-boot-rockchip-20230509' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 9 May 2023 16:45:49 +0000 (12:45 -0400)]
Merge tag 'u-boot-rockchip-20230509' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Rockchip NFC driver update and dev addr pointer api update;
- use standard dr_mode for usb driver;
- rock pi boards dts update;
- Add rk3566 Anbernic boards;
- Misc fixes for drivers;

15 months agoclk: rockchip: rk3588: add hardcoded assigned clocks values
Eugen Hristev [Thu, 13 Apr 2023 11:36:45 +0000 (14:36 +0300)]
clk: rockchip: rk3588: add hardcoded assigned clocks values

The CRU is being probed with a default set of assigned clocks, which
are not implemented in the driver at all.
Hence, when clk_set_defaults is called, it fails with ENOENT.
This would not be a problem, as the CRU still handles all the required
clocks, and the assigned clocks are default configs which are preprogrammed
or not required for Uboot operations.
However, the rockchip reset driver is being bound by the same DT node
as CRU, as the reset driver has no DT node.
But, when probing the reset node, it will call again the clk_set_defaults
for the CRU node, and failing because of missing those specific clocks
in the rk3588 clock driver.
To avoid this, simply implement a basic set/get that will just return
success and the default corresponding rate for the required assigned clocks.
As those clocks were not supported in Uboot, not required for Uboot
operations, there is no need to do any different kind of initialization.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: handle peripheral as well as otg dr_mode
John Keeping [Wed, 12 Apr 2023 11:52:53 +0000 (12:52 +0100)]
rockchip: handle peripheral as well as otg dr_mode

The OTG port is identified by inspecting the "dr_mode" property which is
expected to be "otg" for this port.  But it will work just as well as a
device controller when dr_mode is set to "peripheral", which may be
required if the mode detection pin is not set up correctly and the
device controller needs to be programmed to override this.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: use standard dr_mode parsing function
John Keeping [Wed, 12 Apr 2023 11:52:52 +0000 (12:52 +0100)]
rockchip: use standard dr_mode parsing function

Instead of duplicating the string values here, use usb_get_dr_mode() to
handle the property lookup and converting the values to an enum.

This is implemented with a switch in preparation for the next patch
which adds extra handling for peripheral mode.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoarm: dts: rockchip: rock-3a: drop u-boot,spl-boot-order
FUKAUMI Naoki [Thu, 20 Apr 2023 09:42:30 +0000 (09:42 +0000)]
arm: dts: rockchip: rock-3a: drop u-boot,spl-boot-order

use common one defined in rk356x-u-boot.dtsi.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoarm: dts: rk356x: Makefile: sort
FUKAUMI Naoki [Sat, 8 Apr 2023 09:33:42 +0000 (09:33 +0000)]
arm: dts: rk356x: Makefile: sort

sort alphanumerically.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agodoc: rockchip: update list of Radxa ROCK (Pi) 4 boards
FUKAUMI Naoki [Wed, 26 Apr 2023 02:23:56 +0000 (02:23 +0000)]
doc: rockchip: update list of Radxa ROCK (Pi) 4 boards

add Radxa ROCK (Pi) 4 variants.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoconfigs: rockchip: add Radxa ROCK 4C+
FUKAUMI Naoki [Wed, 26 Apr 2023 02:23:55 +0000 (02:23 +0000)]
configs: rockchip: add Radxa ROCK 4C+

add defconfig for Radxa ROCK 4C+.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoarm: dts: rockchip: add Radxa ROCK 4C+
FUKAUMI Naoki [Wed, 26 Apr 2023 02:23:54 +0000 (02:23 +0000)]
arm: dts: rockchip: add Radxa ROCK 4C+

Linux commit 246450344dad arm64: dts: rockchip: rk3399: Radxa ROCK 4C+

Add support for Radxa ROCK 4C+ SBC.

Key differences of 4C+ compared to previous ROCK Pi 4.
- Rockchip RK3399-T SoC
- DP from 4C replaced with micro HDMI 2K@60fps
- 4-lane MIPI DSI with 1920*1080
- RK817 Audio codec

Also, an official naming convention from Radxa mention to remove
Pi from board name, so this 4C+ is named as Radxa ROCK 4C+ not
Radxa ROCK Pi 4C+.

Signed-off-by: Stephen Chen <stephen@radxa.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoconfigs: rockchip: rock-pi-4: use dtb for ROCK Pi 4A instead of 4B
FUKAUMI Naoki [Wed, 26 Apr 2023 02:23:53 +0000 (02:23 +0000)]
configs: rockchip: rock-pi-4: use dtb for ROCK Pi 4A instead of 4B

rk3399-rock-pi-4a.dtb is enough for Radxa ROCK Pi 4A/B/A+/B+ and ROCK 4SE.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoarm: dts: rockchip: rock-pi-4: sync with Linux 6.3
FUKAUMI Naoki [Wed, 26 Apr 2023 02:23:52 +0000 (02:23 +0000)]
arm: dts: rockchip: rock-pi-4: sync with Linux 6.3

sync dts{,i} files for Radxa ROCK Pi 4 series with Linux 6.3.

because rk3399-rock-pi-4a.dts is enough for ROCK Pi 4A/B/A+/B+ and ROCK
4SE, delete dts{,i} for ROCK Pi 4B.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: rk3328: Add support for FriendlyARM NanoPi R2C
Tianling Shen [Tue, 11 Apr 2023 10:14:49 +0000 (18:14 +0800)]
rockchip: rk3328: Add support for FriendlyARM NanoPi R2C

The NanoPi R2C is a minor variant of NanoPi R2S with the on-board NIC
chip changed from rtl8211e to yt8521s, and otherwise identical to R2S.

The device tree is taken from the kernel linux-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=004589ff9df5b75672a78b6c3c4cba93202b14c9

Signed-off-by: Tianling Shen <cnsztl@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoreset: reset-rockchip: fix trivial line spacing alignment
Eugen Hristev [Tue, 11 Apr 2023 07:20:40 +0000 (10:20 +0300)]
reset: reset-rockchip: fix trivial line spacing alignment

Fix line spacing aligment in bind function

Fixes: 760188c1aa5b ("rockchip: reset: support a (common) rockchip reset drivers")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: correct trivial typo in debug message
Eugen Hristev [Tue, 11 Apr 2023 07:17:56 +0000 (10:17 +0300)]
clk: rockchip: correct trivial typo in debug message

s/faile/failed in debug message

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agopci: pcie_dw_rockchip: release resources on failing probe
Eugen Hristev [Thu, 13 Apr 2023 14:11:03 +0000 (17:11 +0300)]
pci: pcie_dw_rockchip: release resources on failing probe

Implement a resource release mechanism on failing probe.
Without this, a strange situation can happen e.g. when init port fails,
or attempting to get the PHY fails, because the gpios have been
requested first, and if the user tries to do 'pci enum' again, the
driver will fail with 'can't find reset gpios' even if the gpios are
there, just because they were blocked by a previous probe attempt.
It is only natural to release the acquired resources if the probe fails,
just for consistency if nothing else.
This way on subsequent probe attempts, the user will get the same error
message, and not something different that doesn't make sense.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoPrepare v2023.07-rc2
Tom Rini [Mon, 8 May 2023 18:16:32 +0000 (14:16 -0400)]
Prepare v2023.07-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
15 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 8 May 2023 17:43:35 +0000 (13:43 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
15 months agoboard: ti: am64x: Add support for AM64B SK
Judith Mendez [Thu, 6 Apr 2023 06:19:01 +0000 (11:49 +0530)]
board: ti: am64x: Add support for AM64B SK

The AM64x SR2.0 SK board uses "AM64B-SKEVM" as the EEPROM identifier.
This board is similar to the AM64x SKEVM except that it has a new
PMIC that will be enabled in the future and consequently could use a
different device tree file in the future.

For now we treat the board same as an AM64x SK.

Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
15 months agocommon: spl: spl: Remove video driver before u-boot proper
Nikhil M Jain [Mon, 10 Apr 2023 08:49:13 +0000 (14:19 +0530)]
common: spl: spl: Remove video driver before u-boot proper

Add method to remove video driver before loading u-boot proper. When
bootstage changes from SPL to u-boot proper, noo method is called to
remove video driver, and at u-boot proper if video driver is not
enabled, the video driver starts displaying garbage on the screen,
because there is no reserved space for video and the frame buffer gets
u-boot proper data written.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
15 months agoboard: ti: am62x: evm: Add necessary functions to call splash screen
Nikhil M Jain [Mon, 10 Apr 2023 08:49:12 +0000 (14:19 +0530)]
board: ti: am62x: evm: Add necessary functions to call splash screen

To enable splash screen on AM62x at a53 SPL setup DRAM, set page table,
enable cache to allow copying of bmp image to frame buffer and display
it using splash_display.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
15 months agoboard: ti: am62x: am62x: Change splashimage and splashsource
Nikhil M Jain [Mon, 10 Apr 2023 08:49:11 +0000 (14:19 +0530)]
board: ti: am62x: am62x: Change splashimage and splashsource

Change splashimage which is bmp image loadaddr to 0x80200000 since stack
is situated at 0x80477660 as splash framework requires bmp image to be
present above stack.

Change splashsource to sf to support loading bmp image from ospi flash
memory.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
15 months agoconfigs: am62x_evm_a53_defconfig: Changes in memory to support SPL splash screen
Nikhil M Jain [Mon, 10 Apr 2023 08:49:10 +0000 (14:19 +0530)]
configs: am62x_evm_a53_defconfig: Changes in memory to support SPL splash screen

To enable splash at A53 SPL, need to do memory map changes which
involves locate stack above malloc and have enough space to load bmp
image above stack. To load a 1920X1200 image a minimum of 8.8MB space is
needed, to support it move malloc down to 0x80b80000 from 0x80480000 and
bss to 0x80c80000 to have 1MB buffer between malloc and BSS.

Observed SPL size 195KB, CONFIG_SPL_SIZE_LIMIT set to 256KB.
Observed stack size 1904Bytes, CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK set
to 2KB.
CONFIG_SPL_SYS_REPORT_STACK_F_USAGE config sets stack above the malloc
and reports for stack overflow.

Memory map at A53 SPL before splash screen
0x80000000+---------------------+
          |    Empty 512 KB     |
          |                     |
0x80080000+---------------------+
          |     Text Base       |
          |       352 KB        |
          |                     |
0x800D8000+---------------------+
          |                     |
          |                     |
          |    Empty 3.6MB      |
          |                     |
          |                     |
0x80477660+---------------------+
          |    Stack 2 KB       |
0x80477e60+---------------------+
          |     GD 416 Bytes    |
0x80478000+---------------------+
          |    Malloc 352 KB    |
          |                     |
0x80480000+---------------------+
          |                     |
          |                     |
          |                     |
          |                     |
          |   Empty 5.5 MB      |
          |                     |
          |                     |
          |                     |
          |                     |
0x80a00000+---------------------+
          |                     |
          |      BSS 512 KB     |
          |                     |
0x80a80000+---------------------+
          |                     |
          |                     |
          |                     |
          |                     |
          |   Empty 5.5 MB      |
          |                     |
          |                     |
          |                     |
          |                     |
0x81000000+---------------------+FIT Image load address

New memory map with splash screen at SPL
0x80000000+---------------------+
          |    Empty 512 KB     |
          |                     |
0x80080000+---------------------+
          |     Text Base       |
          |       352 KB        |
          |                     |
0x800D8000+---------------------+
          |    Empty 1.1MB      |
          |                     |
0x80200000+---------------------+
          |                     |
          |                     |
          |                     |
          |   BMP Image Load    |
          |                     |
          |       9.4 MB        |
          |                     |
          |                     |
          |                     |
          |                     |
          |                     |
          |                     |
0x80b77660+---------------------+
          |     Stack 2KB       |
0x80b77e60+---------------------+
          |    GD 416 Bytes     |
0x80b78000+---------------------+
          |                     |
          |    Malloc 352KB     |
0x80b80000+---------------------+
          |                     |
          |     Empty 1 MB      |
          |                     |
0x80c80000+---------------------+
          |     BSS 512 KB      |
          |                     |
0x80d00000+---------------------+
          |                     |
          |                     |
          |    Empty 3.0 MB     |
          |                     |
          |                     |
          |                     |
0x81000000+---------------------+FIT Image load addressi

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
15 months agobtrfs: fix offset when reading compressed extents
Dominique Martinet [Tue, 18 Apr 2023 06:41:55 +0000 (15:41 +0900)]
btrfs: fix offset when reading compressed extents

btrfs_read_extent_reg correctly computed the extent offset in the
BTRFS_COMPRESS_NONE case, but did not account for the 'offset - key.offset'
part correctly in the compressed case, making the function read
incorrect data.

In the case I examined, the last 4k of a file was corrupted and
contained data from a few blocks prior, e.g. reading a 10k file with a
single extent:
btrfs_file_read()
 -> btrfs_read_extent_reg
    (aligned part loop, until 8k)
 -> read_and_truncate_page
   -> btrfs_read_extent_reg
      (re-reads the last extent from 8k to the end,
      incorrectly reading the first 2k of data)

This can be reproduced as follow:
$ truncate -s 200M btr
$ mount btr -o compress /mnt
$ pat() { dd if=/dev/zero bs=1M count=$1 iflag=count_bytes status=none | tr '\0' "\\$2"; }
$ { pat 4K 1; pat 4K 2; pat 2K 3; }  > /mnt/file
$ sync
$ filefrag -v /mnt/file
File size of /mnt/file is 10240 (3 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       2:       3328..      3330:      3:             last,encoded,eof
$ umount /mnt

Then in u-boot:
=> load scsi 0 2000000 file
10240 bytes read in 3 ms (3.3 MiB/s)
=> md 2001ff0
02001ff002020202 02020202 02020202 02020202  ................
0200200001010101 01010101 01010101 01010101  ................
0200201001010101 01010101 01010101 01010101  ................

(02002000 onwards should contain '03' pattern but went back to 01,
start of the extent)

After patch, data is read properly:
=> md 2001ff0
02001ff002020202 02020202 02020202 02020202  ................
0200200003030303 03030303 03030303 03030303  ................
0200201003030303 03030303 03030303 03030303  ................

Note that the code previously (before commit e3427184f38a ("fs: btrfs:
Implement btrfs_file_read()")) did not split that read in two, so
this is a regression even if the previous code might not have been
handling offsets correctly either (something that booted now fails to
boot)

Fixes: a26a6bedafcf ("fs: btrfs: Introduce btrfs_read_extent_inline() and btrfs_read_extent_reg()")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
15 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 8 May 2023 13:10:39 +0000 (09:10 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- cmd: tlv_eeprom: Misc cleanups & improvements (Josua)

15 months agocmd: tlv_eeprom: enable 'dev' subcommand before 'read'
Josua Mayer [Fri, 5 May 2023 08:20:49 +0000 (11:20 +0300)]
cmd: tlv_eeprom: enable 'dev' subcommand before 'read'

Move the handler for "tlv_eeprom dev X" command to the beginning of
do_tlv_eeprom, to allow using it before issuing a "read" command for
currently selected eeprom.

Also remove the check if eeprom exists, since that can only work after
the first execution of read_eeprom triggered device lookup.
Instead accept values up to the defined array size (MAX_TLV_DEVICES).

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agocmd: tlv_eeprom: handle -ENODEV error from read_eeprom function
Josua Mayer [Fri, 5 May 2023 08:20:48 +0000 (11:20 +0300)]
cmd: tlv_eeprom: handle -ENODEV error from read_eeprom function

When tlv eeprom does not exist, return error code instead of quietly
making up tlv structure in memory.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agocmd: tlv_eeprom: remove use of global variable has_been_read
Josua Mayer [Fri, 5 May 2023 08:20:47 +0000 (11:20 +0300)]
cmd: tlv_eeprom: remove use of global variable has_been_read

has_been_read is only used as an optimization for do_tlv_eeprom.
Explicitly use and set inside this function, thus making read_eeprom
stateless.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agocmd: tlv_eeprom: remove use of global variable current_dev
Josua Mayer [Fri, 5 May 2023 08:20:46 +0000 (11:20 +0300)]
cmd: tlv_eeprom: remove use of global variable current_dev

Make tlv_eeprom command device selection an explicit parameter of all
function calls.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agoMerge branch 'for-2023.07-2' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx
Tom Rini [Sun, 7 May 2023 13:44:27 +0000 (09:44 -0400)]
Merge branch 'for-2023.07-2' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx

This pull request adds misc fixes for cssi boards and activates
CPM relocation in order to enable the use of SCC4 in
QMC (QUICC Multi-Channel) mode.

15 months agoMerge branch '2023-05-05-networking-updates'
Tom Rini [Sat, 6 May 2023 14:34:34 +0000 (10:34 -0400)]
Merge branch '2023-05-05-networking-updates'

- Cleanup NFS support, add NFSv1 support, assorted IPv6 improvements,
  PHY cleanups and improvements, ksz9477, ldpaa and rtl8169
  improvements, overall network performance improvements.

15 months agoboard: rockchip: add Anbernic RGXX3 Series Devices
Chris Morgan [Fri, 21 Apr 2023 15:59:19 +0000 (10:59 -0500)]
board: rockchip: add Anbernic RGXX3 Series Devices

The Anbernic RGxx3 is a "pseudo-device" that encompasses the following
devices:

 - Anbernic RG353M
 - Anbernic RG353P
 - Anbernic RG353V
 - Anbernic RG353VS
 - Anbernic RG503

The rk3566-anbernic-rgxx3.dtsi is synced with upstream Linux, but
rk3566-anbernic-rgxx3.dts is a U-Boot specific devicetree that
is used for all RGxx3 devices.

Via the board.c file, the bootloader automatically sets the correct
fdtfile, board, and board_name environment variables so that the
correct devicetree can be passed to Linux. It is also possible to
simply hard-code a single devicetree in the boot.scr file and use
that to load Linux as well.

The common specifications for each device are:

 - Rockchip RK3566 SoC
 - 2 external SDMMC slots
 - 1 USB-C host port, 1 USB-C peripheral port
 - 1 mini-HDMI output
 - MIPI-DSI based display panel
 - ADC controlled joysticks with a GPIO mux
 - GPIO buttons
 - A PWM controlled vibrator
 - An ADC controlled button

All of the common features are defined in the devicetree synced from
upstream Linux.

TODO: DSI panel auto-detection for the RG353 devices (requires porting
of DSI controller driver and DSI-DPHY driver to send DSI commands to
the panel).

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agork3399: r4s: Derive local MAC address if EEPROM is missing
Christian Kohlschütter [Tue, 27 Sep 2022 15:05:21 +0000 (15:05 +0000)]
rk3399: r4s: Derive local MAC address if EEPROM is missing

Some RK3399 boards, such as newer revisions of NanoPi R4S, do not
provide an EEPROM chip containing a globally unique MAC address.

Currently, this means that a randomly generated temporary MAC address
may be generated each time the device is rebooted, leading to ARP cache
issues and other confusing bugs.

Since RK3399 CPUs provide a built-in unique serial number, we can
reliably derive a locally MAC address from it by reading the
corresponding bits from the non-secure efuse block.

Enable configuration options that allow deriving a local MAC address
from the CPU serial number.

15 months agoinclude: fdtdec: decouple fdt_addr_t and phys_addr_t size
Johan Jonker [Mon, 13 Mar 2023 00:33:23 +0000 (01:33 +0100)]
include: fdtdec: decouple fdt_addr_t and phys_addr_t size

The DT specification supports CPUs with both 32-bit and 64-bit addressing
capabilities. In U-boot the fdt_addr_t and phys_addr_t size are coupled
by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions
with a 64-bit reg property. These partitions synced from Linux end up with
the wrong offset and sizes when only the lower 32-bit is passed.
Decouple the fdt_addr_t and phys_addr_t size as they don't necessary
match.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoarm: stm32mp: spl: fix function with fdt_addr_t input
Johan Jonker [Mon, 13 Mar 2023 00:33:09 +0000 (01:33 +0100)]
arm: stm32mp: spl: fix function with fdt_addr_t input

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so fix ofnode_get_addr_size function with fdt_addr_t input to
be able to handle both sizes for stm32mp SoC in spl.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: fix debug string with fdt_addr_t input
Johan Jonker [Mon, 13 Mar 2023 00:32:57 +0000 (01:32 +0100)]
drivers: fix debug string with fdt_addr_t input

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so fix some
debug strings with fdt_addr_t to be able to handle both sizes.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: use devfdt_get_addr_ptr when cast to pointer
Johan Jonker [Mon, 13 Mar 2023 00:32:44 +0000 (01:32 +0100)]
drivers: use devfdt_get_addr_ptr when cast to pointer

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
devfdt_get_addr_ptr instead of the devfdt_get_addr function in
the various files in the drivers directory that cast to a pointer.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: use devfdt_get_addr_index_ptr when cast to pointer
Johan Jonker [Mon, 13 Mar 2023 00:32:31 +0000 (01:32 +0100)]
drivers: use devfdt_get_addr_index_ptr when cast to pointer

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
devfdt_get_addr_index_ptr instead of the devfdt_get_addr_index function
in the various files in the drivers directory that cast to a pointer.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: use devfdt_get_addr_size_index_ptr when cast to pointer
Johan Jonker [Mon, 13 Mar 2023 00:32:18 +0000 (01:32 +0100)]
drivers: use devfdt_get_addr_size_index_ptr when cast to pointer

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
devfdt_get_addr_size_index_ptr instead of the devfdt_get_addr_size_index
function in the various files in the drivers directory that cast to
a pointer.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: use dev_read_addr_ptr when cast to pointer
Johan Jonker [Mon, 13 Mar 2023 00:32:04 +0000 (01:32 +0100)]
drivers: use dev_read_addr_ptr when cast to pointer

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
dev_read_addr_ptr instead of the dev_read_addr function in the
various files in the drivers directory that cast to a pointer.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodrivers: use dev_read_addr_index_ptr when cast to pointer
Johan Jonker [Mon, 13 Mar 2023 00:31:49 +0000 (01:31 +0100)]
drivers: use dev_read_addr_index_ptr when cast to pointer

The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
dev_read_addr_index_ptr instead of the dev_read_addr_index function
in the various files in the drivers directory that cast to a pointer.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agospi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
Johan Jonker [Mon, 13 Mar 2023 00:31:36 +0000 (01:31 +0100)]
spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so use devfdt_get_addr_index_ptr and devfdt_get_addr_size_index_ptr
function in the spi-aspeed-smc.c file. Also fix dev_dbg to be able
to handle both sizes. As we are there also streamline the error
response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agocore: read: add dev_read_addr_index_ptr function
Johan Jonker [Mon, 13 Mar 2023 00:31:25 +0000 (01:31 +0100)]
core: read: add dev_read_addr_index_ptr function

Add dev_read_addr_index_ptr function with the
same functionality as dev_read_addr_index,
but instead a return pointer is given.
Use map_sysmem() function as cast for the return.
Make same fix for dev_read_addr_ptr() function.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agocore: fdtaddr: add devfdt_get_addr_size_index_ptr function
Johan Jonker [Fri, 21 Apr 2023 15:33:58 +0000 (17:33 +0200)]
core: fdtaddr: add devfdt_get_addr_size_index_ptr function

Add devfdt_get_addr_size_index_ptr function with the same
functionality as devfdt_get_addr_size_index, but instead
a return pointer is given.

Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agorockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Johan Jonker [Mon, 13 Mar 2023 00:30:57 +0000 (01:30 +0100)]
rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap

The Rockchip SoC rk3288 has 2 types of device trees floating around.
A 64bit reg size when synced from Linux and a 32bit for U-boot.
A pre-probe function in the syscon class driver assumes only 32bit.
For other odd reg structures the regmap must be defined in the individual
syscon driver. Store rk3288 platdata in a regmap before pre-probe
during bind.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
15 months agocore: remap: fix regmap_init_mem_plat() reg size handeling
Johan Jonker [Mon, 13 Mar 2023 00:30:46 +0000 (01:30 +0100)]
core: remap: fix regmap_init_mem_plat() reg size handeling

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so convert regmap_init_mem_plat() input to handel both. The
syscon class driver also makes use of the regmap_init_mem_plat()
function, but has no way of knowing the format of the
device-specific platform data. In case of odd reg structures other
then that the syscon class driver assumes the regmap must be
filled in the individual syscon driver before pre-probe.
Also fix the ARRAY_SIZE divider in the syscon class driver.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoinclude: dm: ofnode: fix headers
Johan Jonker [Mon, 13 Mar 2023 00:30:33 +0000 (01:30 +0100)]
include: dm: ofnode: fix headers

When fdt_addr_t and phys_addr_t are split it turns out that
the header don't match the functions, so fix the headers.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: spi: rk_spi: use base variable with uintptr_t size
Johan Jonker [Mon, 13 Mar 2023 00:30:20 +0000 (01:30 +0100)]
rockchip: spi: rk_spi: use base variable with uintptr_t size

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so use a base variable with uintptr_t size in the
rk_spi.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agorockchip: pwm: rk_pwm: use base variable with uintptr_t size
Johan Jonker [Mon, 13 Mar 2023 00:30:02 +0000 (01:30 +0100)]
rockchip: pwm: rk_pwm: use base variable with uintptr_t size

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so use a base variable with uintptr_t size in the
rk_pwm.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agorockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
Johan Jonker [Mon, 13 Mar 2023 00:29:47 +0000 (01:29 +0100)]
rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expect 64-bit data from the device tree parser,
so use a regs variable with uintptr_t size in the
dw-apb-timer.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agorockchip: adc: rockchip-saradc: use dev_read_addr_ptr
Johan Jonker [Mon, 13 Mar 2023 00:29:35 +0000 (01:29 +0100)]
rockchip: adc: rockchip-saradc: use dev_read_addr_ptr

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expext 64-bit data from the device tree parser,
so use dev_read_addr_ptr in the rockchip-saradc.c file.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agomtd: nand: add support for the Sandisk SDTNQGAMA chip
Johan Jonker [Mon, 13 Mar 2023 00:29:19 +0000 (01:29 +0100)]
mtd: nand: add support for the Sandisk SDTNQGAMA chip

Sandisk SDTNQGAMA is a 8GB size, 3.3V 8 bit chip with 16KB page size,
1KB write size and 40 bit ecc support

Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agomtd: nand: raw: rockchip_nfc: fix oobfree offset and description
Johan Jonker [Mon, 13 Mar 2023 00:29:05 +0000 (01:29 +0100)]
mtd: nand: raw: rockchip_nfc: fix oobfree offset and description

The MTD framework reserves 1 or 2 bytes for the bad block marker
depending on the bus size. The rockchip_nfc driver currently only
supports a 8 bit bus, but reserves standard 2 bytes for the BBM.
The first free OOB byte is therefore OOB2 at offset 2.
Page address(PA) bytes are moved to the last 4 positions before
ECC. Update the description for U-boot.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agomtd: nand: raw: rockchip_nfc: add flash_node to chip structure
Johan Jonker [Mon, 13 Mar 2023 00:28:53 +0000 (01:28 +0100)]
mtd: nand: raw: rockchip_nfc: add flash_node to chip structure

Add flash_node to the rockchip_nfc driver chip structure in order
to find the partitions in the add_mtd_partitions_of() function.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agomtd: nand: raw: rockchip_nfc: add layout structure
Johan Jonker [Mon, 13 Mar 2023 00:28:39 +0000 (01:28 +0100)]
mtd: nand: raw: rockchip_nfc: add layout structure

The MTD framework in U-boot is not identical for drivers ported
from Linux. The rockchip_nfc driver was ported with OOB ops functions
while the framework expects a layout structure per chip.
Fix by adding a structure with OOB data and remove unused functions.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agomtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc"
Johan Jonker [Mon, 13 Mar 2023 00:28:19 +0000 (01:28 +0100)]
mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc"

The compatible string for rk3308 has as fallback string
"rockchip,rv1108-nfc". As there is no logic in probe priority between
the SoC orientated string and the fall back, so remove the compatible
string "rockchip,rk3308-nfc" from the driver.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agomtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr
Johan Jonker [Mon, 13 Mar 2023 00:28:06 +0000 (01:28 +0100)]
mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr

The fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expext 64-bit data from the device tree parser,
so use dev_read_addr_ptr in the rockchip_nfc.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
15 months agonet: phy: Request rgmii-id phy reset gpio as output
Stefan Herbrechtsmeier [Tue, 2 May 2023 12:50:43 +0000 (14:50 +0200)]
net: phy: Request rgmii-id phy reset gpio as output

Request the reset gpio of the rgmii-id phy as output to be consistent
with the eth-phy-uclass driver.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
15 months agonet: rtl8169: add minimal support for 8125B variant
Eugen Hristev [Tue, 25 Apr 2023 13:06:58 +0000 (16:06 +0300)]
net: rtl8169: add minimal support for 8125B variant

Add minimal support for 8125B version.
Changes are based on the Linux driver.
Tested on Radxa Rock 5B Rk3588 board.

Connection to a laptop worked fine in 100 Mbps mode.
1000 Mbps mode is not working at the moment.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agotest: eth: IPv6 network discovery unit test
Ehsan Mohandesi [Sat, 22 Apr 2023 00:08:23 +0000 (17:08 -0700)]
test: eth: IPv6 network discovery unit test

Test router advertisement validation and processing functions.

Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
15 months agotest/py: IPv6 network discovery test
Ehsan Mohandesi [Sat, 22 Apr 2023 00:08:22 +0000 (17:08 -0700)]
test/py: IPv6 network discovery test

Test the IPv6 network discovery feature if indicated by boardenv file.

Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
15 months agonet: ipv6: Add support for default gateway discovery.
Ehsan Mohandesi [Sat, 22 Apr 2023 00:08:21 +0000 (17:08 -0700)]
net: ipv6: Add support for default gateway discovery.

In IPv6, the default gateway and prefix length are determined by receiving
a router advertisement as defined in -
https://www.rfc-editor.org/rfc/rfc4861.

Add support for sending router solicitation (RS) and processing router
advertisements (RA).

If the RA has prefix info option and following conditions are met, then
gatewayip6 and net_prefix_length of ip6addr env variables are initialized.
These are later consumed by IPv6 code for non-local destination IP.

- "Router Lifetime" != 0
- Prefix is NOT link-local prefix (0xfe80::/10)
- L flag is 1
- "Valid Lifetime" != 0

Timing Parameters:
- MAX_RTR_SOLICITATION_DELAY (0-1s)
- RTR_SOLICITATION_INTERVAL (4s) (min retransmit delay)
- MAX_RTR_SOLICITATIONS (3 RS transmissions)

The functionality is enabled by CONFIG_IPV6_ROUTER_DISCOVERY and invoked
automatically from net_init_loop().

Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>Reviewed-by:
Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Tested-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Sergei Antonov <saproj@gmail.com>
15 months agonet: phy: Make phy_interface_is_rgmii a switch statement
Nishanth Menon [Fri, 14 Apr 2023 22:06:45 +0000 (17:06 -0500)]
net: phy: Make phy_interface_is_rgmii a switch statement

Recent commit 75d28899e3e9 ("net: phy: Synchronize PHY interface modes
with Linux") reordered the enum definitions. This exposed a problem
in range checking functions to identify the interface type. Though
this specific api wasn't impacted (all the RGMII definitions remained
within range), this experience should be used to never to have to face
this kind of challenge again.

While it is possible for the phy drivers to use the enums directly,
drivers such as dp83867, dp83869, marvell, micrel_ksz90x1 etc use this
api.

Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: phy: Drop phy_interface_is_sgmii
Nishanth Menon [Fri, 14 Apr 2023 22:06:44 +0000 (17:06 -0500)]
net: phy: Drop phy_interface_is_sgmii

Recent commit 75d28899e3e9 ("net: phy: Synchronize PHY interface modes
with Linux") reordered the enum definitions. This caused the range of
enums that this api was checking to go bad.

There aren't anymore users of phy_interface_is_sgmii, so, just drop
it. Also the protocols are so very different that it makes no sense to
provide a helper wrapper in the hope of reuse for phy drivers.

Reported-by: Tom Rini <trini@konsulko.com>
Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Suggested-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/all/20230414103852.38705065@dellmb/
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: phy: dp83867: Explicitly check against sgmii
Nishanth Menon [Fri, 14 Apr 2023 22:06:43 +0000 (17:06 -0500)]
net: phy: dp83867: Explicitly check against sgmii

dp83867 driver only supports sgmii and not all the newer protocols.
Drop the usage of the generic phy_interface_is_sgmii function and just
matchup to the specific mode supported.

Reported-by: Tom Rini <trini@konsulko.com>
Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Suggested-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/all/b82ac325-4818-8e72-054b-640268dbf806@mailbox.org/
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: share fastboot boot handle logic between transports
Dmitrii Merkurev [Wed, 12 Apr 2023 18:49:31 +0000 (19:49 +0100)]
net: share fastboot boot handle logic between transports

Introduce reboot, boot and continue commands support to
TCP fastboot by moving existing UDP logic into the common module.

Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agonet: add fastboot TCP support
Dmitrii Merkurev [Wed, 12 Apr 2023 18:49:30 +0000 (19:49 +0100)]
net: add fastboot TCP support

Known limitations are
1. fastboot reboot doesn't work (answering OK but not rebooting)
2. flashing isn't supported (TCP transport only limitation)

The command syntax is
fastboot tcp

Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agonet: support being a TCP server to unblock TCP fastboot
Dmitrii Merkurev [Wed, 12 Apr 2023 18:49:29 +0000 (19:49 +0100)]
net: support being a TCP server to unblock TCP fastboot

Make following changes to unblock TCP fastboot support:

1. Implement being a TCP server support
2. Introduce dedicated TCP traffic handler (get rid of UDP signature)
3. Ensure seq_num and ack_num are respected in net_send_tcp_packet
function (make sure existing wget_cmd code is reflected with the fix)

Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: dhcp6: Add a sandbox test for dhcp6
Sean Edmond [Tue, 11 Apr 2023 17:48:48 +0000 (10:48 -0700)]
net: dhcp6: Add a sandbox test for dhcp6

Requires proper environment with DHCP6 server provisioned.

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: dhcp6: pxe: Add DHCP/PXE commands for IPv6
Sean Edmond [Tue, 11 Apr 2023 17:48:47 +0000 (10:48 -0700)]
net: dhcp6: pxe: Add DHCP/PXE commands for IPv6

Adds commands to support DHCP and PXE with IPv6.

New configs added:
- CMD_DHCP6
- DHCP6_PXE_CLIENTARCH
- DHCP6_PXE_DHCP_OPTION
- DHCP6_ENTERPRISE_ID

New commands added (when IPv6 is enabled):
- dhcp6
- pxe get -ipv6
- pxe boot -ipv6

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: dhcp6: Add DHCPv6 (DHCP for IPv6)
Sean Edmond [Tue, 11 Apr 2023 17:48:46 +0000 (10:48 -0700)]
net: dhcp6: Add DHCPv6 (DHCP for IPv6)

Adds DHCPv6 protocol to u-boot.

Allows for address assignement with DHCPv6 4-message exchange
(SOLICIT->ADVERTISE->REQUEST->REPLY).  Includes DHCPv6 options
required by RFC 8415.  Also adds DHCPv6 options required
for PXE boot.

Possible enhancements:
- Duplicate address detection on DHCPv6 assigned address
- IPv6 address assignement through SLAAC
- Sending/parsing other DHCPv6 options (NTP, DNS, etc...)

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agophy: realtek: don't duplicate genphy_startup
Rasmus Villemoes [Tue, 28 Mar 2023 21:21:08 +0000 (23:21 +0200)]
phy: realtek: don't duplicate genphy_startup

rtl8211e_startup() is an exact copy of genphy_startup(). Use that
instead of duplicating it.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
15 months agophy: broadcom: don't duplicate genphy_startup
Rasmus Villemoes [Tue, 28 Mar 2023 21:12:47 +0000 (23:12 +0200)]
phy: broadcom: don't duplicate genphy_startup

Functionally, bcm_cygnus_startup() is an exact copy of
genphy_startup().

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
15 months agonet: phy: gmii2rgmii: Support external rgmii-id phy
Stefan Herbrechtsmeier [Wed, 22 Mar 2023 08:42:47 +0000 (09:42 +0100)]
net: phy: gmii2rgmii: Support external rgmii-id phy

Read the phy mode of the external phy from the device tree if available
and check that it is a RGMII variant.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
15 months agonet: add NFSv1 support
Thomas RIENOESSL [Fri, 10 Mar 2023 09:51:55 +0000 (10:51 +0100)]
net: add NFSv1 support

NFSv1 support added by Christian Gmeiner, Thomas Rienoessl,
September 27, 2018. As of now, NFSv3 is the default choice.
if the server does not support NFSv3, we fall back to
versions 2 or 1.

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
15 months agonfs: handle rpc errors for mount calls
Thomas RIENOESSL [Fri, 10 Mar 2023 09:51:54 +0000 (10:51 +0100)]
nfs: handle rpc errors for mount calls

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
15 months agonfs: factor out generic reply error handling
Thomas RIENOESSL [Fri, 10 Mar 2023 09:51:53 +0000 (10:51 +0100)]
nfs: factor out generic reply error handling

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
15 months agonfs: convert supported_nfs_versions bitfield to an enum
Thomas RIENOESSL [Fri, 10 Mar 2023 09:51:52 +0000 (10:51 +0100)]
nfs: convert supported_nfs_versions bitfield to an enum

Prep. work to support nfs v1.

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
15 months agoLet the EQoS in imx8mp handle fixed-phy too.
Elmar Psilog [Mon, 20 Feb 2023 15:03:15 +0000 (16:03 +0100)]
Let the EQoS in imx8mp handle fixed-phy too.

Without that patch it lost track to the node to scan
speed and duplex.
Patch was created by Marek Vasut, just tested by me.

Signed-off-by: Elmar Psilog <epsi@gmx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
15 months agonet: ipv6: IPv6 environment variable cleanup
Sean Edmond [Thu, 16 Feb 2023 04:38:36 +0000 (20:38 -0800)]
net: ipv6: IPv6 environment variable cleanup

Fix "setenv gatewayip6".

Synchronize IPv6 local variables with environment variables
in netboot_update_env()

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
15 months agodrivers: net: fsl-mc: fix MAC address fixup procedure
Ioana Ciornei [Thu, 9 Feb 2023 16:07:04 +0000 (18:07 +0200)]
drivers: net: fsl-mc: fix MAC address fixup procedure

In the process of adopting CONFIG_DM_ETH on the DPAA2 based platforms,
interfaces which were previously defined as "xgmii" were transitioned to
be defined as "xfi" in the DTS.
See the commit below for reference:
commit 87274918f2f4 ("arm: dts: ls2088ardb: add DPMAC and PHY nodes")

Then Vladimir's commit replaced all occurrences of "xfi" with
"10gbase-r" in an effort to make U-Boot work with the same device tree
as Linux.
commit 77b11f760416 ("net: replace the "xfi" phy-mode with "10gbase-r"")

These changes to the phy_interface_t of an Ethernet port meant that the
mc_fixup_mac_addrs() function was no longer capable to properly fixup
the MAC addresses. The problem arises from the fact that the hardcoded
information about an interface (wriop_get_enet_if()) was no longer
matching any actual device.

For example, the function tried to search for "DPMAC1@xgmii1" by name
using eth_get_dev_by_name() when only "DPMAC1@10gbase-r" was available.

This function removes the need to rely on the hardcoded information by
iterating through all the UCLASS_ETH devices which are DPAA2 and request
a fixup for each of them.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agodrivers: net: ldpaa: export driver name and API to get DPMAC id
Ioana Ciornei [Thu, 9 Feb 2023 16:07:03 +0000 (18:07 +0200)]
drivers: net: ldpaa: export driver name and API to get DPMAC id

Export the ldpaa_eth_get_dpmac_id() function so that it can be used from
other drivers, especially by fsl-mc which will need it the next patch.
Also, create a macro for the Ethernet ldpaa driver name and export it as
well.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
15 months agonet: ksz9477: add port_probe function to config phy
Tim Harvey [Tue, 7 Feb 2023 23:37:18 +0000 (15:37 -0800)]
net: ksz9477: add port_probe function to config phy

Add a port_probe function to configure the phy. This leads to
earlier link negotiation so the port is more likely to be ready
when used.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: ksz9477: remove unnecessary variable
Tim Harvey [Tue, 7 Feb 2023 23:37:17 +0000 (15:37 -0800)]
net: ksz9477: remove unnecessary variable

We don't do anything useful with the master dev, so remove the variable.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agonet: ksz9477: remove unnecessary dsa_set_tagging call
Tim Harvey [Tue, 7 Feb 2023 23:37:16 +0000 (15:37 -0800)]
net: ksz9477: remove unnecessary dsa_set_tagging call

packet tagging is not used for this driver so we do not need to
call dsa_set_tagging.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
15 months agoMerge tag 'video-for-v2023.07-rc2' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 5 May 2023 13:36:08 +0000 (09:36 -0400)]
Merge tag 'video-for-v2023.07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-video

 - enable video support in SPL
 - support splash screen for TI am62x
 - replace #ifdef and #if with if's in bmp/splash
 - add lm3533 backlight driver
 - add Solomon SSD2825 DSI/LVDS bridge driver
 - add Renesas R61307 and R69328 MIPI DSI panel drivers
 - add tegra DC based PWM backlight driver
 - add generic endeavoru (HTC One X) panel driver

15 months agoMerge tag 'fsl-qoirq-2023-5-5' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 5 May 2023 13:33:29 +0000 (09:33 -0400)]
Merge tag 'fsl-qoirq-2023-5-5' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq

fsl-ls1088a device tree update
enable DM_SERIAL for ten64
check for crypto node first in fdt_fixup_remove_jr

15 months agoboard: cssi: Activate SMC relocation on CMPC885 board for MIAE device
Christophe Leroy [Wed, 3 May 2023 07:25:10 +0000 (09:25 +0200)]
board: cssi: Activate SMC relocation on CMPC885 board for MIAE device

When CMPC885 board is used for MIAE device, SCC2 SCC3 and SMC2
are used for serial lines. Therefore only SCC4 is available for
handling the TDM line.

In order to use SCC4 in QMC mode without loosing SMC2, SMC2
must be relocated.

Activate SMC relocation and relocate SMC2 at offset 0x1fc0 which
is unused.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agoserial, mpc8xx: Take parameter RAM relocation into account
Christophe Leroy [Wed, 3 May 2023 07:20:15 +0000 (09:20 +0200)]
serial, mpc8xx: Take parameter RAM relocation into account

Instead of inhibiting parameter RAM relacation, take
into account the configured one.

It means INIT_TRX command cannot be used and must be done
manually as explained in the microcode patch application note.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agospi, mpc8xx: Take parameter RAM relocation into account
Christophe Leroy [Wed, 3 May 2023 07:05:33 +0000 (09:05 +0200)]
spi, mpc8xx: Take parameter RAM relocation into account

Instead of inhibiting parameter RAM relocation, take it into account.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agopowerpc: mpc8xx: Add SMC relocation CPM microcode
Christophe Leroy [Wed, 3 May 2023 06:57:33 +0000 (08:57 +0200)]
powerpc: mpc8xx: Add SMC relocation CPM microcode

In order to use QMC mode in the CPM, a SCC requires more space
in parameter RAM.

After SCC1 there is I2C parameter RAM and after SCC2 there is
SPI parameter RAM. MPC866 and MPC885 can already relocate I2C and.
SPI parameter RAM.

But in order to free space after SCC3 and SCC4, SMC1 and SMC2
need to be relocated. In order to do so, a CPM microcode patch
is required.

Binary data for that patch is copied from Linux kernel.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agopowerpc: mpc885: Add CPM USB-SOF microcode for CPM15 ERRATA
Christophe Leroy [Wed, 3 May 2023 06:50:55 +0000 (08:50 +0200)]
powerpc: mpc885: Add CPM USB-SOF microcode for CPM15 ERRATA

MPC885 CPU has the following ERRATA:

When the USB controller is configured in Host mode, and the
SOF generation (SFTE=1 in USMOD register) is being used,
there may be false CRC error indication in other SCCs.
Although the data is received correctly, the CRC result
will be corrupted.

Add capability to load the related microcode to fix it.
The microcode binary data is copied from Linux kernel.

Other microcode will be added in following patch so make it
a Kconfig choice.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agopowerpc: Force cast on memcpy_toio()
Christophe Leroy [Fri, 5 May 2023 05:24:16 +0000 (07:24 +0200)]
powerpc: Force cast on memcpy_toio()

sparse reports the following warning:

  CHECK   arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c
arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c:29:9: warning: cast removes address space '<asn:2>' of expression
arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c:30:9: warning: cast removes address space '<asn:2>' of expression

This is because of (void *) casts for using memcpy() as a substitute.

Do like other architectures, __force the cast to silence the warning

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
15 months agoarm: dts: ten64: fix header typo and update copyright
Mathew McBride [Wed, 12 Apr 2023 07:38:30 +0000 (07:38 +0000)]
arm: dts: ten64: fix header typo and update copyright

Somehow, I managed to typo our company name in the U-Boot
and Linux kernel submissions.

Fix this and update the copyright year at the same time.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # on LS1088A-RDB
15 months agoarm: dts: ten64: syncronise device tree with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:29 +0000 (07:38 +0000)]
arm: dts: ten64: syncronise device tree with Linux

This synchronises the Linux device tree with U-Boot
(cp linux/..../fsl-ls1088a-ten64.dts uboot/..../fsl-ls1088a-ten64.dts),
as of Linux v6.2-rc5.

Missing from the U-Boot copy previously was the
Ethernet PCS definitions (required for linking with PHY in
Linux but not used by U-Boot) and various upstream
fixes and formatting changes.

The board microcontroller (which doesn't have a Linux driver)
has been moved to the -u-boot.dtsi, as well as the
spi0 quadspi alias (used by U-boot 'sf' but not valid for Linux).

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # on LS1088A-RDB
15 months agoarm: dts: fsl-ls1088a: copy all missing bindings from Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:28 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: copy all missing bindings from Linux

This is effectively:

cp linux/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi \
   u-boot/arch/arm/dts/fsl-ls1088a.dtsi

Tested working with Ten64 board (LS1088A) booting openSUSE Tumbleweed.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # on LS1088A-RDB