Skip to content

Commit 0e8749e

Browse files
mat-cgregkh
authored andcommitted
EHCI : introduce a common ehci_setup
commit 2093c6b upstream. This allow to clean duplicated code in most of SOC driver. Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent a717f83 commit 0e8749e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎drivers/usb/host/ehci-hcd.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,35 @@ static int ehci_run (struct usb_hcd *hcd)
768768
return 0;
769769
}
770770

771+
static int __maybe_unused ehci_setup (struct usb_hcd *hcd)
772+
{
773+
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
774+
int retval;
775+
776+
ehci->regs = (void __iomem *)ehci->caps +
777+
HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
778+
dbg_hcs_params(ehci, "reset");
779+
dbg_hcc_params(ehci, "reset");
780+
781+
/* cache this readonly data; minimize chip reads */
782+
ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
783+
784+
ehci->sbrn = HCD_USB2;
785+
786+
retval = ehci_halt(ehci);
787+
if (retval)
788+
return retval;
789+
790+
/* data structure init */
791+
retval = ehci_init(hcd);
792+
if (retval)
793+
return retval;
794+
795+
ehci_reset(ehci);
796+
797+
return 0;
798+
}
799+
771800
/*-------------------------------------------------------------------------*/
772801

773802
static irqreturn_t ehci_irq (struct usb_hcd *hcd)

0 commit comments

Comments
 (0)