]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
3 years agotools: kwboot: Make the quit sequence buffer const
Marek Behún [Fri, 24 Sep 2021 21:06:40 +0000 (23:06 +0200)]
tools: kwboot: Make the quit sequence buffer const

This buffer is never written to. Make it const.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Fix buffer overflow in kwboot_terminal()
Marek Behún [Fri, 24 Sep 2021 21:06:39 +0000 (23:06 +0200)]
tools: kwboot: Fix buffer overflow in kwboot_terminal()

The `in` variable is set to -1 in kwboot_terminal() if stdin is not a
tty. In this case we should not look whether -1 is set in fd_set, for it
can lead to a buffer overflow, which can be reproduced with
  echo "xyz" | ./tools/kwboot -t /dev/ttyUSB0

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwbimage: Fix printf format warning
Marek Behún [Fri, 24 Sep 2021 21:06:38 +0000 (23:06 +0200)]
tools: kwbimage: Fix printf format warning

On 32-bit ARM the compiler complains:
  tools/kwbimage.c:547: warning: format ‘%lu’ expects argument of type
                                 ‘long unsigned int’, but argument 4 has
                 type ‘unsigned int’

Fix this by using %zu instead of %lu format specifier.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoAzure/GitLab CI: Update docker image
Tom Rini [Thu, 30 Sep 2021 15:36:10 +0000 (11:36 -0400)]
Azure/GitLab CI: Update docker image

Rebuild our current docker image so that ca-certificates will be updated
and Let's Encrypt issued certificates will work again.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'xilinx-for-v2022.01-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 30 Sep 2021 15:29:41 +0000 (11:29 -0400)]
Merge tag 'xilinx-for-v2022.01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2022.01-rc1

zynq:
- Enable capsule update for qspi and mmc
- Update zed DT qspi compatible string

zynqmp:
- Add missing modeboot for EMMC
- Add missing nand DT properties
- List all eeproms for SC on vck190
- Add vck190 SC psu_init

clk:
- Handle only GATE type clock for Versal

watchdog:
- Update versal driver to handle system reset

3 years agoMerge branch '2021-09-30-whitespace-cleanups' into next
Tom Rini [Thu, 30 Sep 2021 14:26:43 +0000 (10:26 -0400)]
Merge branch '2021-09-30-whitespace-cleanups' into next

- A large number of whitespace cleanups from Wolfgang

3 years agoWS cleanup: remove SPACE(s) followed by TAB
Wolfgang Denk [Mon, 27 Sep 2021 15:42:39 +0000 (17:42 +0200)]
WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>
3 years agoWS cleanup: remove trailing white space
Wolfgang Denk [Mon, 27 Sep 2021 15:42:38 +0000 (17:42 +0200)]
WS cleanup: remove trailing white space

Signed-off-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoWS cleanup: remove excessive empty lines
Wolfgang Denk [Mon, 27 Sep 2021 15:42:37 +0000 (17:42 +0200)]
WS cleanup: remove excessive empty lines

Signed-off-by: Wolfgang Denk <wd@denx.de>
3 years agoWS cleanup: remove trailing empty lines
Wolfgang Denk [Mon, 27 Sep 2021 15:42:36 +0000 (17:42 +0200)]
WS cleanup: remove trailing empty lines

Signed-off-by: Wolfgang Denk <wd@denx.de>
3 years agowatchdog: versal: Add support for expire now
Ashok Reddy Soma [Tue, 28 Sep 2021 06:01:59 +0000 (11:31 +0530)]
watchdog: versal: Add support for expire now

Wdt expire command makes the wdt to count least possible ticks(1)
and expires immediately. Add expire_now option to the xlnx_wwdt_ops
and implement it by calling xlnx_wwdt_start() with minimum possible
count(1).

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/1632808919-8600-3-git-send-email-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agowatchdog: versal: Add support for basic window watchdog
Ashok Reddy Soma [Tue, 28 Sep 2021 06:01:58 +0000 (11:31 +0530)]
watchdog: versal: Add support for basic window watchdog

Existing driver uses generic watchdog mode which generates a signal to
PLM firmware, but the signal cannot be used to reset the system.

Change driver to use window watchdog basic mode. This window watchdog mode
generates a signal to PLM firmware which decides what action to take upon
expiry of watchdog.

Timeout value for xlnx_wwdt_start will come in milli seconds from wdt
framework. Make changes to load count value accordingly.

Add checks before loading the timer for min and max possible values.

Fix authour email id of Ashok Reddy Soma to long email id.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/1632808919-8600-2-git-send-email-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoclk: versal: Enable only GATE type clocks
T Karthik Reddy [Tue, 28 Sep 2021 06:00:27 +0000 (11:30 +0530)]
clk: versal: Enable only GATE type clocks

Clocks should be enabled or disabled only if they are of GATE type
clocks. If they are not of GATE type clocks, don't touch them.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/1632808827-6109-1-git-send-email-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoarm64: zynqmp: Add psu_init_gpl for vck190/vmk180 SC
Michal Simek [Fri, 24 Sep 2021 13:06:18 +0000 (15:06 +0200)]
arm64: zynqmp: Add psu_init_gpl for vck190/vmk180 SC

Add psu_init_gpl file for getting SPL to work directly from the tree.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/6675723ad52d29982e62c6ca4832ed18688076cb.1632488774.git.michal.simek@xilinx.com
3 years agoarm64: zynqmp: Define all eeproms for SC on vck190
Michal Simek [Fri, 24 Sep 2021 13:04:57 +0000 (15:04 +0200)]
arm64: zynqmp: Define all eeproms for SC on vck190

There are multiple eeproms on vck190 that's why list all of them.
FMC eeproms are present only when fmcs are plugged.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/96902661e3ab9e20b59d626e6129ccf6f3317c4d.1632488695.git.michal.simek@xilinx.com
3 years agoarm: zynq: Use s25fl256s1 compatible string on zedboard
Michal Simek [Wed, 15 Sep 2021 14:22:31 +0000 (16:22 +0200)]
arm: zynq: Use s25fl256s1 compatible string on zedboard

Use compatible string which is listed in the Linux kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/49bc6b056b0f6f69d4d90351dc875a66b7e37619.1631715748.git.michal.simek@xilinx.com
3 years agoarm64: zynqmp: Add device tree properties for nand flash
Amit Kumar Mahapatra [Wed, 15 Sep 2021 13:46:36 +0000 (15:46 +0200)]
arm64: zynqmp: Add device tree properties for nand flash

Add ecc strength & ecc step size properties for nand flash devices,
when operating in software-ecc mode.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/866f4b888129ff0213df9cdb51b5529b199fb7b7.1631713594.git.michal.simek@xilinx.com
3 years agoxilinx: zynqmp: Set modeboot env variable in eMMC bootmode
Ashok Reddy Soma [Wed, 15 Sep 2021 06:52:17 +0000 (08:52 +0200)]
xilinx: zynqmp: Set modeboot env variable in eMMC bootmode

Set environment variable modeboot to "emmcboot" in case of eMMC boot
mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/c61231e4b8c6118862dfc82e923211637bf29991.1631688736.git.michal.simek@xilinx.com
3 years agoARM: zynq: Enable capsule update for qspi and mmc
Michal Simek [Fri, 27 Aug 2021 10:53:32 +0000 (12:53 +0200)]
ARM: zynq: Enable capsule update for qspi and mmc

Generate dfu_alt_info setup at runtime for capsule update.
Enabling this feature will help with upgrading boards without remembering
what is where.

The similar change was done for ZynqMP by commit b17d9e575811 ("xilinx:
zynqmp: Add support for runtime dfu_alt_info setup").
Code needs to be enabled by CONFIG_SET_DFU_ALT_INFO.

And also enable capsule on disk for RAW firmware images with efidebug
command.

Two indexes are supported for SPL flow. Images can be generated like:
./tools/mkeficapsule --raw spl/boot.bin --index 1 capsule1.bin
./tools/mkeficapsule --raw u-boot.img --index 2 capsule2.bin

Then place them to SD card and load them:
load mmc 0 10000000 capsule1.bin && efidebug capsule update -v 10000000
load mmc 0 10000000 capsule2.bin && efidebug capsule update -v 10000000

FSBL flow will also work where only index 1 capsule is used. There
should be enough space for using boot.bin with bitstream too.

Zynq also support multiple boot locations in SPI or MMC but it is not wired
by this patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/bea5fc75a87a5971f118b46bab4aa7ca39a629c6.1630061610.git.michal.simek@xilinx.com
3 years agoMerge tag 'rpi-next-2021.10.2' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 29 Sep 2021 19:13:35 +0000 (15:13 -0400)]
Merge tag 'rpi-next-2021.10.2' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi

- fix usb stopt; usb start; bug
- update Nicolas email address

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 29 Sep 2021 19:13:11 +0000 (15:13 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Armada8k: Fix CP0 eMMC/SDIO support (Robert)

3 years agoarm: rpi: perform XHCI firmware upload only once
Marek Szyprowski [Fri, 17 Sep 2021 08:19:43 +0000 (10:19 +0200)]
arm: rpi: perform XHCI firmware upload only once

XHCI firmware upload must be performed only once after initializing the
PCI bridge. This fixes USB stack initialization after calling "usb stop;
usb start" on Raspberry Pi 4B.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agomailmap: Update mail address for Nicolas Saenz julienne
Nicolas Saenz Julienne [Thu, 16 Sep 2021 09:55:48 +0000 (11:55 +0200)]
mailmap: Update mail address for Nicolas Saenz julienne

The @suse.de address doesn't exist anymore. Update it to something not
dependent on my workplace.

Signed-off-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agoMerge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 29 Sep 2021 11:58:20 +0000 (07:58 -0400)]
Merge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot-net into next

- Fix some non-NULL terminated strings in the networking subsystem
- net: tsec: Mark tsec_get_interface as __maybe_unused

3 years agoarm: dts: armada8040: Fix CP0 eMMC/SDIO support
Robert Marko [Mon, 27 Sep 2021 21:03:26 +0000 (23:03 +0200)]
arm: dts: armada8040: Fix CP0 eMMC/SDIO support

During the migration to a single DTSI for the CP110-s specific pinctrl
compatibles were moved to the SoC DTSI as CP0 and CP1 have some specifics.
Namely, CP0 eMMC/SDIO support depends on the mvebu-pinctrl driver setting
the BIT(0) in eMMC PHY IO Control 0 Register to 0 in order for the connect
the eMMC/SDIO PHY to the controller and not use it as a MPP pin multiplexor.

So, the mvebu-pinctrl driver check specifically for the
"marvell,armada-8k-cpm-pinctrl" compatible to clear the that bit.

Issue is that compatibles in the 8040 DTSI were set to "marvell,8k-cpm-pinctrl"
for CP0 and "marvell,8k-cps-pinctrl" for the CP1.
This is obviously incorrect as the pinctrl driver does not know about these.

So fix the regression by applying correct compatibles to the DTSI.
Regression found and tested on the Puzzle M801 board.

Fixes: fe9f65f8 ("arm: armada: dts: Use a single dtsi for cp110 die description")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoMerge branch '2021-09-25-TI-platform-updates' into next
Tom Rini [Tue, 28 Sep 2021 23:18:56 +0000 (19:18 -0400)]
Merge branch '2021-09-25-TI-platform-updates' into next

- Start moving some TI board docs to rST
- Assorted TI-specific Kconfig migrations and namespace cleanups.  This
  also allows for some code cleanups.

3 years agoMerge tag '20210928-for-next' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 28 Sep 2021 20:36:25 +0000 (16:36 -0400)]
Merge tag '20210928-for-next' of https://source.denx.de/u-boot/custodians/u-boot-i2c into next

i2c changes for 20210928-for-next

- i2c: rcar_i2c: Enable configuring SCL rise and fall times
- i2c: mvtwsi: Add support for DM clocks and resets
- mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

3 years agoMerge branch '2021-09-28-regression-fixes'
Tom Rini [Tue, 28 Sep 2021 17:57:56 +0000 (13:57 -0400)]
Merge branch '2021-09-28-regression-fixes'

- Reintroduce creating internally the "nor%d" style names, in order to
  fix some use U-Boot use-cases involving the "mtd" command.
- Fix a regression over the default SPI bus mode shown by having the
  compiled default actually start being used.  The correct default here
  is 0.
- Fix ethernet on imx7d-sdb
- Fix a regression with MTD NAND devices when OF_LIVE is enabled

3 years agoimx: imx7d-sdb: fix ethernet, sync .dts with linux
Rasmus Villemoes [Thu, 16 Sep 2021 14:53:14 +0000 (16:53 +0200)]
imx: imx7d-sdb: fix ethernet, sync .dts with linux

Commit b26427710 (mx7dsabre: Enable DM_ETH) changed these flags from 0
(aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
device tree with v5.5-rc1", but in the linux tree, these gpios have
always been GPIO_ACTIVE_HIGH ever since this node was introduced
around v4.13 (linux commit 184f39b5).

I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
around the behaviour of the soft-spi driver back then, which
effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
in the soft-spi driver, which then got fixed in 273f0c91bd9 (spi: add
support for all spi modes with soft spi), but that commit then broke
ethernet on this board.

Fix it by setting the gpios as active high, which as a bonus actually
brings us in sync with the .dts in the linux source tree.

Without this, one gets

    Net:   Could not get PHY for FEC0: addr 0
    No ethernet found.

With this, ethernet (at least ping and tftp) works as expected from
the U-Boot shell.

Cc: Fabio Estevam <festevam@gmail.com>
Cc: Joris Offouga <offougajoris@gmail.com>
Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agomtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface
Patrice Chotard [Mon, 13 Sep 2021 14:25:53 +0000 (16:25 +0200)]
mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agomtd: spi: Set CONFIG_SF_DEFAULT_MODE default to 0
Marek Vasut [Tue, 14 Sep 2021 18:28:24 +0000 (20:28 +0200)]
mtd: spi: Set CONFIG_SF_DEFAULT_MODE default to 0

Before aa8f2d0127f ("spi: Update speed/mode on change") most systems
silently defaulted to SF bus mode 0. Now the mode is always updated,
which causes breakage. It seems most SF which are used as boot media
operate in bus mode 0, so switch that as the default.

This should fix booting at least on Altera SoCFPGA, ST STM32, Xilinx
ZynqMP, NXP iMX and Rockchip SoCs, which recently ran into trouble
with mode 3. Marvell Kirkwood and Xilinx microblaze need to be checked
as those might need mode 3.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
Cc: Andreas Biessmann <andreas@biessmann.org>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
3 years agomtd: spi: nor: force mtd name to "nor%d"
Patrick Delaunay [Wed, 22 Sep 2021 16:29:08 +0000 (18:29 +0200)]
mtd: spi: nor: force mtd name to "nor%d"

Force the mtd name of spi-nor to "nor" + the driver sequence number:
"nor0", "nor1"... beginning after the existing nor devices.

This patch is coherent with existing "nand" and "spi-nand"
mtd device names.

When CFI MTD NOR device are supported, the spi-nor index is chosen after
the last CFI device defined by CONFIG_SYS_MAX_FLASH_BANKS.

When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated, this config
is replaced by to cfi_flash_num_flash_banks in the include file
mtd/cfi_flash.h.

This generic name "nor%d" can be use to identify the mtd spi-nor device
without knowing the real device name or the DT path of the device,
used with API get_mtd_device_nm() and is used in mtdparts command.

This patch also avoids issue when the same NOR device is present 2 times,
for example on STM32MP15F-EV1:

STM32MP> mtd list
SF: Detected mx66l51235l with page size 256 Bytes, erase size 64 KiB, \
total 64 MiB

List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x40000 bytes
  - min I/O: 0x1000 bytes
  - OOB size: 224 bytes
  - OOB available: 118 bytes
  - ECC strength: 8 bits
  - ECC step size: 512 bytes
  - bitflip threshold: 6 bits
  - 0x000000000000-0x000040000000 : "nand0"
* mx66l51235l
  - device: mx66l51235l@0
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@0
  - type: NOR flash
  - block size: 0x10000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "mx66l51235l"
* mx66l51235l
  - device: mx66l51235l@1
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@1
  - type: NOR flash
  - block size: 0x10000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "mx66l51235l"

The same mtd name "mx66l51235l" identify the 2 instances
mx66l51235l@0 and mx66l51235l@1.

This patch fixes a ST32CubeProgrammer / stm32prog command issue
with nor0 target on STM32MP157C-EV1 board introduced by
commit e17dc9227c70 ("mtd: spi-nor: allow registering multiple MTDs when
DM is enabled").

Fixes: e17dc9227c70 ("mtd: spi-nor: allow registering multiple MTDs when DM is enabled")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
[trini: Add <dm/device.h> to <mtd.h> for DM_MAX_SEQ_STR]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoscripts: ensure the cocci script for miiphy_register does not leak the MDIO bus
Vladimir Oltean [Mon, 27 Sep 2021 11:22:05 +0000 (14:22 +0300)]
scripts: ensure the cocci script for miiphy_register does not leak the MDIO bus

When mdio_register fails, mdio_free should be called on the mdiodev that
was previously allocated with mdio_alloc.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
3 years agoarch: powerpc: mpc85xx: free MDIO bus if mdio_register fails
Vladimir Oltean [Mon, 27 Sep 2021 11:22:04 +0000 (14:22 +0300)]
arch: powerpc: mpc85xx: free MDIO bus if mdio_register fails

If mdio_register fails, it is nice to not leave behind dangling
allocated memory.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: ensure port names are NULL-terminated after DSA_PORT_NAME_LENGTH truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:22:03 +0000 (14:22 +0300)]
net: dsa: ensure port names are NULL-terminated after DSA_PORT_NAME_LENGTH truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass DSA_PORT_NAME_LENGTH - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: felix: check return code of mdio_alloc and mdio_register
Vladimir Oltean [Mon, 27 Sep 2021 11:22:02 +0000 (14:22 +0300)]
net: dsa: felix: check return code of mdio_alloc and mdio_register

These functions can return errors, it's best to catch them and trigger
the driver unwind code path.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoscripts: ensure the cocci script for miiphy_register does not leave NULL-unterminated...
Vladimir Oltean [Mon, 27 Sep 2021 11:22:01 +0000 (14:22 +0300)]
scripts: ensure the cocci script for miiphy_register does not leave NULL-unterminated strings

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
3 years agonet: mdio-uclass: rewrite dm_mdio_post_probe using strlcpy
Vladimir Oltean [Mon, 27 Sep 2021 11:22:00 +0000 (14:22 +0300)]
net: mdio-uclass: rewrite dm_mdio_post_probe using strlcpy

dm_mdio_post_probe used to be vulnerable after truncation, but has been
patched by commit b17d873a81c3 ("net: Fix Covarity Defect 244093").
Nonetheless, we can use strlcpy like the rest of the code base now,
which yields the same result.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: qe: uec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:59 +0000 (14:21 +0300)]
net: qe: uec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: davinci_emac: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:58 +0000 (14:21 +0300)]
net: davinci_emac: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: smc911x: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:57 +0000 (14:21 +0300)]
net: smc911x: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: sh_eth: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:56 +0000 (14:21 +0300)]
net: sh_eth: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: mvgbe: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:55 +0000 (14:21 +0300)]
net: mvgbe: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: felix: ensure mii_bus->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:54 +0000 (14:21 +0300)]
net: dsa: felix: ensure mii_bus->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: mpc8xx_fec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:53 +0000 (14:21 +0300)]
net: mpc8xx_fec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: macb: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:52 +0000 (14:21 +0300)]
net: macb: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: lpc32xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:51 +0000 (14:21 +0300)]
net: lpc32xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: ftmac110: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:50 +0000 (14:21 +0300)]
net: ftmac110: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: mcdmafec: ensure bus->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:49 +0000 (14:21 +0300)]
net: mcdmafec: ensure bus->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: enetc: ensure imdio.name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:48 +0000 (14:21 +0300)]
net: enetc: ensure imdio.name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: ep93xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:47 +0000 (14:21 +0300)]
net: ep93xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: eepro100: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:46 +0000 (14:21 +0300)]
net: eepro100: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: bcm-sf2: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:45 +0000 (14:21 +0300)]
net: bcm-sf2: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: at91_emac: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation
Vladimir Oltean [Mon, 27 Sep 2021 11:21:44 +0000 (14:21 +0300)]
net: at91_emac: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: armada100_fec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN trunc...
Vladimir Oltean [Mon, 27 Sep 2021 11:21:43 +0000 (14:21 +0300)]
net: armada100_fec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoboard: gdsys: a38x: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN trunc...
Vladimir Oltean [Mon, 27 Sep 2021 11:21:42 +0000 (14:21 +0300)]
board: gdsys: a38x: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoarch: powerpc: mpc85xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN...
Vladimir Oltean [Mon, 27 Sep 2021 11:21:41 +0000 (14:21 +0300)]
arch: powerpc: mpc85xx: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation

strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass MDIO_NAME_LEN - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen >= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: tsec: read the phy-mode property as fallback to phy-connection-type
Vladimir Oltean [Sat, 18 Sep 2021 12:46:55 +0000 (15:46 +0300)]
net: tsec: read the phy-mode property as fallback to phy-connection-type

The two should be equivalent, but at the moment some platforms
(ls1021a-tsn.dts) use phy-mode only, which is not parsed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode
Vladimir Oltean [Sat, 18 Sep 2021 12:46:54 +0000 (15:46 +0300)]
net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode

Currently the init_phy function may overwrite the priv->interface
property, since it calls tsec_get_interface which tries to determine it
dynamically based on default register values in ECNTRL.

Let's do that only if phy-connection-type happens to not be defined in
the device tree.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: felix: remove "xgmii" phy-mode
Vladimir Oltean [Sat, 18 Sep 2021 12:32:37 +0000 (15:32 +0300)]
net: dsa: felix: remove "xgmii" phy-mode

The felix driver runs only on NXP LS1028A, which most definitely does
not support the parallel 10G interface, just USXGMII, and that only up
to 2.5Gbps (toned down from 10 Gbps via symbol replication).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: enetc: remove support for "xgmii" phy-mode
Vladimir Oltean [Sat, 18 Sep 2021 12:32:36 +0000 (15:32 +0300)]
net: enetc: remove support for "xgmii" phy-mode

The enetc driver runs only on NXP LS1028A, which most definitely does
not support the parallel 10G interface, just USXGMII, and that only up
to 2.5Gbps (toned down from 10 Gbps via symbol replication).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: freescale: replace usage of phy-mode = "sgmii-2500" with "2500base-x"
Vladimir Oltean [Sat, 18 Sep 2021 12:32:35 +0000 (15:32 +0300)]
net: freescale: replace usage of phy-mode = "sgmii-2500" with "2500base-x"

After the discussion here:
https://lore.kernel.org/netdev/20210603143453.if7hgifupx5k433b@pali/

which resulted in this patch:
https://patchwork.kernel.org/project/netdevbpf/patch/20210704134325.24842-1-pali@kernel.org/

and many other discussions before it, notably:
https://patchwork.kernel.org/project/linux-arm-kernel/patch/1512016235-15909-1-git-send-email-Bhaskar.Upadhaya@nxp.com/

it became apparent that nobody really knows what "SGMII 2500" is.
Certainly, Freescale/NXP hardware engineers name this protocol
"SGMII 2500" in the reference manuals, but the PCS devices do not
support any "SGMII" specific features when operating at the speed of
2500 Mbps, no in-band autoneg and no speed change via symbol replication
. So that leaves a fixed speed of 2500 Mbps using a coding of 8b/10b
with a SERDES lane frequency of 3.125 GHz. In fact, "SGMII 2500 without
in-band autoneg and at a fixed speed" is indistinguishable from
"2500base-x without in-band autoneg", which is precisely what these NXP
devices support.

So it just appears that "SGMII 2500" is an unclear name with no clear
definition that stuck.

As such, in the Linux kernel, the drivers which use this SERDES protocol
use the 2500base-x phy-mode.

This patch converts U-Boot to use 2500base-x too, or at least, as much
as it can.

Note that I would have really liked to delete PHY_INTERFACE_MODE_SGMII_2500
completely, but the mvpp2 driver seems to even distinguish between SGMII
2500 and 2500base-X. Namely, it enables in-band autoneg for one but not
the other, and forces flow control for one but not the other. This goes
back to the idea that maybe 2500base-X is a fiber protocol and SGMII-2500
is an MII protocol (connects a MAC to a PHY such as Aquantia), but the
two are practically indistinguishable through everything except use case.

NXP devices can support both use cases through an identical configuration,
for example RX flow control can be unconditionally enabled in order to
support rate adaptation performed by an Aquantia PHY. At least I can
find no indication in online documents published by Cisco which would
point towards "SGMII-2500" being an actual standard with an actual
definition, so I cannot say "yes, NXP devices support it".

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: replace the "xfi" phy-mode with "10gbase-r"
Vladimir Oltean [Sat, 18 Sep 2021 12:32:34 +0000 (15:32 +0300)]
net: replace the "xfi" phy-mode with "10gbase-r"

As part of the effort of making U-Boot work with the same device tree as
Linux, there is an issue with the "xfi" phy-mode. To be precise, in
Linux there was a discussion (for those who have time to read:
https://lore.kernel.org/netdev/1576768881-24971-2-git-send-email-madalin.bucur@oss.nxp.com/)

which led to a patch:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=c114574ebfdf42f826776f717c8056a00fa94881

TL;DR: "xfi" was standardized in Linux as "10gbase-r".

This patch changes the relevant occurrences in U-Boot to use "10gbase-r"
instead of "xfi" wherever applicable.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: phy: genphy_init can be static
Vladimir Oltean [Sat, 18 Sep 2021 11:55:24 +0000 (14:55 +0300)]
net: phy: genphy_init can be static

To avoid a warning with W=1 about this function not having a previous
prototype, declare it as static, because it is not used outside of this
translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: remove unused variables
Vladimir Oltean [Sat, 18 Sep 2021 11:49:56 +0000 (14:49 +0300)]
net: dsa: remove unused variables

"dev" and "dsa_pdata" are unused inside dsa_port_of_to_pdata.

"dsa_priv" is unused inside dsa_port_probe.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: pass CPU port fixed PHY to .port_disable
Vladimir Oltean [Sat, 18 Sep 2021 11:49:55 +0000 (14:49 +0300)]
net: dsa: pass CPU port fixed PHY to .port_disable

While adding the logic for DSA to register a fixed-link PHY for the CPU
port, I forgot to pass it to the .port_disable method too, just
.port_enable.

Bug had no impact for felix_switch.c, due to the phy argument not being
used, but ksz9477.c does use it => NULL pointer dereference.

Fixes: 30f394f4206c ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: update NXP copyright text
Vladimir Oltean [Fri, 17 Sep 2021 11:27:13 +0000 (14:27 +0300)]
net: update NXP copyright text

NXP Legal insists that the following are not fine:

- Saying "NXP Semiconductors" instead of "NXP", since the company's
  registered name is "NXP"

- Putting a "(c)" sign in the copyright string

- Putting a comma in the copyright string

The only accepted copyright string format is "Copyright <year-range> NXP".

This patch changes the copyright headers in the networking files that
were sent by me, or derived from code sent by me.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: felix: propagate the error code from phy_startup()
Vladimir Oltean [Tue, 24 Aug 2021 12:00:43 +0000 (15:00 +0300)]
net: dsa: felix: propagate the error code from phy_startup()

Make sure that the link status returned by phy_startup() is propagated
to the .start() method of struct eth_ops.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: dsa: felix: call phy_config at .port_probe() time
Vladimir Oltean [Tue, 24 Aug 2021 12:00:42 +0000 (15:00 +0300)]
net: dsa: felix: call phy_config at .port_probe() time

It is an unfortunate reality that some PHY settings done by U-Boot
persist even after the PHY is reset and taken over by Linux, and even
more unfortunate that Linux has come to depend on things being set in a
certain way.

For example, on the NXP LS1028A-RDB, the felix switch ports are
connected to a VSC8514 QSGMII PHY. Between the switch port PCS and the
PHY, the U-Boot drivers enable in-band auto-negotiation which makes the
copper-side negotiated speed and duplex be transmitted from the PHY to
the MAC automatically.

The PHY driver portion that does this is in vsc8514_config():

/* Enable Serdes Auto-negotiation */
phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS,
  PHY_EXT_PAGE_ACCESS_EXTENDED3);
val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_MAC_SERDES_CON);
val = val | MIIM_VSC8574_MAC_SERDES_ANEG;
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_MAC_SERDES_CON, val);

The point is that in-band autoneg should be turned on in both the PHY
and the MAC, or off in both the PHY and the MAC, otherwise the QSGMII
link will be broken.

And because phy_config() is currently called at .port_enable() time, the
result is that ports on which traffic has been sent in U-Boot will have
in-band autoneg enabled, and the rest won't.

It can be argued that the Linux kernel should not assume one way or
another and just reinitialize everything according to what it expects,
and that is completely fair. In fact, I've already started an attempt to
remove this dependency, although admittedly I am making slow progress at
it:
https://patchwork.kernel.org/project/netdevbpf/cover/20210212172341.3489046-1-olteanv@gmail.com/

Nonetheless, the sad reality is that NXP also has, apart from kernel
drivers, some user space networking (DPDK), and for some reason, the
expectation there is that somebody else initializes the PHYs. The kernel
can't do it because the device ownership doesn't belong to the kernel,
so what remains is for the bootloader to do it (especially since other
drivers generally call phy_config() at probe time). This is a really
weak guarantee that might break at any time, but apparently that is
enough for some.

Since initializing the ports and PHYs at probe time does not break
anything, we can just do that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: dsa: introduce a .port_probe() method in struct dsa_ops
Vladimir Oltean [Tue, 24 Aug 2021 12:00:41 +0000 (15:00 +0300)]
net: dsa: introduce a .port_probe() method in struct dsa_ops

Some drivers might want to execute code for each port at probe time, as
opposed to executing code just-in-time for the port selected for
networking.

To cater to that use case, introduce a .port_probe() callback method
into the DSA switch operations which is called for each available port,
at the end of dsa_port_probe().

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: dsa: refactor the code to set the port MAC address into a dedicated function
Vladimir Oltean [Tue, 24 Aug 2021 12:00:40 +0000 (15:00 +0300)]
net: dsa: refactor the code to set the port MAC address into a dedicated function

This snippet of code has a bothering "if (...) return 0" in it which
assumes it is the last piece of code running in dsa_port_probe().

This makes it difficult to add further code at the end of dsa_port_probe()
which does not depend on MAC address stuff.

So move the code to a dedicated function which returns void and let the
code flow through.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: dsa: use "err" instead of "ret" in dsa_port_probe
Vladimir Oltean [Tue, 24 Aug 2021 12:00:39 +0000 (15:00 +0300)]
net: dsa: use "err" instead of "ret" in dsa_port_probe

DM DSA uses "err" for error code values, so use this consistently.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: dsa: felix: felix_init() can be static
Vladimir Oltean [Tue, 24 Aug 2021 12:00:38 +0000 (15:00 +0300)]
net: dsa: felix: felix_init() can be static

No one is calling this function from outside felix_switch.c.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
3 years agonet: tsec: Mark tsec_get_interface as __maybe_unused
Ramon Fried [Tue, 28 Sep 2021 15:49:02 +0000 (18:49 +0300)]
net: tsec: Mark tsec_get_interface as __maybe_unused

Non DM builds fail with the following error:
drivers/net/tsec.c:641:24: error: 'tsec_get_interface' defined but not used [-Werror=unused-function]
  641 | static phy_interface_t tsec_get_interface(struct tsec_private *priv)

Fix that.

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoPrepare v2021.10-rc5
Tom Rini [Mon, 27 Sep 2021 13:34:20 +0000 (09:34 -0400)]
Prepare v2021.10-rc5

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agophy: marvell: cp110: Support SATA invert polarity
Denis Odintsov [Wed, 15 Sep 2021 13:45:31 +0000 (15:45 +0200)]
phy: marvell: cp110: Support SATA invert polarity

In commit dfb551cb cp110 configuration initially done in u-boot
was removed and delegated to atf firmware as smc call.
That commit didn't account for later introduced in 898f527e SATA invert polarity support.

This patch adds support of passing SATA invert polarity flags to atf
firmware during the smc call.

Signed-off-by: Denis Odintsov <shiva@mail.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: turris_omnia: fix leaked mtd device
Marek Behún [Sat, 25 Sep 2021 00:49:18 +0000 (02:49 +0200)]
arm: mvebu: turris_omnia: fix leaked mtd device

After getting MTD device via get_mtd_device_nm(), we need to put it with
put_mtd_device(), otherwise we get

  Removing MTD device #0 (mx25l6405d) with use count 1

before booting kernel.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoefi_loader: Fix spec ID event creation
Ruchika Gupta [Tue, 14 Sep 2021 06:44:31 +0000 (12:14 +0530)]
efi_loader: Fix spec ID event creation

TCG EFI Protocol Specification defines the number_of_algorithms
field in spec ID event to be equal to the number of active
algorithms supported by the TPM device. In current implementation,
this field is populated with the count of all algorithms supported
by the TPM which leads to incorrect spec ID event creation.

Similarly, the algorithm array in spec ID event should be a variable
length array with length being equal to the number_of_algorithms field.
In current implementation this is defined as a fixed length array
which has been fixed.

Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
CC: Masahisa Kojima <masahisa.kojima@linaro.org>
CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
CC: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agodoc: Add mention of the /config binding
Simon Glass [Sun, 19 Sep 2021 21:51:10 +0000 (15:51 -0600)]
doc: Add mention of the /config binding

The devicetree binding files are in their own directory and use a simple
text format. Add a link for the binding for the /config node, since it
is otherwise hard to find.

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoarm: orion5x: edminiv2: change maintainer
Simon Guinot [Wed, 15 Sep 2021 13:01:51 +0000 (15:01 +0200)]
arm: orion5x: edminiv2: change maintainer

Since Albert Aribaud is not maintaining anymore the LaCie Ethernet Disk
mini V2 board, then I am taking over.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agomtd: remove SPEAr flash driver st_smi
Patrick Delaunay [Wed, 22 Sep 2021 09:02:26 +0000 (11:02 +0200)]
mtd: remove SPEAr flash driver st_smi

Remove the driver st_smic.c used in SPEAr products and the associated
config CONFIG_ST_SMI; this driver is no more used in U-Boot after the
commit 34cb36b348d1 ("arm: Remove spear600 boards and the rest of SPEAr
support").

Fixes: 34cb36b348d1 ("arm: Remove spear600 boards and the rest of SPEAr support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoTaking over responsibility for GE boards from Sebastian
Martyn Welch [Tue, 21 Sep 2021 16:35:06 +0000 (17:35 +0100)]
Taking over responsibility for GE boards from Sebastian

I am taking over responsibility for the GE board from Sebastian Reichel.
Updating the MAINTAINERS files to reflect this.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
3 years agoMAINTAINERS: remove SPEAR entry
Patrick Delaunay [Tue, 21 Sep 2021 16:18:51 +0000 (18:18 +0200)]
MAINTAINERS: remove SPEAR entry

As the lastest spear directories are removed, delete the associated entry
in the MAINTAINERS file:
- arch/arm/cpu/arm926ejs/spear/
- arch/arm/include/asm/arch-spear/

Fixes: 34cb36b348d1 ("arm: Remove spear600 boards and the rest of SPEAr support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agofs: avoid superfluous messages
Heinrich Schuchardt [Mon, 20 Sep 2021 12:15:03 +0000 (14:15 +0200)]
fs: avoid superfluous messages

Output like the following is quite irritating:

    => bootefi hello
    Scanning disk mmc2.blk...
    No valid Btrfs found
    Bad magic number for SquashFS image.
    ** Unrecognized filesystem type **
    Scanning disk mmc1.blk...
    No valid Btrfs found
    Bad magic number for SquashFS image.
    ** Unrecognized filesystem type **
    Scanning disk mmc0.blk...
    No valid Btrfs found
    Bad magic number for SquashFS image.
    ** Unrecognized filesystem type **

Albeit a whole disk may be formatted with a filesystem in most cases
a partition table is used and the whole disk (partition number 0) doesn't
contain a filesytem. Some partitions may only contain a blob. Not seeing a
filesytem on the whole disk or on any partition is only worth a debug
message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoscripts/mailmapper: enable running with Python 3
Heinrich Schuchardt [Thu, 16 Sep 2021 08:59:12 +0000 (10:59 +0200)]
scripts/mailmapper: enable running with Python 3

Our mailmapper script required Python 2 which is no longer maintained.
A main difference when converting to Python 3 is that byte strings are not
character strings. So add conversion and skip over conversion errors.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agotest/py: tpm2: Skip tpm pytest based on env variable
T Karthik Reddy [Fri, 23 Jul 2021 12:18:26 +0000 (06:18 -0600)]
test/py: tpm2: Skip tpm pytest based on env variable

Tpm test cases relies on tpm device setup. Provide an environment
variable "env__tpm_device_test_skip = True" to skip the test case
if tpm device is not present.
Only needed will have to add variable to the py-test framework.
Test runs successfully even this variable is absent.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoddr: altera: use KBUILD_BASENAME instead of __FILE__
Marek Vasut [Tue, 14 Sep 2021 03:20:19 +0000 (05:20 +0200)]
ddr: altera: use KBUILD_BASENAME instead of __FILE__

The KBUILD_BASENAME contains just the name of the compiled module,
in this case 'sequencer', rather than a full path to the compiled
file. Use it to prevent pulling the full path into the U-Boot binary,
which is useless and annoying.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Let DWMAC configure PHY reset GPIO
Marek Vasut [Tue, 14 Sep 2021 03:25:36 +0000 (05:25 +0200)]
arm: socfpga: vining: Let DWMAC configure PHY reset GPIO

The DM DWMAC driver is perfectly capable of configuring the ethernet
PHY reset GPIO, let the driver do it instead of doing it in the board
file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Enable DW I2C driver
Marek Vasut [Tue, 14 Sep 2021 03:25:35 +0000 (05:25 +0200)]
arm: socfpga: vining: Enable DW I2C driver

The Designware I2C IP is used to communicate with I2C peripherals on
SoCFPGA, and required to access I2C EEPROM on this board. Enable it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Fix UDC controller phandle in DT
Marek Vasut [Tue, 14 Sep 2021 03:25:34 +0000 (05:25 +0200)]
arm: socfpga: vining: Fix UDC controller phandle in DT

The USB peripheral controller is the DWC2 controller 1, not 0.
Update the phandle to fix UDC support on this board.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Un-disable WDT in DT
Marek Vasut [Tue, 14 Sep 2021 03:25:33 +0000 (05:25 +0200)]
arm: socfpga: vining: Un-disable WDT in DT

The WDT on this system should be enabled, make it so.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Set default SPI NOR mode and frequency
Marek Vasut [Tue, 14 Sep 2021 03:25:32 +0000 (05:25 +0200)]
arm: socfpga: vining: Set default SPI NOR mode and frequency

The SPI NOR bus mode is 0 on this system, update it accordingly.
Increase frequency to 40 MHz and enable SFDP parsing, since the
flashes on this system support that and it is a huge performance
improvement.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Set USB gadget manufacturer to Softing with capital S
Marek Vasut [Tue, 14 Sep 2021 03:25:31 +0000 (05:25 +0200)]
arm: socfpga: vining: Set USB gadget manufacturer to Softing with capital S

This was configured in downstream, so it is likely that most of the
custom software used around the device depends on it. Make upstream
compatible.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Increase environment size
Marek Vasut [Tue, 14 Sep 2021 03:25:30 +0000 (05:25 +0200)]
arm: socfpga: vining: Increase environment size

Increase the environment size from 4k to 16k to prevent
environment from becoming full.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agoarm: socfpga: vining: Drop meaningless comment
Marek Vasut [Tue, 14 Sep 2021 03:25:29 +0000 (05:25 +0200)]
arm: socfpga: vining: Drop meaningless comment

The comment is no longer meaningful due to DT conversion, drop it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
3 years agousb: xhci-dwc3: Add support for USB 3.1 controllers
Mark Kettenis [Thu, 16 Sep 2021 14:00:09 +0000 (16:00 +0200)]
usb: xhci-dwc3: Add support for USB 3.1 controllers

This adds support for the DWC_sub31 controllers such as those
found on Apple's M1 SoC.  This version of the controller
seems to work fine with the existing driver.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
3 years agousb: ehci-mx6: use phy_type from device tree
Matthias Schiffer [Mon, 20 Sep 2021 13:37:25 +0000 (15:37 +0200)]
usb: ehci-mx6: use phy_type from device tree

Allow using different PHY interfaces for multiple USB controllers. When no
value is set in DT, we fall back to CONFIG_MXC_USB_PORTSC for now to stay
compatible with current board configurations.

This also adds support for the HSIC mode of the i.MX7.

Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agousb: ehci-ci: remove redundant PORTSC flag definitions
Matthias Schiffer [Mon, 20 Sep 2021 13:37:24 +0000 (15:37 +0200)]
usb: ehci-ci: remove redundant PORTSC flag definitions

These definitions are unused, all boards that define portsc flags use
the equivalent PORT_* definitions instead.

Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agoinclude/configs: replace MXC_EHCI_MODE_SERIAL with PORT_PTS_SERIAL
Matthias Schiffer [Mon, 20 Sep 2021 13:37:23 +0000 (15:37 +0200)]
include/configs: replace MXC_EHCI_MODE_SERIAL with PORT_PTS_SERIAL

The MXC_EHCI_MODE_ definitions are redundant. Replace MXC_EHCI_MODE_SERIAL
with the equivalent PORT_PTS_SERIAL.

Only the zmx25 platform is affected.

Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agousb: add support for ULPI/SERIAL/HSIC PHY modes
Matthias Schiffer [Mon, 20 Sep 2021 13:37:22 +0000 (15:37 +0200)]
usb: add support for ULPI/SERIAL/HSIC PHY modes

Import usb_phy_interface enum values and DT match strings from the Linux
kernel.

Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>