Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280868
b: refs/heads/master
c: 9c67365
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Felipe Balbi committed Dec 12, 2011
1 parent 9d1582b commit 3c80d20
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fca8ab7ee1c6d1857a4fcc9420cbf0e3b51aa199
refs/heads/master: 9c6736523a23371ae58c5427587ee1652ba059c1
27 changes: 24 additions & 3 deletions trunk/drivers/usb/renesas_usbhs/mod_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ static const char usbhsh_hcd_name[] = "renesas_usbhs host";

#define usbhsh_pipe_info(p) ((p)->mod_private)

#define usbhsh_device_parent(d) (usbhsh_usbv_to_udev((d)->usbv->parent))
#define usbhsh_device_hubport(d) ((d)->usbv->portnum)
#define usbhsh_device_number(h, d) ((int)((d) - (h)->udev))
#define usbhsh_device_nth(h, d) ((h)->udev + d)
#define usbhsh_device0(h) usbhsh_device_nth(h, 0)
Expand Down Expand Up @@ -264,6 +266,13 @@ static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
/*
* device control
*/
static int usbhsh_connected_to_rhdev(struct usb_hcd *hcd,
struct usbhsh_device *udev)
{
struct usb_device *usbv = usbhsh_udev_to_usbv(udev);

return hcd->self.root_hub == usbv->parent;
}

static int usbhsh_device_has_endpoint(struct usbhsh_device *udev)
{
Expand All @@ -278,6 +287,7 @@ static struct usbhsh_device *usbhsh_device_alloc(struct usbhsh_hpriv *hpriv,
struct device *dev = usbhsh_hcd_to_dev(hcd);
struct usb_device *usbv = usbhsh_urb_to_usbv(urb);
struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
u16 upphub, hubport;
int i;

/*
Expand Down Expand Up @@ -316,12 +326,23 @@ static struct usbhsh_device *usbhsh_device_alloc(struct usbhsh_hpriv *hpriv,
dev_set_drvdata(&usbv->dev, udev);
udev->usbv = usbv;

upphub = 0;
hubport = 0;
if (!usbhsh_connected_to_rhdev(hcd, udev)) {
/* if udev is not connected to rhdev, it means parent is Hub */
struct usbhsh_device *parent = usbhsh_device_parent(udev);

upphub = usbhsh_device_number(hpriv, parent);
hubport = usbhsh_device_hubport(udev);

dev_dbg(dev, "%s connecte to Hub [%d:%d](%p)\n", __func__,
upphub, hubport, parent);
}

/* set device config */
usbhs_set_device_config(priv,
usbhsh_device_number(hpriv, udev),
usbhsh_device_number(hpriv, udev),
0, /* FIXME no parent */
usbv->speed);
upphub, hubport, usbv->speed);

dev_dbg(dev, "%s [%d](%p)\n", __func__,
usbhsh_device_number(hpriv, udev), udev);
Expand Down

0 comments on commit 3c80d20

Please sign in to comment.