Skip to contentSkip to conversation

SMSC USB333x ULPI USB PHY Support

PATCH In review Paul Kocialkowski 2 participants 6 messages Jan 30, 2019 – Mar 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover SMSC USB333x ULPI USB PHY Support

This series adds support for the SMSC USB333x ULPI USB PHY.

The USB333x usually does not require particular configuration as it implements generic registers described in the ULPI specification.

However, specific use cases require tweaking some bits. In our case, VBUS is not connected to anything so the internal EXTVBUS signal has to be routed to assert VbusValid.

Paul Kocialkowski (3):
dt-bindings: phy: Add bindings for the SMSC USB333x ULPI USB PHY
phy: Add support for the SMSC USB333x ULPI USB PHY
MAINTAINERS: Add entry for the SMSC USB333x ULPI USB PHY

 .../devicetree/bindings/phy/smsc-usb333x.txt  |  50 +++
 MAINTAINERS                                   |   6 +
 drivers/phy/Kconfig                           |   1 +
 drivers/phy/Makefile                          |   1 +
 drivers/phy/smsc/Kconfig                      |  11 +
 drivers/phy/smsc/Makefile                     |   2 +
 drivers/phy/smsc/phy-usb333x.c                | 301 ++++++++++++++++++
 7 files changed, 372 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/smsc-usb333x.txt
 create mode 100644 drivers/phy/smsc/Kconfig
 create mode 100644 drivers/phy/smsc/Makefile
 create mode 100644 drivers/phy/smsc/phy-usb333x.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 dt-bindings: phy: Add bindings for the SMSC USB333x ULPI USB PHY

Introduce the device-tree bindings for this ULPI USB PHY. Optional bindings that are not prefixed with the vendor may be relevant to other ULPI USB PHYs since they match generic ULPI registers.

---
 .../devicetree/bindings/phy/smsc-usb333x.txt  | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/smsc-usb333x.txt
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +50 -0
new file mode 100644
index 000000000000..50d500d67b2f
@@ -0,0 +1,50 @@
+Device tree bindings for SMSC USB333x ULPI USB PHY
+
+Required properties:
+- compatible: Should be "smsc,usb333x".
+
+Optional properties:
+- reset-gpios: GPIO to reset the PHY.
+- clocks: Reference clock that feeds the PHY's PLL.
+- clock-names: Should be "refclk" for the reference clock.
+- extvbus-passthru: Enable EXTVBUS signal pass-through to assert the VbusValid
+  signal internally. This is useful when no VBUS line is connected to the PHY.
+- auto-resume: Enable automatic transmission resume (in host mode).
+- chrg-vbus: Enable internal VBUS pull-up to 3.3 V during OTG SRP.
+- dischrg-vbus: Enable internal VBUS pull-down during OTG SRP.
+- id-pull-up: Enable internal ID pull-up tp 3.3 V.
+- smsc,varisense: Squelch detector threshold register field value, as described
+  in the datasheet.
+- smsc,phyboost: Output voltage change register field value, as described in the
+  datasheet.
+
+Refer to phy/phy-bindings.txt for the generic PHY binding properties.
+Refer to usb/ulpi.txt for the parent ULPI bus binding required for this PHY.
+
+Example:
+
+&usb0 {
+	compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
+	clocks = <&clkc 28>;
+	interrupt-parent = <&intc>;
+	interrupts = <0 21 4>;
+	reg = <0xe0002000 0x1000>;
+	dr_mode = "peripheral";
+	phys = <&usb_phy0>;
+	phy-names = "usb-phy";
+	phy_type = "ulpi";
+
+	ulpi {
+		usb_phy0: usb-phy0 {
+			#phy-cells = <0>;
+			compatible = "smsc,usb333x";
+			reset-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
+			clocks = <&usb_phy_clk>;
+			clock-names = "refclk";
+			smsc,varisense = <1>;
+			smsc,phyboost = <5>;
+			extvbus-passthru;
+			chrg-vbus;
+		};
+	};
+};
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [PATCH 1/3] dt-bindings: phy: Add bindings for the SMSC USB333x ULPI USB PHY

Quoted 23 lines · Paul Kocialkowski

Introduce the device-tree bindings for this ULPI USB PHY. Optional bindings that are not prefixed with the vendor may be relevant to other ULPI USB PHYs since they match generic ULPI registers.

---
 .../devicetree/bindings/phy/smsc-usb333x.txt  | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/smsc-usb333x.txt
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +6 -0
new file mode 100644
index 000000000000..50d500d67b2f
@@ -0,0 +1,50 @@
+Device tree bindings for SMSC USB333x ULPI USB PHY
+
+Required properties:
+- compatible: Should be "smsc,usb333x".
+
+Optional properties:

Documentation/devicetree/bindings/phy/smsc-usb333x.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +9 -0
+- reset-gpios: GPIO to reset the PHY.
+- clocks: Reference clock that feeds the PHY's PLL.
+- clock-names: Should be "refclk" for the reference clock.
 
+- extvbus-passthru: Enable EXTVBUS signal pass-through to assert the VbusValid
+  signal internally. This is useful when no VBUS line is connected to the PHY.
+- auto-resume: Enable automatic transmission resume (in host mode).
+- chrg-vbus: Enable internal VBUS pull-up to 3.3 V during OTG SRP.
+- dischrg-vbus: Enable internal VBUS pull-down during OTG SRP.
+- id-pull-up: Enable internal ID pull-up tp 3.3 V.

These all need smsc prefix.

Documentation/devicetree/bindings/phy/smsc-usb333x.txt line 19

Quoted 4 lines

+- smsc,varisense: Squelch detector threshold register field value, as described

Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +3 -0
+  in the datasheet.
+- smsc,phyboost: Output voltage change register field value, as described in the
+  datasheet.

Please give a range of values at least so we can write constraints.

Quoted 34 lines
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +31 -0
+
+Refer to phy/phy-bindings.txt for the generic PHY binding properties.
+Refer to usb/ulpi.txt for the parent ULPI bus binding required for this PHY.
+
+Example:
+
+&usb0 {
+	compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
+	clocks = <&clkc 28>;
+	interrupt-parent = <&intc>;
+	interrupts = <0 21 4>;
+	reg = <0xe0002000 0x1000>;
+	dr_mode = "peripheral";
+	phys = <&usb_phy0>;
+	phy-names = "usb-phy";
+	phy_type = "ulpi";
+
+	ulpi {
+		usb_phy0: usb-phy0 {
+			#phy-cells = <0>;
+			compatible = "smsc,usb333x";
+			reset-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
+			clocks = <&usb_phy_clk>;
+			clock-names = "refclk";
+			smsc,varisense = <1>;
+			smsc,phyboost = <5>;
+			extvbus-passthru;
+			chrg-vbus;
+		};
+	};
+};
Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH 1/3] dt-bindings: phy: Add bindings for the SMSC USB333x ULPI USB PHY

Hi and sorry for the late response,

Quoted 27 lines · Rob Herring
Quoted 26 lines · Paul Kocialkowski

Introduce the device-tree bindings for this ULPI USB PHY. Optional bindings that are not prefixed with the vendor may be relevant to other ULPI USB PHYs since they match generic ULPI registers.

---
 .../devicetree/bindings/phy/smsc-usb333x.txt  | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/smsc-usb333x.txt
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +9 -0
new file mode 100644
index 000000000000..50d500d67b2f
@@ -0,0 +1,50 @@
+Device tree bindings for SMSC USB333x ULPI USB PHY
+
+Required properties:
+- compatible: Should be "smsc,usb333x".
+
+Optional properties:
+- reset-gpios: GPIO to reset the PHY.
+- clocks: Reference clock that feeds the PHY's PLL.
+- clock-names: Should be "refclk" for the reference clock.
Quoted 8 lines

Documentation/devicetree/bindings/phy/smsc-usb333x.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +6 -0
+- extvbus-passthru: Enable EXTVBUS signal pass-through to assert the VbusValid
+  signal internally. This is useful when no VBUS line is connected to the PHY.
+- auto-resume: Enable automatic transmission resume (in host mode).
+- chrg-vbus: Enable internal VBUS pull-up to 3.3 V during OTG SRP.
+- dischrg-vbus: Enable internal VBUS pull-down during OTG SRP.
+- id-pull-up: Enable internal ID pull-up tp 3.3 V.

These all need smsc prefix.

Note that these features are not specific to this PHY but reflect the use of fields from the standardized ULPI register set, so they could just as well apply to other ULPI USB PHYs.

With that in mind, do these props still qualify to get a smsc prefix? Perhaps they should be added to bindings/usb/generic.txt instead.

Quoted 6 lines

Documentation/devicetree/bindings/phy/smsc-usb333x.txt line 19

Quoted 4 lines
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +4 -0
+- smsc,varisense: Squelch detector threshold register field value, as described
+  in the datasheet.
+- smsc,phyboost: Output voltage change register field value, as described in the
+  datasheet.

Please give a range of values at least so we can write constraints.

Yes, I'll definitely do that in the next revision.

Thanks for the review!

Cheers,

Paul

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/phy/smsc-usb333x.txt new file +31 -0
+
+Refer to phy/phy-bindings.txt for the generic PHY binding properties.
+Refer to usb/ulpi.txt for the parent ULPI bus binding required for this PHY.
+
+Example:
+
+&usb0 {
+	compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
+	clocks = <&clkc 28>;
+	interrupt-parent = <&intc>;
+	interrupts = <0 21 4>;
+	reg = <0xe0002000 0x1000>;
+	dr_mode = "peripheral";
+	phys = <&usb_phy0>;
+	phy-names = "usb-phy";
+	phy_type = "ulpi";
+
+	ulpi {
+		usb_phy0: usb-phy0 {
+			#phy-cells = <0>;
+			compatible = "smsc,usb333x";
+			reset-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
+			clocks = <&usb_phy_clk>;
+			clock-names = "refclk";
+			smsc,varisense = <1>;
+			smsc,phyboost = <5>;
+			extvbus-passthru;
+			chrg-vbus;
+		};
+	};
+};
Signature · 1 line
2.20.1
Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#4 lore raw

PATCH 2/3 phy: Add support for the SMSC USB333x ULPI USB PHY

In reply to Paul Kocialkowski

This is a standard ULPI USB PHY that works according to the ULPI 1.1 specification, which supports USB 2.0 OTG.

This drivers mostly allows settong a few generic bits that are specific to the use case, in addition to handling the reference clock and reset GPIO. In particular, it allows configuring the PHY to use an internal VBUS reference when nothing is connected to the VBUS pin.

Two vendor-specific fields are also supported, which allow setting up high-speed compensation by lowering the squelch detector threshold and tweaking the PHY's data output voltage.

---
 drivers/phy/Kconfig            |   1 +
 drivers/phy/Makefile           |   1 +
 drivers/phy/smsc/Kconfig       |  11 ++
 drivers/phy/smsc/Makefile      |   2 +
 drivers/phy/smsc/phy-usb333x.c | 301 +++++++++++++++++++++++++++++++++
 5 files changed, 316 insertions(+)
 create mode 100644 drivers/phy/smsc/Kconfig
 create mode 100644 drivers/phy/smsc/Makefile
 create mode 100644 drivers/phy/smsc/phy-usb333x.c
drivers/phy/Kconfig +1 -0
index 250abe290ca1..f1bed15f7e5c 100644
@@ -64,6 +64,7 @@ source "drivers/phy/ralink/Kconfig"
 source "drivers/phy/renesas/Kconfig"
 source "drivers/phy/rockchip/Kconfig"
 source "drivers/phy/samsung/Kconfig"
+source "drivers/phy/smsc/Kconfig"
 source "drivers/phy/socionext/Kconfig"
 source "drivers/phy/st/Kconfig"
 source "drivers/phy/tegra/Kconfig"
drivers/phy/Makefile +1 -0
index 0d9fddc498a6..499987ba26d1 100644
@@ -25,6 +25,7 @@ obj-y					+= broadcom/	\
 					   qualcomm/	\
 					   ralink/	\
 					   samsung/	\
+					   smsc/	\
 					   socionext/	\
 					   st/		\
 					   ti/
drivers/phy/smsc/Kconfig new file +11 -0
new file mode 100644
index 000000000000..2d9904986250
@@ -0,0 +1,11 @@
+#
+# PHY drivers for SMSC platforms
+#
+config PHY_USB333X
+	tristate "SMSC USB333x ULPI USB PHY Driver"
+	depends on USB_ULPI_BUS
+	select GENERIC_PHY
+	help
+	  Support for SMSC USB333x ULPI USB PHY.
+
+
drivers/phy/smsc/Makefile new file +2 -0
new file mode 100644
index 000000000000..1cafd3b5845f
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_PHY_USB333X)		+= phy-usb333x.o
drivers/phy/smsc/phy-usb333x.c new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.20.1
#5 lore raw

PATCH 3/3 MAINTAINERS: Add entry for the SMSC USB333x ULPI USB PHY

In reply to Paul Kocialkowski

Add a new MAINTAINERS entry for this ULPI USB PHY.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index d2d5caf789c7..33f1538b30c0 100644
@@ -14146,6 +14146,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/video/fbdev/smscufx.c
 
+SMSC USB333x ULPI USB PHY DRIVER
+M:	Paul Kocialkowski <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/phy/smsc/phy-usb333x.c
+
 SMSC47B397 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <[email protected]>
 L:	[email protected]
Signature · 1 line
2.20.1