Skip to contentSkip to conversation

Revert "usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"

PATCH Superseded Ivan T. Ivanov 3 participants 6 messages Apr 21, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

---
 drivers/usb/host/ehci-msm.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +10 -3
index 9db74ca..275c92e 100644
@@ -88,13 +88,20 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(hcd->regs)) {
-		ret = PTR_ERR(hcd->regs);
+	if (!res) {
+		dev_err(&pdev->dev, "Unable to get memory resource\n");
+		ret = -ENODEV;
 		goto put_hcd;
 	}
+
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
+	hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		dev_err(&pdev->dev, "ioremap failed\n");
+		ret = -ENOMEM;
+		goto put_hcd;
+	}
 
 	/*
 	 * OTG driver takes care of PHY initialization, clock management,

--
1.9.1

Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Ivan T. Ivanov

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

Cc Vivek Gautam <[email protected]>

Since ehci-msm and msm_otg both want to control few USB registers, it makes sense to request ioremap'ed region in both drivers.

I can see a patch in mailing list for adding both ehci-host and otg on msm [1]. But I think it has not yet made it to mainline kernel.

[1] [v3,04/11] ARM: dts: apq8064: Add USB OTG support
https://patches.linaro.org/47067/

Quoted 37 lines

---
drivers/usb/host/ehci-msm.c | 13 ++++++++++---

1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +10 -3
index 9db74ca..275c92e 100644
@@ -88,13 +88,20 @@ static int ehci_msm_probe(struct platform_device
 *pdev)
 }
 
 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- hcd->regs = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(hcd->regs)) {
- ret = PTR_ERR(hcd->regs);
+ if (!res) {
+ dev_err(&pdev->dev, "Unable to get memory resource\n");
+ ret = -ENODEV;
 goto put_hcd;
 }
+
 hcd->rsrc_start = res->start;
 hcd->rsrc_len = resource_size(res);
+ hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
+ if (!hcd->regs) {
+ dev_err(&pdev->dev, "ioremap failed\n");
+ ret = -ENOMEM;
+ goto put_hcd;
+ }
 
 /*

* OTG driver takes care of PHY initialization, clock management,
--
1.9.1

#2 lore raw
Quoted 14 lines · Vivek Gautam

Hi,

Quoted 6 lines · On Tuesday, April 21, 2015 12:41 PM "Ivan T. Ivanov" [email protected]> wrote:

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

Cc Vivek Gautam [email protected]>

Since ehci-msm and msm_otg both want to control few USB registers, it makes sense to request ioremap'ed region in both drivers.

Quoted 8 lines

I can see a patch in mailing list for adding both ehci-host and otg on msm [1].
But I think it has not yet made it to mainline kernel.

[1] [v3,04/11] ARM: dts: apq8064: Add USB OTG support
https://patches.linaro.org/47067/

Thanks. Ivan

maintainer
#3 lore raw
In reply to Ivan T. Ivanov
Quoted 4 lines · Ivan T. Ivanov

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

Um, this patch is in fact _not_ a reversion of 70843f623b58. That commit removed 4 lines of code and added 3. If this were truly a reversion, it would remove 3 lines and add 4. Instead it adds 10.

Please make this a true reversion.

Alan Stern

Quoted 35 lines
---
 drivers/usb/host/ehci-msm.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +10 -4
index 9db74ca..275c92e 100644
@@ -88,13 +88,20 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(hcd->regs)) {
-		ret = PTR_ERR(hcd->regs);
+	if (!res) {
+		dev_err(&pdev->dev, "Unable to get memory resource\n");
+		ret = -ENODEV;
 		goto put_hcd;
 	}
+
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
+	hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		dev_err(&pdev->dev, "ioremap failed\n");
+		ret = -ENOMEM;
+		goto put_hcd;
+	}
 
 	/*
 	 * OTG driver takes care of PHY initialization, clock management,
--
Quoted 4 lines

1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 7 lines · Alan Stern
Quoted 4 lines · Ivan T. Ivanov

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

Quoted 5 lines

Um, this patch is in fact _not_ a reversion of 70843f623b58. That commit removed 4 lines of code and added 3. If this were truly a reversion, it would remove 3 lines and add 4. Instead it adds 10.

Please make this a true reversion.

Right, but I will have to revert 2 commits then, is this ok?

Ivan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#5 lore raw
Quoted 9 lines · Ivan T. Ivanov
Quoted 7 lines · Alan Stern
Quoted 4 lines · Ivan T. Ivanov

This reverts commit 70843f623b58 ("usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap"), because msm_otg and this driver are using same address space to access AHB mode and USB command registers.

Quoted 7 lines
Quoted 5 lines

Um, this patch is in fact _not_ a reversion of 70843f623b58. That commit removed 4 lines of code and added 3. If this were truly a reversion, it would remove 3 lines and add 4. Instead it adds 10.

Please make this a true reversion.

Right, but I will have to revert 2 commits then, is this ok?

Yes, that's okay. I hadn't noticed that e507bf577e5a touched the same code. Just mention them both in the patch description.

Alan Stern