aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-31 03:47:34 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:45:04 -0500
commit9c6736523a23371ae58c5427587ee1652ba059c1 (patch)
tree0df3a845f7874887457b49548ad60a54428fe2d3 /drivers/usb
parentfca8ab7ee1c6d1857a4fcc9420cbf0e3b51aa199 (diff)
usb: gadget: renesas_usbhs: usbhs_set_device_config() care upphub/hubport
current usbhs_set_device_config() didn't care upphub/hubport. This patch adds its value. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index f18062c798a..204f9f08684 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -161,6 +161,8 @@ static const char usbhsh_hcd_name[] = "renesas_usbhs host";
161 161
162#define usbhsh_pipe_info(p) ((p)->mod_private) 162#define usbhsh_pipe_info(p) ((p)->mod_private)
163 163
164#define usbhsh_device_parent(d) (usbhsh_usbv_to_udev((d)->usbv->parent))
165#define usbhsh_device_hubport(d) ((d)->usbv->portnum)
164#define usbhsh_device_number(h, d) ((int)((d) - (h)->udev)) 166#define usbhsh_device_number(h, d) ((int)((d) - (h)->udev))
165#define usbhsh_device_nth(h, d) ((h)->udev + d) 167#define usbhsh_device_nth(h, d) ((h)->udev + d)
166#define usbhsh_device0(h) usbhsh_device_nth(h, 0) 168#define usbhsh_device0(h) usbhsh_device_nth(h, 0)
@@ -264,6 +266,13 @@ static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
264/* 266/*
265 * device control 267 * device control
266 */ 268 */
269static int usbhsh_connected_to_rhdev(struct usb_hcd *hcd,
270 struct usbhsh_device *udev)
271{
272 struct usb_device *usbv = usbhsh_udev_to_usbv(udev);
273
274 return hcd->self.root_hub == usbv->parent;
275}
267 276
268static int usbhsh_device_has_endpoint(struct usbhsh_device *udev) 277static int usbhsh_device_has_endpoint(struct usbhsh_device *udev)
269{ 278{
@@ -278,6 +287,7 @@ static struct usbhsh_device *usbhsh_device_alloc(struct usbhsh_hpriv *hpriv,
278 struct device *dev = usbhsh_hcd_to_dev(hcd); 287 struct device *dev = usbhsh_hcd_to_dev(hcd);
279 struct usb_device *usbv = usbhsh_urb_to_usbv(urb); 288 struct usb_device *usbv = usbhsh_urb_to_usbv(urb);
280 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); 289 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
290 u16 upphub, hubport;
281 int i; 291 int i;
282 292
283 /* 293 /*
@@ -316,12 +326,23 @@ usbhsh_device_find:
316 dev_set_drvdata(&usbv->dev, udev); 326 dev_set_drvdata(&usbv->dev, udev);
317 udev->usbv = usbv; 327 udev->usbv = usbv;
318 328
329 upphub = 0;
330 hubport = 0;
331 if (!usbhsh_connected_to_rhdev(hcd, udev)) {
332 /* if udev is not connected to rhdev, it means parent is Hub */
333 struct usbhsh_device *parent = usbhsh_device_parent(udev);
334
335 upphub = usbhsh_device_number(hpriv, parent);
336 hubport = usbhsh_device_hubport(udev);
337
338 dev_dbg(dev, "%s connecte to Hub [%d:%d](%p)\n", __func__,
339 upphub, hubport, parent);
340 }
341
319 /* set device config */ 342 /* set device config */
320 usbhs_set_device_config(priv, 343 usbhs_set_device_config(priv,
321 usbhsh_device_number(hpriv, udev), 344 usbhsh_device_number(hpriv, udev),
322 usbhsh_device_number(hpriv, udev), 345 upphub, hubport, usbv->speed);
323 0, /* FIXME no parent */
324 usbv->speed);
325 346
326 dev_dbg(dev, "%s [%d](%p)\n", __func__, 347 dev_dbg(dev, "%s [%d](%p)\n", __func__,
327 usbhsh_device_number(hpriv, udev), udev); 348 usbhsh_device_number(hpriv, udev), udev);