I'm trying to get mii support working properly with the ax8817x driver but I'm hitting a big stumbling block. I have the following functions that handle the reads but I always get a return code of 2 from the second ax_read_cmd (the one that actually pulls the value, calls ax_control_msg, etc.). In tracing through ax_read_cmd, that return code is what is passed back from usb_submit_urb (offending code in ax8817x found below). In following usb_submit_urb, I didn't see any cases where it would return 2, but many places with EINVAL, etc which are 22 or 19, etc.

Any thoughts?

static int read_mii_word(struct ax8817x_info *ax_info, __u8 phy, __u8 indx,
            __u16 * regd)
{
   int ret;
   u8 buf[4];

devdbg(ax_info,"read_mii_word: phy=%02x, indx=%02x, regd=%04x", phy, indx, *regd);
ax_write_cmd(ax_info, AX_CMD_SET_SW_MII, 0, 0, 0, &buf);
ret = ax_read_cmd(ax_info, AX_CMD_READ_MII_REG, ax_info->phy_id, indx, 2, &regd);
devdbg(ax_info,"read_mii_word: AX_CMD_READ_MII_REG ret=%02x, regd=%04x", ret, *regd);
ax_write_cmd(ax_info, AX_CMD_SET_HW_MII, 0, 0, 0, &buf);
return ret;
}


static int mdio_read(struct net_device *dev, int phy_id, int loc)
{
   struct ax8817x_info *ax_info = dev->priv;
   int res;

devdbg(ax_info, "mdio_read: phy_id=%02x, loc=%02x", phy_id, loc);
read_mii_word(ax_info, phy_id, loc, (u16 *) & res);
return res & 0xffff;
}



........... Snippet from ax_run_ctl_queue ................


       /* XXX: do something with timeout */
       usb_fill_control_urb(ax_info->ctl_urb, ax_info->usb,
                    next_req->devreq.
                    bRequestType & USB_DIR_IN ?
                    usb_rcvctrlpipe(ax_info->usb,
                            0) :
                    usb_sndctrlpipe(ax_info->usb, 0),
                    (void *) &next_req->devreq,
                    next_req->data, next_req->data_size,
                    ax_ctl_callback, ax_info);

       status = usb_submit_urb(ax_info->ctl_urb, GFP_ATOMIC);
       if (status >= 0) {
           break;
       }

......... Snippet from ax_control_msg ...............

   req->devreq.bRequestType = requesttype;
   req->devreq.bRequest = request;
   req->devreq.wValue = cpu_to_le16(value);
   req->devreq.wIndex = cpu_to_le16(index);
   req->devreq.wLength = cpu_to_le16(size);
   req->data = data;
   req->data_size = size;
   req->timeout = timeout;

   req->priv = &wq;
   set_current_state(TASK_UNINTERRUPTIBLE);
   add_wait_queue(&wq, &wait);

req->cmd_callback = ax_sync_cmd_callback;

   ax_run_ctl_queue(ax_info, req, 0);
   schedule();

ret = req->status;

kfree(req);

return ret;




------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to