phy: add support for STM32 usb phy controller
Subsystems (3)
PATCH v2 1/1 phy: add support for STM32 usb phy controller
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
---
Changes in v2:
- Add bindings documentation
.../devicetree/bindings/phy/phy-stm32-usbphyc.txt | 73 ++++ drivers/phy/Kconfig | 13 + drivers/phy/Makefile | 1 + drivers/phy/phy-stm32-usbphyc.c | 403 +++++++++++++++++++++ 4 files changed, 490 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt create mode 100644 drivers/phy/phy-stm32-usbphyc.c
Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt new file +73 -0
@@ -0,0 +1,73 @@ +STMicroelectronics STM32 USB HS PHY controller + +The STM32 USBPHYC block contains a dual port High Speed UTMI+ PHY and a UTMI +switch. It controls PHY configuration and status, and the UTMI+ switch that +selects either OTG or HOST controller for the second PHY port. It also sets +PLL configuration. + +USBPHYC + |_ PLL + | + |_ PHY port#1 _________________ HOST controller + | _ | + | / 1|________________| + |_ PHY port#2 ----| |________________ + | \_0| | + |_ UTMI switch_______| OTG controller + + +Phy provider node +================= + +Required properties: +- compatible: must be "st,stm32mp1-usbphyc" +- reg: address and length of the usb phy control register set +- clocks: phandle + clock specifier for the PLL phy clock +- #address-cells: number of address cells for phys sub-nodes, must be <1> +- #size-cells: number of size cells for phys sub-nodes, must be <0> + +Optional properties: +- assigned-clocks: phandle + clock specifier for the PLL phy clock +- assigned-clock-parents: the PLL phy clock parent +- resets: phandle + reset specifier + +Required nodes: one sub-node per port the controller provides. + +Phy sub-nodes +============== + +Required properties: +- reg: phy port index +- phy-supply: phandle to the regulator providing 3V3 power to the PHY, + see phy-bindings.txt in the same directory. +- vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY +- vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY +- #phy-cells: see phy-bindings.txt in the same directory, must be <0> for PHY + port#1 and must be <1> for PHY port#2, to select USB controller + + +Example: + usbphyc: usb-phy at 5a006000 { + compatible = "st,stm32mp1-usbphyc"; + reg = <0x5a006000 0x1000>; + clocks = <&rcc_clk USBPHY_K>; + resets = <&rcc_rst USBPHY_R>; + #address-cells = <1>; + #size-cells = <0>; + + usbphyc_port0: usb-phy at 0 { + reg = <0>; + phy-supply = <&vdd_usb>; + vdda1v1-supply = <®11>; + vdda1v8-supply = <®18> + #phy-cells = <0>; + }; + + usbphyc_port1: usb-phy at 1 { + reg = <1>; + phy-supply = <&vdd_usb>; + vdda1v1-supply = <®11>; + vdda1v8-supply = <®18> + #phy-cells = <1>; + }; + };
drivers/phy/Kconfig +13 -0
@@ -110,4 +110,17 @@ config STI_USB_PHY used by USB2 and USB3 Host controllers available on STiH407 SoC families. +config PHY_STM32_USBPHYC + tristate "STMicroelectronics STM32 SoC USB HS PHY driver" + depends on PHY && ARCH_STM32MP + help + Enable this to support the High-Speed USB transceiver that is part of + STMicroelectronics STM32 SoCs. + + This driver controls the entire USB PHY block: the USB PHY controller + (USBPHYC) and the two 8-bit wide UTMI+ interface. First interface is + used by an HS USB Host controller, and the second one is shared + between an HS USB OTG controller and an HS USB Host controller, + selected by an USB switch. + endmenu
drivers/phy/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_BCM6368_USBH_PHY) += bcm6368-usbh-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o +obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o
drivers/phy/phy-stm32-usbphyc.c new file +403 -0
403 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 1/1 phy: add support for STM32 usb phy controller
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 16 lines
drivers/phy/phy-stm32-usbphyc.c new file +16
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; +
drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 10 lines
drivers/phy/phy-stm32-usbphyc.c new file +10
-0+ ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; + +/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);
Shouldn't the reset delay be a reset controller property ?
Review
Quoted 1 line
(quoted diff) +1
-0+ }
Looks good,
Remind me to pick it after the release please.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 1/1 phy: add support for STM32 usb phy controller
Hi Marek
Quoted 38 lines · Marek Vasut
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 20 lines
drivers/phy/phy-stm32-usbphyc.c new file +20
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; + + ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; +
Quoted 8 lines
drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 6 lines
drivers/phy/phy-stm32-usbphyc.c new file +6
-0+/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);Shouldn't the reset delay be a reset controller property ?
There is no delay property in reset framework. The delay is more dependent of the reseted IP than the reset controller.
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ }Looks good,
Reviewed-by Marek Vasut <[email protected]>Remind me to pick it after the release please.
Ok
Thanks
Patrice
Quoted 1 line
PATCH v2 1/1 phy: add support for STM32 usb phy controller
Quoted 50 lines · Patrice CHOTARD
Hi Marek
Quoted 38 lines · Marek Vasut
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 20 lines
drivers/phy/phy-stm32-usbphyc.c new file +20
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; + + ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; +Quoted 8 lines
drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 6 lines
drivers/phy/phy-stm32-usbphyc.c new file +6
-0+/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);Shouldn't the reset delay be a reset controller property ?
Quoted 2 lines
There is no delay property in reset framework. The delay is more dependent of the reseted IP than the reset controller.
OK, so be it.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 1/1 phy: add support for STM32 usb phy controller
In reply to Marek VasutHi Marek
Quoted 47 lines · Marek Vasut
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 16 lines
drivers/phy/phy-stm32-usbphyc.c new file +16
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; +drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 10 lines
drivers/phy/phy-stm32-usbphyc.c new file +10
-0+ ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; + +/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);Shouldn't the reset delay be a reset controller property ?
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ }Looks good,
Reviewed-by Marek Vasut <[email protected]>Remind me to pick it after the release please.
As you requested to me, can you pick the patch ?
Thanks
Patrice
PATCH v2 1/1 phy: add support for STM32 usb phy controller
Quoted 55 lines · Patrice CHOTARD
Hi Marek
Quoted 52 lines · Marek Vasut
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 16 lines
drivers/phy/phy-stm32-usbphyc.c new file +16
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; +drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 10 lines
drivers/phy/phy-stm32-usbphyc.c new file +10
-0+ ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; + +/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);Shouldn't the reset delay be a reset controller property ?
Quoted 4 lines
Quoted 2 lines
Remind me to pick it after the release please.
As you requested to me, can you pick the patch ?
I had to tweak the patch a bit, since it didnt apply anymore. Please check if it's correct, it should be OK though.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 1/1 phy: add support for STM32 usb phy controller
Hi Marek
Quoted 56 lines · Marek Vasut
Quoted 55 lines · Patrice CHOTARD
Hi Marek
Quoted 52 lines · Marek Vasut
Quoted 4 lines · Patrice Chotard
This patch adds phy tranceiver driver for STM32 USB PHY Controller (usbphyc) that provides dual port High-Speed phy for OTG (single port) and EHCI/OHCI host controller (two ports).
Oh, I see.
Quoted 7 lines
One port of the phy is shared between the two USB controllers through a UTMI+ switch.
Signed-off-by Christophe Kerello <[email protected]>Signed-off-by Amelie Delaunay <[email protected]>Signed-off-by Patrice Chotard <[email protected]>---
[...]
Quoted 16 lines
drivers/phy/phy-stm32-usbphyc.c new file +16
-0+static int stm32_usbphyc_probe (struct udevice *dev) +{ +struct stm32_usbphyc *usbphyc =dev_get_priv (dev); +struct reset_ctl reset; +ofnode node; +int i, ret; + + usbphyc->base =dev_read_addr (dev); +if (usbphyc->base ==FDT_ADDR_T_NONE ) +return -EINVAL ; + +/* Enable clock */ + ret =clk_get_by_index (dev,0 , &usbphyc->clk); +if (ret) +return ret; +drivers/phy/phy-stm32-usbphyc.c line 352
Quoted 10 lines
drivers/phy/phy-stm32-usbphyc.c new file +10
-0+ ret =clk_enable (&usbphyc->clk); +if (ret) +return ret; + +/* Reset */ + ret =reset_get_by_index (dev,0 , &reset); +if (!ret) { +reset_assert (&reset); +udelay (2 ); +reset_deassert (&reset);Shouldn't the reset delay be a reset controller property ?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Remind me to pick it after the release please.
As you requested to me, can you pick the patch ?
I had to tweak the patch a bit, since it didnt apply anymore. Please check if it's correct, it should be OK though.
Perfect !
Thanks
Patrice