From nobody Wed Aug 09 16:23:43 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RLb3366mQz4TtKd; Wed, 9 Aug 2023 16:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RLb335LKqz3HVr; Wed, 9 Aug 2023 16:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691598223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1bhE+zqB1HpFwm+8XVbezMkHo6yNUiQoSXuqQG9QxUI=; b=q+pwpx/aneC18u1lpStrEt0gOK98O1Pn4JSiVXCPtXLh+rw3BURJ9fF2FRjruZ8z0FQCyH 5NhvguORjm1Me769zbw8cpGxcVD4kQ0d/gQX22f6E2oZMC77W0j7wLDulEi8E72TCOJnh+ QAo2Gm74wX6pZT0XApO0XyLCkoi/gxOcz2T6NBWFFRPMUO3y2e/zhQ2gOvwDN4/CbaxeWj LRTjRsdpXzPcbdcwV55FKuMwDbKIi3+LEJeeWMBunGSeLKFt22gDLLF3mrEDSoj8zb36vg cpRzkgF55tyoUW/za9LimOhetyN1bRczWcqzoymkZbzZoplQXkwdNJnCjb1v8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691598223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1bhE+zqB1HpFwm+8XVbezMkHo6yNUiQoSXuqQG9QxUI=; b=re+7LYZm1zlggAaSHNgNHK2YHAz6M20PTC+XQ1PzT+uq9cx6boys+NW1w+gokBH9g0Au04 re9XKVRUp60vUwEtTcFPEehg2FDRol/NlZo4cweGa7sTX4NQcocWjuPCJbk2eyiAF0bbo2 tzbsKAH7ka++cJ2QF9W2HK0Csrqyw+28AdJQDZEEQGczIXM7JU0Ky3KSEG7AraSDlmREjp uWyHEekV5sPmF45Ll4FnBj3NH+2n5CAFzWUCVWbGjQQlTUYFgjzgSyxV9KQ6HEYlHPmt/U VuEe9t6Z8jaFLXs2uaQJbDRv26T6RWRCDS0jIm7gIlSOmY7GrI6IRCD/mL0SaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691598223; a=rsa-sha256; cv=none; b=H2aCkiUsu//1Vy2eDH4TfmLFQnrdB4ZzDVDctuw8DyyDfTf/lK7DsFhiKiu+YDv0+pvKFj jN4A3NMSvxVUvLXVTsvkTUSmq5NWKO6tNQz+G1Otjfy2ikJNqqdBSFo98jRNH8FlX3Z1DB AMpv4XIKvGDdBO6eY5bynBd1eJ9FipfNZvseicg75y6DWP/7mcGcta22gdWWwKSUXGxRx3 JXXGnMI7Z+VDfkw59dikbaIjjGxZ6fTYG4xIcsesezHIzfHUPkTllplbRMY+azrXL7Poj9 /yKrPcwrk3zsRZlQCIihGXczkIt7+uwpyp8XPw1bKSGjzqIOG1hL2p9oOIXJ4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RLb334NvWz7bV; Wed, 9 Aug 2023 16:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 379GNhDb026495; Wed, 9 Aug 2023 16:23:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 379GNhCu026492; Wed, 9 Aug 2023 16:23:43 GMT (envelope-from git) Date: Wed, 9 Aug 2023 16:23:43 GMT Message-Id: <202308091623.379GNhCu026492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: 8f5dbc22e595 - main - arswitch(4): Remove support for AR{7240,9340} found in MIPS SoCs only List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f5dbc22e595e09a8beb81ff532df58f006b91cd Auto-Submitted: auto-generated The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=8f5dbc22e595e09a8beb81ff532df58f006b91cd commit 8f5dbc22e595e09a8beb81ff532df58f006b91cd Author: Marius Strobl AuthorDate: 2023-08-08 20:35:02 +0000 Commit: Marius Strobl CommitDate: 2023-08-09 16:22:13 +0000 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 --- share/man/man4/arswitch.4 | 8 +- sys/conf/files | 2 - sys/dev/etherswitch/arswitch/arswitch.c | 28 +--- sys/dev/etherswitch/arswitch/arswitch_7240.c | 147 ----------------- sys/dev/etherswitch/arswitch/arswitch_7240.h | 37 ----- sys/dev/etherswitch/arswitch/arswitch_9340.c | 234 --------------------------- sys/dev/etherswitch/arswitch/arswitch_9340.h | 37 ----- sys/dev/etherswitch/arswitch/arswitch_reg.c | 9 -- sys/dev/etherswitch/arswitch/arswitchreg.h | 47 ------ sys/dev/etherswitch/arswitch/arswitchvar.h | 3 - 10 files changed, 3 insertions(+), 549 deletions(-) diff --git a/share/man/man4/arswitch.4 b/share/man/man4/arswitch.4 index 481a3a08f339..f07d1dec0040 100644 --- a/share/man/man4/arswitch.4 +++ b/share/man/man4/arswitch.4 @@ -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 diff --git a/sys/conf/files b/sys/conf/files index 80384fe1f5b1..f831ee2b5275 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -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 diff --git a/sys/dev/etherswitch/arswitch/arswitch.c b/sys/dev/etherswitch/arswitch/arswitch.c index 6a95c7a8ad80..2d39553b0d9c 100644 --- a/sys/dev/etherswitch/arswitch/arswitch.c +++ b/sys/dev/etherswitch/arswitch/arswitch.c @@ -64,12 +64,10 @@ #include #include -#include #include #include #include #include -#include #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); diff --git a/sys/dev/etherswitch/arswitch/arswitch_7240.c b/sys/dev/etherswitch/arswitch/arswitch_7240.c deleted file mode 100644 index 2096d16c0913..000000000000 --- a/sys/dev/etherswitch/arswitch/arswitch_7240.c +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include /* XXX for probe */ -#include - -#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; -} diff --git a/sys/dev/etherswitch/arswitch/arswitch_7240.h b/sys/dev/etherswitch/arswitch/arswitch_7240.h deleted file mode 100644 index 7d8181aeb353..000000000000 --- a/sys/dev/etherswitch/arswitch/arswitch_7240.h +++ /dev/null @@ -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__ */ - diff --git a/sys/dev/etherswitch/arswitch/arswitch_9340.c b/sys/dev/etherswitch/arswitch/arswitch_9340.c deleted file mode 100644 index 8b1e5c390fb5..000000000000 --- a/sys/dev/etherswitch/arswitch/arswitch_9340.c +++ /dev/null @@ -1,234 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2011-2012 Stefan Bethke. - * Copyright (c) 2013 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include /* XXX for probe */ -#include - -#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; -} diff --git a/sys/dev/etherswitch/arswitch/arswitch_9340.h b/sys/dev/etherswitch/arswitch/arswitch_9340.h deleted file mode 100644 index faf5ef8c1cbb..000000000000 --- a/sys/dev/etherswitch/arswitch/arswitch_9340.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2011-2012 Stefan Bethke. - * Copyright (c) 2031 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$ - */ -#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__ */ diff --git a/sys/dev/etherswitch/arswitch/arswitch_reg.c b/sys/dev/etherswitch/arswitch/arswitch_reg.c index 06f41a29213f..5adbe9cd7108 100644 --- a/sys/dev/etherswitch/arswitch/arswitch_reg.c +++ b/sys/dev/etherswitch/arswitch/arswitch_reg.c @@ -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) diff --git a/sys/dev/etherswitch/arswitch/arswitchreg.h b/sys/dev/etherswitch/arswitch/arswitchreg.h index 5f8b04dea94e..c6f86425a980 100644 --- a/sys/dev/etherswitch/arswitch/arswitchreg.h +++ b/sys/dev/etherswitch/arswitch/arswitchreg.h @@ -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 */ diff --git a/sys/dev/etherswitch/arswitch/arswitchvar.h b/sys/dev/etherswitch/arswitch/arswitchvar.h index e7aec9d99513..821d79bb89b1 100644 --- a/sys/dev/etherswitch/arswitch/arswitchvar.h +++ b/sys/dev/etherswitch/arswitch/arswitchvar.h @@ -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 */