Armada 37xx: port comphy to generic-phys (PLEASE TEST)
Subsystems (8)
cover Armada 37xx: port comphy to generic-phys (PLEASE TEST)
Hi,
I have ported the COMPHY and UTMI PHY drivers from Linux to U-Boot. With this we are able to abandon the current comphy_a3700 driver, which is incompatible with Linux' device trees. So if we want to have DTS files for A3720 boards identical to Linux', we have to do this.
This series adds the set_mode functionality to generic-phy, then adds the ports of UTMI PHY and COMPHY drivers from Linux, then makes some drivers use the generic-phy API on device probe (these drivers are mvneta, ahci_mvebu, pci-aardvark, xhci-mvebu and ehci-marvell),
then converts defconfigs and device trees to use the new bindings and drivers, and the last patch removes the comphy_a3700 driver.
I have successfully compiled U-Boot without errors for all these boards (their defconigs) and also for Armada 8k boards, but am unable to test on anything else but Turris MOX.
Please note that in order for the COMPHY driver to work, you have to use current ARM Trusted Firmware (such that it supports PHY powering on/off via SMC calls).
It would be nice if people tested this series.
Marek
Marek Beh?n (11):
phy: add support for setting phy mode
phy: port Armada 37xx UTMI PHY from Linux
phy: port Armada 37xx COMPHY from Linux
usb: host: make PHY handling more generic
usb: ehci-marvell: call generic-phy initialization
usb: xhci-mvebu: call generic-phy initialization
pci: aardvark: add PHY support
ata: ahci_mvebu: add PHY support
net: mvneta: add PHY support
arm64: mvebu: armada-37xx: convert to use new generic-phy drivers
phy: marvell: remove comphy_a3700 driver
arch/arm/dts/armada-3720-db.dts | 12 - arch/arm/dts/armada-3720-espressobin.dts | 18 - arch/arm/dts/armada-3720-turris-mox.dts | 19 +- arch/arm/dts/armada-3720-uDPU.dts | 18 +- arch/arm/dts/armada-37xx.dtsi | 72 +- board/CZ.NIC/turris_mox/turris_mox.c | 33 - configs/mvebu_db-88f3720_defconfig | 6 +- configs/mvebu_espressobin-88f3720_defconfig | 6 +- configs/turris_mox_defconfig | 6 +- configs/uDPU_defconfig | 6 +- drivers/ata/ahci_mvebu.c | 35 + drivers/net/mvneta.c | 23 + drivers/pci/pci-aardvark.c | 55 +- drivers/phy/Kconfig | 16 + drivers/phy/Makefile | 2 + drivers/phy/marvell/Makefile | 1 - drivers/phy/marvell/comphy_a3700.c | 1021 ------------------- drivers/phy/marvell/comphy_a3700.h | 264 ----- drivers/phy/marvell/comphy_core.c | 3 - drivers/phy/marvell/comphy_core.h | 25 +- drivers/phy/phy-mvebu-a3700-comphy.c | 315 ++++++ drivers/phy/phy-mvebu-a3700-utmi.c | 235 +++++ drivers/phy/phy-uclass.c | 11 + drivers/usb/host/Makefile | 2 + drivers/usb/host/ehci-generic.c | 11 +- drivers/usb/host/ehci-hcd.c | 66 -- drivers/usb/host/ehci-marvell.c | 33 +- drivers/usb/host/ehci-msm.c | 7 +- drivers/usb/host/ehci-pci.c | 6 +- drivers/usb/host/ehci.h | 4 - drivers/usb/host/phy.c | 115 +++ drivers/usb/host/phy.h | 31 + drivers/usb/host/xhci-mvebu.c | 19 +- include/generic-phy.h | 51 + include/mvebu/comphy.h | 22 - 35 files changed, 1046 insertions(+), 1523 deletions(-) delete mode 100644 drivers/phy/marvell/comphy_a3700.c delete mode 100644 drivers/phy/marvell/comphy_a3700.h create mode 100644 drivers/phy/phy-mvebu-a3700-comphy.c create mode 100644 drivers/phy/phy-mvebu-a3700-utmi.c create mode 100644 drivers/usb/host/phy.c create mode 100644 drivers/usb/host/phy.h delete mode 100644 include/mvebu/comphy.h
Signature · 1 line
2.24.1
PATCH 1/11 phy: add support for setting phy mode
Import enum phy_mode from Linux and add .set_mode method to generic-phy operations structure.
--- drivers/phy/phy-uclass.c | 11 +++++++++ include/generic-phy.h | 51 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
drivers/phy/phy-uclass.c +11 -0
@@ -161,6 +161,17 @@ int generic_phy_power_off(struct phy *phy)return ops->power_off ? ops->power_off (phy) :0 ; } +int generic_phy_set_mode (struct phy *phy,enum phy_mode mode,int submode) +{ +struct phy_ops const *ops; + +if (!phy) +return 0 ; + ops =phy_dev_ops (phy->dev); + +return ops->set_mode ? ops->set_mode (phy, mode, submode) :0 ; +} +UCLASS_DRIVER (phy) = { .id =UCLASS_PHY , .name ="phy" ,
include/generic-phy.h +51 -0
75 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH 2/11 phy: port Armada 37xx UTMI PHY from Linux
In reply to Marek BehúnThis patch ports the A3700 UTMI PHY driver from Linux.
--- drivers/phy/Kconfig | 8 + drivers/phy/Makefile | 1 + drivers/phy/phy-mvebu-a3700-utmi.c | 235 +++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+) create mode 100644 drivers/phy/phy-mvebu-a3700-utmi.c
drivers/phy/Kconfig +8 -0
@@ -217,4 +217,12 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second veriosn, so you can easily distinguish them by banks layout. +config PHY_MVEBU_A3700_UTMI + bool "Marvell A3700 UTMI driver" + depends on PHY && ARMADA_3700 + select REGMAP + select SYSCON + help + Enable this to support Marvell A3700 UTMI PHY driver. + endmenu
drivers/phy/Makefile +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o +obj-$(CONFIG_PHY_MVEBU_A3700_UTMI) += phy-mvebu-a3700-utmi.o
drivers/phy/phy-mvebu-a3700-utmi.c new file +235 -0
235 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH 3/11 phy: port Armada 37xx COMPHY from Linux
In reply to Marek BehúnThis patch ports the A3700 COMPHY driver from Linux.
--- drivers/phy/Kconfig | 8 + drivers/phy/Makefile | 1 + drivers/phy/phy-mvebu-a3700-comphy.c | 315 +++++++++++++++++++++++++++ 3 files changed, 324 insertions(+) create mode 100644 drivers/phy/phy-mvebu-a3700-comphy.c
drivers/phy/Kconfig +8 -0
@@ -217,6 +217,14 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second veriosn, so you can easily distinguish them by banks layout. +config PHY_MVEBU_A3700_COMPHY + tristate "Marvell A3700 comphy driver" + depends on PHY && ARMADA_3700 + help + This driver allows to control the comphy, a hardware block providing + shared serdes PHYs on Marvell Armada 3700. Its serdes lanes can be + used by various controllers: Ethernet, SATA, USB3, PCIe. + config PHY_MVEBU_A3700_UTMI bool "Marvell A3700 UTMI driver" depends on PHY && ARMADA_3700
drivers/phy/Makefile +1 -0
@@ -24,4 +24,5 @@ obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o +obj-$(CONFIG_PHY_MVEBU_A3700_COMPHY) += phy-mvebu-a3700-comphy.o obj-$(CONFIG_PHY_MVEBU_A3700_UTMI) += phy-mvebu-a3700-utmi.o
drivers/phy/phy-mvebu-a3700-comphy.c new file +315 -0
315 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH 4/11 usb: host: make PHY handling more generic
In reply to Marek BehúnSince XHCI may also want to use the generic-phy functions from ehci-hcd.c, move them into separate phy.c.
Change these functions so that they enumerate end power on all generic-phys defined in device tree for a given USB controller.
--- drivers/usb/host/Makefile | 2 + drivers/usb/host/ehci-generic.c | 11 +-- drivers/usb/host/ehci-hcd.c | 66 ------------------ drivers/usb/host/ehci-msm.c | 7 +- drivers/usb/host/ehci-pci.c | 6 +- drivers/usb/host/ehci.h | 4 -- drivers/usb/host/phy.c | 115 ++++++++++++++++++++++++++++++++ drivers/usb/host/phy.h | 31 +++++++++ 8 files changed, 161 insertions(+), 81 deletions(-) create mode 100644 drivers/usb/host/phy.c create mode 100644 drivers/usb/host/phy.h
drivers/usb/host/Makefile +2 -0
@@ -8,6 +8,8 @@ obj-y += usb-uclass.o obj-$(CONFIG_SANDBOX) += usb-sandbox.o endif +obj-$(CONFIG_PHY) += phy.o + # ohci obj-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o obj-$(CONFIG_USB_ATMEL) += ohci-at91.o
drivers/usb/host/ehci-generic.c +6 -5
@@ -12,9 +12,11 @@#include <reset.h> #include <asm/io.h> #include <dm.h> -#include "ehci.h" #include <power/regulator.h> +#include "ehci.h" +#include "phy.h" +/* * Even though here we don't explicitly use "struct ehci_ctrl" * ehci_register() expects it to be the first thing that resides in
@@ -24,7 +26,6 @@ struct generic_ehci {struct ehci_ctrl ctrl;struct clk *clocks;struct reset_ctl *resets; -struct phy phy;#ifdef CONFIG_DM_REGULATOR struct udevice *vbus_supply;#endif
@@ -148,7 +149,7 @@ static int ehci_usb_probe(struct udevice *dev)if (err) goto reset_err; - err =ehci_setup_phy (dev, &priv->phy,0 ); + err =usb_phys_setup (dev);if (err) goto regulator_err;
@@ -163,7 +164,7 @@ static int ehci_usb_probe(struct udevice *dev)return 0 ; phy_err: - ret =ehci_shutdown_phy (dev, &priv->phy); + ret =usb_phys_shutdown (dev);if (ret)dev_err (dev,"failed to shutdown usb phy\n" );
@@ -193,7 +194,7 @@ static int ehci_usb_remove(struct udevice *dev)if (ret)return ret; - ret =ehci_shutdown_phy (dev, &priv->phy); + ret =usb_phys_shutdown (dev);if (ret)return ret;
drivers/usb/host/ehci-hcd.c +0 -66
69 lines not on this page · raw message
drivers/usb/host/ehci-msm.c +4 -3
@@ -17,13 +17,14 @@#include <asm/gpio.h> #include <asm/io.h> #include <linux/compat.h> +#include "ehci.h" +#include "phy.h" struct msm_ehci_priv {struct ehci_ctrl ctrl;/* Needed by EHCI */ struct usb_ehci *ehci;/* Start of IP core*/ struct ulpi_viewport ulpi_vp;/* ULPI Viewport */ -struct phy phy; };static int msm_init_after_reset (struct ehci_ctrl *dev)
@@ -56,7 +57,7 @@ static int ehci_usb_probe(struct udevice *dev) hcor = (struct ehci_hcor *)((phys_addr_t )hccr +HC_LENGTH (ehci_readl (&(hccr)->cr_capbase))); - ret =ehci_setup_phy (dev, &p->phy,0 ); + ret =usb_phys_setup (dev);if (ret)return ret;
@@ -81,7 +82,7 @@ static int ehci_usb_remove(struct udevice *dev)/* Stop controller. */ clrbits_le32 (&ehci->usbcmd,CMD_RUN ); - ret =ehci_shutdown_phy (dev, &p->phy); + ret =usb_phys_shutdown (dev);if (ret)return ret;
drivers/usb/host/ehci-pci.c +3 -3
@@ -12,11 +12,11 @@#include <asm/io.h> #include "ehci.h" +#include "phy.h" /* Information about a USB port */ struct ehci_pci_priv {struct ehci_ctrl ehci; -struct phy phy; };#if CONFIG_IS_ENABLED (DM_USB )
@@ -29,7 +29,7 @@ static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr,int ret;u32 cmd; - ret =ehci_setup_phy (dev, &priv->phy,0 ); + ret =usb_phys_setup (dev);if (ret)return ret;
@@ -146,7 +146,7 @@ static int ehci_pci_remove(struct udevice *dev)if (ret)return ret; -return ehci_shutdown_phy (dev, &priv->phy); +return usb_phys_shutdown (dev); }static const struct udevice_id ehci_pci_ids[] = {
drivers/usb/host/ehci.h +0 -4
@@ -294,8 +294,4 @@ int ehci_register(struct udevice *dev, struct ehci_hccr *hccr,int ehci_deregister (struct udevice *dev);extern struct dm_usb_ops ehci_usb_ops; -/* EHCI PHY functions */ -int ehci_setup_phy (struct udevice *dev,struct phy *phy,int index); -int ehci_shutdown_phy (struct udevice *dev,struct phy *phy); -#endif /* USB_EHCI_H */
drivers/usb/host/phy.c new file +115 -0
115 lines not on this page · raw message
drivers/usb/host/phy.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* USB phy functions +* +* Moved from ehci-hcd.c by Marek Behun <[email protected]> +* +* Copyright (C) Marek Vasut <[email protected]> +*/ + +#ifndef __USB_HOST_PHY_H_ +#define __USB_HOST_PHY_H_ + +#include <common.h> +#include <dm.h> + +#ifdef CONFIG_PHY +int usb_phys_setup (struct udevice *dev); +int usb_phys_shutdown (struct udevice *dev); +#else +static inline int usb_phys_setup (struct udevice *dev) +{ +return 0 ; +} + +static inline int usb_phys_shutdown (struct udevice *dev) +{ +return 0 ; +} +#endif + +#endif /* __USB_HOST_PHY_H_ */
Signature · 1 line
2.24.1
PATCH 4/11 usb: host: make PHY handling more generic
On 4/19/20 5:48 PM, Marek Beh?n wrote:
[...]
Quoted 8 lines
drivers/usb/host/phy.c new file +8
-0+static int usb_phy_setup (struct udevice *dev,int index) +{ +struct phy phy; +int ret; + + ret =generic_phy_get_by_index (dev, index, &phy); +if (ret && ret != -ENOENT ) { +dev_err (dev,"failed to get usb phy %i\n" , index);
drivers/usb/host/phy.c line 32
Quoted 10 lines
drivers/usb/host/phy.c new file +10
-0+return ret; + } + + ret =generic_phy_init (&phy); +if (ret) { +dev_err (dev,"failed to init usb phy %i\n" , index); +return ret; + } + + ret =generic_phy_set_mode (&phy,PHY_MODE_USB_HOST_SS ,0 );
How can this ever work with EHCI , which is HS/FS/LS , but not SS ?
[...]
drivers/usb/host/phy.h line 7
Quoted 13 lines
drivers/usb/host/phy.h new file +7
-0@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* USB phy functions +* +* Moved from ehci-hcd.c by Marek Behun <[email protected]> +* +* Copyright (C) Marek Vasut <[email protected]>
I presume the copyright needs updating ?
[...]
PATCH 4/11 usb: host: make PHY handling more generic
Quoted 4 lines · On Mon, 20 Apr 2020 03:41:49 +0200 Marek Vasut <[email protected]> wrote:
drivers/usb/host/phy.c line 32
Quoted 1 line
drivers/usb/host/phy.c new file +1
-0+ ret =generic_phy_set_mode (&phy,PHY_MODE_USB_HOST_SS ,0 );How can this ever work with EHCI , which is HS/FS/LS , but not SS ?
Marek, this is how kernel does it in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/hcd.c#n2628
First PHY_MODE_USB_HOST_SS is tried, then PHY_MODE_USB_HOST.
PATCH 4/11 usb: host: make PHY handling more generic
Quoted 11 lines · Marek Behun
Quoted 4 lines · On Mon, 20 Apr 2020 03:41:49 +0200 Marek Vasut <[email protected]> wrote:
drivers/usb/host/phy.c line 32
Quoted 1 line
drivers/usb/host/phy.c new file +1
-0+ ret =generic_phy_set_mode (&phy,PHY_MODE_USB_HOST_SS ,0 );How can this ever work with EHCI , which is HS/FS/LS , but not SS ?
Marek, this is how kernel does it in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/hcd.c#n2628
FirstPHY_MODE_USB_HOST_SSis tried, thenPHY_MODE_USB_HOST.
That seems unnecessary, considering that we already know SS-mode will fail.
PATCH 4/11 usb: host: make PHY handling more generic
Quoted 9 lines · On Mon, 20 Apr 2020 12:20:38 +0200 Marek Vasut <[email protected]> wrote:
Quoted 8 lines · Marek Behun
Quoted 4 lines · On Mon, 20 Apr 2020 03:41:49 +0200 Marek Vasut <[email protected]> wrote:
drivers/usb/host/phy.c line 32
Quoted 1 line
drivers/usb/host/phy.c new file +1
-0+ ret =generic_phy_set_mode (&phy,PHY_MODE_USB_HOST_SS ,0 );How can this ever work with EHCI , which is HS/FS/LS , but not SS ?
Quoted 5 lines
Quoted 3 lines
Marek, this is how kernel does it in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/hcd.c#n2628
FirstPHY_MODE_USB_HOST_SSis tried, thenPHY_MODE_USB_HOST.That seems unnecessary, considering that we already know SS-mode will fail.
Hmm, I guess phy_mode could be passed as a parameter to the usb_phys_setup function.
PATCH 5/11 usb: ehci-marvell: call generic-phy initialization
In reply to Marek BehúnUse the new usb_phys_setup and usb_phys_shutdown to initialize potential generic-phys in the ehci-marvell driver.
--- drivers/usb/host/ehci-marvell.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-marvell.c +30 -3
@@ -19,6 +19,8 @@#include <asm/arch/orion5x.h> #endif +#include "phy.h" +DECLARE_GLOBAL_DATA_PTR ;#define USB_WINDOW_CTRL (i) (0x320 + ((i) << 4))
@@ -103,6 +105,7 @@ static int ehci_mvebu_probe(struct udevice *dev)struct ehci_mvebu_priv *priv =dev_get_priv (dev);struct ehci_hccr *hccr;struct ehci_hcor *hcor; +int err;/* * Get the base address for EHCI controller from the device node
@@ -125,6 +128,10 @@ static int ehci_mvebu_probe(struct udevice *dev)else usb_brg_adrdec_setup ((void *)priv->hcd_base); + err =usb_phys_setup (dev); +if (err) +return err; + hccr = (struct ehci_hccr *)(priv->hcd_base +0x100 ); hcor = (struct ehci_hcor *) ((uintptr_t )hccr +HC_LENGTH (ehci_readl (&hccr->cr_capbase)));
@@ -133,8 +140,28 @@ static int ehci_mvebu_probe(struct udevice *dev) (uintptr_t )hccr, (uintptr_t )hcor, (uintptr_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase))); -return ehci_register (dev, hccr, hcor, &marvell_ehci_ops,0 , -USB_INIT_HOST ); + err =ehci_register (dev, hccr, hcor, &marvell_ehci_ops,0 , +USB_INIT_HOST ); +if (err) + goto phy_err; + +return 0 ; + +phy_err: +usb_phys_shutdown (dev); + +return err; +} + +static int ehci_mvebu_remove (struct udevice *dev) +{ +int ret; + + ret =ehci_deregister (dev); +if (ret) +return ret; + +return usb_phys_shutdown (dev); }static const struct udevice_id ehci_usb_ids[] = {
@@ -148,7 +175,7 @@ U_BOOT_DRIVER(ehci_mvebu) = { .id = UCLASS_USB, .of_match = ehci_usb_ids, .probe = ehci_mvebu_probe, - .remove = ehci_deregister, + .remove = ehci_mvebu_remove, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_mvebu_priv),
Signature · 1 line
2.24.1
PATCH 6/11 usb: xhci-mvebu: call generic-phy initialization
In reply to Marek BehúnUse the new usb_phys_setup and usb_phys_shutdown to initialize potential generic-phys in the xhci-mvebu driver.
--- drivers/usb/host/xhci-mvebu.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-mvebu.c +18 -1
@@ -14,6 +14,8 @@#include <usb/xhci.h> +#include "phy.h" +struct mvebu_xhci_platdata {fdt_addr_t hcd_base; };
@@ -49,6 +51,10 @@ static int xhci_usb_probe(struct udevice *dev) len =HC_LENGTH (xhci_readl (&ctx->hcd->cr_capbase)); hcor = (struct xhci_hcor *)((uintptr_t )ctx->hcd + len); + ret =usb_phys_setup (dev); +if (ret) +return ret; + ret =device_get_supply_regulator (dev,"vbus-supply" , ®ulator);if (!ret) { ret =regulator_set_enable (regulator, true);
@@ -64,6 +70,17 @@ static int xhci_usb_probe(struct udevice *dev)return xhci_register (dev, ctx->hcd, hcor); } +static int xhci_usb_remove (struct udevice *dev) +{ +int ret; + + ret =xhci_deregister (dev); +if (ret) +return ret; + +return usb_phys_shutdown (dev); +} +static int xhci_usb_ofdata_to_platdata (struct udevice *dev) {struct mvebu_xhci_platdata *plat =dev_get_platdata (dev);
@@ -93,7 +110,7 @@ U_BOOT_DRIVER(usb_xhci) = { .of_match = xhci_usb_ids, .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, .probe = xhci_usb_probe, - .remove = xhci_deregister, + .remove = xhci_usb_remove, .ops = &xhci_usb_ops, .platdata_auto_alloc_size = sizeof(struct mvebu_xhci_platdata), .priv_auto_alloc_size = sizeof(struct mvebu_xhci),
Signature · 1 line
2.24.1
PATCH 7/11 pci: aardvark: add PHY support
In reply to Marek BehúnUse generic-phy API to power on PCIe PHY.
Since the new comphy drivers only does a SMC call into ARM Trusted Firmware and the comphy driver in ATF does not do TX Enabling (step 7 in PCIe PHY power on algorithm), add TX enabling into this driver.
--- drivers/pci/pci-aardvark.c | 55 +++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-)
drivers/pci/pci-aardvark.c +54 -1
@@ -30,6 +30,7 @@#include <asm/io.h> #include <asm-generic/gpio.h> #include <dm/device_compat.h> +#include <generic-phy.h> #include <linux/ioport.h> /* PCIe core registers */
@@ -92,6 +93,8 @@#define PCIE_CORE_CTRL2_TD_ENABLE BIT(4)#define PCIE_CORE_CTRL2_STRICT_ORDER_ENABLE BIT(5)#define PCIE_CORE_CTRL2_ADDRWIN_MAP_ENABLE BIT(6) +#define PCIE_CORE_REF_CLK_REG (CONTROL_BASE_ADDR + 0x14) +#define PCIE_CORE_REF_CLK_TX_ENABLE BIT(1)/* LMI registers base address and register offsets */ #define LMI_BASE_ADDR 0x6000
@@ -141,11 +144,13 @@* number which may vary depending on the PCIe setup * (PEX switches etc). * @device: The pointer to PCI uclass device. +* @phy: The PCIe generic-phy instance. */ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +struct phy phy; };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)
@@ -512,6 +517,11 @@ static int pcie_advk_setup_hw(struct pcie_advk *pcie) {u32 reg; +/* Enable TX */ + reg =advk_readl (pcie,PCIE_CORE_REF_CLK_REG ); + reg |=PCIE_CORE_REF_CLK_TX_ENABLE ; +advk_writel (pcie, reg,PCIE_CORE_REF_CLK_REG ); +/* Set to Direct mode */ reg =advk_readl (pcie,CTRL_CONFIG_REG ); reg &= ~(CTRL_MODE_MASK <<CTRL_MODE_SHIFT );
@@ -597,6 +607,47 @@ static int pcie_advk_setup_hw(struct pcie_advk *pcie)return 0 ; } +/** +* pcie_advk_phy_power_on() - Initialize generic-phy for this controller +*/ +static int pcie_advk_phy_power_on (struct pcie_advk *pcie) +{ +struct udevice *dev = pcie->dev; +struct phy *phy = &pcie->phy; +int ret; + + ret =generic_phy_get_by_index (dev,0 , phy); +if (ret && ret != -ENOENT ) { +dev_err (dev,"failed to get PCIe generic-phy\n" ); +return ret; + } + + ret =generic_phy_init (phy); +if (ret) { +dev_err (dev,"failed to init PCIe generic-phy\n" ); +return ret; + } + + ret =generic_phy_set_mode (phy,PHY_MODE_PCIE ,0 ); +if (ret) { +dev_err (dev,"failed to set mode on PCIe generic-phy\n" ); + goto err; + } + + ret =generic_phy_power_on (phy); +if (ret) { +dev_err (dev,"failed to power on PCIe generic-phy\n" ); + goto err; + } + +return 0 ; + +err: +generic_phy_exit (phy); + +return ret; +} +/** * pcie_advk_probe() - Probe the PCIe bus for active link *
@@ -611,6 +662,9 @@ static int pcie_advk_probe(struct udevice *dev) {struct pcie_advk *pcie =dev_get_priv (dev); + pcie->dev =pci_get_controller (dev); +pcie_advk_phy_power_on (pcie); +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio;
@@ -640,7 +694,6 @@ static int pcie_advk_probe(struct udevice *dev)#endif /* DM_GPIO */ pcie->first_busno = dev->seq; - pcie->dev =pci_get_controller (dev);return pcie_advk_setup_hw (pcie); }
Signature · 1 line
2.24.1
PATCH 8/11 ata: ahci_mvebu: add PHY support
In reply to Marek BehúnUse generic-phy API to power on SATA PHY.
--- drivers/ata/ahci_mvebu.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/ata/ahci_mvebu.c +35 -0
@@ -6,6 +6,7 @@#include <common.h> #include <ahci.h> #include <dm.h> +#include <generic-phy.h> /* * Dummy implementation that can be overwritten by a board
@@ -30,14 +31,48 @@ static int mvebu_ahci_bind(struct udevice *dev)return 0 ; } +static int mvebu_ahci_phy_power_on (struct udevice *dev) +{ +struct phy phy; +int ret; + + ret =generic_phy_get_by_index (dev,0 , &phy); +if (ret == -ENOENT ) +return 0 ; + + ret =generic_phy_init (&phy); +if (ret) +return ret; + + ret =generic_phy_set_mode (&phy,PHY_MODE_SATA ,0 ); +if (ret) + goto err; + + ret =generic_phy_power_on (&phy); +if (ret) + goto err; + +return 0 ; + +err: +generic_phy_exit (&phy); +return ret; +} +static int mvebu_ahci_probe (struct udevice *dev) { +int ret; +/* * Board specific SATA / AHCI enable code, e.g. enable the * AHCI power or deassert reset */ board_ahci_enable (); + ret =mvebu_ahci_phy_power_on (dev); +if (ret) +return ret; +ahci_probe_scsi (dev, (ulong )devfdt_get_addr_ptr (dev));return 0 ;
Signature · 1 line
2.24.1
PATCH 9/11 net: mvneta: add PHY support
In reply to Marek BehúnUse generic-phy API to power on comphy in mvneta driver.
--- drivers/net/mvneta.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/mvneta.c +23 -0
@@ -22,6 +22,7 @@#include <asm/io.h> #include <dm/device_compat.h> #include <dm/devres.h> +#include <generic-phy.h> #include <linux/errno.h> #include <phy.h> #include <miiphy.h>
@@ -274,6 +275,7 @@ struct mvneta_port {unsigned int link;unsigned int duplex;unsigned int speed; +struct phy comphy;int init;int phyaddr;
@@ -1150,8 +1152,22 @@ static int mvneta_setup_txqs(struct mvneta_port *pp)return 0 ; } +static int mvneta_comphy_init (struct mvneta_port *pp) +{ +int ret; + + ret =generic_phy_set_mode (&pp->comphy,PHY_MODE_ETHERNET , + pp->phy_interface); +if (ret) +return ret; + +return generic_phy_power_on (&pp->comphy); +} +static void mvneta_start_dev (struct mvneta_port *pp) { +mvneta_comphy_init (pp); +/* start the Rx/Tx activity */ mvneta_port_enable (pp); }
@@ -1723,6 +1739,12 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); + ret =generic_phy_get_by_index (dev,0 , &pp->comphy); +if (ret && ret != -ENOENT ) { +printf ("cannot get comphy in mvneta\n" ); +return ret; + } +/* PHY interface is already decoded in mvneta_ofdata_to_platdata() */ pp->phy_interface = pdata->phy_interface;
@@ -1776,6 +1798,7 @@ static void mvneta_stop(struct udevice *dev)mvneta_port_down (pp);mvneta_port_disable (pp); +generic_phy_power_off (&pp->comphy); }static const struct eth_ops mvneta_ops = {
Signature · 1 line
2.24.1
PATCH 9/11 net: mvneta: add PHY support
There is some code repetition in patches 7, 8, and 9.
I am thinking about perhaps creating a helper function
generic_phy_begin() which would call
generic_phy_init()
generic_phy_set_mode()
generic_phy_power_on()
and
generic_phy_end()
generic_phy_power_off()
generic_phy_exit()
PATCH 10/11 arm64: mvebu: armada-37xx: convert to use new generic-phy drivers
In reply to Marek BehúnThis patch converts device trees and defconfigs of Armada 37xx boards (EspressoBIN, A37xx DB, uDPU and Turris MOX) to use the newly ported comphy and utmi generic-phy drivers.
For Turris Mox also remove the comphy_update_map implementation, since it is no longer needed.
--- arch/arm/dts/armada-3720-db.dts | 12 ---- arch/arm/dts/armada-3720-espressobin.dts | 18 ------ arch/arm/dts/armada-3720-turris-mox.dts | 19 +----- arch/arm/dts/armada-3720-uDPU.dts | 18 +----- arch/arm/dts/armada-37xx.dtsi | 72 ++++++++++++++++++--- board/CZ.NIC/turris_mox/turris_mox.c | 33 ---------- configs/mvebu_db-88f3720_defconfig | 6 +- configs/mvebu_espressobin-88f3720_defconfig | 6 +- configs/turris_mox_defconfig | 6 +- configs/uDPU_defconfig | 6 +- 10 files changed, 86 insertions(+), 110 deletions(-)
arch/arm/dts/armada-3720-db.dts +0 -12
@@ -68,18 +68,6 @@ }; }; -&comphy { - phy0 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_2_5G>; - }; - - phy1 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>, <&smi_pins>;
arch/arm/dts/armada-3720-espressobin.dts +0 -18
@@ -69,24 +69,6 @@ }; }; -&comphy { - max-lanes = <3>; - phy0 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_2_5G>; - }; - - phy1 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; - - phy2 { - phy-type = <PHY_TYPE_SATA0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { status = "okay"; pinctrl-names = "default";
arch/arm/dts/armada-3720-turris-mox.dts +1 -18
@@ -91,24 +91,6 @@ }; }; -&comphy { - max-lanes = <3>; - phy0 { - phy-type = <PHY_TYPE_SGMII1>; - phy-speed = <PHY_SPEED_3_125G>; - }; - - phy1 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_5G>; - }; - - phy2 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { status = "okay"; pinctrl-names = "default";
@@ -216,6 +198,7 @@ &usb3 { vbus-supply = <®_usb3_vbus>; + phys = <&comphy2 0>; status = "okay"; };
arch/arm/dts/armada-3720-uDPU.dts +2 -16
@@ -106,27 +106,12 @@ }; }; -&comphy { - phy0 { - phy-type = <PHY_TYPE_SGMII1>; - phy-speed = <PHY_SPEED_1_25G>; - }; - phy1 { - phy-type = <PHY_TYPE_SGMII0>; - phy-speed = <PHY_SPEED_1_25G>; - }; - - phy2 { - phy-type = <PHY_TYPE_USB3_HOST1>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { pinctrl-0 = <&pcie_pins>; status = "okay"; phy-mode = "sgmii"; phy = <ðphy0>; + phys = <&comphy1 0>; fixed-link { speed = <1000>; full-duplex;
@@ -137,6 +122,7 @@ status = "okay"; phy-mode = "sgmii"; phy = <ðphy1>; + phys = <&comphy0 1>; fixed-link { speed = <1000>; full-duplex;
arch/arm/dts/armada-37xx.dtsi +63 -9
112 lines not on this page · raw message
board/CZ.NIC/turris_mox/turris_mox.c +0 -33
@@ -17,7 +17,6 @@#include <linux/libfdt.h> #include <linux/string.h> #include <miiphy.h> -#include <mvebu/comphy.h> #include <spi.h> #include "mox_sp.h"
@@ -207,38 +206,6 @@ static int mox_get_topology(const u8 **ptopology, int *psize, int *pis_sd)return 0 ; } -int comphy_update_map (struct comphy_map *serdes_map,int count) -{ -int ret, i, size, sfpindex =-1 , swindex =-1 ; -const u8 *topology; - - ret =mox_get_topology (&topology, &size,NULL ); -if (ret) -return ret; - -for (i =0 ; i < size; ++i) { -if (topology[i] ==MOX_MODULE_SFP && sfpindex ==-1 ) - sfpindex = i; -else if ((topology[i] ==MOX_MODULE_TOPAZ || - topology[i] ==MOX_MODULE_PERIDOT ) && - swindex ==-1 ) - swindex = i; - } - -if (sfpindex >=0 && swindex >=0 ) { -if (sfpindex < swindex) - serdes_map[0 ].speed =PHY_SPEED_1_25G ; -else - serdes_map[0 ].speed =PHY_SPEED_3_125G ; - }else if (sfpindex >=0 ) { - serdes_map[0 ].speed =PHY_SPEED_1_25G ; - }else if (swindex >=0 ) { - serdes_map[0 ].speed =PHY_SPEED_3_125G ; - } - -return 0 ; -} -#define SW_SMI_CMD_R (d, r) (0x9800 | (((d) & 0x1f) << 5) | ((r) & 0x1f))#define SW_SMI_CMD_W (d, r) (0x9400 | (((d) & 0x1f) << 5) | ((r) & 0x1f))
configs/mvebu_db-88f3720_defconfig +5 -1
@@ -39,6 +39,8 @@ CONFIG_MAC_PARTITION=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-db" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -61,9 +63,11 @@ CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DEBUG_MVEBU_A3700_UART=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y
configs/mvebu_espressobin-88f3720_defconfig +5 -1
@@ -39,6 +39,8 @@ CONFIG_MAC_PARTITION=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-espressobin" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -61,9 +63,11 @@ CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DEBUG_MVEBU_A3700_UART=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y
configs/turris_mox_defconfig +5 -1
@@ -54,6 +54,8 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-3720-turris-mox" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTCOMMAND="sf probe; sf read ${fdt_addr_r} 0x7f0000 0x10000; run distro_bootcmd" +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y # CONFIG_MVEBU_GPIO is not set
@@ -78,9 +80,11 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y # CONFIG_PCI_PNP is not set -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_RTC=y CONFIG_RTC_DS1307=y
configs/uDPU_defconfig +5 -1
@@ -49,6 +49,8 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-3720-uDPU" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -76,9 +78,11 @@ CONFIG_MVNETA=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DEBUG_MVEBU_A3700_UART=y
Signature · 1 line
2.24.1
PATCH 10/11 arm64: mvebu: armada-37xx: convert to use new generic-phy drivers
This patch converts device trees and defconfigs of Armada 37xx boards (EspressoBIN, A37xx DB, uDPU and Turris MOX) to use the newly ported comphy and utmi generic-phy drivers.
For Turris Mox also remove the comphy_update_map implementation, since it is no longer needed.
--- arch/arm/dts/armada-3720-db.dts | 12 ---- arch/arm/dts/armada-3720-espressobin.dts | 18 ------ arch/arm/dts/armada-3720-turris-mox.dts | 19 +----- arch/arm/dts/armada-3720-uDPU.dts | 18 +----- arch/arm/dts/armada-37xx.dtsi | 72 ++++++++++++++++++--- board/CZ.NIC/turris_mox/turris_mox.c | 33 ---------- configs/mvebu_db-88f3720_defconfig | 6 +- configs/mvebu_espressobin-88f3720_defconfig | 6 +- configs/turris_mox_defconfig | 6 +- configs/uDPU_defconfig | 6 +- 10 files changed, 86 insertions(+), 110 deletions(-)
arch/arm/dts/armada-3720-db.dts +0 -12
@@ -68,18 +68,6 @@ }; }; -&comphy { - phy0 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_2_5G>; - }; - - phy1 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>, <&smi_pins>;
arch/arm/dts/armada-3720-espressobin.dts +0 -18
@@ -69,24 +69,6 @@ }; }; -&comphy { - max-lanes = <3>; - phy0 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_2_5G>; - }; - - phy1 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; - - phy2 { - phy-type = <PHY_TYPE_SATA0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { status = "okay"; pinctrl-names = "default";
arch/arm/dts/armada-3720-turris-mox.dts +1 -18
@@ -70,24 +70,6 @@ }; }; -&comphy { - max-lanes = <3>; - phy0 { - phy-type = <PHY_TYPE_SGMII1>; - phy-speed = <PHY_SPEED_3_125G>; - }; - - phy1 { - phy-type = <PHY_TYPE_PEX0>; - phy-speed = <PHY_SPEED_5G>; - }; - - phy2 { - phy-type = <PHY_TYPE_USB3_HOST0>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { status = "okay"; pinctrl-names = "default";
@@ -164,6 +146,7 @@ &usb3 { vbus-supply = <®_usb3_vbus>; + phys = <&comphy2 0>; status = "okay"; };
arch/arm/dts/armada-3720-uDPU.dts +2 -16
@@ -106,27 +106,12 @@ }; }; -&comphy { - phy0 { - phy-type = <PHY_TYPE_SGMII1>; - phy-speed = <PHY_SPEED_1_25G>; - }; - phy1 { - phy-type = <PHY_TYPE_SGMII0>; - phy-speed = <PHY_SPEED_1_25G>; - }; - - phy2 { - phy-type = <PHY_TYPE_USB3_HOST1>; - phy-speed = <PHY_SPEED_5G>; - }; -}; - ð0 { pinctrl-0 = <&pcie_pins>; status = "okay"; phy-mode = "sgmii"; phy = <ðphy0>; + phys = <&comphy1 0>; fixed-link { speed = <1000>; full-duplex;
@@ -137,6 +122,7 @@ status = "okay"; phy-mode = "sgmii"; phy = <ðphy1>; + phys = <&comphy0 1>; fixed-link { speed = <1000>; full-duplex;
arch/arm/dts/armada-37xx.dtsi +63 -9
112 lines not on this page · raw message
board/CZ.NIC/turris_mox/turris_mox.c +0 -33
@@ -16,7 +16,6 @@#include <linux/libfdt.h> #include <linux/string.h> #include <miiphy.h> -#include <mvebu/comphy.h> #include <spi.h> #include "mox_sp.h"
@@ -193,38 +192,6 @@ static int mox_get_topology(const u8 **ptopology, int *psize, int *pis_sd)return 0 ; } -int comphy_update_map (struct comphy_map *serdes_map,int count) -{ -int ret, i, size, sfpindex =-1 , swindex =-1 ; -const u8 *topology; - - ret =mox_get_topology (&topology, &size,NULL ); -if (ret) -return ret; - -for (i =0 ; i < size; ++i) { -if (topology[i] ==MOX_MODULE_SFP && sfpindex ==-1 ) - sfpindex = i; -else if ((topology[i] ==MOX_MODULE_TOPAZ || - topology[i] ==MOX_MODULE_PERIDOT ) && - swindex ==-1 ) - swindex = i; - } - -if (sfpindex >=0 && swindex >=0 ) { -if (sfpindex < swindex) - serdes_map[0 ].speed =PHY_SPEED_1_25G ; -else - serdes_map[0 ].speed =PHY_SPEED_3_125G ; - }else if (sfpindex >=0 ) { - serdes_map[0 ].speed =PHY_SPEED_1_25G ; - }else if (swindex >=0 ) { - serdes_map[0 ].speed =PHY_SPEED_3_125G ; - } - -return 0 ; -} -#define SW_SMI_CMD_R (d, r) (0x9800 | (((d) & 0x1f) << 5) | ((r) & 0x1f))#define SW_SMI_CMD_W (d, r) (0x9400 | (((d) & 0x1f) << 5) | ((r) & 0x1f))
configs/mvebu_db-88f3720_defconfig +5 -1
@@ -39,6 +39,8 @@ CONFIG_MAC_PARTITION=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-db" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -61,9 +63,11 @@ CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DEBUG_MVEBU_A3700_UART=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y
configs/mvebu_espressobin-88f3720_defconfig +5 -1
@@ -39,6 +39,8 @@ CONFIG_MAC_PARTITION=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-espressobin" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -61,9 +63,11 @@ CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DEBUG_MVEBU_A3700_UART=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y
configs/turris_mox_defconfig +5 -1
@@ -41,6 +41,8 @@ CONFIG_OF_BOARD_SETUP=y CONFIG_DEFAULT_DEVICE_TREE="armada-3720-turris-mox" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y # CONFIG_MVEBU_GPIO is not set
@@ -63,9 +65,11 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y # CONFIG_PCI_PNP is not set -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_RTC=y CONFIG_RTC_DS1307=y
configs/uDPU_defconfig +5 -1
@@ -49,6 +49,8 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-3720-uDPU" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y
@@ -76,9 +78,11 @@ CONFIG_MVNETA=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_PHY=y +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DEBUG_MVEBU_A3700_UART=y
Signature · 1 line
2.24.1
PATCH 11/11 phy: marvell: remove comphy_a3700 driver
In reply to Marek BehúnThis driver is no longer needed since A37xx was ported to generic-phy.
The only thing not covered by those drivers is eMMC PHY init code, but even this is already done in different driver (xenon_sdhci).
--- drivers/phy/marvell/Makefile | 1 - drivers/phy/marvell/comphy_a3700.c | 1021 ---------------------------- drivers/phy/marvell/comphy_a3700.h | 264 ------- drivers/phy/marvell/comphy_core.c | 3 - drivers/phy/marvell/comphy_core.h | 25 +- include/mvebu/comphy.h | 22 - 6 files changed, 9 insertions(+), 1327 deletions(-) delete mode 100644 drivers/phy/marvell/comphy_a3700.c delete mode 100644 drivers/phy/marvell/comphy_a3700.h delete mode 100644 include/mvebu/comphy.h
drivers/phy/marvell/Makefile +0 -1
@@ -2,5 +2,4 @@ obj-$(CONFIG_MVEBU_COMPHY_SUPPORT) += comphy_core.o obj-$(CONFIG_MVEBU_COMPHY_SUPPORT) += comphy_mux.o -obj-$(CONFIG_ARMADA_3700) += comphy_a3700.o obj-$(CONFIG_ARMADA_8K) += comphy_cp110.o
drivers/phy/marvell/comphy_a3700.c deleted +0 -1021
1,021 lines not on this page · raw message
drivers/phy/marvell/comphy_a3700.h deleted +0 -264
264 lines not on this page · raw message
drivers/phy/marvell/comphy_core.c +0 -3
@@ -112,9 +112,6 @@ static int comphy_probe(struct udevice *dev)fdtdec_locate_array (blob, node,"mux-lane-order" , chip_cfg->comphy_lanes_count); -if (device_is_compatible (dev,"marvell,comphy-armada-3700" )) - chip_cfg->ptr_comphy_chip_init = comphy_a3700_init; -if (device_is_compatible (dev,"marvell,comphy-cp110" )) chip_cfg->ptr_comphy_chip_init = comphy_cp110_init;
drivers/phy/marvell/comphy_core.h +9 -16
@@ -7,7 +7,7 @@#define _COMPHY_CORE_H_#include <fdtdec.h> -#include <mvebu/comphy.h> +#include <dt-bindings/comphy/comphy_data.h> #if defined(DEBUG )#define debug_enter () printf("----> Enter %s\n", __func__);
@@ -70,6 +70,14 @@#define MAX_LANE_OPTIONS 10#define MAX_UTMI_PHY_COUNT 3 +struct comphy_map { +u32 type; +u32 speed; +u32 invert; +bool clk_src; +bool end_point; +}; +struct comphy_mux_options {u32 type;u32 mux_value;
@@ -132,21 +140,6 @@ static inline void reg_set16(void __iomem *addr, u16 data, u16 mask) }/* SoC specific init functions */ -#ifdef CONFIG_ARMADA_3700 -int comphy_a3700_init (struct chip_serdes_phy_config *ptr_chip_cfg, -struct comphy_map *serdes_map); -#else -static inline int comphy_a3700_init (struct chip_serdes_phy_config *ptr_chip_cfg, -struct comphy_map *serdes_map) -{ -/* -* This function should never be called in this configuration, so -* lets return an error here. -*/ -return -1 ; -} -#endif -#ifdef CONFIG_ARMADA_8K int comphy_cp110_init (struct chip_serdes_phy_config *ptr_chip_cfg,struct comphy_map *serdes_map);
include/mvebu/comphy.h deleted +0 -22
@@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* Copyright (C) 2015-2016 Marvell International Ltd. -*/ - -#ifndef _MVEBU_COMPHY_H_ -#define _MVEBU_COMPHY_H_ - -#include <dt-bindings/comphy/comphy_data.h> - -struct comphy_map { -u32 type; -u32 speed; -u32 invert; -bool clk_src; -bool end_point; -}; - -int comphy_update_map (struct comphy_map *serdes_map,int count); - -#endif /* _MVEBU_COMPHY_H_ */ -
Signature · 1 line
2.24.1
cover Armada 37xx: port comphy to generic-phys (PLEASE TEST)
In reply to Marek BehúnW dniu 19.04.2020 o?17:48, Marek Beh?n pisze:
Quoted 27 lines
Hi,
I have ported the COMPHY and UTMI PHY drivers from Linux to U-Boot. With this we are able to abandon the current
comphy_a3700driver, which is incompatible with Linux' device trees. So if we want to have DTS files for A3720 boards identical to Linux', we have to do this.This series adds the
set_modefunctionality to generic-phy, then adds the ports of UTMI PHY and COMPHY drivers from Linux, then makes some drivers use the generic-phy API on device probe (these drivers are mvneta,ahci_mvebu, pci-aardvark, xhci-mvebu and ehci-marvell),
then converts defconfigs and device trees to use the new bindings and drivers, and the last patch removes thecomphy_a3700driver.I have successfully compiled U-Boot without errors for all these boards (their defconigs) and also for Armada 8k boards, but am unable to test on anything else but Turris MOX.
Please note that in order for the COMPHY driver to work, you have to use current ARM Trusted Firmware (such that it supports PHY powering on/off via SMC calls).
It would be nice if people tested this series.
Marek
Quoted 12 lines
Marek Beh?n (11):
phy: add support for setting phy mode
phy: port Armada 37xx UTMI PHY from Linux
phy: port Armada 37xx COMPHY from Linux
usb: host: make PHY handling more generic
usb: ehci-marvell: call generic-phy initialization
usb: xhci-mvebu: call generic-phy initialization
pci: aardvark: add PHY support
ata:ahci_mvebu: add PHY support
net: mvneta: add PHY support
arm64: mvebu: armada-37xx: convert to use new generic-phy drivers
phy: marvell: removecomphy_a3700driver
Hi Marek.
Tests done on ESPRESSObin.
I only tested USB ports and the files are loading fine to memory. Also the pci command lists connected card, so
Signature · 1 line
TMN