mirror of
https://xff.cz/git/u-boot/
synced 2025-10-27 00:24:09 +01:00
tegra20: port to new ehci interface
EHCI interface now supports more than one controller. Wire up our usb functions to use this new interface. Signed-off-by: Lucas Stach <dev@lynxeye.de>
This commit is contained in:
@@ -77,7 +77,6 @@ struct fdt_usb {
|
|||||||
|
|
||||||
static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */
|
static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */
|
||||||
static unsigned port_count; /* Number of available ports */
|
static unsigned port_count; /* Number of available ports */
|
||||||
static int port_current; /* Current port (-1 = none) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This table has USB timing parameters for each Oscillator frequency we
|
* This table has USB timing parameters for each Oscillator frequency we
|
||||||
@@ -351,30 +350,25 @@ static int add_port(struct fdt_usb *config, const u32 timing[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor)
|
int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
|
||||||
{
|
{
|
||||||
struct usb_ctlr *usbctlr;
|
struct usb_ctlr *usbctlr;
|
||||||
|
|
||||||
if (portnum >= port_count)
|
if (portnum >= port_count)
|
||||||
return -1;
|
return -1;
|
||||||
tegrausb_stop_port();
|
|
||||||
set_host_mode(&port[portnum]);
|
set_host_mode(&port[portnum]);
|
||||||
|
|
||||||
usbctlr = port[portnum].reg;
|
usbctlr = port[portnum].reg;
|
||||||
*hccr = (u32)&usbctlr->cap_length;
|
*hccr = (u32)&usbctlr->cap_length;
|
||||||
*hcor = (u32)&usbctlr->usb_cmd;
|
*hcor = (u32)&usbctlr->usb_cmd;
|
||||||
port_current = portnum;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tegrausb_stop_port(void)
|
int tegrausb_stop_port(int portnum)
|
||||||
{
|
{
|
||||||
struct usb_ctlr *usbctlr;
|
struct usb_ctlr *usbctlr;
|
||||||
|
|
||||||
if (port_current == -1)
|
usbctlr = port[portnum].reg;
|
||||||
return -1;
|
|
||||||
|
|
||||||
usbctlr = port[port_current].reg;
|
|
||||||
|
|
||||||
/* Stop controller */
|
/* Stop controller */
|
||||||
writel(0, &usbctlr->usb_cmd);
|
writel(0, &usbctlr->usb_cmd);
|
||||||
@@ -383,7 +377,7 @@ int tegrausb_stop_port(void)
|
|||||||
/* Initiate controller reset */
|
/* Initiate controller reset */
|
||||||
writel(2, &usbctlr->usb_cmd);
|
writel(2, &usbctlr->usb_cmd);
|
||||||
udelay(1000);
|
udelay(1000);
|
||||||
port_current = -1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +453,6 @@ int board_usb_init(const void *blob)
|
|||||||
return -1;
|
return -1;
|
||||||
set_host_mode(&config);
|
set_host_mode(&config);
|
||||||
}
|
}
|
||||||
port_current = -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,13 +240,13 @@ int board_usb_init(const void *blob);
|
|||||||
* @param hcor returns start address of EHCI HCOR registers
|
* @param hcor returns start address of EHCI HCOR registers
|
||||||
* @return 0 if ok, -1 on error (generally invalid port number)
|
* @return 0 if ok, -1 on error (generally invalid port number)
|
||||||
*/
|
*/
|
||||||
int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor);
|
int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the current port
|
* Stop the current port
|
||||||
*
|
*
|
||||||
* @return 0 if ok, -1 if no port was active
|
* @return 0 if ok, -1 if no port was active
|
||||||
*/
|
*/
|
||||||
int tegrausb_stop_port(void);
|
int tegrausb_stop_port(int portnum);
|
||||||
|
|
||||||
#endif /* _TEGRA_USB_H_ */
|
#endif /* _TEGRA_USB_H_ */
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
|
|||||||
* Select the first port, as we don't have a way of selecting others
|
* Select the first port, as we don't have a way of selecting others
|
||||||
* yet
|
* yet
|
||||||
*/
|
*/
|
||||||
if (tegrausb_start_port(0, &our_hccr, &our_hcor))
|
if (tegrausb_start_port(index, &our_hccr, &our_hcor))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*hccr = (struct ehci_hccr *)our_hccr;
|
*hccr = (struct ehci_hccr *)our_hccr;
|
||||||
@@ -72,6 +72,5 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
|
|||||||
*/
|
*/
|
||||||
int ehci_hcd_stop(int index)
|
int ehci_hcd_stop(int index)
|
||||||
{
|
{
|
||||||
tegrausb_stop_port();
|
return tegrausb_stop_port(index);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user