]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/dm9000.c
[ARM] 4911/1: [AT91] LEDs on SAM9260-EK and SAM9261-EK boards
[linux-2.6-omap-h63xx.git] / drivers / net / dm9000.c
index afd2cf509073382dfc11bc17d143577b78846b56..1fe305ca2cf0b42bb8a5a90e80918924a90ac2f8 100644 (file)
@@ -142,6 +142,7 @@ static int dm9000_probe(struct platform_device *);
 static int dm9000_open(struct net_device *);
 static int dm9000_start_xmit(struct sk_buff *, struct net_device *);
 static int dm9000_stop(struct net_device *);
+static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
 
 static void dm9000_init_dm9000(struct net_device *);
 
@@ -332,6 +333,16 @@ static void dm9000_poll_controller(struct net_device *dev)
 }
 #endif
 
+static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
+{
+       board_info_t *dm = to_dm9000_board(dev);
+
+       if (!netif_running(dev))
+               return -EINVAL;
+
+       return generic_mii_ioctl(&dm->mii, if_mii(req), cmd, NULL);
+}
+
 /* ethtool ops */
 
 static void dm9000_get_drvinfo(struct net_device *dev,
@@ -498,6 +509,7 @@ dm9000_probe(struct platform_device *pdev)
        struct dm9000_plat_data *pdata = pdev->dev.platform_data;
        struct board_info *db;  /* Point a board information structure */
        struct net_device *ndev;
+       const unsigned char *mac_src;
        unsigned long base;
        int ret = 0;
        int iosize;
@@ -632,7 +644,7 @@ dm9000_probe(struct platform_device *pdev)
        dm9000_reset(db);
 
        /* try two times, DM9000 sometimes gets the first read wrong */
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < 8; i++) {
                id_val  = ior(db, DM9000_VIDL);
                id_val |= (u32)ior(db, DM9000_VIDH) << 8;
                id_val |= (u32)ior(db, DM9000_PIDL) << 16;
@@ -661,6 +673,7 @@ dm9000_probe(struct platform_device *pdev)
        ndev->stop               = &dm9000_stop;
        ndev->set_multicast_list = &dm9000_hash_table;
        ndev->ethtool_ops        = &dm9000_ethtool_ops;
+       ndev->do_ioctl           = &dm9000_ioctl;
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
        ndev->poll_controller    = &dm9000_poll_controller;
@@ -675,13 +688,16 @@ dm9000_probe(struct platform_device *pdev)
        db->mii.mdio_read    = dm9000_phy_read;
        db->mii.mdio_write   = dm9000_phy_write;
 
+       mac_src = "eeprom";
+
        /* try reading the node address from the attached EEPROM */
        for (i = 0; i < 6; i += 2)
                dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {
                /* try reading from mac */
-
+               
+               mac_src = "chip";
                for (i = 0; i < 6; i++)
                        ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
        }
@@ -695,9 +711,9 @@ dm9000_probe(struct platform_device *pdev)
 
        if (ret == 0) {
                DECLARE_MAC_BUF(mac);
-               printk("%s: dm9000 at %p,%p IRQ %d MAC: %s\n",
+               printk("%s: dm9000 at %p,%p IRQ %d MAC: %s (%s)\n",
                       ndev->name,  db->io_addr, db->io_data, ndev->irq,
-                      print_mac(mac, ndev->dev_addr));
+                      print_mac(mac, ndev->dev_addr), mac_src);
        }
        return 0;