Deleted Added
full compact
arswitch_7240.c (253570) arswitch_7240.c (253572)
1/*-
2 * Copyright (c) 2011-2012 Stefan Bethke.
3 * Copyright (c) 2012 Adrian Chadd.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2011-2012 Stefan Bethke.
3 * Copyright (c) 2012 Adrian Chadd.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/etherswitch/arswitch/arswitch_7240.c 253570 2013-07-23 14:02:38Z loos $
27 * $FreeBSD: head/sys/dev/etherswitch/arswitch/arswitch_7240.c 253572 2013-07-23 14:24:22Z loos $
28 */
29
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/errno.h>
33#include <sys/kernel.h>
34#include <sys/module.h>
35#include <sys/socket.h>

--- 30 unchanged lines hidden (view full) ---

66
67/*
68 * AR7240 specific functions
69 */
70static int
71ar7240_hw_setup(struct arswitch_softc *sc)
72{
73
28 */
29
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/errno.h>
33#include <sys/kernel.h>
34#include <sys/module.h>
35#include <sys/socket.h>

--- 30 unchanged lines hidden (view full) ---

66
67/*
68 * AR7240 specific functions
69 */
70static int
71ar7240_hw_setup(struct arswitch_softc *sc)
72{
73
74 /* Enable CPU port; disable mirror port */
75 arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
76 AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
77
78 return (0);
79}
80
81/*
82 * Initialise other global values for the AR7240.
83 */
84static int
85ar7240_hw_global_setup(struct arswitch_softc *sc)
86{
87
74 return (0);
75}
76
77/*
78 * Initialise other global values for the AR7240.
79 */
80static int
81ar7240_hw_global_setup(struct arswitch_softc *sc)
82{
83
84 /* Enable CPU port; disable mirror port */
85 arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
86 AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
87
88 /* Setup TAG priority mapping */
89 arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50);
90
91 /* Enable broadcast frames transmitted to the CPU */
92 arswitch_writereg(sc->sc_dev, AR8X16_REG_FLOOD_MASK,
93 AR8X16_FLOOD_MASK_BCAST_TO_CPU | 0x003f003f);
94
95 /* Setup MTU */

--- 32 unchanged lines hidden (view full) ---

128}
129
130void
131ar7240_attach(struct arswitch_softc *sc)
132{
133
134 sc->hal.arswitch_hw_setup = ar7240_hw_setup;
135 sc->hal.arswitch_hw_global_setup = ar7240_hw_global_setup;
88 /* Setup TAG priority mapping */
89 arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50);
90
91 /* Enable broadcast frames transmitted to the CPU */
92 arswitch_writereg(sc->sc_dev, AR8X16_REG_FLOOD_MASK,
93 AR8X16_FLOOD_MASK_BCAST_TO_CPU | 0x003f003f);
94
95 /* Setup MTU */

--- 32 unchanged lines hidden (view full) ---

128}
129
130void
131ar7240_attach(struct arswitch_softc *sc)
132{
133
134 sc->hal.arswitch_hw_setup = ar7240_hw_setup;
135 sc->hal.arswitch_hw_global_setup = ar7240_hw_global_setup;
136
137 /* Set the switch vlan capabilities. */
138 sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q |
139 ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOUBLE_TAG;
140 sc->info.es_nvlangroups = AR8X16_MAX_VLANS;
136}
141}