linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] clk: imx8mn: correct the usb1_ctrl parent to be usb_bus
@ 2019-12-05  8:06 Jun Li
  2019-12-05  8:06 ` [PATCH 2/3] arm64: dts: imx8mn: Remove setting for IMX8MN_CLK_USB_CORE_REF Jun Li
  2019-12-05  8:06 ` [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support Jun Li
  0 siblings, 2 replies; 4+ messages in thread
From: Jun Li @ 2019-12-05  8:06 UTC (permalink / raw)
  To: robh+dt, mark.rutland, shawnguo, sboyd
  Cc: s.hauer, kernel, festevam, dl-linux-imx, mturquette, Anson Huang,
	Abel Vesa, Jun Li, Leonard Crestez, Daniel Baluta, Peng Fan,
	devicetree, linux-arm-kernel, linux-clk

From: Li Jun <jun.li@nxp.com>

Per latest imx8mn datasheet of CCM, the parent of usb1_ctrl_root_clk
should be usb_bus.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/clk/imx/clk-imx8mn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c
index 9f5a5a5..1c0d5e9 100644
--- a/drivers/clk/imx/clk-imx8mn.c
+++ b/drivers/clk/imx/clk-imx8mn.c
@@ -512,7 +512,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
 	clks[IMX8MN_CLK_UART2_ROOT] = imx_clk_gate4("uart2_root_clk", "uart2", base + 0x44a0, 0);
 	clks[IMX8MN_CLK_UART3_ROOT] = imx_clk_gate4("uart3_root_clk", "uart3", base + 0x44b0, 0);
 	clks[IMX8MN_CLK_UART4_ROOT] = imx_clk_gate4("uart4_root_clk", "uart4", base + 0x44c0, 0);
-	clks[IMX8MN_CLK_USB1_CTRL_ROOT] = imx_clk_gate4("usb1_ctrl_root_clk", "usb_core_ref", base + 0x44d0, 0);
+	clks[IMX8MN_CLK_USB1_CTRL_ROOT] = imx_clk_gate4("usb1_ctrl_root_clk", "usb_bus", base + 0x44d0, 0);
 	clks[IMX8MN_CLK_GPU_CORE_ROOT] = imx_clk_gate4("gpu_core_root_clk", "gpu_core_div", base + 0x44f0, 0);
 	clks[IMX8MN_CLK_USDHC1_ROOT] = imx_clk_gate4("usdhc1_root_clk", "usdhc1", base + 0x4510, 0);
 	clks[IMX8MN_CLK_USDHC2_ROOT] = imx_clk_gate4("usdhc2_root_clk", "usdhc2", base + 0x4520, 0);
-- 
2.7.4


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

* [PATCH 2/3] arm64: dts: imx8mn: Remove setting for IMX8MN_CLK_USB_CORE_REF
  2019-12-05  8:06 [PATCH 1/3] clk: imx8mn: correct the usb1_ctrl parent to be usb_bus Jun Li
@ 2019-12-05  8:06 ` Jun Li
  2019-12-05  8:06 ` [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support Jun Li
  1 sibling, 0 replies; 4+ messages in thread
From: Jun Li @ 2019-12-05  8:06 UTC (permalink / raw)
  To: robh+dt, mark.rutland, shawnguo, sboyd
  Cc: s.hauer, kernel, festevam, dl-linux-imx, mturquette, Anson Huang,
	Abel Vesa, Jun Li, Leonard Crestez, Daniel Baluta, Peng Fan,
	devicetree, linux-arm-kernel, linux-clk

From: Li Jun <jun.li@nxp.com>

Since IMX8MN_CLK_USB_CORE_REF is not used at all, so remove the setting
for it.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mn.dtsi | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
index e916250..271d197 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
@@ -683,10 +683,8 @@
 				interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clk IMX8MN_CLK_USB1_CTRL_ROOT>;
 				clock-names = "usb1_ctrl_root_clk";
-				assigned-clocks = <&clk IMX8MN_CLK_USB_BUS>,
-						  <&clk IMX8MN_CLK_USB_CORE_REF>;
-				assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>,
-							 <&clk IMX8MN_SYS_PLL1_100M>;
+				assigned-clocks = <&clk IMX8MN_CLK_USB_BUS>;
+				assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>;
 				fsl,usbphy = <&usbphynop1>;
 				fsl,usbmisc = <&usbmisc1 0>;
 				status = "disabled";
-- 
2.7.4


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

* [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support
  2019-12-05  8:06 [PATCH 1/3] clk: imx8mn: correct the usb1_ctrl parent to be usb_bus Jun Li
  2019-12-05  8:06 ` [PATCH 2/3] arm64: dts: imx8mn: Remove setting for IMX8MN_CLK_USB_CORE_REF Jun Li
@ 2019-12-05  8:06 ` Jun Li
  2019-12-11  3:50   ` Shawn Guo
  1 sibling, 1 reply; 4+ messages in thread
From: Jun Li @ 2019-12-05  8:06 UTC (permalink / raw)
  To: robh+dt, mark.rutland, shawnguo, sboyd
  Cc: s.hauer, kernel, festevam, dl-linux-imx, mturquette, Anson Huang,
	Abel Vesa, Jun Li, Leonard Crestez, Daniel Baluta, Peng Fan,
	devicetree, linux-arm-kernel, linux-clk

From: Li Jun <jun.li@nxp.com>

USB1 port has typec connector with power delivery support:
- Dual data role: host and device.
- Dual power role: source and sink, prefer power sink.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 65 +++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index 2a74330..61511e9 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -3,6 +3,7 @@
  * Copyright 2019 NXP
  */
 
+#include <dt-bindings/usb/pd.h>
 #include "imx8mn.dtsi"
 
 / {
@@ -60,6 +61,42 @@
 	status = "okay";
 };
 
+&i2c2 {
+	clock-frequency = <400000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c2>;
+	status = "okay";
+
+	ptn5110: tcpc@50 {
+		compatible = "nxp,ptn5110";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_typec1>;
+		reg = <0x50>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <11 8>;
+		status = "okay";
+
+		port {
+			typec1_dr_sw: endpoint {
+				remote-endpoint = <&usb1_drd_sw>;
+			};
+		};
+
+		typec1_con: connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			power-role = "dual";
+			data-role = "dual";
+			try-power-role = "sink";
+			source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
+			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
+				     PDO_VAR(5000, 20000, 3000)>;
+			op-sink-microwatt = <15000000>;
+			self-powered;
+		};
+	};
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -70,6 +107,21 @@
 	status = "okay";
 };
 
+&usbotg1 {
+	dr_mode = "otg";
+	hnp-disable;
+	srp-disable;
+	adp-disable;
+	usb-role-switch;
+	status = "okay";
+
+	port {
+		usb1_drd_sw: endpoint {
+			remote-endpoint = <&typec1_dr_sw>;
+		};
+	};
+};
+
 &usdhc2 {
 	assigned-clocks = <&clk IMX8MN_CLK_USDHC2>;
 	assigned-clock-rates = <200000000>;
@@ -138,12 +190,25 @@
 		>;
 	};
 
+	pinctrl_i2c2: i2c2grp {
+		fsl,pins = <
+			MX8MN_IOMUXC_I2C2_SCL_I2C2_SCL		0x400001c3
+			MX8MN_IOMUXC_I2C2_SDA_I2C2_SDA		0x400001c3
+		>;
+	};
+
 	pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
 		fsl,pins = <
 			MX8MN_IOMUXC_SD2_RESET_B_GPIO2_IO19	0x41
 		>;
 	};
 
+	pinctrl_typec1: typec1grp {
+		fsl,pins = <
+			MX8MN_IOMUXC_SD1_STROBE_GPIO2_IO11	0x159
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX8MN_IOMUXC_UART2_RXD_UART2_DCE_RX	0x140
-- 
2.7.4


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

* Re: [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support
  2019-12-05  8:06 ` [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support Jun Li
@ 2019-12-11  3:50   ` Shawn Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2019-12-11  3:50 UTC (permalink / raw)
  To: Jun Li
  Cc: robh+dt, mark.rutland, sboyd, s.hauer, kernel, festevam,
	dl-linux-imx, mturquette, Anson Huang, Abel Vesa,
	Leonard Crestez, Daniel Baluta, Peng Fan, devicetree,
	linux-arm-kernel, linux-clk

On Thu, Dec 05, 2019 at 08:06:28AM +0000, Jun Li wrote:
> From: Li Jun <jun.li@nxp.com>
> 
> USB1 port has typec connector with power delivery support:
> - Dual data role: host and device.
> - Dual power role: source and sink, prefer power sink.
> 
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 65 +++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> index 2a74330..61511e9 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> @@ -3,6 +3,7 @@
>   * Copyright 2019 NXP
>   */
>  
> +#include <dt-bindings/usb/pd.h>
>  #include "imx8mn.dtsi"
>  
>  / {
> @@ -60,6 +61,42 @@
>  	status = "okay";
>  };
>  
> +&i2c2 {
> +	clock-frequency = <400000>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_i2c2>;
> +	status = "okay";
> +
> +	ptn5110: tcpc@50 {
> +		compatible = "nxp,ptn5110";
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&pinctrl_typec1>;
> +		reg = <0x50>;
> +		interrupt-parent = <&gpio2>;
> +		interrupts = <11 8>;

We prefer to use macro for IRQ type:

s/8/IRQ_TYPE_LEVEL_LOW

I fixed it up and applied all 3 patches.

Shawn

> +		status = "okay";
> +
> +		port {
> +			typec1_dr_sw: endpoint {
> +				remote-endpoint = <&usb1_drd_sw>;
> +			};
> +		};
> +
> +		typec1_con: connector {
> +			compatible = "usb-c-connector";
> +			label = "USB-C";
> +			power-role = "dual";
> +			data-role = "dual";
> +			try-power-role = "sink";
> +			source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
> +			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
> +				     PDO_VAR(5000, 20000, 3000)>;
> +			op-sink-microwatt = <15000000>;
> +			self-powered;
> +		};
> +	};
> +};
> +
>  &snvs_pwrkey {
>  	status = "okay";
>  };
> @@ -70,6 +107,21 @@
>  	status = "okay";
>  };
>  
> +&usbotg1 {
> +	dr_mode = "otg";
> +	hnp-disable;
> +	srp-disable;
> +	adp-disable;
> +	usb-role-switch;
> +	status = "okay";
> +
> +	port {
> +		usb1_drd_sw: endpoint {
> +			remote-endpoint = <&typec1_dr_sw>;
> +		};
> +	};
> +};
> +
>  &usdhc2 {
>  	assigned-clocks = <&clk IMX8MN_CLK_USDHC2>;
>  	assigned-clock-rates = <200000000>;
> @@ -138,12 +190,25 @@
>  		>;
>  	};
>  
> +	pinctrl_i2c2: i2c2grp {
> +		fsl,pins = <
> +			MX8MN_IOMUXC_I2C2_SCL_I2C2_SCL		0x400001c3
> +			MX8MN_IOMUXC_I2C2_SDA_I2C2_SDA		0x400001c3
> +		>;
> +	};
> +
>  	pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
>  		fsl,pins = <
>  			MX8MN_IOMUXC_SD2_RESET_B_GPIO2_IO19	0x41
>  		>;
>  	};
>  
> +	pinctrl_typec1: typec1grp {
> +		fsl,pins = <
> +			MX8MN_IOMUXC_SD1_STROBE_GPIO2_IO11	0x159
> +		>;
> +	};
> +
>  	pinctrl_uart2: uart2grp {
>  		fsl,pins = <
>  			MX8MN_IOMUXC_UART2_RXD_UART2_DCE_RX	0x140
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2019-12-11  3:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05  8:06 [PATCH 1/3] clk: imx8mn: correct the usb1_ctrl parent to be usb_bus Jun Li
2019-12-05  8:06 ` [PATCH 2/3] arm64: dts: imx8mn: Remove setting for IMX8MN_CLK_USB_CORE_REF Jun Li
2019-12-05  8:06 ` [PATCH 3/3] arm64: dts: imx8mn-evk: enable usb1 and typec support Jun Li
2019-12-11  3:50   ` Shawn Guo

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).