All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] phy: rockchip-typec: fix boards that does not report cable-state.
@ 2018-03-01  9:24 ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, Andre Przywara, Rob Herring,
	Icenowy Zheng, Shawn Lin, Rask Ingemann Lambertsen,
	Catalin Marinas, Pierre-Hugues Husson, Corentin Labbe,
	Jacob Chen, Kever Yang, linux-rockchip, Will Deacon, devicetree,
	linux-arm-kernel, Jianqun Xu, Klaus Goger, linux-kernel,
	Heinrich Schuchardt, Mark Rutland, Chen-Yu Tsai, Maxime Ripard

Hi,

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") introduced a regression on some rk3399 boards,
and break USB. While some boards have support to report cable-state via
extcon interface, other boards does not support. This patch series
tries to fix this.

First and second patch makes extcon optional, the following patches
enables the typec phyter for others rk3399 boards. It has been tested on
Samsung Chromebook Plus and Sapphire but not on the other boards, so I'll
appreciate if someone can test it.

Best regards,
 Enric

Enric Balletbo i Serra (6):
  phy: rockchip-typec: fall back to working in host-mode if extcon is
    missing.
  dt-bindings: phy-rockchip-typec: move extcon property to be optional.
  arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
  arm64: dts: rockchip: enable typec-phy for rk3399-firefly.
  arm64: dts: rockchip: enable typec-phy1 for rk3399-puma.
  arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou.

 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts              | 8 ++++++++
 arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts          | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi                | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi            | 8 ++++++++
 drivers/phy/rockchip/phy-rockchip-typec.c                    | 9 ++++++---
 6 files changed, 32 insertions(+), 3 deletions(-)

-- 
2.16.1

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

* [PATCH 0/6] phy: rockchip-typec: fix boards that does not report cable-state.
@ 2018-03-01  9:24 ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, Andre Przywara, Rob Herring,
	Icenowy Zheng, Shawn Lin, Rask Ingemann Lambertsen,
	Catalin Marinas, Pierre-Hugues Husson, Corentin Labbe,
	Jacob Chen, Kever Yang, linux-rockchip, Will Deacon, devicetree,
	linux-arm-kernel, Jianqun Xu, Klaus Goger, linux-kernel,
	Heinrich Schuchardt

Hi,

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") introduced a regression on some rk3399 boards,
and break USB. While some boards have support to report cable-state via
extcon interface, other boards does not support. This patch series
tries to fix this.

First and second patch makes extcon optional, the following patches
enables the typec phyter for others rk3399 boards. It has been tested on
Samsung Chromebook Plus and Sapphire but not on the other boards, so I'll
appreciate if someone can test it.

Best regards,
 Enric

Enric Balletbo i Serra (6):
  phy: rockchip-typec: fall back to working in host-mode if extcon is
    missing.
  dt-bindings: phy-rockchip-typec: move extcon property to be optional.
  arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
  arm64: dts: rockchip: enable typec-phy for rk3399-firefly.
  arm64: dts: rockchip: enable typec-phy1 for rk3399-puma.
  arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou.

 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts              | 8 ++++++++
 arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts          | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi                | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi            | 8 ++++++++
 drivers/phy/rockchip/phy-rockchip-typec.c                    | 9 ++++++---
 6 files changed, 32 insertions(+), 3 deletions(-)

-- 
2.16.1

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

* [PATCH 0/6] phy: rockchip-typec: fix boards that does not report cable-state.
@ 2018-03-01  9:24 ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") introduced a regression on some rk3399 boards,
and break USB. While some boards have support to report cable-state via
extcon interface, other boards does not support. This patch series
tries to fix this.

First and second patch makes extcon optional, the following patches
enables the typec phyter for others rk3399 boards. It has been tested on
Samsung Chromebook Plus and Sapphire but not on the other boards, so I'll
appreciate if someone can test it.

Best regards,
 Enric

Enric Balletbo i Serra (6):
  phy: rockchip-typec: fall back to working in host-mode if extcon is
    missing.
  dt-bindings: phy-rockchip-typec: move extcon property to be optional.
  arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
  arm64: dts: rockchip: enable typec-phy for rk3399-firefly.
  arm64: dts: rockchip: enable typec-phy1 for rk3399-puma.
  arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou.

 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts              | 8 ++++++++
 arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts          | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi                | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi            | 8 ++++++++
 drivers/phy/rockchip/phy-rockchip-typec.c                    | 9 ++++++---
 6 files changed, 32 insertions(+), 3 deletions(-)

-- 
2.16.1

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

* [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
  2018-03-01  9:24 ` Enric Balletbo i Serra
  (?)
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, linux-rockchip, linux-kernel,
	linux-arm-kernel

Right now the rockchip typec-phy does fail probing when no extcon is
detected. Some boards get the cable-state via the extcon interface and
have this supported, other boards seem to use the fusb302 chip or
another but the driver currently does not seem to utilize the extcon
interface to report the cable-state. That's required to detect
cable-state changes but a missing extcon shouldn't fail to probe,
instead, should just fall back to working in host-mode if it cannot get
the extcon.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
 	u8 mode;
 	int ret;
 
+	if (!edev)
+		return MODE_DFP_USB;
+
 	ufp = extcon_get_state(edev, EXTCON_USB);
 	dp = extcon_get_state(edev, EXTCON_DISP_DP);
 
@@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
 
 	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
 	if (IS_ERR(tcphy->extcon)) {
-		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
-			dev_err(dev, "Invalid or missing extcon\n");
-		return PTR_ERR(tcphy->extcon);
+		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

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

* [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: gwendal, linux-kernel, vicencb, linux-rockchip, groeck, kernel,
	linux-arm-kernel

Right now the rockchip typec-phy does fail probing when no extcon is
detected. Some boards get the cable-state via the extcon interface and
have this supported, other boards seem to use the fusb302 chip or
another but the driver currently does not seem to utilize the extcon
interface to report the cable-state. That's required to detect
cable-state changes but a missing extcon shouldn't fail to probe,
instead, should just fall back to working in host-mode if it cannot get
the extcon.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
 	u8 mode;
 	int ret;
 
+	if (!edev)
+		return MODE_DFP_USB;
+
 	ufp = extcon_get_state(edev, EXTCON_USB);
 	dp = extcon_get_state(edev, EXTCON_DISP_DP);
 
@@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
 
 	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
 	if (IS_ERR(tcphy->extcon)) {
-		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
-			dev_err(dev, "Invalid or missing extcon\n");
-		return PTR_ERR(tcphy->extcon);
+		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

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

* [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Right now the rockchip typec-phy does fail probing when no extcon is
detected. Some boards get the cable-state via the extcon interface and
have this supported, other boards seem to use the fusb302 chip or
another but the driver currently does not seem to utilize the extcon
interface to report the cable-state. That's required to detect
cable-state changes but a missing extcon shouldn't fail to probe,
instead, should just fall back to working in host-mode if it cannot get
the extcon.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
 	u8 mode;
 	int ret;
 
+	if (!edev)
+		return MODE_DFP_USB;
+
 	ufp = extcon_get_state(edev, EXTCON_USB);
 	dp = extcon_get_state(edev, EXTCON_DISP_DP);
 
@@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
 
 	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
 	if (IS_ERR(tcphy->extcon)) {
-		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
-			dev_err(dev, "Invalid or missing extcon\n");
-		return PTR_ERR(tcphy->extcon);
+		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

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

* [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional.
  2018-03-01  9:24 ` Enric Balletbo i Serra
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, devicetree, linux-kernel,
	linux-rockchip, Rob Herring, Mark Rutland, linux-arm-kernel

The extcon property is used to detect the cable-state but some boards,
like Sapphire, currently does not seem to support, others might just not
need, as are supposed to work in host-mode only. So, extcon property is
not really a required property, move to be optional instead.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
index 6ea867e3176f..a66f23a01129 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
@@ -14,6 +14,8 @@ Required properties:
  - resets : a list of phandle + reset specifier pairs
  - reset-names : string reset name, must be:
 		 "uphy", "uphy-pipe", "uphy-tcphy"
+
+Optional properties:
  - extcon : extcon specifier for the Power Delivery
 
 Note, there are 2 type-c phys for RK3399, and they are almost identical, except
-- 
2.16.1

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

* [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

The extcon property is used to detect the cable-state but some boards,
like Sapphire, currently does not seem to support, others might just not
need, as are supposed to work in host-mode only. So, extcon property is
not really a required property, move to be optional instead.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
index 6ea867e3176f..a66f23a01129 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
@@ -14,6 +14,8 @@ Required properties:
  - resets : a list of phandle + reset specifier pairs
  - reset-names : string reset name, must be:
 		 "uphy", "uphy-pipe", "uphy-tcphy"
+
+Optional properties:
  - extcon : extcon specifier for the Power Delivery
 
 Note, there are 2 type-c phys for RK3399, and they are almost identical, except
-- 
2.16.1

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

* [PATCH 3/6] arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
  2018-03-01  9:24 ` Enric Balletbo i Serra
  (?)
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, devicetree, Jianqun Xu,
	Jacob Chen, Kever Yang, linux-kernel, linux-rockchip, Shawn Lin,
	Rob Herring, Will Deacon, Mark Rutland, Catalin Marinas,
	linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3 type-A port.
During boot, the following message appears a few times:

  dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
bceause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
index ce592a4c0c4c..9c685eab4748 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
@@ -557,6 +557,14 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 3/6] arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: Mark Rutland, devicetree, gwendal, Rob Herring, Catalin Marinas,
	Shawn Lin, Will Deacon, Kever Yang, vicencb, linux-kernel,
	linux-rockchip, Jacob Chen, groeck, kernel, Jianqun Xu,
	linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3 type-A port.
During boot, the following message appears a few times:

  dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
bceause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
index ce592a4c0c4c..9c685eab4748 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
@@ -557,6 +557,14 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 3/6] arm64: dts: rockchip: enable typec-phy for rk3399-sapphire.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3 type-A port.
During boot, the following message appears a few times:

  dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
bceause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
index ce592a4c0c4c..9c685eab4748 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
@@ -557,6 +557,14 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 4/6] arm64: dts: rockchip: enable typec-phy for rk3399-firefly.
  2018-03-01  9:24 ` Enric Balletbo i Serra
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, devicetree,
	Pierre-Hugues Husson, Jianqun Xu, Kever Yang, linux-kernel,
	Heinrich Schuchardt, linux-rockchip, Shawn Lin, Rob Herring,
	Will Deacon, Mark Rutland, Catalin Marinas, linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During boot,
the following message appears a few times:

      dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
index 4f28628aa091..0e3a9ab4a297 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
@@ -670,6 +670,14 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 4/6] arm64: dts: rockchip: enable typec-phy for rk3399-firefly.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During boot,
the following message appears a few times:

      dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
index 4f28628aa091..0e3a9ab4a297 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
@@ -670,6 +670,14 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 5/6] arm64: dts: rockchip: enable typec-phy1 for rk3399-puma.
  2018-03-01  9:24 ` Enric Balletbo i Serra
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, devicetree, Jianqun Xu,
	Jacob Chen, Klaus Goger, linux-kernel, linux-rockchip, Shawn Lin,
	Rob Herring, Will Deacon, Mark Rutland, Catalin Marinas,
	linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During boot,
the following message appears a few times:

      dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
index 1fc5060d7027..3a3b24383482 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
@@ -505,6 +505,10 @@
 	};
 };
 
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy1 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 5/6] arm64: dts: rockchip: enable typec-phy1 for rk3399-puma.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During boot,
the following message appears a few times:

      dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never happens
beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
index 1fc5060d7027..3a3b24383482 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
@@ -505,6 +505,10 @@
 	};
 };
 
+&tcphy1 {
+	status = "okay";
+};
+
 &u2phy1 {
 	status = "okay";
 
-- 
2.16.1

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

* [PATCH 6/6] arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou.
  2018-03-01  9:24 ` Enric Balletbo i Serra
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: kishon, heiko
  Cc: groeck, gwendal, kernel, vicencb, devicetree, Corentin Labbe,
	Andre Przywara, Klaus Goger, linux-kernel, Maxime Ripard,
	linux-rockchip, Rob Herring, Icenowy Zheng, Will Deacon,
	Rask Ingemann Lambertsen, Catalin Marinas, Chen-Yu Tsai,
	Mark Rutland, linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During
boot, the following message appears a few times:

    dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never
happens beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
index 9a7486058455..2c9c696d1383 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
@@ -191,6 +191,10 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 };
-- 
2.16.1

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

* [PATCH 6/6] arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou.
@ 2018-03-01  9:24   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Commit c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
support for rk3399") caused a regression regarding the USB3. During
boot, the following message appears a few times:

    dwc3: failed to initialize core

The driver is deferred waiting for the typec-phy, but this never
happens beause is disabled. So, enable it.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
index 9a7486058455..2c9c696d1383 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
@@ -191,6 +191,10 @@
 	status = "okay";
 };
 
+&tcphy0 {
+	status = "okay";
+};
+
 &u2phy0 {
 	status = "okay";
 };
-- 
2.16.1

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

* Re: [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
  2018-03-01  9:24   ` Enric Balletbo i Serra
@ 2018-03-01  9:45     ` Heiko Stübner
  -1 siblings, 0 replies; 24+ messages in thread
From: Heiko Stübner @ 2018-03-01  9:45 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: kishon, groeck, gwendal, kernel, vicencb, linux-rockchip,
	linux-kernel, linux-arm-kernel

Am Donnerstag, 1. März 2018, 10:24:15 CET schrieb Enric Balletbo i Serra:
> Right now the rockchip typec-phy does fail probing when no extcon is
> detected. Some boards get the cable-state via the extcon interface and
> have this supported, other boards seem to use the fusb302 chip or
> another but the driver currently does not seem to utilize the extcon
> interface to report the cable-state. That's required to detect
> cable-state changes but a missing extcon shouldn't fail to probe,
> instead, should just fall back to working in host-mode if it cannot get
> the extcon.

And of course:
Some boards use no controller at all and just connect the type-c to a
standard USB-A port.

> Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
> support for rk3399") Reported-by: Vicente Bergas <vicencb@gmail.com>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
>  drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c
> b/drivers/phy/rockchip/phy-rockchip-typec.c index
> 7492c8978217..3741afab5cd2 100644
> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
> @@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy
> *tcphy) u8 mode;
>  	int ret;
> 
> +	if (!edev)
> +		return MODE_DFP_USB;
> +
>  	ufp = extcon_get_state(edev, EXTCON_USB);
>  	dp = extcon_get_state(edev, EXTCON_DISP_DP);
> 
> @@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct
> platform_device *pdev)
> 
>  	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
>  	if (IS_ERR(tcphy->extcon)) {
> -		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
> -			dev_err(dev, "Invalid or missing extcon\n");
> -		return PTR_ERR(tcphy->extcon);
> +		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
> +			return PTR_ERR(tcphy->extcon);
> +		tcphy->extcon = NULL;

Do we want to keep a bit of the error handling of extcon, a la

+		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
+			tcphy->extcon = NULL;
+		} else {
+			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
+				dev_err(dev, "Invalid or extcon\n");
+			return PTR_ERR(tcphy->extcon);
+		}

So only make it NULL, if extcon really reports ENODEV?


Heiko

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

* [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
@ 2018-03-01  9:45     ` Heiko Stübner
  0 siblings, 0 replies; 24+ messages in thread
From: Heiko Stübner @ 2018-03-01  9:45 UTC (permalink / raw)
  To: linux-arm-kernel

Am Donnerstag, 1. M?rz 2018, 10:24:15 CET schrieb Enric Balletbo i Serra:
> Right now the rockchip typec-phy does fail probing when no extcon is
> detected. Some boards get the cable-state via the extcon interface and
> have this supported, other boards seem to use the fusb302 chip or
> another but the driver currently does not seem to utilize the extcon
> interface to report the cable-state. That's required to detect
> cable-state changes but a missing extcon shouldn't fail to probe,
> instead, should just fall back to working in host-mode if it cannot get
> the extcon.

And of course:
Some boards use no controller at all and just connect the type-c to a
standard USB-A port.

> Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
> support for rk3399") Reported-by: Vicente Bergas <vicencb@gmail.com>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
>  drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c
> b/drivers/phy/rockchip/phy-rockchip-typec.c index
> 7492c8978217..3741afab5cd2 100644
> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
> @@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy
> *tcphy) u8 mode;
>  	int ret;
> 
> +	if (!edev)
> +		return MODE_DFP_USB;
> +
>  	ufp = extcon_get_state(edev, EXTCON_USB);
>  	dp = extcon_get_state(edev, EXTCON_DISP_DP);
> 
> @@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct
> platform_device *pdev)
> 
>  	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
>  	if (IS_ERR(tcphy->extcon)) {
> -		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
> -			dev_err(dev, "Invalid or missing extcon\n");
> -		return PTR_ERR(tcphy->extcon);
> +		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
> +			return PTR_ERR(tcphy->extcon);
> +		tcphy->extcon = NULL;

Do we want to keep a bit of the error handling of extcon, a la

+		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
+			tcphy->extcon = NULL;
+		} else {
+			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
+				dev_err(dev, "Invalid or extcon\n");
+			return PTR_ERR(tcphy->extcon);
+		}

So only make it NULL, if extcon really reports ENODEV?


Heiko

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

* Re: [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional.
@ 2018-03-01  9:49     ` Heiko Stübner
  0 siblings, 0 replies; 24+ messages in thread
From: Heiko Stübner @ 2018-03-01  9:49 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: kishon, groeck, gwendal, kernel, vicencb, devicetree,
	linux-kernel, linux-rockchip, Rob Herring, Mark Rutland,
	linux-arm-kernel

Hi Enric,

Am Donnerstag, 1. März 2018, 10:24:16 CET schrieb Enric Balletbo i Serra:
> The extcon property is used to detect the cable-state but some boards,
> like Sapphire, currently does not seem to support, others might just not
> need, as are supposed to work in host-mode only. So, extcon property is
> not really a required property, move to be optional instead.

The change itself is justified, the "justification" in the message might
need some rework, as this sounds more like a kernel-side issue,
while the extcon should always be optional.

Something like:

The extcon property is used to detect the cable-state but some boards
just connect the type-c phy to a regular USB-A connector without any
power-delivery and thus no controller reporting the cable-state.
So the extcon property is not really a required property, move it to be 
optional instead.


For the change itself:
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
>  Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index
> 6ea867e3176f..a66f23a01129 100644
> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> @@ -14,6 +14,8 @@ Required properties:
>   - resets : a list of phandle + reset specifier pairs
>   - reset-names : string reset name, must be:
>  		 "uphy", "uphy-pipe", "uphy-tcphy"
> +
> +Optional properties:
>   - extcon : extcon specifier for the Power Delivery
> 
>  Note, there are 2 type-c phys for RK3399, and they are almost identical,
> except

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

* Re: [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional.
@ 2018-03-01  9:49     ` Heiko Stübner
  0 siblings, 0 replies; 24+ messages in thread
From: Heiko Stübner @ 2018-03-01  9:49 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
	gwendal-F7+t8E8rja9g9hUCZPvPmw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	vicencb-Re5JQEeQqe8AvxtiuMwx3w, kishon-l0cyMroinI0,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring,
	groeck-F7+t8E8rja9g9hUCZPvPmw, kernel-ZGY8ohtN/8qB+jHODAdFcQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Enric,

Am Donnerstag, 1. März 2018, 10:24:16 CET schrieb Enric Balletbo i Serra:
> The extcon property is used to detect the cable-state but some boards,
> like Sapphire, currently does not seem to support, others might just not
> need, as are supposed to work in host-mode only. So, extcon property is
> not really a required property, move to be optional instead.

The change itself is justified, the "justification" in the message might
need some rework, as this sounds more like a kernel-side issue,
while the extcon should always be optional.

Something like:

The extcon property is used to detect the cable-state but some boards
just connect the type-c phy to a regular USB-A connector without any
power-delivery and thus no controller reporting the cable-state.
So the extcon property is not really a required property, move it to be 
optional instead.


For the change itself:
Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

> Signed-off-by: Enric Balletbo i Serra <enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
> 
>  Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index
> 6ea867e3176f..a66f23a01129 100644
> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> @@ -14,6 +14,8 @@ Required properties:
>   - resets : a list of phandle + reset specifier pairs
>   - reset-names : string reset name, must be:
>  		 "uphy", "uphy-pipe", "uphy-tcphy"
> +
> +Optional properties:
>   - extcon : extcon specifier for the Power Delivery
> 
>  Note, there are 2 type-c phys for RK3399, and they are almost identical,
> except

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

* [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional.
@ 2018-03-01  9:49     ` Heiko Stübner
  0 siblings, 0 replies; 24+ messages in thread
From: Heiko Stübner @ 2018-03-01  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Enric,

Am Donnerstag, 1. M?rz 2018, 10:24:16 CET schrieb Enric Balletbo i Serra:
> The extcon property is used to detect the cable-state but some boards,
> like Sapphire, currently does not seem to support, others might just not
> need, as are supposed to work in host-mode only. So, extcon property is
> not really a required property, move to be optional instead.

The change itself is justified, the "justification" in the message might
need some rework, as this sounds more like a kernel-side issue,
while the extcon should always be optional.

Something like:

The extcon property is used to detect the cable-state but some boards
just connect the type-c phy to a regular USB-A connector without any
power-delivery and thus no controller reporting the cable-state.
So the extcon property is not really a required property, move it to be 
optional instead.


For the change itself:
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
>  Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index
> 6ea867e3176f..a66f23a01129 100644
> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
> @@ -14,6 +14,8 @@ Required properties:
>   - resets : a list of phandle + reset specifier pairs
>   - reset-names : string reset name, must be:
>  		 "uphy", "uphy-pipe", "uphy-tcphy"
> +
> +Optional properties:
>   - extcon : extcon specifier for the Power Delivery
> 
>  Note, there are 2 type-c phys for RK3399, and they are almost identical,
> except

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

* Re: [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
  2018-03-01  9:45     ` Heiko Stübner
@ 2018-03-01 12:15       ` Enric Balletbo i Serra
  -1 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01 12:15 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: kishon, groeck, gwendal, kernel, vicencb, linux-rockchip,
	linux-kernel, linux-arm-kernel

Hi Heiko,

On 01/03/18 10:45, Heiko Stübner wrote:
> Am Donnerstag, 1. März 2018, 10:24:15 CET schrieb Enric Balletbo i Serra:
>> Right now the rockchip typec-phy does fail probing when no extcon is
>> detected. Some boards get the cable-state via the extcon interface and
>> have this supported, other boards seem to use the fusb302 chip or
>> another but the driver currently does not seem to utilize the extcon
>> interface to report the cable-state. That's required to detect
>> cable-state changes but a missing extcon shouldn't fail to probe,
>> instead, should just fall back to working in host-mode if it cannot get
>> the extcon.
> 
> And of course:
> Some boards use no controller at all and just connect the type-c to a
> standard USB-A port.
> 
>> Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
>> support for rk3399") Reported-by: Vicente Bergas <vicencb@gmail.com>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
>>
>>  drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c
>> b/drivers/phy/rockchip/phy-rockchip-typec.c index
>> 7492c8978217..3741afab5cd2 100644
>> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
>> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
>> @@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy
>> *tcphy) u8 mode;
>>  	int ret;
>>
>> +	if (!edev)
>> +		return MODE_DFP_USB;
>> +
>>  	ufp = extcon_get_state(edev, EXTCON_USB);
>>  	dp = extcon_get_state(edev, EXTCON_DISP_DP);
>>
>> @@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct
>> platform_device *pdev)
>>
>>  	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
>>  	if (IS_ERR(tcphy->extcon)) {
>> -		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
>> -			dev_err(dev, "Invalid or missing extcon\n");
>> -		return PTR_ERR(tcphy->extcon);
>> +		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
>> +			return PTR_ERR(tcphy->extcon);
>> +		tcphy->extcon = NULL;
> 
> Do we want to keep a bit of the error handling of extcon, a la
> 
> +		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
> +			tcphy->extcon = NULL;
> +		} else {
> +			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
> +				dev_err(dev, "Invalid or extcon\n");
> +			return PTR_ERR(tcphy->extcon);
> +		}
> 
> So only make it NULL, if extcon really reports ENODEV?
> 

Sounds good to me, I'll send a second version ASAP, so people can test it with
that change applied.

Thanks for the feedback.

Regards,
 Enric

> 
> Heiko
> 

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

* [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
@ 2018-03-01 12:15       ` Enric Balletbo i Serra
  0 siblings, 0 replies; 24+ messages in thread
From: Enric Balletbo i Serra @ 2018-03-01 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Heiko,

On 01/03/18 10:45, Heiko St?bner wrote:
> Am Donnerstag, 1. M?rz 2018, 10:24:15 CET schrieb Enric Balletbo i Serra:
>> Right now the rockchip typec-phy does fail probing when no extcon is
>> detected. Some boards get the cable-state via the extcon interface and
>> have this supported, other boards seem to use the fusb302 chip or
>> another but the driver currently does not seem to utilize the extcon
>> interface to report the cable-state. That's required to detect
>> cable-state changes but a missing extcon shouldn't fail to probe,
>> instead, should just fall back to working in host-mode if it cannot get
>> the extcon.
> 
> And of course:
> Some boards use no controller at all and just connect the type-c to a
> standard USB-A port.
> 
>> Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port
>> support for rk3399") Reported-by: Vicente Bergas <vicencb@gmail.com>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
>>
>>  drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c
>> b/drivers/phy/rockchip/phy-rockchip-typec.c index
>> 7492c8978217..3741afab5cd2 100644
>> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
>> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
>> @@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy
>> *tcphy) u8 mode;
>>  	int ret;
>>
>> +	if (!edev)
>> +		return MODE_DFP_USB;
>> +
>>  	ufp = extcon_get_state(edev, EXTCON_USB);
>>  	dp = extcon_get_state(edev, EXTCON_DISP_DP);
>>
>> @@ -1115,9 +1118,9 @@ static int rockchip_typec_phy_probe(struct
>> platform_device *pdev)
>>
>>  	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
>>  	if (IS_ERR(tcphy->extcon)) {
>> -		if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
>> -			dev_err(dev, "Invalid or missing extcon\n");
>> -		return PTR_ERR(tcphy->extcon);
>> +		if (PTR_ERR(tcphy->extcon) == -EPROBE_DEFER)
>> +			return PTR_ERR(tcphy->extcon);
>> +		tcphy->extcon = NULL;
> 
> Do we want to keep a bit of the error handling of extcon, a la
> 
> +		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
> +			tcphy->extcon = NULL;
> +		} else {
> +			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
> +				dev_err(dev, "Invalid or extcon\n");
> +			return PTR_ERR(tcphy->extcon);
> +		}
> 
> So only make it NULL, if extcon really reports ENODEV?
> 

Sounds good to me, I'll send a second version ASAP, so people can test it with
that change applied.

Thanks for the feedback.

Regards,
 Enric

> 
> Heiko
> 

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

end of thread, other threads:[~2018-03-01 12:15 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01  9:24 [PATCH 0/6] phy: rockchip-typec: fix boards that does not report cable-state Enric Balletbo i Serra
2018-03-01  9:24 ` Enric Balletbo i Serra
2018-03-01  9:24 ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:45   ` Heiko Stübner
2018-03-01  9:45     ` Heiko Stübner
2018-03-01 12:15     ` Enric Balletbo i Serra
2018-03-01 12:15       ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:49   ` Heiko Stübner
2018-03-01  9:49     ` Heiko Stübner
2018-03-01  9:49     ` Heiko Stübner
2018-03-01  9:24 ` [PATCH 3/6] arm64: dts: rockchip: enable typec-phy for rk3399-sapphire Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 4/6] arm64: dts: rockchip: enable typec-phy for rk3399-firefly Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 5/6] arm64: dts: rockchip: enable typec-phy1 for rk3399-puma Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 6/6] arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.