1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Merge from NetBSD:

Pave the way for USB2, by replacing 'lowspeed' with 'speed', so
that it can take the values USB_SPEED_LOW, USB_SPEED_FULL or in
time USB_SPEED_HIGH.
This commit is contained in:
Josef Karthauser 2002-02-16 00:51:26 +00:00
parent c67fd26e98
commit 4d0649fbad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90714
5 changed files with 21 additions and 16 deletions

View File

@ -1751,7 +1751,8 @@ ohci_open(usbd_pipe_handle pipe)
OHCI_ED_SET_FA(addr) |
OHCI_ED_SET_EN(ed->bEndpointAddress) |
OHCI_ED_DIR_TD |
(dev->lowspeed ? OHCI_ED_SPEED : 0) | fmt |
(dev->speed == USB_SPEED_LOW ? OHCI_ED_SPEED : 0) |
fmt |
OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize)));
sed->ed.ed_headp = sed->ed.ed_tailp = htole32(tdphys);
@ -2171,6 +2172,7 @@ ohci_root_ctrl_start(usbd_xfer_handle xfer)
OWRITE4(sc, port, UPS_OVERCURRENT_INDICATOR);
break;
case UHF_PORT_POWER:
/* Yes, writing to the LOW_SPEED bit clears power. */
OWRITE4(sc, port, UPS_LOW_SPEED);
break;
case UHF_C_PORT_CONNECTION:

View File

@ -1634,9 +1634,9 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
int addr = upipe->pipe.device->address;
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%d ls=%d "
DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%d speed=%d "
"flags=0x%x\n", addr, UE_GET_ADDR(endpt), len,
upipe->pipe.device->lowspeed, flags));
upipe->pipe.device->speed, flags));
maxp = UGETW(upipe->pipe.endpoint->edesc->wMaxPacketSize);
if (maxp == 0) {
printf("uhci_alloc_std_chain: maxp=0\n");
@ -1659,7 +1659,7 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
lastlink = UHCI_PTR_T;
ntd--;
status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(3) | UHCI_TD_ACTIVE);
if (upipe->pipe.device->lowspeed)
if (upipe->pipe.device->speed == USB_SPEED_LOW)
status |= UHCI_TD_LS;
if (flags & USBD_SHORT_XFER_OK)
status |= UHCI_TD_SPD;
@ -2100,7 +2100,7 @@ uhci_device_request(usbd_xfer_handle xfer)
UGETW(req->wIndex), UGETW(req->wLength),
addr, endpt));
ls = dev->lowspeed ? UHCI_TD_LS : 0;
ls = dev->speed == USB_SPEED_LOW ? UHCI_TD_LS : 0;
isread = req->bmRequestType & UT_READ;
len = UGETW(req->wLength);
@ -2167,7 +2167,7 @@ uhci_device_request(usbd_xfer_handle xfer)
sqh->intr_info = ii;
s = splusb();
if (dev->lowspeed)
if (dev->speed == USB_SPEED_LOW)
uhci_add_ls_ctrl(sc, sqh);
else
uhci_add_hs_ctrl(sc, sqh);
@ -2590,7 +2590,7 @@ uhci_device_ctrl_done(usbd_xfer_handle xfer)
LIST_REMOVE(ii, list); /* remove from active list */
if (upipe->pipe.device->lowspeed)
if (upipe->pipe.device->speed == USB_SPEED_LOW)
uhci_remove_ls_ctrl(sc, upipe->u.ctl.sqh);
else
uhci_remove_hs_ctrl(sc, upipe->u.ctl.sqh);

View File

@ -597,7 +597,10 @@ struct usb_device_info {
u_int8_t subclass;
u_int8_t protocol;
u_int8_t config;
u_int8_t lowspeed;
u_int8_t speed;
#define USB_SPEED_LOW 1
#define USB_SPEED_FULL 2
#define USB_SPEED_HIGH 3
int power; /* power consumption in mA, 0 if selfpowered */
int nports;
char devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];

View File

@ -905,7 +905,7 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev,
*/
usbd_status
usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
int lowspeed, int port, struct usbd_port *up)
int speed, int port, struct usbd_port *up)
{
usbd_device_handle dev;
usb_device_descriptor_t *dd;
@ -913,8 +913,8 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
int addr;
int i;
DPRINTF(("usbd_new_device bus=%p port=%d depth=%d lowspeed=%d\n",
bus, port, depth, lowspeed));
DPRINTF(("usbd_new_device bus=%p port=%d depth=%d speed=%d\n",
bus, port, depth, speed));
addr = usbd_getnewaddr(bus);
if (addr < 0) {
printf("%s: No free USB addresses, new device ignored.\n",
@ -943,10 +943,10 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
dev->quirks = &usbd_no_quirk;
dev->address = USB_START_ADDR;
dev->ddesc.bMaxPacketSize = 0;
dev->lowspeed = lowspeed != 0;
dev->depth = depth;
dev->powersrc = up;
dev->langid = USBD_NOLANG;
dev->speed = speed;
dev->cookie.cookie = ++usb_cookie_no;
/* Establish the default pipe. */
@ -975,10 +975,10 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
}
DPRINTF(("usbd_new_device: adding unit addr=%d, rev=%02x, class=%d, "
"subclass=%d, protocol=%d, maxpacket=%d, len=%d, ls=%d\n",
"subclass=%d, protocol=%d, maxpacket=%d, len=%d, speed=%d\n",
addr,UGETW(dd->bcdUSB), dd->bDeviceClass, dd->bDeviceSubClass,
dd->bDeviceProtocol, dd->bMaxPacketSize, dd->bLength,
dev->lowspeed));
dev->speed));
if (dd->bDescriptorType != UDESC_DEVICE) {
/* Illegal device descriptor */
@ -1169,7 +1169,7 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di,
di->protocol = dev->ddesc.bDeviceProtocol;
di->config = dev->config;
di->power = dev->self_powered ? 0 : dev->power;
di->lowspeed = dev->lowspeed;
di->speed = dev->speed;
if (dev->subdevs != NULL) {
for (i = 0; dev->subdevs[i] &&

View File

@ -123,7 +123,7 @@ struct usbd_device {
u_int8_t address; /* device addess */
u_int8_t config; /* current configuration # */
u_int8_t depth; /* distance from root hub */
u_int8_t lowspeed; /* lowspeed flag */
u_int8_t speed; /* low/full/high speed */
u_int8_t self_powered; /* flag for self powered */
u_int16_t power; /* mA the device uses */
int16_t langid; /* language for strings */