diff mbox

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

Message ID 1427307788-7496-36-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. This makes the weak functions
use a consistent API.

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

Changes in v2: None

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

Comments

Simon Glass April 7, 2015, 6:44 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. This makes the weak functions
> use a consistent API.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/usb/host/ehci-faraday.c | 2 +-
>  drivers/usb/host/ehci-hcd.c     | 6 +++---
>  drivers/usb/host/ehci-tegra.c   | 5 ++---
>  drivers/usb/host/ehci.h         | 2 +-
>  4 files changed, 7 insertions(+), 8 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 e386813..c64672b 100644
--- a/drivers/usb/host/ehci-faraday.c
+++ b/drivers/usb/host/ehci-faraday.c
@@ -92,7 +92,7 @@  int ehci_hcd_stop(int index)
  * This ehci_set_usbmode() overrides the weak function
  * in "ehci-hcd.c".
  */
-void ehci_set_usbmode(int index)
+void ehci_set_usbmode(struct ehci_ctrl *ctrl)
 {
 	/* nothing needs to be done */
 }
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index e9f58e3..196e23a 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -124,12 +124,12 @@  __weak int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg)
 	return PORTSC_PSPD(reg);
 }
 
-__weak void ehci_set_usbmode(int index)
+__weak void ehci_set_usbmode(struct ehci_ctrl *ctrl)
 {
 	uint32_t tmp;
 	uint32_t *reg_ptr;
 
-	reg_ptr = (uint32_t *)((u8 *)&ehcic[index].hcor->or_usbcmd + USBMODE);
+	reg_ptr = (uint32_t *)((u8 *)&ctrl->hcor->or_usbcmd + USBMODE);
 	tmp = ehci_readl(reg_ptr);
 	tmp |= USBMODE_CM_HC;
 #if defined(CONFIG_EHCI_MMIO_BIG_ENDIAN)
@@ -187,7 +187,7 @@  static int ehci_reset(int index)
 	}
 
 	if (ehci_is_TDI())
-		ehci_set_usbmode(index);
+		ehci_set_usbmode(&ehcic[index]);
 
 #ifdef CONFIG_USB_EHCI_TXFIFO_THRESH
 	cmd = ehci_readl(&ehcic[index].hcor->or_txfilltuning);
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 5060dd1..6054b2b 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -219,13 +219,12 @@  void ehci_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg,
  * This ehci_set_usbmode overrides the weak function ehci_set_usbmode
  * in "ehci-hcd.c".
  */
-void ehci_set_usbmode(int index)
+void ehci_set_usbmode(struct ehci_ctrl *ctrl)
 {
-	struct fdt_usb *config;
+	struct fdt_usb *config = ctrl->priv;
 	struct usb_ctlr *usbctlr;
 	uint32_t tmp;
 
-	config = &port[index];
 	usbctlr = config->reg;
 
 	tmp = ehci_readl(&usbctlr->usb_mode);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index a00c7e7..164b3cb 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -253,7 +253,7 @@  struct ehci_ctrl {
 
 /* Weak functions that drivers can override */
 int ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg);
-void ehci_set_usbmode(int index);
+void ehci_set_usbmode(struct ehci_ctrl *ctrl);
 void ehci_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg,
 			uint32_t *reg);
 uint32_t *ehci_get_portsc_register(struct ehci_hcor *hcor, int port);