mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 02:48:21 +00:00
93 lines
2.0 KiB
C
93 lines
2.0 KiB
C
/*
|
|
* Combined Ethernet driver for Motorola MPC8xx and MPC82xx.
|
|
*
|
|
* Copyright (c) 2003 Intracom S.A.
|
|
* by Pantelis Antoniou <panto@intracom.gr>
|
|
*
|
|
* 2005 (c) MontaVista Software, Inc.
|
|
* Vitaly Bordug <vbordug@ru.mvista.com>
|
|
*
|
|
* This file is licensed under the terms of the GNU General Public License
|
|
* version 2. This program is licensed "as is" without any warranty of any
|
|
* kind, whether express or implied.
|
|
*/
|
|
|
|
|
|
#include <linux/config.h>
|
|
#include <linux/module.h>
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/string.h>
|
|
#include <linux/ptrace.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/init.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/etherdevice.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/mii.h>
|
|
#include <linux/ethtool.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/uaccess.h>
|
|
|
|
#include "fs_enet.h"
|
|
|
|
static const u16 mii_regs[7] = {
|
|
0x3100,
|
|
0x786d,
|
|
0x0fff,
|
|
0x0fff,
|
|
0x01e1,
|
|
0x45e1,
|
|
0x0003,
|
|
};
|
|
|
|
static int mii_read(struct fs_enet_mii_bus *bus, int phy_id, int location)
|
|
{
|
|
int ret = 0;
|
|
|
|
if ((unsigned int)location >= ARRAY_SIZE(mii_regs))
|
|
return -1;
|
|
|
|
if (location != 5)
|
|
ret = mii_regs[location];
|
|
else
|
|
ret = bus->fixed.lpa;
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void mii_write(struct fs_enet_mii_bus *bus, int phy_id, int location, int val)
|
|
{
|
|
/* do nothing */
|
|
}
|
|
|
|
int fs_mii_fixed_init(struct fs_enet_mii_bus *bus)
|
|
{
|
|
const struct fs_mii_bus_info *bi = bus->bus_info;
|
|
|
|
bus->fixed.lpa = 0x45e1; /* default 100Mb, full duplex */
|
|
|
|
/* if speed is fixed at 10Mb, remove 100Mb modes */
|
|
if (bi->i.fixed.speed == 10)
|
|
bus->fixed.lpa &= ~LPA_100;
|
|
|
|
/* if duplex is half, remove full duplex modes */
|
|
if (bi->i.fixed.duplex == 0)
|
|
bus->fixed.lpa &= ~LPA_DUPLEX;
|
|
|
|
bus->mii_read = mii_read;
|
|
bus->mii_write = mii_write;
|
|
|
|
return 0;
|
|
}
|