[U-Boot] [PATCH] net: fec: Avoid MX28 bus sync issue

Robert Hodaszi
2013-09-13T14:24:00Z

> OK, but as Wolfgang already pointed out, can you tell use what compiler exposes
> this behavior and show us the details WD requested please ?
>
> Best regards,
> Marek Vasut

You can find the informations below.

Please, use my patch or don't use it, or feel free to modify it as you
wish, but sorry, I really don't have more time to work on this problem.

/ $ arm-linux-gcc --version//
//arm-linux-gcc (crosstool-NG 1.12.1) 4.4.6//
//Copyright (C) 2010 Free Software Foundation, Inc.//
//This is free software; see the source for copying conditions. There
is NO//
//warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.//
//
// $ arm-linux-ld --version//
//GNU ld (crosstool-NG 1.12.1) 2.20.1.20100303//
//Copyright 2009 Free Software Foundation, Inc.//
//This program is free software; you may redistribute it under the terms
of//
//the GNU General Public License version 3 or (at your option) a later
version.//
//This program has absolutely no warranty./

*Before**:

*/4003ff5c <fec_recv>://
//4003ff5c: e92d44f0 push {r4, r5, r6, r7, sl, lr}//
//4003ff60: e590403c ldr r4, [r0, #60] ; 0x3c//
//4003ff64: e24ddc06 sub sp, sp, #1536 ; 0x600//
//4003ff68: e5943000 ldr r3, [r4]//
//4003ff6c: e594600c ldr r6, [r4, #12]//
//4003ff70: e5935004 ldr r5, [r3, #4]//
//4003ff74: e594a008 ldr sl, [r4, #8]//
//4003ff78: e1a07000 mov r7, r0//
//4003ff7c: e5943000 ldr r3, [r4]//
//4003ff80: e3150101 tst r5, #1073741824 ; 0x40000000//
//4003ff84: e5835004 str r5, [r3, #4]//
//4003ff88: 0a000007 beq 4003ffac <fec_recv+0x50>//
//4003ff8c: ebfffd9e bl 4003f60c <fec_halt>//
//4003ff90: e5941018 ldr r1, [r4, #24]//
//4003ff94: e1a00007 mov r0, r7//
//4003ff98: ebfffef1 bl 4003fb64 <fec_init>//
//4003ff9c: e1a01005 mov r1, r5//
//4003ffa0: e59f01a4 ldr r0, [pc, #420] ; 4004014c
<fec_recv+0x1f0>//
//4003ffa4: ebff76b7 bl 4001da88 <printf>//
//4003ffa8: ea00001d b 40040024 <fec_recv+0xc8>//
//4003ffac: e3550000 cmp r5, #0//
//4003ffb0: aa000003 bge 4003ffc4 <fec_recv+0x68>//
//4003ffb4: e59320c4 ldr r2, [r3, #196] ; 0xc4//
//4003ffb8: e3822001 orr r2, r2, #1//
//4003ffbc: e5943000 ldr r3, [r4]//
//4003ffc0: e58320c4 str r2, [r3, #196] ; 0xc4//
//4003ffc4: e3150201 tst r5, #268435456 ; 0x10000000//
//4003ffc8: 0a00000d beq 40040004 <fec_recv+0xa8>//
//4003ffcc: e5943000 ldr r3, [r4]//
//4003ffd0: e59330c4 ldr r3, [r3, #196] ; 0xc4//
//4003ffd4: e3130001 tst r3, #1//
//4003ffd8: 0a000009 beq 40040004 <fec_recv+0xa8>//
//4003ffdc: e1a00007 mov r0, r7//
//4003ffe0: ebfffd89 bl 4003f60c <fec_halt>//
//4003ffe4: e5943000 ldr r3, [r4]//
//4003ffe8: e59320c4 ldr r2, [r3, #196] ; 0xc4//
//4003ffec: e3c22001 bic r2, r2, #1//
//4003fff0: e5943000 ldr r3, [r4]//
//4003fff4: e1a00007 mov r0, r7//
//4003fff8: e58320c4 str r2, [r3, #196] ; 0xc4//
//4003fffc: e5941018 ldr r1, [r4, #24]//
//40040000: ebfffed7 bl 4003fb64 <fec_init>//
//40040004: e1a05186 lsl r5, r6, #3//
//40040008: e08a6005 add r6, sl, r5//
//4004000c: e3c6003f bic r0, r6, #63 ; 0x3f//
//40040010: e2801040 add r1, r0, #64 ; 0x40//
//40040014: ebff0152 bl 40000564
<invalidate_dcache_range>//
//40040018: e1d620b2 ldrh r2, [r6, #2]//
//4004001c: e3120902 tst r2, #32768 ; 0x8000//
//40040020: 0a000001 beq 4004002c <fec_recv+0xd0>//
//40040024: e3a05000 mov r5, #0//
//40040028: ea000044 b 40040140 <fec_recv+0x1e4>//
//4004002c: e59f311c ldr r3, [pc, #284] ; 40040150
<fec_recv+0x1f4>//
//40040030: e0023003 and r3, r2, r3//
//40040034: e3530b02 cmp r3, #2048 ; 0x800//
//40040038: 1a000016 bne 40040098 <fec_recv+0x13c>//
//4004003c: e19a30b5 ldrh r3, [sl, r5]//
//40040040: e3530012 cmp r3, #18//
//40040044: da000013 ble 40040098 <fec_recv+0x13c>//
//40040048: e5967004 ldr r7, [r6, #4]//
//4004004c: e19a50b5 ldrh r5, [sl, r5]//
//40040050: e2455004 sub r5, r5, #4//
//40040054: e287103f add r1, r7, #63 ; 0x3f//
//40040058: e0811005 add r1, r1, r5//
//4004005c: e3c7003f bic r0, r7, #63 ; 0x3f//
//40040060: e3c1103f bic r1, r1, #63 ; 0x3f//
//40040064: ebff013e bl 40000564
<invalidate_dcache_range>//
//40040068: e1a00007 mov r0, r7//
//4004006c: e1a01005 mov r1, r5//
//40040070: ebfffe57 bl 4003f9d4 <swap_packet>//
//40040074: e1a01007 mov r1, r7//
//40040078: e1a02005 mov r2, r5//
//4004007c: e1a0000d mov r0, sp//
//40040080: eb0030c5 bl 4004c39c <memcpy>//
//40040084: e1a0000d mov r0, sp//
//40040088: e1a01005 mov r1, r5//
//4004008c: e1a0600d mov r6, sp//
//40040090: eb00465e bl 40051a10 <NetReceive>//
//40040094: ea000005 b 400400b0 <fec_recv+0x154>//
//40040098: e2125037 ands r5, r2, #55 ; 0x37//
//4004009c: 0a000003 beq 400400b0 <fec_recv+0x154>//
//400400a0: e5961004 ldr r1, [r6, #4]//
//400400a4: e59f00a8 ldr r0, [pc, #168] ; 40040154
<fec_recv+0x1f8>//
//400400a8: ebff7676 bl 4001da88 <printf>//
//400400ac: e3a05000 mov r5, #0//
//400400b0: e594300c ldr r3, [r4, #12]//
//400400b4: e2032007 and r2, r3, #7//
//400400b8: e3520007 cmp r2, #7//
//400400bc: 1a000014 bne 40040114 <fec_recv+0x1b8>//
//400400c0: e5940008 ldr r0, [r4, #8]//
//400400c4: e243227e sub r2, r3, #-536870905 ;
0xe0000007//
//400400c8: e2433007 sub r3, r3, #7//
//400400cc: e0800183 add r0, r0, r3, lsl #3//
//400400d0: e1a02182 lsl r2, r2, #3//
//400400d4: ea000009 b 40040100 <fec_recv+0x1a4>//
//400400d8: e5941008 ldr r1, [r4, #8]//
//400400dc: e353003f cmp r3, #63 ; 0x3f//
//400400e0: 13a0e902 movne lr, #32768 ; 0x8000//
//400400e4: 03a0ea0a moveq lr, #40960 ; 0xa000//
//400400e8: e081c002 add ip, r1, r2//
//400400ec: e1cce0b2 strh lr, [ip, #2]//
//400400f0: e3a0c000 mov ip, #0//
//400400f4: e181c0b2 strh ip, [r1, r2]//
//400400f8: e2833001 add r3, r3, #1//
//400400fc: e2822008 add r2, r2, #8//
//40040100: e594100c ldr r1, [r4, #12]//
//40040104: e1530001 cmp r3, r1//
//40040108: dafffff2 ble 400400d8 <fec_recv+0x17c>//
//4004010c: e2801040 add r1, r0, #64 ; 0x40//
//40040110: ebff011d bl 4000058c <flush_dcache_range>//
//40040114: e5943000 ldr r3, [r4]//
//40040118: e3a02401 mov r2, #16777216 ; 0x1000000//
//4004011c: e5832010 str r2, [r3, #16]//
//40040120: e594300c ldr r3, [r4, #12]//
//40040124: e2833001 add r3, r3, #1//
//40040128: e21331fe ands r3, r3, #-2147483585 ;
0x8000003f//
//4004012c: 42433001 submi r3, r3, #1//
//40040130: 41e03d03 mvnmi r3, r3, lsl #26//
//40040134: 41e03d23 mvnmi r3, r3, lsr #26//
//40040138: 42833001 addmi r3, r3, #1//
//4004013c: e584300c str r3, [r4, #12]//
//40040140: e1a00005 mov r0, r5//
//40040144: e28ddc06 add sp, sp, #1536 ; 0x600//
//40040148: e8bd84f0 pop {r4, r5, r6, r7, sl, pc}//
//4004014c: 40068c43 .word 0x40068c43//
//40040150: 00000837 .word 0x00000837//
//40040154: 40068c58 .word 0x40068c58/

*After:

*/4003ff5c <fec_recv>://
//4003ff5c: e92d44f0 push {r4, r5, r6, r7, sl, lr}//
//4003ff60: e590403c ldr r4, [r0, #60] ; 0x3c//
//4003ff64: e1a0a000 mov sl, r0//
//4003ff68: e5943000 ldr r3, [r4]//
//4003ff6c: e594600c ldr r6, [r4, #12]//
//4003ff70: e5935004 ldr r5, [r3, #4]//
//4003ff74: e5947008 ldr r7, [r4, #8]//
//4003ff78: e5943000 ldr r3, [r4]//
//4003ff7c: e3150101 tst r5, #1073741824 ; 0x40000000//
//4003ff80: e5835004 str r5, [r3, #4]//
//4003ff84: 0a000007 beq 4003ffa8 <fec_recv+0x4c>//
//4003ff88: ebfffd9f bl 4003f60c <fec_halt>//
//4003ff8c: e5941018 ldr r1, [r4, #24]//
//4003ff90: e1a0000a mov r0, sl//
//4003ff94: ebfffef2 bl 4003fb64 <fec_init>//
//4003ff98: e1a01005 mov r1, r5//
//4003ff9c: e59f019c ldr r0, [pc, #412] ; 40040140
<fec_recv+0x1e4>//
//4003ffa0: ebff76b8 bl 4001da88 <printf>//
//4003ffa4: ea00001d b 40040020 <fec_recv+0xc4>//
//4003ffa8: e3550000 cmp r5, #0//
//4003ffac: aa000003 bge 4003ffc0 <fec_recv+0x64>//
//4003ffb0: e59320c4 ldr r2, [r3, #196] ; 0xc4//
//4003ffb4: e3822001 orr r2, r2, #1//
//4003ffb8: e5943000 ldr r3, [r4]//
//4003ffbc: e58320c4 str r2, [r3, #196] ; 0xc4//
//4003ffc0: e3150201 tst r5, #268435456 ; 0x10000000//
//4003ffc4: 0a00000d beq 40040000 <fec_recv+0xa4>//
//4003ffc8: e5943000 ldr r3, [r4]//
//4003ffcc: e59330c4 ldr r3, [r3, #196] ; 0xc4//
//4003ffd0: e3130001 tst r3, #1//
//4003ffd4: 0a000009 beq 40040000 <fec_recv+0xa4>//
//4003ffd8: e1a0000a mov r0, sl//
//4003ffdc: ebfffd8a bl 4003f60c <fec_halt>//
//4003ffe0: e5943000 ldr r3, [r4]//
//4003ffe4: e59320c4 ldr r2, [r3, #196] ; 0xc4//
//4003ffe8: e3c22001 bic r2, r2, #1//
//4003ffec: e5943000 ldr r3, [r4]//
//4003fff0: e1a0000a mov r0, sl//
//4003fff4: e58320c4 str r2, [r3, #196] ; 0xc4//
//4003fff8: e5941018 ldr r1, [r4, #24]//
//4003fffc: ebfffed8 bl 4003fb64 <fec_init>//
//40040000: e1a05186 lsl r5, r6, #3//
//40040004: e0876005 add r6, r7, r5//
//40040008: e3c6003f bic r0, r6, #63 ; 0x3f//
//4004000c: e2801040 add r1, r0, #64 ; 0x40//
//40040010: ebff0153 bl 40000564
<invalidate_dcache_range>//
//40040014: e1d620b2 ldrh r2, [r6, #2]//
//40040018: e3120902 tst r2, #32768 ; 0x8000//
//4004001c: 0a000001 beq 40040028 <fec_recv+0xcc>//
//40040020: e3a05000 mov r5, #0//
//40040024: ea000043 b 40040138 <fec_recv+0x1dc>//
//40040028: e59f3114 ldr r3, [pc, #276] ; 40040144
<fec_recv+0x1e8>//
//4004002c: e0023003 and r3, r2, r3//
//40040030: e3530b02 cmp r3, #2048 ; 0x800//
//40040034: 1a000015 bne 40040090 <fec_recv+0x134>//
//40040038: e19730b5 ldrh r3, [r7, r5]//
//4004003c: e3530012 cmp r3, #18//
//40040040: da000012 ble 40040090 <fec_recv+0x134>//
//40040044: e5966004 ldr r6, [r6, #4]//
//40040048: e19750b5 ldrh r5, [r7, r5]//
//4004004c: e2455004 sub r5, r5, #4//
//40040050: e286103f add r1, r6, #63 ; 0x3f//
//40040054: e0811005 add r1, r1, r5//
//40040058: e3c6003f bic r0, r6, #63 ; 0x3f//
//4004005c: e3c1103f bic r1, r1, #63 ; 0x3f//
//40040060: ebff013f bl 40000564
<invalidate_dcache_range>//
//40040064: e1a00006 mov r0, r6//
//40040068: e1a01005 mov r1, r5//
//4004006c: ebfffe58 bl 4003f9d4 <swap_packet>//
//40040070: e1a01006 mov r1, r6//
//40040074: e1a02005 mov r2, r5//
//40040078: e59f00c8 ldr r0, [pc, #200] ; 40040148
<fec_recv+0x1ec>//
//4004007c: eb0030c4 bl 4004c394 <memcpy>//
//40040080: e59f00c0 ldr r0, [pc, #192] ; 40040148
<fec_recv+0x1ec>//
//40040084: e1a01005 mov r1, r5//
//40040088: eb00465e bl 40051a08 <NetReceive>//
//4004008c: ea000005 b 400400a8 <fec_recv+0x14c>//
//40040090: e2125037 ands r5, r2, #55 ; 0x37//
//40040094: 0a000003 beq 400400a8 <fec_recv+0x14c>//
//40040098: e5961004 ldr r1, [r6, #4]//
//4004009c: e59f00a8 ldr r0, [pc, #168] ; 4004014c
<fec_recv+0x1f0>//
//400400a0: ebff7678 bl 4001da88 <printf>//
//400400a4: e3a05000 mov r5, #0//
//400400a8: e594300c ldr r3, [r4, #12]//
//400400ac: e2032007 and r2, r3, #7//
//400400b0: e3520007 cmp r2, #7//
//400400b4: 1a000014 bne 4004010c <fec_recv+0x1b0>//
//400400b8: e5940008 ldr r0, [r4, #8]//
//400400bc: e243227e sub r2, r3, #-536870905 ;
0xe0000007//
//400400c0: e2433007 sub r3, r3, #7//
//400400c4: e0800183 add r0, r0, r3, lsl #3//
//400400c8: e1a02182 lsl r2, r2, #3//
//400400cc: ea000009 b 400400f8 <fec_recv+0x19c>//
//400400d0: e5941008 ldr r1, [r4, #8]//
//400400d4: e353003f cmp r3, #63 ; 0x3f//
//400400d8: 13a0e902 movne lr, #32768 ; 0x8000//
//400400dc: 03a0ea0a moveq lr, #40960 ; 0xa000//
//400400e0: e081c002 add ip, r1, r2//
//400400e4: e1cce0b2 strh lr, [ip, #2]//
//400400e8: e3a0c000 mov ip, #0//
//400400ec: e181c0b2 strh ip, [r1, r2]//
//400400f0: e2833001 add r3, r3, #1//
//400400f4: e2822008 add r2, r2, #8//
//400400f8: e594100c ldr r1, [r4, #12]//
//400400fc: e1530001 cmp r3, r1//
//40040100: dafffff2 ble 400400d0 <fec_recv+0x174>//
//40040104: e2801040 add r1, r0, #64 ; 0x40//
//40040108: ebff011f bl 4000058c <flush_dcache_range>//
//4004010c: e5943000 ldr r3, [r4]//
//40040110: e3a02401 mov r2, #16777216 ; 0x1000000//
//40040114: e5832010 str r2, [r3, #16]//
//40040118: e594300c ldr r3, [r4, #12]//
//4004011c: e2833001 add r3, r3, #1//
//40040120: e21331fe ands r3, r3, #-2147483585 ;
0x8000003f//
//40040124: 42433001 submi r3, r3, #1//
//40040128: 41e03d03 mvnmi r3, r3, lsl #26//
//4004012c: 41e03d23 mvnmi r3, r3, lsr #26//
//40040130: 42833001 addmi r3, r3, #1//
//40040134: e584300c str r3, [r4, #12]//
//40040138: e1a00005 mov r0, r5//
//4004013c: e8bd84f0 pop {r4, r5, r6, r7, sl, pc}//
//40040140: 40068c3b .word 0x40068c3b//
//40040144: 00000837 .word 0x00000837//
//40040148: 4008a880 .word 0x4008a880//
//4004014c: 40068c50 .word 0x40068c50//
/

Robert Hodaszi