From owner-svn-src-head@FreeBSD.ORG Tue Jul 1 14:33:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BB393EC; Tue, 1 Jul 2014 14:33:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F34692781; Tue, 1 Jul 2014 14:33:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s61EXm1M010600; Tue, 1 Jul 2014 14:33:48 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s61EXmO7010598; Tue, 1 Jul 2014 14:33:48 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201407011433.s61EXmO7010598@svn.freebsd.org> From: Luiz Otavio O Souza Date: Tue, 1 Jul 2014 14:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268093 - head/sys/dev/etherswitch/rtl8366 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jul 2014 14:33:49 -0000 Author: loos Date: Tue Jul 1 14:33:48 2014 New Revision: 268093 URL: http://svnweb.freebsd.org/changeset/base/268093 Log: Add the CPU port flag to the CPU port on rtl8366 (port 5). Do not allow any media change on the switch CPU port. Tested on TP-Link WR1043ND. Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Tue Jul 1 14:12:59 2014 (r268092) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Tue Jul 1 14:33:48 2014 (r268093) @@ -570,6 +570,7 @@ rtl_getport(device_t dev, etherswitch_po return (err); } else { /* fill in fixed values for CPU port */ + p->es_flags |= ETHERSWITCH_PORT_CPU; ifmr->ifm_count = 0; smi_read(dev, RTL8366RB_PLSR_BASE + (RTL8366RB_NUM_PHYS)/2, &v, RTL_WAITOK); v = v >> (8 * ((RTL8366RB_NUM_PHYS) % 2)); @@ -606,6 +607,8 @@ rtl_setport(device_t dev, etherswitch_po RTL8366RB_PVCR_VAL(p->es_port, vlangroup), RTL_WAITOK); if (err) return (err); + if (p->es_port == RTL8366RB_CPU_PORT) + return (0); mii = device_get_softc(sc->miibus[p->es_port]); ifm = &mii->mii_media; err = ifmedia_ioctl(sc->ifp[p->es_port], &p->es_ifr, ifm, SIOCSIFMEDIA); Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Tue Jul 1 14:12:59 2014 (r268092) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Tue Jul 1 14:33:48 2014 (r268093) @@ -168,9 +168,10 @@ (RTL8366RB_PACR | (1 << (((phy) & 0x1f) + 9)) | (((page) & 0xf) << 5) | ((reg) & 0x1f)) /* general characteristics of the chip */ -#define RTL8366RB_NUM_PORTS 6 -#define RTL8366RB_NUM_PHYS (RTL8366RB_NUM_PORTS-1) -#define RTL8366RB_NUM_VLANS 16 -#define RTL8366RB_NUM_PHY_REG 32 +#define RTL8366RB_CPU_PORT 5 +#define RTL8366RB_NUM_PORTS 6 +#define RTL8366RB_NUM_PHYS (RTL8366RB_NUM_PORTS-1) +#define RTL8366RB_NUM_VLANS 16 +#define RTL8366RB_NUM_PHY_REG 32 #endif