# # Author: Robert Schwebel # # Description: ChangeLog: # # * Patch by Robert Schwebel, 2003-05-14: # call mac address reading code also for SMSC91C111; # fix output of printks to use space after colon # consistently; don't wait for about 10 seconds timeout # when no cable is plugged in; remove duplicate printks # # State: 2004-05-15: submitted # # # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher # --- u-boot-maintainance1/lib_arm/board.c~submit-smsc91111 2004-05-14 19:02:46.000000000 +0200 +++ u-boot-maintainance1/lib_arm/board.c 2004-05-14 19:02:48.000000000 +0200 @@ -32,6 +32,13 @@ #include #include +#ifdef CONFIG_DRIVER_SMC91111 +#include "../drivers/smc91111.h" +#endif +#ifdef CONFIG_DRIVER_LAN91C96 +#include "../drivers/lan91c96.h" +#endif + #if (CONFIG_COMMANDS & CFG_CMD_NAND) void nand_init (void); #endif @@ -58,9 +65,6 @@ extern void rtl8019_get_enetaddr (uchar * addr); #endif -#ifdef CONFIG_DRIVER_LAN91C96 -#include "../drivers/lan91c96.h" -#endif /* * Begin and End of memory area for malloc(), and current "brk" */ @@ -302,12 +306,13 @@ cs8900_get_enetaddr (gd->bd->bi_enetaddr); #endif -#ifdef CONFIG_DRIVER_LAN91C96 +#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96) if (getenv ("ethaddr")) { + puts("Configuring MAC address for network card\n"); smc_set_mac_addr(gd->bd->bi_enetaddr); } - /* eth_hw_init(); */ -#endif /* CONFIG_DRIVER_LAN91C96 */ + eth_init(gd->bd); +#endif /* Initialize from environment */ if ((s = getenv ("loadaddr")) != NULL) { --- u-boot-maintainance1/drivers/smc91111.c~submit-smsc91111 2004-05-14 19:02:46.000000000 +0200 +++ u-boot-maintainance1/drivers/smc91111.c 2004-05-14 19:02:48.000000000 +0200 @@ -61,6 +61,7 @@ #include #include +#include #include "smc91111.h" #include @@ -78,6 +79,11 @@ "smc91111.c:v1.0 04/25/01 by Daris A Nevil (dnevil@snmc.com)\n"; #endif +/* Autonegotiation timeout in seconds */ +#ifndef CONFIG_SMC_AUTONEG_TIMEOUT +#define CONFIG_SMC_AUTONEG_TIMEOUT 10 +#endif + /*------------------------------------------------------------------------ . . Configuration options, for the experienced user to change. @@ -353,7 +359,7 @@ */ static void smc_reset (void) { - PRINTK2 ("%s:smc_reset\n", SMC_DEV_NAME); + PRINTK2 ("%s: smc_reset\n", SMC_DEV_NAME); /* This resets the registers mostly to defaults, but doesn't affect EEPROM. That seems unnecessary */ @@ -414,7 +420,7 @@ */ static void smc_enable() { - PRINTK2("%s:smc_enable\n", SMC_DEV_NAME); + PRINTK2("%s: smc_enable\n", SMC_DEV_NAME); SMC_SELECT_BANK( 0 ); /* see the header file for options in TCR/RCR DEFAULT*/ SMC_outw( TCR_DEFAULT, TCR_REG ); @@ -440,7 +446,7 @@ */ static void smc_shutdown() { - PRINTK2(CARDNAME ":smc_shutdown\n"); + PRINTK2(CARDNAME ": smc_shutdown\n"); /* no more interrupts for me */ SMC_SELECT_BANK( 2 ); @@ -489,7 +495,7 @@ saved_pnr = SMC_inb( PN_REG ); saved_ptr = SMC_inw( PTR_REG ); - PRINTK3 ("%s:smc_hardware_send_packet\n", SMC_DEV_NAME); + PRINTK3 ("%s: smc_hardware_send_packet\n", SMC_DEV_NAME); length = ETH_ZLEN < packet_length ? packet_length : ETH_ZLEN; @@ -677,7 +683,7 @@ */ void smc_destructor() { - PRINTK2(CARDNAME ":smc_destructor\n"); + PRINTK2(CARDNAME ": smc_destructor\n"); } @@ -691,7 +697,7 @@ { int i, err; - PRINTK2 ("%s:smc_open\n", SMC_DEV_NAME); + PRINTK2 ("%s: smc_open\n", SMC_DEV_NAME); /* reset the hardware */ smc_reset (); @@ -764,7 +770,7 @@ return 0; } - PRINTK3("%s:smc_rcv\n", SMC_DEV_NAME); + PRINTK3("%s: smc_rcv\n", SMC_DEV_NAME); /* start reading from the start of the packet */ SMC_outw( PTR_READ | PTR_RCV | PTR_AUTOINC, PTR_REG ); @@ -860,7 +866,7 @@ -----------------------------------------------------*/ static int smc_close() { - PRINTK2("%s:smc_close\n", SMC_DEV_NAME); + PRINTK2("%s: smc_close\n", SMC_DEV_NAME); /* clear everything */ smc_shutdown(); @@ -1222,7 +1228,7 @@ word status = 0; /*;my status = 0 */ int failed = 0; - PRINTK3 ("%s:smc_program_phy()\n", SMC_DEV_NAME); + PRINTK3 ("%s: smc_program_phy()\n", SMC_DEV_NAME); /* Get the detected phy address */ @@ -1286,8 +1292,8 @@ /* the link does not come up. */ smc_read_phy_register(PHY_AD_REG); - PRINTK2 ("%s:phy caps=%x\n", SMC_DEV_NAME, my_phy_caps); - PRINTK2 ("%s:phy advertised caps=%x\n", SMC_DEV_NAME, my_ad_caps); + PRINTK2 ("%s: phy caps=%x\n", SMC_DEV_NAME, my_phy_caps); + PRINTK2 ("%s: phy advertised caps=%x\n", SMC_DEV_NAME, my_ad_caps); /* Restart auto-negotiation process in order to advertise my caps */ smc_write_phy_register (PHY_CNTL_REG, @@ -1296,8 +1302,9 @@ /* Wait for the auto-negotiation to complete. This may take from */ /* 2 to 3 seconds. */ /* Wait for the reset to complete, or time out */ - timeout = 20; /* Wait up to 10 seconds */ + timeout = CONFIG_SMC_AUTONEG_TIMEOUT * 2; while (timeout--) { + status = smc_read_phy_register (PHY_STAT_REG); if (status & PHY_STAT_ANEG_ACK) { /* auto-negotiate complete */ @@ -1308,11 +1315,11 @@ /* Restart auto-negotiation if remote fault */ if (status & PHY_STAT_REM_FLT) { - printf ("%s:PHY remote fault detected\n", + printf ("%s: PHY remote fault detected\n", SMC_DEV_NAME); /* Restart auto-negotiation */ - printf ("%s:PHY restarting auto-negotiation\n", + printf ("%s: PHY restarting auto-negotiation\n", SMC_DEV_NAME); smc_write_phy_register (PHY_CNTL_REG, PHY_CNTL_ANEG_EN | @@ -1323,15 +1330,13 @@ } if (timeout < 1) { - printf ("%s:PHY auto-negotiate timed out\n", SMC_DEV_NAME); - printf ("%s:PHY auto-negotiate timed out\n", SMC_DEV_NAME); + printf ("%s: PHY auto-negotiate timed out\n", SMC_DEV_NAME); failed = 1; } /* Fail if we detected an auto-negotiate remote fault */ if (status & PHY_STAT_REM_FLT) { - printf ("%s:PHY remote fault detected\n", SMC_DEV_NAME); - printf ("%s:PHY remote fault detected\n", SMC_DEV_NAME); + printf ("%s: PHY remote fault detected\n", SMC_DEV_NAME); failed = 1; } @@ -1469,12 +1474,16 @@ return (1); #else int i; + int valid_mac = 0; + SMC_SELECT_BANK (1); for (i=0; i<6; i++) { v_rom_mac[i] = SMC_inb (ADDR0_REG + i); + valid_mac |= v_rom_mac[i]; } - return (1); + + return (valid_mac ? 1 : 0); #endif } #endif /* CONFIG_DRIVER_SMC91111 */ --- u-boot-maintainance1/include/configs/innokom.h~submit-smsc91111 2004-05-14 19:02:46.000000000 +0200 +++ u-boot-maintainance1/include/configs/innokom.h 2004-05-14 19:17:19.000000000 +0200 @@ -140,6 +140,7 @@ #define CONFIG_SMC91111_BASE 0x14000000 /* chip select 5 */ #undef CONFIG_SMC_USE_32_BIT /* 16 bit bus access */ #undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */ +#define CONFIG_SMC_AUTONEG_TIMEOUT 10 /* timeout 10 seconds */ #undef CONFIG_SHOW_ACTIVITY #define CONFIG_NET_RETRY_COUNT 10 /* # of retries */