All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-07 11:53 ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index fb8aba4..5d9d7f3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* switch to USB function. (system register, force ip into usb mode) */
+	/* switch to USB function, and enable usb pll */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_FORCE_UART_EN;
+	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
 	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
 	tmp = readl(com + U3P_U2PHYDTM0);
 	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-	tmp |= P2C_FORCE_SUSPENDM;
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
 	writel(tmp, com + U3P_USBPHYACR6);
 
-	/* let suspendm=0, set utmi into analog power down */
-	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_RG_SUSPENDM;
-	writel(tmp, com + U3P_U2PHYDTM0);
-	udelay(1);
-
 	tmp = readl(com + U3P_U2PHYDTM1);
 	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
 	tmp |= P2C_RG_SESSEND;
 	writel(tmp, com + U3P_U2PHYDTM1);
 
 	if (tphy->pdata->avoid_rx_sen_degradation && index) {
+		tmp = readl(com + U3P_U2PHYDTM0);
+		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+		writel(tmp, com + U3P_U2PHYDTM0);
+
 		tmp = readl(com + U3D_U2PHYDCR0);
 		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
 		writel(tmp, com + U3D_U2PHYDCR0);
-- 
1.9.1

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

* [1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-07 11:53 ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index fb8aba4..5d9d7f3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* switch to USB function. (system register, force ip into usb mode) */
+	/* switch to USB function, and enable usb pll */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_FORCE_UART_EN;
+	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
 	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
 	tmp = readl(com + U3P_U2PHYDTM0);
 	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-	tmp |= P2C_FORCE_SUSPENDM;
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
 	writel(tmp, com + U3P_USBPHYACR6);
 
-	/* let suspendm=0, set utmi into analog power down */
-	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_RG_SUSPENDM;
-	writel(tmp, com + U3P_U2PHYDTM0);
-	udelay(1);
-
 	tmp = readl(com + U3P_U2PHYDTM1);
 	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
 	tmp |= P2C_RG_SESSEND;
 	writel(tmp, com + U3P_U2PHYDTM1);
 
 	if (tphy->pdata->avoid_rx_sen_degradation && index) {
+		tmp = readl(com + U3P_U2PHYDTM0);
+		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+		writel(tmp, com + U3P_U2PHYDTM0);
+
 		tmp = readl(com + U3D_U2PHYDCR0);
 		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
 		writel(tmp, com + U3D_U2PHYDCR0);

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

* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-07 11:53 ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index fb8aba4..5d9d7f3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* switch to USB function. (system register, force ip into usb mode) */
+	/* switch to USB function, and enable usb pll */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_FORCE_UART_EN;
+	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
 	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
 	tmp = readl(com + U3P_U2PHYDTM0);
 	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-	tmp |= P2C_FORCE_SUSPENDM;
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
 	writel(tmp, com + U3P_USBPHYACR6);
 
-	/* let suspendm=0, set utmi into analog power down */
-	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_RG_SUSPENDM;
-	writel(tmp, com + U3P_U2PHYDTM0);
-	udelay(1);
-
 	tmp = readl(com + U3P_U2PHYDTM1);
 	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
 	tmp |= P2C_RG_SESSEND;
 	writel(tmp, com + U3P_U2PHYDTM1);
 
 	if (tphy->pdata->avoid_rx_sen_degradation && index) {
+		tmp = readl(com + U3P_U2PHYDTM0);
+		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+		writel(tmp, com + U3P_U2PHYDTM0);
+
 		tmp = readl(com + U3D_U2PHYDCR0);
 		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
 		writel(tmp, com + U3D_U2PHYDCR0);
-- 
1.9.1

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

* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-07 11:53 ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel

When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index fb8aba4..5d9d7f3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* switch to USB function. (system register, force ip into usb mode) */
+	/* switch to USB function, and enable usb pll */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_FORCE_UART_EN;
+	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
 	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
 	tmp = readl(com + U3P_U2PHYDTM0);
 	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-	tmp |= P2C_FORCE_SUSPENDM;
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
 	writel(tmp, com + U3P_USBPHYACR6);
 
-	/* let suspendm=0, set utmi into analog power down */
-	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_RG_SUSPENDM;
-	writel(tmp, com + U3P_U2PHYDTM0);
-	udelay(1);
-
 	tmp = readl(com + U3P_U2PHYDTM1);
 	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
 	tmp |= P2C_RG_SESSEND;
 	writel(tmp, com + U3P_U2PHYDTM1);
 
 	if (tphy->pdata->avoid_rx_sen_degradation && index) {
+		tmp = readl(com + U3P_U2PHYDTM0);
+		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+		writel(tmp, com + U3P_U2PHYDTM0);
+
 		tmp = readl(com + U3D_U2PHYDCR0);
 		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
 		writel(tmp, com + U3D_U2PHYDCR0);
-- 
1.9.1

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

* [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

V1 TPHY for SATA doesn't have shared banks if it isn't shared
with PCIe or USB, so make it optional.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 5d9d7f3..d99f79b1 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -1023,9 +1023,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	tphy->dev = dev;
 	platform_set_drvdata(pdev, tphy);
 
-	if (tphy->pdata->version == MTK_PHY_V1) {
+	sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	/* SATA phy of V1 needn't it if not shared with PCIe or USB */
+	if (sif_res && tphy->pdata->version == MTK_PHY_V1) {
 		/* get banks shared by multiple phys */
-		sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		tphy->sif_base = devm_ioremap_resource(dev, sif_res);
 		if (IS_ERR(tphy->sif_base)) {
 			dev_err(dev, "failed to remap sif regs\n");
-- 
1.9.1

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

* [2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

V1 TPHY for SATA doesn't have shared banks if it isn't shared
with PCIe or USB, so make it optional.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 5d9d7f3..d99f79b1 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -1023,9 +1023,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	tphy->dev = dev;
 	platform_set_drvdata(pdev, tphy);
 
-	if (tphy->pdata->version == MTK_PHY_V1) {
+	sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	/* SATA phy of V1 needn't it if not shared with PCIe or USB */
+	if (sif_res && tphy->pdata->version == MTK_PHY_V1) {
 		/* get banks shared by multiple phys */
-		sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		tphy->sif_base = devm_ioremap_resource(dev, sif_res);
 		if (IS_ERR(tphy->sif_base)) {
 			dev_err(dev, "failed to remap sif regs\n");

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

* [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

V1 TPHY for SATA doesn't have shared banks if it isn't shared
with PCIe or USB, so make it optional.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 5d9d7f3..d99f79b1 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -1023,9 +1023,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	tphy->dev = dev;
 	platform_set_drvdata(pdev, tphy);
 
-	if (tphy->pdata->version == MTK_PHY_V1) {
+	sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	/* SATA phy of V1 needn't it if not shared with PCIe or USB */
+	if (sif_res && tphy->pdata->version == MTK_PHY_V1) {
 		/* get banks shared by multiple phys */
-		sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		tphy->sif_base = devm_ioremap_resource(dev, sif_res);
 		if (IS_ERR(tphy->sif_base)) {
 			dev_err(dev, "failed to remap sif regs\n");
-- 
1.9.1

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

* [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel

V1 TPHY for SATA doesn't have shared banks if it isn't shared
with PCIe or USB, so make it optional.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 5d9d7f3..d99f79b1 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -1023,9 +1023,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	tphy->dev = dev;
 	platform_set_drvdata(pdev, tphy);
 
-	if (tphy->pdata->version == MTK_PHY_V1) {
+	sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	/* SATA phy of V1 needn't it if not shared with PCIe or USB */
+	if (sif_res && tphy->pdata->version == MTK_PHY_V1) {
 		/* get banks shared by multiple phys */
-		sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		tphy->sif_base = devm_ioremap_resource(dev, sif_res);
 		if (IS_ERR(tphy->sif_base)) {
 			dev_err(dev, "failed to remap sif regs\n");
-- 
1.9.1

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

* [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 
@@ -995,7 +996,6 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 static int mtk_tphy_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	struct resource res;
 	int port, retval;
 
-	match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
-	if (!match)
-		return -EINVAL;
-
 	tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
 	if (!tphy)
 		return -ENOMEM;
 
-	tphy->pdata = match->data;
+	tphy->pdata = of_device_get_match_data(dev);
+	if (!tphy->pdata)
+		return -EINVAL;
+
 	tphy->nphys = of_get_child_count(np);
 	tphy->phys = devm_kcalloc(dev, tphy->nphys,
 				  sizeof(*tphy->phys), GFP_KERNEL);
-- 
1.9.1

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

* [3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 
@@ -995,7 +996,6 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 static int mtk_tphy_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	struct resource res;
 	int port, retval;
 
-	match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
-	if (!match)
-		return -EINVAL;
-
 	tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
 	if (!tphy)
 		return -ENOMEM;
 
-	tphy->pdata = match->data;
+	tphy->pdata = of_device_get_match_data(dev);
+	if (!tphy->pdata)
+		return -EINVAL;
+
 	tphy->nphys = of_get_child_count(np);
 	tphy->phys = devm_kcalloc(dev, tphy->nphys,
 				  sizeof(*tphy->phys), GFP_KERNEL);

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

* [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 
@@ -995,7 +996,6 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 static int mtk_tphy_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	struct resource res;
 	int port, retval;
 
-	match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
-	if (!match)
-		return -EINVAL;
-
 	tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
 	if (!tphy)
 		return -ENOMEM;
 
-	tphy->pdata = match->data;
+	tphy->pdata = of_device_get_match_data(dev);
+	if (!tphy->pdata)
+		return -EINVAL;
+
 	tphy->nphys = of_get_child_count(np);
 	tphy->phys = devm_kcalloc(dev, tphy->nphys,
 				  sizeof(*tphy->phys), GFP_KERNEL);
-- 
1.9.1

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

* [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
@ 2017-12-07 11:53   ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 
@@ -995,7 +996,6 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 static int mtk_tphy_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	struct resource res;
 	int port, retval;
 
-	match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
-	if (!match)
-		return -EINVAL;
-
 	tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
 	if (!tphy)
 		return -ENOMEM;
 
-	tphy->pdata = match->data;
+	tphy->pdata = of_device_get_match_data(dev);
+	if (!tphy->pdata)
+		return -EINVAL;
+
 	tphy->nphys = of_get_child_count(np);
 	tphy->phys = devm_kcalloc(dev, tphy->nphys,
 				  sizeof(*tphy->phys), GFP_KERNEL);
-- 
1.9.1

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

* Re: [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-28 11:14   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2017-12-28 11:14 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek



On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> When system is running, if usb2 phy is forced to bypass utmi signals,
> all PLL will be turned off, and it can't detect device connection
> anymore, so replace force mode with auto mode which can bypass utmi
> signals automatically if no device attached for normal flow.
> But keep the force mode to fix RX sensitivity degradation issue.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

merged this series.

Thanks
Kishon
> ---
>  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> index fb8aba4..5d9d7f3 100644
> --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* switch to USB function. (system register, force ip into usb mode) */
> +	/* switch to USB function, and enable usb pll */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_FORCE_UART_EN;
> +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
>  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
> @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Enable */
> @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  
>  	tmp = readl(com + U3P_U2PHYDTM0);
>  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> -	tmp |= P2C_FORCE_SUSPENDM;
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Disable */
> @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
>  	writel(tmp, com + U3P_USBPHYACR6);
>  
> -	/* let suspendm=0, set utmi into analog power down */
> -	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_RG_SUSPENDM;
> -	writel(tmp, com + U3P_U2PHYDTM0);
> -	udelay(1);
> -
>  	tmp = readl(com + U3P_U2PHYDTM1);
>  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
>  	tmp |= P2C_RG_SESSEND;
>  	writel(tmp, com + U3P_U2PHYDTM1);
>  
>  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> +		tmp = readl(com + U3P_U2PHYDTM0);
> +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> +		writel(tmp, com + U3P_U2PHYDTM0);
> +
>  		tmp = readl(com + U3D_U2PHYDCR0);
>  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
>  		writel(tmp, com + U3D_U2PHYDCR0);
> 

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

* [1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-28 11:14   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2017-12-28 11:14 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek

On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> When system is running, if usb2 phy is forced to bypass utmi signals,
> all PLL will be turned off, and it can't detect device connection
> anymore, so replace force mode with auto mode which can bypass utmi
> signals automatically if no device attached for normal flow.
> But keep the force mode to fix RX sensitivity degradation issue.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

merged this series.

Thanks
Kishon
> ---
>  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> index fb8aba4..5d9d7f3 100644
> --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* switch to USB function. (system register, force ip into usb mode) */
> +	/* switch to USB function, and enable usb pll */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_FORCE_UART_EN;
> +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
>  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
> @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Enable */
> @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  
>  	tmp = readl(com + U3P_U2PHYDTM0);
>  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> -	tmp |= P2C_FORCE_SUSPENDM;
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Disable */
> @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
>  	writel(tmp, com + U3P_USBPHYACR6);
>  
> -	/* let suspendm=0, set utmi into analog power down */
> -	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_RG_SUSPENDM;
> -	writel(tmp, com + U3P_U2PHYDTM0);
> -	udelay(1);
> -
>  	tmp = readl(com + U3P_U2PHYDTM1);
>  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
>  	tmp |= P2C_RG_SESSEND;
>  	writel(tmp, com + U3P_U2PHYDTM1);
>  
>  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> +		tmp = readl(com + U3P_U2PHYDTM0);
> +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> +		writel(tmp, com + U3P_U2PHYDTM0);
> +
>  		tmp = readl(com + U3D_U2PHYDCR0);
>  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
>  		writel(tmp, com + U3D_U2PHYDCR0);
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-28 11:14   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2017-12-28 11:14 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek



On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> When system is running, if usb2 phy is forced to bypass utmi signals,
> all PLL will be turned off, and it can't detect device connection
> anymore, so replace force mode with auto mode which can bypass utmi
> signals automatically if no device attached for normal flow.
> But keep the force mode to fix RX sensitivity degradation issue.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

merged this series.

Thanks
Kishon
> ---
>  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> index fb8aba4..5d9d7f3 100644
> --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* switch to USB function. (system register, force ip into usb mode) */
> +	/* switch to USB function, and enable usb pll */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_FORCE_UART_EN;
> +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
>  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
> @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Enable */
> @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  
>  	tmp = readl(com + U3P_U2PHYDTM0);
>  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> -	tmp |= P2C_FORCE_SUSPENDM;
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Disable */
> @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
>  	writel(tmp, com + U3P_USBPHYACR6);
>  
> -	/* let suspendm=0, set utmi into analog power down */
> -	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_RG_SUSPENDM;
> -	writel(tmp, com + U3P_U2PHYDTM0);
> -	udelay(1);
> -
>  	tmp = readl(com + U3P_U2PHYDTM1);
>  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
>  	tmp |= P2C_RG_SESSEND;
>  	writel(tmp, com + U3P_U2PHYDTM1);
>  
>  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> +		tmp = readl(com + U3P_U2PHYDTM0);
> +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> +		writel(tmp, com + U3P_U2PHYDTM0);
> +
>  		tmp = readl(com + U3D_U2PHYDCR0);
>  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
>  		writel(tmp, com + U3D_U2PHYDCR0);
> 

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

* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2017-12-28 11:14   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2017-12-28 11:14 UTC (permalink / raw)
  To: linux-arm-kernel



On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> When system is running, if usb2 phy is forced to bypass utmi signals,
> all PLL will be turned off, and it can't detect device connection
> anymore, so replace force mode with auto mode which can bypass utmi
> signals automatically if no device attached for normal flow.
> But keep the force mode to fix RX sensitivity degradation issue.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

merged this series.

Thanks
Kishon
> ---
>  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> index fb8aba4..5d9d7f3 100644
> --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* switch to USB function. (system register, force ip into usb mode) */
> +	/* switch to USB function, and enable usb pll */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_FORCE_UART_EN;
> +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
>  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
> @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
>  	u32 index = instance->index;
>  	u32 tmp;
>  
> -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
>  	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Enable */
> @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  
>  	tmp = readl(com + U3P_U2PHYDTM0);
>  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> -	tmp |= P2C_FORCE_SUSPENDM;
>  	writel(tmp, com + U3P_U2PHYDTM0);
>  
>  	/* OTG Disable */
> @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
>  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
>  	writel(tmp, com + U3P_USBPHYACR6);
>  
> -	/* let suspendm=0, set utmi into analog power down */
> -	tmp = readl(com + U3P_U2PHYDTM0);
> -	tmp &= ~P2C_RG_SUSPENDM;
> -	writel(tmp, com + U3P_U2PHYDTM0);
> -	udelay(1);
> -
>  	tmp = readl(com + U3P_U2PHYDTM1);
>  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
>  	tmp |= P2C_RG_SESSEND;
>  	writel(tmp, com + U3P_U2PHYDTM1);
>  
>  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> +		tmp = readl(com + U3P_U2PHYDTM0);
> +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> +		writel(tmp, com + U3P_U2PHYDTM0);
> +
>  		tmp = readl(com + U3D_U2PHYDCR0);
>  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
>  		writel(tmp, com + U3D_U2PHYDCR0);
> 

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

* Re: [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2018-01-02  1:41     ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2018-01-02  1:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek

On Thu, 2017-12-28 at 16:44 +0530, Kishon Vijay Abraham I wrote:
> 
> On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> > When system is running, if usb2 phy is forced to bypass utmi signals,
> > all PLL will be turned off, and it can't detect device connection
> > anymore, so replace force mode with auto mode which can bypass utmi
> > signals automatically if no device attached for normal flow.
> > But keep the force mode to fix RX sensitivity degradation issue.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> merged this series.
Thanks a lot
> 
> Thanks
> Kishon
> > ---
> >  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
> >  1 file changed, 7 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> > index fb8aba4..5d9d7f3 100644
> > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* switch to USB function. (system register, force ip into usb mode) */
> > +	/* switch to USB function, and enable usb pll */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_FORCE_UART_EN;
> > +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
> >  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> > @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> > -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> > +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Enable */
> > @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> >  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> > -	tmp |= P2C_FORCE_SUSPENDM;
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Disable */
> > @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
> >  	writel(tmp, com + U3P_USBPHYACR6);
> >  
> > -	/* let suspendm=0, set utmi into analog power down */
> > -	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_RG_SUSPENDM;
> > -	writel(tmp, com + U3P_U2PHYDTM0);
> > -	udelay(1);
> > -
> >  	tmp = readl(com + U3P_U2PHYDTM1);
> >  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
> >  	tmp |= P2C_RG_SESSEND;
> >  	writel(tmp, com + U3P_U2PHYDTM1);
> >  
> >  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> > +		tmp = readl(com + U3P_U2PHYDTM0);
> > +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> > +		writel(tmp, com + U3P_U2PHYDTM0);
> > +
> >  		tmp = readl(com + U3D_U2PHYDCR0);
> >  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
> >  		writel(tmp, com + U3D_U2PHYDCR0);
> > 

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

* [1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2018-01-02  1:41     ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2018-01-02  1:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek

On Thu, 2017-12-28 at 16:44 +0530, Kishon Vijay Abraham I wrote:
> 
> On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> > When system is running, if usb2 phy is forced to bypass utmi signals,
> > all PLL will be turned off, and it can't detect device connection
> > anymore, so replace force mode with auto mode which can bypass utmi
> > signals automatically if no device attached for normal flow.
> > But keep the force mode to fix RX sensitivity degradation issue.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> merged this series.
Thanks a lot
> 
> Thanks
> Kishon
> > ---
> >  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
> >  1 file changed, 7 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> > index fb8aba4..5d9d7f3 100644
> > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* switch to USB function. (system register, force ip into usb mode) */
> > +	/* switch to USB function, and enable usb pll */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_FORCE_UART_EN;
> > +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
> >  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> > @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> > -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> > +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Enable */
> > @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> >  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> > -	tmp |= P2C_FORCE_SUSPENDM;
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Disable */
> > @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
> >  	writel(tmp, com + U3P_USBPHYACR6);
> >  
> > -	/* let suspendm=0, set utmi into analog power down */
> > -	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_RG_SUSPENDM;
> > -	writel(tmp, com + U3P_U2PHYDTM0);
> > -	udelay(1);
> > -
> >  	tmp = readl(com + U3P_U2PHYDTM1);
> >  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
> >  	tmp |= P2C_RG_SESSEND;
> >  	writel(tmp, com + U3P_U2PHYDTM1);
> >  
> >  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> > +		tmp = readl(com + U3P_U2PHYDTM0);
> > +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> > +		writel(tmp, com + U3P_U2PHYDTM0);
> > +
> >  		tmp = readl(com + U3D_U2PHYDCR0);
> >  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
> >  		writel(tmp, com + U3D_U2PHYDCR0);
> >
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2018-01-02  1:41     ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2018-01-02  1:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Matthias Brugger, Ryder Lee, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek

On Thu, 2017-12-28 at 16:44 +0530, Kishon Vijay Abraham I wrote:
> 
> On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> > When system is running, if usb2 phy is forced to bypass utmi signals,
> > all PLL will be turned off, and it can't detect device connection
> > anymore, so replace force mode with auto mode which can bypass utmi
> > signals automatically if no device attached for normal flow.
> > But keep the force mode to fix RX sensitivity degradation issue.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> merged this series.
Thanks a lot
> 
> Thanks
> Kishon
> > ---
> >  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
> >  1 file changed, 7 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> > index fb8aba4..5d9d7f3 100644
> > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* switch to USB function. (system register, force ip into usb mode) */
> > +	/* switch to USB function, and enable usb pll */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_FORCE_UART_EN;
> > +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
> >  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> > @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> > -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> > +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Enable */
> > @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> >  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> > -	tmp |= P2C_FORCE_SUSPENDM;
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Disable */
> > @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
> >  	writel(tmp, com + U3P_USBPHYACR6);
> >  
> > -	/* let suspendm=0, set utmi into analog power down */
> > -	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_RG_SUSPENDM;
> > -	writel(tmp, com + U3P_U2PHYDTM0);
> > -	udelay(1);
> > -
> >  	tmp = readl(com + U3P_U2PHYDTM1);
> >  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
> >  	tmp |= P2C_RG_SESSEND;
> >  	writel(tmp, com + U3P_U2PHYDTM1);
> >  
> >  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> > +		tmp = readl(com + U3P_U2PHYDTM0);
> > +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> > +		writel(tmp, com + U3P_U2PHYDTM0);
> > +
> >  		tmp = readl(com + U3D_U2PHYDCR0);
> >  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
> >  		writel(tmp, com + U3D_U2PHYDCR0);
> > 

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

* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
@ 2018-01-02  1:41     ` Chunfeng Yun
  0 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2018-01-02  1:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2017-12-28 at 16:44 +0530, Kishon Vijay Abraham I wrote:
> 
> On Thursday 07 December 2017 05:23 PM, Chunfeng Yun wrote:
> > When system is running, if usb2 phy is forced to bypass utmi signals,
> > all PLL will be turned off, and it can't detect device connection
> > anymore, so replace force mode with auto mode which can bypass utmi
> > signals automatically if no device attached for normal flow.
> > But keep the force mode to fix RX sensitivity degradation issue.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> merged this series.
Thanks a lot
> 
> Thanks
> Kishon
> > ---
> >  drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
> >  1 file changed, 7 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> > index fb8aba4..5d9d7f3 100644
> > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > @@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* switch to USB function. (system register, force ip into usb mode) */
> > +	/* switch to USB function, and enable usb pll */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_FORCE_UART_EN;
> > +	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
> >  	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> > @@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
> >  	u32 index = instance->index;
> >  	u32 tmp;
> >  
> > -	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
> > -	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> > +	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Enable */
> > @@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  
> >  	tmp = readl(com + U3P_U2PHYDTM0);
> >  	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
> > -	tmp |= P2C_FORCE_SUSPENDM;
> >  	writel(tmp, com + U3P_U2PHYDTM0);
> >  
> >  	/* OTG Disable */
> > @@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
> >  	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
> >  	writel(tmp, com + U3P_USBPHYACR6);
> >  
> > -	/* let suspendm=0, set utmi into analog power down */
> > -	tmp = readl(com + U3P_U2PHYDTM0);
> > -	tmp &= ~P2C_RG_SUSPENDM;
> > -	writel(tmp, com + U3P_U2PHYDTM0);
> > -	udelay(1);
> > -
> >  	tmp = readl(com + U3P_U2PHYDTM1);
> >  	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
> >  	tmp |= P2C_RG_SESSEND;
> >  	writel(tmp, com + U3P_U2PHYDTM1);
> >  
> >  	if (tphy->pdata->avoid_rx_sen_degradation && index) {
> > +		tmp = readl(com + U3P_U2PHYDTM0);
> > +		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
> > +		writel(tmp, com + U3P_U2PHYDTM0);
> > +
> >  		tmp = readl(com + U3D_U2PHYDCR0);
> >  		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
> >  		writel(tmp, com + U3D_U2PHYDCR0);
> > 

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

end of thread, other threads:[~2018-01-02  1:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 11:53 [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals Chunfeng Yun
2017-12-07 11:53 ` Chunfeng Yun
2017-12-07 11:53 ` Chunfeng Yun
2017-12-07 11:53 ` [1/3] " Chunfeng Yun
2017-12-07 11:53 ` [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY Chunfeng Yun
2017-12-07 11:53   ` Chunfeng Yun
2017-12-07 11:53   ` Chunfeng Yun
2017-12-07 11:53   ` [2/3] " Chunfeng Yun
2017-12-07 11:53 ` [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data() Chunfeng Yun
2017-12-07 11:53   ` Chunfeng Yun
2017-12-07 11:53   ` Chunfeng Yun
2017-12-07 11:53   ` [3/3] " Chunfeng Yun
2017-12-28 11:14 ` [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals Kishon Vijay Abraham I
2017-12-28 11:14   ` Kishon Vijay Abraham I
2017-12-28 11:14   ` Kishon Vijay Abraham I
2017-12-28 11:14   ` [1/3] " Kishon Vijay Abraham I
2018-01-02  1:41   ` [PATCH 1/3] " Chunfeng Yun
2018-01-02  1:41     ` Chunfeng Yun
2018-01-02  1:41     ` Chunfeng Yun
2018-01-02  1:41     ` [1/3] " Chunfeng Yun

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.