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 899de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_port.vlan_cfg register */ 909de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_AWARE_ENA 0x00100000 919de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_POP_CNT_MASK 0x000c0000 929de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_VID_MASK 0x00000fff 939de05987SCodrin Ciubotariu 949de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_vlan_cfg register */ 959de05987SCodrin Ciubotariu #define VSC9953_PORT_VLAN_CFG_VID_MASK 0x00000fff 969de05987SCodrin Ciubotariu 979de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_tidx register */ 989de05987SCodrin Ciubotariu #define VSC9953_ANA_TBL_VID_MASK 0x00000fff 999de05987SCodrin Ciubotariu 1009de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_access register */ 1019de05987SCodrin Ciubotariu #define VSC9953_VLAN_PORT_MASK 0x00001ffc 1029de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_MASK 0x00000003 1039de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_IDLE 0x00000000 1049de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_READ 0x00000001 1059de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_WRITE 0x00000002 1069de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_INIT 0x00000003 1079de05987SCodrin Ciubotariu 108*68c929daSCodrin Ciubotariu /* Macros for vsc9953_ana_port.port_cfg register */ 109*68c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_ENA 0x00000080 110*68c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_AUTO 0x00000100 111*68c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_CPU 0x00000200 112*68c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_DROP 0x00000400 113*68c929daSCodrin Ciubotariu 1143cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_qsys_sys.switch_port_mode register */ 115fe91095bSCodrin Ciubotariu #define VSC9953_PORT_ENA 0x00002000 1163cc8cfffSCodrin Ciubotariu 1179de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana.adv_learn register */ 1189de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHK 0x00000400 1199de05987SCodrin Ciubotariu 1209de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_tag_cfg register */ 1219de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_MASK 0x00000180 1229de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_NONE 0x00000000 1239de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_PVID_ZERO 0x00000080 1249de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_ZERO 0x00000100 1259de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL 0x00000180 1269de05987SCodrin Ciubotariu 1276706b115SCodrin Ciubotariu #define VSC9953_MAX_PORTS 10 1286706b115SCodrin Ciubotariu #define VSC9953_PORT_CHECK(port) \ 1296706b115SCodrin Ciubotariu (((port) < 0 || (port) >= VSC9953_MAX_PORTS) ? 0 : 1) 1306706b115SCodrin Ciubotariu #define VSC9953_INTERNAL_PORT_CHECK(port) ( \ 1316706b115SCodrin Ciubotariu ( \ 1326706b115SCodrin Ciubotariu (port) < VSC9953_MAX_PORTS - 2 || (port) >= VSC9953_MAX_PORTS \ 1336706b115SCodrin Ciubotariu ) ? 0 : 1 \ 1346706b115SCodrin Ciubotariu ) 1359de05987SCodrin Ciubotariu #define VSC9953_MAX_VLAN 4096 1369de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHECK(vid) \ 1379de05987SCodrin Ciubotariu (((vid) < 0 || (vid) >= VSC9953_MAX_VLAN) ? 0 : 1) 1386706b115SCodrin Ciubotariu 1396706b115SCodrin Ciubotariu #define DEFAULT_VSC9953_MDIO_NAME "VSC9953_MDIO0" 1406706b115SCodrin Ciubotariu 1416706b115SCodrin Ciubotariu #define MIIMIND_OPR_PEND 0x00000004 1426706b115SCodrin Ciubotariu 1436706b115SCodrin Ciubotariu struct vsc9953_mdio_info { 1446706b115SCodrin Ciubotariu struct vsc9953_mii_mng *regs; 1456706b115SCodrin Ciubotariu char *name; 1466706b115SCodrin Ciubotariu }; 1476706b115SCodrin Ciubotariu 1483cc8cfffSCodrin Ciubotariu /* VSC9953 ANA structure */ 1496706b115SCodrin Ciubotariu 1506706b115SCodrin Ciubotariu struct vsc9953_ana_port { 1516706b115SCodrin Ciubotariu u32 vlan_cfg; 1526706b115SCodrin Ciubotariu u32 drop_cfg; 1536706b115SCodrin Ciubotariu u32 qos_cfg; 1546706b115SCodrin Ciubotariu u32 vcap_cfg; 1556706b115SCodrin Ciubotariu u32 vcap_s1_key_cfg[3]; 1566706b115SCodrin Ciubotariu u32 vcap_s2_cfg; 1576706b115SCodrin Ciubotariu u32 qos_pcp_dei_map_cfg[16]; 1586706b115SCodrin Ciubotariu u32 cpu_fwd_cfg; 1596706b115SCodrin Ciubotariu u32 cpu_fwd_bpdu_cfg; 1606706b115SCodrin Ciubotariu u32 cpu_fwd_garp_cfg; 1616706b115SCodrin Ciubotariu u32 cpu_fwd_ccm_cfg; 1626706b115SCodrin Ciubotariu u32 port_cfg; 1636706b115SCodrin Ciubotariu u32 pol_cfg; 1646706b115SCodrin Ciubotariu u32 reserved[34]; 1656706b115SCodrin Ciubotariu }; 1666706b115SCodrin Ciubotariu 1676706b115SCodrin Ciubotariu struct vsc9953_ana_pol { 1686706b115SCodrin Ciubotariu u32 pol_pir_cfg; 1696706b115SCodrin Ciubotariu u32 pol_cir_cfg; 1706706b115SCodrin Ciubotariu u32 pol_mode_cfg; 1716706b115SCodrin Ciubotariu u32 pol_pir_state; 1726706b115SCodrin Ciubotariu u32 pol_cir_state; 1736706b115SCodrin Ciubotariu u32 reserved1[3]; 1746706b115SCodrin Ciubotariu }; 1756706b115SCodrin Ciubotariu 1766706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables { 1776706b115SCodrin Ciubotariu u32 entry_lim[11]; 1786706b115SCodrin Ciubotariu u32 an_moved; 1796706b115SCodrin Ciubotariu u32 mach_data; 1806706b115SCodrin Ciubotariu u32 macl_data; 1816706b115SCodrin Ciubotariu u32 mac_access; 1826706b115SCodrin Ciubotariu u32 mact_indx; 1836706b115SCodrin Ciubotariu u32 vlan_access; 1846706b115SCodrin Ciubotariu u32 vlan_tidx; 1856706b115SCodrin Ciubotariu }; 1866706b115SCodrin Ciubotariu 1876706b115SCodrin Ciubotariu struct vsc9953_ana_ana { 1886706b115SCodrin Ciubotariu u32 adv_learn; 1896706b115SCodrin Ciubotariu u32 vlan_mask; 190440873dfSCodrin Ciubotariu u32 reserved; 1916706b115SCodrin Ciubotariu u32 anag_efil; 1926706b115SCodrin Ciubotariu u32 an_events; 1936706b115SCodrin Ciubotariu u32 storm_limit_burst; 1946706b115SCodrin Ciubotariu u32 storm_limit_cfg[4]; 1956706b115SCodrin Ciubotariu u32 isolated_prts; 1966706b115SCodrin Ciubotariu u32 community_ports; 1976706b115SCodrin Ciubotariu u32 auto_age; 1986706b115SCodrin Ciubotariu u32 mac_options; 1996706b115SCodrin Ciubotariu u32 learn_disc; 2006706b115SCodrin Ciubotariu u32 agen_ctrl; 2016706b115SCodrin Ciubotariu u32 mirror_ports; 2026706b115SCodrin Ciubotariu u32 emirror_ports; 2036706b115SCodrin Ciubotariu u32 flooding; 2046706b115SCodrin Ciubotariu u32 flooding_ipmc; 2056706b115SCodrin Ciubotariu u32 sflow_cfg[11]; 2066706b115SCodrin Ciubotariu u32 port_mode[12]; 2076706b115SCodrin Ciubotariu }; 2086706b115SCodrin Ciubotariu 2096706b115SCodrin Ciubotariu struct vsc9953_ana_pgid { 2106706b115SCodrin Ciubotariu u32 port_grp_id[91]; 2116706b115SCodrin Ciubotariu }; 2126706b115SCodrin Ciubotariu 2136706b115SCodrin Ciubotariu struct vsc9953_ana_pfc { 2146706b115SCodrin Ciubotariu u32 pfc_cfg; 2156706b115SCodrin Ciubotariu u32 reserved1[15]; 2166706b115SCodrin Ciubotariu }; 2176706b115SCodrin Ciubotariu 2186706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc { 2196706b115SCodrin Ciubotariu u32 pol_flowc[10]; 2206706b115SCodrin Ciubotariu u32 reserved1[17]; 2216706b115SCodrin Ciubotariu u32 pol_hyst; 2226706b115SCodrin Ciubotariu }; 2236706b115SCodrin Ciubotariu 2246706b115SCodrin Ciubotariu struct vsc9953_ana_common { 2256706b115SCodrin Ciubotariu u32 aggr_cfg; 2266706b115SCodrin Ciubotariu u32 cpuq_cfg; 2276706b115SCodrin Ciubotariu u32 cpuq_8021_cfg; 2286706b115SCodrin Ciubotariu u32 dscp_cfg; 2296706b115SCodrin Ciubotariu u32 dscp_rewr_cfg; 2306706b115SCodrin Ciubotariu u32 vcap_rng_type_cfg; 2316706b115SCodrin Ciubotariu u32 vcap_rng_val_cfg; 2326706b115SCodrin Ciubotariu u32 discard_cfg; 2336706b115SCodrin Ciubotariu u32 fid_cfg; 2346706b115SCodrin Ciubotariu }; 2356706b115SCodrin Ciubotariu 2366706b115SCodrin Ciubotariu struct vsc9953_analyzer { 2376706b115SCodrin Ciubotariu struct vsc9953_ana_port port[11]; 2386706b115SCodrin Ciubotariu u32 reserved1[9536]; 2396706b115SCodrin Ciubotariu struct vsc9953_ana_pol pol[164]; 2406706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables ana_tables; 2416706b115SCodrin Ciubotariu u32 reserved2[14]; 2426706b115SCodrin Ciubotariu struct vsc9953_ana_ana ana; 2436706b115SCodrin Ciubotariu u32 reserved3[22]; 2446706b115SCodrin Ciubotariu struct vsc9953_ana_pgid port_id_tbl; 2456706b115SCodrin Ciubotariu u32 reserved4[549]; 2466706b115SCodrin Ciubotariu struct vsc9953_ana_pfc pfc[10]; 2476706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc pol_misc; 2486706b115SCodrin Ciubotariu u32 reserved5[196]; 2496706b115SCodrin Ciubotariu struct vsc9953_ana_common common; 2506706b115SCodrin Ciubotariu }; 2513cc8cfffSCodrin Ciubotariu /* END VSC9953 ANA structure t*/ 2526706b115SCodrin Ciubotariu 2533cc8cfffSCodrin Ciubotariu /* VSC9953 DEV_GMII structure */ 2546706b115SCodrin Ciubotariu 2556706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode { 2566706b115SCodrin Ciubotariu u32 clock_cfg; 2576706b115SCodrin Ciubotariu u32 port_misc; 2586706b115SCodrin Ciubotariu u32 reserved1; 2596706b115SCodrin Ciubotariu u32 eee_cfg; 2606706b115SCodrin Ciubotariu }; 2616706b115SCodrin Ciubotariu 2626706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status { 2636706b115SCodrin Ciubotariu u32 mac_ena_cfg; 2646706b115SCodrin Ciubotariu u32 mac_mode_cfg; 2656706b115SCodrin Ciubotariu u32 mac_maxlen_cfg; 2666706b115SCodrin Ciubotariu u32 mac_tags_cfg; 2676706b115SCodrin Ciubotariu u32 mac_adv_chk_cfg; 2686706b115SCodrin Ciubotariu u32 mac_ifg_cfg; 2696706b115SCodrin Ciubotariu u32 mac_hdx_cfg; 2706706b115SCodrin Ciubotariu u32 mac_fc_mac_low_cfg; 2716706b115SCodrin Ciubotariu u32 mac_fc_mac_high_cfg; 2726706b115SCodrin Ciubotariu u32 mac_sticky; 2736706b115SCodrin Ciubotariu }; 2746706b115SCodrin Ciubotariu 2756706b115SCodrin Ciubotariu struct vsc9953_dev_gmii { 2766706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode port_mode; 2776706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status mac_cfg_status; 2786706b115SCodrin Ciubotariu }; 2796706b115SCodrin Ciubotariu 2803cc8cfffSCodrin Ciubotariu /* END VSC9953 DEV_GMII structure */ 2816706b115SCodrin Ciubotariu 2823cc8cfffSCodrin Ciubotariu /* VSC9953 QSYS structure */ 2836706b115SCodrin Ciubotariu 2846706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch { 2856706b115SCodrin Ciubotariu u32 cir_cfg; 2866706b115SCodrin Ciubotariu u32 reserved1; 2876706b115SCodrin Ciubotariu u32 se_cfg; 2886706b115SCodrin Ciubotariu u32 se_dwrr_cfg[8]; 2896706b115SCodrin Ciubotariu u32 cir_state; 2906706b115SCodrin Ciubotariu u32 reserved2[20]; 2916706b115SCodrin Ciubotariu }; 2926706b115SCodrin Ciubotariu 2936706b115SCodrin Ciubotariu struct vsc9953_qsys_sys { 2946706b115SCodrin Ciubotariu u32 port_mode[12]; 2956706b115SCodrin Ciubotariu u32 switch_port_mode[11]; 2966706b115SCodrin Ciubotariu u32 stat_cnt_cfg; 2976706b115SCodrin Ciubotariu u32 eee_cfg[10]; 2986706b115SCodrin Ciubotariu u32 eee_thrs; 2996706b115SCodrin Ciubotariu u32 igr_no_sharing; 3006706b115SCodrin Ciubotariu u32 egr_no_sharing; 3016706b115SCodrin Ciubotariu u32 sw_status[11]; 3026706b115SCodrin Ciubotariu u32 ext_cpu_cfg; 3036706b115SCodrin Ciubotariu u32 cpu_group_map; 3046706b115SCodrin Ciubotariu u32 reserved1[23]; 3056706b115SCodrin Ciubotariu }; 3066706b115SCodrin Ciubotariu 3076706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg { 3086706b115SCodrin Ciubotariu u32 red_profile[16]; 3096706b115SCodrin Ciubotariu u32 res_qos_mode; 3106706b115SCodrin Ciubotariu }; 3116706b115SCodrin Ciubotariu 3126706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg { 3136706b115SCodrin Ciubotariu u32 egr_drop_mode; 3146706b115SCodrin Ciubotariu }; 3156706b115SCodrin Ciubotariu 3166706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt { 3176706b115SCodrin Ciubotariu u32 eq_cntrl; 3186706b115SCodrin Ciubotariu u32 reserved1; 3196706b115SCodrin Ciubotariu }; 3206706b115SCodrin Ciubotariu 3216706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc { 3226706b115SCodrin Ciubotariu u32 hsch_misc_cfg; 3236706b115SCodrin Ciubotariu u32 reserved1[546]; 3246706b115SCodrin Ciubotariu }; 3256706b115SCodrin Ciubotariu 3266706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl { 3276706b115SCodrin Ciubotariu u32 res_cfg; 3286706b115SCodrin Ciubotariu u32 res_stat; 3296706b115SCodrin Ciubotariu 3306706b115SCodrin Ciubotariu }; 3316706b115SCodrin Ciubotariu 3326706b115SCodrin Ciubotariu struct vsc9953_qsys_reg { 3336706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch hsch[108]; 3346706b115SCodrin Ciubotariu struct vsc9953_qsys_sys sys; 3356706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg qos_cfg; 3366706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg drop_cfg; 3376706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt mmgt; 3386706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc hsch_misc; 3396706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl res_ctrl[1024]; 3406706b115SCodrin Ciubotariu }; 3416706b115SCodrin Ciubotariu 3423cc8cfffSCodrin Ciubotariu /* END VSC9953 QSYS structure */ 3436706b115SCodrin Ciubotariu 3443cc8cfffSCodrin Ciubotariu /* VSC9953 SYS structure */ 3456706b115SCodrin Ciubotariu 34686719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs { 34786719f0cSCodrin Ciubotariu u32 c_rx_oct; 34886719f0cSCodrin Ciubotariu u32 c_rx_uc; 34986719f0cSCodrin Ciubotariu u32 c_rx_mc; 35086719f0cSCodrin Ciubotariu u32 c_rx_bc; 35186719f0cSCodrin Ciubotariu u32 c_rx_short; 35286719f0cSCodrin Ciubotariu u32 c_rx_frag; 35386719f0cSCodrin Ciubotariu u32 c_rx_jabber; 35486719f0cSCodrin Ciubotariu u32 c_rx_crc; 35586719f0cSCodrin Ciubotariu u32 c_rx_symbol_err; 35686719f0cSCodrin Ciubotariu u32 c_rx_sz_64; 35786719f0cSCodrin Ciubotariu u32 c_rx_sz_65_127; 35886719f0cSCodrin Ciubotariu u32 c_rx_sz_128_255; 35986719f0cSCodrin Ciubotariu u32 c_rx_sz_256_511; 36086719f0cSCodrin Ciubotariu u32 c_rx_sz_512_1023; 36186719f0cSCodrin Ciubotariu u32 c_rx_sz_1024_1526; 36286719f0cSCodrin Ciubotariu u32 c_rx_sz_jumbo; 36386719f0cSCodrin Ciubotariu u32 c_rx_pause; 36486719f0cSCodrin Ciubotariu u32 c_rx_control; 36586719f0cSCodrin Ciubotariu u32 c_rx_long; 36686719f0cSCodrin Ciubotariu u32 c_rx_cat_drop; 36786719f0cSCodrin Ciubotariu u32 c_rx_red_prio_0; 36886719f0cSCodrin Ciubotariu u32 c_rx_red_prio_1; 36986719f0cSCodrin Ciubotariu u32 c_rx_red_prio_2; 37086719f0cSCodrin Ciubotariu u32 c_rx_red_prio_3; 37186719f0cSCodrin Ciubotariu u32 c_rx_red_prio_4; 37286719f0cSCodrin Ciubotariu u32 c_rx_red_prio_5; 37386719f0cSCodrin Ciubotariu u32 c_rx_red_prio_6; 37486719f0cSCodrin Ciubotariu u32 c_rx_red_prio_7; 37586719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_0; 37686719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_1; 37786719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_2; 37886719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_3; 37986719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_4; 38086719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_5; 38186719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_6; 38286719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_7; 38386719f0cSCodrin Ciubotariu u32 c_rx_green_prio_0; 38486719f0cSCodrin Ciubotariu u32 c_rx_green_prio_1; 38586719f0cSCodrin Ciubotariu u32 c_rx_green_prio_2; 38686719f0cSCodrin Ciubotariu u32 c_rx_green_prio_3; 38786719f0cSCodrin Ciubotariu u32 c_rx_green_prio_4; 38886719f0cSCodrin Ciubotariu u32 c_rx_green_prio_5; 38986719f0cSCodrin Ciubotariu u32 c_rx_green_prio_6; 39086719f0cSCodrin Ciubotariu u32 c_rx_green_prio_7; 39186719f0cSCodrin Ciubotariu u32 reserved[20]; 39286719f0cSCodrin Ciubotariu }; 39386719f0cSCodrin Ciubotariu 39486719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs { 39586719f0cSCodrin Ciubotariu u32 c_tx_oct; 39686719f0cSCodrin Ciubotariu u32 c_tx_uc; 39786719f0cSCodrin Ciubotariu u32 c_tx_mc; 39886719f0cSCodrin Ciubotariu u32 c_tx_bc; 39986719f0cSCodrin Ciubotariu u32 c_tx_col; 40086719f0cSCodrin Ciubotariu u32 c_tx_drop; 40186719f0cSCodrin Ciubotariu u32 c_tx_pause; 40286719f0cSCodrin Ciubotariu u32 c_tx_sz_64; 40386719f0cSCodrin Ciubotariu u32 c_tx_sz_65_127; 40486719f0cSCodrin Ciubotariu u32 c_tx_sz_128_255; 40586719f0cSCodrin Ciubotariu u32 c_tx_sz_256_511; 40686719f0cSCodrin Ciubotariu u32 c_tx_sz_512_1023; 40786719f0cSCodrin Ciubotariu u32 c_tx_sz_1024_1526; 40886719f0cSCodrin Ciubotariu u32 c_tx_sz_jumbo; 40986719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_0; 41086719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_1; 41186719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_2; 41286719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_3; 41386719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_4; 41486719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_5; 41586719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_6; 41686719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_7; 41786719f0cSCodrin Ciubotariu u32 c_tx_green_prio_0; 41886719f0cSCodrin Ciubotariu u32 c_tx_green_prio_1; 41986719f0cSCodrin Ciubotariu u32 c_tx_green_prio_2; 42086719f0cSCodrin Ciubotariu u32 c_tx_green_prio_3; 42186719f0cSCodrin Ciubotariu u32 c_tx_green_prio_4; 42286719f0cSCodrin Ciubotariu u32 c_tx_green_prio_5; 42386719f0cSCodrin Ciubotariu u32 c_tx_green_prio_6; 42486719f0cSCodrin Ciubotariu u32 c_tx_green_prio_7; 42586719f0cSCodrin Ciubotariu u32 c_tx_aged; 42686719f0cSCodrin Ciubotariu u32 reserved[33]; 42786719f0cSCodrin Ciubotariu }; 42886719f0cSCodrin Ciubotariu 42986719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs { 43086719f0cSCodrin Ciubotariu u32 c_dr_local; 43186719f0cSCodrin Ciubotariu u32 c_dr_tail; 43286719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_0; 43386719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_1; 43486719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_2; 43586719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_3; 43686719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_4; 43786719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_5; 43886719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_6; 43986719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_7; 44086719f0cSCodrin Ciubotariu u32 c_dr_green_prio_0; 44186719f0cSCodrin Ciubotariu u32 c_dr_green_prio_1; 44286719f0cSCodrin Ciubotariu u32 c_dr_green_prio_2; 44386719f0cSCodrin Ciubotariu u32 c_dr_green_prio_3; 44486719f0cSCodrin Ciubotariu u32 c_dr_green_prio_4; 44586719f0cSCodrin Ciubotariu u32 c_dr_green_prio_5; 44686719f0cSCodrin Ciubotariu u32 c_dr_green_prio_6; 44786719f0cSCodrin Ciubotariu u32 c_dr_green_prio_7; 44886719f0cSCodrin Ciubotariu u32 reserved[46]; 44986719f0cSCodrin Ciubotariu }; 45086719f0cSCodrin Ciubotariu 4516706b115SCodrin Ciubotariu struct vsc9953_sys_stat { 45286719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs rx_cntrs; 45386719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs tx_cntrs; 45486719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs drop_cntrs; 4556706b115SCodrin Ciubotariu u32 reserved1[6]; 4566706b115SCodrin Ciubotariu }; 4576706b115SCodrin Ciubotariu 4586706b115SCodrin Ciubotariu struct vsc9953_sys_sys { 4596706b115SCodrin Ciubotariu u32 reset_cfg; 4606706b115SCodrin Ciubotariu u32 reserved1; 4616706b115SCodrin Ciubotariu u32 vlan_etype_cfg; 4626706b115SCodrin Ciubotariu u32 port_mode[12]; 4636706b115SCodrin Ciubotariu u32 front_port_mode[10]; 4646706b115SCodrin Ciubotariu u32 frame_aging; 4656706b115SCodrin Ciubotariu u32 stat_cfg; 4666706b115SCodrin Ciubotariu u32 reserved2[50]; 4676706b115SCodrin Ciubotariu }; 4686706b115SCodrin Ciubotariu 4696706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg { 4706706b115SCodrin Ciubotariu u32 pause_cfg[11]; 4716706b115SCodrin Ciubotariu u32 pause_tot_cfg; 4726706b115SCodrin Ciubotariu u32 tail_drop_level[11]; 4736706b115SCodrin Ciubotariu u32 tot_tail_drop_lvl; 4746706b115SCodrin Ciubotariu u32 mac_fc_cfg[10]; 4756706b115SCodrin Ciubotariu }; 4766706b115SCodrin Ciubotariu 4776706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt { 4786706b115SCodrin Ciubotariu u16 free_cnt; 4796706b115SCodrin Ciubotariu }; 4806706b115SCodrin Ciubotariu 4816706b115SCodrin Ciubotariu struct vsc9953_system_reg { 4826706b115SCodrin Ciubotariu struct vsc9953_sys_stat stat; 4836706b115SCodrin Ciubotariu struct vsc9953_sys_sys sys; 4846706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg pause_cfg; 4856706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt mmgt; 4866706b115SCodrin Ciubotariu }; 4876706b115SCodrin Ciubotariu 4883cc8cfffSCodrin Ciubotariu /* END VSC9953 SYS structure */ 4896706b115SCodrin Ciubotariu 4909de05987SCodrin Ciubotariu /* VSC9953 REW structure */ 4919de05987SCodrin Ciubotariu 4929de05987SCodrin Ciubotariu struct vsc9953_rew_port { 4939de05987SCodrin Ciubotariu u32 port_vlan_cfg; 4949de05987SCodrin Ciubotariu u32 port_tag_cfg; 4959de05987SCodrin Ciubotariu u32 port_port_cfg; 4969de05987SCodrin Ciubotariu u32 port_dscp_cfg; 4979de05987SCodrin Ciubotariu u32 port_pcp_dei_qos_map_cfg[16]; 4989de05987SCodrin Ciubotariu u32 reserved[12]; 4999de05987SCodrin Ciubotariu }; 5009de05987SCodrin Ciubotariu 5019de05987SCodrin Ciubotariu struct vsc9953_rew_common { 5029de05987SCodrin Ciubotariu u32 reserve[4]; 5039de05987SCodrin Ciubotariu u32 dscp_remap_dp1_cfg[64]; 5049de05987SCodrin Ciubotariu u32 dscp_remap_cfg[64]; 5059de05987SCodrin Ciubotariu }; 5069de05987SCodrin Ciubotariu 5079de05987SCodrin Ciubotariu struct vsc9953_rew_reg { 5089de05987SCodrin Ciubotariu struct vsc9953_rew_port port[12]; 5099de05987SCodrin Ciubotariu struct vsc9953_rew_common common; 5109de05987SCodrin Ciubotariu }; 5119de05987SCodrin Ciubotariu 5129de05987SCodrin Ciubotariu /* END VSC9953 REW structure */ 5136706b115SCodrin Ciubotariu 5143cc8cfffSCodrin Ciubotariu /* VSC9953 DEVCPU_GCB structure */ 5156706b115SCodrin Ciubotariu 5166706b115SCodrin Ciubotariu struct vsc9953_chip_regs { 5176706b115SCodrin Ciubotariu u32 chipd_id; 5186706b115SCodrin Ciubotariu u32 gpr; 5196706b115SCodrin Ciubotariu u32 soft_rst; 5206706b115SCodrin Ciubotariu }; 5216706b115SCodrin Ciubotariu 5226706b115SCodrin Ciubotariu struct vsc9953_gpio { 5236706b115SCodrin Ciubotariu u32 gpio_out_set[10]; 5246706b115SCodrin Ciubotariu u32 gpio_out_clr[10]; 5256706b115SCodrin Ciubotariu u32 gpio_out[10]; 5266706b115SCodrin Ciubotariu u32 gpio_in[10]; 5276706b115SCodrin Ciubotariu }; 5286706b115SCodrin Ciubotariu 5296706b115SCodrin Ciubotariu struct vsc9953_mii_mng { 5306706b115SCodrin Ciubotariu u32 miimstatus; 5316706b115SCodrin Ciubotariu u32 reserved1; 5326706b115SCodrin Ciubotariu u32 miimcmd; 5336706b115SCodrin Ciubotariu u32 miimdata; 5346706b115SCodrin Ciubotariu u32 miimcfg; 5356706b115SCodrin Ciubotariu u32 miimscan_0; 5366706b115SCodrin Ciubotariu u32 miimscan_1; 5376706b115SCodrin Ciubotariu u32 miiscan_lst_rslts; 5386706b115SCodrin Ciubotariu u32 miiscan_lst_rslts_valid; 5396706b115SCodrin Ciubotariu }; 5406706b115SCodrin Ciubotariu 5416706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan { 5426706b115SCodrin Ciubotariu u32 mii_scan_results_sticky[2]; 5436706b115SCodrin Ciubotariu }; 5446706b115SCodrin Ciubotariu 5456706b115SCodrin Ciubotariu struct vsc9953_devcpu_gcb { 5466706b115SCodrin Ciubotariu struct vsc9953_chip_regs chip_regs; 5476706b115SCodrin Ciubotariu struct vsc9953_gpio gpio; 5486706b115SCodrin Ciubotariu struct vsc9953_mii_mng mii_mng[2]; 5496706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan mii_read_scan; 5506706b115SCodrin Ciubotariu }; 5516706b115SCodrin Ciubotariu 5523cc8cfffSCodrin Ciubotariu /* END VSC9953 DEVCPU_GCB structure */ 5536706b115SCodrin Ciubotariu 5543cc8cfffSCodrin Ciubotariu /* VSC9953 IS* structure */ 5556706b115SCodrin Ciubotariu 5566706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg { 5576706b115SCodrin Ciubotariu u32 vcap_update_ctrl; 5586706b115SCodrin Ciubotariu u32 vcap_mv_cfg; 5596706b115SCodrin Ciubotariu }; 5606706b115SCodrin Ciubotariu 5616706b115SCodrin Ciubotariu struct vsc9953_vcap { 5626706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg vcap_core_cfg; 5636706b115SCodrin Ciubotariu }; 5646706b115SCodrin Ciubotariu 5653cc8cfffSCodrin Ciubotariu /* END VSC9953 IS* structure */ 5666706b115SCodrin Ciubotariu 5676706b115SCodrin Ciubotariu #define VSC9953_PORT_INFO_INITIALIZER(idx) \ 5686706b115SCodrin Ciubotariu { \ 5696706b115SCodrin Ciubotariu .enabled = 0, \ 5706706b115SCodrin Ciubotariu .phyaddr = 0, \ 5716706b115SCodrin Ciubotariu .index = idx, \ 5726706b115SCodrin Ciubotariu .phy_regs = NULL, \ 5736706b115SCodrin Ciubotariu .enet_if = PHY_INTERFACE_MODE_NONE, \ 5746706b115SCodrin Ciubotariu .bus = NULL, \ 5756706b115SCodrin Ciubotariu .phydev = NULL, \ 5766706b115SCodrin Ciubotariu } 5776706b115SCodrin Ciubotariu 5786706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 port */ 5796706b115SCodrin Ciubotariu struct vsc9953_port_info { 5806706b115SCodrin Ciubotariu u8 enabled; 5816706b115SCodrin Ciubotariu u8 phyaddr; 5826706b115SCodrin Ciubotariu int index; 5836706b115SCodrin Ciubotariu void *phy_regs; 5846706b115SCodrin Ciubotariu phy_interface_t enet_if; 5856706b115SCodrin Ciubotariu struct mii_dev *bus; 5866706b115SCodrin Ciubotariu struct phy_device *phydev; 5876706b115SCodrin Ciubotariu }; 5886706b115SCodrin Ciubotariu 5896706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 switch */ 5906706b115SCodrin Ciubotariu struct vsc9953_info { 5916706b115SCodrin Ciubotariu struct vsc9953_port_info port[VSC9953_MAX_PORTS]; 5926706b115SCodrin Ciubotariu }; 5936706b115SCodrin Ciubotariu 5946706b115SCodrin Ciubotariu void vsc9953_init(bd_t *bis); 5956706b115SCodrin Ciubotariu 5963cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_mdio(int port_no, struct mii_dev *bus); 5973cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_address(int port_no, int address); 5983cc8cfffSCodrin Ciubotariu void vsc9953_port_enable(int port_no); 5993cc8cfffSCodrin Ciubotariu void vsc9953_port_disable(int port_no); 6003cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_int(int port_no, phy_interface_t phy_int); 6016706b115SCodrin Ciubotariu 6026706b115SCodrin Ciubotariu #endif /* _VSC9953_H_ */ 603