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/config.h>
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/kernel.h>
20 #include <linux/sched.h>
21 #include <linux/string.h>
22 #include <linux/ptrace.h>
23 #include <linux/errno.h>
24 #include <linux/ioport.h>
25 #include <linux/slab.h>
26 #include <linux/interrupt.h>
27 #include <linux/pci.h>
28 #include <linux/init.h>
29 #include <linux/delay.h>
30 #include <linux/netdevice.h>
31 #include <linux/etherdevice.h>
32 #include <linux/skbuff.h>
33 #include <linux/spinlock.h>
34 #include <linux/mii.h>
35 #include <linux/ethtool.h>
36 #include <linux/bitops.h>
38 #include <asm/pgtable.h>
40 #include <asm/uaccess.h>
44 static const u16 mii_regs
[7] = {
54 static int mii_read(struct fs_enet_mii_bus
*bus
, int phy_id
, int location
)
58 if ((unsigned int)location
>= ARRAY_SIZE(mii_regs
))
62 ret
= mii_regs
[location
];
69 static void mii_write(struct fs_enet_mii_bus
*bus
, int phy_id
, int location
, int val
)
74 int fs_mii_fixed_init(struct fs_enet_mii_bus
*bus
)
76 const struct fs_mii_bus_info
*bi
= bus
->bus_info
;
78 bus
->fixed
.lpa
= 0x45e1; /* default 100Mb, full duplex */
80 /* if speed is fixed at 10Mb, remove 100Mb modes */
81 if (bi
->i
.fixed
.speed
== 10)
82 bus
->fixed
.lpa
&= ~LPA_100
;
84 /* if duplex is half, remove full duplex modes */
85 if (bi
->i
.fixed
.duplex
== 0)
86 bus
->fixed
.lpa
&= ~LPA_DUPLEX
;
88 bus
->mii_read
= mii_read
;
89 bus
->mii_write
= mii_write
;