summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-12-22 10:33:04 -0500
committerTom Rini <trini@konsulko.com>2022-12-22 10:33:04 -0500
commit52d91e1c20b399ddab276e2c03e5788ed5e5fdd2 (patch)
tree3da0b0377b27eedd5d702c77fbb63a0d905a3f77 /drivers
parent14f43797d0a696248c09d298e2f2809dded345ba (diff)
parent8214b772cf213f1f02e5e33f4a5158f52d9d2c23 (diff)
Merge branch '2022-12-21-CONFIG-migration-work' into next
- Bring in the second to last big batch of CONFIG migrations and renames. Of note here we fix a few inconsistencies around the baudrate tables on some SoCs and now are consistent in hostname/etc handling in the environment.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/adc/adc-uclass.c2
-rw-r--r--drivers/ddr/fsl/ctrl_regs.c17
-rw-r--r--drivers/ddr/fsl/mpc85xx_ddr_gen1.c2
-rw-r--r--drivers/dma/fsl_dma.c4
-rw-r--r--drivers/i2c/Kconfig2
-rw-r--r--drivers/i2c/mv_i2c.c33
-rw-r--r--drivers/mmc/Kconfig14
-rw-r--r--drivers/mmc/fsl_esdhc_imx.c2
-rw-r--r--drivers/mtd/Kconfig28
-rw-r--r--drivers/mtd/cfi_flash.c4
-rw-r--r--drivers/mtd/nand/raw/Kconfig4
-rw-r--r--drivers/mtd/nand/raw/fsl_ifc_spl.c6
-rw-r--r--drivers/net/Kconfig28
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/fec_mxc.c4
-rw-r--r--drivers/net/mvgbe.c4
-rw-r--r--drivers/net/mvgbe.h7
-rw-r--r--drivers/net/qe/uec.h1
-rw-r--r--drivers/net/ti/Kconfig13
-rw-r--r--drivers/net/ti/cpsw.c4
-rw-r--r--drivers/net/vsc9953.c2754
-rw-r--r--drivers/power/pmic/Kconfig3
-rw-r--r--drivers/ram/mpc83xx_sdram.c7
-rw-r--r--drivers/rtc/mc146818.c2
-rw-r--r--drivers/serial/usbtty.c50
-rw-r--r--drivers/serial/usbtty.h4
-rw-r--r--drivers/spi/Kconfig10
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/gadget/ep0.c19
29 files changed, 112 insertions, 2918 deletions
diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c
index 67137ffb341..9646e4d7062 100644
--- a/drivers/adc/adc-uclass.c
+++ b/drivers/adc/adc-uclass.c
@@ -22,7 +22,7 @@
#define CHECK_MASK (!CHECK_NUMBER)
/* TODO: add support for timer uclass (for early calls) */
-#ifdef CONFIG_SANDBOX_ARCH
+#ifdef CONFIG_SANDBOX
#define sdelay(x) udelay(x)
#else
extern void sdelay(unsigned long loops);
diff --git a/drivers/ddr/fsl/ctrl_regs.c b/drivers/ddr/fsl/ctrl_regs.c
index df7ec484651..759921bc582 100644
--- a/drivers/ddr/fsl/ctrl_regs.c
+++ b/drivers/ddr/fsl/ctrl_regs.c
@@ -938,7 +938,7 @@ static void set_ddr_sdram_cfg_2(const unsigned int ctrl_num,
#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
/* Use the DDR controller to auto initialize memory. */
d_init = popts->ecc_init_using_memctl;
- ddr->ddr_data_init = CONFIG_MEM_INIT_VALUE;
+ ddr->ddr_data_init = 0xDEADBEEF;
debug("DDR: ddr_data_init = 0x%08x\n", ddr->ddr_data_init);
#else
/* Memory will be initialized via DMA, or not at all. */
@@ -1842,19 +1842,6 @@ static void set_ddr_sdram_mode(const unsigned int ctrl_num,
}
#endif
-/* DDR SDRAM Data Initialization (DDR_DATA_INIT) */
-static void set_ddr_data_init(fsl_ddr_cfg_regs_t *ddr)
-{
- unsigned int init_value; /* Initialization value */
-
-#ifdef CONFIG_MEM_INIT_VALUE
- init_value = CONFIG_MEM_INIT_VALUE;
-#else
- init_value = 0xDEADBEEF;
-#endif
- ddr->ddr_data_init = init_value;
-}
-
/*
* DDR SDRAM Clock Control (DDR_SDRAM_CLK_CNTL)
* The old controller on the 8540/60 doesn't have this register.
@@ -2537,7 +2524,7 @@ compute_fsl_memctl_config_regs(const unsigned int ctrl_num,
set_ddr_sdram_rcw(ctrl_num, ddr, popts, common_dimm);
set_ddr_sdram_interval(ctrl_num, ddr, popts, common_dimm);
- set_ddr_data_init(ddr);
+ ddr->ddr_data_init = 0xDEADBEEF;
set_ddr_sdram_clk_cntl(ddr, popts);
set_ddr_init_addr(ddr);
set_ddr_init_ext_addr(ddr);
diff --git a/drivers/ddr/fsl/mpc85xx_ddr_gen1.c b/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
index 0f1e99eeb03..16186bdbae7 100644
--- a/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
+++ b/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
@@ -73,7 +73,7 @@ ddr_enable_ecc(unsigned int dram_size)
struct ccsr_ddr __iomem *ddr =
(struct ccsr_ddr __iomem *)(CFG_SYS_FSL_DDR_ADDR);
- dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
+ dma_meminit(dram_size);
/*
* Enable errors for ECC.
diff --git a/drivers/dma/fsl_dma.c b/drivers/dma/fsl_dma.c
index cd78e45d888..700df2236bd 100644
--- a/drivers/dma/fsl_dma.c
+++ b/drivers/dma/fsl_dma.c
@@ -133,7 +133,7 @@ int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count) {
*/
#if ((!defined CONFIG_MPC83xx && defined(CONFIG_DDR_ECC) && \
!defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)))
-void dma_meminit(uint val, uint size)
+void dma_meminit(uint size)
{
uint *p = 0;
uint i = 0;
@@ -142,7 +142,7 @@ void dma_meminit(uint val, uint size)
if (((uint)p & 0x1f) == 0)
ppcDcbz((ulong)p);
- *p = (uint)CONFIG_MEM_INIT_VALUE;
+ *p = (uint)0xDEADBEEF;
if (((uint)p & 0x1c) == 0x1c)
ppcDcbf((ulong)p);
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 08b6c7bdcc4..76e19918aad 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -704,7 +704,7 @@ config SYS_I2C_BUS_MAX
depends on ARCH_OMAP2PLUS || ARCH_SOCFPGA
default 2 if TI816X
default 3 if OMAP34XX || AM33XX || AM43XX
- default 4 if ARCH_SOCFPGA || OMAP44XX || TI814X
+ default 4 if ARCH_SOCFPGA || OMAP44XX
default 5 if OMAP54XX
help
Define the maximum number of available I2C buses.
diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index 8ee17f0a450..5bc9cd7b295 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -374,45 +374,12 @@ static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen,
static struct mv_i2c *base_glob;
-#ifdef CONFIG_I2C_MULTI_BUS
-static unsigned long i2c_regs[CONFIG_MV_I2C_NUM] = CONFIG_MV_I2C_REG;
-static unsigned int bus_initialized[CONFIG_MV_I2C_NUM];
-static unsigned int current_bus;
-
-int i2c_set_bus_num(unsigned int bus)
-{
- if ((bus < 0) || (bus >= CONFIG_MV_I2C_NUM)) {
- printf("Bad bus: %d\n", bus);
- return -1;
- }
-
- base_glob = (struct mv_i2c *)i2c_regs[bus];
- current_bus = bus;
-
- if (!bus_initialized[current_bus]) {
- bus_initialized[current_bus] = 1;
- }
-
- return 0;
-}
-
-unsigned int i2c_get_bus_num(void)
-{
- return current_bus;
-}
-#endif
-
/* API Functions */
void i2c_init(int speed, int slaveaddr)
{
u32 val;
-#ifdef CONFIG_I2C_MULTI_BUS
- current_bus = 0;
- base_glob = (struct mv_i2c *)i2c_regs[current_bus];
-#else
base_glob = (struct mv_i2c *)CONFIG_MV_I2C_REG;
-#endif
if (speed > I2C_SPEED_STANDARD_RATE)
val = ICR_FM;
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index bf4d994ff69..878f867c627 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -385,6 +385,11 @@ config MMC_OMAP36XX_PINS
If unsure, say N.
+config HSMMC2_8BIT
+ bool "Enable 8-bit interface for eMMC (interface #2)"
+ depends on MMC_OMAP_HS && (OMAP44XX || OMAP54XX || DRA7XX || AM33XX || \
+ AM43XX || ARCH_KEYSTONE)
+
config SH_SDHI
bool "SuperH/Renesas ARM SoCs on-chip SDHI host controller support"
depends on ARCH_RMOBILE
@@ -820,8 +825,13 @@ config MMC_MTK
endif
+config FSL_SDHC_V2_3
+ bool
+
config FSL_ESDHC
bool "Freescale/NXP eSDHC controller support"
+ select FSL_SDHC_V2_3 if ARCH_P1010 || ARCH_BSC9131 || ARCH_BSC9132 \
+ || ARCH_C29X
help
This selects support for the eSDHC (Enhanced Secure Digital Host
Controller) found on numerous Freescale/NXP SoCs.
@@ -881,6 +891,10 @@ config FSL_USDHC
help
This enables the Ultra Secured Digital Host Controller enhancements
+config FSL_ESDHC_PIN_MUX
+ bool "Perform esdhc device-tree fixup"
+ depends on (FSL_ESDHC || FSL_ESDHC_IMX) && OF_LIBFDT
+
endmenu
config SYS_FSL_ERRATUM_ESDHC111
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 5ee3ce78231..66caf683f74 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1360,7 +1360,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis)
#if CONFIG_IS_ENABLED(OF_LIBFDT)
__weak int esdhc_status_fixup(void *blob, const char *compat)
{
- if (IS_ENABLED(FSL_ESDHC_PIN_MUX) && !hwconfig("esdhc")) {
+ if (IS_ENABLED(CONFIG_FSL_ESDHC_PIN_MUX) && !hwconfig("esdhc")) {
do_fixup_by_compat(blob, compat, "status", "disabled",
sizeof("disabled"), 1);
return 1;
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index d8e2dec0a8d..af45ef00dae 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -77,6 +77,15 @@ config SYS_FLASH_CFI_WIDTH
help
This must be kept in sync with the table in include/flash.h
+config FLASH_SHOW_PROGRESS
+ int "Print out a countdown durinng writes"
+ depends on FLASH_CFI_DRIVER
+ default 45
+ help
+ If set to a non-zero value, print out countdown digits and dots.
+ Recommended value: 45 (9..1) for 80 column displays, 15 (3..1) for 40
+ column displays.
+
config CFI_FLASH
bool "Enable Driver Model for CFI Flash driver"
depends on DM_MTD
@@ -110,6 +119,13 @@ config SYS_FLASH_EMPTY_INFO
bool "Enable displaying empty sectors in flash info"
depends on FLASH_CFI_DRIVER
+config FLASH_SPANSION_S29WS_N
+ bool "Non-standard s29ws-n MirrorBit flash"
+ depends on FLASH_CFI_DRIVER
+ help
+ Enable this if the s29ws-n MirrorBit flash has non-standard addresses
+ for buffered write commands.
+
config FLASH_CFI_MTD
bool "Enable CFI MTD driver"
depends on FLASH_CFI_DRIVER
@@ -147,6 +163,18 @@ config SYS_FLASH_CHECKSUM
If the variable flashchecksum is set in the environment, perform a CRC
of the flash and print the value to console.
+config FLASH_VERIFY
+ bool "Compare writes to NOR flash with source location"
+ depends on MTD_NOR_FLASH
+ help
+ If enabled, the content of the flash (destination) is compared
+ against the source after the write operation. An error message will
+ be printed when the contents are not identical. Please note that
+ this option is useless in nearly all cases, since such flash
+ programming errors usually are detected earlier while
+ unprotecting/erasing/programming. Please only enable this option if
+ you really know what you are doing.
+
config ALTERA_QSPI
bool "Altera Generic Quad SPI Controller"
depends on DM_MTD
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index c1cdd2cbc3e..f378f6fb613 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1292,7 +1292,7 @@ void flash_print_info(flash_info_t *info)
* effect updates to digit and dots. Repeated code is nasty too, so
* we define it once here.
*/
-#ifdef CONFIG_FLASH_SHOW_PROGRESS
+#if CONFIG_FLASH_SHOW_PROGRESS
#define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \
if (flash_verbose) { \
dots -= dots_sub; \
@@ -1325,7 +1325,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
#ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE
int buffered_size;
#endif
-#ifdef CONFIG_FLASH_SHOW_PROGRESS
+#if CONFIG_FLASH_SHOW_PROGRESS
int digit = CONFIG_FLASH_SHOW_PROGRESS;
int scale = 0;
int dots = 0;
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 25b829f11cd..1e4e5c92067 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -479,6 +479,10 @@ config SYS_NAND_SIZE
depends on NAND_MXC && SPL_NAND_SUPPORT
default 268435456
+config MXC_NAND_HWECC
+ bool "Hardware ECC support in MXC NAND"
+ depends on NAND_MXC
+
config NAND_MXS
bool "MXS NAND support"
depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
diff --git a/drivers/mtd/nand/raw/fsl_ifc_spl.c b/drivers/mtd/nand/raw/fsl_ifc_spl.c
index 3b464ce10ce..60a865b5667 100644
--- a/drivers/mtd/nand/raw/fsl_ifc_spl.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_spl.c
@@ -278,11 +278,11 @@ void nand_boot(void)
* U-Boot header is appended at end of U-boot image, so
* calculate U-boot header address using U-boot header size.
*/
-#define CONFIG_U_BOOT_HDR_ADDR \
+#define FSL_U_BOOT_HDR_ADDR \
((CFG_SYS_NAND_U_BOOT_START + \
CFG_SYS_NAND_U_BOOT_SIZE) - \
- CONFIG_U_BOOT_HDR_SIZE)
- spl_validate_uboot(CONFIG_U_BOOT_HDR_ADDR,
+ FSL_U_BOOT_HDR_SIZE)
+ spl_validate_uboot(FSL_U_BOOT_HDR_ADDR,
CFG_SYS_NAND_U_BOOT_START);
/*
* In case of failure in validation, spl_validate_uboot would
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 4e5da5ab72a..7873538cc2d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -198,6 +198,18 @@ config DRIVER_DM9000
help
The Davicom DM9000 parallel bus external ethernet interface chip.
+config DM9000_BYTE_SWAPPED
+ bool "Byte swapped access for DM9000"
+ depends on DRIVER_DM9000
+
+config DM9000_NO_SROM
+ bool "No SROM on DM9000"
+ depends on DRIVER_DM9000
+
+config DM9000_USE_16BIT
+ bool "Use 16bit access in DM9000"
+ depends on DRIVER_DM9000
+
config DWC_ETH_QOS
bool "Synopsys DWC Ethernet QOS device support"
select PHYLIB
@@ -360,6 +372,7 @@ config FMAN_ENET
select SYS_FMAN_V3 if ARCH_B4420 || ARCH_B4860 || ARCH_LS1043A || \
ARCH_LS1046A || ARCH_T1024 || ARCH_T1040 || ARCH_T1042 || \
ARCH_T2080 || ARCH_T4240
+ select FSL_FM_10GEC_REGULAR_NOTATION if ARCH_T1024
help
This driver support the Freescale FMan Ethernet controller
@@ -379,6 +392,18 @@ config SYS_FMAN_V3
help
SoC has FMan v3 with mEMAC
+config FSL_FM_10GEC_REGULAR_NOTATION
+ bool
+ help
+ On SoCs T4240, T2080, LS1043A, etc, the notation between 10GEC and
+ MAC as below:
+ 10GEC1->MAC9, 10GEC2->MAC10, 10GEC3->MAC1, 10GEC4->MAC2
+ While on SoCs T1024, etc, the notation between 10GEC and MAC as below:
+ 10GEC1->MAC1, 10GEC2->MAC2
+ so we introduce CONFIG_FSL_FM_10GEC_REGULAR_NOTATION to identify the
+ new SoCs on which 10GEC enumeration is consistent with MAC
+ enumeration.
+
config FTMAC100
bool "Ftmac100 Ethernet Support"
help
@@ -684,9 +709,6 @@ config XILINX_AXIMRMAC
config VSC7385_ENET
bool "Vitesse 7385 Switch Firmware Upload driver"
-config VSC9953
- bool "Vitesse VSC9953 L2 Switch driver"
-
config XILINX_EMACLITE
select PHYLIB
select MII
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index d3fc6b7d3ee..5b4e60eea3e 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -87,7 +87,6 @@ obj-$(CONFIG_SUN8I_EMAC) += sun8i_emac.o
obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
obj-$(CONFIG_TULIP) += dc2114x.o
obj-$(CONFIG_VSC7385_ENET) += vsc7385.o
-obj-$(CONFIG_VSC9953) += vsc9953.o
obj-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o
obj-$(CONFIG_XILINX_AXIMRMAC) += xilinx_axi_mrmac.o
obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index a61a1fc7573..9cb235ad5e3 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -268,7 +268,6 @@ static int miiphy_restart_aneg(struct eth_device *dev)
return ret;
}
-#ifndef CONFIG_FEC_FIXED_SPEED
static int miiphy_wait_aneg(struct eth_device *dev)
{
uint32_t start;
@@ -294,7 +293,6 @@ static int miiphy_wait_aneg(struct eth_device *dev)
return 0;
}
-#endif /* CONFIG_FEC_FIXED_SPEED */
#endif
static int fec_rx_task_enable(struct fec_priv *fec)
@@ -536,8 +534,6 @@ static int fec_open(struct udevice *dev)
}
speed = fec->phydev->speed;
}
-#elif CONFIG_FEC_FIXED_SPEED
- speed = CONFIG_FEC_FIXED_SPEED;
#else
miiphy_wait_aneg(edev);
speed = miiphy_speed(edev->name, fec->phy_id);
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 58363fce057..3587ca2124e 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -37,10 +37,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#ifndef CONFIG_MVGBE_PORTS
-# define CONFIG_MVGBE_PORTS {0, 0}
-#endif
-
#define MV_PHY_ADR_REQUEST 0xee
#define MVGBE_SMI_REG (((struct mvgbe_registers *)MVGBE0_BASE)->smi)
#define MVGBE_PGADR_REG 22
diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h
index e3f5ac06399..6514ab67bab 100644
--- a/drivers/net/mvgbe.h
+++ b/drivers/net/mvgbe.h
@@ -11,13 +11,6 @@
#ifndef __MVGBE_H__
#define __MVGBE_H__
-/* PHY_BASE_ADR is board specific and can be configured */
-#if defined (CONFIG_PHY_BASE_ADR)
-#define PHY_BASE_ADR CONFIG_PHY_BASE_ADR
-#else
-#define PHY_BASE_ADR 0x08 /* default phy base addr */
-#endif
-
/* Constants */
#define INT_CAUSE_UNMASK_ALL 0x0007ffff
#define INT_CAUSE_UNMASK_ALL_EXT 0x0011ffff
diff --git a/drivers/net/qe/uec.h b/drivers/net/qe/uec.h
index 551d7061ccc..4510205da32 100644
--- a/drivers/net/qe/uec.h
+++ b/drivers/net/qe/uec.h
@@ -689,5 +689,4 @@ struct uec_priv {
int uec_initialize(struct bd_info *bis, struct uec_inf *uec_info);
int uec_eth_init(struct bd_info *bis, struct uec_inf *uecs, int num);
-int uec_standard_init(struct bd_info *bis);
#endif /* __UEC_H__ */
diff --git a/drivers/net/ti/Kconfig b/drivers/net/ti/Kconfig
index 59c96d862dd..e13dbc94018 100644
--- a/drivers/net/ti/Kconfig
+++ b/drivers/net/ti/Kconfig
@@ -25,6 +25,19 @@ config DRIVER_TI_KEYSTONE_NET
help
This driver supports the TI Keystone 2 Ethernet subsystem
+choice
+ prompt "TI Keystone 2 Ethernet NETCP IP revision"
+ depends on DRIVER_TI_KEYSTONE_NET
+ default KSNET_NETCP_V1_5
+
+config KSNET_NETCP_V1_0
+ bool "NETCP version 1.0"
+
+config KSNET_NETCP_V1_5
+ bool "NETCP version 1.5"
+
+endchoice
+
config TI_AM65_CPSW_NUSS
bool "TI K3 AM65x MCU CPSW Nuss Ethernet controller driver"
depends on ARCH_K3
diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index a19dc38e525..3a8cc9c52a5 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -79,10 +79,6 @@ struct cpsw_slave_regs {
u32 tx_pri_map;
#ifdef CONFIG_AM33XX
u32 gap_thresh;
-#elif defined(CONFIG_TI814X)
- u32 ts_ctl;
- u32 ts_seq_ltype;
- u32 ts_vlan;
#endif
u32 sa_lo;
u32 sa_hi;
diff --git a/drivers/net/vsc9953.c b/drivers/net/vsc9953.c
deleted file mode 100644
index 29f26b4b332..00000000000
--- a/drivers/net/vsc9953.c
+++ /dev/null
@@ -1,2754 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2014 - 2015 Freescale Semiconductor, Inc.
- *
- * Driver for the Vitesse VSC9953 L2 Switch
- */
-
-#include <common.h>
-#include <command.h>
-#include <log.h>
-#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>
-#include <linux/delay.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");
-}
-
-static void vcap_entry2cache_init(u32 target, u32 entry_words)
-{
- int i;
-
- for (i = 0; i < entry_words; i++) {
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CACHE_ENTRY_DAT(target, i)), 0x00);
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CACHE_MASK_DAT(target, i)), 0xFF);
- }
-
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CACHE_TG_DAT(target)), 0x00);
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_MV_CFG(target)),
- VSC9953_VCAP_CFG_MV_CFG_SIZE(entry_words));
-}
-
-static void vcap_action2cache_init(u32 target, u32 action_words,
- u32 counter_words)
-{
- int i;
-
- for (i = 0; i < action_words; i++)
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CACHE_ACTION_DAT(target, i)), 0x00);
-
- for (i = 0; i < counter_words; i++)
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CACHE_CNT_DAT(target, i)), 0x00);
-}
-
-static int vcap_cmd(u32 target, u16 ix, int cmd, int sel, int entry_count)
-{
- u32 tgt = target;
- u32 value = (VSC9953_VCAP_UPDATE_CTRL_UPDATE_CMD(cmd) |
- VSC9953_VCAP_UPDATE_CTRL_UPDATE_ADDR(ix) |
- VSC9953_VCAP_UPDATE_CTRL_UPDATE_SHOT);
-
- if ((sel & TCAM_SEL_ENTRY) && ix >= entry_count)
- return CMD_RET_FAILURE;
-
- if (!(sel & TCAM_SEL_ENTRY))
- value |= VSC9953_VCAP_UPDATE_CTRL_UPDATE_ENTRY_DIS;
-
- if (!(sel & TCAM_SEL_ACTION))
- value |= VSC9953_VCAP_UPDATE_CTRL_UPDATE_ACTION_DIS;
-
- if (!(sel & TCAM_SEL_COUNTER))
- value |= VSC9953_VCAP_UPDATE_CTRL_UPDATE_CNT_DIS;
-
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_UPDATE_CTRL(tgt)), value);
-
- do {
- value = in_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_UPDATE_CTRL(tgt)));
-
- } while (value & VSC9953_VCAP_UPDATE_CTRL_UPDATE_SHOT);
-
- return CMD_RET_SUCCESS;
-}
-
-static void vsc9953_vcap_init(void)
-{
- u32 tgt = VSC9953_ES0;
- int cmd_ret;
-
- /* write entries */
- vcap_entry2cache_init(tgt, ENTRY_WORDS_ES0);
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE, TCAM_SEL_ENTRY,
- ENTRY_WORDS_ES0);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid TCAM_SEL_ENTRY\n",
- __LINE__);
-
- /* write actions and counters */
- vcap_action2cache_init(tgt, BITS_TO_DWORD(ES0_ACT_WIDTH),
- BITS_TO_DWORD(ES0_CNT_WIDTH));
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_MV_CFG(tgt)),
- VSC9953_VCAP_CFG_MV_CFG_SIZE(ES0_ACT_COUNT));
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE,
- TCAM_SEL_ACTION | TCAM_SEL_COUNTER, ENTRY_WORDS_ES0);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n",
- __LINE__);
-
- tgt = VSC9953_IS1;
-
- /* write entries */
- vcap_entry2cache_init(tgt, ENTRY_WORDS_IS1);
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE, TCAM_SEL_ENTRY,
- ENTRY_WORDS_IS1);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid TCAM_SEL_ENTRY\n",
- __LINE__);
-
- /* write actions and counters */
- vcap_action2cache_init(tgt, BITS_TO_DWORD(IS1_ACT_WIDTH),
- BITS_TO_DWORD(IS1_CNT_WIDTH));
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_MV_CFG(tgt)),
- VSC9953_VCAP_CFG_MV_CFG_SIZE(IS1_ACT_COUNT));
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE,
- TCAM_SEL_ACTION | TCAM_SEL_COUNTER, ENTRY_WORDS_IS1);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n",
- __LINE__);
-
- tgt = VSC9953_IS2;
-
- /* write entries */
- vcap_entry2cache_init(tgt, ENTRY_WORDS_IS2);
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE, TCAM_SEL_ENTRY,
- ENTRY_WORDS_IS2);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid selection: TCAM_SEL_ENTRY\n",
- __LINE__);
-
- /* write actions and counters */
- vcap_action2cache_init(tgt, BITS_TO_DWORD(IS2_ACT_WIDTH),
- BITS_TO_DWORD(IS2_CNT_WIDTH));
- out_le32((unsigned int *)(VSC9953_OFFSET +
- VSC9953_VCAP_CFG_MV_CFG(tgt)),
- VSC9953_VCAP_CFG_MV_CFG_SIZE(IS2_ACT_COUNT));
- cmd_ret = vcap_cmd(tgt, 0, TCAM_CMD_INITIALIZE,
- TCAM_SEL_ACTION | TCAM_SEL_COUNTER, ENTRY_WORDS_IS2);
- if (cmd_ret != CMD_RET_SUCCESS)
- debug("VSC9953:%d invalid TCAM_SEL_ACTION | TCAM_SEL_COUNTER\n",
- __LINE__);
-}
-
-void vsc9953_init(struct bd_info *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_vcap_init();
- 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;
-}
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index d94048db5f7..176fb07c651 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -416,6 +416,9 @@ config POWER_HI6553
config POWER_LTC3676
bool "Enable legacy driver for LTC3676 PMIC"
+config POWER_PCA9450
+ bool "Enable legacy driver for PCA9450 PMIC"
+
config POWER_PFUZE100
bool "Enable legacy driver for PFUZE100 PMIC"
diff --git a/drivers/ram/mpc83xx_sdram.c b/drivers/ram/mpc83xx_sdram.c
index a53ff93a6b0..11676d4fae7 100644
--- a/drivers/ram/mpc83xx_sdram.c
+++ b/drivers/ram/mpc83xx_sdram.c
@@ -118,12 +118,7 @@ int dram_init(void)
phys_size_t get_effective_memsize(void)
{
- if (!IS_ENABLED(CONFIG_VERY_BIG_RAM))
- return gd->ram_size;
-
- /* Limit stack to what we can reasonable map */
- return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
- CONFIG_MAX_MEM_MAPPED : gd->ram_size);
+ return gd->ram_size;
}
/**
diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c
index 122691b9784..03ce081d576 100644
--- a/drivers/rtc/mc146818.c
+++ b/drivers/rtc/mc146818.c
@@ -13,7 +13,7 @@
#include <dm.h>
#include <rtc.h>
-#if defined(CONFIG_X86) || defined(CONFIG_MALTA)
+#if defined(CONFIG_X86) || defined(CONFIG_TARGET_MALTA)
#include <asm/io.h>
#define in8(p) inb(p)
#define out8(p, v) outb(v, p)
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index 4f4eb02de08..07a59ec9607 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -120,20 +120,6 @@ static struct usb_device_descriptor device_descriptor = {
.bNumConfigurations = NUM_CONFIGS
};
-
-#if defined(CONFIG_USBD_HS)
-static struct usb_qualifier_descriptor qualifier_descriptor = {
- .bLength = sizeof(struct usb_qualifier_descriptor),
- .bDescriptorType = USB_DT_QUAL,
- .bcdUSB = cpu_to_le16(USB_BCD_VERSION),
- .bDeviceClass = COMMUNICATIONS_DEVICE_CLASS,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- .bMaxPacketSize0 = EP0_MAX_PACKET_SIZE,
- .bNumConfigurations = NUM_CONFIGS
-};
-#endif
-
/*
* Static CDC ACM specific descriptors
*/
@@ -639,9 +625,6 @@ static void usbtty_init_instances (void)
memset (device_instance, 0, sizeof (struct usb_device_instance));
device_instance->device_state = STATE_INIT;
device_instance->device_descriptor = &device_descriptor;
-#if defined(CONFIG_USBD_HS)
- device_instance->qualifier_descriptor = &qualifier_descriptor;
-#endif
device_instance->event = usbtty_event_handler;
device_instance->cdc_recv_setup = usbtty_cdc_setup;
device_instance->bus = bus_instance;
@@ -755,10 +738,6 @@ static void usbtty_init_terminal_type(short type)
device_descriptor.idProduct =
cpu_to_le16(CONFIG_USBD_PRODUCTID_CDCACM);
-#if defined(CONFIG_USBD_HS)
- qualifier_descriptor.bDeviceClass =
- COMMUNICATIONS_DEVICE_CLASS;
-#endif
/* Assign endpoint indices */
tx_endpoint = ACM_TX_ENDPOINT;
rx_endpoint = ACM_RX_ENDPOINT;
@@ -787,9 +766,6 @@ static void usbtty_init_terminal_type(short type)
device_descriptor.bDeviceClass = 0xFF;
device_descriptor.idProduct =
cpu_to_le16(CONFIG_USBD_PRODUCTID_GSERIAL);
-#if defined(CONFIG_USBD_HS)
- qualifier_descriptor.bDeviceClass = 0xFF;
-#endif
/* Assign endpoint indices */
tx_endpoint = GSERIAL_TX_ENDPOINT;
rx_endpoint = GSERIAL_RX_ENDPOINT;
@@ -937,9 +913,6 @@ static int usbtty_configured (void)
static void usbtty_event_handler (struct usb_device_instance *device,
usb_device_event_t event, int data)
{
-#if defined(CONFIG_USBD_HS)
- int i;
-#endif
switch (event) {
case DEVICE_RESET:
case DEVICE_BUS_INACTIVE:
@@ -950,29 +923,6 @@ static void usbtty_event_handler (struct usb_device_instance *device,
break;
case DEVICE_ADDRESS_ASSIGNED:
-#if defined(CONFIG_USBD_HS)
- /*
- * is_usbd_high_speed routine needs to be defined by
- * specific gadget driver
- * It returns true if device enumerates at High speed
- * Retuns false otherwise
- */
- for (i = 0; i < NUM_ENDPOINTS; i++) {
- if (((ep_descriptor_ptrs[i]->bmAttributes &
- USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_BULK)
- && is_usbd_high_speed()) {
-
- ep_descriptor_ptrs[i]->wMaxPacketSize =
- CONFIG_USBD_SERIAL_BULK_HS_PKTSIZE;
- }
-
- endpoint_instance[i + 1].tx_packetSize =
- ep_descriptor_ptrs[i]->wMaxPacketSize;
- endpoint_instance[i + 1].rcv_packetSize =
- ep_descriptor_ptrs[i]->wMaxPacketSize;
- }
-#endif
usbtty_init_endpoints ();
default:
diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
index e27aa368c9a..ac4d22044d3 100644
--- a/drivers/serial/usbtty.h
+++ b/drivers/serial/usbtty.h
@@ -51,10 +51,6 @@
#define CONFIG_USBD_SERIAL_INT_PKTSIZE UDC_INT_PACKET_SIZE
#define CONFIG_USBD_SERIAL_BULK_PKTSIZE UDC_BULK_PACKET_SIZE
-#if defined(CONFIG_USBD_HS)
-#define CONFIG_USBD_SERIAL_BULK_HS_PKTSIZE UDC_BULK_HS_PACKET_SIZE
-#endif
-
#define USBTTY_DEVICE_CLASS COMMUNICATIONS_DEVICE_CLASS
#define USBTTY_BCD_DEVICE 0x00
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index c6900f449d5..64ceed12ce4 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -429,6 +429,16 @@ config SANDBOX_SPI
};
};
+config SANDBOX_SPI_MAX_BUS
+ int
+ depends on SANDBOX
+ default 1
+
+config SANDBOX_SPI_MAX_CS
+ int
+ depends on SANDBOX
+ default 10
+
config SPI_ASPEED_SMC
bool "ASPEED SPI flash controller driver"
depends on DM_SPI && SPI_MEM
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 3afb45d5ccb..8efd4614573 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -93,7 +93,6 @@ comment "USB peripherals"
config USB_STORAGE
bool "USB Mass Storage support"
- depends on !(BLK && !DM_USB)
---help---
Say Y here if you want to connect USB mass storage devices to your
board's USB port.
diff --git a/drivers/usb/gadget/ep0.c b/drivers/usb/gadget/ep0.c
index 6624f61b763..c256cc31fbd 100644
--- a/drivers/usb/gadget/ep0.c
+++ b/drivers/usb/gadget/ep0.c
@@ -371,26 +371,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
}
break;
case USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER:
-#if defined(CONFIG_USBD_HS)
- {
- struct usb_qualifier_descriptor *qualifier_descriptor =
- device->qualifier_descriptor;
-
- if (!qualifier_descriptor)
- return -1;
-
- /* copy descriptor for this device */
- copy_config(urb, qualifier_descriptor,
- sizeof(struct usb_qualifier_descriptor),
- max);
-
- }
- dbg_ep0(3, "copied qualifier descriptor, actual_length: 0x%x",
- urb->actual_length);
-#else
return -1;
-#endif
- break;
default:
return -1;