Commit 487778b781257831aa9b9140dd3c7ad4176e8314

Authored by wdenk
1 parent 8b601449e8

Patch by Robert Schwebel, April 02, 2003:

fix for SMSC91111 driver

Showing 3 changed files with 18 additions and 1 deletions Side-by-side Diff

... ... @@ -2,6 +2,9 @@
2 2 Changes since U-Boot 0.3.1:
3 3 ======================================================================
4 4  
  5 +* Patch by Robert Schwebel, April 02, 2003:
  6 + fix for SMSC91111 driver
  7 +
5 8 * Patch by Vladimir Gurevich, 04 Jun 2003:
6 9 make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option
7 10  
... ... @@ -317,6 +317,17 @@
317 317 return 0;
318 318 }
319 319  
  320 +/* Only one release command at a time, please */
  321 +static inline void smc_wait_mmu_release_complete(void)
  322 +{
  323 + int count = 0;
  324 + /* assume bank 2 selected */
  325 + while ( SMC_inw(MMU_CMD_REG) & MC_BUSY ) {
  326 + udelay(1); // Wait until not busy
  327 + if( ++count > 200) break;
  328 + }
  329 +}
  330 +
320 331 /*
321 332 . Function: smc_reset( void )
322 333 . Purpose:
... ... @@ -374,6 +385,7 @@
374 385  
375 386 /* Reset the MMU */
376 387 SMC_SELECT_BANK( 2 );
  388 + smc_wait_mmu_release_complete();
377 389 SMC_outw( MC_RESET, MMU_CMD_REG );
378 390 while ( SMC_inw( MMU_CMD_REG ) & MC_BUSY )
379 391 udelay(1); /* Wait until not busy */
... ... @@ -673,6 +685,8 @@
673 685 /* conservative setting (10Mbps, HalfDuplex, no AutoNeg.) */
674 686 /* SMC_SELECT_BANK(0); */
675 687 /* SMC_outw(0, RPC_REG); */
  688 +
  689 + SMC_SELECT_BANK(1);
676 690  
677 691 #ifdef USE_32_BIT
678 692 for ( i = 0; i < 6; i += 2 ) {
... ... @@ -80,7 +80,7 @@
80 80 #define SMC_inw(r) (*((volatile word *)(SMC_BASE_ADDRESS+(r))))
81 81 #define SMC_inb(p) ({ \
82 82 unsigned int __p = (unsigned int)(SMC_BASE_ADDRESS + (p)); \
83   - unsigned int __v = *(volatile unsigned short *)((SMC_BASE_ADDRESS + __p) & ~1); \
  83 + unsigned int __v = *(volatile unsigned short *)((__p) & ~1); \
84 84 if (__p & 1) __v >>= 8; \
85 85 else __v &= 0xff; \
86 86 __v; })