]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/e1000.c
ARM: omap3: evm: Refactor 'board_eth_init'
[u-boot] / drivers / net / e1000.c
index 2f2185d8f188110e1b1b6d871686a311cd80349b..875682b1b89e1ee31b7226e646be3c108b850933 100644 (file)
@@ -1522,11 +1522,10 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC;
                E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1);
 
-       /* IGB is cool */
-       if (hw->mac_type == e1000_igb)
-               return;
 
                switch (hw->mac_type) {
+               case e1000_igb:                 /* IGB is cool */
+                       return;
                case e1000_82571:
                case e1000_82572:
                        /* Clear PHY TX compatible mode bits */
@@ -5453,7 +5452,7 @@ e1000_initialize(bd_t * bis)
        for (i = 0; (devno = pci_find_devices(e1000_supported, i)) >= 0; i++) {
                /*
                 * These will never get freed due to errors, this allows us to
-                * perform SPI EEPROM programming from U-boot, for example.
+                * perform SPI EEPROM programming from U-Boot, for example.
                 */
                struct eth_device *nic = malloc(sizeof(*nic));
                struct e1000_hw *hw = malloc(sizeof(*hw));
@@ -5513,7 +5512,8 @@ static int do_e1000(cmd_tbl_t *cmdtp, int flag,
        struct udevice *dev;
        char name[30];
        int ret;
-#else
+#endif
+#if !defined(CONFIG_DM_ETH) || defined(CONFIG_E1000_SPI)
        struct e1000_hw *hw;
 #endif
        int cardnum;
@@ -5549,6 +5549,9 @@ static int do_e1000(cmd_tbl_t *cmdtp, int flag,
        }
 
 #ifdef CONFIG_E1000_SPI
+#ifdef CONFIG_DM_ETH
+       hw = dev_get_priv(dev);
+#endif
        /* Handle the "SPI" subcommand */
        if (!strcmp(argv[2], "spi"))
                return do_e1000_spi(cmdtp, hw, argc - 3, argv + 3);