Skip to contentSkip to conversation

UDC support for MIPS/AU1200 and Geode/CS5536

PATCH In review Jordan Crouse 4 participants 7 messages Jan 9, 2006 – Jan 13, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UDC support for MIPS/AU1200 and Geode/CS5536

#1 lore raw
Quoted 2 lines · Jordan Crouse

From the "two-birds-one-stone" department, I am pleased to present USB UDC support for both the MIPS Au1200 SoC and the Geode CS5535 south bridge.

                                                     ^^^^^^

Of course, I meant the CS5536 - this *won't* work for the CS5535.

Jordan

Signature · 4 lines
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>
#2 lore raw
In reply to Jordan Crouse

Am Montag, 9. Januar 2006 19:03 schrieb Jordan Crouse:

Quoted 11 lines
Quoted 1 line

From the "two-birds-one-stone" department, I am pleased to present USB UDC

support for both the MIPS Au1200 SoC and the Geode CS5535 south bridge. Also, coming soon (in the next few days), OTG, which has been removed from the usb_host patch, and put into its own patch (as per David's comments).

This patch is against current linux-mips git, but it should apply for Linus's tree as well.

Regards,
Jordan

+ VDBG("udc_read_bytes(): %d bytes\n", bytes);
+
+ /* dwords first */
+ for (i = 0; i < bytes / UDC_DWORD_BYTES; i++) {
+ *((u32*) (buf + (i<<2))) = readl(dev->rxfifo);
+ }

Is there any reason you don't increment by 4?

Regards
Oliver

#3 lore raw
Quoted 22 lines · Oliver Neukum

Am Montag, 9. Januar 2006 19:03 schrieb Jordan Crouse:

Quoted 12 lines
Quoted 1 line

From the "two-birds-one-stone" department, I am pleased to present USB UDC

support for both the MIPS Au1200 SoC and the Geode CS5535 south bridge. Also, coming soon (in the next few days), OTG, which has been removed from the usb_host patch, and put into its own patch (as per David's comments).

This patch is against current linux-mips git, but it should apply for Linus's tree as well.

Regards,
Jordan

(quoted diff) +6 -0
+        VDBG("udc_read_bytes(): %d bytes\n", bytes);
+
+        /* dwords first */
+        for (i = 0; i < bytes / UDC_DWORD_BYTES; i++) {
+               *((u32*) (buf + (i<<2))) = readl(dev->rxfifo); 
+        }
Quoted 9 lines

Is there any reason you don't increment by 4?

Regards
Oliver

The loop is for reading dwords only, so "i < bytes / UDC_DWORD_BYTES" cuts off remaining 1,2 or 3 bytes which are handled by the next loop. But you are right, incrementing by 4 may look better, as

       for (i = 0; i < bytes - bytes % UDC_DWORD_BYTES; i+=4) {
              *((u32*) (buf + i)) = readl(dev->rxfifo); 
       }

Thanks,
Thomas

#4 lore raw
Quoted 6 lines · Thomas Dahlmann

The loop is for reading dwords only, so "i < bytes / UDC_DWORD_BYTES" cuts off remaining 1,2 or 3 bytes which are handled by the next loop. But you are right, incrementing by 4 may look better, as

       for (i = 0; i < bytes - bytes % UDC_DWORD_BYTES; i+=4) {
    for (i = 0; i <= bytes - UDC_DWORD_BYTES; i += 4) {

?

David Vrabel

#5 lore raw
In reply to Thomas Dahlmann

Am Dienstag, 10. Januar 2006 12:02 schrieb Thomas Dahlmann:

Quoted 35 lines
Quoted 23 lines · Oliver Neukum

Am Montag, 9. Januar 2006 19:03 schrieb Jordan Crouse:

Quoted 13 lines
Quoted 1 line

From the "two-birds-one-stone" department, I am pleased to present USB UDC

support for both the MIPS Au1200 SoC and the Geode CS5535 south bridge. Also, coming soon (in the next few days), OTG, which has been removed from the usb_host patch, and put into its own patch (as per David's comments).

This patch is against current linux-mips git, but it should apply for Linus's tree as well.

Regards,
Jordan

(quoted diff) +6 -0
+        VDBG("udc_read_bytes(): %d bytes\n", bytes);
+
+        /* dwords first */
+        for (i = 0; i < bytes / UDC_DWORD_BYTES; i++) {
+               *((u32*) (buf + (i<<2))) = readl(dev->rxfifo); 
+        }
Quoted 9 lines

Is there any reason you don't increment by 4?

Regards
Oliver

Quoted 7 lines

The loop is for reading dwords only, so "i < bytes / UDC_DWORD_BYTES" cuts off remaining 1,2 or 3 bytes which are handled by the next loop. But you are right, incrementing by 4 may look better, as

        for (i = 0; i < bytes - bytes % UDC_DWORD_BYTES; i+=4) {
               *((u32*) (buf + i)) = readl(dev->rxfifo); 
        }

Not only will it look better, but it'll save you a shift operation. You might even compute start and finish values before the loop and save an addition in the body.

Regards
Oliver

#6 lore raw
Quoted 54 lines · Oliver Neukum

Am Dienstag, 10. Januar 2006 12:02 schrieb Thomas Dahlmann:

Quoted 41 lines
Quoted 26 lines · Oliver Neukum

Am Montag, 9. Januar 2006 19:03 schrieb Jordan Crouse:

Quoted 14 lines
Quoted 1 line

From the "two-birds-one-stone" department, I am pleased to present USB UDC

support for both the MIPS Au1200 SoC and the Geode CS5535 south bridge. Also, coming soon (in the next few days), OTG, which has been removed from the usb_host patch, and put into its own patch (as per David's comments).

This patch is against current linux-mips git, but it should apply for Linus's tree as well.

Regards,
Jordan

(quoted diff) +6 -0
+        VDBG("udc_read_bytes(): %d bytes\n", bytes);
+
+        /* dwords first */
+        for (i = 0; i < bytes / UDC_DWORD_BYTES; i++) {
+               *((u32*) (buf + (i<<2))) = readl(dev->rxfifo); 
+        }
Quoted 11 lines

Is there any reason you don't increment by 4?

Regards
Oliver

Quoted 9 lines

The loop is for reading dwords only, so "i < bytes / UDC_DWORD_BYTES" cuts off remaining 1,2 or 3 bytes which are handled by the next loop. But you are right, incrementing by 4 may look better, as

       for (i = 0; i < bytes - bytes % UDC_DWORD_BYTES; i+=4) {
              *((u32*) (buf + i)) = readl(dev->rxfifo); 
       }
Quoted 11 lines

Not only will it look better, but it'll save you a shift operation. You might even compute start and finish values before the loop and save an addition in the body.

Regards
Oliver

I have changed this for the next patch release. Thanks for the input !

Regards,
Thomas