Lines Matching refs:dev

96 nc_vendor_read(struct usbnet *dev, u8 req, u8 regnum, u16 *retval_ptr)  in nc_vendor_read()  argument
98 int status = usbnet_read_cmd(dev, req, in nc_vendor_read()
111 nc_register_read(struct usbnet *dev, u8 regnum, u16 *retval_ptr) in nc_register_read() argument
113 return nc_vendor_read(dev, REQUEST_REGISTER, regnum, retval_ptr); in nc_register_read()
117 nc_vendor_write(struct usbnet *dev, u8 req, u8 regnum, u16 value) in nc_vendor_write() argument
119 usbnet_write_cmd(dev, req, in nc_vendor_write()
125 nc_register_write(struct usbnet *dev, u8 regnum, u16 value) in nc_register_write() argument
127 nc_vendor_write(dev, REQUEST_REGISTER, regnum, value); in nc_register_write()
132 static void nc_dump_registers(struct usbnet *dev)
140 netdev_dbg(dev->net, "registers:\n");
150 retval = nc_register_read(dev, reg, vp);
152 netdev_dbg(dev->net, "reg [0x%x] ==> error %d\n",
155 netdev_dbg(dev->net, "reg [0x%x] = 0x%x\n", reg, *vp);
181 static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl) in nc_dump_usbctl() argument
183 netif_dbg(dev, link, dev->net, in nc_dump_usbctl()
185 dev->udev->bus->bus_name, dev->udev->devpath, in nc_dump_usbctl()
224 static inline void nc_dump_status(struct usbnet *dev, u16 status) in nc_dump_status() argument
226 netif_dbg(dev, link, dev->net, in nc_dump_status()
228 dev->udev->bus->bus_name, dev->udev->devpath, in nc_dump_status()
259 static int net1080_reset(struct usbnet *dev) in net1080_reset() argument
267 if ((retval = nc_register_read(dev, REG_STATUS, &vp)) < 0) { in net1080_reset()
268 netdev_dbg(dev->net, "can't read %s-%s status: %d\n", in net1080_reset()
269 dev->udev->bus->bus_name, dev->udev->devpath, retval); in net1080_reset()
273 nc_dump_status(dev, status); in net1080_reset()
275 if ((retval = nc_register_read(dev, REG_USBCTL, &vp)) < 0) { in net1080_reset()
276 netdev_dbg(dev->net, "can't read USBCTL, %d\n", retval); in net1080_reset()
280 nc_dump_usbctl(dev, usbctl); in net1080_reset()
282 nc_register_write(dev, REG_USBCTL, in net1080_reset()
285 if ((retval = nc_register_read(dev, REG_TTL, &vp)) < 0) { in net1080_reset()
286 netdev_dbg(dev->net, "can't read TTL, %d\n", retval); in net1080_reset()
291 nc_register_write(dev, REG_TTL, in net1080_reset()
293 netdev_dbg(dev->net, "assigned TTL, %d ms\n", NC_READ_TTL_MS); in net1080_reset()
295 netif_info(dev, link, dev->net, "port %c, peer %sconnected\n", in net1080_reset()
304 static int net1080_check_connect(struct usbnet *dev) in net1080_check_connect() argument
310 retval = nc_register_read(dev, REG_STATUS, &vp); in net1080_check_connect()
313 netdev_dbg(dev->net, "net1080_check_conn read - %d\n", retval); in net1080_check_connect()
321 static void nc_ensure_sync(struct usbnet *dev) in nc_ensure_sync() argument
323 if (++dev->frame_errors <= 5) in nc_ensure_sync()
326 if (usbnet_write_cmd_async(dev, REQUEST_REGISTER, in nc_ensure_sync()
334 netif_dbg(dev, rx_err, dev->net, in nc_ensure_sync()
336 dev->frame_errors = 0; in nc_ensure_sync()
339 static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) in net1080_rx_fixup() argument
346 if (skb->len < dev->net->hard_header_len) in net1080_rx_fixup()
350 netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", in net1080_rx_fixup()
351 skb->len, dev->net->hard_header_len, dev->hard_mtu, in net1080_rx_fixup()
352 dev->net->mtu); in net1080_rx_fixup()
353 dev->net->stats.rx_frame_errors++; in net1080_rx_fixup()
354 nc_ensure_sync(dev); in net1080_rx_fixup()
362 dev->net->stats.rx_frame_errors++; in net1080_rx_fixup()
363 netdev_dbg(dev->net, "packet too big, %d\n", packet_len); in net1080_rx_fixup()
364 nc_ensure_sync(dev); in net1080_rx_fixup()
367 dev->net->stats.rx_frame_errors++; in net1080_rx_fixup()
368 netdev_dbg(dev->net, "header too short, %d\n", hdr_len); in net1080_rx_fixup()
369 nc_ensure_sync(dev); in net1080_rx_fixup()
373 netdev_dbg(dev->net, "header OOB, %d bytes\n", hdr_len - MIN_HEADER); in net1080_rx_fixup()
374 nc_ensure_sync(dev); in net1080_rx_fixup()
385 dev->net->stats.rx_frame_errors++; in net1080_rx_fixup()
386 netdev_dbg(dev->net, "bad pad\n"); in net1080_rx_fixup()
392 dev->net->stats.rx_frame_errors++; in net1080_rx_fixup()
393 netdev_dbg(dev->net, "bad packet len %d (expected %d)\n", in net1080_rx_fixup()
395 nc_ensure_sync(dev); in net1080_rx_fixup()
399 dev->net->stats.rx_fifo_errors++; in net1080_rx_fixup()
400 netdev_dbg(dev->net, "(2+ dropped) rx packet_id mismatch 0x%x 0x%x\n", in net1080_rx_fixup()
406 netdev_dbg(dev->net, "frame <rx h %d p %d id %d\n", header->hdr_len, in net1080_rx_fixup()
409 dev->frame_errors = 0; in net1080_rx_fixup()
414 net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) in net1080_tx_fixup() argument
459 header->packet_id = cpu_to_le16((u16)dev->xid++); in net1080_tx_fixup()
467 netdev_dbg(dev->net, "frame >tx h %d p %d id %d\n", in net1080_tx_fixup()
474 static int net1080_bind(struct usbnet *dev, struct usb_interface *intf) in net1080_bind() argument
480 dev->net->hard_header_len += extra; in net1080_bind()
481 dev->rx_urb_size = dev->net->hard_header_len + dev->net->mtu; in net1080_bind()
482 dev->hard_mtu = NC_MAX_PACKET; in net1080_bind()
483 return usbnet_get_endpoints (dev, intf); in net1080_bind()