• Pali Rohár's avatar
    phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation · 93433708
    Pali Rohár authored
    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 45aefe3d ("ata: ahci: mvebu: Make SATA PHY optional for Armada
    3720")
    commit 3241929b ("usb: host: xhci: mvebu: make USB 3.0 PHY optional for
    Armada 3720")
    commit b0c6ae0f ("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: default avatarPali Rohár <pali@kernel.org>
    Acked-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
    Link: https://lore.kernel.org/r/20220203214444.1508-3-kabel@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    93433708
phy-mvebu-a3700-comphy.c 43.4 KB