Skip to contentSkip to conversation

usb: ehci-msm: Don't ioremap configuration space exclusively

PATCH In review Ivan T. Ivanov 3 participants 8 messages Apr 9, 2015 – Apr 20, 2015

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

PATCH 1/1 usb: ehci-msm: Don't ioremap configuration space exclusively

This allow same IO space to be shared between HCD and Device controller driver. Which can be loaded simultaneously and started/stopped on demand by USB OTG PHY driver.

---
 drivers/usb/host/ehci-msm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +7 -3
index 9db74ca..f059e15 100644
@@ -88,13 +88,17 @@ 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 (!res)
+		return -ENODEV;
+
+	hcd->rsrc_start = res->start;
+	hcd->rsrc_len = resource_size(res);
+
+	hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
 	if (IS_ERR(hcd->regs)) {
 		ret = PTR_ERR(hcd->regs);
 		goto put_hcd;
 	}
-	hcd->rsrc_start = res->start;
-	hcd->rsrc_len = resource_size(res);
 
 	/*
 	 * OTG driver takes care of PHY initialization, clock management,

--
1.9.1

maintainer
#1 lore raw
Quoted 3 lines · Ivan T. Ivanov

This allow same IO space to be shared between HCD and Device controller driver. Which can be loaded simultaneously and started/stopped on demand by USB OTG PHY driver.

You really should CC the person who wrote the code you are changing. This is almost exactly the same as reverting commit 70843f623b58 (usb:
host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap).

Vivek, what do you think?

Alan Stern

Quoted 35 lines
---
 drivers/usb/host/ehci-msm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +7 -4
index 9db74ca..f059e15 100644
@@ -88,13 +88,17 @@ 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 (!res)
+		return -ENODEV;
+
+	hcd->rsrc_start = res->start;
+	hcd->rsrc_len = resource_size(res);
+
+	hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
 	if (IS_ERR(hcd->regs)) {
 		ret = PTR_ERR(hcd->regs);
 		goto put_hcd;
 	}
-	hcd->rsrc_start = res->start;
-	hcd->rsrc_len = resource_size(res);
 
 	/*
 	 * OTG driver takes care of PHY initialization, clock management,
--

1.9.1

#2 lore raw
Quoted 5 lines · Alan Stern
Quoted 3 lines · Ivan T. Ivanov

This allow same IO space to be shared between HCD and Device controller driver. Which can be loaded simultaneously and started/stopped on demand by USB OTG PHY driver.

Are you sure ?
Will ehci controller registers overlap with the Device controller's register region ?

Quoted 6 lines

You really should CC the person who wrote the code you are changing. This is almost exactly the same as reverting commit 70843f623b58 (usb:
host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap).

Vivek, what do you think?

Yea, the idea was to prevent any unintentional overlapping of ioremapped regions by two device drivers.

I still believe that the register region used by ehci-msm may not be overlapping with the device-controller's register memory region.

Quoted 44 lines

Alan Stern

Quoted 31 lines
---
 drivers/usb/host/ehci-msm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-msm.c +7 -4
index 9db74ca..f059e15 100644
@@ -88,13 +88,17 @@ 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 (!res)
+             return -ENODEV;
+
+     hcd->rsrc_start = res->start;
+     hcd->rsrc_len = resource_size(res);
+
+     hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
      if (IS_ERR(hcd->regs)) {
              ret = PTR_ERR(hcd->regs);
              goto put_hcd;
      }
-     hcd->rsrc_start = res->start;
-     hcd->rsrc_len = resource_size(res);
 
      /*
       * 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-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 4 lines
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India
#3 lore raw

Hi,

Quoted 8 lines · Vivek Gautam
Quoted 5 lines · Alan Stern
Quoted 3 lines · Ivan T. Ivanov

This allow same IO space to be shared between HCD and Device controller driver. Which can be loaded simultaneously and started/stopped on demand by USB OTG PHY driver.

Are you sure ?

No.

Quoted 3 lines

Will ehci controller registers overlap with the Device controller's register region ?

Well, not exactly DC vs HC region, but at least USB_AHBBURST, USB_AHBMODE, USB_USBMODE are used by both OTG phy-msm-usb and this ehci-msm driver. And this is broken right now.

Ivan

#4 lore raw
Quoted 14 lines · Ivan T. Ivanov

Hi,

Quoted 8 lines · Vivek Gautam
Quoted 5 lines · Alan Stern
Quoted 3 lines · Ivan T. Ivanov

This allow same IO space to be shared between HCD and Device controller driver. Which can be loaded simultaneously and started/stopped on demand by USB OTG PHY driver.

Are you sure ?

No.

Quoted 7 lines
Quoted 3 lines

Will ehci controller registers overlap with the Device controller's register region ?

Well, not exactly DC vs HC region, but at least USB_AHBBURST, USB_AHBMODE, USB_USBMODE are used by both OTG phy-msm-usb and this ehci-msm driver. And this is broken right now.

Hi Alan,

Perhaps I have to resend this patch with updated commit message? Are they any other obstacles?

Regards,
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 4 lines · Ivan T. Ivanov

Hi Alan,

Perhaps I have to resend this patch with updated commit message? Are they any other obstacles?

Instead of submitting this new patch, would it be okay to revert commit 70843f623b58? That would be simpler.

Also, I'd like to get an Acked-by from Vivek before accepting this.

Alan Stern

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

Hi Alan,

Perhaps I have to resend this patch with updated commit message? Are they any other obstacles?

Instead of submitting this new patch, would it be okay to revert commit 70843f623b58? That would be simpler.

Sure, wherever is working better for you.

Quoted 5 lines

Also, I'd like to get an Acked-by from Vivek before accepting this.

Alan Stern

Do you expect something from my side?

Thanks,
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
#7 lore raw
Quoted 15 lines · Ivan T. Ivanov
Quoted 9 lines · Alan Stern
Quoted 4 lines · Ivan T. Ivanov

Hi Alan,

Perhaps I have to resend this patch with updated commit message? Are they any other obstacles?

Instead of submitting this new patch, would it be okay to revert commit 70843f623b58? That would be simpler.

Sure, wherever is working better for you.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

Also, I'd like to get an Acked-by from Vivek before accepting this.

Alan Stern

Do you expect something from my side?

Just submit a new version of the patch (reverting that commit) and CC:
Vivek on the submission.

Alan Stern