u-boot/drivers
Vladimir Oltean 4f5bd8d68b 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>
2021-09-28 18:50:56 +03:00
..
adc dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
ata pci: acpi: Drop DM_PCI check from ahci 2021-09-13 18:23:13 -04:00
axi dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
bios_emulator pci: Drop DM_PCI check from bios_emul 2021-08-05 19:46:35 -04:00
block blk: Support iteration 2021-07-21 10:27:35 -06:00
bootcount bootcount: add a new driver with syscon as backend 2021-08-22 11:04:52 +02:00
bus bus: ti-sysc: change in a normal driver 2021-03-22 19:23:27 +13:00
button dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
cache cache: add sifive composable cache driver 2021-09-07 10:34:29 +08:00
clk clk: ti: k3: Update driver to account for divider flags 2021-09-17 14:47:03 -04:00
core dm: core: Don't allow uclass use before ready 2021-08-08 11:27:27 -06:00
cpu dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
crypto image: Drop if/elseif hash selection in calculate_hash() 2021-09-08 16:12:09 -04:00
ddr ddr: altera: use KBUILD_BASENAME instead of __FILE__ 2021-09-28 18:50:55 +03:00
demo common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
dfu global: Convert simple_strtoul() with decimal to dectoul() 2021-08-02 13:32:14 -04:00
dma dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
fastboot Fix flashing of eMMC user area with Fastboot 2021-08-21 18:23:02 -04:00
firmware psci: Do not define do_poweroff() if CONFIG_SYSRESET_CMD_POWEROFF is enabled 2021-07-26 09:18:45 +02:00
fpga arm: socfpga: Move Stratix10 and Agilex to use TARGET_SOCFPGA_SOC64 2021-03-08 10:59:10 +08:00
gpio pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
hwspinlock dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
i2c pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
input dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
led dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
mailbox dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
memory memory: stm32-fmc2: migrate trace to dev and log macro 2021-01-13 09:52:58 +01:00
misc imx8ulp: move struct mu_type to common header 2021-08-09 14:46:51 +02:00
mmc sunxi: mmc: A20: Fix MMC optimisation 2021-09-14 00:02:10 +01:00
mtd mtd: remove SPEAr flash driver st_smi 2021-09-28 18:50:55 +03:00
mux dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
net net: dsa: felix: call phy_config at .port_probe() time 2021-09-28 18:50:56 +03:00
nvme dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
pch dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
pci pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
pci_endpoint dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
phy phy: marvell: cp110: Support SATA invert polarity 2021-09-28 18:50:55 +03:00
pinctrl pinctrl: fix typo 2021-09-14 09:07:18 -04:00
power global: Convert simple_strtoul() with hex to hextoul() 2021-08-02 13:32:14 -04:00
pwm dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
qe global: Convert simple_strtoul() with hex to hextoul() 2021-08-02 13:32:14 -04:00
ram global: Convert simple_strtoul() with decimal to dectoul() 2021-08-02 13:32:14 -04:00
reboot-mode reboot-mode: read the boot mode from RTC memory 2021-07-23 10:16:39 -04:00
remoteproc remoteproc: pru: Add support for various PRU cores on K3 AM65x SoCs 2021-07-15 17:56:04 +05:30
reset reset: zynqmp: Add reset controller for ZynqMP SoC 2021-08-06 09:32:03 +02:00
rng dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
rtc rtc: zynqmp: Add support for ZynqMP RTC 2021-08-06 09:32:02 +02:00
scsi pci: scsi: pci: Drop DM_PCI check from scsi 2021-08-05 19:46:35 -04:00
serial global: Convert simple_strtoul() with decimal to dectoul() 2021-08-02 13:32:14 -04:00
smem dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
soc soc: xilinx: versal: Add soc_xilinx_versal driver 2021-08-26 08:08:11 +02:00
sound dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
spi pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
spmi dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
sysinfo sysinfo: rcar3: Add Renesas R-Car Gen3 sysinfo driver 2021-07-20 23:33:54 +02:00
sysreset sysreset: provide type of reset in do_reset cmd 2021-04-20 07:31:12 -04:00
tee tee: optee: sync cache on pre-reloc OP-TEE invocation 2021-07-23 07:13:25 -04:00
thermal dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
timer x86: tsc: Rename X86_TSC_TIMER_EARLY_FREQ to X86_TSC_TIMER_FREQ 2021-08-02 15:11:40 +08:00
tpm sandbox: tpm: Support extending a PCR multiple times 2021-08-01 09:05:24 -06:00
ufs dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
usb usb: xhci-dwc3: Add support for USB 3.1 controllers 2021-09-28 18:50:55 +03:00
video - add display driver for ST-Ericsson MCDE 2021-08-06 13:46:40 -04:00
virtio pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
w1 various minor sandbox improvements 2021-07-07 13:34:42 -04:00
w1-eeprom dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
watchdog wdt: dw: Fix passing NULL pointer to reset functions 2021-09-20 07:39:29 +02:00
xen dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
Kconfig reboot-mode: add support for reboot mode control 2021-07-23 10:16:39 -04:00
Makefile ddr: Add DDR driver for iMX8ULP 2021-08-09 14:46:51 +02:00