linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY
@ 2021-08-04 14:05 Baruch Siach
  2021-08-04 14:05 ` [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018 Baruch Siach
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Baruch Siach, Kathiravan T, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Add compatible string for USB3 PHY in Qualcomm IPQ6018 SoC.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
index f0497b8623ad..3ae865988f04 100644
--- a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
@@ -18,6 +18,7 @@ properties:
   compatible:
     enum:
       - qcom,ipq6018-qmp-pcie-phy
+      - qcom,ipq6018-qmp-usb3-phy
       - qcom,ipq8074-qmp-pcie-phy
       - qcom,ipq8074-qmp-usb3-phy
       - qcom,msm8996-qmp-pcie-phy
-- 
2.30.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] 16+ messages in thread

* [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
@ 2021-08-04 14:05 ` Baruch Siach
  2021-08-06 13:05   ` Vinod Koul
  2021-08-04 14:05 ` [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period Baruch Siach
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Baruch Siach, Kathiravan T, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Initialization is identical to the IPQ8074 USB3 PHY.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index cfe359488f5c..da02279534f0 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5225,6 +5225,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = {
 	}, {
 		.compatible = "qcom,ipq6018-qmp-pcie-phy",
 		.data = &ipq6018_pciephy_cfg,
+	}, {
+		.compatible = "qcom,ipq6018-qmp-usb3-phy",
+		.data = &ipq8074_usb3phy_cfg,
 	}, {
 		.compatible = "qcom,sc7180-qmp-usb3-phy",
 		.data = &sc7180_usb3phy_cfg,
-- 
2.30.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] 16+ messages in thread

* [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
  2021-08-04 14:05 ` [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018 Baruch Siach
@ 2021-08-04 14:05 ` Baruch Siach
  2021-08-13 17:22   ` Rob Herring
  2021-08-04 14:05 ` [PATCH v2 4/6] usb: dwc3: reference clock period configuration Baruch Siach
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Baruch Siach, Kathiravan T, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Document the snps,ref-clock-period property that describes reference
clock period when it deviates from the default set value.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index 41416fbd92aa..c8027d2852cd 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -252,6 +252,15 @@ properties:
     minimum: 0
     maximum: 0x3f
 
+  snps,ref-clock-period:
+    description:
+      Value for REFCLKPER field of GUCTL register for post-silicon reference
+      clock period in nanoseconds, when the hardware set default does not match
+      the actual clock.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 0x3ff
+
   snps,rx-thr-num-pkt-prd:
     description:
       Periodic ESS RX packet threshold count (host mode only). Set this and
-- 
2.30.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] 16+ messages in thread

* [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
  2021-08-04 14:05 ` [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018 Baruch Siach
  2021-08-04 14:05 ` [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period Baruch Siach
@ 2021-08-04 14:05 ` Baruch Siach
  2021-08-04 14:11   ` Felipe Balbi
  2021-08-04 14:05 ` [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018 Baruch Siach
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Balaji Prakash J, Baruch Siach, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

From: Balaji Prakash J <bjagadee@codeaurora.org>

Set reference clock period when it differs from dwc3 default hardware
set.

Tested (USB2 only) on IPQ6010 SoC based board with 24 MHz reference
clock while hardware default is 19.2 MHz.

Signed-off-by: Balaji Prakash J <bjagadee@codeaurora.org>
[ baruch: rewrite commit message; drop GFLADJ code; remove 'quirk-' from
  property name; mention tested hardware ]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2:

  Remove snps,quirk-ref-clock-adjustment; not needed for tested hardware

  Rename DT property to snps,ref-clock-period (Thinh Nguyen)

  Use FIELD_PREP() (Bjorn Andersson)
---
 drivers/usb/dwc3/core.c | 29 +++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  6 ++++++
 2 files changed, 35 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index ba74ad7f6995..7ec5bfb5fc11 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -26,6 +26,7 @@
 #include <linux/acpi.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/reset.h>
+#include <linux/bitfield.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
@@ -351,6 +352,29 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc)
 	}
 }
 
+/**
+ * dwc3_ref_clk_period - Reference clock period configuration
+ *		Default reference clock period depends on hardware
+ *		configuration. For systems with reference clock that differs
+ *		from the default, this will set clock period in DWC3_GUCTL
+ *		register.
+ * @dwc: Pointer to our controller context structure
+ * @ref_clk_per: reference clock period in ns
+ */
+static void dwc3_ref_clk_period(struct dwc3 *dwc)
+{
+	u32 reg;
+
+	if (dwc->ref_clk_per == 0)
+		return;
+
+	reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
+	reg &= ~DWC3_GUCTL_REFCLKPER_MASK;
+	reg |=  FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, dwc->ref_clk_per);
+	dwc3_writel(dwc->regs, DWC3_GUCTL, reg);
+}
+
+
 /**
  * dwc3_free_one_event_buffer - Frees one event buffer
  * @dwc: Pointer to our controller context structure
@@ -1011,6 +1035,9 @@ static int dwc3_core_init(struct dwc3 *dwc)
 	/* Adjust Frame Length */
 	dwc3_frame_length_adjustment(dwc);
 
+	/* Adjust Reference Clock Period */
+	dwc3_ref_clk_period(dwc);
+
 	dwc3_set_incr_burst_type(dwc);
 
 	usb_phy_set_suspend(dwc->usb2_phy, 0);
@@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 				    &dwc->hsphy_interface);
 	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
 				 &dwc->fladj);
+	device_property_read_u32(dev, "snps,ref-clock-period",
+				 &dwc->ref_clk_per);
 
 	dwc->dis_metastability_quirk = device_property_read_bool(dev,
 				"snps,dis_metastability_quirk");
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 5991766239ba..1e4e21ea9d97 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -386,6 +386,10 @@
 #define DWC3_GFLADJ_30MHZ_SDBND_SEL		BIT(7)
 #define DWC3_GFLADJ_30MHZ_MASK			0x3f
 
+/* Global User Control Register*/
+#define DWC3_GUCTL_REFCLKPER_MASK		0xffc00000
+#define DWC3_GUCTL_REFCLKPER_SEL		22
+
 /* Global User Control Register 2 */
 #define DWC3_GUCTL2_RST_ACTBITLATER		BIT(14)
 
@@ -969,6 +973,7 @@ struct dwc3_scratchpad_array {
  * @regs: base address for our registers
  * @regs_size: address space size
  * @fladj: frame length adjustment
+ * @ref_clk_per: reference clock period configuration
  * @irq_gadget: peripheral controller's IRQ number
  * @otg_irq: IRQ number for OTG IRQs
  * @current_otg_role: current role of operation while using the OTG block
@@ -1141,6 +1146,7 @@ struct dwc3 {
 	struct power_supply	*usb_psy;
 
 	u32			fladj;
+	u32			ref_clk_per;
 	u32			irq_gadget;
 	u32			otg_irq;
 	u32			current_otg_role;
-- 
2.30.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] 16+ messages in thread

* [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
                   ` (2 preceding siblings ...)
  2021-08-04 14:05 ` [PATCH v2 4/6] usb: dwc3: reference clock period configuration Baruch Siach
@ 2021-08-04 14:05 ` Baruch Siach
  2021-08-13 17:28   ` Rob Herring
  2021-08-04 14:05 ` [PATCH v2 6/6] arm64: qcom: ipq6018: add usb3 DT description Baruch Siach
  2021-08-06 13:05 ` [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Vinod Koul
  5 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Baruch Siach, Kathiravan T, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Add compatible string for Qualcomm IPQ6018 SoC.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 Documentation/devicetree/bindings/usb/qcom,dwc3.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
index 4e6451789806..55ed4b4c7f51 100644
--- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
@@ -13,6 +13,7 @@ properties:
   compatible:
     items:
       - enum:
+          - qcom,ipq6018-dwc3
           - qcom,msm8996-dwc3
           - qcom,msm8998-dwc3
           - qcom,sc7180-dwc3
-- 
2.30.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] 16+ messages in thread

* [PATCH v2 6/6] arm64: qcom: ipq6018: add usb3 DT description
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
                   ` (3 preceding siblings ...)
  2021-08-04 14:05 ` [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018 Baruch Siach
@ 2021-08-04 14:05 ` Baruch Siach
  2021-08-06 13:05 ` [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Vinod Koul
  5 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring
  Cc: Kathiravan T, Baruch Siach, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

From: Kathiravan T <kathirav@codeaurora.org>

Based on downstream codeaurora code.

Tested (USB2 only) on IPQ6010 based hardware.

Signed-off-by: Kathiravan T <kathirav@codeaurora.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi | 83 +++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
index 9fa5b028e4f3..ab701da582e5 100644
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -524,6 +524,89 @@ qrtr_requests {
 			};
 		};
 
+		ssphy_0: ssphy@78000 {
+			compatible = "qcom,ipq6018-qmp-usb3-phy";
+			reg = <0x0 0x78000 0x0 0x1C4>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			#clock-cells = <1>;
+			ranges;
+
+			clocks = <&gcc GCC_USB0_AUX_CLK>,
+				 <&gcc GCC_USB0_PHY_CFG_AHB_CLK>, <&xo>;
+			clock-names = "aux", "cfg_ahb", "ref";
+
+			resets = <&gcc GCC_USB0_PHY_BCR>,
+				 <&gcc GCC_USB3PHY_0_PHY_BCR>;
+			reset-names = "phy","common";
+			status = "disabled";
+
+			usb0_ssphy: lane@78200 {
+				reg = <0x0 0x00078200 0x0 0x130>, /* Tx */
+				      <0x0 0x00078400 0x0 0x200>, /* Rx */
+				      <0x0 0x00078800 0x0 0x1F8>, /* PCS */
+				      <0x0 0x00078600 0x0 0x044>; /* PCS misc */
+				#phy-cells = <0>;
+				clocks = <&gcc GCC_USB0_PIPE_CLK>;
+				clock-names = "pipe0";
+				clock-output-names = "gcc_usb0_pipe_clk_src";
+			};
+		};
+
+		qusb_phy_0: qusb@79000 {
+			compatible = "qcom,ipq6018-qusb2-phy";
+			reg = <0x0 0x079000 0x0 0x180>;
+			#phy-cells = <0>;
+
+			clocks = <&gcc GCC_USB0_PHY_CFG_AHB_CLK>,
+				<&xo>;
+			clock-names = "cfg_ahb", "ref";
+
+			resets = <&gcc GCC_QUSB2_0_PHY_BCR>;
+			status = "disabled";
+		};
+
+		usb3: usb3@8A00000 {
+			compatible = "qcom,ipq6018-dwc3", "qcom,dwc3";
+			reg = <0x0 0x8AF8800 0x0 0x400>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+
+			clocks = <&gcc GCC_SYS_NOC_USB0_AXI_CLK>,
+				<&gcc GCC_USB0_MASTER_CLK>,
+				<&gcc GCC_USB0_SLEEP_CLK>,
+				<&gcc GCC_USB0_MOCK_UTMI_CLK>;
+			clock-names = "sys_noc_axi",
+				"master",
+				"sleep",
+				"mock_utmi";
+
+			assigned-clocks = <&gcc GCC_SYS_NOC_USB0_AXI_CLK>,
+					  <&gcc GCC_USB0_MASTER_CLK>,
+					  <&gcc GCC_USB0_MOCK_UTMI_CLK>;
+			assigned-clock-rates = <133330000>,
+					       <133330000>,
+					       <20000000>;
+
+			resets = <&gcc GCC_USB0_BCR>;
+			status = "disabled";
+
+			dwc_0: dwc3@8A00000 {
+				compatible = "snps,dwc3";
+				reg = <0x0 0x8A00000 0x0 0xcd00>;
+				interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&qusb_phy_0>, <&usb0_ssphy>;
+				phy-names = "usb2-phy", "usb3-phy";
+				tx-fifo-resize;
+				snps,is-utmi-l1-suspend;
+				snps,hird-threshold = /bits/ 8 <0x0>;
+				snps,dis_u2_susphy_quirk;
+				snps,dis_u3_susphy_quirk;
+				snps,ref-clock-period = <0x32>;
+				dr_mode = "host";
+			};
+		};
 	};
 
 	wcss: wcss-smp2p {
-- 
2.30.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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:05 ` [PATCH v2 4/6] usb: dwc3: reference clock period configuration Baruch Siach
@ 2021-08-04 14:11   ` Felipe Balbi
  2021-08-04 14:22     ` Baruch Siach
  0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2021-08-04 14:11 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Rob Herring, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree


Hi,

Baruch Siach <baruch@tkos.co.il> writes:
> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>  				    &dwc->hsphy_interface);
>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
>  				 &dwc->fladj);
> +	device_property_read_u32(dev, "snps,ref-clock-period",
> +				 &dwc->ref_clk_per);

I wonder if it would make more sense to pass an actual clock reference
here. If valid, then reconfigure the period to the value returned by
clk_get_rate(). It would avoid yet another DT binding. If we make the
clock optional, then we won't affect any other platforms. The clock
itself could be a regular fixed clock node.

-- 
balbi

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:11   ` Felipe Balbi
@ 2021-08-04 14:22     ` Baruch Siach
  2021-08-04 14:30       ` Felipe Balbi
  2021-08-13 17:27       ` Rob Herring
  0 siblings, 2 replies; 16+ messages in thread
From: Baruch Siach @ 2021-08-04 14:22 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Rob Herring, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Hi Felipe,

On Wed, Aug 04 2021, Felipe Balbi wrote:
> Baruch Siach <baruch@tkos.co.il> writes:
>> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>>  				    &dwc->hsphy_interface);
>>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
>>  				 &dwc->fladj);
>> +	device_property_read_u32(dev, "snps,ref-clock-period",
>> +				 &dwc->ref_clk_per);
>
> I wonder if it would make more sense to pass an actual clock reference
> here. If valid, then reconfigure the period to the value returned by
> clk_get_rate(). It would avoid yet another DT binding. If we make the
> clock optional, then we won't affect any other platforms. The clock
> itself could be a regular fixed clock node.

Thinh Nguyen asked to add a dedicated DT property. He explained that
clk_get_rate() does not work for PCI hosted dwc3. This is the most
complete summary of the discussion:

  https://lore.kernel.org/r/c797e9cb-cae6-c0b6-5714-169c2ad79d32@synopsys.com

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:22     ` Baruch Siach
@ 2021-08-04 14:30       ` Felipe Balbi
  2021-08-09 22:13         ` Thinh Nguyen
  2021-08-13 17:27       ` Rob Herring
  1 sibling, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2021-08-04 14:30 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Rob Herring, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree


Hi,

Baruch Siach <baruch@tkos.co.il> writes:
> Hi Felipe,
>
> On Wed, Aug 04 2021, Felipe Balbi wrote:
>> Baruch Siach <baruch@tkos.co.il> writes:
>>> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>>>  				    &dwc->hsphy_interface);
>>>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
>>>  				 &dwc->fladj);
>>> +	device_property_read_u32(dev, "snps,ref-clock-period",
>>> +				 &dwc->ref_clk_per);
>>
>> I wonder if it would make more sense to pass an actual clock reference
>> here. If valid, then reconfigure the period to the value returned by
>> clk_get_rate(). It would avoid yet another DT binding. If we make the
>> clock optional, then we won't affect any other platforms. The clock
>> itself could be a regular fixed clock node.
>
> Thinh Nguyen asked to add a dedicated DT property. He explained that
> clk_get_rate() does not work for PCI hosted dwc3. This is the most
> complete summary of the discussion:

Hence the "optional" :-)

Or, perhaps, Thinh wants to use this for internal FPGA-based validation?

In that case, I'm okay with the property.

-- 
balbi

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY
  2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
                   ` (4 preceding siblings ...)
  2021-08-04 14:05 ` [PATCH v2 6/6] arm64: qcom: ipq6018: add usb3 DT description Baruch Siach
@ 2021-08-06 13:05 ` Vinod Koul
  5 siblings, 0 replies; 16+ messages in thread
From: Vinod Koul @ 2021-08-06 13:05 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Kishon Vijay Abraham I, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring, Kathiravan T, Balaji Prakash J,
	Jack Pham, Thinh Nguyen, linux-arm-msm, linux-arm-kernel,
	linux-phy, linux-usb, devicetree

On 04-08-21, 17:05, Baruch Siach wrote:
> Add compatible string for USB3 PHY in Qualcomm IPQ6018 SoC.

Applied, thanks

-- 
~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] 16+ messages in thread

* Re: [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018
  2021-08-04 14:05 ` [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018 Baruch Siach
@ 2021-08-06 13:05   ` Vinod Koul
  0 siblings, 0 replies; 16+ messages in thread
From: Vinod Koul @ 2021-08-06 13:05 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Kishon Vijay Abraham I, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Rob Herring, Kathiravan T, Balaji Prakash J,
	Jack Pham, Thinh Nguyen, linux-arm-msm, linux-arm-kernel,
	linux-phy, linux-usb, devicetree

On 04-08-21, 17:05, Baruch Siach wrote:
> Initialization is identical to the IPQ8074 USB3 PHY.

Applied, thanks

-- 
~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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:30       ` Felipe Balbi
@ 2021-08-09 22:13         ` Thinh Nguyen
  0 siblings, 0 replies; 16+ messages in thread
From: Thinh Nguyen @ 2021-08-09 22:13 UTC (permalink / raw)
  To: Felipe Balbi, Baruch Siach
  Cc: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Rob Herring, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Felipe Balbi wrote:
> 
> Hi,
> 
> Baruch Siach <baruch@tkos.co.il> writes:
>> Hi Felipe,
>>
>> On Wed, Aug 04 2021, Felipe Balbi wrote:
>>> Baruch Siach <baruch@tkos.co.il> writes:
>>>> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>>>>  				    &dwc->hsphy_interface);
>>>>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
>>>>  				 &dwc->fladj);
>>>> +	device_property_read_u32(dev, "snps,ref-clock-period",
>>>> +				 &dwc->ref_clk_per);
>>>
>>> I wonder if it would make more sense to pass an actual clock reference
>>> here. If valid, then reconfigure the period to the value returned by
>>> clk_get_rate(). It would avoid yet another DT binding. If we make the
>>> clock optional, then we won't affect any other platforms. The clock
>>> itself could be a regular fixed clock node.
>>
>> Thinh Nguyen asked to add a dedicated DT property. He explained that
>> clk_get_rate() does not work for PCI hosted dwc3. This is the most
>> complete summary of the discussion:
> 
> Hence the "optional" :-)
> 
> Or, perhaps, Thinh wants to use this for internal FPGA-based validation?
> 
> In that case, I'm okay with the property.
> 

We do use it for internal FPGA validation, but it should help for other
dwc3 PCI devices also.

BR,
Thinh
_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period
  2021-08-04 14:05 ` [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period Baruch Siach
@ 2021-08-13 17:22   ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2021-08-13 17:22 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Kishon Vijay Abraham I, Vinod Koul, Andy Gross, Bjorn Andersson,
	Felipe Balbi, Kathiravan T, Balaji Prakash J, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

On Wed, Aug 04, 2021 at 05:05:07PM +0300, Baruch Siach wrote:
> Document the snps,ref-clock-period property that describes reference
> clock period when it deviates from the default set value.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> index 41416fbd92aa..c8027d2852cd 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> @@ -252,6 +252,15 @@ properties:
>      minimum: 0
>      maximum: 0x3f
>  
> +  snps,ref-clock-period:
> +    description:
> +      Value for REFCLKPER field of GUCTL register for post-silicon reference

Why is post-silicon relevant here? Everything upstream should be for 
post-silicon. I've seen and done the hacks to make pre-silicon testing 
work and we don't need those upstream.

> +      clock period in nanoseconds, when the hardware set default does not match

If you have units, then use property unit suffix in the name.

> +      the actual clock.
> +    $ref: /schemas/types.yaml#/definitions/uint32

And then you can drop the type.

However, if the h/w block gets a ref clock why isn't it described in 
'clocks' and then you can just read why the frequency is and calculate 
the period.

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-04 14:22     ` Baruch Siach
  2021-08-04 14:30       ` Felipe Balbi
@ 2021-08-13 17:27       ` Rob Herring
  2021-08-13 19:52         ` Thinh Nguyen
  1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2021-08-13 17:27 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Felipe Balbi, Kishon Vijay Abraham I, Vinod Koul, Andy Gross,
	Bjorn Andersson, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

On Wed, Aug 04, 2021 at 05:22:27PM +0300, Baruch Siach wrote:
> Hi Felipe,
> 
> On Wed, Aug 04 2021, Felipe Balbi wrote:
> > Baruch Siach <baruch@tkos.co.il> writes:
> >> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
> >>  				    &dwc->hsphy_interface);
> >>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
> >>  				 &dwc->fladj);
> >> +	device_property_read_u32(dev, "snps,ref-clock-period",
> >> +				 &dwc->ref_clk_per);
> >
> > I wonder if it would make more sense to pass an actual clock reference
> > here. If valid, then reconfigure the period to the value returned by
> > clk_get_rate(). It would avoid yet another DT binding. If we make the
> > clock optional, then we won't affect any other platforms. The clock
> > itself could be a regular fixed clock node.
> 
> Thinh Nguyen asked to add a dedicated DT property. He explained that
> clk_get_rate() does not work for PCI hosted dwc3. This is the most
> complete summary of the discussion:
> 
>   https://lore.kernel.org/r/c797e9cb-cae6-c0b6-5714-169c2ad79d32@synopsys.com

PCI devices can have DT nodes with clock properties too. Or use the 
VID/PID to infer the frequency. Or use 'clock-frequency' property.

It boils down to we have lots of standard properties for clocks and 
clock configuration, so custom properties are a NAK.

Rob

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018
  2021-08-04 14:05 ` [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018 Baruch Siach
@ 2021-08-13 17:28   ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2021-08-13 17:28 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Bjorn Andersson, Andy Gross, Jack Pham, linux-phy, Vinod Koul,
	Kishon Vijay Abraham I, Felipe Balbi, Thinh Nguyen, linux-usb,
	linux-arm-msm, Balaji Prakash J, linux-arm-kernel, devicetree,
	Kathiravan T, Rob Herring

On Wed, 04 Aug 2021 17:05:09 +0300, Baruch Siach wrote:
> Add compatible string for Qualcomm IPQ6018 SoC.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  Documentation/devicetree/bindings/usb/qcom,dwc3.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH v2 4/6] usb: dwc3: reference clock period configuration
  2021-08-13 17:27       ` Rob Herring
@ 2021-08-13 19:52         ` Thinh Nguyen
  0 siblings, 0 replies; 16+ messages in thread
From: Thinh Nguyen @ 2021-08-13 19:52 UTC (permalink / raw)
  To: Rob Herring, Baruch Siach
  Cc: Felipe Balbi, Kishon Vijay Abraham I, Vinod Koul, Andy Gross,
	Bjorn Andersson, Balaji Prakash J, Kathiravan T, Jack Pham,
	Thinh Nguyen, linux-arm-msm, linux-arm-kernel, linux-phy,
	linux-usb, devicetree

Rob Herring wrote:
> On Wed, Aug 04, 2021 at 05:22:27PM +0300, Baruch Siach wrote:
>> Hi Felipe,
>>
>> On Wed, Aug 04 2021, Felipe Balbi wrote:
>>> Baruch Siach <baruch@tkos.co.il> writes:
>>>> @@ -1371,6 +1398,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
>>>>  				    &dwc->hsphy_interface);
>>>>  	device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
>>>>  				 &dwc->fladj);
>>>> +	device_property_read_u32(dev, "snps,ref-clock-period",
>>>> +				 &dwc->ref_clk_per);
>>>
>>> I wonder if it would make more sense to pass an actual clock reference
>>> here. If valid, then reconfigure the period to the value returned by
>>> clk_get_rate(). It would avoid yet another DT binding. If we make the
>>> clock optional, then we won't affect any other platforms. The clock
>>> itself could be a regular fixed clock node.
>>
>> Thinh Nguyen asked to add a dedicated DT property. He explained that
>> clk_get_rate() does not work for PCI hosted dwc3. This is the most
>> complete summary of the discussion:
>>
>>   https://urldefense.com/v3/__https://lore.kernel.org/r/c797e9cb-cae6-c0b6-5714-169c2ad79d32@synopsys.com__;!!A4F2R9G_pg!Nh6rqp_aOd8XIvqELvDRQe5ooZf13UZKwmn9lWcRgdbyMKpTMzL8HasrB1X2Ojvumo8g$ 
> 
> PCI devices can have DT nodes with clock properties too. Or use the 
> VID/PID to infer the frequency. Or use 'clock-frequency' property.
> 
> It boils down to we have lots of standard properties for clocks and 
> clock configuration, so custom properties are a NAK.
> 

Do we have DT node for the PCI device before discovering the device from
PCI bus enumeration? I don't think we can find the clock properties from
its configuration space. For our HAPS devices, we can't use VID/PID to
infer the frequency since our phy and ref clock may change.

Does "clock-frequency" mean ref clock? If so, let's use that?

Thanks,
Thinh
_______________________________________________
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] 16+ messages in thread

end of thread, other threads:[~2021-08-13 19:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 14:05 [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY Baruch Siach
2021-08-04 14:05 ` [PATCH v2 2/6] phy: qcom-qmp: add USB3 PHY support for IPQ6018 Baruch Siach
2021-08-06 13:05   ` Vinod Koul
2021-08-04 14:05 ` [PATCH v2 3/6] dt-bindings: usb: dwc3: add reference clock period Baruch Siach
2021-08-13 17:22   ` Rob Herring
2021-08-04 14:05 ` [PATCH v2 4/6] usb: dwc3: reference clock period configuration Baruch Siach
2021-08-04 14:11   ` Felipe Balbi
2021-08-04 14:22     ` Baruch Siach
2021-08-04 14:30       ` Felipe Balbi
2021-08-09 22:13         ` Thinh Nguyen
2021-08-13 17:27       ` Rob Herring
2021-08-13 19:52         ` Thinh Nguyen
2021-08-04 14:05 ` [PATCH v2 5/6] dt-bindings: usb: qcom,dwc3: add binding for IPQ6018 Baruch Siach
2021-08-13 17:28   ` Rob Herring
2021-08-04 14:05 ` [PATCH v2 6/6] arm64: qcom: ipq6018: add usb3 DT description Baruch Siach
2021-08-06 13:05 ` [PATCH v2 1/6] dt-bindings: phy: qcom,qmp: Add IPQ6018 USB3 PHY 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).