* [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties.
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
@ 2018-02-16 12:09 ` Enric Balletbo i Serra
2018-02-17 0:07 ` Heiko Stuebner
2018-02-19 20:02 ` Rob Herring
2018-02-16 12:09 ` [PATCH v3 3/6] phy: rockchip-typec: enable usb3 host during usb3 phy power on Enric Balletbo i Serra
` (4 subsequent siblings)
5 siblings, 2 replies; 14+ messages in thread
From: Enric Balletbo i Serra @ 2018-02-16 12:09 UTC (permalink / raw)
To: Rob Herring, Kishon Vijay Abraham I, Brian Norris
Cc: devicetree, hl, dianders, linux-kernel, linux-rockchip,
Chris Zhong, William wu, kernel, linux-arm-kernel,
Heiko Stuebner
As now the following register properties are in the driver, document as
deprecated these properties and recommend to not use them on new bindings.
The deprecated properties are:
- rockchip,typec-conn-dir : the register of type-c connector direction
- rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2
enable control.
- rockchip,external-psm : the register of type-c phy external psm clock
selection.
- rockchip,pipe-status : the register of type-c phy pipe status.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
- Apply the nit suggested by Heiko Stuebner.
Changes since v1:
- This patch is new on these series and is just a documentation update
due patch [1/6]
.../devicetree/bindings/phy/phy-rockchip-typec.txt | 33 +++++-----------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
index 6ea867e3176f..f95cd492d6fc 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
@@ -16,24 +16,6 @@ Required properties:
"uphy", "uphy-pipe", "uphy-tcphy"
- extcon : extcon specifier for the Power Delivery
-Note, there are 2 type-c phys for RK3399, and they are almost identical, except
-these registers(description below), every register node contains 3 sections:
-offset, enable bit, write mask bit.
- - rockchip,typec-conn-dir : the register of type-c connector direction,
- for type-c phy0, it must be <0xe580 0 16>;
- for type-c phy1, it must be <0xe58c 0 16>;
- - rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2 enable
- control.
- for type-c phy0, it must be <0xe580 3 19>;
- for type-c phy1, it must be <0xe58c 3 19>;
- - rockchip,external-psm : the register of type-c phy external psm clock
- selection.
- for type-c phy0, it must be <0xe588 14 30>;
- for type-c phy1, it must be <0xe594 14 30>;
- - rockchip,pipe-status : the register of type-c phy pipe status.
- for type-c phy0, it must be <0xe5c0 0 0>;
- for type-c phy1, it must be <0xe5c0 16 16>;
-
Required nodes : a sub-node is required for each port the phy provides.
The sub-node name is used to identify dp or usb3 port,
and shall be the following entries:
@@ -43,6 +25,13 @@ Required nodes : a sub-node is required for each port the phy provides.
Required properties (port (child) node):
- #phy-cells : must be 0, See ./phy-bindings.txt for details.
+Deprecated properties, do not use in new device tree sources, these
+properties are determined by the compatible value:
+ - rockchip,typec-conn-dir
+ - rockchip,usb3tousb2-en
+ - rockchip,external-psm
+ - rockchip,pipe-status
+
Example:
tcphy0: phy@ff7c0000 {
compatible = "rockchip,rk3399-typec-phy";
@@ -58,10 +47,6 @@ Example:
<&cru SRST_UPHY0_PIPE_L00>,
<&cru SRST_P_UPHY0_TCPHY>;
reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
- rockchip,typec-conn-dir = <0xe580 0 16>;
- rockchip,usb3tousb2-en = <0xe580 3 19>;
- rockchip,external-psm = <0xe588 14 30>;
- rockchip,pipe-status = <0xe5c0 0 0>;
tcphy0_dp: dp-port {
#phy-cells = <0>;
@@ -86,10 +71,6 @@ Example:
<&cru SRST_UPHY1_PIPE_L00>,
<&cru SRST_P_UPHY1_TCPHY>;
reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
- rockchip,typec-conn-dir = <0xe58c 0 16>;
- rockchip,usb3tousb2-en = <0xe58c 3 19>;
- rockchip,external-psm = <0xe594 14 30>;
- rockchip,pipe-status = <0xe5c0 16 16>;
tcphy1_dp: dp-port {
#phy-cells = <0>;
--
2.15.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties.
2018-02-16 12:09 ` [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties Enric Balletbo i Serra
@ 2018-02-17 0:07 ` Heiko Stuebner
2018-02-19 20:02 ` Rob Herring
1 sibling, 0 replies; 14+ messages in thread
From: Heiko Stuebner @ 2018-02-17 0:07 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Rob Herring, Kishon Vijay Abraham I, Brian Norris, dianders,
Chris Zhong, William wu, hl, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel
Am Freitag, 16. Februar 2018, 13:09:52 CET schrieb Enric Balletbo i Serra:
> As now the following register properties are in the driver, document as
> deprecated these properties and recommend to not use them on new bindings.
>
> The deprecated properties are:
>
> - rockchip,typec-conn-dir : the register of type-c connector direction
> - rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2
> enable control.
> - rockchip,external-psm : the register of type-c phy external psm clock
> selection.
> - rockchip,pipe-status : the register of type-c phy pipe status.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties.
2018-02-16 12:09 ` [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties Enric Balletbo i Serra
2018-02-17 0:07 ` Heiko Stuebner
@ 2018-02-19 20:02 ` Rob Herring
1 sibling, 0 replies; 14+ messages in thread
From: Rob Herring @ 2018-02-19 20:02 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: devicetree, Heiko Stuebner, linux-kernel, Brian Norris, dianders,
Kishon Vijay Abraham I, linux-rockchip, Chris Zhong, William wu,
kernel, linux-arm-kernel, hl
On Fri, Feb 16, 2018 at 01:09:52PM +0100, Enric Balletbo i Serra wrote:
> As now the following register properties are in the driver, document as
> deprecated these properties and recommend to not use them on new bindings.
>
> The deprecated properties are:
>
> - rockchip,typec-conn-dir : the register of type-c connector direction
> - rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2
> enable control.
> - rockchip,external-psm : the register of type-c phy external psm clock
> selection.
> - rockchip,pipe-status : the register of type-c phy pipe status.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> Changes since v2:
> - Apply the nit suggested by Heiko Stuebner.
> Changes since v1:
> - This patch is new on these series and is just a documentation update
> due patch [1/6]
>
> .../devicetree/bindings/phy/phy-rockchip-typec.txt | 33 +++++-----------------
> 1 file changed, 7 insertions(+), 26 deletions(-)
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 3/6] phy: rockchip-typec: enable usb3 host during usb3 phy power on
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
2018-02-16 12:09 ` [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties Enric Balletbo i Serra
@ 2018-02-16 12:09 ` Enric Balletbo i Serra
[not found] ` <20180216120956.19034-3-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-02-16 12:09 ` [PATCH v3 4/6] phy: rockchip-typec: force to USB2 if DP at 4 lanes mode Enric Balletbo i Serra
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Enric Balletbo i Serra @ 2018-02-16 12:09 UTC (permalink / raw)
To: Rob Herring, Kishon Vijay Abraham I, Brian Norris
Cc: Heiko Stuebner, dianders, Chris Zhong, William wu, hl,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel
From: William wu <wulf@rock-chips.com>
We have forced usb3 to work in usb2 only mode in firmware by setting
usb3tousb2_en (bit3 of GRF_USB3PHY0/1_CON0) to 1, and setting
host_u3_port_disable (bit0 of GRF_USB3OTG0/1_CON1) to 1 and host_u3_port
(bit15~12 of GRF_USB3OTG0/1_CON1) to 0. So we need to re-enable usb3
host.
Note that the RK3399 TRM suggests that we should keep the whole usb3
controller in reset for the duration of the Type-C PHY initialization.
However, it's hard to assert the reset in the current framework of
reset. And according to the TRM, it doesn't require that we should
clear the usb3tousb2 bit before pipe ready. So let's enable the usb3
host after pipe ready to avoid the Type-C PHY initialization failure.
Signed-off-by: William wu <wulf@rock-chips.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
- None.
Changes since v1:
- Use the registers offsets from the driver not the DT.
drivers/phy/rockchip/phy-rockchip-typec.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 5f660f6b9f95..54dc52a948ef 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -362,6 +362,8 @@ struct usb3phy_reg {
* @usb3tousb2_en: the register of type-c force usb2 to usb2 enable.
* @external_psm: the register of type-c phy external psm clock.
* @pipe_status: the register of type-c phy pipe status.
+ * @usb3_host_disable: the register of type-c usb3 host disable.
+ * @usb3_host_port: the register of type-c usb3 host port.
*/
struct rockchip_usb3phy_port_cfg {
unsigned int reg;
@@ -369,6 +371,8 @@ struct rockchip_usb3phy_port_cfg {
struct usb3phy_reg usb3tousb2_en;
struct usb3phy_reg external_psm;
struct usb3phy_reg pipe_status;
+ struct usb3phy_reg usb3_host_disable;
+ struct usb3phy_reg usb3_host_port;
};
struct rockchip_typec_phy {
@@ -440,6 +444,8 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = {
.usb3tousb2_en = { 0xe580, 3, 19 },
.external_psm = { 0xe588, 14, 30 },
.pipe_status = { 0xe5c0, 0, 0 },
+ .usb3_host_disable = { 0x2434, 0, 16 },
+ .usb3_host_port = { 0x2434, 12, 28 },
},
{
.reg = 0xff800000,
@@ -447,6 +453,8 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = {
.usb3tousb2_en = { 0xe58c, 3, 19 },
.external_psm = { 0xe594, 14, 30 },
.pipe_status = { 0xe5c0, 16, 16 },
+ .usb3_host_disable = { 0x2444, 0, 16 },
+ .usb3_host_port = { 0x2444, 12, 28 },
},
{ /* sentinel */ }
};
@@ -879,6 +887,9 @@ static int rockchip_usb3_phy_power_on(struct phy *phy)
regmap_read(tcphy->grf_regs, reg->offset, &val);
if (!(val & BIT(reg->enable_bit))) {
tcphy->mode |= new_mode & (MODE_DFP_USB | MODE_UFP_USB);
+ /* enable usb3 host */
+ property_enable(tcphy, &cfg->usb3_host_disable, 0);
+ property_enable(tcphy, &cfg->usb3_host_port, 1);
goto unlock_ret;
}
usleep_range(10, 20);
--
2.15.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 4/6] phy: rockchip-typec: force to USB2 if DP at 4 lanes mode
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
2018-02-16 12:09 ` [PATCH v3 2/6] dt-bindings: phy-rockchip-typec: deprecate some register properties Enric Balletbo i Serra
2018-02-16 12:09 ` [PATCH v3 3/6] phy: rockchip-typec: enable usb3 host during usb3 phy power on Enric Balletbo i Serra
@ 2018-02-16 12:09 ` Enric Balletbo i Serra
[not found] ` <20180216120956.19034-4-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-02-16 12:09 ` [PATCH v3 5/6] phy: rockchip-typec: support DP phy switch Enric Balletbo i Serra
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Enric Balletbo i Serra @ 2018-02-16 12:09 UTC (permalink / raw)
To: Rob Herring, Kishon Vijay Abraham I, Brian Norris
Cc: Heiko Stuebner, dianders, Chris Zhong, William wu, hl,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel
From: Chris Zhong <zyw@rock-chips.com>
The usb3tousb2_en BIT will be clear to 0 in probe(), it make USB
controller work at USB3 mode, and if the USB phy is turned on with DP
only mode(4 lanes DP), the rockchip_usb3_phy_power_on() will return
directly, so usb3_host_disable and usb3_host_port these 2 BIT will keep
a same value as coreboot. In coreboot, these 3 BITs are set as USB2
mode, but now one of the bits is changed to USB3, it make USB controller
work at a unknown status.
These 3 BITs should be changed to USB2, if the Type-C works at 4 lanes
mode, and then switch it back to USB3 mode, when USB disconnect.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
- None.
Changes since v1:
- Use the registers offsets from the driver not the DT.
drivers/phy/rockchip/phy-rockchip-typec.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 54dc52a948ef..9bc4d4bd46d3 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -853,6 +853,18 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
return mode;
}
+static int tcphy_cfg_usb3_to_usb2_only(struct rockchip_typec_phy *tcphy,
+ bool value)
+{
+ struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
+
+ property_enable(tcphy, &cfg->usb3tousb2_en, value);
+ property_enable(tcphy, &cfg->usb3_host_disable, value);
+ property_enable(tcphy, &cfg->usb3_host_port, !value);
+
+ return 0;
+}
+
static int rockchip_usb3_phy_power_on(struct phy *phy)
{
struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
@@ -870,8 +882,10 @@ static int rockchip_usb3_phy_power_on(struct phy *phy)
}
/* DP-only mode; fall back to USB2 */
- if (!(new_mode & (MODE_DFP_USB | MODE_UFP_USB)))
+ if (!(new_mode & (MODE_DFP_USB | MODE_UFP_USB))) {
+ tcphy_cfg_usb3_to_usb2_only(tcphy, true);
goto unlock_ret;
+ }
if (tcphy->mode == new_mode)
goto unlock_ret;
@@ -887,9 +901,9 @@ static int rockchip_usb3_phy_power_on(struct phy *phy)
regmap_read(tcphy->grf_regs, reg->offset, &val);
if (!(val & BIT(reg->enable_bit))) {
tcphy->mode |= new_mode & (MODE_DFP_USB | MODE_UFP_USB);
+
/* enable usb3 host */
- property_enable(tcphy, &cfg->usb3_host_disable, 0);
- property_enable(tcphy, &cfg->usb3_host_port, 1);
+ tcphy_cfg_usb3_to_usb2_only(tcphy, false);
goto unlock_ret;
}
usleep_range(10, 20);
@@ -910,6 +924,7 @@ static int rockchip_usb3_phy_power_off(struct phy *phy)
struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
mutex_lock(&tcphy->lock);
+ tcphy_cfg_usb3_to_usb2_only(tcphy, false);
if (tcphy->mode == MODE_DISCONNECT)
goto unlock;
--
2.15.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/6] phy: rockchip-typec: support DP phy switch
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
` (2 preceding siblings ...)
2018-02-16 12:09 ` [PATCH v3 4/6] phy: rockchip-typec: force to USB2 if DP at 4 lanes mode Enric Balletbo i Serra
@ 2018-02-16 12:09 ` Enric Balletbo i Serra
[not found] ` <20180216120956.19034-5-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-02-16 12:09 ` [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the " Enric Balletbo i Serra
2018-02-17 0:06 ` [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Heiko Stuebner
5 siblings, 1 reply; 14+ messages in thread
From: Enric Balletbo i Serra @ 2018-02-16 12:09 UTC (permalink / raw)
To: Rob Herring, Kishon Vijay Abraham I, Brian Norris
Cc: Heiko Stuebner, dianders, Chris Zhong, William wu, hl,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel
From: Chris Zhong <zyw@rock-chips.com>
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
only one PHY can connect to DP controller at one time, the other should
be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
set this bit means enable PHY 1, clear this bit means enable PHY 0.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
- None.
Changes since v1:
- This patch is new on these series but as a consequence of the work
done need to be reworked. The patch was send some time ago [1] but
got stuck, so it's also and attempt to revive it.
[1] https://lkml.org/lkml/2017/2/10/74
drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 9bc4d4bd46d3..1c79785a5439 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -364,6 +364,7 @@ struct usb3phy_reg {
* @pipe_status: the register of type-c phy pipe status.
* @usb3_host_disable: the register of type-c usb3 host disable.
* @usb3_host_port: the register of type-c usb3 host port.
+ * @uphy_dp_sel: the register of type-c phy DP select control.
*/
struct rockchip_usb3phy_port_cfg {
unsigned int reg;
@@ -373,6 +374,7 @@ struct rockchip_usb3phy_port_cfg {
struct usb3phy_reg pipe_status;
struct usb3phy_reg usb3_host_disable;
struct usb3phy_reg usb3_host_port;
+ struct usb3phy_reg uphy_dp_sel;
};
struct rockchip_typec_phy {
@@ -446,6 +448,7 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = {
.pipe_status = { 0xe5c0, 0, 0 },
.usb3_host_disable = { 0x2434, 0, 16 },
.usb3_host_port = { 0x2434, 12, 28 },
+ .uphy_dp_sel = { 0x6268, 19, 19 },
},
{
.reg = 0xff800000,
@@ -455,6 +458,7 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = {
.pipe_status = { 0xe5c0, 16, 16 },
.usb3_host_disable = { 0x2444, 0, 16 },
.usb3_host_port = { 0x2444, 12, 28 },
+ .uphy_dp_sel = { 0x6268, 3, 19 },
},
{ /* sentinel */ }
};
@@ -856,7 +860,7 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
static int tcphy_cfg_usb3_to_usb2_only(struct rockchip_typec_phy *tcphy,
bool value)
{
- struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
+ const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
property_enable(tcphy, &cfg->usb3tousb2_en, value);
property_enable(tcphy, &cfg->usb3_host_disable, value);
@@ -947,6 +951,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = {
static int rockchip_dp_phy_power_on(struct phy *phy)
{
struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
+ const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
int new_mode, ret = 0;
u32 val;
@@ -979,6 +984,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy)
if (ret)
goto unlock_ret;
+ property_enable(tcphy, &cfg->uphy_dp_sel, 1);
+
ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL,
val, val & DP_MODE_A2, 1000,
PHY_MODE_SET_TIMEOUT);
--
2.15.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the DP phy switch
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
` (3 preceding siblings ...)
2018-02-16 12:09 ` [PATCH v3 5/6] phy: rockchip-typec: support DP phy switch Enric Balletbo i Serra
@ 2018-02-16 12:09 ` Enric Balletbo i Serra
[not found] ` <20180216120956.19034-6-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-03-16 11:02 ` Heiko Stuebner
2018-02-17 0:06 ` [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Heiko Stuebner
5 siblings, 2 replies; 14+ messages in thread
From: Enric Balletbo i Serra @ 2018-02-16 12:09 UTC (permalink / raw)
To: Rob Herring, Kishon Vijay Abraham I, Brian Norris
Cc: Heiko Stuebner, dianders, Chris Zhong, William wu, hl,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel
From: Chris Zhong <zyw@rock-chips.com>
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
only one PHY can connect to DP controller at one time, the other should
be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
set this bit means enable PHY 1, clear this bit means enable PHY 0.
If the board has 2 Type-C ports, the DP driver get the phy id from
devm_of_phy_get_by_index, and then control this switch according to
this id. But some others board only has one Type-C port, it may be PHY 0
or PHY 1. The dts node id can not tell us the correct PHY id. Hence move
this switch to PHY driver, the PHY driver can distinguish between PHY 0
and PHY 1, and then write the correct register bit.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
- None.
Changes since v1:
- This patch is new on these series and is related to [5/6] so I
included to this series. Like [5/6] the patch was send some time ago
[1] but got stuck, so it's also and attempt to revive it.
[1] https://lkml.org/lkml/2017/2/10/74
drivers/gpu/drm/rockchip/cdn-dp-core.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index ec999d9f15f6..c6fbdcd87c16 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -43,8 +43,6 @@
#define GRF_SOC_CON9 0x6224
#define DP_SEL_VOP_LIT BIT(12)
#define GRF_SOC_CON26 0x6268
-#define UPHY_SEL_BIT 3
-#define UPHY_SEL_MASK BIT(19)
#define DPTX_HPD_SEL (3 << 12)
#define DPTX_HPD_DEL (2 << 12)
#define DPTX_HPD_SEL_MASK (3 << 28)
@@ -394,11 +392,6 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port)
union extcon_property_value property;
int ret;
- ret = cdn_dp_grf_write(dp, GRF_SOC_CON26,
- (port->id << UPHY_SEL_BIT) | UPHY_SEL_MASK);
- if (ret)
- return ret;
-
if (!port->phy_enabled) {
ret = phy_power_on(port->phy);
if (ret) {
--
2.15.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
[parent not found: <20180216120956.19034-6-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>]
* Re: [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the DP phy switch
[not found] ` <20180216120956.19034-6-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
@ 2018-02-17 0:10 ` Heiko Stuebner
0 siblings, 0 replies; 14+ messages in thread
From: Heiko Stuebner @ 2018-02-17 0:10 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Rob Herring, Kishon Vijay Abraham I, Brian Norris,
dianders-F7+t8E8rja9g9hUCZPvPmw, Chris Zhong, William wu,
hl-TNX95d0MmH7DzftRWevZcw, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-ZGY8ohtN/8qB+jHODAdFcQ
Am Freitag, 16. Februar 2018, 13:09:56 CET schrieb Enric Balletbo i Serra:
> From: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>
> There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
> only one PHY can connect to DP controller at one time, the other should
> be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
> set this bit means enable PHY 1, clear this bit means enable PHY 0.
>
> If the board has 2 Type-C ports, the DP driver get the phy id from
> devm_of_phy_get_by_index, and then control this switch according to
> this id. But some others board only has one Type-C port, it may be PHY 0
> or PHY 1. The dts node id can not tell us the correct PHY id. Hence move
> this switch to PHY driver, the PHY driver can distinguish between PHY 0
> and PHY 1, and then write the correct register bit.
>
> Signed-off-by: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the DP phy switch
2018-02-16 12:09 ` [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the " Enric Balletbo i Serra
[not found] ` <20180216120956.19034-6-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
@ 2018-03-16 11:02 ` Heiko Stuebner
1 sibling, 0 replies; 14+ messages in thread
From: Heiko Stuebner @ 2018-03-16 11:02 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Rob Herring, Kishon Vijay Abraham I, Brian Norris, dianders,
Chris Zhong, William wu, hl, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel
Am Freitag, 16. Februar 2018, 13:09:56 CET schrieb Enric Balletbo i Serra:
> From: Chris Zhong <zyw@rock-chips.com>
>
> There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
> only one PHY can connect to DP controller at one time, the other should
> be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
> set this bit means enable PHY 1, clear this bit means enable PHY 0.
>
> If the board has 2 Type-C ports, the DP driver get the phy id from
> devm_of_phy_get_by_index, and then control this switch according to
> this id. But some others board only has one Type-C port, it may be PHY 0
> or PHY 1. The dts node id can not tell us the correct PHY id. Hence move
> this switch to PHY driver, the PHY driver can distinguish between PHY 0
> and PHY 1, and then write the correct register bit.
>
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
applied to drm-misc with a note stating where the rest of the series
went to.
Thanks
Heiko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields.
2018-02-16 12:09 [PATCH v3 1/6] phy: rockchip-typec: deprecate some DT properties for various register fields Enric Balletbo i Serra
` (4 preceding siblings ...)
2018-02-16 12:09 ` [PATCH v3 6/6] drm/rockchip: cdn-dp: remove the " Enric Balletbo i Serra
@ 2018-02-17 0:06 ` Heiko Stuebner
5 siblings, 0 replies; 14+ messages in thread
From: Heiko Stuebner @ 2018-02-17 0:06 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Rob Herring, Kishon Vijay Abraham I, Brian Norris, dianders,
Chris Zhong, William wu, hl, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel
Am Freitag, 16. Februar 2018, 13:09:51 CET schrieb Enric Balletbo i Serra:
> Adding properties for various register fields in the DT doesn't scale and
> this information should be in the driver instead.
>
> Before this patch these registers (description below) were specified in
> the DT, every register node contained 3 sections: offset, enable bit,
> write mask bit.
>
> - rockchip,typec-conn-dir : the register of type-c connector direction,
> for type-c phy0, it must be <0xe580 0 16>;
> for type-c phy1, it must be <0xe58c 0 16>;
> - rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2 enable
> control.
> for type-c phy0, it must be <0xe580 3 19>;
> for type-c phy1, it must be <0xe58c 3 19>;
> - rockchip,external-psm : the register of type-c phy external psm clock
> selection.
> for type-c phy0, it must be <0xe588 14 30>;
> for type-c phy1, it must be <0xe594 14 30>;
> - rockchip,pipe-status : the register of type-c phy pipe status.
> for type-c phy0, it must be <0xe5c0 0 0>;
> for type-c phy1, it must be <0xe5c0 16 16>;
>
> After this patch these register definitions are in the driver. So can be
> removed from the DT. Note that there are 2 type-c phys for RK3399 with
> different offsets, the driver checks the phy base address of the running
> instance and applies the right offsets.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> Changes since v2:
> - Suggested by Heiko Stuebner:
> - Prefix phy config struct with rk3399_ as is rk3399-specific.
> - Create a new struct similar to things like the inno-usb2-phy
> - Select phy config according to the compatible and remove the
> specific constants.
> Changes since v1:
> - This patch is new in this series to accomplish the purpose of get rid
> of some registers from the DT. Suggested by Rob Herring.
looks great now
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 14+ messages in thread