mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
usb: musb: make multipoint optional
The multipoint handling under MUSB is optional, and some parts (like the Blackfin processor) do not implement support for it. Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Remy Bohmer <linux@bohmer.net>
This commit is contained in:
parent
df402ba381
commit
8868fd443b
1 changed files with 20 additions and 0 deletions
|
@ -402,11 +402,13 @@ static void config_hub_port(struct usb_device *dev, u8 ep)
|
|||
if (dev->parent->children[chid] == dev)
|
||||
break;
|
||||
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
/* configure the hub address and the port address */
|
||||
writeb(hub, &musbr->tar[ep].txhubaddr);
|
||||
writeb((chid + 1), &musbr->tar[ep].txhubport);
|
||||
writeb(hub, &musbr->tar[ep].rxhubaddr);
|
||||
writeb((chid + 1), &musbr->tar[ep].rxhubport);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -415,7 +417,9 @@ static void config_hub_port(struct usb_device *dev, u8 ep)
|
|||
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len, struct devrequest *setup)
|
||||
{
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
int devnum = usb_pipedevice(pipe);
|
||||
#endif
|
||||
u16 csr;
|
||||
u8 devspeed;
|
||||
|
||||
|
@ -423,9 +427,11 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||
writeb(MUSB_CONTROL_EP, &musbr->index);
|
||||
csr = readw(&musbr->txcsr);
|
||||
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
/* target addr and (for multipoint) hub addr/port */
|
||||
writeb(devnum, &musbr->tar[MUSB_CONTROL_EP].txfuncaddr);
|
||||
writeb(devnum, &musbr->tar[MUSB_CONTROL_EP].rxfuncaddr);
|
||||
#endif
|
||||
|
||||
/* configure the hub address and the port number as required */
|
||||
devspeed = get_dev_speed(dev);
|
||||
|
@ -435,10 +441,12 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||
writeb(devspeed << 6, &musbr->txtype);
|
||||
} else {
|
||||
writeb(musb_cfg.musb_speed << 6, &musbr->txtype);
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
writeb(0, &musbr->tar[MUSB_CONTROL_EP].txhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_CONTROL_EP].txhubport);
|
||||
writeb(0, &musbr->tar[MUSB_CONTROL_EP].rxhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_CONTROL_EP].rxhubport);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Control transfer setup phase */
|
||||
|
@ -497,7 +505,9 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
|
|||
{
|
||||
int dir_out = usb_pipeout(pipe);
|
||||
int ep = usb_pipeendpoint(pipe);
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
int devnum = usb_pipedevice(pipe);
|
||||
#endif
|
||||
u8 type;
|
||||
u16 csr;
|
||||
u32 txlen = 0;
|
||||
|
@ -507,11 +517,13 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
|
|||
/* select bulk endpoint */
|
||||
writeb(MUSB_BULK_EP, &musbr->index);
|
||||
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
/* write the address of the device */
|
||||
if (dir_out)
|
||||
writeb(devnum, &musbr->tar[MUSB_BULK_EP].txfuncaddr);
|
||||
else
|
||||
writeb(devnum, &musbr->tar[MUSB_BULK_EP].rxfuncaddr);
|
||||
#endif
|
||||
|
||||
/* configure the hub address and the port number as required */
|
||||
devspeed = get_dev_speed(dev);
|
||||
|
@ -524,6 +536,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
|
|||
*/
|
||||
config_hub_port(dev, MUSB_BULK_EP);
|
||||
} else {
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
if (dir_out) {
|
||||
writeb(0, &musbr->tar[MUSB_BULK_EP].txhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_BULK_EP].txhubport);
|
||||
|
@ -531,6 +544,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
|
|||
writeb(0, &musbr->tar[MUSB_BULK_EP].rxhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_BULK_EP].rxhubport);
|
||||
}
|
||||
#endif
|
||||
devspeed = musb_cfg.musb_speed;
|
||||
}
|
||||
|
||||
|
@ -696,7 +710,9 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
|
|||
{
|
||||
int dir_out = usb_pipeout(pipe);
|
||||
int ep = usb_pipeendpoint(pipe);
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
int devnum = usb_pipedevice(pipe);
|
||||
#endif
|
||||
u8 type;
|
||||
u16 csr;
|
||||
u32 txlen = 0;
|
||||
|
@ -706,11 +722,13 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
|
|||
/* select interrupt endpoint */
|
||||
writeb(MUSB_INTR_EP, &musbr->index);
|
||||
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
/* write the address of the device */
|
||||
if (dir_out)
|
||||
writeb(devnum, &musbr->tar[MUSB_INTR_EP].txfuncaddr);
|
||||
else
|
||||
writeb(devnum, &musbr->tar[MUSB_INTR_EP].rxfuncaddr);
|
||||
#endif
|
||||
|
||||
/* configure the hub address and the port number as required */
|
||||
devspeed = get_dev_speed(dev);
|
||||
|
@ -723,6 +741,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
|
|||
*/
|
||||
config_hub_port(dev, MUSB_INTR_EP);
|
||||
} else {
|
||||
#ifndef MUSB_NO_MULTIPOINT
|
||||
if (dir_out) {
|
||||
writeb(0, &musbr->tar[MUSB_INTR_EP].txhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_INTR_EP].txhubport);
|
||||
|
@ -730,6 +749,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
|
|||
writeb(0, &musbr->tar[MUSB_INTR_EP].rxhubaddr);
|
||||
writeb(0, &musbr->tar[MUSB_INTR_EP].rxhubport);
|
||||
}
|
||||
#endif
|
||||
devspeed = musb_cfg.musb_speed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue