platform/kernel/u-boot.git
14 months agoMerge branch '2023-05-11-CONFIG_IS_ENABLED-vs-IS_ENABLED-cleanups' into next
Tom Rini [Thu, 11 May 2023 17:02:03 +0000 (13:02 -0400)]
Merge branch '2023-05-11-CONFIG_IS_ENABLED-vs-IS_ENABLED-cleanups' into next

- Bring in some of the clean-ups to use IS_ENABLED rather than
  CONFIG_IS_ENABLED to make the code less error-prone.

14 months agopower: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)
Troy Kisky [Mon, 13 Mar 2023 21:31:44 +0000 (14:31 -0700)]
power: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)

This avoids an error in converting to CONFIG_IS_ENABLED(DM_PMIC).
Many boards SPL code needs these definitions to compile, even if
the functions are not linked.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoarm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:42 +0000 (14:31 -0700)]
arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA

This avoid an error with enable_sata_clock when
defined(CONFIG_SATA) is changed to CONFIG_IS_ENABLED(SATA).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agowandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:41 +0000 (14:31 -0700)]
wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA
is defined.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
14 months agosolidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:40 +0000 (14:31 -0700)]
solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA
is defined.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agofreescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)
Troy Kisky [Mon, 13 Mar 2023 21:31:38 +0000 (14:31 -0700)]
freescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)

pfuze_mode_init calls pmic_reg_read which is only available from

obj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o

Prepare for conversion of defined(CONFIG_DM_PMIC) to
CONFIG_IS_ENABLED(DM_PMIC).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agom53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
Troy Kisky [Mon, 13 Mar 2023 21:31:37 +0000 (14:31 -0700)]
m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)

The function ft_board_setup calls do_fixup_by_path_string
which is only available on CONFIG_IS_ENABLED(OF_LIBFDT).
This prepares for the conversion.

ft_board_setup is only called from image-fdt which is linked by
obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoofnode: fdt_support definitions needed if OF_CONTROL is enabled
Troy Kisky [Mon, 13 Mar 2023 21:31:35 +0000 (14:31 -0700)]
ofnode: fdt_support definitions needed if OF_CONTROL is enabled

With the use of CONFIG_IS_ENABLED in code, instead of at the preprocessor
level, these defines are still needed if OF_CONTROL is enabled.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoconfig_distro_bootcmd: remove booting environment variables from SPL environment
Troy Kisky [Mon, 13 Mar 2023 21:31:34 +0000 (14:31 -0700)]
config_distro_bootcmd: remove booting environment variables from SPL environment

SPL environments don't need commands that they can never use.
Avoid errors with CONFIG_IS_ENABLED conversions by skipping them now.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agox86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
Troy Kisky [Mon, 13 Mar 2023 21:31:33 +0000 (14:31 -0700)]
x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED

CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
would check for CONFIG_SPL_SPL_X86_32BIT_INIT for SPL builds

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocmd: nvedit: remove error check, handle with Kconfig
Troy Kisky [Mon, 13 Mar 2023 21:31:24 +0000 (14:31 -0700)]
cmd: nvedit: remove error check, handle with Kconfig

Avoid error messages when SPL,TPL,VPL build don't
have the environment options of the main build.
This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed
to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
14 months agoMerge branch 'master' into next
Tom Rini [Mon, 8 May 2023 18:31:04 +0000 (14:31 -0400)]
Merge branch 'master' into next

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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)

14 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>
14 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>
14 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>
14 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>
14 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.

14 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.

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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
14 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
14 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
14 months agoarm: dts: fsl-ls1088a: move and sync existing bindings to be under /soc
Mathew McBride [Wed, 12 Apr 2023 07:38:27 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: move and sync existing bindings to be under /soc

Our [U-Boot] copy of fsl-ls1088a.dtsi had all the hardware under
the top level, until the DM_SERIAL implementation recently.

In this commit, remove any remaining devices (that were in U-Boot,
but not touched by previous patches in this series) to be under /soc,
updating to their upstream (Linux) bindings.

The bindings have been copied closest to their relative positions
in the Linux version, so the eventual result is that the U-Boot
and Linux fsl-ls1088a.dtsi will be identical.

The next commit will add the hardware bindings that were not
in U-Boot.

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
14 months agoarm: dts: fsl-ls1088a: syncronise fsl-mc definition with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:26 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: syncronise fsl-mc definition with Linux

This moves the fsl-mc device tree definition under the /soc
node, as well as adding interrupt and IOMMU definitions that
were not in U-Boot before.

There are slight differences between the two bindings
as we add a "simple-mfd" compatible to function
under U-Boot's driver model.

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
14 months agoarm: dts: fsl-ls1088a: syncronise MDIO+PCS U-Boot definitions with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:25 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: syncronise MDIO+PCS U-Boot definitions with Linux

Synchronise the MDIO controller definitions with Linux, so
the controllers will be usable when passing U-Boot's
control FDT to Linux.

This also adds the PCS (internal controller) definitions
which are not used by U-Boot.

Caveat: The kernel definition uses "fsl,fman-memac-mdio",
as with other members of the Layerscape family, but
U-Boot uses a different driver for the DPAA2
Family devices (LS1088/LS2088/LX2160). So
we use "fsl,ls-mdio" as the first compatible string
for these devices.

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
14 months agoarm: dts: fsl-ls1088a: sync usb controller nodes with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:24 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: sync usb controller nodes with Linux

Synchronise the USB device tree definition with Linux, allowing
the U-Boot control FDT to be used to boot a Linux system with
working USB.

An extra compatible string, "fsl,layerscape-dwc3" is needed
for special handling in U-Boot, so has been added to the
-u-boot.dtsi file. It might be better to add this to the
Linux source bindings.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
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
14 months agoarm: dts: fsl-ls1088a: move I2C nodes under "soc" and syncronize with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:23 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: move I2C nodes under "soc" and syncronize with Linux

U-Boot's definition for the I2C controllers did not contain any
clock information. This resulted in the I2C not functioning when
the U-Boot control FDT was passed to 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
14 months agoarm: dts: fsl-ls1088a: move GPIO controller under "soc" per Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:22 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: move GPIO controller under "soc" per Linux

Move the GPIO controller definitions under the "soc" and in
the same relative position as the Linux kernel fsl-ls1088a.dtsi.

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
14 months agoarm: dts: fsl-ls1088a: import CPU definition from Linux kernel
Mathew McBride [Wed, 12 Apr 2023 07:38:21 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: import CPU definition from Linux kernel

This is required for Linux to boot using the same FDT as
U-Boot (such as passing the control FDT to bootefi).

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
14 months agoarm: dts: fsl-ls1088a: match Linux FDT by disabling PCIe by default
Mathew McBride [Wed, 12 Apr 2023 07:38:20 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: match Linux FDT by disabling PCIe by default

The Linux kernel fsl-ls1088a.dtsi disables (status="disabled")
all PCIe controllers by default, with the bootloader (i.e U-Boot)
enabling the appropriate controllers (specified by the board
reset control word/RCW) by FDT fixup.

However, U-Boot needs these controllers to be enabled
to be usable, which we can add in the u-boot only dtsi.

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
14 months agoarm: dts: fsl-ls1088a: sync PCIe controller definition with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:19 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: sync PCIe controller definition with Linux

This moves the PCIe controller definitions under /soc and adopts
the same bindings (fsl,ls1088a-pcie) as Linux. Previously,
the format was different between the two versions.

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
14 months agoarm: dts: fsl-ls1088a: import and sync full SMMU nodes with Linux
Mathew McBride [Wed, 12 Apr 2023 07:38:18 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: import and sync full SMMU nodes with Linux

To synchronise the device tree in U-Boot with Linux, the GIC
(Interrupt Controller) and SMMU/IOMMU nodes need to be synchronised
before changing any dependent components like PCIe and DPAA2/fsl-mc.

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
14 months agopci: layerscape: add support for kernel/official fsl, ls1088a-pcie binding
Mathew McBride [Wed, 12 Apr 2023 07:38:17 +0000 (07:38 +0000)]
pci: layerscape: add support for kernel/official fsl, ls1088a-pcie binding

This allows the Layerscape PCIe RC driver to use the upstream
style binding (two "reg" entries instead of four).

It is similar to the previous commit e10da1f985ad
("pci: layerscape: add official ls1028a binding support")
which implemented this for the LS1028A.

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
14 months agoarm: dts: fsl-ls1088a: move memory node into U-Boot specific file
Mathew McBride [Wed, 12 Apr 2023 07:38:16 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: move memory node into U-Boot specific file

The top-level "memory" node does not exist in the Linux
version of the fsl-ls1088a.dtsi file. Move it to the U-Boot
"tweak" file, so we can have an identical copy of
fsl-ls1088a.dtsi between the projects in the end.

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
14 months agoarm: dts: fsl-ls1088a: move u-boot bootph tags into u-boot only files
Mathew McBride [Wed, 12 Apr 2023 07:38:15 +0000 (07:38 +0000)]
arm: dts: fsl-ls1088a: move u-boot bootph tags into u-boot only files

This moves the bootph-all tags that were added in commit a593c1fec579
("arch: arm: dts: fsl-ls1088a.dtsi: tag serial nodes with bootph-all")
into a u-boot only include.

Due to the way the U-Boot device tree "tweak" system is setup[1],
we need to have a per-board <boardname>-u-boot.dtsi, which will
include the "fsl-ls1088a-u-boot.dtsi" tweaks.

By doing so, future updates to fsl-ls1088a.dtsi from upstream
(Linux kernel) can just be copied directly into the U-Boot tree,
without worrying about any extra data local to U-Boot.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] - https://u-boot.readthedocs.io/en/latest/develop/devicetree/control.html#adding-tweaks-for-u-boot
The CONFIG_SYS_SOC, CONFIG_SYS_CPU and CONFIG_SYS_VENDOR
values are the same for the entire Layerscape family,
meaning there is no ability to create a LS1088A only
file here. But we will be adding per-board tweaks
later in any case.
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
14 months agoconfigs: ten64: enable DM_SERIAL
Mathew McBride [Wed, 12 Apr 2023 07:38:14 +0000 (07:38 +0000)]
configs: ten64: enable DM_SERIAL

The recent series "Convert LS1088A and LX2160 to DM_SERIAL"
from Ioana Ciornei provided the necessary support to enable
DM_SERIAL on the Ten64 board (LS1088A).

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@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
14 months agoarmv8: fsl-layerscape: check for crypto node first in fdt_fixup_remove_jr
Mathew McBride [Wed, 12 Apr 2023 07:38:13 +0000 (07:38 +0000)]
armv8: fsl-layerscape: check for crypto node first in fdt_fixup_remove_jr

This a problem I found while updating the U-Boot fsl-ls1088a.dtsi
to match the Linux version.

fdt_fixup_remove_jr did not check whether there was a "crypto"
alias in the device tree before calling more fdt_* functions,
which resulted in a crash.

Fixes: a797f274
("ARMv8/sec_firmware : Update chosen/kaslr-seed with random number")

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
14 months agoMerge branch '2023-05-04-assorted-TI-updates'
Tom Rini [Fri, 5 May 2023 00:57:59 +0000 (20:57 -0400)]
Merge branch '2023-05-04-assorted-TI-updates'

- Clean up / merge some defconfigs, update DDR timings and a few more
  assorted fixes.

14 months agoarm: dts: k3-j7200: ddr: Update to 0.6 version of DDR config tool
Neha Malcom Francis [Tue, 25 Apr 2023 13:09:28 +0000 (18:39 +0530)]
arm: dts: k3-j7200: ddr: Update to 0.6 version of DDR config tool

Update the DDR settings to those generated using 0.6 version of
Jacinto 7 DDRSS Register Configuration tool.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
14 months agoarm: dts: k3-j721e: ddr: Update to 0.9.1 version of DDR config tool
Neha Malcom Francis [Tue, 25 Apr 2023 13:09:27 +0000 (18:39 +0530)]
arm: dts: k3-j721e: ddr: Update to 0.9.1 version of DDR config tool

Update the DDR settings to those generated using 0.9.1 version of
Jacinto 7 DDRSS Register Configuration tool.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
14 months agoconfigs: j7200: Merge the HS and non-HS defconfigs
Manorit Chawdhry [Thu, 4 May 2023 05:37:08 +0000 (11:07 +0530)]
configs: j7200: Merge the HS and non-HS defconfigs

K3 devices have runtime type board detection. Make the default defconfig
include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection.
If TI_SECURE_DEV_PKG is not set the build will emit warnings, for non-HS
devices these can be ignored.

Reviewed-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
14 months agoKconfig: j721s2: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region
Manorit Chawdhry [Thu, 4 May 2023 05:37:07 +0000 (11:07 +0530)]
Kconfig: j721s2: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

On K3 HS-SE devices all the firewalls are locked by default
until sysfw comes up. Rom configures some of the firewall for its usage
along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721s2 was set to a PSRAM region triggering the
firewall exception before sysfw came up. The exception started happening
after adding multi dtb support that accesses the scratchpad for reading
EEPROM contents.

Old map:
┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c61f20 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c65f20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c66000
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x10000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41c76000)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ (0x41c80000)
│               DM DATA               │
├─────────────────────────────────────┤ (0x41c84130) (approx)
│                EMPTY                │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
        (0x41cffbfc)

New map:
┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c61f20 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c65f20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c66000
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x10000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41c76000)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ (0x41c80000)
│               DM DATA               │
├─────────────────────────────────────┤ (0x41c84130) (approx)
│                EMPTY                │
├─────────────────────────────────────┤ SYS_K3_MCU_SCRATCHPAD_BASE
│              SCRATCHPAD             │ (0x41cff9fc)
│ SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200  │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
        (0x41cffbfc)

Reviewed-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
14 months agoconfigs: j721s2: Merge the HS and non-HS defconfigs
Manorit Chawdhry [Thu, 4 May 2023 05:37:06 +0000 (11:07 +0530)]
configs: j721s2: Merge the HS and non-HS defconfigs

K3 devices have runtime type board detection. Make the default defconfig
include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection.
If TI_SECURE_DEV_PKG is not set the build will emit warnings, for non-HS
devices these can be ignored.

Reviewed-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
14 months agoarm: dts: iot2050: Include u-boot specific bits implicitly
Jan Kiszka [Tue, 25 Apr 2023 19:28:23 +0000 (21:28 +0200)]
arm: dts: iot2050: Include u-boot specific bits implicitly

Create *-u-boot.dtsi files for each target dtb of the IOT2050 series so
that we can drop the #include deviations from upstream dts[i] files
here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
14 months agoenvironment: ti: Add get_fit_config command to get FIT config string
Andrew Davis [Tue, 25 Apr 2023 16:20:45 +0000 (11:20 -0500)]
environment: ti: Add get_fit_config command to get FIT config string

When OE is packaging a dtb file into the FIT image it names the node based
on the dtb filename. Node names can't have "/" so it is turned into "_".
We select our FIT config using the "fdtfile" env var so we don't duplicate
the board_name to fdt logic. Result is fdtfile needs mangled when used to
select a config node from OE made FIT image. Do this here.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
14 months agoconfigs: am62x: enable secure device configs by default
Praneeth Bajjuri [Wed, 5 Apr 2023 22:40:47 +0000 (17:40 -0500)]
configs: am62x: enable secure device configs by default

Enable the CONFIG_TI_SECURE_DEVICE by default

Non-HS devices will continue to boot due to runtime device type detection.

TI's security enforcing SoCs will authenticate each binary it loads by
comparing it's signature with keys etched into the SoC during the boot
up process. The am62x family of SoCs by default will have some level of
security enforcement checking. To keep things as simple as possible,
enable the CONFIG_TI_SECURE_DEVICE options by default so all levels of
secure SoCs will work out of the box

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
14 months agok3: pmic: Clear ESM masks
Neha Malcom Francis [Wed, 5 Apr 2023 10:54:35 +0000 (16:24 +0530)]
k3: pmic: Clear ESM masks

ESM MCU masks must be set to 0h so that PMIC can handle errors
that require attention for example SYS_SAFETY_ERRn. The required bits
must be cleared: ESM_MCU_RST_MASK, ESM_MCU_FAIL_MASK, ESM_MCU_PIN_MASK.

If PMIC expected to handle errors, make sure EVM is configured to
connect SOC_SAFETY_ERRz (Main) to the PMIC.

Note that even though the User Guide for TPS65941 for J721E mentions
that these bits are reset to 0h; it is not reflected once board boots to
kernel, possibly due to NVM configurations. Eithercase, it is best to
account for this from R5 SPL side as well.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
14 months agoMerge branch '2023-05-03-assorted-updates-and-fixes'
Tom Rini [Thu, 4 May 2023 15:49:30 +0000 (11:49 -0400)]
Merge branch '2023-05-03-assorted-updates-and-fixes'

- Various typo fixes, pass -Werror to host tools builds, bdi cleanups,
  fix hush and local variables, a FSL PCI fix and correct some python in
  one of the tests.

14 months agoMerge tag 'efi-2023-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 4 May 2023 13:03:02 +0000 (09:03 -0400)]
Merge tag 'efi-2023-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-07-rc2

Documentation:

* treat documentation warnings as errors in CI
* adjust StarFive VisionFive 2 and SiFive Unmatched documentation
* man-page for cp
* correct description of uclass_get_device_by_of_path
* correct proftool usage

UEFI

* Fix documentation of EFI Python tests
* Rename efi_selftest Python test

14 months agopowerpc: mpc8xx: Reorganise init RAM
Christophe Leroy [Thu, 4 May 2023 08:20:35 +0000 (10:20 +0200)]
powerpc: mpc8xx: Reorganise init RAM

Using SMC relocation microcode patch or USB-SOF microcode patch
will disable DPRAM memory from 0x2000 to 0x2400 and from 0x2f00
to 0x3000.

At the time being, init RAM is setup to use 0x2800-0x2e00, but
the stack pointer goes beyond 0x2800 and even beyond 0x2400.

For the time being we are not going to use any microcode patch
that uses memory about 0x3000, so reorganise setup to use:
- 0x2800 - 0x2e00 for init malloc and global data and CPM buffers
- 0x3000 - 0x3c00 for init stack

For more details about CPM dual port ram, see
commit b1d62424cb ("powerpc: mpc8xx: redistribute data in CPM dpram")

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
14 months agoCI: treat documentation warnings as errors
Heinrich Schuchardt [Tue, 2 May 2023 03:04:11 +0000 (05:04 +0200)]
CI: treat documentation warnings as errors

We do not want to merge documentation that produces Sphinx warnings.

scripts/kernel-doc uses environment variable KDOC_WERROR to determine
if warnings should be treated as errors.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agopowerpc: mpc8xx: CPM parameter RAM can be anywhere
Christophe Leroy [Wed, 3 May 2023 08:31:19 +0000 (10:31 +0200)]
powerpc: mpc8xx: CPM parameter RAM can be anywhere

With relocation, CPM parameter RAM can be anywhere in the
dual port RAM, so don't split dual port RAM.

Remove dparam and dparam16 members of struct comm_proc

PROFF_XXX become offsets from the start of dual port RAM,
then they are now consistant with the offsets in RPBASE
registers.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
14 months agoboard: cssi: Load CMPC885's motherboard FPGA earlier
Christophe Leroy [Wed, 3 May 2023 06:38:16 +0000 (08:38 +0200)]
board: cssi: Load CMPC885's motherboard FPGA earlier

In order to know the motherboard type earlier, perform I/O ports
initialisation and FPGA loading in board_early_init_f() instead
of board_early_init_r().

This is needed to be able to load mpc8xx CPM microcode base on
motherboard type and before starting to use the CPM.

Console is not available yet so remove the printfs.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
14 months agoboard: cssi: Remove stale macro from cmpcpro.c
Christophe Leroy [Wed, 3 May 2023 06:21:46 +0000 (08:21 +0200)]
board: cssi: Remove stale macro from cmpcpro.c

Three unused macros were left over. Remove them.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
14 months agoboard: cssi: Remove duplicated FPGA loading sequence on CMPC885
Christophe Leroy [Wed, 3 May 2023 05:46:20 +0000 (07:46 +0200)]
board: cssi: Remove duplicated FPGA loading sequence on CMPC885

A duplicated FPGA loading sequence appears after FPGA reset.

Remove it.

Fixes: dac3c6f625 ("board: cssi: Add new board MCR3000_2G")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
14 months agoefi: Rename the base efi self-test
Simon Glass [Wed, 19 Apr 2023 23:38:16 +0000 (11:38 +1200)]
efi: Rename the base efi self-test

This function uses the same base name as all the others in this file, so
it is not easy to run just that one test. Add a _base suffix so that it
can be run on its own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>