Skip to content

Commit

Permalink
phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation
Browse files Browse the repository at this point in the history
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 45aefe3 ("ata: ahci: mvebu: Make SATA PHY optional for Armada
3720")
commit 3241929 ("usb: host: xhci: mvebu: make USB 3.0 PHY optional for
Armada 3720")
commit b0c6ae0 ("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 <[email protected]>
Acked-by: Miquel Raynal <[email protected]>
Signed-off-by: Marek Behún <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
pali authored and vinodkoul committed Feb 25, 2022
1 parent 4bf18d5 commit 9343370
Showing 1 changed file with 1,215 additions and 117 deletions.
Loading

0 comments on commit 9343370

Please sign in to comment.