* [U-Boot] [PATCH] r8a66597-hcd: fix cannot use external hub
@ 2008-10-29 11:05 Yoshihiro Shimoda
2009-02-22 9:55 ` Remy Bohmer
0 siblings, 1 reply; 2+ messages in thread
From: Yoshihiro Shimoda @ 2008-10-29 11:05 UTC (permalink / raw)
To: u-boot
Fix the problem that cannot use external hub, because this driver
did not control correctly a DEVADDx register.
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
---
drivers/usb/r8a66597-hcd.c | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/r8a66597-hcd.c
index 0d3931e..5007051 100644
--- a/drivers/usb/r8a66597-hcd.c
+++ b/drivers/usb/r8a66597-hcd.c
@@ -36,12 +36,37 @@ static unsigned short vif = CONFIG_R8A66597_LDRV;
static unsigned short endian = CONFIG_R8A66597_ENDIAN;
static struct r8a66597 gr8a66597;
-static void set_devadd_reg(struct r8a66597 *r8a66597, u8 r8a66597_address,
- u16 usbspd, u8 upphub, u8 hubport, int port)
+static void get_hub_data(struct usb_device *dev, u16 *hub_devnum, u16 *hubport)
{
- u16 val;
+ int i;
+
+ *hub_devnum = 0;
+ *hubport = 0;
+
+ /* check a device connected to root_hub */
+ if ((dev->parent && dev->parent->devnum == 1) ||
+ (dev->devnum == 1))
+ return;
+
+ for (i = 0; i < USB_MAXCHILDREN; i++) {
+ if (dev->parent->children[i] == dev) {
+ *hub_devnum = (u8)dev->parent->devnum;
+ *hubport = i;
+ return;
+ }
+ }
+
+ printf("get_hub_data error.\n");
+}
+
+static void set_devadd(struct r8a66597 *r8a66597, u8 r8a66597_address,
+ struct usb_device *dev, int port)
+{
+ u16 val, usbspd, upphub, hubport;
unsigned long devadd_reg = get_devadd_addr(r8a66597_address);
+ get_hub_data(dev, &upphub, &hubport);
+ usbspd = r8a66597->speed;
val = (upphub << 11) | (hubport << 8) | (usbspd << 6) | (port & 0x0001);
r8a66597_write(r8a66597, val, devadd_reg);
}
@@ -818,7 +843,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
R8A66597_DPRINT("pipe = %08x, buffer = %p, len = %d, devnum = %d\n",
pipe, buffer, transfer_len, dev->devnum);
- set_devadd_reg(r8a66597, dev->devnum, r8a66597->speed, 0, 0, 0);
+ set_devadd(r8a66597, dev->devnum, dev, 0);
pipe_buffer_setting(r8a66597, dev, pipe);
@@ -854,13 +879,14 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe,
setup);
R8A66597_DPRINT("%s: setup\n", __func__);
- set_devadd_reg(r8a66597, r8a66597_address, r8a66597->speed, 0, 0, 0);
+ set_devadd(r8a66597, r8a66597_address, dev, 0);
if (send_setup_packet(r8a66597, dev, setup) < 0) {
printf("setup packet send error\n");
return -1;
}
+ dev->act_len = 0;
if (usb_pipein(pipe))
if (receive_control_packet(r8a66597, dev, buffer,
transfer_len) < 0)
--
1.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH] r8a66597-hcd: fix cannot use external hub
2008-10-29 11:05 [U-Boot] [PATCH] r8a66597-hcd: fix cannot use external hub Yoshihiro Shimoda
@ 2009-02-22 9:55 ` Remy Bohmer
0 siblings, 0 replies; 2+ messages in thread
From: Remy Bohmer @ 2009-02-22 9:55 UTC (permalink / raw)
To: u-boot
Hello,
2008/10/29 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>:
> Fix the problem that cannot use external hub, because this driver
> did not control correctly a DEVADDx register.
>
> Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
> ---
> drivers/usb/r8a66597-hcd.c | 36 +++++++++++++++++++++++++++++++-----
> 1 files changed, 31 insertions(+), 5 deletions(-)
Applied to u-boot-usb
Thanks.
Remy
>
> diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/r8a66597-hcd.c
> index 0d3931e..5007051 100644
> --- a/drivers/usb/r8a66597-hcd.c
> +++ b/drivers/usb/r8a66597-hcd.c
> @@ -36,12 +36,37 @@ static unsigned short vif = CONFIG_R8A66597_LDRV;
> static unsigned short endian = CONFIG_R8A66597_ENDIAN;
> static struct r8a66597 gr8a66597;
>
> -static void set_devadd_reg(struct r8a66597 *r8a66597, u8 r8a66597_address,
> - u16 usbspd, u8 upphub, u8 hubport, int port)
> +static void get_hub_data(struct usb_device *dev, u16 *hub_devnum, u16 *hubport)
> {
> - u16 val;
> + int i;
> +
> + *hub_devnum = 0;
> + *hubport = 0;
> +
> + /* check a device connected to root_hub */
> + if ((dev->parent && dev->parent->devnum == 1) ||
> + (dev->devnum == 1))
> + return;
> +
> + for (i = 0; i < USB_MAXCHILDREN; i++) {
> + if (dev->parent->children[i] == dev) {
> + *hub_devnum = (u8)dev->parent->devnum;
> + *hubport = i;
> + return;
> + }
> + }
> +
> + printf("get_hub_data error.\n");
> +}
> +
> +static void set_devadd(struct r8a66597 *r8a66597, u8 r8a66597_address,
> + struct usb_device *dev, int port)
> +{
> + u16 val, usbspd, upphub, hubport;
> unsigned long devadd_reg = get_devadd_addr(r8a66597_address);
>
> + get_hub_data(dev, &upphub, &hubport);
> + usbspd = r8a66597->speed;
> val = (upphub << 11) | (hubport << 8) | (usbspd << 6) | (port & 0x0001);
> r8a66597_write(r8a66597, val, devadd_reg);
> }
> @@ -818,7 +843,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
> R8A66597_DPRINT("pipe = %08x, buffer = %p, len = %d, devnum = %d\n",
> pipe, buffer, transfer_len, dev->devnum);
>
> - set_devadd_reg(r8a66597, dev->devnum, r8a66597->speed, 0, 0, 0);
> + set_devadd(r8a66597, dev->devnum, dev, 0);
>
> pipe_buffer_setting(r8a66597, dev, pipe);
>
> @@ -854,13 +879,14 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe,
> setup);
>
> R8A66597_DPRINT("%s: setup\n", __func__);
> - set_devadd_reg(r8a66597, r8a66597_address, r8a66597->speed, 0, 0, 0);
> + set_devadd(r8a66597, r8a66597_address, dev, 0);
>
> if (send_setup_packet(r8a66597, dev, setup) < 0) {
> printf("setup packet send error\n");
> return -1;
> }
>
> + dev->act_len = 0;
> if (usb_pipein(pipe))
> if (receive_control_packet(r8a66597, dev, buffer,
> transfer_len) < 0)
> --
> 1.5.5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-22 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 11:05 [U-Boot] [PATCH] r8a66597-hcd: fix cannot use external hub Yoshihiro Shimoda
2009-02-22 9:55 ` Remy Bohmer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox