linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board
@ 2023-08-19  3:17 Sam Protsenko
  2023-08-19  3:17 ` [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support Sam Protsenko
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

This patch series enables USB gadget, USB host and Ethernet support for
E850-96 board. The most major change was done in USB PHY driver, as the
register layout of PHY block in Exynos850 is very different from
Exynos5 one.

Sam Protsenko (8):
  dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
  dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
  usb: dwc3: exynos: Add support for Exynos850 variant
  phy: exynos5-usbdrd: Make it possible to pass custom phy ops
  phy: exynos5-usbdrd: Add 26MHz ref clk support
  phy: exynos5-usbdrd: Add Exynos850 support
  arm64: dts: exynos: Enable USB in Exynos850
  arm64: dts: exynos: Enable USB support on E850-96 board

 .../bindings/phy/samsung,usb3-drd-phy.yaml    |   1 +
 .../bindings/usb/samsung,exynos-dwc3.yaml     |  16 ++
 .../boot/dts/exynos/exynos850-e850-96.dts     |  58 ++++++
 arch/arm64/boot/dts/exynos/exynos850.dtsi     |  30 +++
 drivers/phy/samsung/phy-exynos5-usbdrd.c      | 182 +++++++++++++++++-
 drivers/usb/dwc3/dwc3-exynos.c                |   9 +
 6 files changed, 294 insertions(+), 2 deletions(-)

-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  7:09   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: " Sam Protsenko
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Exynos850 has dwc3 compatible USB controller, so it can reuse existing
dwc3 glue layer. Document a new compatible for Exynos850 and its clocks.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 .../bindings/usb/samsung,exynos-dwc3.yaml        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml b/Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml
index 42ceaf13cd5d..fc9a425be5fe 100644
--- a/Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml
@@ -15,6 +15,7 @@ properties:
       - samsung,exynos5250-dwusb3
       - samsung,exynos5433-dwusb3
       - samsung,exynos7-dwusb3
+      - samsung,exynos850-dwusb3
 
   '#address-cells':
     const: 1
@@ -101,6 +102,21 @@ allOf:
             - const: usbdrd30_susp_clk
             - const: usbdrd30_axius_clk
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: samsung,exynos850-dwusb3
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          maxItems: 2
+        clock-names:
+          items:
+            - const: bus_early
+            - const: ref
+
 additionalProperties: false
 
 examples:
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
  2023-08-19  3:17 ` [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  7:11   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant Sam Protsenko
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Document Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two
clocks (ref and phy), which is already described in bindings.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml
index 5ba55f9f20cc..452e584d9812 100644
--- a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml
@@ -29,6 +29,7 @@ properties:
       - samsung,exynos5420-usbdrd-phy
       - samsung,exynos5433-usbdrd-phy
       - samsung,exynos7-usbdrd-phy
+      - samsung,exynos850-usbdrd-phy
 
   clocks:
     minItems: 2
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
  2023-08-19  3:17 ` [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support Sam Protsenko
  2023-08-19  3:17 ` [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: " Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  7:11   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops Sam Protsenko
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Add Exynos850 compatible string and associated driver data. Only two
clocks are needed for this SoC:
  - bus_early: bus clock needed for registers access
  - ref: USB 2.0 DRD reference clock (50 MHz)

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/usb/dwc3/dwc3-exynos.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index f882dd647340..5d365ca51771 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -163,6 +163,12 @@ static const struct dwc3_exynos_driverdata exynos7_drvdata = {
 	.suspend_clk_idx = 1,
 };
 
+static const struct dwc3_exynos_driverdata exynos850_drvdata = {
+	.clk_names = { "bus_early", "ref" },
+	.num_clks = 2,
+	.suspend_clk_idx = -1,
+};
+
 static const struct of_device_id exynos_dwc3_match[] = {
 	{
 		.compatible = "samsung,exynos5250-dwusb3",
@@ -173,6 +179,9 @@ static const struct of_device_id exynos_dwc3_match[] = {
 	}, {
 		.compatible = "samsung,exynos7-dwusb3",
 		.data = &exynos7_drvdata,
+	}, {
+		.compatible = "samsung,exynos850-dwusb3",
+		.data = &exynos850_drvdata,
 	}, {
 	}
 };
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (2 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  7:12   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support Sam Protsenko
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Provide a way to use different PHY ops for different chips. Right now
all chips are using exynos5_usbdrd_phy_ops, but it won't always be the
case. For example, Exynos850 has very different USB PHY block, so there
will be another PHY ops implementation for that chip.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/phy/samsung/phy-exynos5-usbdrd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index 06484abb5705..1ece4a1a1a6e 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -165,6 +165,7 @@ struct exynos5_usbdrd_phy_config {
 
 struct exynos5_usbdrd_phy_drvdata {
 	const struct exynos5_usbdrd_phy_config *phy_cfg;
+	const struct phy_ops *phy_ops;
 	u32 pmu_offset_usbdrd0_phy;
 	u32 pmu_offset_usbdrd1_phy;
 	bool has_common_clk_gate;
@@ -779,6 +780,7 @@ static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = {
 
 static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
 	.phy_cfg		= phy_cfg_exynos5,
+	.phy_ops		= &exynos5_usbdrd_phy_ops,
 	.pmu_offset_usbdrd0_phy	= EXYNOS5_USBDRD_PHY_CONTROL,
 	.pmu_offset_usbdrd1_phy	= EXYNOS5420_USBDRD1_PHY_CONTROL,
 	.has_common_clk_gate	= true,
@@ -786,12 +788,14 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
 
 static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
 	.phy_cfg		= phy_cfg_exynos5,
+	.phy_ops		= &exynos5_usbdrd_phy_ops,
 	.pmu_offset_usbdrd0_phy	= EXYNOS5_USBDRD_PHY_CONTROL,
 	.has_common_clk_gate	= true,
 };
 
 static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
 	.phy_cfg		= phy_cfg_exynos5,
+	.phy_ops		= &exynos5_usbdrd_phy_ops,
 	.pmu_offset_usbdrd0_phy	= EXYNOS5_USBDRD_PHY_CONTROL,
 	.pmu_offset_usbdrd1_phy	= EXYNOS5433_USBHOST30_PHY_CONTROL,
 	.has_common_clk_gate	= false,
@@ -799,6 +803,7 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
 
 static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
 	.phy_cfg		= phy_cfg_exynos5,
+	.phy_ops		= &exynos5_usbdrd_phy_ops,
 	.pmu_offset_usbdrd0_phy	= EXYNOS5_USBDRD_PHY_CONTROL,
 	.has_common_clk_gate	= false,
 };
@@ -906,8 +911,8 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
 	dev_vdbg(dev, "Creating usbdrd_phy phy\n");
 
 	for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {
-		struct phy *phy = devm_phy_create(dev, NULL,
-						  &exynos5_usbdrd_phy_ops);
+		struct phy *phy = devm_phy_create(dev, NULL, drv_data->phy_ops);
+
 		if (IS_ERR(phy)) {
 			dev_err(dev, "Failed to create usbdrd_phy phy\n");
 			return PTR_ERR(phy);
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (3 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  7:41   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support Sam Protsenko
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Modern Exynos chips (like Exynos850) might have 26 MHz OSCCLK external
clock, which is also used as a PHY reference clock. For some USB PHY
controllers (e.g USB DRD PHY block on Exynos850) there is no need to set
the refclk frequency at all (and corresponding bits in CLKRSTCTRL[7:5]
are marked RESERVED), so that value won't be set in the driver. But
even in that case, 26 MHz support still has to be added, otherwise
exynos5_rate_to_clk() fails, which leads in turn to probe error.

Add the correct value for 26MHz refclk to make it possible to add
support for new Exynos USB DRD PHY controllers.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/phy/samsung/phy-exynos5-usbdrd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index 1ece4a1a1a6e..41508db87b9b 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -30,6 +30,7 @@
 #define EXYNOS5_FSEL_19MHZ2		0x3
 #define EXYNOS5_FSEL_20MHZ		0x4
 #define EXYNOS5_FSEL_24MHZ		0x5
+#define EXYNOS5_FSEL_26MHZ		0x82
 #define EXYNOS5_FSEL_50MHZ		0x7
 
 /* Exynos5: USB 3.0 DRD PHY registers */
@@ -244,6 +245,9 @@ static unsigned int exynos5_rate_to_clk(unsigned long rate, u32 *reg)
 	case 24 * MHZ:
 		*reg = EXYNOS5_FSEL_24MHZ;
 		break;
+	case 26 * MHZ:
+		*reg = EXYNOS5_FSEL_26MHZ;
+		break;
 	case 50 * MHZ:
 		*reg = EXYNOS5_FSEL_50MHZ;
 		break;
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (4 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  8:32   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850 Sam Protsenko
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Implement Exynos850 USB 2.0 DRD PHY controller support. Exynos850 has
quite a different PHY controller than Exynos5 compatible controllers,
but it's still possible to implement it on top of existing
exynos5-usbdrd driver infrastructure.

Only UTMI+ (USB 2.0) PHY interface is implemented, as Exynos850 doesn't
support USB 3.0.

Only two clocks are used for this controller:
  - phy: bus clock, used for PHY registers access
  - ref: PHY reference clock (OSCCLK)

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/phy/samsung/phy-exynos5-usbdrd.c | 169 +++++++++++++++++++++++
 1 file changed, 169 insertions(+)

diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index 41508db87b9b..3f310b28bfff 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -145,6 +145,34 @@
 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5		(0x20 << 4)
 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M		(0x40 << 4)
 
+/* Exynos850: USB DRD PHY registers */
+#define EXYNOS850_DRD_LINKCTRL			0x04
+#define LINKCTRL_BUS_FILTER_BYPASS(_x)		((_x) << 4)
+#define LINKCTRL_FORCE_QACT			BIT(8)
+
+#define EXYNOS850_DRD_CLKRST			0x20
+#define CLKRST_LINK_SW_RST			BIT(0)
+#define CLKRST_PORT_RST				BIT(1)
+#define CLKRST_PHY_SW_RST			BIT(3)
+
+#define EXYNOS850_DRD_UTMI			0x50
+#define UTMI_FORCE_SLEEP			BIT(0)
+#define UTMI_FORCE_SUSPEND			BIT(1)
+#define UTMI_DM_PULLDOWN			BIT(2)
+#define UTMI_DP_PULLDOWN			BIT(3)
+#define UTMI_FORCE_BVALID			BIT(4)
+#define UTMI_FORCE_VBUSVALID			BIT(5)
+
+#define EXYNOS850_DRD_HSP			0x54
+#define HSP_COMMONONN				BIT(8)
+#define HSP_EN_UTMISUSPEND			BIT(9)
+#define HSP_VBUSVLDEXT				BIT(12)
+#define HSP_VBUSVLDEXTSEL			BIT(13)
+#define HSP_FSV_OUT_EN				BIT(24)
+
+#define EXYNOS850_DRD_HSP_TEST			0x5c
+#define HSP_TEST_SIDDQ				BIT(24)
+
 #define KHZ	1000
 #define MHZ	(KHZ * KHZ)
 
@@ -716,6 +744,129 @@ static const struct phy_ops exynos5_usbdrd_phy_ops = {
 	.owner		= THIS_MODULE,
 };
 
+static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
+{
+	void __iomem *regs_base = phy_drd->reg_phy;
+	u32 reg;
+
+	/*
+	 * Disable HWACG (hardware auto clock gating control). This will force
+	 * QACTIVE signal in Q-Channel interface to HIGH level, to make sure
+	 * the PHY clock is not gated by the hardware.
+	 */
+	reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL);
+	reg |= LINKCTRL_FORCE_QACT;
+	writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL);
+
+	/* Start PHY Reset (POR=high) */
+	reg = readl(regs_base + EXYNOS850_DRD_CLKRST);
+	reg |= CLKRST_PHY_SW_RST;
+	writel(reg, regs_base + EXYNOS850_DRD_CLKRST);
+
+	/* Enable UTMI+ */
+	reg = readl(regs_base + EXYNOS850_DRD_UTMI);
+	reg &= ~(UTMI_FORCE_SUSPEND | UTMI_FORCE_SLEEP | UTMI_DP_PULLDOWN |
+		 UTMI_DM_PULLDOWN);
+	writel(reg, regs_base + EXYNOS850_DRD_UTMI);
+
+	/* Set PHY clock and control HS PHY */
+	reg = readl(regs_base + EXYNOS850_DRD_HSP);
+	reg |= HSP_EN_UTMISUSPEND | HSP_COMMONONN;
+	writel(reg, regs_base + EXYNOS850_DRD_HSP);
+
+	/* Set VBUS Valid and D+ pull-up control by VBUS pad usage */
+	reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL);
+	reg |= LINKCTRL_BUS_FILTER_BYPASS(0xf);
+	writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL);
+
+	reg = readl(regs_base + EXYNOS850_DRD_UTMI);
+	reg |= UTMI_FORCE_BVALID | UTMI_FORCE_VBUSVALID;
+	writel(reg, regs_base + EXYNOS850_DRD_UTMI);
+
+	reg = readl(regs_base + EXYNOS850_DRD_HSP);
+	reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL;
+	writel(reg, regs_base + EXYNOS850_DRD_HSP);
+
+	/* Power up PHY analog blocks */
+	reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST);
+	reg &= ~HSP_TEST_SIDDQ;
+	writel(reg, regs_base + EXYNOS850_DRD_HSP_TEST);
+
+	/* Finish PHY reset (POR=low) */
+	udelay(10); /* required before doing POR=low */
+	reg = readl(regs_base + EXYNOS850_DRD_CLKRST);
+	reg &= ~(CLKRST_PHY_SW_RST | CLKRST_PORT_RST);
+	writel(reg, regs_base + EXYNOS850_DRD_CLKRST);
+	udelay(75); /* required after POR=low for guaranteed PHY clock */
+
+	/* Disable single ended signal out */
+	reg = readl(regs_base + EXYNOS850_DRD_HSP);
+	reg &= ~HSP_FSV_OUT_EN;
+	writel(reg, regs_base + EXYNOS850_DRD_HSP);
+}
+
+static int exynos850_usbdrd_phy_init(struct phy *phy)
+{
+	struct phy_usb_instance *inst = phy_get_drvdata(phy);
+	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
+	int ret;
+
+	ret = clk_prepare_enable(phy_drd->clk);
+	if (ret)
+		return ret;
+
+	/* UTMI or PIPE3 specific init */
+	inst->phy_cfg->phy_init(phy_drd);
+
+	clk_disable_unprepare(phy_drd->clk);
+
+	return 0;
+}
+
+static int exynos850_usbdrd_phy_exit(struct phy *phy)
+{
+	struct phy_usb_instance *inst = phy_get_drvdata(phy);
+	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
+	void __iomem *regs_base = phy_drd->reg_phy;
+	u32 reg;
+	int ret;
+
+	ret = clk_prepare_enable(phy_drd->clk);
+	if (ret)
+		return ret;
+
+	/* Set PHY clock and control HS PHY */
+	reg = readl(regs_base + EXYNOS850_DRD_UTMI);
+	reg &= ~(UTMI_DP_PULLDOWN | UTMI_DM_PULLDOWN);
+	reg |= UTMI_FORCE_SUSPEND | UTMI_FORCE_SLEEP;
+	writel(reg, regs_base + EXYNOS850_DRD_UTMI);
+
+	/* Power down PHY analog blocks */
+	reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST);
+	reg |= HSP_TEST_SIDDQ;
+	writel(reg, regs_base + EXYNOS850_DRD_HSP_TEST);
+
+	/* Link reset */
+	reg = readl(regs_base + EXYNOS850_DRD_CLKRST);
+	reg |= CLKRST_LINK_SW_RST;
+	writel(reg, regs_base + EXYNOS850_DRD_CLKRST);
+	udelay(10); /* required before doing POR=low */
+	reg &= ~CLKRST_LINK_SW_RST;
+	writel(reg, regs_base + EXYNOS850_DRD_CLKRST);
+
+	clk_disable_unprepare(phy_drd->clk);
+
+	return 0;
+}
+
+static const struct phy_ops exynos850_usbdrd_phy_ops = {
+	.init		= exynos850_usbdrd_phy_init,
+	.exit		= exynos850_usbdrd_phy_exit,
+	.power_on	= exynos5_usbdrd_phy_power_on,
+	.power_off	= exynos5_usbdrd_phy_power_off,
+	.owner		= THIS_MODULE,
+};
+
 static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd)
 {
 	unsigned long ref_rate;
@@ -782,6 +933,14 @@ static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = {
 	},
 };
 
+static const struct exynos5_usbdrd_phy_config phy_cfg_exynos850[] = {
+	{
+		.id		= EXYNOS5_DRDPHY_UTMI,
+		.phy_isol	= exynos5_usbdrd_phy_isol,
+		.phy_init	= exynos850_usbdrd_utmi_init,
+	},
+};
+
 static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
 	.phy_cfg		= phy_cfg_exynos5,
 	.phy_ops		= &exynos5_usbdrd_phy_ops,
@@ -812,6 +971,13 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
 	.has_common_clk_gate	= false,
 };
 
+static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
+	.phy_cfg		= phy_cfg_exynos850,
+	.phy_ops		= &exynos850_usbdrd_phy_ops,
+	.pmu_offset_usbdrd0_phy	= EXYNOS5_USBDRD_PHY_CONTROL,
+	.has_common_clk_gate	= true,
+};
+
 static const struct of_device_id exynos5_usbdrd_phy_of_match[] = {
 	{
 		.compatible = "samsung,exynos5250-usbdrd-phy",
@@ -825,6 +991,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = {
 	}, {
 		.compatible = "samsung,exynos7-usbdrd-phy",
 		.data = &exynos7_usbdrd_phy
+	}, {
+		.compatible = "samsung,exynos850-usbdrd-phy",
+		.data = &exynos850_usbdrd_phy
 	},
 	{ },
 };
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (5 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  8:33   ` Krzysztof Kozlowski
  2023-08-19  3:17 ` [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board Sam Protsenko
  2023-08-22 14:29 ` (subset) [PATCH 0/8] arm64: exynos: Enable USB for " Vinod Koul
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

Add USB controller and USB PHY controller nodes for Exynos850 SoC.

The USB controller has next features:
  - Dual Role Device (DRD) controller
  - DWC3 compatible
  - Supports USB 2.0 host and USB 2.0 device interfaces
  - Supports  full-speed (12 Mbps) and high-speed (480 Mbps) modes with
    USB device 2.0 interface
  - Supports on-chip USB PHY transceiver
  - Supports up to 16 bi-directional endpoints (that includes control
    endpoint 0)
  - Complies with xHCI 1.00 specification

Only USB 2.0 is supported in Exynos850, so only UTMI+ PHY interface is
specified in "phys" property (index 0) and PIPE3 is omitted (index 1).

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos850.dtsi b/arch/arm64/boot/dts/exynos/exynos850.dtsi
index aa077008b3be..198d1dfcc672 100644
--- a/arch/arm64/boot/dts/exynos/exynos850.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos850.dtsi
@@ -570,6 +570,36 @@ sysreg_cmgp: syscon@11c20000 {
 			clocks = <&cmu_cmgp CLK_GOUT_SYSREG_CMGP_PCLK>;
 		};
 
+		usbdrd: usb@13600000 {
+			compatible = "samsung,exynos850-dwusb3";
+			clocks = <&cmu_hsi CLK_GOUT_USB_BUS_EARLY_CLK>,
+				 <&cmu_hsi CLK_GOUT_USB_REF_CLK>;
+			clock-names = "bus_early", "ref";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x0 0x13600000 0x10000>;
+			status = "disabled";
+
+			usbdrd_dwc3: usb@0 {
+				compatible = "snps,dwc3";
+				reg = <0x0 0x10000>;
+				interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&usbdrd_phy 0>;
+				phy-names = "usb2-phy";
+			};
+		};
+
+		usbdrd_phy: phy@135d0000 {
+			compatible = "samsung,exynos850-usbdrd-phy";
+			reg = <0x135d0000 0x100>;
+			clocks = <&cmu_hsi CLK_GOUT_USB_PHY_ACLK>,
+				 <&cmu_hsi CLK_GOUT_USB_PHY_REF_CLK>;
+			clock-names = "phy", "ref";
+			samsung,pmu-syscon = <&pmu_system_controller>;
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+
 		usi_uart: usi@138200c0 {
 			compatible = "samsung,exynos850-usi";
 			reg = <0x138200c0 0x20>;
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (6 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850 Sam Protsenko
@ 2023-08-19  3:17 ` Sam Protsenko
  2023-08-19  8:36   ` Krzysztof Kozlowski
  2023-08-22 14:29 ` (subset) [PATCH 0/8] arm64: exynos: Enable USB for " Vinod Koul
  8 siblings, 1 reply; 19+ messages in thread
From: Sam Protsenko @ 2023-08-19  3:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

The E850-96 board has a micro-USB socket and two USB 2.0 host sockets.
The USB role (host or peripheral) is selected automatically depending on
micro-USB cable attachment state:
  - micro-USB cable is attached: USB device role
  - micro-USB cable is detached: USB host role

USB can't act simultaneously as a device and a host, because Exynos850
SoC has only one USB controller and there are no external USB
controllers on the E850-96 board. So the USB switch chip (specifically
TS3USB221A) connects SoC USB lines either to micro-USB connector or to
USB hub chip (LAN9514), w.r.t. micro-USB cable attachment state.

When USB works in the host role, Ethernet capability becomes available
too, as LAN9514 chip (providing USB hub) also enables Ethernet PHY and
Ethernet MAC.

Dynamic role switching is done in gpio-usb-b-connector, using current
micro-USB VBUS line level as a trigger:
  - VBUS=high: SoC USB lines are wired to micro-USB socket
  - VBUS=low: SoC USB lines are wired to USB hub chip

In order to make USB host functional when the board is booted with
micro-USB cable disconnected, role-switch-default-mode = "host" is used.

One can look at E850-96 board schematics [1] to figure out how exactly
all related USB hardware connections and lines reflect into
corresponding device tree definitions.

As PMIC regulators are not implemented yet, we rely on USB LDOs being
already enabled in the bootloader, and a dummy regulator is provided to
"usbdrd" vdd nodes for now.

[1] https://www.96boards.org/documentation/consumer/e850-96b/hardware-docs/

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 .../boot/dts/exynos/exynos850-e850-96.dts     | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos850-e850-96.dts b/arch/arm64/boot/dts/exynos/exynos850-e850-96.dts
index 6ed38912507f..8d733361ef82 100644
--- a/arch/arm64/boot/dts/exynos/exynos850-e850-96.dts
+++ b/arch/arm64/boot/dts/exynos/exynos850-e850-96.dts
@@ -29,6 +29,22 @@ chosen {
 		stdout-path = &serial_0;
 	};
 
+	connector {
+		compatible = "gpio-usb-b-connector", "usb-b-connector";
+		label = "micro-USB";
+		type = "micro";
+		vbus-supply = <&reg_usb_host_vbus>;
+		id-gpios = <&gpa0 0 GPIO_ACTIVE_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&micro_usb_det_pins>;
+
+		port {
+			usb_dr_connector: endpoint {
+				remote-endpoint = <&usb1_drd_sw>;
+			};
+		};
+	};
+
 	/*
 	 * RAM: 4 GiB (eMCP):
 	 *   - 2 GiB at 0x80000000
@@ -111,6 +127,20 @@ bt_active_led: led-5 {
 		};
 	};
 
+	/* TODO: Remove this once PMIC is implemented  */
+	reg_dummy: regulator-0 {
+		compatible = "regulator-fixed";
+		regulator-name = "dummy_reg";
+	};
+
+	reg_usb_host_vbus: regulator-1 {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_host_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpa3 5 GPIO_ACTIVE_LOW>;
+	};
+
 	/*
 	 * RTC clock (XrtcXTI); external, must be 32.768 kHz.
 	 *
@@ -172,6 +202,12 @@ key_volup_pins: key-volup-pins {
 		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
 		samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
 	};
+
+	micro_usb_det_pins: micro-usb-det-pins {
+		samsung,pins = "gpa0-0";
+		samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
+		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+	};
 };
 
 &rtc {
@@ -186,6 +222,28 @@ &serial_0 {
 	pinctrl-0 = <&uart1_pins>;
 };
 
+&usbdrd {
+	status = "okay";
+	vdd10-supply = <&reg_dummy>;
+	vdd33-supply = <&reg_dummy>;
+};
+
+&usbdrd_dwc3 {
+	dr_mode = "otg";
+	usb-role-switch;
+	role-switch-default-mode = "host";
+
+	port {
+		usb1_drd_sw: endpoint {
+			remote-endpoint = <&usb_dr_connector>;
+		};
+	};
+};
+
+&usbdrd_phy {
+	status = "okay";
+};
+
 &usi_uart {
 	samsung,clkreq-on; /* needed for UART mode */
 	status = "okay";
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
  2023-08-19  3:17 ` [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support Sam Protsenko
@ 2023-08-19  7:09   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  7:09 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Exynos850 has dwc3 compatible USB controller, so it can reuse existing
> dwc3 glue layer. Document a new compatible for Exynos850 and its clocks.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  .../bindings/usb/samsung,exynos-dwc3.yaml        | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
  2023-08-19  3:17 ` [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: " Sam Protsenko
@ 2023-08-19  7:11   ` Krzysztof Kozlowski
  2023-08-22 14:09     ` Vinod Koul
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  7:11 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Document Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two
> clocks (ref and phy), which is already described in bindings.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 +
>  1 file changed, 1 insertion(+)

You should probably split the patchset between separate subsystems, so
Greg and Vinod can easily pick up their parts.


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant
  2023-08-19  3:17 ` [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant Sam Protsenko
@ 2023-08-19  7:11   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  7:11 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Add Exynos850 compatible string and associated driver data. Only two
> clocks are needed for this SoC:
>   - bus_early: bus clock needed for registers access
>   - ref: USB 2.0 DRD reference clock (50 MHz)
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-exynos.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops
  2023-08-19  3:17 ` [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops Sam Protsenko
@ 2023-08-19  7:12   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  7:12 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Provide a way to use different PHY ops for different chips. Right now
> all chips are using exynos5_usbdrd_phy_ops, but it won't always be the
> case. For example, Exynos850 has very different USB PHY block, so there
> will be another PHY ops implementation for that chip.
> 
> No functional change.
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support
  2023-08-19  3:17 ` [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support Sam Protsenko
@ 2023-08-19  7:41   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  7:41 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Modern Exynos chips (like Exynos850) might have 26 MHz OSCCLK external
> clock, which is also used as a PHY reference clock. For some USB PHY
> controllers (e.g USB DRD PHY block on Exynos850) there is no need to set
> the refclk frequency at all (and corresponding bits in CLKRSTCTRL[7:5]
> are marked RESERVED), so that value won't be set in the driver. But
> even in that case, 26 MHz support still has to be added, otherwise
> exynos5_rate_to_clk() fails, which leads in turn to probe error.
> 
> Add the correct value for 26MHz refclk to make it possible to add
> support for new Exynos USB DRD PHY controllers.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support
  2023-08-19  3:17 ` [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support Sam Protsenko
@ 2023-08-19  8:32   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  8:32 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Implement Exynos850 USB 2.0 DRD PHY controller support. Exynos850 has
> quite a different PHY controller than Exynos5 compatible controllers,
> but it's still possible to implement it on top of existing
> exynos5-usbdrd driver infrastructure.
> 
> Only UTMI+ (USB 2.0) PHY interface is implemented, as Exynos850 doesn't
> support USB 3.0.
> 
> Only two clocks are used for this controller:
>   - phy: bus clock, used for PHY registers access
>   - ref: PHY reference clock (OSCCLK)
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850
  2023-08-19  3:17 ` [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850 Sam Protsenko
@ 2023-08-19  8:33   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  8:33 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> Add USB controller and USB PHY controller nodes for Exynos850 SoC.
> 
> The USB controller has next features:
>   - Dual Role Device (DRD) controller
>   - DWC3 compatible
>   - Supports USB 2.0 host and USB 2.0 device interfaces
>   - Supports  full-speed (12 Mbps) and high-speed (480 Mbps) modes with
>     USB device 2.0 interface
>   - Supports on-chip USB PHY transceiver
>   - Supports up to 16 bi-directional endpoints (that includes control
>     endpoint 0)
>   - Complies with xHCI 1.00 specification
> 
> Only USB 2.0 is supported in Exynos850, so only UTMI+ PHY interface is
> specified in "phys" property (index 0) and PIPE3 is omitted (index 1).
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/exynos/exynos850.dtsi b/arch/arm64/boot/dts/exynos/exynos850.dtsi
> index aa077008b3be..198d1dfcc672 100644
> --- a/arch/arm64/boot/dts/exynos/exynos850.dtsi
> +++ b/arch/arm64/boot/dts/exynos/exynos850.dtsi
> @@ -570,6 +570,36 @@ sysreg_cmgp: syscon@11c20000 {
>  			clocks = <&cmu_cmgp CLK_GOUT_SYSREG_CMGP_PCLK>;
>  		};
>  
> +		usbdrd: usb@13600000 {
> +			compatible = "samsung,exynos850-dwusb3";
> +			clocks = <&cmu_hsi CLK_GOUT_USB_BUS_EARLY_CLK>,
> +				 <&cmu_hsi CLK_GOUT_USB_REF_CLK>;
> +			clock-names = "bus_early", "ref";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			ranges = <0x0 0x13600000 0x10000>;

Please put ranges after compatible. I know that existing code does not
follow this convention, though.

> +			status = "disabled";
> +


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board
  2023-08-19  3:17 ` [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board Sam Protsenko
@ 2023-08-19  8:36   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-19  8:36 UTC (permalink / raw)
  To: Sam Protsenko, Rob Herring, Thinh Nguyen
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Vinod Koul, Kishon Vijay Abraham I, Greg Kroah-Hartman,
	Alim Akhtar, Marc Kleine-Budde, Heiko Stuebner, linux-phy,
	devicetree, linux-kernel, linux-usb, linux-arm-kernel,
	linux-samsung-soc

On 19/08/2023 05:17, Sam Protsenko wrote:
> The E850-96 board has a micro-USB socket and two USB 2.0 host sockets.
> The USB role (host or peripheral) is selected automatically depending on
> micro-USB cable attachment state:
>   - micro-USB cable is attached: USB device role
>   - micro-USB cable is detached: USB host role
> 
> USB can't act simultaneously as a device and a host, because Exynos850
> SoC has only one USB controller and there are no external USB
> controllers on the E850-96 board. So the USB switch chip (specifically
> TS3USB221A) connects SoC USB lines either to micro-USB connector or to
> USB hub chip (LAN9514), w.r.t. micro-USB cable attachment state.
> 
> When USB works in the host role, Ethernet capability becomes available
> too, as LAN9514 chip (providing USB hub) also enables Ethernet PHY and
> Ethernet MAC.
> 
> Dynamic role switching is done in gpio-usb-b-connector, using current
> micro-USB VBUS line level as a trigger:
>   - VBUS=high: SoC USB lines are wired to micro-USB socket
>   - VBUS=low: SoC USB lines are wired to USB hub chip
> 
> In order to make USB host functional when the board is booted with
> micro-USB cable disconnected, role-switch-default-mode = "host" is used.
> 
> One can look at E850-96 board schematics [1] to figure out how exactly
> all related USB hardware connections and lines reflect into
> corresponding device tree definitions.
> 
> As PMIC regulators are not implemented yet, we rely on USB LDOs being
> already enabled in the bootloader, and a dummy regulator is provided to
> "usbdrd" vdd nodes for now.
> 
> [1] https://www.96boards.org/documentation/consumer/e850-96b/hardware-docs/
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  .../boot/dts/exynos/exynos850-e850-96.dts     | 58 +++++++++++++++++++
>  1 file changed, 58 insertions(+)
> 

This looks good. Please split the DTS patches from the patchset, so they
won't be applied by Greg. Anyway, I finished pulling for this cycle, so
this will have to wait till v6.6-rc1.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
  2023-08-19  7:11   ` Krzysztof Kozlowski
@ 2023-08-22 14:09     ` Vinod Koul
  0 siblings, 0 replies; 19+ messages in thread
From: Vinod Koul @ 2023-08-22 14:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sam Protsenko, Rob Herring, Thinh Nguyen, JaeHun Jung,
	Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Kishon Vijay Abraham I, Greg Kroah-Hartman, Alim Akhtar,
	Marc Kleine-Budde, Heiko Stuebner, linux-phy, devicetree,
	linux-kernel, linux-usb, linux-arm-kernel, linux-samsung-soc

On 19-08-23, 09:11, Krzysztof Kozlowski wrote:
> On 19/08/2023 05:17, Sam Protsenko wrote:
> > Document Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two
> > clocks (ref and phy), which is already described in bindings.
> > 
> > Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> > ---
> >  Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 +
> >  1 file changed, 1 insertion(+)
> 
> You should probably split the patchset between separate subsystems, so
> Greg and Vinod can easily pick up their parts.

Yes I agree :-) if there is NO dependency pls split them!

> 
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Best regards,
> Krzysztof

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: (subset) [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board
  2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
                   ` (7 preceding siblings ...)
  2023-08-19  3:17 ` [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board Sam Protsenko
@ 2023-08-22 14:29 ` Vinod Koul
  8 siblings, 0 replies; 19+ messages in thread
From: Vinod Koul @ 2023-08-22 14:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Thinh Nguyen, Sam Protsenko
  Cc: JaeHun Jung, Marek Szyprowski, Sylwester Nawrocki, Conor Dooley,
	Kishon Vijay Abraham I, Greg Kroah-Hartman, Alim Akhtar,
	Marc Kleine-Budde, Heiko Stuebner, linux-phy, devicetree,
	linux-kernel, linux-usb, linux-arm-kernel, linux-samsung-soc


On Fri, 18 Aug 2023 22:17:23 -0500, Sam Protsenko wrote:
> This patch series enables USB gadget, USB host and Ethernet support for
> E850-96 board. The most major change was done in USB PHY driver, as the
> register layout of PHY block in Exynos850 is very different from
> Exynos5 one.
> 
> Sam Protsenko (8):
>   dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
>   dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
>   usb: dwc3: exynos: Add support for Exynos850 variant
>   phy: exynos5-usbdrd: Make it possible to pass custom phy ops
>   phy: exynos5-usbdrd: Add 26MHz ref clk support
>   phy: exynos5-usbdrd: Add Exynos850 support
>   arm64: dts: exynos: Enable USB in Exynos850
>   arm64: dts: exynos: Enable USB support on E850-96 board
> 
> [...]

Applied, thanks!

[2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
      commit: 0b76bdce32300a626dc796f656c085a786c5dab1
[4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops
      commit: 6b34ec66e7e7351b9a0a1eba8f57eb46ddeabf1e
[5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support
      commit: 255ec3879dd4d585799fd8d8a94a335eaf84d2ec
[6/8] phy: exynos5-usbdrd: Add Exynos850 support
      commit: 691525074db97d9b684dd1457fd8dc9842a36615

Best regards,
-- 
~Vinod



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-08-22 14:29 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-19  3:17 [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board Sam Protsenko
2023-08-19  3:17 ` [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support Sam Protsenko
2023-08-19  7:09   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: " Sam Protsenko
2023-08-19  7:11   ` Krzysztof Kozlowski
2023-08-22 14:09     ` Vinod Koul
2023-08-19  3:17 ` [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant Sam Protsenko
2023-08-19  7:11   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops Sam Protsenko
2023-08-19  7:12   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support Sam Protsenko
2023-08-19  7:41   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support Sam Protsenko
2023-08-19  8:32   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850 Sam Protsenko
2023-08-19  8:33   ` Krzysztof Kozlowski
2023-08-19  3:17 ` [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board Sam Protsenko
2023-08-19  8:36   ` Krzysztof Kozlowski
2023-08-22 14:29 ` (subset) [PATCH 0/8] arm64: exynos: Enable USB for " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).