mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
style(9) fixes, remove unnecessary headers, remove duplicate #defines and
in some cases, shuffle the code around to simplify locking. No functional changes. Sponsored by: Rubicon Communications, LLC (Netgate)
This commit is contained in:
parent
5bb27fe15c
commit
33c2a3cb16
2 changed files with 88 additions and 136 deletions
|
|
@ -28,40 +28,25 @@
|
|||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <arm/mv/mvwin.h>
|
||||
#include <arm/mv/mvreg.h>
|
||||
#include <arm/mv/mvvar.h>
|
||||
|
||||
#include <dev/etherswitch/etherswitch.h>
|
||||
#include <dev/mdio/mdio.h>
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
#include <dev/mge/if_mgevar.h>
|
||||
|
||||
#include <dev/fdt/fdt_common.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
|
||||
#include "e6000swreg.h"
|
||||
#include "etherswitch_if.h"
|
||||
|
|
@ -71,14 +56,10 @@ __FBSDID("$FreeBSD$");
|
|||
MALLOC_DECLARE(M_E6000SW);
|
||||
MALLOC_DEFINE(M_E6000SW, "e6000sw", "e6000sw switch");
|
||||
|
||||
#define E6000SW_LOCK(_sc) \
|
||||
sx_xlock(&(_sc)->sx)
|
||||
#define E6000SW_UNLOCK(_sc) \
|
||||
sx_unlock(&(_sc)->sx)
|
||||
#define E6000SW_LOCK_ASSERT(_sc, _what) \
|
||||
sx_assert(&(_sc)->sx, (_what))
|
||||
#define E6000SW_TRYLOCK(_sc) \
|
||||
sx_tryxlock(&(_sc)->sx)
|
||||
#define E6000SW_LOCK(_sc) sx_xlock(&(_sc)->sx)
|
||||
#define E6000SW_UNLOCK(_sc) sx_unlock(&(_sc)->sx)
|
||||
#define E6000SW_LOCK_ASSERT(_sc, _what) sx_assert(&(_sc)->sx, (_what))
|
||||
#define E6000SW_TRYLOCK(_sc) sx_tryxlock(&(_sc)->sx)
|
||||
|
||||
typedef struct e6000sw_softc {
|
||||
device_t dev;
|
||||
|
|
@ -108,46 +89,43 @@ static etherswitch_info_t etherswitch_info = {
|
|||
.es_name = "Marvell 6000 series switch"
|
||||
};
|
||||
|
||||
static void e6000sw_identify(driver_t *driver, device_t parent);
|
||||
static int e6000sw_probe(device_t dev);
|
||||
static int e6000sw_attach(device_t dev);
|
||||
static int e6000sw_detach(device_t dev);
|
||||
static int e6000sw_readphy(device_t dev, int phy, int reg);
|
||||
static int e6000sw_writephy(device_t dev, int phy, int reg, int data);
|
||||
static etherswitch_info_t* e6000sw_getinfo(device_t dev);
|
||||
static void e6000sw_lock(device_t dev);
|
||||
static void e6000sw_unlock(device_t dev);
|
||||
static int e6000sw_getport(device_t dev, etherswitch_port_t *p);
|
||||
static int e6000sw_setport(device_t dev, etherswitch_port_t *p);
|
||||
static int e6000sw_readreg_wrapper(device_t dev, int addr_reg);
|
||||
static int e6000sw_writereg_wrapper(device_t dev, int addr_reg, int val);
|
||||
static int e6000sw_readphy_wrapper(device_t dev, int phy, int reg);
|
||||
static int e6000sw_writephy_wrapper(device_t dev, int phy, int reg, int data);
|
||||
static int e6000sw_getvgroup_wrapper(device_t dev, etherswitch_vlangroup_t *vg);
|
||||
static int e6000sw_setvgroup_wrapper(device_t dev, etherswitch_vlangroup_t *vg);
|
||||
static int e6000sw_setvgroup(device_t dev, etherswitch_vlangroup_t *vg);
|
||||
static int e6000sw_getvgroup(device_t dev, etherswitch_vlangroup_t *vg);
|
||||
static void e6000sw_setup(device_t dev, e6000sw_softc_t *sc);
|
||||
static void e6000sw_port_vlan_conf(e6000sw_softc_t *sc);
|
||||
static void e6000sw_tick(void *arg);
|
||||
static void e6000sw_set_atustat(device_t dev, e6000sw_softc_t *sc, int bin,
|
||||
int flag);
|
||||
static int e6000sw_atu_flush(device_t dev, e6000sw_softc_t *sc, int flag);
|
||||
static __inline void e6000sw_writereg(e6000sw_softc_t *sc, int addr, int reg,
|
||||
int val);
|
||||
static __inline uint32_t e6000sw_readreg(e6000sw_softc_t *sc, int addr,
|
||||
int reg);
|
||||
static int e6000sw_ifmedia_upd(struct ifnet *ifp);
|
||||
static void e6000sw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
|
||||
static int e6000sw_atu_mac_table(device_t dev, e6000sw_softc_t *sc, struct
|
||||
atu_opt *atu, int flag);
|
||||
static int e6000sw_get_pvid(e6000sw_softc_t *sc, int port, int *pvid);
|
||||
static int e6000sw_set_pvid(e6000sw_softc_t *sc, int port, int pvid);
|
||||
static __inline int e6000sw_is_cpuport(e6000sw_softc_t *sc, int port);
|
||||
static __inline int e6000sw_is_fixedport(e6000sw_softc_t *sc, int port);
|
||||
static __inline int e6000sw_is_phyport(e6000sw_softc_t *sc, int port);
|
||||
static __inline struct mii_data *e6000sw_miiforphy(e6000sw_softc_t *sc,
|
||||
unsigned int phy);
|
||||
static void e6000sw_identify(driver_t *, device_t);
|
||||
static int e6000sw_probe(device_t);
|
||||
static int e6000sw_attach(device_t);
|
||||
static int e6000sw_detach(device_t);
|
||||
static int e6000sw_readphy(device_t, int, int);
|
||||
static int e6000sw_writephy(device_t, int, int, int);
|
||||
static etherswitch_info_t* e6000sw_getinfo(device_t);
|
||||
static void e6000sw_lock(device_t);
|
||||
static void e6000sw_unlock(device_t);
|
||||
static int e6000sw_getport(device_t, etherswitch_port_t *);
|
||||
static int e6000sw_setport(device_t, etherswitch_port_t *);
|
||||
static int e6000sw_readreg_wrapper(device_t, int);
|
||||
static int e6000sw_writereg_wrapper(device_t, int, int);
|
||||
static int e6000sw_readphy_wrapper(device_t, int, int);
|
||||
static int e6000sw_writephy_wrapper(device_t, int, int, int);
|
||||
static int e6000sw_getvgroup_wrapper(device_t, etherswitch_vlangroup_t *);
|
||||
static int e6000sw_setvgroup_wrapper(device_t, etherswitch_vlangroup_t *);
|
||||
static int e6000sw_setvgroup(device_t, etherswitch_vlangroup_t *);
|
||||
static int e6000sw_getvgroup(device_t, etherswitch_vlangroup_t *);
|
||||
static void e6000sw_setup(device_t, e6000sw_softc_t *);
|
||||
static void e6000sw_port_vlan_conf(e6000sw_softc_t *);
|
||||
static void e6000sw_tick(void *);
|
||||
static void e6000sw_set_atustat(device_t, e6000sw_softc_t *, int, int);
|
||||
static int e6000sw_atu_flush(device_t, e6000sw_softc_t *, int);
|
||||
static __inline void e6000sw_writereg(e6000sw_softc_t *, int, int, int);
|
||||
static __inline uint32_t e6000sw_readreg(e6000sw_softc_t *, int, int);
|
||||
static int e6000sw_ifmedia_upd(struct ifnet *);
|
||||
static void e6000sw_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
static int e6000sw_atu_mac_table(device_t, e6000sw_softc_t *, struct atu_opt *,
|
||||
int);
|
||||
static int e6000sw_get_pvid(e6000sw_softc_t *, int, int *);
|
||||
static int e6000sw_set_pvid(e6000sw_softc_t *, int, int);
|
||||
static __inline int e6000sw_is_cpuport(e6000sw_softc_t *, int);
|
||||
static __inline int e6000sw_is_fixedport(e6000sw_softc_t *, int);
|
||||
static __inline int e6000sw_is_phyport(e6000sw_softc_t *, int);
|
||||
static __inline struct mii_data *e6000sw_miiforphy(e6000sw_softc_t *,
|
||||
unsigned int);
|
||||
|
||||
static device_method_t e6000sw_methods[] = {
|
||||
/* device interface */
|
||||
|
|
@ -190,14 +168,17 @@ DRIVER_MODULE(etherswitch, e6000sw, etherswitch_driver, etherswitch_devclass, 0,
|
|||
DRIVER_MODULE(miibus, e6000sw, miibus_driver, miibus_devclass, 0, 0);
|
||||
MODULE_DEPEND(e6000sw, mdio, 1, 1, 1);
|
||||
|
||||
#define SMI_CMD 0
|
||||
#define SMI_CMD_BUSY (1<<15)
|
||||
#define SMI_CMD_OP_READ ((2<<10)|SMI_CMD_BUSY|(1<<12))
|
||||
#define SMI_CMD_OP_WRITE ((1<<10)|SMI_CMD_BUSY|(1<<12))
|
||||
#define SMI_DATA 1
|
||||
#define SMI_CMD 0
|
||||
#define SMI_CMD_BUSY (1 << 15)
|
||||
#define SMI_CMD_OP_READ ((2 << 10) | SMI_CMD_BUSY | (1 << 12))
|
||||
#define SMI_CMD_OP_WRITE ((1 << 10) | SMI_CMD_BUSY | (1 << 12))
|
||||
#define SMI_DATA 1
|
||||
|
||||
#define MDIO_READ(dev, addr, reg) \
|
||||
MDIO_READREG(device_get_parent(dev), (addr), (reg))
|
||||
#define MDIO_WRITE(dev, addr, reg, val) \
|
||||
MDIO_WRITEREG(device_get_parent(dev), (addr), (reg), (val))
|
||||
|
||||
#define MDIO_READ(dev, addr, reg) MDIO_READREG(device_get_parent(dev), (addr), (reg))
|
||||
#define MDIO_WRITE(dev, addr, reg, val) MDIO_WRITEREG(device_get_parent(dev), (addr), (reg), (val))
|
||||
static void
|
||||
e6000sw_identify(driver_t *driver, device_t parent)
|
||||
{
|
||||
|
|
@ -211,8 +192,8 @@ e6000sw_probe(device_t dev)
|
|||
{
|
||||
e6000sw_softc_t *sc;
|
||||
const char *description;
|
||||
unsigned int id;
|
||||
phandle_t dsa_node, switch_node;
|
||||
uint32_t id;
|
||||
|
||||
dsa_node = fdt_find_compatible(OF_finddevice("/"),
|
||||
"marvell,dsa", 0);
|
||||
|
|
@ -235,8 +216,8 @@ e6000sw_probe(device_t dev)
|
|||
/* Lock is necessary due to assertions. */
|
||||
sx_init(&sc->sx, "e6000sw");
|
||||
E6000SW_LOCK(sc);
|
||||
|
||||
id = e6000sw_readreg(sc, REG_PORT(0), SWITCH_ID);
|
||||
E6000SW_UNLOCK(sc);
|
||||
|
||||
switch (id & 0xfff0) {
|
||||
case 0x3520:
|
||||
|
|
@ -249,7 +230,6 @@ e6000sw_probe(device_t dev)
|
|||
description = "Marvell 88E6176";
|
||||
break;
|
||||
default:
|
||||
E6000SW_UNLOCK(sc);
|
||||
sx_destroy(&sc->sx);
|
||||
device_printf(dev, "Unrecognized device, id 0x%x.\n", id);
|
||||
return (ENXIO);
|
||||
|
|
@ -257,8 +237,6 @@ e6000sw_probe(device_t dev)
|
|||
|
||||
device_set_desc(dev, description);
|
||||
|
||||
E6000SW_UNLOCK(sc);
|
||||
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
|
|
@ -433,9 +411,9 @@ e6000sw_poll_done(e6000sw_softc_t *sc)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (i = 0; i < E6000SW_SMI_TIMEOUT; i++) {
|
||||
|
||||
if (!(e6000sw_readreg(sc, REG_GLOBAL2, PHY_CMD) &
|
||||
if (!(e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG) &
|
||||
(1 << PHY_CMD_SMI_BUSY)))
|
||||
return (0);
|
||||
|
||||
|
|
@ -457,8 +435,6 @@ e6000sw_readphy(device_t dev, int phy, int reg)
|
|||
int err;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
val = 0;
|
||||
|
||||
if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) {
|
||||
device_printf(dev, "Wrong register address.\n");
|
||||
return (EINVAL);
|
||||
|
|
@ -472,7 +448,7 @@ e6000sw_readphy(device_t dev, int phy, int reg)
|
|||
return (err);
|
||||
}
|
||||
|
||||
val |= 1 << PHY_CMD_SMI_BUSY;
|
||||
val = 1 << PHY_CMD_SMI_BUSY;
|
||||
val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE;
|
||||
val |= PHY_CMD_OPCODE_READ << PHY_CMD_OPCODE;
|
||||
val |= (reg << PHY_CMD_REG_ADDR) & PHY_CMD_REG_ADDR_MASK;
|
||||
|
|
@ -485,10 +461,9 @@ e6000sw_readphy(device_t dev, int phy, int reg)
|
|||
return (err);
|
||||
}
|
||||
|
||||
val = e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG)
|
||||
& PHY_DATA_MASK;
|
||||
val = e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG);
|
||||
|
||||
return (val);
|
||||
return (val & PHY_DATA_MASK);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -499,8 +474,6 @@ e6000sw_writephy(device_t dev, int phy, int reg, int data)
|
|||
int err;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
val = 0;
|
||||
|
||||
if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) {
|
||||
device_printf(dev, "Wrong register address.\n");
|
||||
return (EINVAL);
|
||||
|
|
@ -514,22 +487,20 @@ e6000sw_writephy(device_t dev, int phy, int reg, int data)
|
|||
return (err);
|
||||
}
|
||||
|
||||
val = 1 << PHY_CMD_SMI_BUSY;
|
||||
val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE;
|
||||
val |= 1 << PHY_CMD_SMI_BUSY;
|
||||
val |= PHY_CMD_OPCODE_WRITE << PHY_CMD_OPCODE;
|
||||
val |= (reg << PHY_CMD_REG_ADDR) & PHY_CMD_REG_ADDR_MASK;
|
||||
val |= (phy << PHY_CMD_DEV_ADDR) & PHY_CMD_DEV_ADDR_MASK;
|
||||
e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG,
|
||||
data & PHY_DATA_MASK);
|
||||
data & PHY_DATA_MASK);
|
||||
e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, val);
|
||||
|
||||
err = e6000sw_poll_done(sc);
|
||||
if (err != 0) {
|
||||
if (err != 0)
|
||||
device_printf(dev, "Timeout while waiting for switch\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return (err);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -589,18 +560,14 @@ e6000sw_getport(device_t dev, etherswitch_port_t *p)
|
|||
int err;
|
||||
struct ifmediareq *ifmr;
|
||||
|
||||
err = 0;
|
||||
e6000sw_softc_t *sc = device_get_softc(dev);
|
||||
E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED);
|
||||
|
||||
if (p->es_port >= sc->num_ports || p->es_port < 0)
|
||||
return (EINVAL);
|
||||
|
||||
err = 0;
|
||||
E6000SW_LOCK(sc);
|
||||
|
||||
if (p->es_port >= sc->num_ports ||
|
||||
p->es_port < 0) {
|
||||
err = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
e6000sw_get_pvid(sc, p->es_port, &p->es_pvid);
|
||||
|
||||
if (e6000sw_is_cpuport(sc, p->es_port)) {
|
||||
|
|
@ -623,9 +590,8 @@ e6000sw_getport(device_t dev, etherswitch_port_t *p)
|
|||
err = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr,
|
||||
&mii->mii_media, SIOCGIFMEDIA);
|
||||
}
|
||||
|
||||
out:
|
||||
E6000SW_UNLOCK(sc);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
|
@ -636,18 +602,14 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p)
|
|||
int err;
|
||||
struct mii_data *mii;
|
||||
|
||||
err = 0;
|
||||
sc = device_get_softc(dev);
|
||||
E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED);
|
||||
|
||||
if (p->es_port >= sc->num_ports || p->es_port < 0)
|
||||
return (EINVAL);
|
||||
|
||||
err = 0;
|
||||
E6000SW_LOCK(sc);
|
||||
|
||||
if (p->es_port >= sc->num_ports ||
|
||||
p->es_port < 0) {
|
||||
err = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (p->es_pvid != 0)
|
||||
e6000sw_set_pvid(sc, p->es_port, p->es_pvid);
|
||||
if (!e6000sw_is_cpuport(sc, p->es_port)) {
|
||||
|
|
@ -655,9 +617,8 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p)
|
|||
err = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, &mii->mii_media,
|
||||
SIOCSIFMEDIA);
|
||||
}
|
||||
|
||||
out:
|
||||
E6000SW_UNLOCK(sc);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
|
@ -773,12 +734,10 @@ e6000sw_flush_port(e6000sw_softc_t *sc, int port)
|
|||
{
|
||||
uint32_t reg;
|
||||
|
||||
reg = e6000sw_readreg(sc, REG_PORT(port),
|
||||
PORT_VLAN_MAP);
|
||||
reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP);
|
||||
reg &= ~PORT_VLAN_MAP_TABLE_MASK;
|
||||
reg &= ~PORT_VLAN_MAP_FID_MASK;
|
||||
e6000sw_writereg(sc, REG_PORT(port),
|
||||
PORT_VLAN_MAP, reg);
|
||||
e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg);
|
||||
if (sc->vgroup[port] != E6000SW_PORT_NO_VGROUP) {
|
||||
/*
|
||||
* If port belonged somewhere, owner-group
|
||||
|
|
@ -795,14 +754,12 @@ e6000sw_port_assign_vgroup(e6000sw_softc_t *sc, int port, int fid, int vgroup,
|
|||
{
|
||||
uint32_t reg;
|
||||
|
||||
reg = e6000sw_readreg(sc, REG_PORT(port),
|
||||
PORT_VLAN_MAP);
|
||||
reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP);
|
||||
reg &= ~PORT_VLAN_MAP_TABLE_MASK;
|
||||
reg &= ~PORT_VLAN_MAP_FID_MASK;
|
||||
reg |= members & ~(1 << port);
|
||||
reg |= (fid << PORT_VLAN_MAP_FID) & PORT_VLAN_MAP_FID_MASK;
|
||||
e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP,
|
||||
reg);
|
||||
e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg);
|
||||
sc->vgroup[port] = vgroup;
|
||||
}
|
||||
|
||||
|
|
@ -897,19 +854,18 @@ e6000sw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
|||
ifmr->ifm_status = mii->mii_media_status;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
e6000sw_smi_waitready(e6000sw_softc_t *sc, int phy)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < E6000SW_SMI_TIMEOUT; i++) {
|
||||
if ((MDIO_READ(sc->dev, phy, SMI_CMD)
|
||||
& SMI_CMD_BUSY) == 0)
|
||||
return 0;
|
||||
if ((MDIO_READ(sc->dev, phy, SMI_CMD) & SMI_CMD_BUSY) == 0)
|
||||
return (0);
|
||||
DELAY(1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
|
|
@ -925,8 +881,8 @@ e6000sw_readreg(e6000sw_softc_t *sc, int addr, int reg)
|
|||
printf("e6000sw: readreg timeout\n");
|
||||
return (0xffff);
|
||||
}
|
||||
MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD, SMI_CMD_OP_READ |
|
||||
(addr << 5) | reg);
|
||||
MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD,
|
||||
SMI_CMD_OP_READ | (addr << 5) | reg);
|
||||
if (e6000sw_smi_waitready(sc, sc->sw_addr)) {
|
||||
printf("e6000sw: readreg timeout\n");
|
||||
return (0xffff);
|
||||
|
|
@ -951,14 +907,12 @@ e6000sw_writereg(e6000sw_softc_t *sc, int addr, int reg, int val)
|
|||
return;
|
||||
}
|
||||
MDIO_WRITE(sc->dev, sc->sw_addr, SMI_DATA, val);
|
||||
MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD, SMI_CMD_OP_WRITE |
|
||||
(addr << 5) | reg);
|
||||
MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD,
|
||||
SMI_CMD_OP_WRITE | (addr << 5) | reg);
|
||||
if (e6000sw_smi_waitready(sc, sc->sw_addr)) {
|
||||
printf("e6000sw: readreg timeout\n");
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
|
|
|
|||
|
|
@ -155,8 +155,6 @@ struct atu_opt {
|
|||
#define SMI_PHY_CMD_REG 0x18
|
||||
#define SMI_PHY_DATA_REG 0x19
|
||||
|
||||
#define PHY_CMD 0x18
|
||||
#define PHY_DATA 0x19
|
||||
#define PHY_DATA_MASK 0xffff
|
||||
|
||||
#define PHY_CMD_SMI_BUSY 15
|
||||
|
|
|
|||
Loading…
Reference in a new issue