2 * Combined Ethernet driver for Motorola MPC8xx and MPC82xx.
4 * Copyright (c) 2003 Intracom S.A.
5 * by Pantelis Antoniou <panto@intracom.gr>
7 * 2005 (c) MontaVista Software, Inc.
8 * Vitaly Bordug <vbordug@ru.mvista.com>
10 * This file is licensed under the terms of the GNU General Public License
11 * version 2. This program is licensed "as is" without any warranty of any
12 * kind, whether express or implied.
16 #include <linux/module.h>
17 #include <linux/types.h>
18 #include <linux/kernel.h>
19 #include <linux/sched.h>
20 #include <linux/string.h>
21 #include <linux/ptrace.h>
22 #include <linux/errno.h>
23 #include <linux/ioport.h>
24 #include <linux/slab.h>
25 #include <linux/interrupt.h>
26 #include <linux/pci.h>
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/netdevice.h>
30 #include <linux/etherdevice.h>
31 #include <linux/skbuff.h>
32 #include <linux/spinlock.h>
33 #include <linux/mii.h>
34 #include <linux/ethtool.h>
35 #include <linux/bitops.h>
37 #include <asm/pgtable.h>
39 #include <asm/uaccess.h>
43 static const u16 mii_regs[7] = {
53 static int mii_read(struct fs_enet_mii_bus *bus, int phy_id, int location)
57 if ((unsigned int)location >= ARRAY_SIZE(mii_regs))
61 ret = mii_regs[location];
68 static void mii_write(struct fs_enet_mii_bus *bus, int phy_id, int location, int val)
73 int fs_mii_fixed_init(struct fs_enet_mii_bus *bus)
75 const struct fs_mii_bus_info *bi = bus->bus_info;
77 bus->fixed.lpa = 0x45e1; /* default 100Mb, full duplex */
79 /* if speed is fixed at 10Mb, remove 100Mb modes */
80 if (bi->i.fixed.speed == 10)
81 bus->fixed.lpa &= ~LPA_100;
83 /* if duplex is half, remove full duplex modes */
84 if (bi->i.fixed.duplex == 0)
85 bus->fixed.lpa &= ~LPA_DUPLEX;
87 bus->mii_read = mii_read;
88 bus->mii_write = mii_write;