]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: usb: Pass EHCI controller pointer to ehci_set_usbmode()
authorSimon Glass <sjg@chromium.org>
Wed, 25 Mar 2015 18:22:23 +0000 (12:22 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 19:47:55 +0000 (21:47 +0200)
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>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/usb/host/ehci-faraday.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-tegra.c
drivers/usb/host/ehci.h

index e38681342ca08b84bfd28dcb14f9bad284c89be4..c64672bf456687dc81c427100c241999e8d00f66 100644 (file)
@@ -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 */
 }
index 4adf98c112fb61f79fd76972de4870b139226476..4de7c81c955ecab8f1bbd14e38cbf2b0a3546166 100644 (file)
@@ -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);
index 17f8be1de9bd2e53ef8ad564b3a3803de8751e77..0e6b60e0d6a88c9fe74a708d8a08901c5338fd84 100644 (file)
@@ -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);
index a00c7e78bdf5fd5217984df8ca17e789ccc61d65..164b3cb4c7925abdc00610c557b51f0873bcf878 100644 (file)
@@ -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);