From 552e7c57d035792c8939d86f276624e2614b936b Mon Sep 17 00:00:00 2001 From: Vicentiu Galanopulo Date: Wed, 2 May 2018 06:23:38 -0500 Subject: net/phy/cortina: Add support for CS4223 PHY Add support for Cortina CS4223 10G PHY - As per the CS4223 specs, an EEPROM module is connected to the PHY. At startup the PHY reads the firmware line and tries to load the firmware into the internal memory. - This driver reads the EEPROM status and checks if firmware has been loaded Signed-off-by: Vicentiu Galanopulo Acked-by: Joe Hershberger --- include/cortina.h | 4 ++++ include/phy.h | 1 + 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/cortina.h b/include/cortina.h index 4cb09855198..ba7fafe9c4d 100644 --- a/include/cortina.h +++ b/include/cortina.h @@ -64,6 +64,10 @@ #define VILLA_LINE_SDS_COMMON_STX0_TX_OUTPUT_CTRLA 0x427 #define VILLA_LINE_SDS_COMMON_STX0_TX_OUTPUT_CTRLB 0x428 +/* Cortina CS4223 */ +#define CS4223_EEPROM_STATUS 0x5001 +#define CS4223_EEPROM_FIRMWARE_LOADDONE 0x1 + #define mseq_edc_bist_done (0x1<<0) #define mseq_edc_bist_fail (0x1<<8) diff --git a/include/phy.h b/include/phy.h index 52bf99717c7..e8f10ab3d23 100644 --- a/include/phy.h +++ b/include/phy.h @@ -314,6 +314,7 @@ static inline bool phy_interface_is_sgmii(struct phy_device *phydev) /* PHY UIDs for various PHYs that are referenced in external code */ #define PHY_UID_CS4340 0x13e51002 +#define PHY_UID_CS4223 0x03e57003 #define PHY_UID_TN2020 0x00a19410 #endif -- cgit v1.2.3 From 98017a1fb5c0add55249fa08f8982452a3ab31af Mon Sep 17 00:00:00 2001 From: Radu Bulie Date: Mon, 21 May 2018 10:02:09 -0500 Subject: drivers/net/vsc9953: Initialize action RAM in VCAP complex VCAP tables must be initialized even if no advanced classification is used. If no initialization is performed, then ECC error will be observed by the user when the first packet enters the l2switch. The error is marked in MPIC_EISR0 -bit 29 which means - Internal RAM multi-bit ECC error. This patch fixes the aforementioned ECC error by performing the initialization of VCAP tables. Signed-off-by: Radu Bulie Acked-by: Joe Hershberger --- include/vsc9953.h | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'include') diff --git a/include/vsc9953.h b/include/vsc9953.h index bb7f8ecde5d..fe072da5164 100644 --- a/include/vsc9953.h +++ b/include/vsc9953.h @@ -186,6 +186,76 @@ #define MIIMIND_OPR_PEND 0x00000004 +#define VSC9953_BITMASK(offset) ((BIT(offset)) - 1) +#define VSC9953_ENC_BITFIELD(target, offset, width) \ + (((target) & VSC9953_BITMASK(width)) << (offset)) + +#define VSC9953_IO_ADDR(target, offset) ((target) + (offset << 2)) + +#define VSC9953_IO_REG(target, offset) (VSC9953_IO_ADDR(target, offset)) +#define VSC9953_VCAP_CACHE_ENTRY_DAT(target, ri) \ + VSC9953_IO_REG(target, (0x2 + (ri))) + +#define VSC9953_VCAP_CACHE_MASK_DAT(target, ri) \ + VSC9953_IO_REG(target, (0x42 + (ri))) + +#define VSC9953_VCAP_CACHE_TG_DAT(target) VSC9953_IO_REG(target, 0xe2) +#define VSC9953_VCAP_CFG_MV_CFG(target) VSC9953_IO_REG(target, 0x1) +#define VSC9953_VCAP_CFG_MV_CFG_SIZE(target) \ + VSC9953_ENC_BITFIELD(target, 0, 16) + +#define VSC9953_VCAP_CFG_UPDATE_CTRL(target) VSC9953_IO_REG(target, 0x0) +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_CMD(target) \ + VSC9953_ENC_BITFIELD(target, 22, 3) + +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_ADDR(target) \ + VSC9953_ENC_BITFIELD(target, 3, 16) + +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_SHOT BIT(2) +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_ENTRY_DIS BIT(21) +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_ACTION_DIS BIT(20) +#define VSC9953_VCAP_UPDATE_CTRL_UPDATE_CNT_DIS BIT(19) +#define VSC9953_VCAP_CACHE_ACTION_DAT(target, ri) \ + VSC9953_IO_REG(target, (0x82 + (ri))) + +#define VSC9953_VCAP_CACHE_CNT_DAT(target, ri) \ + VSC9953_IO_REG(target, (0xc2 + (ri))) + +#define VSC9953_PORT_OFFSET 1 +#define VSC9953_IS1_CNT 256 +#define VSC9953_IS2_CNT 1024 +#define VSC9953_ES0_CNT 1024 + +#define BITS_TO_DWORD(in) (1 + (((in) - 1) / 32)) +#define ENTRY_WORDS_ES0 BITS_TO_DWORD(29) +#define ENTRY_WORDS_IS1 BITS_TO_DWORD(376) +#define ENTRY_WORDS_IS2 BITS_TO_DWORD(376) +#define ES0_ACT_WIDTH BITS_TO_DWORD(91) +#define ES0_CNT_WIDTH BITS_TO_DWORD(1) +#define IS1_ACT_WIDTH BITS_TO_DWORD(320) +#define IS1_CNT_WIDTH BITS_TO_DWORD(4) +#define IS2_ACT_WIDTH BITS_TO_DWORD(103 - 2 * VSC9953_PORT_OFFSET) +#define IS2_CNT_WIDTH BITS_TO_DWORD(4 * 32) +#define ES0_ACT_COUNT (VSC9953_ES0_CNT + VSC9953_MAX_PORTS) +#define IS1_ACT_COUNT (VSC9953_IS1_CNT + 1) +#define IS2_ACT_COUNT (VSC9953_IS2_CNT + VSC9953_MAX_PORTS + 2) + +/* TCAM entries */ +enum tcam_sel { + TCAM_SEL_ENTRY = BIT(0), + TCAM_SEL_ACTION = BIT(1), + TCAM_SEL_COUNTER = BIT(2), + TCAM_SEL_ALL = VSC9953_BITMASK(3), +}; + +enum tcam_cmd { + TCAM_CMD_WRITE = 0, + TCAM_CMD_READ = 1, + TCAM_CMD_MOVE_UP = 2, + TCAM_CMD_MOVE_DOWN = 3, + TCAM_CMD_INITIALIZE = 4, +}; + struct vsc9953_mdio_info { struct vsc9953_mii_mng *regs; char *name; -- cgit v1.2.3 From ff114e0f76b6f0937890ba72859acfb40afee329 Mon Sep 17 00:00:00 2001 From: Kunihiko Hayashi Date: Fri, 18 May 2018 11:12:04 +0900 Subject: net: include/phy.h: add new mode for internal phy Add the new mode to indicate a built-in PHY. This will be used by UniPhier AVE ethernet driver. Signed-off-by: Kunihiko Hayashi Reviewed-by: Marek Vasut Acked-by: Joe Hershberger --- include/phy.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/phy.h b/include/phy.h index e8f10ab3d23..7c3fc5ce40c 100644 --- a/include/phy.h +++ b/include/phy.h @@ -65,6 +65,7 @@ typedef enum { PHY_INTERFACE_MODE_XAUI, PHY_INTERFACE_MODE_RXAUI, PHY_INTERFACE_MODE_SFI, + PHY_INTERFACE_MODE_INTERNAL, PHY_INTERFACE_MODE_NONE, /* Must be last */ PHY_INTERFACE_MODE_COUNT, @@ -87,6 +88,7 @@ static const char *phy_interface_strings[] = { [PHY_INTERFACE_MODE_XAUI] = "xaui", [PHY_INTERFACE_MODE_RXAUI] = "rxaui", [PHY_INTERFACE_MODE_SFI] = "sfi", + [PHY_INTERFACE_MODE_INTERNAL] = "internal", [PHY_INTERFACE_MODE_NONE] = "", }; -- cgit v1.2.3