Skip to contentSkip to conversation

phy: for 4.7 -rc cycle

GIT PULL New Kishon Vijay Abraham I 2 participants 8 messages Jun 23, 2016 – Jun 25, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

Please find the 2nd pull request for the -rc cycle. This contains minor fixes in various phy drivers. I've listed the changes in the tag message. Consider merging it in this -rc cyle.

Please let me know if I have to change something.

Thanks
Kishon

The following changes since commit 31b2a32f708bb33b3f35b03ce3d2cb31f7d1e684:

phy: ti-pipe3: Program the DPLL even if it was already locked (2016-06-03 12:06:41 +0530)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.7-rc5

for you to fetch changes up to 04e59a0211ff012ba60c00baca673482570784e9:

phy-sun4i-usb: Fix irq free conditions to match request conditions (2016-06-22 11:33:46 +0530)

----------------------------------------------------------------
phy: for 4.7-rc5

*) Fix in sun4i-usb phy driver to properly handle the return value of
gpiod_to_irq
*) Fix a sparse warning in sun4i-usb phy driver
*) Fix bcm-ns-usb2 phy driver to check the correct variable *) Fix spurious interrupts during VBUS change in rcar-gen3-usb2 phy
driver

----------------------------------------------------------------
Ben Dooks (1):
phy-sun4i-usb: fix missing __iomem *

Dan Carpenter (1):
phy: bcm-ns-usb2: checking the wrong variable

Hans de Goede (1):
phy-sun4i-usb: Fix irq free conditions to match request conditions

Quentin Schulz (1):
phy: phy-sun4i-usb: Fix optional gpios failing probe

Wei Yongjun (1):
phy: rockchip-dp: fix return value check in rockchip_dp_phy_probe()

Yoshihiro Shimoda (1):
phy: rcar-gen3-usb2: fix unexpected repeat interrupts of VBUS change

 drivers/phy/phy-bcm-ns-usb2.c    |    4 ++--
 drivers/phy/phy-rcar-gen3-usb2.c |   14 +-------------
 drivers/phy/phy-rockchip-dp.c    |    2 +-
 drivers/phy/phy-sun4i-usb.c      |   14 +++++++-------
 4 files changed, 11 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/6 phy: phy-sun4i-usb: Fix optional gpios failing probe

From: Quentin Schulz <[email protected]>

The interrupt 0 is not a valid interrupt number. In the event where the retrieval of the vbus-det gpio would return null, the gpiod_to_irq callback would return 0, while the current code makes the assumption that it is a valid interrupt, and would go on calling request_irq. Obviously, this would fail, preventing the driver from probing properly, while the vbus and id gpios are optional.

---
 drivers/phy/phy-sun4i-usb.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/phy-sun4i-usb.c +4 -4
index bae54f7..45f01d6 100644
@@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 
 	data->id_det_irq = gpiod_to_irq(data->id_det_gpio);
 	data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio);
-	if ((data->id_det_gpio && data->id_det_irq < 0) ||
-	    (data->vbus_det_gpio && data->vbus_det_irq < 0))
+	if ((data->id_det_gpio && data->id_det_irq <= 0) ||
+	    (data->vbus_det_gpio && data->vbus_det_irq <= 0))
 		data->phy0_poll = true;
 
-	if (data->id_det_irq >= 0) {
+	if (data->id_det_irq > 0) {
 		ret = devm_request_irq(dev, data->id_det_irq,
 				sun4i_usb_phy0_id_vbus_det_irq,
 				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (data->vbus_det_irq >= 0) {
+	if (data->vbus_det_irq > 0) {
 		ret = devm_request_irq(dev, data->vbus_det_irq,
 				sun4i_usb_phy0_id_vbus_det_irq,
 				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/6 phy-sun4i-usb: fix missing __iomem *

In reply to Kishon Vijay Abraham I

From: Ben Dooks <[email protected]>

Fix the missing __iomem attribute in sun4i_usb_phy_write() function. This fixes the following sparse warnings:

drivers/phy/phy-sun4i-usb.c:178:39: warning: incorrect type in initializer (different address spaces)
drivers/phy/phy-sun4i-usb.c:178:39: expected void *phyctl
drivers/phy/phy-sun4i-usb.c:178:39: got void [noderef] <asn:2>*
drivers/phy/phy-sun4i-usb.c:185:17: warning: incorrect type in argument 2 (different address spaces)
drivers/phy/phy-sun4i-usb.c:185:17: expected void volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:185:17: got void *phyctl
drivers/phy/phy-sun4i-usb.c:189:24: warning: incorrect type in argument 1 (different address spaces)
drivers/phy/phy-sun4i-usb.c:189:24: expected void const volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:189:24: got void *phyctl
drivers/phy/phy-sun4i-usb.c:196:17: warning: incorrect type in argument 2 (different address spaces)
drivers/phy/phy-sun4i-usb.c:196:17: expected void volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:196:17: got void *phyctl
drivers/phy/phy-sun4i-usb.c:199:24: warning: incorrect type in argument 1 (different address spaces)
drivers/phy/phy-sun4i-usb.c:199:24: expected void const volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:199:24: got void *phyctl
drivers/phy/phy-sun4i-usb.c:205:17: warning: incorrect type in argument 2 (different address spaces)
drivers/phy/phy-sun4i-usb.c:205:17: expected void volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:205:17: got void *phyctl
drivers/phy/phy-sun4i-usb.c:208:24: warning: incorrect type in argument 1 (different address spaces)
drivers/phy/phy-sun4i-usb.c:208:24: expected void const volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:208:24: got void *phyctl
drivers/phy/phy-sun4i-usb.c:210:17: warning: incorrect type in argument 2 (different address spaces)
drivers/phy/phy-sun4i-usb.c:210:17: expected void volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:210:17: got void *phyctl
drivers/phy/phy-sun4i-usb.c:212:24: warning: incorrect type in argument 1 (different address spaces)
drivers/phy/phy-sun4i-usb.c:212:24: expected void const volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:212:24: got void *phyctl
drivers/phy/phy-sun4i-usb.c:214:17: warning: incorrect type in argument 2 (different address spaces)
drivers/phy/phy-sun4i-usb.c:214:17: expected void volatile [noderef] <asn:2>*addr
drivers/phy/phy-sun4i-usb.c:214:17: got void *phyctl

---
 drivers/phy/phy-sun4i-usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-sun4i-usb.c +1 -1
index 45f01d6..7390294 100644
@@ -175,7 +175,7 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
 {
 	struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy);
 	u32 temp, usbc_bit = BIT(phy->index * 2);
-	void *phyctl = phy_data->base + phy_data->cfg->phyctl_offset;
+	void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset;
 	int i;
 
 	mutex_lock(&phy_data->mutex);
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/6 phy-sun4i-usb: Fix irq free conditions to match request conditions

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

commit 5cf700ac9d50 ("phy: phy-sun4i-usb: Fix optional gpios failing probe")
changed the condition under which irqs are requested, but omitted matching changes to sun4i_usb_phy_remove(). This commit fixes this.

Fixes 5cf700ac9d50 ("phy: phy-sun4i-usb: Fix optional gpios failing probe")
---
 drivers/phy/phy-sun4i-usb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-sun4i-usb.c +2 -2
index 7390294..de3101f 100644
@@ -514,9 +514,9 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev)
 
 	if (data->vbus_power_nb_registered)
 		power_supply_unreg_notifier(&data->vbus_power_nb);
-	if (data->id_det_irq >= 0)
+	if (data->id_det_irq > 0)
 		devm_free_irq(dev, data->id_det_irq, data);
-	if (data->vbus_det_irq >= 0)
+	if (data->vbus_det_irq > 0)
 		devm_free_irq(dev, data->vbus_det_irq, data);
 
 	cancel_delayed_work_sync(&data->detect);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/6 phy: rockchip-dp: fix return value check in rockchip_dp_phy_probe()

In reply to Kishon Vijay Abraham I

From: Wei Yongjun <[email protected]>

In case of error, the function devm_kzalloc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

---
 drivers/phy/phy-rockchip-dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-rockchip-dp.c +1 -1
index 793ecb6..8b267a7 100644
@@ -90,7 +90,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
-	if (IS_ERR(dp))
+	if (!dp)
 		return -ENOMEM;
 
 	dp->dev = dev;
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/6 phy: bcm-ns-usb2: checking the wrong variable

In reply to Kishon Vijay Abraham I

From: Dan Carpenter <[email protected]>

We intended to test "usb2->phy" here instead of "dev".

Fixes d3feb4067335 ('phy: bcm-ns-usb2: new driver for USB 2.0 PHY on Northstar')
---
 drivers/phy/phy-bcm-ns-usb2.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-bcm-ns-usb2.c +2 -2
index 95ab6b2..58dff80 100644
@@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
 	}
 
 	usb2->phy = devm_phy_create(dev, NULL, &ops);
-	if (IS_ERR(dev))
-		return PTR_ERR(dev);
+	if (IS_ERR(usb2->phy))
+		return PTR_ERR(usb2->phy);
 
 	phy_set_drvdata(usb2->phy, usb2);
 	platform_set_drvdata(pdev, usb2);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 phy: rcar-gen3-usb2: fix unexpected repeat interrupts of VBUS change

In reply to Kishon Vijay Abraham I

From: Yoshihiro Shimoda <[email protected]>

This patch fixes an issue that the driver is possible to cause unexpected repeat interrupts if a board condition is wrong (e.g. even if the ID pin is as function, a board supplies the VBUS.)

The reason why unexpected repeat interrupts happen is:
1) The driver changed the mode to function if it detected the ID pin is high and the VBUS is high.
2) After the driver changed function mode, it disabled the "VBUS control" feature. Then, the VBUS signal will be low.
3) Since the VBUS change interruption happened, the driver checked the ID pin and VBUS.
4) Since VBUS was low, the driver changed the mode to host and enabled the "VBUS control" feature. Then the VBUS signal will be high.
5) Since the VBUS change interruption happened, the driver did 1) above.

So, this patch modified the condition in rcar_gen3_device_recognition() to check the ID pin only.

Fixes 1114e2d (phy: rcar-gen3-usb2: change the mode to OTG on the combined channel)
Cc <[email protected]> # v4.5+
---
 drivers/phy/phy-rcar-gen3-usb2.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/phy/phy-rcar-gen3-usb2.c +1 -13
index 76bb88f..4be3f5d 100644
@@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
 	extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
 }
 
-static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
-{
-	return !!(readl(ch->base + USB2_ADPCTRL) &
-		  USB2_ADPCTRL_OTGSESSVLD);
-}
-
 static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 {
 	return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
@@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 
 static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
 {
-	bool is_host = true;
-
-	/* B-device? */
-	if (rcar_gen3_check_id(ch) && rcar_gen3_check_vbus(ch))
-		is_host = false;
-
-	if (is_host)
+	if (!rcar_gen3_check_id(ch))
 		rcar_gen3_init_for_host(ch);
 	else
 		rcar_gen3_init_for_peri(ch);
Signature · 1 line
1.7.9.5
#7 lore raw
In reply to Kishon Vijay Abraham I
Quoted 11 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the 2nd pull request for the -rc cycle. This contains minor fixes in various phy drivers. I've listed the changes in the tag message. Consider merging it in this -rc cyle.

Please let me know if I have to change something.

Thanks
Kishon

Quoted 7 lines

The following changes since commit 31b2a32f708bb33b3f35b03ce3d2cb31f7d1e684:

phy: ti-pipe3: Program the DPLL even if it was already locked (2016-06-03 12:06:41 +0530)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.7-rc5

Pulled and pushed out, thanks.

greg k-h