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 8922449858SCodrin Ciubotariu /* Macros for register vsc9953_ana_ana_tables.mac_access register */ 9022449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_IDLE 0x00000000 9122449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_LEARN 0x00000001 9222449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_FORGET 0x00000002 9322449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_AGE 0x00000003 9422449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_NEXT 0x00000004 9522449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_READ 0x00000006 9622449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_WRITE 0x00000007 9722449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_MASK 0x00000007 9822449858SCodrin Ciubotariu #define VSC9953_MAC_CMD_VALID 0x00000800 9922449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_NORMAL 0x00000000 10022449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_LOCKED 0x00000200 10122449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_IPV4MCAST 0x00000400 10222449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_IPV6MCAST 0x00000600 10322449858SCodrin Ciubotariu #define VSC9953_MAC_ENTRYTYPE_MASK 0x00000600 10422449858SCodrin Ciubotariu #define VSC9953_MAC_DESTIDX_MASK 0x000001f8 10522449858SCodrin Ciubotariu #define VSC9953_MAC_VID_MASK 0x1fff0000 10622449858SCodrin Ciubotariu #define VSC9953_MAC_MACH_MASK 0x0000ffff 10722449858SCodrin 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 111a2477924SCodrin Ciubotariu #define VSC9953_VLAN_CFG_POP_CNT_NONE 0x00000000 112a2477924SCodrin Ciubotariu #define VSC9953_VLAN_CFG_POP_CNT_ONE 0x00040000 1139de05987SCodrin Ciubotariu #define VSC9953_VLAN_CFG_VID_MASK 0x00000fff 1149de05987SCodrin Ciubotariu 1159de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_vlan_cfg register */ 1169de05987SCodrin Ciubotariu #define VSC9953_PORT_VLAN_CFG_VID_MASK 0x00000fff 1179de05987SCodrin Ciubotariu 1189de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_tidx register */ 1199de05987SCodrin Ciubotariu #define VSC9953_ANA_TBL_VID_MASK 0x00000fff 1209de05987SCodrin Ciubotariu 1219de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.vlan_access register */ 1229de05987SCodrin Ciubotariu #define VSC9953_VLAN_PORT_MASK 0x00001ffc 1239de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_MASK 0x00000003 1249de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_IDLE 0x00000000 1259de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_READ 0x00000001 1269de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_WRITE 0x00000002 1279de05987SCodrin Ciubotariu #define VSC9953_VLAN_CMD_INIT 0x00000003 1289de05987SCodrin Ciubotariu 12968c929daSCodrin Ciubotariu /* Macros for vsc9953_ana_port.port_cfg register */ 13068c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_ENA 0x00000080 13168c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_AUTO 0x00000100 13268c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_CPU 0x00000200 13368c929daSCodrin Ciubotariu #define VSC9953_PORT_CFG_LEARN_DROP 0x00000400 13468c929daSCodrin Ciubotariu 1353cc8cfffSCodrin Ciubotariu /* Macros for vsc9953_qsys_sys.switch_port_mode register */ 136fe91095bSCodrin Ciubotariu #define VSC9953_PORT_ENA 0x00002000 1373cc8cfffSCodrin Ciubotariu 138*21d214fcSCodrin Ciubotariu /* Macros for vsc9953_ana_ana.agen_ctrl register */ 139*21d214fcSCodrin Ciubotariu #define VSC9953_FID_MASK_ALL 0x00fff000 140*21d214fcSCodrin Ciubotariu 1419de05987SCodrin Ciubotariu /* Macros for vsc9953_ana_ana.adv_learn register */ 1429de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHK 0x00000400 1439de05987SCodrin Ciubotariu 1449de05987SCodrin Ciubotariu /* Macros for vsc9953_rew_port.port_tag_cfg register */ 1459de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_MASK 0x00000180 1469de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_NONE 0x00000000 1479de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_PVID_ZERO 0x00000080 1489de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL_BUT_ZERO 0x00000100 1499de05987SCodrin Ciubotariu #define VSC9953_TAG_CFG_ALL 0x00000180 150a2477924SCodrin Ciubotariu #define VSC9953_TAG_VID_PVID 0x00000010 1519de05987SCodrin Ciubotariu 15222449858SCodrin Ciubotariu /* Macros for vsc9953_ana_ana.anag_efil register */ 15322449858SCodrin Ciubotariu #define VSC9953_AGE_PORT_EN 0x00080000 15422449858SCodrin Ciubotariu #define VSC9953_AGE_PORT_MASK 0x0007c000 15522449858SCodrin Ciubotariu #define VSC9953_AGE_VID_EN 0x00002000 15622449858SCodrin Ciubotariu #define VSC9953_AGE_VID_MASK 0x00001fff 15722449858SCodrin Ciubotariu 15822449858SCodrin Ciubotariu /* Macros for vsc9953_ana_ana_tables.mach_data register */ 15922449858SCodrin Ciubotariu #define VSC9953_MACHDATA_VID_MASK 0x1fff0000 16022449858SCodrin Ciubotariu 1616706b115SCodrin Ciubotariu #define VSC9953_MAX_PORTS 10 1626706b115SCodrin Ciubotariu #define VSC9953_PORT_CHECK(port) \ 1636706b115SCodrin Ciubotariu (((port) < 0 || (port) >= VSC9953_MAX_PORTS) ? 0 : 1) 1646706b115SCodrin Ciubotariu #define VSC9953_INTERNAL_PORT_CHECK(port) ( \ 1656706b115SCodrin Ciubotariu ( \ 1666706b115SCodrin Ciubotariu (port) < VSC9953_MAX_PORTS - 2 || (port) >= VSC9953_MAX_PORTS \ 1676706b115SCodrin Ciubotariu ) ? 0 : 1 \ 1686706b115SCodrin Ciubotariu ) 1699de05987SCodrin Ciubotariu #define VSC9953_MAX_VLAN 4096 1709de05987SCodrin Ciubotariu #define VSC9953_VLAN_CHECK(vid) \ 1719de05987SCodrin Ciubotariu (((vid) < 0 || (vid) >= VSC9953_MAX_VLAN) ? 0 : 1) 1726706b115SCodrin Ciubotariu 1736706b115SCodrin Ciubotariu #define DEFAULT_VSC9953_MDIO_NAME "VSC9953_MDIO0" 1746706b115SCodrin Ciubotariu 1756706b115SCodrin Ciubotariu #define MIIMIND_OPR_PEND 0x00000004 1766706b115SCodrin Ciubotariu 1776706b115SCodrin Ciubotariu struct vsc9953_mdio_info { 1786706b115SCodrin Ciubotariu struct vsc9953_mii_mng *regs; 1796706b115SCodrin Ciubotariu char *name; 1806706b115SCodrin Ciubotariu }; 1816706b115SCodrin Ciubotariu 1823cc8cfffSCodrin Ciubotariu /* VSC9953 ANA structure */ 1836706b115SCodrin Ciubotariu 1846706b115SCodrin Ciubotariu struct vsc9953_ana_port { 1856706b115SCodrin Ciubotariu u32 vlan_cfg; 1866706b115SCodrin Ciubotariu u32 drop_cfg; 1876706b115SCodrin Ciubotariu u32 qos_cfg; 1886706b115SCodrin Ciubotariu u32 vcap_cfg; 1896706b115SCodrin Ciubotariu u32 vcap_s1_key_cfg[3]; 1906706b115SCodrin Ciubotariu u32 vcap_s2_cfg; 1916706b115SCodrin Ciubotariu u32 qos_pcp_dei_map_cfg[16]; 1926706b115SCodrin Ciubotariu u32 cpu_fwd_cfg; 1936706b115SCodrin Ciubotariu u32 cpu_fwd_bpdu_cfg; 1946706b115SCodrin Ciubotariu u32 cpu_fwd_garp_cfg; 1956706b115SCodrin Ciubotariu u32 cpu_fwd_ccm_cfg; 1966706b115SCodrin Ciubotariu u32 port_cfg; 1976706b115SCodrin Ciubotariu u32 pol_cfg; 1986706b115SCodrin Ciubotariu u32 reserved[34]; 1996706b115SCodrin Ciubotariu }; 2006706b115SCodrin Ciubotariu 2016706b115SCodrin Ciubotariu struct vsc9953_ana_pol { 2026706b115SCodrin Ciubotariu u32 pol_pir_cfg; 2036706b115SCodrin Ciubotariu u32 pol_cir_cfg; 2046706b115SCodrin Ciubotariu u32 pol_mode_cfg; 2056706b115SCodrin Ciubotariu u32 pol_pir_state; 2066706b115SCodrin Ciubotariu u32 pol_cir_state; 2076706b115SCodrin Ciubotariu u32 reserved1[3]; 2086706b115SCodrin Ciubotariu }; 2096706b115SCodrin Ciubotariu 2106706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables { 2116706b115SCodrin Ciubotariu u32 entry_lim[11]; 2126706b115SCodrin Ciubotariu u32 an_moved; 2136706b115SCodrin Ciubotariu u32 mach_data; 2146706b115SCodrin Ciubotariu u32 macl_data; 2156706b115SCodrin Ciubotariu u32 mac_access; 2166706b115SCodrin Ciubotariu u32 mact_indx; 2176706b115SCodrin Ciubotariu u32 vlan_access; 2186706b115SCodrin Ciubotariu u32 vlan_tidx; 2196706b115SCodrin Ciubotariu }; 2206706b115SCodrin Ciubotariu 2216706b115SCodrin Ciubotariu struct vsc9953_ana_ana { 2226706b115SCodrin Ciubotariu u32 adv_learn; 2236706b115SCodrin Ciubotariu u32 vlan_mask; 224440873dfSCodrin Ciubotariu u32 reserved; 2256706b115SCodrin Ciubotariu u32 anag_efil; 2266706b115SCodrin Ciubotariu u32 an_events; 2276706b115SCodrin Ciubotariu u32 storm_limit_burst; 2286706b115SCodrin Ciubotariu u32 storm_limit_cfg[4]; 2296706b115SCodrin Ciubotariu u32 isolated_prts; 2306706b115SCodrin Ciubotariu u32 community_ports; 2316706b115SCodrin Ciubotariu u32 auto_age; 2326706b115SCodrin Ciubotariu u32 mac_options; 2336706b115SCodrin Ciubotariu u32 learn_disc; 2346706b115SCodrin Ciubotariu u32 agen_ctrl; 2356706b115SCodrin Ciubotariu u32 mirror_ports; 2366706b115SCodrin Ciubotariu u32 emirror_ports; 2376706b115SCodrin Ciubotariu u32 flooding; 2386706b115SCodrin Ciubotariu u32 flooding_ipmc; 2396706b115SCodrin Ciubotariu u32 sflow_cfg[11]; 2406706b115SCodrin Ciubotariu u32 port_mode[12]; 2416706b115SCodrin Ciubotariu }; 2426706b115SCodrin Ciubotariu 2436706b115SCodrin Ciubotariu struct vsc9953_ana_pgid { 2446706b115SCodrin Ciubotariu u32 port_grp_id[91]; 2456706b115SCodrin Ciubotariu }; 2466706b115SCodrin Ciubotariu 2476706b115SCodrin Ciubotariu struct vsc9953_ana_pfc { 2486706b115SCodrin Ciubotariu u32 pfc_cfg; 2496706b115SCodrin Ciubotariu u32 reserved1[15]; 2506706b115SCodrin Ciubotariu }; 2516706b115SCodrin Ciubotariu 2526706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc { 2536706b115SCodrin Ciubotariu u32 pol_flowc[10]; 2546706b115SCodrin Ciubotariu u32 reserved1[17]; 2556706b115SCodrin Ciubotariu u32 pol_hyst; 2566706b115SCodrin Ciubotariu }; 2576706b115SCodrin Ciubotariu 2586706b115SCodrin Ciubotariu struct vsc9953_ana_common { 2596706b115SCodrin Ciubotariu u32 aggr_cfg; 2606706b115SCodrin Ciubotariu u32 cpuq_cfg; 2616706b115SCodrin Ciubotariu u32 cpuq_8021_cfg; 2626706b115SCodrin Ciubotariu u32 dscp_cfg; 2636706b115SCodrin Ciubotariu u32 dscp_rewr_cfg; 2646706b115SCodrin Ciubotariu u32 vcap_rng_type_cfg; 2656706b115SCodrin Ciubotariu u32 vcap_rng_val_cfg; 2666706b115SCodrin Ciubotariu u32 discard_cfg; 2676706b115SCodrin Ciubotariu u32 fid_cfg; 2686706b115SCodrin Ciubotariu }; 2696706b115SCodrin Ciubotariu 2706706b115SCodrin Ciubotariu struct vsc9953_analyzer { 2716706b115SCodrin Ciubotariu struct vsc9953_ana_port port[11]; 2726706b115SCodrin Ciubotariu u32 reserved1[9536]; 2736706b115SCodrin Ciubotariu struct vsc9953_ana_pol pol[164]; 2746706b115SCodrin Ciubotariu struct vsc9953_ana_ana_tables ana_tables; 2756706b115SCodrin Ciubotariu u32 reserved2[14]; 2766706b115SCodrin Ciubotariu struct vsc9953_ana_ana ana; 2776706b115SCodrin Ciubotariu u32 reserved3[22]; 2786706b115SCodrin Ciubotariu struct vsc9953_ana_pgid port_id_tbl; 2796706b115SCodrin Ciubotariu u32 reserved4[549]; 2806706b115SCodrin Ciubotariu struct vsc9953_ana_pfc pfc[10]; 2816706b115SCodrin Ciubotariu struct vsc9953_ana_pol_misc pol_misc; 2826706b115SCodrin Ciubotariu u32 reserved5[196]; 2836706b115SCodrin Ciubotariu struct vsc9953_ana_common common; 2846706b115SCodrin Ciubotariu }; 2853cc8cfffSCodrin Ciubotariu /* END VSC9953 ANA structure t*/ 2866706b115SCodrin Ciubotariu 2873cc8cfffSCodrin Ciubotariu /* VSC9953 DEV_GMII structure */ 2886706b115SCodrin Ciubotariu 2896706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode { 2906706b115SCodrin Ciubotariu u32 clock_cfg; 2916706b115SCodrin Ciubotariu u32 port_misc; 2926706b115SCodrin Ciubotariu u32 reserved1; 2936706b115SCodrin Ciubotariu u32 eee_cfg; 2946706b115SCodrin Ciubotariu }; 2956706b115SCodrin Ciubotariu 2966706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status { 2976706b115SCodrin Ciubotariu u32 mac_ena_cfg; 2986706b115SCodrin Ciubotariu u32 mac_mode_cfg; 2996706b115SCodrin Ciubotariu u32 mac_maxlen_cfg; 3006706b115SCodrin Ciubotariu u32 mac_tags_cfg; 3016706b115SCodrin Ciubotariu u32 mac_adv_chk_cfg; 3026706b115SCodrin Ciubotariu u32 mac_ifg_cfg; 3036706b115SCodrin Ciubotariu u32 mac_hdx_cfg; 3046706b115SCodrin Ciubotariu u32 mac_fc_mac_low_cfg; 3056706b115SCodrin Ciubotariu u32 mac_fc_mac_high_cfg; 3066706b115SCodrin Ciubotariu u32 mac_sticky; 3076706b115SCodrin Ciubotariu }; 3086706b115SCodrin Ciubotariu 3096706b115SCodrin Ciubotariu struct vsc9953_dev_gmii { 3106706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_port_mode port_mode; 3116706b115SCodrin Ciubotariu struct vsc9953_dev_gmii_mac_cfg_status mac_cfg_status; 3126706b115SCodrin Ciubotariu }; 3136706b115SCodrin Ciubotariu 3143cc8cfffSCodrin Ciubotariu /* END VSC9953 DEV_GMII structure */ 3156706b115SCodrin Ciubotariu 3163cc8cfffSCodrin Ciubotariu /* VSC9953 QSYS structure */ 3176706b115SCodrin Ciubotariu 3186706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch { 3196706b115SCodrin Ciubotariu u32 cir_cfg; 3206706b115SCodrin Ciubotariu u32 reserved1; 3216706b115SCodrin Ciubotariu u32 se_cfg; 3226706b115SCodrin Ciubotariu u32 se_dwrr_cfg[8]; 3236706b115SCodrin Ciubotariu u32 cir_state; 3246706b115SCodrin Ciubotariu u32 reserved2[20]; 3256706b115SCodrin Ciubotariu }; 3266706b115SCodrin Ciubotariu 3276706b115SCodrin Ciubotariu struct vsc9953_qsys_sys { 3286706b115SCodrin Ciubotariu u32 port_mode[12]; 3296706b115SCodrin Ciubotariu u32 switch_port_mode[11]; 3306706b115SCodrin Ciubotariu u32 stat_cnt_cfg; 3316706b115SCodrin Ciubotariu u32 eee_cfg[10]; 3326706b115SCodrin Ciubotariu u32 eee_thrs; 3336706b115SCodrin Ciubotariu u32 igr_no_sharing; 3346706b115SCodrin Ciubotariu u32 egr_no_sharing; 3356706b115SCodrin Ciubotariu u32 sw_status[11]; 3366706b115SCodrin Ciubotariu u32 ext_cpu_cfg; 3376706b115SCodrin Ciubotariu u32 cpu_group_map; 3386706b115SCodrin Ciubotariu u32 reserved1[23]; 3396706b115SCodrin Ciubotariu }; 3406706b115SCodrin Ciubotariu 3416706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg { 3426706b115SCodrin Ciubotariu u32 red_profile[16]; 3436706b115SCodrin Ciubotariu u32 res_qos_mode; 3446706b115SCodrin Ciubotariu }; 3456706b115SCodrin Ciubotariu 3466706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg { 3476706b115SCodrin Ciubotariu u32 egr_drop_mode; 3486706b115SCodrin Ciubotariu }; 3496706b115SCodrin Ciubotariu 3506706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt { 3516706b115SCodrin Ciubotariu u32 eq_cntrl; 3526706b115SCodrin Ciubotariu u32 reserved1; 3536706b115SCodrin Ciubotariu }; 3546706b115SCodrin Ciubotariu 3556706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc { 3566706b115SCodrin Ciubotariu u32 hsch_misc_cfg; 3576706b115SCodrin Ciubotariu u32 reserved1[546]; 3586706b115SCodrin Ciubotariu }; 3596706b115SCodrin Ciubotariu 3606706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl { 3616706b115SCodrin Ciubotariu u32 res_cfg; 3626706b115SCodrin Ciubotariu u32 res_stat; 3636706b115SCodrin Ciubotariu 3646706b115SCodrin Ciubotariu }; 3656706b115SCodrin Ciubotariu 3666706b115SCodrin Ciubotariu struct vsc9953_qsys_reg { 3676706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch hsch[108]; 3686706b115SCodrin Ciubotariu struct vsc9953_qsys_sys sys; 3696706b115SCodrin Ciubotariu struct vsc9953_qsys_qos_cfg qos_cfg; 3706706b115SCodrin Ciubotariu struct vsc9953_qsys_drop_cfg drop_cfg; 3716706b115SCodrin Ciubotariu struct vsc9953_qsys_mmgt mmgt; 3726706b115SCodrin Ciubotariu struct vsc9953_qsys_hsch_misc hsch_misc; 3736706b115SCodrin Ciubotariu struct vsc9953_qsys_res_ctrl res_ctrl[1024]; 3746706b115SCodrin Ciubotariu }; 3756706b115SCodrin Ciubotariu 3763cc8cfffSCodrin Ciubotariu /* END VSC9953 QSYS structure */ 3776706b115SCodrin Ciubotariu 3783cc8cfffSCodrin Ciubotariu /* VSC9953 SYS structure */ 3796706b115SCodrin Ciubotariu 38086719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs { 38186719f0cSCodrin Ciubotariu u32 c_rx_oct; 38286719f0cSCodrin Ciubotariu u32 c_rx_uc; 38386719f0cSCodrin Ciubotariu u32 c_rx_mc; 38486719f0cSCodrin Ciubotariu u32 c_rx_bc; 38586719f0cSCodrin Ciubotariu u32 c_rx_short; 38686719f0cSCodrin Ciubotariu u32 c_rx_frag; 38786719f0cSCodrin Ciubotariu u32 c_rx_jabber; 38886719f0cSCodrin Ciubotariu u32 c_rx_crc; 38986719f0cSCodrin Ciubotariu u32 c_rx_symbol_err; 39086719f0cSCodrin Ciubotariu u32 c_rx_sz_64; 39186719f0cSCodrin Ciubotariu u32 c_rx_sz_65_127; 39286719f0cSCodrin Ciubotariu u32 c_rx_sz_128_255; 39386719f0cSCodrin Ciubotariu u32 c_rx_sz_256_511; 39486719f0cSCodrin Ciubotariu u32 c_rx_sz_512_1023; 39586719f0cSCodrin Ciubotariu u32 c_rx_sz_1024_1526; 39686719f0cSCodrin Ciubotariu u32 c_rx_sz_jumbo; 39786719f0cSCodrin Ciubotariu u32 c_rx_pause; 39886719f0cSCodrin Ciubotariu u32 c_rx_control; 39986719f0cSCodrin Ciubotariu u32 c_rx_long; 40086719f0cSCodrin Ciubotariu u32 c_rx_cat_drop; 40186719f0cSCodrin Ciubotariu u32 c_rx_red_prio_0; 40286719f0cSCodrin Ciubotariu u32 c_rx_red_prio_1; 40386719f0cSCodrin Ciubotariu u32 c_rx_red_prio_2; 40486719f0cSCodrin Ciubotariu u32 c_rx_red_prio_3; 40586719f0cSCodrin Ciubotariu u32 c_rx_red_prio_4; 40686719f0cSCodrin Ciubotariu u32 c_rx_red_prio_5; 40786719f0cSCodrin Ciubotariu u32 c_rx_red_prio_6; 40886719f0cSCodrin Ciubotariu u32 c_rx_red_prio_7; 40986719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_0; 41086719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_1; 41186719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_2; 41286719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_3; 41386719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_4; 41486719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_5; 41586719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_6; 41686719f0cSCodrin Ciubotariu u32 c_rx_yellow_prio_7; 41786719f0cSCodrin Ciubotariu u32 c_rx_green_prio_0; 41886719f0cSCodrin Ciubotariu u32 c_rx_green_prio_1; 41986719f0cSCodrin Ciubotariu u32 c_rx_green_prio_2; 42086719f0cSCodrin Ciubotariu u32 c_rx_green_prio_3; 42186719f0cSCodrin Ciubotariu u32 c_rx_green_prio_4; 42286719f0cSCodrin Ciubotariu u32 c_rx_green_prio_5; 42386719f0cSCodrin Ciubotariu u32 c_rx_green_prio_6; 42486719f0cSCodrin Ciubotariu u32 c_rx_green_prio_7; 42586719f0cSCodrin Ciubotariu u32 reserved[20]; 42686719f0cSCodrin Ciubotariu }; 42786719f0cSCodrin Ciubotariu 42886719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs { 42986719f0cSCodrin Ciubotariu u32 c_tx_oct; 43086719f0cSCodrin Ciubotariu u32 c_tx_uc; 43186719f0cSCodrin Ciubotariu u32 c_tx_mc; 43286719f0cSCodrin Ciubotariu u32 c_tx_bc; 43386719f0cSCodrin Ciubotariu u32 c_tx_col; 43486719f0cSCodrin Ciubotariu u32 c_tx_drop; 43586719f0cSCodrin Ciubotariu u32 c_tx_pause; 43686719f0cSCodrin Ciubotariu u32 c_tx_sz_64; 43786719f0cSCodrin Ciubotariu u32 c_tx_sz_65_127; 43886719f0cSCodrin Ciubotariu u32 c_tx_sz_128_255; 43986719f0cSCodrin Ciubotariu u32 c_tx_sz_256_511; 44086719f0cSCodrin Ciubotariu u32 c_tx_sz_512_1023; 44186719f0cSCodrin Ciubotariu u32 c_tx_sz_1024_1526; 44286719f0cSCodrin Ciubotariu u32 c_tx_sz_jumbo; 44386719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_0; 44486719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_1; 44586719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_2; 44686719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_3; 44786719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_4; 44886719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_5; 44986719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_6; 45086719f0cSCodrin Ciubotariu u32 c_tx_yellow_prio_7; 45186719f0cSCodrin Ciubotariu u32 c_tx_green_prio_0; 45286719f0cSCodrin Ciubotariu u32 c_tx_green_prio_1; 45386719f0cSCodrin Ciubotariu u32 c_tx_green_prio_2; 45486719f0cSCodrin Ciubotariu u32 c_tx_green_prio_3; 45586719f0cSCodrin Ciubotariu u32 c_tx_green_prio_4; 45686719f0cSCodrin Ciubotariu u32 c_tx_green_prio_5; 45786719f0cSCodrin Ciubotariu u32 c_tx_green_prio_6; 45886719f0cSCodrin Ciubotariu u32 c_tx_green_prio_7; 45986719f0cSCodrin Ciubotariu u32 c_tx_aged; 46086719f0cSCodrin Ciubotariu u32 reserved[33]; 46186719f0cSCodrin Ciubotariu }; 46286719f0cSCodrin Ciubotariu 46386719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs { 46486719f0cSCodrin Ciubotariu u32 c_dr_local; 46586719f0cSCodrin Ciubotariu u32 c_dr_tail; 46686719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_0; 46786719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_1; 46886719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_2; 46986719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_3; 47086719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_4; 47186719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_5; 47286719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_6; 47386719f0cSCodrin Ciubotariu u32 c_dr_yellow_prio_7; 47486719f0cSCodrin Ciubotariu u32 c_dr_green_prio_0; 47586719f0cSCodrin Ciubotariu u32 c_dr_green_prio_1; 47686719f0cSCodrin Ciubotariu u32 c_dr_green_prio_2; 47786719f0cSCodrin Ciubotariu u32 c_dr_green_prio_3; 47886719f0cSCodrin Ciubotariu u32 c_dr_green_prio_4; 47986719f0cSCodrin Ciubotariu u32 c_dr_green_prio_5; 48086719f0cSCodrin Ciubotariu u32 c_dr_green_prio_6; 48186719f0cSCodrin Ciubotariu u32 c_dr_green_prio_7; 48286719f0cSCodrin Ciubotariu u32 reserved[46]; 48386719f0cSCodrin Ciubotariu }; 48486719f0cSCodrin Ciubotariu 4856706b115SCodrin Ciubotariu struct vsc9953_sys_stat { 48686719f0cSCodrin Ciubotariu struct vsc9953_rx_cntrs rx_cntrs; 48786719f0cSCodrin Ciubotariu struct vsc9953_tx_cntrs tx_cntrs; 48886719f0cSCodrin Ciubotariu struct vsc9953_drop_cntrs drop_cntrs; 4896706b115SCodrin Ciubotariu u32 reserved1[6]; 4906706b115SCodrin Ciubotariu }; 4916706b115SCodrin Ciubotariu 4926706b115SCodrin Ciubotariu struct vsc9953_sys_sys { 4936706b115SCodrin Ciubotariu u32 reset_cfg; 4946706b115SCodrin Ciubotariu u32 reserved1; 4956706b115SCodrin Ciubotariu u32 vlan_etype_cfg; 4966706b115SCodrin Ciubotariu u32 port_mode[12]; 4976706b115SCodrin Ciubotariu u32 front_port_mode[10]; 4986706b115SCodrin Ciubotariu u32 frame_aging; 4996706b115SCodrin Ciubotariu u32 stat_cfg; 5006706b115SCodrin Ciubotariu u32 reserved2[50]; 5016706b115SCodrin Ciubotariu }; 5026706b115SCodrin Ciubotariu 5036706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg { 5046706b115SCodrin Ciubotariu u32 pause_cfg[11]; 5056706b115SCodrin Ciubotariu u32 pause_tot_cfg; 5066706b115SCodrin Ciubotariu u32 tail_drop_level[11]; 5076706b115SCodrin Ciubotariu u32 tot_tail_drop_lvl; 5086706b115SCodrin Ciubotariu u32 mac_fc_cfg[10]; 5096706b115SCodrin Ciubotariu }; 5106706b115SCodrin Ciubotariu 5116706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt { 5126706b115SCodrin Ciubotariu u16 free_cnt; 5136706b115SCodrin Ciubotariu }; 5146706b115SCodrin Ciubotariu 5156706b115SCodrin Ciubotariu struct vsc9953_system_reg { 5166706b115SCodrin Ciubotariu struct vsc9953_sys_stat stat; 5176706b115SCodrin Ciubotariu struct vsc9953_sys_sys sys; 5186706b115SCodrin Ciubotariu struct vsc9953_sys_pause_cfg pause_cfg; 5196706b115SCodrin Ciubotariu struct vsc9953_sys_mmgt mmgt; 5206706b115SCodrin Ciubotariu }; 5216706b115SCodrin Ciubotariu 5223cc8cfffSCodrin Ciubotariu /* END VSC9953 SYS structure */ 5236706b115SCodrin Ciubotariu 5249de05987SCodrin Ciubotariu /* VSC9953 REW structure */ 5259de05987SCodrin Ciubotariu 5269de05987SCodrin Ciubotariu struct vsc9953_rew_port { 5279de05987SCodrin Ciubotariu u32 port_vlan_cfg; 5289de05987SCodrin Ciubotariu u32 port_tag_cfg; 5299de05987SCodrin Ciubotariu u32 port_port_cfg; 5309de05987SCodrin Ciubotariu u32 port_dscp_cfg; 5319de05987SCodrin Ciubotariu u32 port_pcp_dei_qos_map_cfg[16]; 5329de05987SCodrin Ciubotariu u32 reserved[12]; 5339de05987SCodrin Ciubotariu }; 5349de05987SCodrin Ciubotariu 5359de05987SCodrin Ciubotariu struct vsc9953_rew_common { 5369de05987SCodrin Ciubotariu u32 reserve[4]; 5379de05987SCodrin Ciubotariu u32 dscp_remap_dp1_cfg[64]; 5389de05987SCodrin Ciubotariu u32 dscp_remap_cfg[64]; 5399de05987SCodrin Ciubotariu }; 5409de05987SCodrin Ciubotariu 5419de05987SCodrin Ciubotariu struct vsc9953_rew_reg { 5429de05987SCodrin Ciubotariu struct vsc9953_rew_port port[12]; 5439de05987SCodrin Ciubotariu struct vsc9953_rew_common common; 5449de05987SCodrin Ciubotariu }; 5459de05987SCodrin Ciubotariu 5469de05987SCodrin Ciubotariu /* END VSC9953 REW structure */ 5476706b115SCodrin Ciubotariu 5483cc8cfffSCodrin Ciubotariu /* VSC9953 DEVCPU_GCB structure */ 5496706b115SCodrin Ciubotariu 5506706b115SCodrin Ciubotariu struct vsc9953_chip_regs { 5516706b115SCodrin Ciubotariu u32 chipd_id; 5526706b115SCodrin Ciubotariu u32 gpr; 5536706b115SCodrin Ciubotariu u32 soft_rst; 5546706b115SCodrin Ciubotariu }; 5556706b115SCodrin Ciubotariu 5566706b115SCodrin Ciubotariu struct vsc9953_gpio { 5576706b115SCodrin Ciubotariu u32 gpio_out_set[10]; 5586706b115SCodrin Ciubotariu u32 gpio_out_clr[10]; 5596706b115SCodrin Ciubotariu u32 gpio_out[10]; 5606706b115SCodrin Ciubotariu u32 gpio_in[10]; 5616706b115SCodrin Ciubotariu }; 5626706b115SCodrin Ciubotariu 5636706b115SCodrin Ciubotariu struct vsc9953_mii_mng { 5646706b115SCodrin Ciubotariu u32 miimstatus; 5656706b115SCodrin Ciubotariu u32 reserved1; 5666706b115SCodrin Ciubotariu u32 miimcmd; 5676706b115SCodrin Ciubotariu u32 miimdata; 5686706b115SCodrin Ciubotariu u32 miimcfg; 5696706b115SCodrin Ciubotariu u32 miimscan_0; 5706706b115SCodrin Ciubotariu u32 miimscan_1; 5716706b115SCodrin Ciubotariu u32 miiscan_lst_rslts; 5726706b115SCodrin Ciubotariu u32 miiscan_lst_rslts_valid; 5736706b115SCodrin Ciubotariu }; 5746706b115SCodrin Ciubotariu 5756706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan { 5766706b115SCodrin Ciubotariu u32 mii_scan_results_sticky[2]; 5776706b115SCodrin Ciubotariu }; 5786706b115SCodrin Ciubotariu 5796706b115SCodrin Ciubotariu struct vsc9953_devcpu_gcb { 5806706b115SCodrin Ciubotariu struct vsc9953_chip_regs chip_regs; 5816706b115SCodrin Ciubotariu struct vsc9953_gpio gpio; 5826706b115SCodrin Ciubotariu struct vsc9953_mii_mng mii_mng[2]; 5836706b115SCodrin Ciubotariu struct vsc9953_mii_read_scan mii_read_scan; 5846706b115SCodrin Ciubotariu }; 5856706b115SCodrin Ciubotariu 5863cc8cfffSCodrin Ciubotariu /* END VSC9953 DEVCPU_GCB structure */ 5876706b115SCodrin Ciubotariu 5883cc8cfffSCodrin Ciubotariu /* VSC9953 IS* structure */ 5896706b115SCodrin Ciubotariu 5906706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg { 5916706b115SCodrin Ciubotariu u32 vcap_update_ctrl; 5926706b115SCodrin Ciubotariu u32 vcap_mv_cfg; 5936706b115SCodrin Ciubotariu }; 5946706b115SCodrin Ciubotariu 5956706b115SCodrin Ciubotariu struct vsc9953_vcap { 5966706b115SCodrin Ciubotariu struct vsc9953_vcap_core_cfg vcap_core_cfg; 5976706b115SCodrin Ciubotariu }; 5986706b115SCodrin Ciubotariu 5993cc8cfffSCodrin Ciubotariu /* END VSC9953 IS* structure */ 6006706b115SCodrin Ciubotariu 6016706b115SCodrin Ciubotariu #define VSC9953_PORT_INFO_INITIALIZER(idx) \ 6026706b115SCodrin Ciubotariu { \ 6036706b115SCodrin Ciubotariu .enabled = 0, \ 6046706b115SCodrin Ciubotariu .phyaddr = 0, \ 6056706b115SCodrin Ciubotariu .index = idx, \ 6066706b115SCodrin Ciubotariu .phy_regs = NULL, \ 6076706b115SCodrin Ciubotariu .enet_if = PHY_INTERFACE_MODE_NONE, \ 6086706b115SCodrin Ciubotariu .bus = NULL, \ 6096706b115SCodrin Ciubotariu .phydev = NULL, \ 6106706b115SCodrin Ciubotariu } 6116706b115SCodrin Ciubotariu 6126706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 port */ 6136706b115SCodrin Ciubotariu struct vsc9953_port_info { 6146706b115SCodrin Ciubotariu u8 enabled; 6156706b115SCodrin Ciubotariu u8 phyaddr; 6166706b115SCodrin Ciubotariu int index; 6176706b115SCodrin Ciubotariu void *phy_regs; 6186706b115SCodrin Ciubotariu phy_interface_t enet_if; 6196706b115SCodrin Ciubotariu struct mii_dev *bus; 6206706b115SCodrin Ciubotariu struct phy_device *phydev; 6216706b115SCodrin Ciubotariu }; 6226706b115SCodrin Ciubotariu 6236706b115SCodrin Ciubotariu /* Structure to describe a VSC9953 switch */ 6246706b115SCodrin Ciubotariu struct vsc9953_info { 6256706b115SCodrin Ciubotariu struct vsc9953_port_info port[VSC9953_MAX_PORTS]; 6266706b115SCodrin Ciubotariu }; 6276706b115SCodrin Ciubotariu 6286706b115SCodrin Ciubotariu void vsc9953_init(bd_t *bis); 6296706b115SCodrin Ciubotariu 6303cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_mdio(int port_no, struct mii_dev *bus); 6313cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_address(int port_no, int address); 6323cc8cfffSCodrin Ciubotariu void vsc9953_port_enable(int port_no); 6333cc8cfffSCodrin Ciubotariu void vsc9953_port_disable(int port_no); 6343cc8cfffSCodrin Ciubotariu void vsc9953_port_info_set_phy_int(int port_no, phy_interface_t phy_int); 6356706b115SCodrin Ciubotariu 6366706b115SCodrin Ciubotariu #endif /* _VSC9953_H_ */ 637