Lines Matching refs:port

61 	struct oz_port *port;
97 /* Holds state information about an hcd port.
163 struct oz_port *port, struct usb_host_config *config,
166 struct oz_port *port);
168 struct oz_port *port,
171 struct oz_port *port, int if_ix);
233 * port is returned, if there is one or -1 otherwise.
397 static void oz_ep_free(struct oz_port *port, struct oz_endpoint *ep)
400 if (port) {
402 struct oz_hcd *ozhcd = port->ozhcd;
405 oz_usb_stream_delete(port->hpd, ep->ep_num);
420 static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
440 spin_lock_bh(&port->ozhcd->hcd_lock);
445 spin_unlock_bh(&port->ozhcd->hcd_lock);
447 oz_complete_urb(port->ozhcd->hcd, urb, 0, 0);
452 ep = port->in_ep[ep_addr];
454 ep = port->out_ep[ep_addr];
455 if (ep && port->hpd) {
466 spin_unlock_bh(&port->ozhcd->hcd_lock);
476 static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
481 spin_lock_bh(&port->ozhcd->hcd_lock);
483 ep = port->in_ep[ep_addr];
485 ep = port->out_ep[ep_addr];
497 spin_unlock_bh(&port->ozhcd->hcd_lock);
506 static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix,
509 struct oz_hcd *ozhcd = port->ozhcd;
515 ep = port->out_ep[ep_ix];
538 static void oz_acquire_port(struct oz_port *port, void *hpd)
540 INIT_LIST_HEAD(&port->isoc_out_ep);
541 INIT_LIST_HEAD(&port->isoc_in_ep);
542 port->flags |= OZ_PORT_F_PRESENT | OZ_PORT_F_CHANGED;
543 port->status |= USB_PORT_STAT_CONNECTION |
546 port->hpd = hpd;
571 * We allocate a port to associate with the PD and create a structure for
572 * endpoint 0. This port is made the connection port.
573 * In the event that one of the other port is already a connection port then
576 * that this port needs configuring and make it the connection port once the
577 * current connection port has been assigned an address. Collisions here are
602 struct oz_port *port = &ozhcd->ports[i];
603 spin_lock(&port->port_lock);
604 if ((port->flags & OZ_PORT_F_PRESENT) == 0) {
605 oz_acquire_port(port, hpd);
606 spin_unlock(&port->port_lock);
609 spin_unlock(&port->port_lock);
642 struct oz_port *port = (struct oz_port *)hport;
648 if (port == 0) {
649 oz_trace("oz_hcd_pd_departed() port = 0\n");
652 ozhcd = port->ozhcd;
655 /* Check if this is the connection port - if so clear it.
659 (port == &ozhcd->ports[ozhcd->conn_port])) {
663 spin_lock(&port->port_lock);
664 port->flags |= OZ_PORT_F_DYING;
665 spin_unlock(&port->port_lock);
668 oz_clean_endpoints_for_config(ozhcd->hcd, port);
669 spin_lock_bh(&port->port_lock);
670 hpd = port->hpd;
671 port->hpd = 0;
672 port->bus_addr = 0xff;
673 port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING);
674 port->flags |= OZ_PORT_F_CHANGED;
675 port->status &= ~USB_PORT_STAT_CONNECTION;
676 port->status |= (USB_PORT_STAT_C_CONNECTION << 16);
680 if (port->out_ep[0]) {
681 ep = port->out_ep[0];
682 port->out_ep[0] = 0;
684 spin_unlock_bh(&port->port_lock);
686 oz_ep_free(port, ep);
697 struct oz_port *port = (struct oz_port *)hport;
698 struct oz_hcd *ozhcd = port->ozhcd;
700 spin_lock_bh(&port->port_lock);
701 port->flags |= OZ_PORT_F_CHANGED;
702 port->status |= USB_PORT_STAT_RESET;
703 port->status |= (USB_PORT_STAT_C_RESET << 16);
704 spin_unlock_bh(&port->port_lock);
705 oz_clean_endpoints_for_config(ozhcd->hcd, port);
714 struct oz_port *port = (struct oz_port *)hport;
721 urb = oz_find_urb_by_id(port, 0, req_id);
738 if (oz_enqueue_ep_urb(port, 0, 0, urb, req_id))
740 else if (oz_usb_get_desc_req(port->hpd, req_id,
744 oz_dequeue_ep_urb(port, 0, 0, urb);
752 oz_complete_urb(port->ozhcd->hcd, urb, 0, 0);
802 static void oz_hcd_complete_set_config(struct oz_port *port, struct urb *urb,
806 struct usb_hcd *hcd = port->ozhcd->hcd;
808 port->config_num = config_num;
809 oz_clean_endpoints_for_config(hcd, port);
810 if (oz_build_endpoints_for_config(hcd, port,
811 &urb->dev->config[port->config_num-1], GFP_ATOMIC)) {
822 static void oz_hcd_complete_set_interface(struct oz_port *port, struct urb *urb,
825 struct usb_hcd *hcd = port->ozhcd->hcd;
831 oz_clean_endpoints_for_interface(hcd, port, if_num);
832 config = &urb->dev->config[port->config_num-1];
834 if (oz_build_endpoints_for_interface(hcd, port, intf,
838 port->iface[if_num].alt = alt;
850 struct oz_port *port = (struct oz_port *)hport;
853 struct usb_hcd *hcd = port->ozhcd->hcd;
859 urb = oz_find_urb_by_id(port, 0, req_id);
872 oz_hcd_complete_set_config(port, urb, rcode,
876 oz_hcd_complete_set_interface(port, urb, rcode,
936 struct oz_port *port = (struct oz_port *)hport;
938 struct oz_hcd *ozhcd = port->ozhcd;
940 ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK];
962 oz_complete_urb(port->ozhcd->hcd, urb, 0, 0);
986 struct oz_port *port = (struct oz_port *)hport;
987 struct oz_hcd *ozhcd = port->ozhcd;
999 list_for_each(e, &port->isoc_out_ep) {
1032 oz_usb_send_isoc(port->hpd, urbl->ep_num, urb);
1034 oz_complete_urb(port->ozhcd->hcd, urb, 0, t);
1039 list_for_each(e, &port->isoc_in_ep) {
1106 if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep))
1116 oz_complete_urb(port->ozhcd->hcd, urb, 0, 0);
1121 ep = port->out_ep[0];
1154 struct oz_port *port,
1157 struct oz_hcd *ozhcd = port->ozhcd;
1178 oz_clean_endpoints_for_interface(hcd, port, if_ix);
1194 if (oz_usb_stream_create(port->hpd, ep_num))
1200 port->in_ep[ep_num] = ep;
1201 port->iface[if_ix].ep_mask |=
1205 list_add_tail(&ep->link, &port->isoc_in_ep);
1209 port->out_ep[ep_num] = ep;
1210 port->iface[if_ix].ep_mask |= (1<<ep_num);
1213 list_add_tail(&ep->link, &port->isoc_out_ep);
1218 if (request_heartbeat && port->hpd)
1219 oz_usb_request_heartbeat(port->hpd);
1227 struct oz_port *port, int if_ix)
1229 struct oz_hcd *ozhcd = port->ozhcd;
1235 if (if_ix >= port->num_iface)
1239 mask = port->iface[if_ix].ep_mask;
1240 port->iface[if_ix].ep_mask = 0;
1245 if ((mask & (1<<i)) && port->out_ep[i]) {
1246 e = &port->out_ep[i]->link;
1247 port->out_ep[i] = 0;
1255 if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) {
1256 e = &port->in_ep[i]->link;
1257 port->in_ep[i] = 0;
1267 oz_ep_free(port, ep);
1274 struct oz_port *port, struct usb_host_config *config,
1277 struct oz_hcd *ozhcd = port->ozhcd;
1288 port->iface = iface;
1289 port->num_iface = num_iface;
1295 if (oz_build_endpoints_for_interface(hcd, port, intf,
1301 oz_clean_endpoints_for_config(hcd, port);
1308 struct oz_port *port)
1310 struct oz_hcd *ozhcd = port->ozhcd;
1313 for (i = 0; i < port->num_iface; i++)
1314 oz_clean_endpoints_for_interface(hcd, port, i);
1316 if (port->iface) {
1318 kfree(port->iface);
1319 port->iface = 0;
1321 port->num_iface = 0;
1327 static void *oz_claim_hpd(struct oz_port *port)
1330 struct oz_hcd *ozhcd = port->ozhcd;
1332 hpd = port->hpd;
1354 struct oz_port *port = 0;
1362 port = &ozhcd->ports[port_ix];
1363 if (((port->flags & OZ_PORT_F_PRESENT) == 0)
1364 || (port->flags & OZ_PORT_F_DYING)) {
1370 /* Store port in private context data.
1372 urb->hcpriv = port;
1384 req_id = port->next_req_id++;
1385 hpd = oz_claim_hpd(port);
1387 oz_trace("Cannot claim port\n");
1428 port->config_num;
1444 port->iface[(u8)windex].alt;
1446 windex, port->iface[(u8)windex].alt);
1461 if (oz_usb_control_req(port->hpd, req_id, setup,
1476 if (oz_enqueue_ep_urb(port, 0, 0, urb, req_id))
1486 oz_usb_request_heartbeat(port->hpd);
1495 struct oz_port *port = urb->hcpriv;
1506 /* Check if there is a device at the port - refuse if not.
1508 if ((port->flags & OZ_PORT_F_PRESENT) == 0)
1514 if (oz_enqueue_ep_urb(port, ep_addr, usb_pipein(urb->pipe),
1563 static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
1570 if (port == 0) {
1571 oz_trace("ERRORERROR: oz_urb_cancel(%p) port is null\n", urb);
1574 ozhcd = port->ozhcd;
1608 urbl = oz_remove_urb(port->in_ep[ix], urb);
1610 urbl = oz_remove_urb(port->out_ep[ix], urb);
1639 oz_urb_cancel(urbl->port, urbl->ep_num, urb);
1713 struct oz_port *port;
1733 port = &ozhcd->ports[port_ix];
1734 if (port == 0)
1736 if ((port->flags & OZ_PORT_F_PRESENT) == 0) {
1741 urb->hcpriv = port;
1816 urbl->port = (struct oz_port *)urb->hcpriv;
1896 struct oz_port *port;
1905 port = &ozhcd->ports[port_id-1];
1958 spin_lock_bh(&port->port_lock);
1959 port->status &= ~clear_bits;
1960 port->status |= set_bits;
1961 spin_unlock_bh(&port->port_lock);
1964 port->status);
1972 struct oz_port *port;
1980 port = &ozhcd->ports[port_id-1];
2034 spin_lock_bh(&port->port_lock);
2035 port->status &= ~clear_bits;
2036 spin_unlock_bh(&port->port_lock);
2154 struct oz_port *port = &ozhcd->ports[i];
2155 port->ozhcd = ozhcd;
2156 port->flags = 0;
2157 port->status = 0;
2158 port->bus_addr = 0xff;
2159 spin_lock_init(&port->port_lock);