From: "Eli Chen" <eli@routefree.com>
To: <linuxppc-embedded@lists.linuxppc.org>,
"Alexander Kolesnikov" <akolesni@qualcomm.com>
Subject: Re: USB support in the HardHet Linux 2.4.2 on the IBM Walnut
Date: Mon, 3 Sep 2001 17:05:24 -0700 [thread overview]
Message-ID: <009601c134d5$4bc7aca0$b300000a@foolio1> (raw)
In-Reply-To: 4.2.2.20010830111127.02d754d0@qisrael.qi.qualcomm.com
[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]
Alexander,
We have managed to get the USB ohci driver to work on the Walnut board. I
believe one of the problems was that the 405gp platform did not guarantee
cache coherency for pci-dma. This is supposedly fixed by patches
ohci-0323*.patch and pcipool patches (you can find on usb-devel mailing
list).
That didn't improve things at all. Then I discovered that cache invalidates
were happening on addresses not aligned with the 405gp cacheline. This
junked some good data, and I fixed it by using kmalloc'ed memory for dma and
aligning end addresses manually. I also have a fix for the Pegasus ethernet
dongle (other drivers probably have to be patched as well.)
The code uses a macro called L1_CACHE_ALIGN:
#define L1_CACHE_ALIGN(x)
(((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
where L1_CACHE_BYTES is 32 for 405gp.
hope this helps! sorry if it's too messy. I'll try to help more if I can.
Eli
----- Original Message -----
From: "Alexander Kolesnikov" <akolesni@qualcomm.com>
To: <linuxppc-embedded@lists.linuxppc.org>
Sent: Thursday, August 30, 2001 2:19 AM
Subject: USB support in the HardHet Linux 2.4.2 on the IBM Walnut
>
> Hi All,
>
> We have problems with different USB chips on the Walnut board:
>
> 1.Using of a OHCI chip causes to kernel crash. This problem is famous but
> we really need to know whether does any "on the shelf" solution for the
> particular case exist.
>
> 2.When a UHCI chip is used, the USB device connecting to it causes to the
> following error messages:
>
> usb_control/buk_msg:timeout
> usb.c:USB device not accepting new address = XX (error=-110)
>
> The used USB hubs and devices work properly with another OS on the PC
> platform.
>
> Thanks in advance.
>
>
[-- Attachment #2: usb.h.patch --]
[-- Type: application/octet-stream, Size: 844 bytes --]
Index: usb.h
===================================================================
RCS file: /home/routefree/depot/rf/src/hr/linux/include/linux/usb.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -r1.1.1.2 -r1.2
599,600c599,604
< struct usb_device_descriptor descriptor;/* Descriptor */
< struct usb_config_descriptor *config; /* All of the configs */
---
> /* The reason for the alignment is that we're DMA-ing the descriptor struct,
> * and we want to make sure when the cacheline is invalidated it doesn't clobber
> * any data also in the cacheline, since the descriptor is only 18 bytes.
> */
> struct usb_device_descriptor __attribute__ ((aligned(L1_CACHE_BYTES))) descriptor;/* Descriptor */
> struct usb_config_descriptor __attribute__ ((aligned(L1_CACHE_BYTES))) *config; /* All of the configs */
[-- Attachment #3: usb.patch --]
[-- Type: application/octet-stream, Size: 7679 bytes --]
Index: pegasus.c
===================================================================
RCS file: /home/routefree/depot/rf/src/hr/linux/drivers/usb/pegasus.c,v
retrieving revision 1.2
retrieving revision 1.6
diff -r1.2 -r1.6
54,55c54,55
< #define PEGASUS_USE_INTR
< #define PEGASUS_WRITE_EEPROM
---
> #undef PEGASUS_USE_INTR
> #undef PEGASUS_WRITE_EEPROM
126a127
> unsigned char *buffer;
128a130,136
> buffer = kmalloc(L1_CACHE_ALIGN(size),GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return 0;
> }
> memcpy(buffer,data,size);
>
143c151
< data, size, ctrl_callback, pegasus );
---
> buffer, L1_CACHE_ALIGN(size), ctrl_callback, pegasus );
156a165,166
> memcpy(data,buffer,size);
> kfree(buffer);
163a174
> unsigned char *buffer;
165a177,183
> buffer = kmalloc(size,GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return 0;
> }
> memcpy(buffer,data,size);
>
180c198
< data, size, ctrl_callback, pegasus );
---
> buffer, size, ctrl_callback, pegasus );
187a206
> kfree(buffer);
193a213
> kfree(buffer);
200a221
> unsigned char *buffer;
203a225,231
> buffer = kmalloc(1,GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return 0;
> }
> memcpy(buffer,&data,1);
>
218c246
< &data, 1, ctrl_callback, pegasus );
---
> buffer, 1, ctrl_callback, pegasus );
225a254
> kfree(buffer);
231a261
> kfree(buffer);
Index: usb.c
===================================================================
RCS file: /home/routefree/depot/rf/src/hr/linux/drivers/usb/usb.c,v
retrieving revision 1.2
retrieving revision 1.5
diff -r1.2 -r1.5
1772c1772
< sizeof(dev->descriptor));
---
> L1_CACHE_ALIGN(sizeof(dev->descriptor)));
1789a1790
> unsigned char *buffer;
1792a1794,1799
> buffer = kmalloc(L1_CACHE_ALIGN(1), GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return -ENOMEM;
> }
>
1795c1802,1803
< 0, ifnum, &type, 1, HZ * GET_TIMEOUT)) < 0)
---
> 0, ifnum, buffer, L1_CACHE_ALIGN(1), HZ * GET_TIMEOUT)) < 0) {
> kfree(buffer);
1796a1805,1808
> }
>
> type = *buffer;
> kfree(buffer);
1851a1864
> unsigned char *buffer;
1865a1879,1884
> buffer = kmalloc(L1_CACHE_ALIGN(sizeof(status)), GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return -ENOMEM;
> }
>
1868c1887,1891
< &status, sizeof(status), HZ * SET_TIMEOUT);
---
> buffer, L1_CACHE_ALIGN(sizeof(status)), HZ * SET_TIMEOUT);
>
> memcpy(&status,buffer,sizeof(status));
> kfree(buffer);
>
1953c1976
< unsigned char buffer[8];
---
> unsigned char *buffer;
1955,1956c1978
< struct usb_config_descriptor *desc =
< (struct usb_config_descriptor *)buffer;
---
> struct usb_config_descriptor *desc;
1984a2007,2013
> buffer = kmalloc(L1_CACHE_ALIGN(8), GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> return -ENOMEM;
> }
> desc = (struct usb_config_descriptor *)buffer;
>
1988c2017
< result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, 8);
---
> result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, L1_CACHE_ALIGN(8));
2002c2031
< bigbuffer = kmalloc(length, GFP_KERNEL);
---
> bigbuffer = kmalloc(L1_CACHE_ALIGN(length), GFP_KERNEL);
2010c2039
< result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, bigbuffer, length);
---
> result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, bigbuffer, L1_CACHE_ALIGN(length));
2034a2064
> kfree(buffer);
2036a2067
> kfree(buffer);
2131c2162
< err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8);
---
> err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, L1_CACHE_ALIGN(8));
Index: hub.c
===================================================================
RCS file: /home/routefree/depot/rf/src/hr/linux/drivers/usb/hub.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -r1.2 -r1.3
128a129
> unsigned char *buffer;
194c195,204
< ret = usb_get_hub_status(dev, &hubstatus);
---
> buffer = kmalloc(sizeof(struct usb_hub_status),GFP_KERNEL);
> if (!buffer) {
> err("unable to allocate memory for configuration descriptors");
> kfree(hub->descriptor);
> return -1;
> }
> memcpy(buffer,&hubstatus,sizeof(struct usb_hub_status));
> ret = usb_get_hub_status(dev,buffer);
> memcpy(&hubstatus,buffer,sizeof(struct usb_hub_status));
> kfree(buffer);
446a457
> unsigned char *buffer;
453c464,474
< ret = usb_get_port_status(hub, port + 1, &portsts);
---
> buffer = kmalloc(sizeof(struct usb_hub_status),GFP_KERNEL);
> if (buffer) {
> memcpy(buffer,&portsts,sizeof(struct usb_hub_status));
> ret = usb_get_port_status(hub, port + 1, buffer);
> memcpy(&portsts,buffer,sizeof(struct usb_hub_status));
> kfree(buffer);
> } else {
> err("unable to allocate memory for configuration descriptors");
> ret = -1;
> }
>
643a665,666
> unsigned char *buffer;
> int temp_ret;
687c710,720
< ret = usb_get_port_status(dev, i + 1, &portsts);
---
> buffer = kmalloc(sizeof(struct usb_hub_status),GFP_KERNEL);
> if (buffer) {
> memcpy(buffer,&portsts,sizeof(struct usb_hub_status));
> ret = usb_get_port_status(dev, i + 1, buffer);
> memcpy(&portsts,buffer,sizeof(struct usb_hub_status));
> kfree(buffer);
> } else {
> err("unable to allocate memory for configuration descriptors");
> ret = -1;
> }
>
733a767,777
> buffer = kmalloc(sizeof(struct usb_hub_status),GFP_KERNEL);
> if (buffer) {
> memcpy(buffer,&hubsts,sizeof(struct usb_hub_status));
> temp_ret = usb_get_hub_status(dev, buffer);
> memcpy(&hubsts,buffer,sizeof(struct usb_hub_status));
> kfree(buffer);
> } else {
> err("unable to allocate memory for configuration descriptors");
> temp_ret = -1;
> }
>
735c779
< if (usb_get_hub_status(dev, &hubsts) < 0)
---
> if (temp_ret < 0)
Index: usb-ohci.h
===================================================================
RCS file: /home/routefree/depot/rf/src/hr/linux/drivers/usb/usb-ohci.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -r1.2 -r1.3
60c60
< } __attribute((aligned(16)));
---
> } __attribute((aligned(L1_CACHE_BYTES)));
118c118
< } __attribute((aligned(16)));
---
> } __attribute((aligned(L1_CACHE_BYTES)));
561c561
< 16 /* byte alignment */,
---
> L1_CACHE_BYTES /* byte alignment */,
568c568
< 16 /* byte alignment */,
---
> L1_CACHE_BYTES /* byte alignment */,
next prev parent reply other threads:[~2001-09-04 0:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-30 9:19 USB support in the HardHet Linux 2.4.2 on the IBM Walnut Alexander Kolesnikov
2001-08-30 9:38 ` Adrian Cox
2001-09-04 0:05 ` Eli Chen [this message]
2001-09-04 19:56 ` Dan Malek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='009601c134d5$4bc7aca0$b300000a@foolio1' \
--to=eli@routefree.com \
--cc=akolesni@qualcomm.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).