// SPDX-License-Identifier: GPL-2.0+
/*
 *  Copyright 2014 - 2015 Freescale Semiconductor, Inc.
 *
 *  Driver for the Vitesse VSC9953 L2 Switch
 */

#include <asm/io.h>
#include <asm/fsl_serdes.h>
#include <fm_eth.h>
#include <fsl_memac.h>
#include <bitfield.h>
#include <errno.h>
#include <malloc.h>
#include <vsc9953.h>
#include <ethsw.h>

static struct vsc9953_info vsc9953_l2sw = {
		.port[0] = VSC9953_PORT_INFO_INITIALIZER(0),
		.port[1] = VSC9953_PORT_INFO_INITIALIZER(1),
		.port[2] = VSC9953_PORT_INFO_INITIALIZER(2),
		.port[3] = VSC9953_PORT_INFO_INITIALIZER(3),
		.port[4] = VSC9953_PORT_INFO_INITIALIZER(4),
		.port[5] = VSC9953_PORT_INFO_INITIALIZER(5),
		.port[6] = VSC9953_PORT_INFO_INITIALIZER(6),
		.port[7] = VSC9953_PORT_INFO_INITIALIZER(7),
		.port[8] = VSC9953_PORT_INFO_INITIALIZER(8),
		.port[9] = VSC9953_PORT_INFO_INITIALIZER(9),
};

void vsc9953_port_info_set_mdio(int port_no, struct mii_dev *bus)
{
	if (!VSC9953_PORT_CHECK(port_no))
		return;

	vsc9953_l2sw.port[port_no].bus = bus;
}

void vsc9953_port_info_set_phy_address(int port_no, int address)
{
	if (!VSC9953_PORT_CHECK(port_no))
		return;

	vsc9953_l2sw.port[port_no].phyaddr = address;
}

void vsc9953_port_info_set_phy_int(int port_no, phy_interface_t phy_int)
{
	if (!VSC9953_PORT_CHECK(port_no))
		return;

	vsc9953_l2sw.port[port_no].enet_if = phy_int;
}

void vsc9953_port_enable(int port_no)
{
	if (!VSC9953_PORT_CHECK(port_no))
		return;

	vsc9953_l2sw.port[port_no].enabled = 1;
}

void vsc9953_port_disable(int port_no)
{
	if (!VSC9953_PORT_CHECK(port_no))
		return;

	vsc9953_l2sw.port[port_no].enabled = 0;
}

static void vsc9953_mdio_write(struct vsc9953_mii_mng *phyregs, int port_addr,
		int regnum, int value)
{
	int timeout = 50000;

	out_le32(&phyregs->miimcmd, (0x1 << 31) | ((port_addr & 0x1f) << 25) |
			((regnum & 0x1f) << 20) | ((value & 0xffff) << 4) |
			(0x1 << 1));
	asm("sync");

	while ((in_le32(&phyregs->miimstatus) & 0x8) && --timeout)
		udelay(1);

	if (timeout == 0)
		debug("Timeout waiting for MDIO write\n");
}

static int vsc9953_mdio_read(struct vsc9953_mii_mng *phyregs, int port_addr,
		int regnum)
{
	int value = 0xFFFF;
	int timeout = 50000;

	while ((in_le32(&phyregs->miimstatus) & MIIMIND_OPR_PEND) && --timeout)
		udelay(1);
	if (timeout == 0) {
		debug("Timeout waiting for MDIO operation to finish\n");
		return value;
	}

	/* Put the address of the phy, and the register
	 * number into MIICMD
	 */
	out_le32(&phyregs->miimcmd, (0x1 << 31) | ((port_addr & 0x1f) << 25) |
			((regnum & 0x1f) << 20) | ((value & 0xffff) << 4) |
			(0x2 << 1));

	timeout = 50000;
	/* Wait for the the indication that the read is done */
	while ((in_le32(&phyregs->miimstatus) & 0x8) && --timeout)
		udelay(1);
	if (timeout == 0)
		debug("Timeout waiting for MDIO read\n");

	/* Grab the value read from the PHY */
	value = in_le32(&phyregs->miimdata);

	if ((value & 0x00030000) == 0)
		return value & 0x0000ffff;

	return value;
}

static int init_phy(struct eth_device *dev)
{
	struct vsc9953_port_info *l2sw_port = dev->priv;
	struct phy_device *phydev = NULL;

#ifdef CONFIG_PHYLIB
	if (!l2sw_port->bus)
		return 0;
	phydev = phy_connect(l2sw_port->bus, l2sw_port->phyaddr, dev,
			l2sw_port->enet_if);
	if (!phydev) {
		printf("Failed to connect\n");
		return -1;
	}

	phydev->supported &= SUPPORTED_10baseT_Half |
			SUPPORTED_10baseT_Full |
			SUPPORTED_100baseT_Half |
			SUPPORTED_100baseT_Full |
			SUPPORTED_1000baseT_Full;
	phydev->advertising = phydev->supported;

	l2sw_port->phydev = phydev;

	phy_config(phydev);
#endif

	return 0;
}

static int vsc9953_port_init(int port_no)
{
	struct eth_device *dev;

	/* Internal ports never have a PHY */
	if (VSC9953_INTERNAL_PORT_CHECK(port_no))
		return 0;

	/* alloc eth device */
	dev = (struct eth_device *)calloc(1, sizeof(struct eth_device));
	if (!dev)
		return -ENOMEM;

	sprintf(dev->name, "SW@PORT%d", port_no);
	dev->priv = &vsc9953_l2sw.port[port_no];
	dev->init = NULL;
	dev->halt = NULL;
	dev->send = NULL;
	dev->recv = NULL;

	if (init_phy(dev)) {
		free(dev);
		return -ENODEV;
	}

	return 0;
}

static int vsc9953_vlan_table_poll_idle(void)
{
	struct vsc9953_analyzer *l2ana_reg;
	int timeout;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	timeout = 50000;
	while (((in_le32(&l2ana_reg->ana_tables.vlan_access) &
		 VSC9953_VLAN_CMD_MASK) != VSC9953_VLAN_CMD_IDLE) && --timeout)
		udelay(1);

	return timeout ? 0 : -EBUSY;
}

#ifdef CONFIG_CMD_ETHSW
/* Add/remove a port to/from a VLAN */
static void vsc9953_vlan_table_membership_set(int vid, u32 port_no, u8 add)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	if (vsc9953_vlan_table_poll_idle() < 0) {
		debug("VLAN table timeout\n");
		return;
	}

	val = in_le32(&l2ana_reg->ana_tables.vlan_tidx);
	val = bitfield_replace_by_mask(val, VSC9953_ANA_TBL_VID_MASK, vid);
	out_le32(&l2ana_reg->ana_tables.vlan_tidx, val);

	clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access,
			VSC9953_VLAN_CMD_MASK, VSC9953_VLAN_CMD_READ);

	if (vsc9953_vlan_table_poll_idle() < 0) {
		debug("VLAN table timeout\n");
		return;
	}

	val = in_le32(&l2ana_reg->ana_tables.vlan_tidx);
	val = bitfield_replace_by_mask(val, VSC9953_ANA_TBL_VID_MASK, vid);
	out_le32(&l2ana_reg->ana_tables.vlan_tidx, val);

	val = in_le32(&l2ana_reg->ana_tables.vlan_access);
	if (!add) {
		val = bitfield_replace_by_mask(val, VSC9953_VLAN_CMD_MASK,
						VSC9953_VLAN_CMD_WRITE) &
		      ~(bitfield_replace_by_mask(0, VSC9953_VLAN_PORT_MASK,
						 (1 << port_no)));
		 ;
	} else {
		val = bitfield_replace_by_mask(val, VSC9953_VLAN_CMD_MASK,
						VSC9953_VLAN_CMD_WRITE) |
		      bitfield_replace_by_mask(0, VSC9953_VLAN_PORT_MASK,
					       (1 << port_no));
	}
	out_le32(&l2ana_reg->ana_tables.vlan_access, val);

	/* wait for VLAN table command to flush */
	if (vsc9953_vlan_table_poll_idle() < 0) {
		debug("VLAN table timeout\n");
		return;
	}
}

/* show VLAN membership for a port */
static void vsc9953_vlan_membership_show(int port_no)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;
	u32 vid;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	printf("Port %d VLAN membership: ", port_no);

	for (vid = 0; vid < VSC9953_MAX_VLAN; vid++) {
		if (vsc9953_vlan_table_poll_idle() < 0) {
			debug("VLAN table timeout\n");
			return;
		}

		val = in_le32(&l2ana_reg->ana_tables.vlan_tidx);
		val = bitfield_replace_by_mask(val, VSC9953_ANA_TBL_VID_MASK,
					       vid);
		out_le32(&l2ana_reg->ana_tables.vlan_tidx, val);

		clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access,
				VSC9953_VLAN_CMD_MASK, VSC9953_VLAN_CMD_READ);

		if (vsc9953_vlan_table_poll_idle() < 0) {
			debug("VLAN table timeout\n");
			return;
		}

		val = in_le32(&l2ana_reg->ana_tables.vlan_access);

		if (bitfield_extract_by_mask(val, VSC9953_VLAN_PORT_MASK) &
		    (1 << port_no))
			printf("%d ", vid);
	}
	printf("\n");
}
#endif

/* vlan table set/clear all membership of vid */
static void vsc9953_vlan_table_membership_all_set(int vid, int set_member)
{
	uint val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	if (vsc9953_vlan_table_poll_idle() < 0) {
		debug("VLAN table timeout\n");
		return;
	}

	/* read current vlan configuration */
	val = in_le32(&l2ana_reg->ana_tables.vlan_tidx);
	out_le32(&l2ana_reg->ana_tables.vlan_tidx,
		 bitfield_replace_by_mask(val, VSC9953_ANA_TBL_VID_MASK, vid));

	clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access,
			VSC9953_VLAN_CMD_MASK, VSC9953_VLAN_CMD_READ);

	if (vsc9953_vlan_table_poll_idle() < 0) {
		debug("VLAN table timeout\n");
		return;
	}

	val = in_le32(&l2ana_reg->ana_tables.vlan_tidx);
	out_le32(&l2ana_reg->ana_tables.vlan_tidx,
		 bitfield_replace_by_mask(val, VSC9953_ANA_TBL_VID_MASK, vid));

	clrsetbits_le32(&l2ana_reg->ana_tables.vlan_access,
			VSC9953_VLAN_PORT_MASK | VSC9953_VLAN_CMD_MASK,
			VSC9953_VLAN_CMD_WRITE |
			(set_member ? VSC9953_VLAN_PORT_MASK : 0));
}

#ifdef CONFIG_CMD_ETHSW
/* Get PVID of a VSC9953 port */
static int vsc9953_port_vlan_pvid_get(int port_nr, int *pvid)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_nr].enabled) {
		printf("Port %d is administrative down\n", port_nr);
		return -1;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
				VSC9953_ANA_OFFSET);

	/* Get ingress PVID */
	val = in_le32(&l2ana_reg->port[port_nr].vlan_cfg);
	*pvid = bitfield_extract_by_mask(val, VSC9953_VLAN_CFG_VID_MASK);

	return 0;
}
#endif

/* Set PVID for a VSC9953 port */
static void vsc9953_port_vlan_pvid_set(int port_no, int pvid)
{
	uint val;
	struct vsc9953_analyzer *l2ana_reg;
	struct vsc9953_rew_reg *l2rew_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);
	l2rew_reg = (struct vsc9953_rew_reg *)(VSC9953_OFFSET +
			VSC9953_REW_OFFSET);

	/* Set PVID on ingress */
	val = in_le32(&l2ana_reg->port[port_no].vlan_cfg);
	val = bitfield_replace_by_mask(val, VSC9953_VLAN_CFG_VID_MASK, pvid);
	out_le32(&l2ana_reg->port[port_no].vlan_cfg, val);

	/* Set PVID on egress */
	val = in_le32(&l2rew_reg->port[port_no].port_vlan_cfg);
	val = bitfield_replace_by_mask(val, VSC9953_PORT_VLAN_CFG_VID_MASK,
				       pvid);
	out_le32(&l2rew_reg->port[port_no].port_vlan_cfg, val);
}

static void vsc9953_port_all_vlan_pvid_set(int pvid)
{
	int i;

	for (i = 0; i < VSC9953_MAX_PORTS; i++)
		vsc9953_port_vlan_pvid_set(i, pvid);
}

/* Enable/disable vlan aware of a VSC9953 port */
static void vsc9953_port_vlan_aware_set(int port_no, int enabled)
{
	struct vsc9953_analyzer *l2ana_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	if (enabled)
		setbits_le32(&l2ana_reg->port[port_no].vlan_cfg,
			     VSC9953_VLAN_CFG_AWARE_ENA);
	else
		clrbits_le32(&l2ana_reg->port[port_no].vlan_cfg,
			     VSC9953_VLAN_CFG_AWARE_ENA);
}

/* Set all VSC9953 ports' vlan aware  */
static void vsc9953_port_all_vlan_aware_set(int enabled)
{
	int i;

	for (i = 0; i < VSC9953_MAX_PORTS; i++)
		vsc9953_port_vlan_aware_set(i, enabled);
}

/* Enable/disable vlan pop count of a VSC9953 port */
static void vsc9953_port_vlan_popcnt_set(int port_no, int popcnt)
{
	uint val;
	struct vsc9953_analyzer *l2ana_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	if (popcnt > 3 || popcnt < 0) {
		printf("Invalid pop count value: %d\n", port_no);
		return;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	val = in_le32(&l2ana_reg->port[port_no].vlan_cfg);
	val = bitfield_replace_by_mask(val, VSC9953_VLAN_CFG_POP_CNT_MASK,
				       popcnt);
	out_le32(&l2ana_reg->port[port_no].vlan_cfg, val);
}

/* Set all VSC9953 ports' pop count  */
static void vsc9953_port_all_vlan_poncnt_set(int popcnt)
{
	int i;

	for (i = 0; i < VSC9953_MAX_PORTS; i++)
		vsc9953_port_vlan_popcnt_set(i, popcnt);
}

/* Enable/disable learning for frames dropped due to ingress filtering */
static void vsc9953_vlan_ingr_fltr_learn_drop(int enable)
{
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	if (enable)
		setbits_le32(&l2ana_reg->ana.adv_learn, VSC9953_VLAN_CHK);
	else
		clrbits_le32(&l2ana_reg->ana.adv_learn, VSC9953_VLAN_CHK);
}

enum aggr_code_mode {
	AGGR_CODE_RAND = 0,
	AGGR_CODE_ALL,	/* S/D MAC, IPv4 S/D IP, IPv6 Flow Label, S/D PORT */
};

/* Set aggregation code generation mode */
static int vsc9953_aggr_code_set(enum aggr_code_mode ac)
{
	int rc;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	switch (ac) {
	case AGGR_CODE_RAND:
		clrsetbits_le32(&l2ana_reg->common.aggr_cfg,
				VSC9953_AC_DMAC_ENA | VSC9953_AC_SMAC_ENA |
				VSC9953_AC_IP6_LBL_ENA |
				VSC9953_AC_IP6_TCPUDP_ENA |
				VSC9953_AC_IP4_SIPDIP_ENA |
				VSC9953_AC_IP4_TCPUDP_ENA, VSC9953_AC_RND_ENA);
		rc = 0;
		break;
	case AGGR_CODE_ALL:
		clrsetbits_le32(&l2ana_reg->common.aggr_cfg, VSC9953_AC_RND_ENA,
				VSC9953_AC_DMAC_ENA | VSC9953_AC_SMAC_ENA |
				VSC9953_AC_IP6_LBL_ENA |
				VSC9953_AC_IP6_TCPUDP_ENA |
				VSC9953_AC_IP4_SIPDIP_ENA |
				VSC9953_AC_IP4_TCPUDP_ENA);
		rc = 0;
		break;
	default:
		/* unknown mode for aggregation code */
		rc = -EINVAL;
	}

	return rc;
}

/* Egress untag modes of a VSC9953 port */
enum egress_untag_mode {
	EGRESS_UNTAG_ALL = 0,
	EGRESS_UNTAG_PVID_AND_ZERO,
	EGRESS_UNTAG_ZERO,
	EGRESS_UNTAG_NONE,
};

#ifdef CONFIG_CMD_ETHSW
/* Get egress tagging configuration for a VSC9953 port */
static int vsc9953_port_vlan_egr_untag_get(int port_no,
					   enum egress_untag_mode *mode)
{
	u32 val;
	struct vsc9953_rew_reg *l2rew_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return -1;
	}

	l2rew_reg = (struct vsc9953_rew_reg *)(VSC9953_OFFSET +
			VSC9953_REW_OFFSET);

	val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg);

	switch (val & VSC9953_TAG_CFG_MASK) {
	case VSC9953_TAG_CFG_NONE:
		*mode = EGRESS_UNTAG_ALL;
		return 0;
	case VSC9953_TAG_CFG_ALL_BUT_PVID_ZERO:
		*mode = EGRESS_UNTAG_PVID_AND_ZERO;
		return 0;
	case VSC9953_TAG_CFG_ALL_BUT_ZERO:
		*mode = EGRESS_UNTAG_ZERO;
		return 0;
	case VSC9953_TAG_CFG_ALL:
		*mode = EGRESS_UNTAG_NONE;
		return 0;
	default:
		printf("Unknown egress tagging configuration for port %d\n",
		       port_no);
		return -1;
	}
}

/* Show egress tagging configuration for a VSC9953 port */
static void vsc9953_port_vlan_egr_untag_show(int port_no)
{
	enum egress_untag_mode mode;

	if (vsc9953_port_vlan_egr_untag_get(port_no, &mode)) {
		printf("%7d\t%17s\n", port_no, "-");
		return;
	}

	printf("%7d\t", port_no);
	switch (mode) {
	case EGRESS_UNTAG_ALL:
		printf("%17s\n", "all");
		break;
	case EGRESS_UNTAG_NONE:
		printf("%17s\n", "none");
		break;
	case EGRESS_UNTAG_PVID_AND_ZERO:
		printf("%17s\n", "PVID and 0");
		break;
	case EGRESS_UNTAG_ZERO:
		printf("%17s\n", "0");
		break;
	default:
		printf("%17s\n", "-");
	}
}
#endif

static void vsc9953_port_vlan_egr_untag_set(int port_no,
					    enum egress_untag_mode mode)
{
	struct vsc9953_rew_reg *l2rew_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2rew_reg = (struct vsc9953_rew_reg *)(VSC9953_OFFSET +
			VSC9953_REW_OFFSET);

	switch (mode) {
	case EGRESS_UNTAG_ALL:
		clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
				VSC9953_TAG_CFG_MASK, VSC9953_TAG_CFG_NONE);
		break;
	case EGRESS_UNTAG_PVID_AND_ZERO:
		clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
				VSC9953_TAG_CFG_MASK,
				VSC9953_TAG_CFG_ALL_BUT_PVID_ZERO);
		break;
	case EGRESS_UNTAG_ZERO:
		clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
				VSC9953_TAG_CFG_MASK,
				VSC9953_TAG_CFG_ALL_BUT_ZERO);
		break;
	case EGRESS_UNTAG_NONE:
		clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
				VSC9953_TAG_CFG_MASK, VSC9953_TAG_CFG_ALL);
		break;
	default:
		printf("Unknown untag mode for port %d\n", port_no);
	}
}

static void vsc9953_port_all_vlan_egress_untagged_set(
		enum egress_untag_mode mode)
{
	int i;

	for (i = 0; i < VSC9953_MAX_PORTS; i++)
		vsc9953_port_vlan_egr_untag_set(i, mode);
}

static int vsc9953_autoage_time_set(int age_period)
{
	u32 autoage;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	if (age_period < 0 || age_period > VSC9953_AUTOAGE_PERIOD_MASK)
		return -EINVAL;

	autoage = bitfield_replace_by_mask(in_le32(&l2ana_reg->ana.auto_age),
					   VSC9953_AUTOAGE_PERIOD_MASK,
					   age_period);
	out_le32(&l2ana_reg->ana.auto_age, autoage);

	return 0;
}

#ifdef CONFIG_CMD_ETHSW

/* Enable/disable status of a VSC9953 port */
static void vsc9953_port_status_set(int port_no, u8 enabled)
{
	struct vsc9953_qsys_reg *l2qsys_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled)
		return;

	l2qsys_reg = (struct vsc9953_qsys_reg *)(VSC9953_OFFSET +
			VSC9953_QSYS_OFFSET);

	if (enabled)
		setbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no],
			     VSC9953_PORT_ENA);
	else
		clrbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no],
			     VSC9953_PORT_ENA);
}

/* Start autonegotiation for a VSC9953 PHY */
static void vsc9953_phy_autoneg(int port_no)
{
	if (!vsc9953_l2sw.port[port_no].phydev)
		return;

	if (vsc9953_l2sw.port[port_no].phydev->drv->startup(
			vsc9953_l2sw.port[port_no].phydev))
		printf("Failed to start PHY for port %d\n", port_no);
}

/* Print a VSC9953 port's configuration */
static void vsc9953_port_config_show(int port_no)
{
	int speed;
	int duplex;
	int link;
	u8 enabled;
	u32 val;
	struct vsc9953_qsys_reg *l2qsys_reg;

	l2qsys_reg = (struct vsc9953_qsys_reg *)(VSC9953_OFFSET +
			VSC9953_QSYS_OFFSET);

	val = in_le32(&l2qsys_reg->sys.switch_port_mode[port_no]);
	enabled = vsc9953_l2sw.port[port_no].enabled &&
		  (val & VSC9953_PORT_ENA);

	/* internal ports (8 and 9) are fixed */
	if (VSC9953_INTERNAL_PORT_CHECK(port_no)) {
		link = 1;
		speed = SPEED_2500;
		duplex = DUPLEX_FULL;
	} else {
		if (vsc9953_l2sw.port[port_no].phydev) {
			link = vsc9953_l2sw.port[port_no].phydev->link;
			speed = vsc9953_l2sw.port[port_no].phydev->speed;
			duplex = vsc9953_l2sw.port[port_no].phydev->duplex;
		} else {
			link = -1;
			speed = -1;
			duplex = -1;
		}
	}

	printf("%8d ", port_no);
	printf("%8s ", enabled == 1 ? "enabled" : "disabled");
	printf("%8s ", link == 1 ? "up" : "down");

	switch (speed) {
	case SPEED_10:
		printf("%8d ", 10);
		break;
	case SPEED_100:
		printf("%8d ", 100);
		break;
	case SPEED_1000:
		printf("%8d ", 1000);
		break;
	case SPEED_2500:
		printf("%8d ", 2500);
		break;
	case SPEED_10000:
		printf("%8d ", 10000);
		break;
	default:
		printf("%8s ", "-");
	}

	printf("%8s\n", duplex == DUPLEX_FULL ? "full" : "half");
}

/* Show VSC9953 ports' statistics */
static void vsc9953_port_statistics_show(int port_no)
{
	u32 rx_val;
	u32 tx_val;
	struct vsc9953_system_reg *l2sys_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2sys_reg = (struct vsc9953_system_reg *)(VSC9953_OFFSET +
			VSC9953_SYS_OFFSET);

	printf("Statistics for L2 Switch port %d:\n", port_no);

	/* Set counter view for our port */
	out_le32(&l2sys_reg->sys.stat_cfg, port_no);

#define VSC9953_STATS_PRINTF "%-15s %10u"

	/* Get number of Rx and Tx frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx frames:", rx_val, "Tx frames:", tx_val);

	/* Get number of Rx and Tx bytes */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_oct);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_oct);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx bytes:", rx_val, "Tx bytes:", tx_val);

	/* Get number of Rx frames received ok and Tx frames sent ok */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_0) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_1) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_2) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_3) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_4) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_5) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_6) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_7) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_0) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_1) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_2) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_3) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_4) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_5) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_6) +
		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_7);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx frames ok:", rx_val, "Tx frames ok:", tx_val);

	/* Get number of Rx and Tx unicast frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_uc);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_uc);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx unicast:", rx_val, "Tx unicast:", tx_val);

	/* Get number of Rx and Tx broadcast frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_bc);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_bc);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx broadcast:", rx_val, "Tx broadcast:", tx_val);

	/* Get number of Rx and Tx frames of 64B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 64B:", rx_val, "Tx 64B:", tx_val);

	/* Get number of Rx and Tx frames with sizes between 65B and 127B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 65B-127B:", rx_val, "Tx 65B-127B:", tx_val);

	/* Get number of Rx and Tx frames with sizes between 128B and 255B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 128B-255B:", rx_val, "Tx 128B-255B:", tx_val);

	/* Get number of Rx and Tx frames with sizes between 256B and 511B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 256B-511B:", rx_val, "Tx 256B-511B:", tx_val);

	/* Get number of Rx and Tx frames with sizes between 512B and 1023B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 512B-1023B:", rx_val, "Tx 512B-1023B:", tx_val);

	/* Get number of Rx and Tx frames with sizes between 1024B and 1526B */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx 1024B-1526B:", rx_val, "Tx 1024B-1526B:", tx_val);

	/* Get number of Rx and Tx jumbo frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx jumbo:", rx_val, "Tx jumbo:", tx_val);

	/* Get number of Rx and Tx dropped frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_tail) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_0) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_1) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_2) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_3) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_4) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_5) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_6) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_7) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_0) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_1) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_2) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_3) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_4) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_5) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_6) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_7);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_drop) +
		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx drops:", rx_val, "Tx drops:", tx_val);

	/*
	 * Get number of Rx frames with CRC or alignment errors
	 * and number of detected Tx collisions
	 */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_crc);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_col);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx CRC&align:", rx_val, "Tx coll:", tx_val);

	/*
	 * Get number of Rx undersized frames and
	 * number of Tx aged frames
	 */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short);
	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged);
	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
	       "Rx undersize:", rx_val, "Tx aged:", tx_val);

	/* Get number of Rx oversized frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long);
	printf(VSC9953_STATS_PRINTF"\n", "Rx oversized:", rx_val);

	/* Get number of Rx fragmented frames */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag);
	printf(VSC9953_STATS_PRINTF"\n", "Rx fragments:", rx_val);

	/* Get number of Rx jabber errors */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber);
	printf(VSC9953_STATS_PRINTF"\n", "Rx jabbers:", rx_val);

	/*
	 * Get number of Rx frames filtered due to classification rules or
	 * no destination ports
	 */
	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) +
		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_local);
	printf(VSC9953_STATS_PRINTF"\n", "Rx filtered:", rx_val);

	printf("\n");
}

/* Clear statistics for a VSC9953 port */
static void vsc9953_port_statistics_clear(int port_no)
{
	struct vsc9953_system_reg *l2sys_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2sys_reg = (struct vsc9953_system_reg *)(VSC9953_OFFSET +
			VSC9953_SYS_OFFSET);

	/* Clear all counter groups for our ports */
	out_le32(&l2sys_reg->sys.stat_cfg, port_no |
		 VSC9953_STAT_CLEAR_RX | VSC9953_STAT_CLEAR_TX |
		 VSC9953_STAT_CLEAR_DR);
}

enum port_learn_mode {
	PORT_LEARN_NONE,
	PORT_LEARN_AUTO
};

/* Set learning configuration for a VSC9953 port */
static void vsc9953_port_learn_mode_set(int port_no, enum port_learn_mode mode)
{
	struct vsc9953_analyzer *l2ana_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	switch (mode) {
	case PORT_LEARN_NONE:
		clrbits_le32(&l2ana_reg->port[port_no].port_cfg,
			     VSC9953_PORT_CFG_LEARN_DROP |
			     VSC9953_PORT_CFG_LEARN_CPU |
			     VSC9953_PORT_CFG_LEARN_AUTO |
			     VSC9953_PORT_CFG_LEARN_ENA);
		break;
	case PORT_LEARN_AUTO:
		clrsetbits_le32(&l2ana_reg->port[port_no].port_cfg,
				VSC9953_PORT_CFG_LEARN_DROP |
				VSC9953_PORT_CFG_LEARN_CPU,
				VSC9953_PORT_CFG_LEARN_ENA |
				VSC9953_PORT_CFG_LEARN_AUTO);
		break;
	default:
		printf("Unknown learn mode for port %d\n", port_no);
	}
}

/* Get learning configuration for a VSC9953 port */
static int vsc9953_port_learn_mode_get(int port_no, enum port_learn_mode *mode)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	/* Administrative down */
	if (!vsc9953_l2sw.port[port_no].enabled) {
		printf("Port %d is administrative down\n", port_no);
		return -1;
	}

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	/* For now we only support HW learning (auto) and no learning */
	val = in_le32(&l2ana_reg->port[port_no].port_cfg);
	if ((val & (VSC9953_PORT_CFG_LEARN_ENA |
		    VSC9953_PORT_CFG_LEARN_AUTO)) ==
	    (VSC9953_PORT_CFG_LEARN_ENA | VSC9953_PORT_CFG_LEARN_AUTO))
		*mode = PORT_LEARN_AUTO;
	else
		*mode = PORT_LEARN_NONE;

	return 0;
}

/* wait for FDB to become available */
static int vsc9953_mac_table_poll_idle(void)
{
	struct vsc9953_analyzer *l2ana_reg;
	u32 timeout;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	timeout = 50000;
	while (((in_le32(&l2ana_reg->ana_tables.mac_access) &
			 VSC9953_MAC_CMD_MASK) !=
		VSC9953_MAC_CMD_IDLE) && --timeout)
		udelay(1);

	return timeout ? 0 : -EBUSY;
}

/* enum describing available commands for the MAC table */
enum mac_table_cmd {
	MAC_TABLE_READ,
	MAC_TABLE_LOOKUP,
	MAC_TABLE_WRITE,
	MAC_TABLE_LEARN,
	MAC_TABLE_FORGET,
	MAC_TABLE_GET_NEXT,
	MAC_TABLE_AGE,
};

/* Issues a command to the FDB table */
static int vsc9953_mac_table_cmd(enum mac_table_cmd cmd)
{
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	switch (cmd) {
	case MAC_TABLE_READ:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK | VSC9953_MAC_CMD_VALID,
				VSC9953_MAC_CMD_READ);
		break;
	case MAC_TABLE_LOOKUP:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK, VSC9953_MAC_CMD_READ |
				VSC9953_MAC_CMD_VALID);
		break;
	case MAC_TABLE_WRITE:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK |
				VSC9953_MAC_ENTRYTYPE_MASK,
				VSC9953_MAC_CMD_WRITE |
				VSC9953_MAC_ENTRYTYPE_LOCKED);
		break;
	case MAC_TABLE_LEARN:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK |
				VSC9953_MAC_ENTRYTYPE_MASK,
				VSC9953_MAC_CMD_LEARN |
				VSC9953_MAC_ENTRYTYPE_LOCKED |
				VSC9953_MAC_CMD_VALID);
		break;
	case MAC_TABLE_FORGET:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK |
				VSC9953_MAC_ENTRYTYPE_MASK,
				VSC9953_MAC_CMD_FORGET);
		break;
	case MAC_TABLE_GET_NEXT:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK |
				VSC9953_MAC_ENTRYTYPE_MASK,
				VSC9953_MAC_CMD_NEXT);
		break;
	case MAC_TABLE_AGE:
		clrsetbits_le32(&l2ana_reg->ana_tables.mac_access,
				VSC9953_MAC_CMD_MASK |
				VSC9953_MAC_ENTRYTYPE_MASK,
				VSC9953_MAC_CMD_AGE);
		break;
	default:
		printf("Unknown MAC table command\n");
	}

	if (vsc9953_mac_table_poll_idle() < 0) {
		debug("MAC table timeout\n");
		return -1;
	}

	return 0;
}

/* show the FDB entries that correspond to a port and a VLAN */
static void vsc9953_mac_table_show(int port_no, int vid)
{
	int rc[VSC9953_MAX_PORTS];
	enum port_learn_mode mode[VSC9953_MAX_PORTS];
	int i;
	u32 val;
	u32 vlan;
	u32 mach;
	u32 macl;
	u32 dest_indx;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	/* disable auto learning */
	if (port_no == ETHSW_CMD_PORT_ALL) {
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			rc[i] = vsc9953_port_learn_mode_get(i, &mode[i]);
			if (!rc[i] && mode[i] != PORT_LEARN_NONE)
				vsc9953_port_learn_mode_set(i, PORT_LEARN_NONE);
		}
	} else {
		rc[port_no] = vsc9953_port_learn_mode_get(port_no,
							  &mode[port_no]);
		if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE)
			vsc9953_port_learn_mode_set(port_no, PORT_LEARN_NONE);
	}

	/* write port and vid to get selected FDB entries */
	val = in_le32(&l2ana_reg->ana.anag_efil);
	if (port_no != ETHSW_CMD_PORT_ALL) {
		val = bitfield_replace_by_mask(val, VSC9953_AGE_PORT_MASK,
					       port_no) | VSC9953_AGE_PORT_EN;
	}
	if (vid != ETHSW_CMD_VLAN_ALL) {
		val = bitfield_replace_by_mask(val, VSC9953_AGE_VID_MASK,
					       vid) | VSC9953_AGE_VID_EN;
	}
	out_le32(&l2ana_reg->ana.anag_efil, val);

	/* set MAC and VLAN to 0 to look from beginning */
	clrbits_le32(&l2ana_reg->ana_tables.mach_data,
		     VSC9953_MAC_VID_MASK | VSC9953_MAC_MACH_MASK);
	out_le32(&l2ana_reg->ana_tables.macl_data, 0);

	/* get entries */
	printf("%10s %17s %5s %4s\n", "EntryType", "MAC", "PORT", "VID");
	do {
		if (vsc9953_mac_table_cmd(MAC_TABLE_GET_NEXT) < 0) {
			debug("GET NEXT MAC table command failed\n");
			break;
		}

		val = in_le32(&l2ana_reg->ana_tables.mac_access);

		/* get out when an invalid entry is found */
		if (!(val & VSC9953_MAC_CMD_VALID))
			break;

		switch (val & VSC9953_MAC_ENTRYTYPE_MASK) {
		case VSC9953_MAC_ENTRYTYPE_NORMAL:
			printf("%10s ", "Dynamic");
			break;
		case VSC9953_MAC_ENTRYTYPE_LOCKED:
			printf("%10s ", "Static");
			break;
		case VSC9953_MAC_ENTRYTYPE_IPV4MCAST:
			printf("%10s ", "IPv4 Mcast");
			break;
		case VSC9953_MAC_ENTRYTYPE_IPV6MCAST:
			printf("%10s ", "IPv6 Mcast");
			break;
		default:
			printf("%10s ", "Unknown");
		}

		dest_indx = bitfield_extract_by_mask(val,
						     VSC9953_MAC_DESTIDX_MASK);

		val = in_le32(&l2ana_reg->ana_tables.mach_data);
		vlan = bitfield_extract_by_mask(val, VSC9953_MAC_VID_MASK);
		mach = bitfield_extract_by_mask(val, VSC9953_MAC_MACH_MASK);
		macl = in_le32(&l2ana_reg->ana_tables.macl_data);

		printf("%02x:%02x:%02x:%02x:%02x:%02x ", (mach >> 8) & 0xff,
		       mach & 0xff, (macl >> 24) & 0xff, (macl >> 16) & 0xff,
		       (macl >> 8) & 0xff, macl & 0xff);
		printf("%5d ", dest_indx);
		printf("%4d\n", vlan);
	} while (1);

	/* set learning mode to previous value */
	if (port_no == ETHSW_CMD_PORT_ALL) {
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (!rc[i] && mode[i] != PORT_LEARN_NONE)
				vsc9953_port_learn_mode_set(i, mode[i]);
		}
	} else {
		/* If administrative down, skip */
		if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE)
			vsc9953_port_learn_mode_set(port_no, mode[port_no]);
	}

	/* reset FDB port and VLAN FDB selection */
	clrbits_le32(&l2ana_reg->ana.anag_efil, VSC9953_AGE_PORT_EN |
		     VSC9953_AGE_PORT_MASK | VSC9953_AGE_VID_EN |
		     VSC9953_AGE_VID_MASK);
}

/* Add a static FDB entry */
static int vsc9953_mac_table_add(u8 port_no, uchar mac[6], int vid)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	val = in_le32(&l2ana_reg->ana_tables.mach_data);
	val = bitfield_replace_by_mask(val, VSC9953_MACHDATA_VID_MASK, vid) |
	      (mac[0] << 8) | (mac[1] << 0);
	out_le32(&l2ana_reg->ana_tables.mach_data, val);

	out_le32(&l2ana_reg->ana_tables.macl_data,
		 (mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) |
		 (mac[5] << 0));

	/* set on which port is the MAC address added */
	val = in_le32(&l2ana_reg->ana_tables.mac_access);
	val = bitfield_replace_by_mask(val, VSC9953_MAC_DESTIDX_MASK, port_no);
	out_le32(&l2ana_reg->ana_tables.mac_access, val);

	if (vsc9953_mac_table_cmd(MAC_TABLE_LEARN) < 0)
		return -1;

	/* check if the MAC address was indeed added */
	val = in_le32(&l2ana_reg->ana_tables.mach_data);
	val = bitfield_replace_by_mask(val, VSC9953_MACHDATA_VID_MASK, vid) |
	      (mac[0] << 8) | (mac[1] << 0);
	out_le32(&l2ana_reg->ana_tables.mach_data, val);

	out_le32(&l2ana_reg->ana_tables.macl_data,
		 (mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) |
		 (mac[5] << 0));

	if (vsc9953_mac_table_cmd(MAC_TABLE_READ) < 0)
		return -1;

	val = in_le32(&l2ana_reg->ana_tables.mac_access);

	if ((port_no != bitfield_extract_by_mask(val,
						 VSC9953_MAC_DESTIDX_MASK))) {
		printf("Failed to add MAC address\n");
		return -1;
	}
	return 0;
}

/* Delete a FDB entry */
static int vsc9953_mac_table_del(uchar mac[6], u16 vid)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	/* check first if MAC entry is present */
	val = in_le32(&l2ana_reg->ana_tables.mach_data);
	val = bitfield_replace_by_mask(val, VSC9953_MACHDATA_VID_MASK, vid) |
	      (mac[0] << 8) | (mac[1] << 0);
	out_le32(&l2ana_reg->ana_tables.mach_data, val);

	out_le32(&l2ana_reg->ana_tables.macl_data,
		 (mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) |
		 (mac[5] << 0));

	if (vsc9953_mac_table_cmd(MAC_TABLE_LOOKUP) < 0) {
		debug("Lookup in the MAC table failed\n");
		return -1;
	}

	if (!(in_le32(&l2ana_reg->ana_tables.mac_access) &
	      VSC9953_MAC_CMD_VALID)) {
		printf("The MAC address: %02x:%02x:%02x:%02x:%02x:%02x ",
		       mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
		printf("VLAN: %d does not exist.\n", vid);
		return -1;
	}

	/* FDB entry found, proceed to delete */
	val = in_le32(&l2ana_reg->ana_tables.mach_data);
	val = bitfield_replace_by_mask(val, VSC9953_MACHDATA_VID_MASK, vid) |
	      (mac[0] << 8) | (mac[1] << 0);
	out_le32(&l2ana_reg->ana_tables.mach_data, val);

	out_le32(&l2ana_reg->ana_tables.macl_data, (mac[2] << 24) |
		 (mac[3] << 16) | (mac[4] << 8) | (mac[5] << 0));

	if (vsc9953_mac_table_cmd(MAC_TABLE_FORGET) < 0)
		return -1;

	/* check if the MAC entry is still in FDB */
	val = in_le32(&l2ana_reg->ana_tables.mach_data);
	val = bitfield_replace_by_mask(val, VSC9953_MACHDATA_VID_MASK, vid) |
	      (mac[0] << 8) | (mac[1] << 0);
	out_le32(&l2ana_reg->ana_tables.mach_data, val);

	out_le32(&l2ana_reg->ana_tables.macl_data, (mac[2] << 24) |
		 (mac[3] << 16) | (mac[4] << 8) | (mac[5] << 0));

	if (vsc9953_mac_table_cmd(MAC_TABLE_LOOKUP) < 0) {
		debug("Lookup in the MAC table failed\n");
		return -1;
	}
	if (in_le32(&l2ana_reg->ana_tables.mac_access) &
	    VSC9953_MAC_CMD_VALID) {
		printf("Failed to delete MAC address\n");
		return -1;
	}

	return 0;
}

/* age the unlocked entries in FDB */
static void vsc9953_mac_table_age(int port_no, int vid)
{
	int rc[VSC9953_MAX_PORTS];
	enum port_learn_mode mode[VSC9953_MAX_PORTS];
	u32 val;
	int i;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	/* set port and VID for selective aging */
	val = in_le32(&l2ana_reg->ana.anag_efil);
	if (port_no != ETHSW_CMD_PORT_ALL) {
		/* disable auto learning */
		rc[port_no] = vsc9953_port_learn_mode_get(port_no,
							  &mode[port_no]);
		if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE)
			vsc9953_port_learn_mode_set(port_no, PORT_LEARN_NONE);

		val = bitfield_replace_by_mask(val, VSC9953_AGE_PORT_MASK,
					       port_no) | VSC9953_AGE_PORT_EN;
	} else {
		/* disable auto learning on all ports */
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			rc[i] = vsc9953_port_learn_mode_get(i, &mode[i]);
			if (!rc[i] && mode[i] != PORT_LEARN_NONE)
				vsc9953_port_learn_mode_set(i, PORT_LEARN_NONE);
		}
	}

	if (vid != ETHSW_CMD_VLAN_ALL) {
		val = bitfield_replace_by_mask(val, VSC9953_AGE_VID_MASK, vid) |
		      VSC9953_AGE_VID_EN;
	}
	out_le32(&l2ana_reg->ana.anag_efil, val);

	/* age the dynamic FDB entries */
	vsc9953_mac_table_cmd(MAC_TABLE_AGE);

	/* clear previously set port and VID */
	clrbits_le32(&l2ana_reg->ana.anag_efil, VSC9953_AGE_PORT_EN |
		     VSC9953_AGE_PORT_MASK | VSC9953_AGE_VID_EN |
		     VSC9953_AGE_VID_MASK);

	if (port_no != ETHSW_CMD_PORT_ALL) {
		if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE)
			vsc9953_port_learn_mode_set(port_no, mode[port_no]);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (!rc[i] && mode[i] != PORT_LEARN_NONE)
				vsc9953_port_learn_mode_set(i, mode[i]);
		}
	}
}

/* Delete all the dynamic FDB entries */
static void vsc9953_mac_table_flush(int port, int vid)
{
	vsc9953_mac_table_age(port, vid);
	vsc9953_mac_table_age(port, vid);
}

enum egress_vlan_tag {
	EGR_TAG_CLASS = 0,
	EGR_TAG_PVID,
};

/* Set egress tag mode for a VSC9953 port */
static void vsc9953_port_vlan_egress_tag_set(int port_no,
					     enum egress_vlan_tag mode)
{
	struct vsc9953_rew_reg *l2rew_reg;

	l2rew_reg = (struct vsc9953_rew_reg *)(VSC9953_OFFSET +
			VSC9953_REW_OFFSET);

	switch (mode) {
	case EGR_TAG_CLASS:
		clrbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
			     VSC9953_TAG_VID_PVID);
		break;
	case EGR_TAG_PVID:
		setbits_le32(&l2rew_reg->port[port_no].port_tag_cfg,
			     VSC9953_TAG_VID_PVID);
		break;
	default:
		printf("Unknown egress VLAN tag mode for port %d\n", port_no);
	}
}

/* Get egress tag mode for a VSC9953 port */
static void vsc9953_port_vlan_egress_tag_get(int port_no,
					     enum egress_vlan_tag *mode)
{
	u32 val;
	struct vsc9953_rew_reg *l2rew_reg;

	l2rew_reg = (struct vsc9953_rew_reg *)(VSC9953_OFFSET +
			VSC9953_REW_OFFSET);

	val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg);
	if (val & VSC9953_TAG_VID_PVID)
		*mode = EGR_TAG_PVID;
	else
		*mode = EGR_TAG_CLASS;
}

/* VSC9953 VLAN learning modes */
enum vlan_learning_mode {
	SHARED_VLAN_LEARNING,
	PRIVATE_VLAN_LEARNING,
};

/* Set VLAN learning mode for VSC9953 */
static void vsc9953_vlan_learning_set(enum vlan_learning_mode lrn_mode)
{
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	switch (lrn_mode) {
	case SHARED_VLAN_LEARNING:
		setbits_le32(&l2ana_reg->ana.agen_ctrl, VSC9953_FID_MASK_ALL);
		break;
	case PRIVATE_VLAN_LEARNING:
		clrbits_le32(&l2ana_reg->ana.agen_ctrl, VSC9953_FID_MASK_ALL);
		break;
	default:
		printf("Unknown VLAN learn mode\n");
	}
}

/* Get VLAN learning mode for VSC9953 */
static int vsc9953_vlan_learning_get(enum vlan_learning_mode *lrn_mode)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	val = in_le32(&l2ana_reg->ana.agen_ctrl);

	if (!(val & VSC9953_FID_MASK_ALL)) {
		*lrn_mode = PRIVATE_VLAN_LEARNING;
	} else if ((val & VSC9953_FID_MASK_ALL) == VSC9953_FID_MASK_ALL) {
		*lrn_mode = SHARED_VLAN_LEARNING;
	} else {
		printf("Unknown VLAN learning mode\n");
		return -EINVAL;
	}

	return 0;
}

/* Enable/disable VLAN ingress filtering on a VSC9953 port */
static void vsc9953_port_ingress_filtering_set(int port_no, int enabled)
{
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	if (enabled)
		setbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no);
	else
		clrbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no);
}

/* Return VLAN ingress filtering on a VSC9953 port */
static int vsc9953_port_ingress_filtering_get(int port_no)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	val = in_le32(&l2ana_reg->ana.vlan_mask);
	return !!(val & (1 << port_no));
}

/* Get the aggregation group of a port */
static int vsc9953_port_aggr_grp_get(int port_no, int *aggr_grp)
{
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	if (!VSC9953_PORT_CHECK(port_no))
		return -EINVAL;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	val = in_le32(&l2ana_reg->port[port_no].port_cfg);
	*aggr_grp = bitfield_extract_by_mask(val,
					     VSC9953_PORT_CFG_PORTID_MASK);

	return 0;
}

static void vsc9953_aggr_grp_members_get(int aggr_grp,
					 u8 aggr_membr[VSC9953_MAX_PORTS])
{
	int port_no;
	int aggr_membr_grp;

	for (port_no = 0; port_no < VSC9953_MAX_PORTS; port_no++) {
		aggr_membr[port_no] = 0;

		if (vsc9953_port_aggr_grp_get(port_no, &aggr_membr_grp))
			continue;

		if (aggr_grp == aggr_membr_grp)
			aggr_membr[port_no] = 1;
	}
}

static void vsc9953_update_dest_members_masks(int port_no, u32 membr_bitfld_old,
					      u32 membr_bitfld_new)
{
	int i;
	u32 pgid;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	/*
	 * NOTE: Only the unicast destination masks are updated, since
	 * we do not support for now Layer-2 multicast entries
	 */
	for (i = 0; i < VSC9953_MAX_PORTS; i++) {
		if (i == port_no) {
			clrsetbits_le32(&l2ana_reg->port_id_tbl.port_grp_id[i],
					VSC9953_PGID_PORT_MASK,
					membr_bitfld_new);
			continue;
		}

		pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[i]);
		if ((u32)(1 << i) & membr_bitfld_old & VSC9953_PGID_PORT_MASK)
			pgid &= ~((u32)(1 << port_no));
		if ((u32)(1 << i) & membr_bitfld_new & VSC9953_PGID_PORT_MASK)
			pgid |= ((u32)(1 << port_no));

		out_le32(&l2ana_reg->port_id_tbl.port_grp_id[i], pgid);
	}
}

static void vsc9953_update_source_members_masks(int port_no,
						u32 membr_bitfld_old,
						u32 membr_bitfld_new)
{
	int i;
	int index;
	u32 pgid;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	for (i = 0; i < VSC9953_MAX_PORTS + 1; i++) {
		index = PGID_SRC_START + i;
		pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[index]);
		if (i == port_no) {
			pgid = (pgid | VSC9953_PGID_PORT_MASK) &
			       ~membr_bitfld_new;
			out_le32(&l2ana_reg->port_id_tbl.port_grp_id[index],
				 pgid);
			continue;
		}

		if ((u32)(1 << i) & membr_bitfld_old & VSC9953_PGID_PORT_MASK)
			pgid |= (u32)(1 << port_no);

		if ((u32)(1 << i) & membr_bitfld_new & VSC9953_PGID_PORT_MASK)
			pgid &= ~(u32)(1 << port_no);
		out_le32(&l2ana_reg->port_id_tbl.port_grp_id[index], pgid);
	}
}

static u32 vsc9953_aggr_mask_get_next(u32 aggr_mask, u32 member_bitfield)
{
	if (!member_bitfield)
		return 0;

	if (!(aggr_mask & VSC9953_PGID_PORT_MASK))
		aggr_mask = 1;
	else
		aggr_mask <<= 1;

	while (!(aggr_mask & member_bitfield)) {
		aggr_mask <<= 1;
		if (!(aggr_mask & VSC9953_PGID_PORT_MASK))
			aggr_mask = 1;
	}

	return aggr_mask;
}

static void vsc9953_update_aggr_members_masks(int port_no, u32 membr_bitfld_old,
					      u32 membr_bitfld_new)
{
	int i;
	u32 pgid;
	u32 aggr_mask_old = 0;
	u32 aggr_mask_new = 0;
	struct vsc9953_analyzer *l2ana_reg;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	/* Update all the PGID aggregation masks */
	for (i = PGID_AGGR_START; i < PGID_SRC_START; i++) {
		pgid = in_le32(&l2ana_reg->port_id_tbl.port_grp_id[i]);

		aggr_mask_old = vsc9953_aggr_mask_get_next(aggr_mask_old,
							   membr_bitfld_old);
		pgid = (pgid & ~membr_bitfld_old) | aggr_mask_old;

		aggr_mask_new = vsc9953_aggr_mask_get_next(aggr_mask_new,
							   membr_bitfld_new);
		pgid = (pgid & ~membr_bitfld_new) | aggr_mask_new;

		out_le32(&l2ana_reg->port_id_tbl.port_grp_id[i], pgid);
	}
}

static u32 vsc9953_aggr_membr_bitfield_get(u8 member[VSC9953_MAX_PORTS])
{
	int i;
	u32 member_bitfield = 0;

	for (i = 0; i < VSC9953_MAX_PORTS; i++) {
		if (member[i])
			member_bitfield |= 1 << i;
	}
	member_bitfield &= VSC9953_PGID_PORT_MASK;

	return member_bitfield;
}

static void vsc9953_update_members_masks(int port_no,
					 u8 member_old[VSC9953_MAX_PORTS],
					 u8 member_new[VSC9953_MAX_PORTS])
{
	u32 membr_bitfld_old = vsc9953_aggr_membr_bitfield_get(member_old);
	u32 membr_bitfld_new = vsc9953_aggr_membr_bitfield_get(member_new);

	vsc9953_update_dest_members_masks(port_no, membr_bitfld_old,
					  membr_bitfld_new);
	vsc9953_update_source_members_masks(port_no, membr_bitfld_old,
					    membr_bitfld_new);
	vsc9953_update_aggr_members_masks(port_no, membr_bitfld_old,
					  membr_bitfld_new);
}

/* Set the aggregation group of a port */
static int vsc9953_port_aggr_grp_set(int port_no, int aggr_grp)
{
	u8 aggr_membr_old[VSC9953_MAX_PORTS];
	u8 aggr_membr_new[VSC9953_MAX_PORTS];
	int rc;
	int aggr_grp_old;
	u32 val;
	struct vsc9953_analyzer *l2ana_reg;

	if (!VSC9953_PORT_CHECK(port_no) || !VSC9953_PORT_CHECK(aggr_grp))
		return -EINVAL;

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
						VSC9953_ANA_OFFSET);

	rc = vsc9953_port_aggr_grp_get(port_no, &aggr_grp_old);
	if (rc)
		return rc;

	/* get all the members of the old aggregation group */
	vsc9953_aggr_grp_members_get(aggr_grp_old, aggr_membr_old);

	/* get all the members of the same aggregation group */
	vsc9953_aggr_grp_members_get(aggr_grp, aggr_membr_new);

	/* add current port as member to the new aggregation group */
	aggr_membr_old[port_no] = 0;
	aggr_membr_new[port_no] = 1;

	/* update masks */
	vsc9953_update_members_masks(port_no, aggr_membr_old, aggr_membr_new);

	/* Change logical port number */
	val = in_le32(&l2ana_reg->port[port_no].port_cfg);
	val = bitfield_replace_by_mask(val,
				       VSC9953_PORT_CFG_PORTID_MASK, aggr_grp);
	out_le32(&l2ana_reg->port[port_no].port_cfg, val);

	return 0;
}

static int vsc9953_port_status_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	u8 enabled;

	/* Last keyword should tell us if we should enable/disable the port */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_enable)
		enabled = 1;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_disable)
		enabled = 0;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_status_set(parsed_cmd->port, enabled);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_status_set(i, enabled);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_config_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_phy_autoneg(parsed_cmd->port);
		printf("%8s %8s %8s %8s %8s\n",
		       "Port", "Status", "Link", "Speed",
		       "Duplex");
		vsc9953_port_config_show(parsed_cmd->port);

	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_phy_autoneg(i);
		printf("%8s %8s %8s %8s %8s\n",
		       "Port", "Status", "Link", "Speed", "Duplex");
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_config_show(i);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_stats_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_statistics_show(parsed_cmd->port);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_statistics_show(i);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_stats_clear_key_func(struct ethsw_command_def
					     *parsed_cmd)
{
	int i;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_statistics_clear(parsed_cmd->port);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_statistics_clear(i);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_learn_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	enum port_learn_mode mode;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		if (vsc9953_port_learn_mode_get(parsed_cmd->port, &mode))
			return CMD_RET_FAILURE;
		printf("%7s %11s\n", "Port", "Learn mode");
		switch (mode) {
		case PORT_LEARN_NONE:
			printf("%7d %11s\n", parsed_cmd->port, "disable");
			break;
		case PORT_LEARN_AUTO:
			printf("%7d %11s\n", parsed_cmd->port, "auto");
			break;
		default:
			printf("%7d %11s\n", parsed_cmd->port, "-");
		}
	} else {
		printf("%7s %11s\n", "Port", "Learn mode");
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (vsc9953_port_learn_mode_get(i, &mode))
				continue;
			switch (mode) {
			case PORT_LEARN_NONE:
				printf("%7d %11s\n", i, "disable");
				break;
			case PORT_LEARN_AUTO:
				printf("%7d %11s\n", i, "auto");
				break;
			default:
				printf("%7d %11s\n", i, "-");
			}
		}
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_learn_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	enum port_learn_mode mode;

	/* Last keyword should tell us the learn mode */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_auto)
		mode = PORT_LEARN_AUTO;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_disable)
		mode = PORT_LEARN_NONE;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_learn_mode_set(parsed_cmd->port, mode);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_learn_mode_set(i, mode);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_fdb_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL &&
	    !VSC9953_PORT_CHECK(parsed_cmd->port)) {
		printf("Invalid port number: %d\n", parsed_cmd->port);
		return CMD_RET_FAILURE;
	}

	if (parsed_cmd->vid != ETHSW_CMD_VLAN_ALL &&
	    !VSC9953_VLAN_CHECK(parsed_cmd->vid)) {
		printf("Invalid VID number: %d\n", parsed_cmd->vid);
		return CMD_RET_FAILURE;
	}

	vsc9953_mac_table_show(parsed_cmd->port, parsed_cmd->vid);

	return CMD_RET_SUCCESS;
}

static int vsc9953_fdb_flush_key_func(struct ethsw_command_def *parsed_cmd)
{
	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL &&
	    !VSC9953_PORT_CHECK(parsed_cmd->port)) {
		printf("Invalid port number: %d\n", parsed_cmd->port);
		return CMD_RET_FAILURE;
	}

	if (parsed_cmd->vid != ETHSW_CMD_VLAN_ALL &&
	    !VSC9953_VLAN_CHECK(parsed_cmd->vid)) {
		printf("Invalid VID number: %d\n", parsed_cmd->vid);
		return CMD_RET_FAILURE;
	}

	vsc9953_mac_table_flush(parsed_cmd->port, parsed_cmd->vid);

	return CMD_RET_SUCCESS;
}

static int vsc9953_fdb_entry_add_key_func(struct ethsw_command_def *parsed_cmd)
{
	int vid;

	/* a port number must be present */
	if (parsed_cmd->port == ETHSW_CMD_PORT_ALL) {
		printf("Please specify a port\n");
		return CMD_RET_FAILURE;
	}

	if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
		printf("Invalid port number: %d\n", parsed_cmd->port);
		return CMD_RET_FAILURE;
	}

	/* Use VLAN 1 if VID is not set */
	vid = (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL ? 1 : parsed_cmd->vid);

	if (!VSC9953_VLAN_CHECK(vid)) {
		printf("Invalid VID number: %d\n", vid);
		return CMD_RET_FAILURE;
	}

	if (vsc9953_mac_table_add(parsed_cmd->port, parsed_cmd->ethaddr, vid))
		return CMD_RET_FAILURE;

	return CMD_RET_SUCCESS;
}

static int vsc9953_fdb_entry_del_key_func(struct ethsw_command_def *parsed_cmd)
{
	int vid;

	/* Use VLAN 1 if VID is not set */
	vid = (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL ? 1 : parsed_cmd->vid);

	if (!VSC9953_VLAN_CHECK(vid)) {
		printf("Invalid VID number: %d\n", vid);
		return CMD_RET_FAILURE;
	}

	if (vsc9953_mac_table_del(parsed_cmd->ethaddr, vid))
		return CMD_RET_FAILURE;

	return CMD_RET_SUCCESS;
}

static int vsc9953_pvid_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	int pvid;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}

		if (vsc9953_port_vlan_pvid_get(parsed_cmd->port, &pvid))
			return CMD_RET_FAILURE;
		printf("%7s %7s\n", "Port", "PVID");
		printf("%7d %7d\n", parsed_cmd->port, pvid);
	} else {
		printf("%7s %7s\n", "Port", "PVID");
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (vsc9953_port_vlan_pvid_get(i, &pvid))
				continue;
			printf("%7d %7d\n", i, pvid);
		}
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_pvid_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	/* PVID number should be set in parsed_cmd->vid */
	if (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL) {
		printf("Please set a pvid value\n");
		return CMD_RET_FAILURE;
	}

	if (!VSC9953_VLAN_CHECK(parsed_cmd->vid)) {
		printf("Invalid VID number: %d\n", parsed_cmd->vid);
		return CMD_RET_FAILURE;
	}

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_vlan_pvid_set(parsed_cmd->port, parsed_cmd->vid);
	} else {
		vsc9953_port_all_vlan_pvid_set(parsed_cmd->vid);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_vlan_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_vlan_membership_show(parsed_cmd->port);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_vlan_membership_show(i);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_vlan_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	int add;

	/* VLAN should be set in parsed_cmd->vid */
	if (parsed_cmd->vid == ETHSW_CMD_VLAN_ALL) {
		printf("Please set a vlan value\n");
		return CMD_RET_FAILURE;
	}

	if (!VSC9953_VLAN_CHECK(parsed_cmd->vid)) {
		printf("Invalid VID number: %d\n", parsed_cmd->vid);
		return CMD_RET_FAILURE;
	}

	/* keywords add/delete should be the last but one in array */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 2] ==
	    ethsw_id_add)
		add = 1;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 2] ==
		 ethsw_id_del)
		add = 0;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_vlan_table_membership_set(parsed_cmd->vid,
						  parsed_cmd->port, add);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_vlan_table_membership_set(parsed_cmd->vid, i,
							  add);
	}

	return CMD_RET_SUCCESS;
}
static int vsc9953_port_untag_show_key_func(
		struct ethsw_command_def *parsed_cmd)
{
	int i;

	printf("%7s\t%17s\n", "Port", "Untag");
	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_vlan_egr_untag_show(parsed_cmd->port);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_vlan_egr_untag_show(i);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_untag_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	enum egress_untag_mode mode;

	/* keywords for the untagged mode are the last in the array */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_all)
		mode = EGRESS_UNTAG_ALL;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_none)
		mode = EGRESS_UNTAG_NONE;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_pvid)
		mode = EGRESS_UNTAG_PVID_AND_ZERO;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_vlan_egr_untag_set(parsed_cmd->port, mode);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_vlan_egr_untag_set(i, mode);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_egr_vlan_tag_show_key_func(
		struct ethsw_command_def *parsed_cmd)
{
	int i;
	enum egress_vlan_tag mode;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_vlan_egress_tag_get(parsed_cmd->port, &mode);
		printf("%7s\t%12s\n", "Port", "Egress VID");
		printf("%7d\t", parsed_cmd->port);
		switch (mode) {
		case EGR_TAG_CLASS:
			printf("%12s\n", "classified");
			break;
		case EGR_TAG_PVID:
			printf("%12s\n", "pvid");
			break;
		default:
			printf("%12s\n", "-");
		}
	} else {
		printf("%7s\t%12s\n", "Port", "Egress VID");
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			vsc9953_port_vlan_egress_tag_get(i, &mode);
			switch (mode) {
			case EGR_TAG_CLASS:
				printf("%7d\t%12s\n", i, "classified");
				break;
			case EGR_TAG_PVID:
				printf("%7d\t%12s\n", i, "pvid");
				break;
			default:
				printf("%7d\t%12s\n", i, "-");
			}
		}
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_egr_vlan_tag_set_key_func(
		struct ethsw_command_def *parsed_cmd)
{
	int i;
	enum egress_vlan_tag mode;

	/* keywords for the egress vlan tag mode are the last in the array */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_pvid)
		mode = EGR_TAG_PVID;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_classified)
		mode = EGR_TAG_CLASS;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_vlan_egress_tag_set(parsed_cmd->port, mode);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_vlan_egress_tag_set(i, mode);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_vlan_learn_show_key_func(
		struct ethsw_command_def *parsed_cmd)
{
	int rc;
	enum vlan_learning_mode mode;

	rc = vsc9953_vlan_learning_get(&mode);
	if (rc)
		return CMD_RET_FAILURE;

	switch (mode) {
	case SHARED_VLAN_LEARNING:
		printf("VLAN learning mode: shared\n");
		break;
	case PRIVATE_VLAN_LEARNING:
		printf("VLAN learning mode: private\n");
		break;
	default:
		printf("Unknown VLAN learning mode\n");
		rc = CMD_RET_FAILURE;
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_vlan_learn_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	enum vlan_learning_mode mode;

	/* keywords for shared/private are the last in the array */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_shared)
		mode = SHARED_VLAN_LEARNING;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_private)
		mode = PRIVATE_VLAN_LEARNING;
	else
		return CMD_RET_USAGE;

	vsc9953_vlan_learning_set(mode);

	return CMD_RET_SUCCESS;
}

static int vsc9953_ingr_fltr_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	int enabled;

	printf("%7s\t%18s\n", "Port", "Ingress filtering");
	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		enabled = vsc9953_port_ingress_filtering_get(parsed_cmd->port);
		printf("%7d\t%18s\n", parsed_cmd->port, enabled ? "enable" :
								  "disable");
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			enabled = vsc9953_port_ingress_filtering_get(i);
			printf("%7d\t%18s\n", parsed_cmd->port, enabled ?
								"enable" :
								"disable");
		}
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_ingr_fltr_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	int enable;

	/* keywords for enabling/disabling ingress filtering
	 * are the last in the array
	 */
	if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
	    ethsw_id_enable)
		enable = 1;
	else if (parsed_cmd->cmd_to_keywords[parsed_cmd->cmd_keywords_nr - 1] ==
		 ethsw_id_disable)
		enable = 0;
	else
		return CMD_RET_USAGE;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		vsc9953_port_ingress_filtering_set(parsed_cmd->port, enable);
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++)
			vsc9953_port_ingress_filtering_set(i, enable);
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_aggr_show_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;
	int aggr_grp;

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}

		if (vsc9953_port_aggr_grp_get(parsed_cmd->port, &aggr_grp))
			return CMD_RET_FAILURE;
		printf("%7s %10s\n", "Port", "Aggr grp");
		printf("%7d %10d\n", parsed_cmd->port, aggr_grp);
	} else {
		printf("%7s %10s\n", "Port", "Aggr grp");
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (vsc9953_port_aggr_grp_get(i, &aggr_grp))
				continue;
			printf("%7d %10d\n", i, aggr_grp);
		}
	}

	return CMD_RET_SUCCESS;
}

static int vsc9953_port_aggr_set_key_func(struct ethsw_command_def *parsed_cmd)
{
	int i;

	/* Aggregation group number should be set in parsed_cmd->aggr_grp */
	if (parsed_cmd->aggr_grp == ETHSW_CMD_AGGR_GRP_NONE) {
		printf("Please set an aggregation group value\n");
		return CMD_RET_FAILURE;
	}

	if (!VSC9953_PORT_CHECK(parsed_cmd->aggr_grp)) {
		printf("Invalid aggregation group number: %d\n",
		       parsed_cmd->aggr_grp);
		return CMD_RET_FAILURE;
	}

	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
			printf("Invalid port number: %d\n", parsed_cmd->port);
			return CMD_RET_FAILURE;
		}
		if (vsc9953_port_aggr_grp_set(parsed_cmd->port,
					      parsed_cmd->aggr_grp)) {
			printf("Port %d: failed to set aggr group %d\n",
			       parsed_cmd->port, parsed_cmd->aggr_grp);
		}
	} else {
		for (i = 0; i < VSC9953_MAX_PORTS; i++) {
			if (vsc9953_port_aggr_grp_set(i,
						      parsed_cmd->aggr_grp)) {
				printf("Port %d: failed to set aggr group %d\n",
				       i, parsed_cmd->aggr_grp);
			}
		}
	}

	return CMD_RET_SUCCESS;
}

static struct ethsw_command_func vsc9953_cmd_func = {
		.ethsw_name = "L2 Switch VSC9953",
		.port_enable = &vsc9953_port_status_key_func,
		.port_disable = &vsc9953_port_status_key_func,
		.port_show = &vsc9953_port_config_key_func,
		.port_stats = &vsc9953_port_stats_key_func,
		.port_stats_clear = &vsc9953_port_stats_clear_key_func,
		.port_learn = &vsc9953_learn_set_key_func,
		.port_learn_show = &vsc9953_learn_show_key_func,
		.fdb_show = &vsc9953_fdb_show_key_func,
		.fdb_flush = &vsc9953_fdb_flush_key_func,
		.fdb_entry_add = &vsc9953_fdb_entry_add_key_func,
		.fdb_entry_del = &vsc9953_fdb_entry_del_key_func,
		.pvid_show = &vsc9953_pvid_show_key_func,
		.pvid_set = &vsc9953_pvid_set_key_func,
		.vlan_show = &vsc9953_vlan_show_key_func,
		.vlan_set = &vsc9953_vlan_set_key_func,
		.port_untag_show = &vsc9953_port_untag_show_key_func,
		.port_untag_set = &vsc9953_port_untag_set_key_func,
		.port_egr_vlan_show = &vsc9953_egr_vlan_tag_show_key_func,
		.port_egr_vlan_set = &vsc9953_egr_vlan_tag_set_key_func,
		.vlan_learn_show = &vsc9953_vlan_learn_show_key_func,
		.vlan_learn_set = &vsc9953_vlan_learn_set_key_func,
		.port_ingr_filt_show = &vsc9953_ingr_fltr_show_key_func,
		.port_ingr_filt_set = &vsc9953_ingr_fltr_set_key_func,
		.port_aggr_show = &vsc9953_port_aggr_show_key_func,
		.port_aggr_set = &vsc9953_port_aggr_set_key_func,
};

#endif /* CONFIG_CMD_ETHSW */

/*****************************************************************************
At startup, the default configuration would be:
	- HW learning enabled on all ports; (HW default)
	- All ports are in VLAN 1;
	- All ports are VLAN aware;
	- All ports have POP_COUNT 1;
	- All ports have PVID 1;
	- All ports have TPID 0x8100; (HW default)
	- All ports tag frames classified to all VLANs that are not PVID;
*****************************************************************************/
void vsc9953_default_configuration(void)
{
	int i;

	if (vsc9953_autoage_time_set(VSC9953_DEFAULT_AGE_TIME))
		debug("VSC9953: failed to set AGE time to %d\n",
		      VSC9953_DEFAULT_AGE_TIME);

	for (i = 0; i < VSC9953_MAX_VLAN; i++)
		vsc9953_vlan_table_membership_all_set(i, 0);
	vsc9953_port_all_vlan_aware_set(1);
	vsc9953_port_all_vlan_pvid_set(1);
	vsc9953_port_all_vlan_poncnt_set(1);
	vsc9953_vlan_table_membership_all_set(1, 1);
	vsc9953_vlan_ingr_fltr_learn_drop(1);
	vsc9953_port_all_vlan_egress_untagged_set(EGRESS_UNTAG_PVID_AND_ZERO);
	if (vsc9953_aggr_code_set(AGGR_CODE_ALL))
		debug("VSC9953: failed to set default aggregation code mode\n");
}

void vsc9953_init(bd_t *bis)
{
	u32 i;
	u32 hdx_cfg = 0;
	u32 phy_addr = 0;
	int timeout;
	struct vsc9953_system_reg *l2sys_reg;
	struct vsc9953_qsys_reg *l2qsys_reg;
	struct vsc9953_dev_gmii *l2dev_gmii_reg;
	struct vsc9953_analyzer *l2ana_reg;
	struct vsc9953_devcpu_gcb *l2dev_gcb;

	l2dev_gmii_reg = (struct vsc9953_dev_gmii *)(VSC9953_OFFSET +
			VSC9953_DEV_GMII_OFFSET);

	l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
			VSC9953_ANA_OFFSET);

	l2sys_reg = (struct vsc9953_system_reg *)(VSC9953_OFFSET +
			VSC9953_SYS_OFFSET);

	l2qsys_reg = (struct vsc9953_qsys_reg *)(VSC9953_OFFSET +
			VSC9953_QSYS_OFFSET);

	l2dev_gcb = (struct vsc9953_devcpu_gcb *)(VSC9953_OFFSET +
			VSC9953_DEVCPU_GCB);

	out_le32(&l2dev_gcb->chip_regs.soft_rst,
		 VSC9953_SOFT_SWC_RST_ENA);
	timeout = 50000;
	while ((in_le32(&l2dev_gcb->chip_regs.soft_rst) &
			VSC9953_SOFT_SWC_RST_ENA) && --timeout)
		udelay(1); /* busy wait for vsc9953 soft reset */
	if (timeout == 0)
		debug("Timeout waiting for VSC9953 to reset\n");

	out_le32(&l2sys_reg->sys.reset_cfg, VSC9953_MEM_ENABLE |
		 VSC9953_MEM_INIT);

	timeout = 50000;
	while ((in_le32(&l2sys_reg->sys.reset_cfg) &
		VSC9953_MEM_INIT) && --timeout)
		udelay(1); /* busy wait for vsc9953 memory init */
	if (timeout == 0)
		debug("Timeout waiting for VSC9953 memory to initialize\n");

	out_le32(&l2sys_reg->sys.reset_cfg, (in_le32(&l2sys_reg->sys.reset_cfg)
			| VSC9953_CORE_ENABLE));

	/* VSC9953 Setting to be done once only */
	out_le32(&l2qsys_reg->sys.ext_cpu_cfg, 0x00000b00);

	for (i = 0; i < VSC9953_MAX_PORTS; i++) {
		if (vsc9953_port_init(i))
			printf("Failed to initialize l2switch port %d\n", i);

		if (!vsc9953_l2sw.port[i].enabled)
			continue;

		/* Enable VSC9953 GMII Ports Port ID 0 - 7 */
		if (VSC9953_INTERNAL_PORT_CHECK(i)) {
			out_le32(&l2ana_reg->pfc[i].pfc_cfg,
				 VSC9953_PFC_FC_QSGMII);
			out_le32(&l2sys_reg->pause_cfg.mac_fc_cfg[i],
				 VSC9953_MAC_FC_CFG_QSGMII);
		} else {
			out_le32(&l2ana_reg->pfc[i].pfc_cfg,
				 VSC9953_PFC_FC);
			out_le32(&l2sys_reg->pause_cfg.mac_fc_cfg[i],
				 VSC9953_MAC_FC_CFG);
		}

		l2dev_gmii_reg = (struct vsc9953_dev_gmii *)
				 (VSC9953_OFFSET + VSC9953_DEV_GMII_OFFSET +
				 T1040_SWITCH_GMII_DEV_OFFSET * i);

		out_le32(&l2dev_gmii_reg->port_mode.clock_cfg,
			 VSC9953_CLOCK_CFG);
		out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_ena_cfg,
			 VSC9953_MAC_ENA_CFG);
		out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_mode_cfg,
			 VSC9953_MAC_MODE_CFG);
		out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_ifg_cfg,
			 VSC9953_MAC_IFG_CFG);
		/* mac_hdx_cfg varies with port id*/
		hdx_cfg = VSC9953_MAC_HDX_CFG | (i << 16);
		out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_hdx_cfg, hdx_cfg);
		out_le32(&l2sys_reg->sys.front_port_mode[i],
			 VSC9953_FRONT_PORT_MODE);
		setbits_le32(&l2qsys_reg->sys.switch_port_mode[i],
			     VSC9953_PORT_ENA);
		out_le32(&l2dev_gmii_reg->mac_cfg_status.mac_maxlen_cfg,
			 VSC9953_MAC_MAX_LEN);
		out_le32(&l2sys_reg->pause_cfg.pause_cfg[i],
			 VSC9953_PAUSE_CFG);
		/* WAIT FOR 2 us*/
		udelay(2);

		/* Initialize Lynx PHY Wrappers */
		phy_addr = 0;
		if (vsc9953_l2sw.port[i].enet_if ==
				PHY_INTERFACE_MODE_QSGMII)
			phy_addr = (i + 0x4) & 0x1F;
		else if (vsc9953_l2sw.port[i].enet_if ==
				PHY_INTERFACE_MODE_SGMII)
			phy_addr = (i + 1) & 0x1F;

		if (phy_addr) {
			/* SGMII IF mode + AN enable */
			vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr,
					   0x14, PHY_SGMII_IF_MODE_AN |
					   PHY_SGMII_IF_MODE_SGMII);
			/* Dev ability according to SGMII specification */
			vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr,
					   0x4, PHY_SGMII_DEV_ABILITY_SGMII);
			/* Adjust link timer for SGMII
			 * 1.6 ms in units of 8 ns = 2 * 10^5 = 0x30d40
			 */
			vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr,
					   0x13, 0x0003);
			vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr,
					   0x12, 0x0d40);
			/* Restart AN */
			vsc9953_mdio_write(&l2dev_gcb->mii_mng[0], phy_addr,
					   0x0, PHY_SGMII_CR_DEF_VAL |
					   PHY_SGMII_CR_RESET_AN);

			timeout = 50000;
			while ((vsc9953_mdio_read(&l2dev_gcb->mii_mng[0],
					phy_addr, 0x01) & 0x0020) && --timeout)
				udelay(1); /* wait for AN to complete */
			if (timeout == 0)
				debug("Timeout waiting for AN to complete\n");
		}
	}

	vsc9953_default_configuration();

#ifdef CONFIG_CMD_ETHSW
	if (ethsw_define_functions(&vsc9953_cmd_func) < 0)
		debug("Unable to use \"ethsw\" commands\n");
#endif

	printf("VSC9953 L2 switch initialized\n");
	return;
}
