16706b115SCodrin Ciubotariu /* 26706b115SCodrin Ciubotariu * vsc9953.h 36706b115SCodrin Ciubotariu * 46706b115SCodrin Ciubotariu * Driver for the Vitesse VSC9953 L2 Switch 56706b115SCodrin Ciubotariu * 66706b115SCodrin Ciubotariu * This software may be used and distributed according to the 76706b115SCodrin Ciubotariu * terms of the GNU Public License, Version 2, incorporated 86706b115SCodrin Ciubotariu * herein by reference. 96706b115SCodrin Ciubotariu * 106706b115SCodrin Ciubotariu * Copyright 2013 Freescale Semiconductor, Inc. 116706b115SCodrin Ciubotariu * 126706b115SCodrin Ciubotariu */ 136706b115SCodrin Ciubotariu 146706b115SCodrin Ciubotariu #ifndef _VSC9953_H_ 156706b115SCodrin Ciubotariu #define _VSC9953_H_ 166706b115SCodrin Ciubotariu 176706b115SCodrin Ciubotariu #include <config.h> 186706b115SCodrin Ciubotariu #include <miiphy.h> 196706b115SCodrin Ciubotariu #include <asm/types.h> 206706b115SCodrin Ciubotariu 216706b115SCodrin Ciubotariu #define VSC9953_OFFSET (CONFIG_SYS_CCSRBAR_DEFAULT + 0x800000) 226706b115SCodrin Ciubotariu 236706b115SCodrin Ciubotariu #define VSC9953_SYS_OFFSET 0x010000 249de05987SCodrin Ciubotariu #define VSC9953_REW_OFFSET 0x030000 256706b115SCodrin Ciubotariu #define VSC9953_DEV_GMII_OFFSET 0x100000 266706b115SCodrin Ciubotariu #define VSC9953_QSYS_OFFSET 0x200000 276706b115SCodrin Ciubotariu #define VSC9953_ANA_OFFSET 0x280000 286706b115SCodrin Ciubotariu #define VSC9953_DEVCPU_GCB 0x070000 296706b115SCodrin Ciubotariu #define VSC9953_ES0 0x040000 306706b115SCodrin Ciubotariu #define VSC9953_IS1 0x050000 316706b115SCodrin Ciubotariu #define VSC9953_IS2 0x060000 326706b115SCodrin Ciubotariu 336706b115SCodrin Ciubotariu #define T1040_SWITCH_GMII_DEV_OFFSET 0x010000 346706b115SCodrin Ciubotariu #define VSC9953_PHY_REGS_OFFST 0x0000AC 356706b115SCodrin Ciubotariu 363cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_chip_regs.soft_rst register */ 37c4390486SCodrin Ciubotariu #define VSC9953_SOFT_SWC_RST_ENA 0x00000001 383cc8cfffSCodrin Ciubotariu 393cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_sys_sys.reset_cfg register */ 40c4390486SCodrin Ciubotariu #define VSC9953_CORE_ENABLE 0x80 41c4390486SCodrin Ciubotariu #define VSC9953_MEM_ENABLE 0x40 42c4390486SCodrin Ciubotariu #define VSC9953_MEM_INIT 0x20 436706b115SCodrin Ciubotariu 443cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_mac_cfg_status.mac_ena_cfg register */ 45c4390486SCodrin Ciubotariu #define VSC9953_MAC_ENA_CFG 0x00000011 463cc8cfffSCodrin Ciubotariu 473cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_mac_cfg_status.mac_mode_cfg register */ 48c4390486SCodrin Ciubotariu #define VSC9953_MAC_MODE_CFG 0x00000011 493cc8cfffSCodrin Ciubotariu 503cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_mac_cfg_status.mac_ifg_cfg register */ 51c4390486SCodrin Ciubotariu #define VSC9953_MAC_IFG_CFG 0x00000515 523cc8cfffSCodrin Ciubotariu 533cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_mac_cfg_status.mac_hdx_cfg register */ 54c4390486SCodrin Ciubotariu #define VSC9953_MAC_HDX_CFG 0x00001043 553cc8cfffSCodrin Ciubotariu 563cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_mac_cfg_status.mac_maxlen_cfg register */ 57c4390486SCodrin Ciubotariu #define VSC9953_MAC_MAX_LEN 0x000005ee 586706b115SCodrin Ciubotariu 593cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_dev_gmii_port_mode.clock_cfg register */ 603cc8cfffSCodrin Ciubotariu #define VSC9953_CLOCK_CFG 0x00000001 613cc8cfffSCodrin Ciubotariu #define VSC9953_CLOCK_CFG_1000M 0x00000001 623cc8cfffSCodrin Ciubotariu 633cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_sys_sys.front_port_mode register */ 643cc8cfffSCodrin Ciubotariu #define VSC9953_FRONT_PORT_MODE 0x00000000 653cc8cfffSCodrin Ciubotariu 663cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_ana_pfc.pfc_cfg register */ 673cc8cfffSCodrin Ciubotariu #define VSC9953_PFC_FC 0x00000001 683cc8cfffSCodrin Ciubotariu #define VSC9953_PFC_FC_QSGMII 0x00000000 693cc8cfffSCodrin Ciubotariu 703cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_sys_pause_cfg.mac_fc_cfg register */ 713cc8cfffSCodrin Ciubotariu #define VSC9953_MAC_FC_CFG 0x04700000 723cc8cfffSCodrin Ciubotariu #define VSC9953_MAC_FC_CFG_QSGMII 0x00700000 733cc8cfffSCodrin Ciubotariu 743cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_sys_pause_cfg.pause_cfg register */ 753cc8cfffSCodrin Ciubotariu #define VSC9953_PAUSE_CFG 0x001ffffe 763cc8cfffSCodrin Ciubotariu 773cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_sys_pause_cfgtot_tail_drop_lvl register */ 783cc8cfffSCodrin Ciubotariu #define VSC9953_TOT_TAIL_DROP_LVL 0x000003ff 793cc8cfffSCodrin Ciubotariu 8086719f0cSCodrin Ciubotariu /* Macros for vsc9953_sys_sys.stat_cfg register */ 8186719f0cSCodrin Ciubotariu #define VSC9953_STAT_CLEAR_RX 0x00000400 8286719f0cSCodrin Ciubotariu #define VSC9953_STAT_CLEAR_TX 0x00000800 8386719f0cSCodrin Ciubotariu #define VSC9953_STAT_CLEAR_DR 0x00001000 8486719f0cSCodrin Ciubotariu 853cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_vcap_core_cfg.vcap_mv_cfg register */ 86c4390486SCodrin Ciubotariu #define VSC9953_VCAP_MV_CFG 0x0000ffff 87c4390486SCodrin Ciubotariu #define VSC9953_VCAP_UPDATE_CTRL 0x01000004 883cc8cfffSCodrin Ciubotariu 89*22449858SCodrin Ciubotariu /* Macros for register vsc9953_ana_ana_tables.mac_access register */ 90*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_IDLE 0x00000000 91*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_LEARN 0x00000001 92*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_FORGET 0x00000002 93*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_AGE 0x00000003 94*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_NEXT 0x00000004 95*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_READ 0x00000006 96*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_WRITE 0x00000007 97*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_MASK 0x00000007 98*22449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_VALID 0x00000800 99*22449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_NORMAL 0x00000000 100*22449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_LOCKED 0x00000200 101*22449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_IPV4MCAST 0x00000400 102*22449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_IPV6MCAST 0x00000600 103*22449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_MASK 0x00000600 104*22449858SCodrin Ciubotariu #define VSC9953_MAC_DESTIDX_MASK 0x000001f8 105*22449858SCodrin Ciubotariu #define VSC9953_MAC_VID_MASK 0x1fff0000 106*22449858SCodrin Ciubotariu #define VSC9953_MAC_MACH_MASK 0x0000ffff 107*22449858SCodrin Ciubotariu 1089de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_port.vlan_cfg register */ 1099de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_AWARE_ENA 0x00100000 1109de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_POP_CNT_MASK 0x000c0000 1119de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_VID_MASK 0x00000fff 1129de05987SCodrin Ciubotariu 1139de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_vlan_cfg register */ 1149de05987SCodrin Ciubotariu #define VSC9953_PORT_VLAN_CFG_VID_MASK 0x00000fff 1159de05987SCodrin Ciubotariu 1169de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_tidx register */ 1179de05987SCodrin Ciubotariu #define VSC9953_ANA_TBL_VID_MASK 0x00000fff 1189de05987SCodrin Ciubotariu 1199de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_access register */ 1209de05987SCodrin Ciubotariu #define VSC9953_VLAN_PORT_MASK 0x00001ffc 1219de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_MASK 0x00000003 1229de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_IDLE 0x00000000 1239de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_READ 0x00000001 1249de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_WRITE 0x00000002 1259de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_INIT 0x00000003 1269de05987SCodrin Ciubotariu 12768c929daSCodrin Ciubotariu /* Macros for vsc9953_ana_port.port_cfg register */ 12868c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_ENA 0x00000080 12968c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_AUTO 0x00000100 13068c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_CPU 0x00000200 13168c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_DROP 0x00000400 13268c929daSCodrin Ciubotariu 1333cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_qsys_sys.switch_port_mode register */ 134fe91095bSCodrin Ciubotariu #define VSC9953_PORT_ENA 0x00002000 1353cc8cfffSCodrin Ciubotariu 1369de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana.adv_learn register */ 1379de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHK 0x00000400 1389de05987SCodrin Ciubotariu 1399de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_tag_cfg register */ 1409de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_MASK 0x00000180 1419de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_NONE 0x00000000 1429de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_PVID_ZERO 0x00000080 1439de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_ZERO 0x00000100 1449de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL 0x00000180 1459de05987SCodrin Ciubotariu 146*22449858SCodrin Ciubotariu /* Macros for vsc9953_ana_ana.anag_efil register */ 147*22449858SCodrin Ciubotariu #define VSC9953_AGE_PORT_EN 0x00080000 148*22449858SCodrin Ciubotariu #define VSC9953_AGE_PORT_MASK 0x0007c000 149*22449858SCodrin Ciubotariu #define VSC9953_AGE_VID_EN 0x00002000 150*22449858SCodrin Ciubotariu #define VSC9953_AGE_VID_MASK 0x00001fff 151*22449858SCodrin Ciubotariu 152*22449858SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.mach_data register */ 153*22449858SCodrin Ciubotariu #define VSC9953_MACHDATA_VID_MASK 0x1fff0000 154*22449858SCodrin Ciubotariu 1556706b115SCodrin Ciubotariu #define VSC9953_MAX_PORTS 10 1566706b115SCodrin Ciubotariu #define VSC9953_PORT_CHECK(port) \ 1576706b115SCodrin Ciubotariu (((port) < 0 || (port) >= VSC9953_MAX_PORTS) ? 0 : 1) 1586706b115SCodrin Ciubotariu #define VSC9953_INTERNAL_PORT_CHECK(port) ( \ 1596706b115SCodrin Ciubotariu ( \ 1606706b115SCodrin Ciubotariu (port) < VSC9953_MAX_PORTS - 2 || (port) >= VSC9953_MAX_PORTS \ 1616706b115SCodrin Ciubotariu ) ? 0 : 1 \ 1626706b115SCodrin Ciubotariu ) 1639de05987SCodrin Ciubotariu #define VSC9953_MAX_VLAN 4096 1649de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHECK(vid) \ 1659de05987SCodrin Ciubotariu (((vid) < 0 || (vid) >= VSC9953_MAX_VLAN) ? 0 : 1) 1666706b115SCodrin Ciubotariu 1676706b115SCodrin Ciubotariu #define DEFAULT_VSC9953_MDIO_NAME "VSC9953_MDIO0" 1686706b115SCodrin Ciubotariu 1696706b115SCodrin Ciubotariu #define MIIMIND_OPR_PEND 0x00000004 1706706b115SCodrin Ciubotariu 1716706b115SCodrin Ciubotariu struct vsc9953_mdio_info { 1726706b115SCodrin Ciubotariu struct vsc9953_mii_mng *regs; 1736706b115SCodrin Ciubotariu char *name; 1746706b115SCodrin Ciubotariu }; 1756706b115SCodrin Ciubotariu 1763cc8cfffSCodrin Ciubotariu /* VSC9953 ANA structure */ 1776706b115SCodrin Ciubotariu 1786706b115SCodrin Ciubotariu struct vsc9953_ana_port { 1796706b115SCodrin Ciubotariu u32 vlan_cfg; 1806706b115SCodrin Ciubotariu u32 drop_cfg; 1816706b115SCodrin Ciubotariu u32 qos_cfg; 1826706b115SCodrin Ciubotariu u32 vcap_cfg; 1836706b115SCodrin Ciubotariu u32 vcap_s1_key_cfg[3]; 1846706b115SCodrin Ciubotariu u32 vcap_s2_cfg; 1856706b115SCodrin Ciubotariu u32 qos_pcp_dei_map_cfg[16]; 1866706b115SCodrin Ciubotariu u32 cpu_fwd_cfg; 1876706b115SCodrin Ciubotariu u32 cpu_fwd_bpdu_cfg; 1886706b115SCodrin Ciubotariu u32 cpu_fwd_garp_cfg; 1896706b115SCodrin Ciubotariu u32 cpu_fwd_ccm_cfg; 1906706b115SCodrin Ciubotariu u32 port_cfg; 1916706b115SCodrin Ciubotariu u32 pol_cfg; 1926706b115SCodrin Ciubotariu u32 reserved[34]; 1936706b115SCodrin Ciubotariu }; 1946706b115SCodrin Ciubotariu 1956706b115SCodrin Ciubotariu struct vsc9953_ana_pol { 1966706b115SCodrin Ciubotariu u32 pol_pir_cfg; 1976706b115SCodrin Ciubotariu u32 pol_cir_cfg; 1986706b115SCodrin Ciubotariu u32 pol_mode_cfg; 1996706b115SCodrin Ciubotariu u32 pol_pir_state; 2006706b115SCodrin Ciubotariu u32 pol_cir_state; 2016706b115SCodrin Ciubotariu u32 reserved1[3]; 2026706b115SCodrin Ciubotariu }; 2036706b115SCodrin Ciubotariu 2046706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables { 2056706b115SCodrin Ciubotariu u32 entry_lim[11]; 2066706b115SCodrin Ciubotariu u32 an_moved; 2076706b115SCodrin Ciubotariu u32 mach_data; 2086706b115SCodrin Ciubotariu u32 macl_data; 2096706b115SCodrin Ciubotariu u32 mac_access; 2106706b115SCodrin Ciubotariu u32 mact_indx; 2116706b115SCodrin Ciubotariu u32 vlan_access; 2126706b115SCodrin Ciubotariu u32 vlan_tidx; 2136706b115SCodrin Ciubotariu }; 2146706b115SCodrin Ciubotariu 2156706b115SCodrin Ciubotariu struct vsc9953_ana_ana { 2166706b115SCodrin Ciubotariu u32 adv_learn; 2176706b115SCodrin Ciubotariu u32 vlan_mask; 218440873dfSCodrin Ciubotariu u32 reserved; 2196706b115SCodrin Ciubotariu u32 anag_efil; 2206706b115SCodrin Ciubotariu u32 an_events; 2216706b115SCodrin Ciubotariu u32 storm_limit_burst; 2226706b115SCodrin Ciubotariu u32 storm_limit_cfg[4]; 2236706b115SCodrin Ciubotariu u32 isolated_prts; 2246706b115SCodrin Ciubotariu u32 community_ports; 2256706b115SCodrin Ciubotariu u32 auto_age; 2266706b115SCodrin Ciubotariu u32 mac_options; 2276706b115SCodrin Ciubotariu u32 learn_disc; 2286706b115SCodrin Ciubotariu u32 agen_ctrl; 2296706b115SCodrin Ciubotariu u32 mirror_ports; 2306706b115SCodrin Ciubotariu u32 emirror_ports; 2316706b115SCodrin Ciubotariu u32 flooding; 2326706b115SCodrin Ciubotariu u32 flooding_ipmc; 2336706b115SCodrin Ciubotariu u32 sflow_cfg[11]; 2346706b115SCodrin Ciubotariu u32 port_mode[12]; 2356706b115SCodrin Ciubotariu }; 2366706b115SCodrin Ciubotariu 2376706b115SCodrin Ciubotariu struct vsc9953_ana_pgid { 2386706b115SCodrin Ciubotariu u32 port_grp_id[91]; 2396706b115SCodrin Ciubotariu }; 2406706b115SCodrin Ciubotariu 2416706b115SCodrin Ciubotariu struct vsc9953_ana_pfc { 2426706b115SCodrin Ciubotariu u32 pfc_cfg; 2436706b115SCodrin Ciubotariu u32 reserved1[15]; 2446706b115SCodrin Ciubotariu }; 2456706b115SCodrin Ciubotariu 2466706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc { 2476706b115SCodrin Ciubotariu u32 pol_flowc[10]; 2486706b115SCodrin Ciubotariu u32 reserved1[17]; 2496706b115SCodrin Ciubotariu u32 pol_hyst; 2506706b115SCodrin Ciubotariu }; 2516706b115SCodrin Ciubotariu 2526706b115SCodrin Ciubotariu struct vsc9953_ana_common { 2536706b115SCodrin Ciubotariu u32 aggr_cfg; 2546706b115SCodrin Ciubotariu u32 cpuq_cfg; 2556706b115SCodrin Ciubotariu u32 cpuq_8021_cfg; 2566706b115SCodrin Ciubotariu u32 dscp_cfg; 2576706b115SCodrin Ciubotariu u32 dscp_rewr_cfg; 2586706b115SCodrin Ciubotariu u32 vcap_rng_type_cfg; 2596706b115SCodrin Ciubotariu u32 vcap_rng_val_cfg; 2606706b115SCodrin Ciubotariu u32 discard_cfg; 2616706b115SCodrin Ciubotariu u32 fid_cfg; 2626706b115SCodrin Ciubotariu }; 2636706b115SCodrin Ciubotariu 2646706b115SCodrin Ciubotariu struct vsc9953_analyzer { 2656706b115SCodrin Ciubotariu struct vsc9953_ana_port port[11]; 2666706b115SCodrin Ciubotariu u32 reserved1[9536]; 2676706b115SCodrin Ciubotariu struct vsc9953_ana_pol pol[164]; 2686706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables ana_tables; 2696706b115SCodrin Ciubotariu u32 reserved2[14]; 2706706b115SCodrin Ciubotariu struct vsc9953_ana_ana ana; 2716706b115SCodrin Ciubotariu u32 reserved3[22]; 2726706b115SCodrin Ciubotariu struct vsc9953_ana_pgid port_id_tbl; 2736706b115SCodrin Ciubotariu u32 reserved4[549]; 2746706b115SCodrin Ciubotariu struct vsc9953_ana_pfc pfc[10]; 2756706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc pol_misc; 2766706b115SCodrin Ciubotariu u32 reserved5[196]; 2776706b115SCodrin Ciubotariu struct vsc9953_ana_common common; 2786706b115SCodrin Ciubotariu }; 2793cc8cfffSCodrin Ciubotariu /* END VSC9953 ANA structure t*/ 2806706b115SCodrin Ciubotariu 2813cc8cfffSCodrin Ciubotariu /* VSC9953 DEV_GMII structure */ 2826706b115SCodrin Ciubotariu 2836706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode { 2846706b115SCodrin Ciubotariu u32 clock_cfg; 2856706b115SCodrin Ciubotariu u32 port_misc; 2866706b115SCodrin Ciubotariu u32 reserved1; 2876706b115SCodrin Ciubotariu u32 eee_cfg; 2886706b115SCodrin Ciubotariu }; 2896706b115SCodrin Ciubotariu 2906706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status { 2916706b115SCodrin Ciubotariu u32 mac_ena_cfg; 2926706b115SCodrin Ciubotariu u32 mac_mode_cfg; 2936706b115SCodrin Ciubotariu u32 mac_maxlen_cfg; 2946706b115SCodrin Ciubotariu u32 mac_tags_cfg; 2956706b115SCodrin Ciubotariu u32 mac_adv_chk_cfg; 2966706b115SCodrin Ciubotariu u32 mac_ifg_cfg; 2976706b115SCodrin Ciubotariu u32 mac_hdx_cfg; 2986706b115SCodrin Ciubotariu u32 mac_fc_mac_low_cfg; 2996706b115SCodrin Ciubotariu u32 mac_fc_mac_high_cfg; 3006706b115SCodrin Ciubotariu u32 mac_sticky; 3016706b115SCodrin Ciubotariu }; 3026706b115SCodrin Ciubotariu 3036706b115SCodrin Ciubotariu struct vsc9953_dev_gmii { 3046706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode port_mode; 3056706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status mac_cfg_status; 3066706b115SCodrin Ciubotariu }; 3076706b115SCodrin Ciubotariu 3083cc8cfffSCodrin Ciubotariu /* END VSC9953 DEV_GMII structure */ 3096706b115SCodrin Ciubotariu 3103cc8cfffSCodrin Ciubotariu /* VSC9953 QSYS structure */ 3116706b115SCodrin Ciubotariu 3126706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch { 3136706b115SCodrin Ciubotariu u32 cir_cfg; 3146706b115SCodrin Ciubotariu u32 reserved1; 3156706b115SCodrin Ciubotariu u32 se_cfg; 3166706b115SCodrin Ciubotariu u32 se_dwrr_cfg[8]; 3176706b115SCodrin Ciubotariu u32 cir_state; 3186706b115SCodrin Ciubotariu u32 reserved2[20]; 3196706b115SCodrin Ciubotariu }; 3206706b115SCodrin Ciubotariu 3216706b115SCodrin Ciubotariu struct vsc9953_qsys_sys { 3226706b115SCodrin Ciubotariu u32 port_mode[12]; 3236706b115SCodrin Ciubotariu u32 switch_port_mode[11]; 3246706b115SCodrin Ciubotariu u32 stat_cnt_cfg; 3256706b115SCodrin Ciubotariu u32 eee_cfg[10]; 3266706b115SCodrin Ciubotariu u32 eee_thrs; 3276706b115SCodrin Ciubotariu u32 igr_no_sharing; 3286706b115SCodrin Ciubotariu u32 egr_no_sharing; 3296706b115SCodrin Ciubotariu u32 sw_status[11]; 3306706b115SCodrin Ciubotariu u32 ext_cpu_cfg; 3316706b115SCodrin Ciubotariu u32 cpu_group_map; 3326706b115SCodrin Ciubotariu u32 reserved1[23]; 3336706b115SCodrin Ciubotariu }; 3346706b115SCodrin Ciubotariu 3356706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg { 3366706b115SCodrin Ciubotariu u32 red_profile[16]; 3376706b115SCodrin Ciubotariu u32 res_qos_mode; 3386706b115SCodrin Ciubotariu }; 3396706b115SCodrin Ciubotariu 3406706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg { 3416706b115SCodrin Ciubotariu u32 egr_drop_mode; 3426706b115SCodrin Ciubotariu }; 3436706b115SCodrin Ciubotariu 3446706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt { 3456706b115SCodrin Ciubotariu u32 eq_cntrl; 3466706b115SCodrin Ciubotariu u32 reserved1; 3476706b115SCodrin Ciubotariu }; 3486706b115SCodrin Ciubotariu 3496706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc { 3506706b115SCodrin Ciubotariu u32 hsch_misc_cfg; 3516706b115SCodrin Ciubotariu u32 reserved1[546]; 3526706b115SCodrin Ciubotariu }; 3536706b115SCodrin Ciubotariu 3546706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl { 3556706b115SCodrin Ciubotariu u32 res_cfg; 3566706b115SCodrin Ciubotariu u32 res_stat; 3576706b115SCodrin Ciubotariu 3586706b115SCodrin Ciubotariu }; 3596706b115SCodrin Ciubotariu 3606706b115SCodrin Ciubotariu struct vsc9953_qsys_reg { 3616706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch hsch[108]; 3626706b115SCodrin Ciubotariu struct vsc9953_qsys_sys sys; 3636706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg qos_cfg; 3646706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg drop_cfg; 3656706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt mmgt; 3666706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc hsch_misc; 3676706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl res_ctrl[1024]; 3686706b115SCodrin Ciubotariu }; 3696706b115SCodrin Ciubotariu 3703cc8cfffSCodrin Ciubotariu /* END VSC9953 QSYS structure */ 3716706b115SCodrin Ciubotariu 3723cc8cfffSCodrin Ciubotariu /* VSC9953 SYS structure */ 3736706b115SCodrin Ciubotariu 37486719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs { 37586719f0cSCodrin Ciubotariu u32 c_rx_oct; 37686719f0cSCodrin Ciubotariu u32 c_rx_uc; 37786719f0cSCodrin Ciubotariu u32 c_rx_mc; 37886719f0cSCodrin Ciubotariu u32 c_rx_bc; 37986719f0cSCodrin Ciubotariu u32 c_rx_short; 38086719f0cSCodrin Ciubotariu u32 c_rx_frag; 38186719f0cSCodrin Ciubotariu u32 c_rx_jabber; 38286719f0cSCodrin Ciubotariu u32 c_rx_crc; 38386719f0cSCodrin Ciubotariu u32 c_rx_symbol_err; 38486719f0cSCodrin Ciubotariu u32 c_rx_sz_64; 38586719f0cSCodrin Ciubotariu u32 c_rx_sz_65_127; 38686719f0cSCodrin Ciubotariu u32 c_rx_sz_128_255; 38786719f0cSCodrin Ciubotariu u32 c_rx_sz_256_511; 38886719f0cSCodrin Ciubotariu u32 c_rx_sz_512_1023; 38986719f0cSCodrin Ciubotariu u32 c_rx_sz_1024_1526; 39086719f0cSCodrin Ciubotariu u32 c_rx_sz_jumbo; 39186719f0cSCodrin Ciubotariu u32 c_rx_pause; 39286719f0cSCodrin Ciubotariu u32 c_rx_control; 39386719f0cSCodrin Ciubotariu u32 c_rx_long; 39486719f0cSCodrin Ciubotariu u32 c_rx_cat_drop; 39586719f0cSCodrin Ciubotariu u32 c_rx_red_prio_0; 39686719f0cSCodrin Ciubotariu u32 c_rx_red_prio_1; 39786719f0cSCodrin Ciubotariu u32 c_rx_red_prio_2; 39886719f0cSCodrin Ciubotariu u32 c_rx_red_prio_3; 39986719f0cSCodrin Ciubotariu u32 c_rx_red_prio_4; 40086719f0cSCodrin Ciubotariu u32 c_rx_red_prio_5; 40186719f0cSCodrin Ciubotariu u32 c_rx_red_prio_6; 40286719f0cSCodrin Ciubotariu u32 c_rx_red_prio_7; 40386719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_0; 40486719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_1; 40586719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_2; 40686719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_3; 40786719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_4; 40886719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_5; 40986719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_6; 41086719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_7; 41186719f0cSCodrin Ciubotariu u32 c_rx_green_prio_0; 41286719f0cSCodrin Ciubotariu u32 c_rx_green_prio_1; 41386719f0cSCodrin Ciubotariu u32 c_rx_green_prio_2; 41486719f0cSCodrin Ciubotariu u32 c_rx_green_prio_3; 41586719f0cSCodrin Ciubotariu u32 c_rx_green_prio_4; 41686719f0cSCodrin Ciubotariu u32 c_rx_green_prio_5; 41786719f0cSCodrin Ciubotariu u32 c_rx_green_prio_6; 41886719f0cSCodrin Ciubotariu u32 c_rx_green_prio_7; 41986719f0cSCodrin Ciubotariu u32 reserved[20]; 42086719f0cSCodrin Ciubotariu }; 42186719f0cSCodrin Ciubotariu 42286719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs { 42386719f0cSCodrin Ciubotariu u32 c_tx_oct; 42486719f0cSCodrin Ciubotariu u32 c_tx_uc; 42586719f0cSCodrin Ciubotariu u32 c_tx_mc; 42686719f0cSCodrin Ciubotariu u32 c_tx_bc; 42786719f0cSCodrin Ciubotariu u32 c_tx_col; 42886719f0cSCodrin Ciubotariu u32 c_tx_drop; 42986719f0cSCodrin Ciubotariu u32 c_tx_pause; 43086719f0cSCodrin Ciubotariu u32 c_tx_sz_64; 43186719f0cSCodrin Ciubotariu u32 c_tx_sz_65_127; 43286719f0cSCodrin Ciubotariu u32 c_tx_sz_128_255; 43386719f0cSCodrin Ciubotariu u32 c_tx_sz_256_511; 43486719f0cSCodrin Ciubotariu u32 c_tx_sz_512_1023; 43586719f0cSCodrin Ciubotariu u32 c_tx_sz_1024_1526; 43686719f0cSCodrin Ciubotariu u32 c_tx_sz_jumbo; 43786719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_0; 43886719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_1; 43986719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_2; 44086719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_3; 44186719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_4; 44286719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_5; 44386719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_6; 44486719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_7; 44586719f0cSCodrin Ciubotariu u32 c_tx_green_prio_0; 44686719f0cSCodrin Ciubotariu u32 c_tx_green_prio_1; 44786719f0cSCodrin Ciubotariu u32 c_tx_green_prio_2; 44886719f0cSCodrin Ciubotariu u32 c_tx_green_prio_3; 44986719f0cSCodrin Ciubotariu u32 c_tx_green_prio_4; 45086719f0cSCodrin Ciubotariu u32 c_tx_green_prio_5; 45186719f0cSCodrin Ciubotariu u32 c_tx_green_prio_6; 45286719f0cSCodrin Ciubotariu u32 c_tx_green_prio_7; 45386719f0cSCodrin Ciubotariu u32 c_tx_aged; 45486719f0cSCodrin Ciubotariu u32 reserved[33]; 45586719f0cSCodrin Ciubotariu }; 45686719f0cSCodrin Ciubotariu 45786719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs { 45886719f0cSCodrin Ciubotariu u32 c_dr_local; 45986719f0cSCodrin Ciubotariu u32 c_dr_tail; 46086719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_0; 46186719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_1; 46286719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_2; 46386719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_3; 46486719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_4; 46586719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_5; 46686719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_6; 46786719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_7; 46886719f0cSCodrin Ciubotariu u32 c_dr_green_prio_0; 46986719f0cSCodrin Ciubotariu u32 c_dr_green_prio_1; 47086719f0cSCodrin Ciubotariu u32 c_dr_green_prio_2; 47186719f0cSCodrin Ciubotariu u32 c_dr_green_prio_3; 47286719f0cSCodrin Ciubotariu u32 c_dr_green_prio_4; 47386719f0cSCodrin Ciubotariu u32 c_dr_green_prio_5; 47486719f0cSCodrin Ciubotariu u32 c_dr_green_prio_6; 47586719f0cSCodrin Ciubotariu u32 c_dr_green_prio_7; 47686719f0cSCodrin Ciubotariu u32 reserved[46]; 47786719f0cSCodrin Ciubotariu }; 47886719f0cSCodrin Ciubotariu 4796706b115SCodrin Ciubotariu struct vsc9953_sys_stat { 48086719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs rx_cntrs; 48186719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs tx_cntrs; 48286719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs drop_cntrs; 4836706b115SCodrin Ciubotariu u32 reserved1[6]; 4846706b115SCodrin Ciubotariu }; 4856706b115SCodrin Ciubotariu 4866706b115SCodrin Ciubotariu struct vsc9953_sys_sys { 4876706b115SCodrin Ciubotariu u32 reset_cfg; 4886706b115SCodrin Ciubotariu u32 reserved1; 4896706b115SCodrin Ciubotariu u32 vlan_etype_cfg; 4906706b115SCodrin Ciubotariu u32 port_mode[12]; 4916706b115SCodrin Ciubotariu u32 front_port_mode[10]; 4926706b115SCodrin Ciubotariu u32 frame_aging; 4936706b115SCodrin Ciubotariu u32 stat_cfg; 4946706b115SCodrin Ciubotariu u32 reserved2[50]; 4956706b115SCodrin Ciubotariu }; 4966706b115SCodrin Ciubotariu 4976706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg { 4986706b115SCodrin Ciubotariu u32 pause_cfg[11]; 4996706b115SCodrin Ciubotariu u32 pause_tot_cfg; 5006706b115SCodrin Ciubotariu u32 tail_drop_level[11]; 5016706b115SCodrin Ciubotariu u32 tot_tail_drop_lvl; 5026706b115SCodrin Ciubotariu u32 mac_fc_cfg[10]; 5036706b115SCodrin Ciubotariu }; 5046706b115SCodrin Ciubotariu 5056706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt { 5066706b115SCodrin Ciubotariu u16 free_cnt; 5076706b115SCodrin Ciubotariu }; 5086706b115SCodrin Ciubotariu 5096706b115SCodrin Ciubotariu struct vsc9953_system_reg { 5106706b115SCodrin Ciubotariu struct vsc9953_sys_stat stat; 5116706b115SCodrin Ciubotariu struct vsc9953_sys_sys sys; 5126706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg pause_cfg; 5136706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt mmgt; 5146706b115SCodrin Ciubotariu }; 5156706b115SCodrin Ciubotariu 5163cc8cfffSCodrin Ciubotariu /* END VSC9953 SYS structure */ 5176706b115SCodrin Ciubotariu 5189de05987SCodrin Ciubotariu /* VSC9953 REW structure */ 5199de05987SCodrin Ciubotariu 5209de05987SCodrin Ciubotariu struct vsc9953_rew_port { 5219de05987SCodrin Ciubotariu u32 port_vlan_cfg; 5229de05987SCodrin Ciubotariu u32 port_tag_cfg; 5239de05987SCodrin Ciubotariu u32 port_port_cfg; 5249de05987SCodrin Ciubotariu u32 port_dscp_cfg; 5259de05987SCodrin Ciubotariu u32 port_pcp_dei_qos_map_cfg[16]; 5269de05987SCodrin Ciubotariu u32 reserved[12]; 5279de05987SCodrin Ciubotariu }; 5289de05987SCodrin Ciubotariu 5299de05987SCodrin Ciubotariu struct vsc9953_rew_common { 5309de05987SCodrin Ciubotariu u32 reserve[4]; 5319de05987SCodrin Ciubotariu u32 dscp_remap_dp1_cfg[64]; 5329de05987SCodrin Ciubotariu u32 dscp_remap_cfg[64]; 5339de05987SCodrin Ciubotariu }; 5349de05987SCodrin Ciubotariu 5359de05987SCodrin Ciubotariu struct vsc9953_rew_reg { 5369de05987SCodrin Ciubotariu struct vsc9953_rew_port port[12]; 5379de05987SCodrin Ciubotariu struct vsc9953_rew_common common; 5389de05987SCodrin Ciubotariu }; 5399de05987SCodrin Ciubotariu 5409de05987SCodrin Ciubotariu /* END VSC9953 REW structure */ 5416706b115SCodrin Ciubotariu 5423cc8cfffSCodrin Ciubotariu /* VSC9953 DEVCPU_GCB structure */ 5436706b115SCodrin Ciubotariu 5446706b115SCodrin Ciubotariu struct vsc9953_chip_regs { 5456706b115SCodrin Ciubotariu u32 chipd_id; 5466706b115SCodrin Ciubotariu u32 gpr; 5476706b115SCodrin Ciubotariu u32 soft_rst; 5486706b115SCodrin Ciubotariu }; 5496706b115SCodrin Ciubotariu 5506706b115SCodrin Ciubotariu struct vsc9953_gpio { 5516706b115SCodrin Ciubotariu u32 gpio_out_set[10]; 5526706b115SCodrin Ciubotariu u32 gpio_out_clr[10]; 5536706b115SCodrin Ciubotariu u32 gpio_out[10]; 5546706b115SCodrin Ciubotariu u32 gpio_in[10]; 5556706b115SCodrin Ciubotariu }; 5566706b115SCodrin Ciubotariu 5576706b115SCodrin Ciubotariu struct vsc9953_mii_mng { 5586706b115SCodrin Ciubotariu u32 miimstatus; 5596706b115SCodrin Ciubotariu u32 reserved1; 5606706b115SCodrin Ciubotariu u32 miimcmd; 5616706b115SCodrin Ciubotariu u32 miimdata; 5626706b115SCodrin Ciubotariu u32 miimcfg; 5636706b115SCodrin Ciubotariu u32 miimscan_0; 5646706b115SCodrin Ciubotariu u32 miimscan_1; 5656706b115SCodrin Ciubotariu u32 miiscan_lst_rslts; 5666706b115SCodrin Ciubotariu u32 miiscan_lst_rslts_valid; 5676706b115SCodrin Ciubotariu }; 5686706b115SCodrin Ciubotariu 5696706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan { 5706706b115SCodrin Ciubotariu u32 mii_scan_results_sticky[2]; 5716706b115SCodrin Ciubotariu }; 5726706b115SCodrin Ciubotariu 5736706b115SCodrin Ciubotariu struct vsc9953_devcpu_gcb { 5746706b115SCodrin Ciubotariu struct vsc9953_chip_regs chip_regs; 5756706b115SCodrin Ciubotariu struct vsc9953_gpio gpio; 5766706b115SCodrin Ciubotariu struct vsc9953_mii_mng mii_mng[2]; 5776706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan mii_read_scan; 5786706b115SCodrin Ciubotariu }; 5796706b115SCodrin Ciubotariu 5803cc8cfffSCodrin Ciubotariu /* END VSC9953 DEVCPU_GCB structure */ 5816706b115SCodrin Ciubotariu 5823cc8cfffSCodrin Ciubotariu /* VSC9953 IS* structure */ 5836706b115SCodrin Ciubotariu 5846706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg { 5856706b115SCodrin Ciubotariu u32 vcap_update_ctrl; 5866706b115SCodrin Ciubotariu u32 vcap_mv_cfg; 5876706b115SCodrin Ciubotariu }; 5886706b115SCodrin Ciubotariu 5896706b115SCodrin Ciubotariu struct vsc9953_vcap { 5906706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg vcap_core_cfg; 5916706b115SCodrin Ciubotariu }; 5926706b115SCodrin Ciubotariu 5933cc8cfffSCodrin Ciubotariu /* END VSC9953 IS* structure */ 5946706b115SCodrin Ciubotariu 5956706b115SCodrin Ciubotariu #define VSC9953_PORT_INFO_INITIALIZER(idx) \ 5966706b115SCodrin Ciubotariu { \ 5976706b115SCodrin Ciubotariu .enabled = 0, \ 5986706b115SCodrin Ciubotariu .phyaddr = 0, \ 5996706b115SCodrin Ciubotariu .index = idx, \ 6006706b115SCodrin Ciubotariu .phy_regs = NULL, \ 6016706b115SCodrin Ciubotariu .enet_if = PHY_INTERFACE_MODE_NONE, \ 6026706b115SCodrin Ciubotariu .bus = NULL, \ 6036706b115SCodrin Ciubotariu .phydev = NULL, \ 6046706b115SCodrin Ciubotariu } 6056706b115SCodrin Ciubotariu 6066706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 port */ 6076706b115SCodrin Ciubotariu struct vsc9953_port_info { 6086706b115SCodrin Ciubotariu u8 enabled; 6096706b115SCodrin Ciubotariu u8 phyaddr; 6106706b115SCodrin Ciubotariu int index; 6116706b115SCodrin Ciubotariu void *phy_regs; 6126706b115SCodrin Ciubotariu phy_interface_t enet_if; 6136706b115SCodrin Ciubotariu struct mii_dev *bus; 6146706b115SCodrin Ciubotariu struct phy_device *phydev; 6156706b115SCodrin Ciubotariu }; 6166706b115SCodrin Ciubotariu 6176706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 switch */ 6186706b115SCodrin Ciubotariu struct vsc9953_info { 6196706b115SCodrin Ciubotariu struct vsc9953_port_info port[VSC9953_MAX_PORTS]; 6206706b115SCodrin Ciubotariu }; 6216706b115SCodrin Ciubotariu 6226706b115SCodrin Ciubotariu void vsc9953_init(bd_t *bis); 6236706b115SCodrin Ciubotariu 6243cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_mdio(int port_no, struct mii_dev *bus); 6253cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_address(int port_no, int address); 6263cc8cfffSCodrin Ciubotariu void vsc9953_port_enable(int port_no); 6273cc8cfffSCodrin Ciubotariu void vsc9953_port_disable(int port_no); 6283cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_int(int port_no, phy_interface_t phy_int); 6296706b115SCodrin Ciubotariu 6306706b115SCodrin Ciubotariu #endif /* _VSC9953_H_ */ 631