mpc7448hpc2: Add CONFIG_SYS_I2C_SPEED define
[platform/kernel/u-boot.git] / net / net.c
index a89f6a0..5637cf5 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -209,8 +209,6 @@ uchar               NetArpWaitPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
 ulong          NetArpWaitTimerStart;
 int            NetArpWaitTry;
 
-int            env_changed_id = 0;
-
 void ArpRequest (void)
 {
        int i;
@@ -278,76 +276,25 @@ void ArpTimeoutCheck(void)
        }
 }
 
-int
+static void
 NetInitLoop(proto_t protocol)
 {
+       static int env_changed_id = 0;
        bd_t *bd = gd->bd;
        int env_id = get_env_id ();
 
        /* update only when the environment has changed */
-       if (env_changed_id == env_id)
-               return 0;
-
-       switch (protocol) {
-#if defined(CONFIG_CMD_NFS)
-       case NFS:
-#endif
-#if defined(CONFIG_CMD_PING)
-       case PING:
-#endif
-#if defined(CONFIG_CMD_SNTP)
-       case SNTP:
-#endif
-       case NETCONS:
-       case TFTP:
+       if (env_changed_id != env_id) {
                NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
                NetOurGatewayIP = getenv_IPaddr ("gatewayip");
                NetOurSubnetMask= getenv_IPaddr ("netmask");
-               NetOurVLAN = getenv_VLAN("vlan");
-               NetOurNativeVLAN = getenv_VLAN("nvlan");
-
-               switch (protocol) {
-#if defined(CONFIG_CMD_NFS)
-               case NFS:
-#endif
-               case NETCONS:
-               case TFTP:
-                       NetServerIP = getenv_IPaddr ("serverip");
-                       break;
-#if defined(CONFIG_CMD_PING)
-               case PING:
-                       /* nothing */
-                       break;
-#endif
-#if defined(CONFIG_CMD_SNTP)
-               case SNTP:
-                       /* nothing */
-                       break;
-#endif
-               default:
-                       break;
-               }
-
-               break;
-       case BOOTP:
-       case RARP:
-               /*
-                * initialize our IP addr to 0 in order to accept ANY
-                * IP addr assigned to us by the BOOTP / RARP server
-                */
-               NetOurIP = 0;
                NetServerIP = getenv_IPaddr ("serverip");
-               NetOurVLAN = getenv_VLAN("vlan");       /* VLANs must be read */
                NetOurNativeVLAN = getenv_VLAN("nvlan");
-       case CDP:
-               NetOurVLAN = getenv_VLAN("vlan");       /* VLANs must be read */
-               NetOurNativeVLAN = getenv_VLAN("nvlan");
-               break;
-       default:
-               break;
+               NetOurVLAN = getenv_VLAN("vlan");
+               env_changed_id = env_id;
        }
-       env_changed_id = env_id;
-       return 0;
+
+       return;
 }
 
 /**********************************************************************/
@@ -440,10 +387,7 @@ restart:
 
 #if defined(CONFIG_CMD_DHCP)
                case DHCP:
-                       /* Start with a clean slate... */
                        BootpTry = 0;
-                       NetOurIP = 0;
-                       NetServerIP = getenv_IPaddr ("serverip");
                        DhcpRequest();          /* Basically same as BOOTP */
                        break;
 #endif