diff mbox

[U-Boot,v2,30/80] dm: usb: Pass EHCI controller pointer to ehci_get_port_speed()

Message ID 1427307788-7496-31-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass March 25, 2015, 6:22 p.m. UTC
Adjust this function so that it is passed an EHCI controller pointer so that
implementations can look up their controller.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/usb/host/ehci-faraday.c | 5 +++--
 drivers/usb/host/ehci-hcd.c     | 4 ++--
 drivers/usb/host/ehci-tegra.c   | 5 +++--
 drivers/usb/host/ehci.h         | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

Comments

Simon Glass April 7, 2015, 6:43 p.m. UTC | #1
On 25 March 2015 at 12:22, Simon Glass <sjg@chromium.org> wrote:
> Adjust this function so that it is passed an EHCI controller pointer so that
> implementations can look up their controller.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/usb/host/ehci-faraday.c | 5 +++--
>  drivers/usb/host/ehci-hcd.c     | 4 ++--
>  drivers/usb/host/ehci-tegra.c   | 5 +++--
>  drivers/usb/host/ehci.h         | 2 +-
>  4 files changed, 9 insertions(+), 7 deletions(-)

Applied to u-boot-dm/next.
diff mbox

Patch

diff --git a/drivers/usb/host/ehci-faraday.c b/drivers/usb/host/ehci-faraday.c
index 3b761bc..e386813 100644
--- a/drivers/usb/host/ehci-faraday.c
+++ b/drivers/usb/host/ehci-faraday.c
@@ -101,11 +101,12 @@  void ehci_set_usbmode(int index)
  * This ehci_get_port_speed() overrides the weak function
  * in "ehci-hcd.c".
  */
-int ehci_get_port_speed(struct ehci_hcor *hcor, uint32_t reg)
+int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg)
 {
 	int spd, ret = PORTSC_PSPD_HS;
-	union ehci_faraday_regs *regs = (void __iomem *)((ulong)hcor - 0x10);
+	union ehci_faraday_regs *regs;
 
+	ret = (void __iomem *)((ulong)ctrl->hcor - 0x10);
 	if (ehci_is_fotg2xx(regs))
 		spd = OTGCSR_SPD(readl(&regs->otg.otgcsr));
 	else
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 10a0671..fed3942 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -119,7 +119,7 @@  static struct descriptor {
 #define ehci_is_TDI()	(0)
 #endif
 
-__weak int ehci_get_port_speed(struct ehci_hcor *hcor, uint32_t reg)
+__weak int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg)
 {
 	return PORTSC_PSPD(reg);
 }
@@ -781,7 +781,7 @@  ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 			tmpbuf[1] |= USB_PORT_STAT_POWER >> 8;
 
 		if (ehci_is_TDI()) {
-			switch (ehci_get_port_speed(ctrl->hcor, reg)) {
+			switch (ehci_get_port_speed(ctrl, reg)) {
 			case PORTSC_PSPD_FS:
 				break;
 			case PORTSC_PSPD_LS:
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index b5ad1e3..0831fe9 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -225,13 +225,14 @@  void ehci_set_usbmode(int index)
  * This ehci_get_port_speed overrides the weak function ehci_get_port_speed
  * in "ehci-hcd.c".
  */
-int ehci_get_port_speed(struct ehci_hcor *hcor, uint32_t reg)
+int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg)
 {
 	uint32_t tmp;
 	uint32_t *reg_ptr;
 
 	if (controller->has_hostpc) {
-		reg_ptr = (uint32_t *)((u8 *)&hcor->or_usbcmd + HOSTPC1_DEVLC);
+		reg_ptr = (uint32_t *)((u8 *)&ctrl->hcor->or_usbcmd +
+				HOSTPC1_DEVLC);
 		tmp = ehci_readl(reg_ptr);
 		return HOSTPC1_PSPD(tmp);
 	} else
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 3e5427a..ec4d6b0 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -251,7 +251,7 @@  struct ehci_ctrl {
 };
 
 /* Weak functions that drivers can override */
-int ehci_get_port_speed(struct ehci_hcor *hcor, uint32_t reg);
+int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg);
 void ehci_set_usbmode(int index);
 void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg);
 uint32_t *ehci_get_portsc_register(struct ehci_hcor *hcor, int port);