arswitch(4): Remove support for AR{7240,9340} found in MIPS SoCs only
With the general removal of MIPS support there's no longer a need to support these integrated switches. Approved by: adrian Differential Revision: https://reviews.freebsd.org/D41394
This commit is contained in:
parent
077ef5b445
commit
8f5dbc22e5
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 19, 2021
|
||||
.Dd August 8, 2023
|
||||
.Dt ARSWITCH 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -39,9 +39,7 @@ The
|
||||
.Nm
|
||||
device driver provides a management interface to multiple Atheros
|
||||
fast ethernet switch chips:
|
||||
.Bl -tag -compact -width "AR7240"
|
||||
.It AR7240
|
||||
Wireless Network Processor SOC with five Fast Ethernet PHYs
|
||||
.Bl -tag -compact -width "AR8216"
|
||||
.It AR8216
|
||||
Fast Ethernet Switch
|
||||
.It AR8226
|
||||
@ -49,8 +47,6 @@ Fast Ethernet Switch
|
||||
Six-port Gigabit Ethernet Switch
|
||||
.It AR8327
|
||||
Seven-port Gigabit Ethernet Switch
|
||||
.It AR9340
|
||||
Wireless networking SoC
|
||||
.El
|
||||
.Pp
|
||||
The driver uses an
|
||||
|
@ -1648,8 +1648,6 @@ dev/etherswitch/arswitch/arswitch_8216.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_8226.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_8316.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_8327.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_7240.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_9340.c optional arswitch
|
||||
dev/etherswitch/arswitch/arswitch_vlans.c optional arswitch
|
||||
dev/etherswitch/etherswitch.c optional etherswitch
|
||||
dev/etherswitch/etherswitch_if.m optional etherswitch
|
||||
|
@ -64,12 +64,10 @@
|
||||
#include <dev/etherswitch/arswitch/arswitch_phy.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_vlans.h>
|
||||
|
||||
#include <dev/etherswitch/arswitch/arswitch_7240.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_8216.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_8226.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_8316.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_8327.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_9340.h>
|
||||
|
||||
#include "mdio_if.h"
|
||||
#include "miibus_if.h"
|
||||
@ -105,24 +103,6 @@ arswitch_probe(device_t dev)
|
||||
bzero(sc, sizeof(*sc));
|
||||
sc->page = -1;
|
||||
|
||||
/* AR7240 probe */
|
||||
if (ar7240_probe(dev) == 0) {
|
||||
chipname = "AR7240";
|
||||
sc->sc_switchtype = AR8X16_SWITCH_AR7240;
|
||||
sc->is_internal_switch = 1;
|
||||
id = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* AR9340 probe */
|
||||
if (ar9340_probe(dev) == 0) {
|
||||
chipname = "AR9340";
|
||||
sc->sc_switchtype = AR8X16_SWITCH_AR9340;
|
||||
sc->is_internal_switch = 1;
|
||||
id = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* AR8xxx probe */
|
||||
id = arswitch_readreg(dev, AR8X16_REG_MASK_CTRL);
|
||||
sc->chip_rev = (id & AR8X16_MASK_CTRL_REV_MASK);
|
||||
@ -152,8 +132,6 @@ arswitch_probe(device_t dev)
|
||||
chipname = NULL;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
DPRINTF(sc, ARSWITCH_DBG_ANY, "chipname=%s, id=%08x\n", chipname, id);
|
||||
if (chipname != NULL) {
|
||||
snprintf(desc, sizeof(desc),
|
||||
@ -589,11 +567,7 @@ arswitch_attach(device_t dev)
|
||||
/*
|
||||
* Attach switch related functions
|
||||
*/
|
||||
if (AR8X16_IS_SWITCH(sc, AR7240))
|
||||
ar7240_attach(sc);
|
||||
else if (AR8X16_IS_SWITCH(sc, AR9340))
|
||||
ar9340_attach(sc);
|
||||
else if (AR8X16_IS_SWITCH(sc, AR8216))
|
||||
if (AR8X16_IS_SWITCH(sc, AR8216))
|
||||
ar8216_attach(sc);
|
||||
else if (AR8X16_IS_SWITCH(sc, AR8226))
|
||||
ar8226_attach(sc);
|
||||
|
@ -1,147 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2011-2012 Stefan Bethke.
|
||||
* Copyright (c) 2012 Adrian Chadd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <dev/iicbus/iic.h>
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
#include <dev/mdio/mdio.h>
|
||||
|
||||
#include <dev/etherswitch/etherswitch.h>
|
||||
|
||||
#include <dev/etherswitch/arswitch/arswitchreg.h>
|
||||
#include <dev/etherswitch/arswitch/arswitchvar.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_reg.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_phy.h> /* XXX for probe */
|
||||
#include <dev/etherswitch/arswitch/arswitch_7240.h>
|
||||
|
||||
#include "mdio_if.h"
|
||||
#include "miibus_if.h"
|
||||
#include "etherswitch_if.h"
|
||||
|
||||
/*
|
||||
* AR7240 specific functions
|
||||
*/
|
||||
static int
|
||||
ar7240_hw_setup(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise other global values for the AR7240.
|
||||
*/
|
||||
static int
|
||||
ar7240_hw_global_setup(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
ARSWITCH_LOCK(sc);
|
||||
|
||||
/* Enable CPU port; disable mirror port */
|
||||
arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
|
||||
AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
|
||||
|
||||
/* Setup TAG priority mapping */
|
||||
arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50);
|
||||
|
||||
/* Enable broadcast frames transmitted to the CPU */
|
||||
arswitch_writereg(sc->sc_dev, AR8X16_REG_FLOOD_MASK,
|
||||
AR8X16_FLOOD_MASK_BCAST_TO_CPU | 0x003f003f);
|
||||
|
||||
/* Setup MTU */
|
||||
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_GLOBAL_CTRL,
|
||||
AR7240_GLOBAL_CTRL_MTU_MASK,
|
||||
SM(1536, AR7240_GLOBAL_CTRL_MTU_MASK));
|
||||
|
||||
/* Service Tag */
|
||||
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG,
|
||||
AR8X16_SERVICE_TAG_MASK, 0);
|
||||
|
||||
ARSWITCH_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The AR7240 probes the same as the AR8216.
|
||||
*
|
||||
* However, the support is slightly different.
|
||||
*
|
||||
* So instead of checking the PHY revision or mask register contents,
|
||||
* we simply fall back to a hint check.
|
||||
*/
|
||||
int
|
||||
ar7240_probe(device_t dev)
|
||||
{
|
||||
int is_7240 = 0;
|
||||
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
"is_7240", &is_7240) != 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (is_7240 == 0)
|
||||
return (ENXIO);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ar7240_attach(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
sc->hal.arswitch_hw_setup = ar7240_hw_setup;
|
||||
sc->hal.arswitch_hw_global_setup = ar7240_hw_global_setup;
|
||||
|
||||
/* Set the switch vlan capabilities. */
|
||||
sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q |
|
||||
ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOUBLE_TAG;
|
||||
sc->info.es_nvlangroups = AR8X16_MAX_VLANS;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2011-2012 Stefan Bethke.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef __ARSWITCH_7240_H__
|
||||
#define __ARSWITCH_7240_H__
|
||||
|
||||
extern int ar7240_probe(device_t dev);
|
||||
extern void ar7240_attach(struct arswitch_softc *sc);
|
||||
|
||||
#endif /* __ARSWITCH_7240_H__ */
|
||||
|
@ -1,234 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2011-2012 Stefan Bethke.
|
||||
* Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <dev/iicbus/iic.h>
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
#include <dev/mdio/mdio.h>
|
||||
|
||||
#include <dev/etherswitch/etherswitch.h>
|
||||
|
||||
#include <dev/etherswitch/arswitch/arswitchreg.h>
|
||||
#include <dev/etherswitch/arswitch/arswitchvar.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_reg.h>
|
||||
#include <dev/etherswitch/arswitch/arswitch_phy.h> /* XXX for probe */
|
||||
#include <dev/etherswitch/arswitch/arswitch_9340.h>
|
||||
|
||||
#include "mdio_if.h"
|
||||
#include "miibus_if.h"
|
||||
#include "etherswitch_if.h"
|
||||
|
||||
/*
|
||||
* AR9340 specific functions
|
||||
*/
|
||||
static int
|
||||
ar9340_hw_setup(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ar9340_atu_learn_default(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
/* Enable aging, MAC replacing */
|
||||
arswitch_writereg(sc->sc_dev, AR934X_REG_AT_CTRL,
|
||||
0x2b /* 5 min age time */ |
|
||||
AR934X_AT_CTRL_AGE_EN |
|
||||
AR934X_AT_CTRL_LEARN_CHANGE);
|
||||
|
||||
/* Enable ARP frame acknowledge */
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL,
|
||||
AR934X_QM_CTRL_ARP_EN, AR934X_QM_CTRL_ARP_EN);
|
||||
|
||||
#if 0
|
||||
/* Copy frame to CPU port, not just redirect it */
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL,
|
||||
AR934X_QM_CTRL_ARP_COPY_EN, AR934X_QM_CTRL_ARP_COPY_EN);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise other global values for the AR9340.
|
||||
*/
|
||||
static int
|
||||
ar9340_hw_global_setup(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
ARSWITCH_LOCK(sc);
|
||||
|
||||
/* Enable CPU port; disable mirror port */
|
||||
arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
|
||||
AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
|
||||
|
||||
/* Setup TAG priority mapping */
|
||||
arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50);
|
||||
|
||||
/* Enable Broadcast frames transmitted to the CPU */
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_FLOOD_MASK,
|
||||
AR934X_FLOOD_MASK_BC_DP(0),
|
||||
AR934X_FLOOD_MASK_BC_DP(0));
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_FLOOD_MASK,
|
||||
AR934X_FLOOD_MASK_MC_DP(0),
|
||||
AR934X_FLOOD_MASK_MC_DP(0));
|
||||
#if 0
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_FLOOD_MASK,
|
||||
AR934X_FLOOD_MASK_UC_DP(0),
|
||||
AR934X_FLOOD_MASK_UC_DP(0));
|
||||
#endif
|
||||
|
||||
/* Enable MIB counters */
|
||||
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_MIB_FUNC0,
|
||||
AR934X_MIB_ENABLE, AR934X_MIB_ENABLE);
|
||||
|
||||
/* Setup MTU */
|
||||
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_GLOBAL_CTRL,
|
||||
AR7240_GLOBAL_CTRL_MTU_MASK,
|
||||
SM(1536, AR7240_GLOBAL_CTRL_MTU_MASK));
|
||||
|
||||
/* Service Tag */
|
||||
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG,
|
||||
AR8X16_SERVICE_TAG_MASK, 0);
|
||||
|
||||
/* Settle time */
|
||||
DELAY(1000);
|
||||
|
||||
/*
|
||||
* Check PHY mode bits.
|
||||
*
|
||||
* This dictates whether the connected port is to be wired
|
||||
* up via GMII or MII. I'm not sure why - this is an internal
|
||||
* wiring issue.
|
||||
*/
|
||||
if (sc->is_gmii) {
|
||||
device_printf(sc->sc_dev, "%s: GMII\n", __func__);
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_OPER_MODE0,
|
||||
AR934X_OPER_MODE0_MAC_GMII_EN,
|
||||
AR934X_OPER_MODE0_MAC_GMII_EN);
|
||||
} else if (sc->is_mii) {
|
||||
device_printf(sc->sc_dev, "%s: MII\n", __func__);
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_OPER_MODE0,
|
||||
AR934X_OPER_MODE0_PHY_MII_EN,
|
||||
AR934X_OPER_MODE0_PHY_MII_EN);
|
||||
} else {
|
||||
device_printf(sc->sc_dev, "%s: need is_gmii or is_mii set\n",
|
||||
__func__);
|
||||
ARSWITCH_UNLOCK(sc);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* Whether to connect PHY 4 via MII (ie a switch port) or
|
||||
* treat it as a CPU port.
|
||||
*/
|
||||
if (sc->phy4cpu) {
|
||||
device_printf(sc->sc_dev, "%s: PHY4 - CPU\n", __func__);
|
||||
arswitch_modifyreg(sc->sc_dev, AR934X_REG_OPER_MODE1,
|
||||
AR934X_REG_OPER_MODE1_PHY4_MII_EN,
|
||||
AR934X_REG_OPER_MODE1_PHY4_MII_EN);
|
||||
sc->info.es_nports = 5;
|
||||
} else {
|
||||
device_printf(sc->sc_dev, "%s: PHY4 - Local\n", __func__);
|
||||
sc->info.es_nports = 6;
|
||||
}
|
||||
|
||||
/* Settle time */
|
||||
DELAY(1000);
|
||||
|
||||
ARSWITCH_UNLOCK(sc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The AR9340 switch probes (almost) the same as the AR7240 on-chip switch.
|
||||
*
|
||||
* However, the support is slightly different.
|
||||
*
|
||||
* So instead of checking the PHY revision or mask register contents,
|
||||
* we simply fall back to a hint check.
|
||||
*/
|
||||
int
|
||||
ar9340_probe(device_t dev)
|
||||
{
|
||||
int is_9340 = 0;
|
||||
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
"is_9340", &is_9340) != 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (is_9340 == 0)
|
||||
return (ENXIO);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ar9340_attach(struct arswitch_softc *sc)
|
||||
{
|
||||
|
||||
sc->hal.arswitch_hw_setup = ar9340_hw_setup;
|
||||
sc->hal.arswitch_hw_global_setup = ar9340_hw_global_setup;
|
||||
sc->hal.arswitch_atu_learn_default = ar9340_atu_learn_default;
|
||||
/*
|
||||
* Note: the ar9340 table fetch code/registers matche
|
||||
* the ar8216/ar8316 for now because we're not supporting
|
||||
* static entry programming that includes any of the extra
|
||||
* bits in the AR9340.
|
||||
*/
|
||||
|
||||
/* Set the switch vlan capabilities. */
|
||||
sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q |
|
||||
ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOUBLE_TAG;
|
||||
sc->info.es_nvlangroups = AR8X16_MAX_VLANS;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2011-2012 Stefan Bethke.
|
||||
* Copyright (c) 2031 Adrian Chadd <adrian@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef __ARSWITCH_9340_H__
|
||||
#define __ARSWITCH_9340_H__
|
||||
|
||||
extern int ar9340_probe(device_t dev);
|
||||
extern void ar9340_attach(struct arswitch_softc *sc);
|
||||
|
||||
#endif /* __ARSWITCH_9340_H__ */
|
@ -107,15 +107,6 @@ arswitch_writereg16(device_t dev, int addr, int data)
|
||||
return (MDIO_WRITEREG(device_get_parent(dev), 0x10 | phy, reg, data));
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX NOTE:
|
||||
*
|
||||
* This may not work for AR7240 series embedded switches -
|
||||
* the per-PHY register space doesn't seem to be exposed.
|
||||
*
|
||||
* In that instance, it may be required to speak via
|
||||
* the internal switch PHY MDIO bus indirection.
|
||||
*/
|
||||
void
|
||||
arswitch_writedbg(device_t dev, int phy, uint16_t dbg_addr,
|
||||
uint16_t dbg_data)
|
||||
|
@ -113,8 +113,6 @@
|
||||
#define AR8316_GLOBAL_CTRL_MTU_MASK_S 0
|
||||
#define AR8236_GLOBAL_CTRL_MTU_MASK 0x00007fff
|
||||
#define AR8236_GLOBAL_CTRL_MTU_MASK_S 0
|
||||
#define AR7240_GLOBAL_CTRL_MTU_MASK 0x00003fff
|
||||
#define AR7240_GLOBAL_CTRL_MTU_MASK_S 0
|
||||
|
||||
#define AR8X16_REG_VLAN_CTRL 0x0040
|
||||
#define AR8X16_VLAN_OP 0x00000007
|
||||
@ -365,51 +363,6 @@
|
||||
|
||||
#define AR8X16_MAX_VLANS 16
|
||||
|
||||
/*
|
||||
* AR9340 switch specific definitions.
|
||||
*/
|
||||
|
||||
#define AR934X_REG_OPER_MODE0 0x04
|
||||
#define AR934X_OPER_MODE0_MAC_GMII_EN (1 << 6)
|
||||
#define AR934X_OPER_MODE0_PHY_MII_EN (1 << 10)
|
||||
|
||||
#define AR934X_REG_OPER_MODE1 0x08
|
||||
#define AR934X_REG_OPER_MODE1_PHY4_MII_EN (1 << 28)
|
||||
|
||||
#define AR934X_REG_FLOOD_MASK 0x2c
|
||||
#define AR934X_FLOOD_MASK_UC_DP(_p) (1 << (0 + (_p)))
|
||||
#define AR934X_FLOOD_MASK_MC_DP(_p) (1 << (16 + (_p)))
|
||||
#define AR934X_FLOOD_MASK_BC_DP(_p) (1 << (25 + (_p)))
|
||||
|
||||
#define AR934X_REG_QM_CTRL 0x3c
|
||||
#define AR934X_QM_CTRL_ARP_EN (1 << 15)
|
||||
#define AR934X_QM_CTRL_ARP_COPY_EN (1 << 14)
|
||||
|
||||
#define AR934X_REG_AT_CTRL 0x5c
|
||||
#define AR934X_AT_CTRL_AGE_TIME BITS(0, 15)
|
||||
#define AR934X_AT_CTRL_AGE_EN (1 << 17)
|
||||
#define AR934X_AT_CTRL_LEARN_CHANGE (1 << 18)
|
||||
|
||||
#define AR934X_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100)
|
||||
|
||||
#define AR934X_REG_PORT_VLAN1(_port) (AR934X_REG_PORT_BASE((_port)) + 0x08)
|
||||
#define AR934X_PORT_VLAN1_DEFAULT_SVID_S 0
|
||||
#define AR934X_PORT_VLAN1_FORCE_DEFAULT_VID_EN (1 << 12)
|
||||
#define AR934X_PORT_VLAN1_PORT_TLS_MODE (1 << 13)
|
||||
#define AR934X_PORT_VLAN1_PORT_VLAN_PROP_EN (1 << 14)
|
||||
#define AR934X_PORT_VLAN1_PORT_CLONE_EN (1 << 15)
|
||||
#define AR934X_PORT_VLAN1_DEFAULT_CVID_S 16
|
||||
#define AR934X_PORT_VLAN1_FORCE_PORT_VLAN_EN (1 << 28)
|
||||
#define AR934X_PORT_VLAN1_ING_PORT_PRI_S 29
|
||||
|
||||
#define AR934X_REG_PORT_VLAN2(_port) (AR934X_REG_PORT_BASE((_port)) + 0x0c)
|
||||
#define AR934X_PORT_VLAN2_PORT_VID_MEM_S 16
|
||||
#define AR934X_PORT_VLAN2_8021Q_MODE_S 30
|
||||
#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_ONLY 0
|
||||
#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_FALLBACK 1
|
||||
#define AR934X_PORT_VLAN2_8021Q_MODE_VLAN_ONLY 2
|
||||
#define AR934X_PORT_VLAN2_8021Q_MODE_SECURE 3
|
||||
|
||||
/*
|
||||
* AR8327 specific registers
|
||||
*/
|
||||
|
@ -32,11 +32,9 @@
|
||||
|
||||
typedef enum {
|
||||
AR8X16_SWITCH_NONE,
|
||||
AR8X16_SWITCH_AR7240,
|
||||
AR8X16_SWITCH_AR8216,
|
||||
AR8X16_SWITCH_AR8226,
|
||||
AR8X16_SWITCH_AR8316,
|
||||
AR8X16_SWITCH_AR9340,
|
||||
AR8X16_SWITCH_AR8327,
|
||||
AR8X16_SWITCH_AR8337,
|
||||
} ar8x16_switch_type;
|
||||
@ -68,7 +66,6 @@ struct arswitch_softc {
|
||||
int is_gmii; /* PHY mode is GMII (XXX which PHY?) */
|
||||
int is_mii; /* PHY mode is MII (XXX which PHY?) */
|
||||
int page;
|
||||
int is_internal_switch;
|
||||
int chip_ver;
|
||||
int chip_rev;
|
||||
int mii_lo_first; /* Send low data DWORD before high */
|
||||
|
Loading…
Reference in New Issue
Block a user