]> git.itanic.dy.fi Git - linux-stable/commit
phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation
authorPali Rohár <pali@kernel.org>
Thu, 3 Feb 2022 21:44:41 +0000 (22:44 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 25 Feb 2022 13:42:21 +0000 (19:12 +0530)
commit934337080c6c59b75db76b180b509f218640ad48
treebae0cc0f39f8a7403944156dc31e8661f923dd88
parent4bf18d5a2dd02db8c5b16a2cfae513510506df5b
phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation

Remove old RPC implementation and add a new native kernel implementation.

The old implementation uses ARM SMC API to issue RPC calls to ARM Trusted
Firmware which provides real implementation of PHY configuration.

But older versions of ARM Trusted Firmware do not provide this PHY
configuration functionality, simply returning: operation not supported; or
worse, some versions provide the configuration functionality incorrectly.

For example the firmware shipped in ESPRESSObin board has this older
version of ARM Trusted Firmware and therefore SATA, USB 3.0 and PCIe
functionality do not work with newer versions of Linux kernel.

Due to the above reasons, the following commits were introduced into Linux,
to workaround these issues by ignoring -EOPNOTSUPP error code from
phy-mvebu-a3700-comphy driver function phy_power_on():

commit 45aefe3d2251 ("ata: ahci: mvebu: Make SATA PHY optional for Armada
3720")
commit 3241929b67d2 ("usb: host: xhci: mvebu: make USB 3.0 PHY optional for
Armada 3720")
commit b0c6ae0f8948 ("PCI: aardvark: Fix initialization with old Marvell's
Arm Trusted Firmware")

Replace this RPC implementation with proper native kernel implementation,
which is independent on the firmware. Never return -EOPNOTSUPP for proper
arguments.

This should solve multiple issues with real-world boards, where it is not
possible or really inconvenient to change the firmware. Let's eliminate
these issues.

This implementation is ported directly from Armada 3720 comphy driver found
in newest version of ARM Trusted Firmware source code, but with various
fixes of register names, some added comments, some refactoring due to the
original code not conforming to kernel standards. Also PCIe mode poweroff
support was added here, and PHY reset support. These changes are also going
to be sent to ARM Trusted Firmware.

[ Pali did the porting from ATF.
  I (Marek) then fixed some register names, some various other things,
  added some comments and refactored the code to kernel standards. Also
  fixed PHY poweroff and added PHY reset. ]

Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20220203214444.1508-3-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/marvell/phy-mvebu-a3700-comphy.c