4 * Driver for the Vitesse VSC9953 L2 Switch
6 * This software may be used and distributed according to the
7 * terms of the GNU Public License, Version 2, incorporated
10 * Copyright 2013 Freescale Semiconductor, Inc.
19 #include <asm/types.h>
22 #define VSC9953_OFFSET (CONFIG_SYS_CCSRBAR_DEFAULT + 0x800000)
24 #define VSC9953_SYS_OFFSET 0x010000
25 #define VSC9953_DEV_GMII_OFFSET 0x100000
26 #define VSC9953_QSYS_OFFSET 0x200000
27 #define VSC9953_ANA_OFFSET 0x280000
28 #define VSC9953_DEVCPU_GCB 0x070000
29 #define VSC9953_ES0 0x040000
30 #define VSC9953_IS1 0x050000
31 #define VSC9953_IS2 0x060000
33 #define T1040_SWITCH_GMII_DEV_OFFSET 0x010000
34 #define VSC9953_PHY_REGS_OFFST 0x0000AC
36 #define CONFIG_VSC9953_SOFT_SWC_RST_ENA 0x00000001
37 #define CONFIG_VSC9953_CORE_ENABLE 0x80
38 #define CONFIG_VSC9953_MEM_ENABLE 0x40
39 #define CONFIG_VSC9953_MEM_INIT 0x20
41 #define CONFIG_VSC9953_PORT_ENA 0x00003a00
42 #define CONFIG_VSC9953_MAC_ENA_CFG 0x00000011
43 #define CONFIG_VSC9953_MAC_MODE_CFG 0x00000011
44 #define CONFIG_VSC9953_MAC_IFG_CFG 0x00000515
45 #define CONFIG_VSC9953_MAC_HDX_CFG 0x00001043
46 #define CONFIG_VSC9953_CLOCK_CFG 0x00000001
47 #define CONFIG_VSC9953_CLOCK_CFG_1000M 0x00000001
48 #define CONFIG_VSC9953_PFC_FC 0x00000001
49 #define CONFIG_VSC9953_PFC_FC_QSGMII 0x00000000
50 #define CONFIG_VSC9953_MAC_FC_CFG 0x04700000
51 #define CONFIG_VSC9953_MAC_FC_CFG_QSGMII 0x00700000
52 #define CONFIG_VSC9953_PAUSE_CFG 0x001ffffe
53 #define CONFIG_VSC9953_TOT_TAIL_DROP_LVL 0x000003ff
54 #define CONFIG_VSC9953_FRONT_PORT_MODE 0x00000000
55 #define CONFIG_VSC9953_MAC_MAX_LEN 0x000005ee
57 #define CONFIG_VSC9953_VCAP_MV_CFG 0x0000ffff
58 #define CONFIG_VSC9953_VCAP_UPDATE_CTRL 0x01000004
59 #define VSC9953_MAX_PORTS 10
60 #define VSC9953_PORT_CHECK(port) \
61 (((port) < 0 || (port) >= VSC9953_MAX_PORTS) ? 0 : 1)
62 #define VSC9953_INTERNAL_PORT_CHECK(port) ( \
64 (port) < VSC9953_MAX_PORTS - 2 || (port) >= VSC9953_MAX_PORTS \
68 #define DEFAULT_VSC9953_MDIO_NAME "VSC9953_MDIO0"
70 #define MIIMIND_OPR_PEND 0x00000004
72 struct vsc9953_mdio_info {
73 struct vsc9953_mii_mng *regs;
77 /* VSC9953 ANA structure for T1040 U-boot*/
79 struct vsc9953_ana_port {
84 u32 vcap_s1_key_cfg[3];
86 u32 qos_pcp_dei_map_cfg[16];
96 struct vsc9953_ana_pol {
105 struct vsc9953_ana_ana_tables {
116 struct vsc9953_ana_ana {
121 u32 storm_limit_burst;
122 u32 storm_limit_cfg[4];
137 struct vsc9953_ana_pgid {
141 struct vsc9953_ana_pfc {
146 struct vsc9953_ana_pol_misc {
152 struct vsc9953_ana_common {
158 u32 vcap_rng_type_cfg;
159 u32 vcap_rng_val_cfg;
164 struct vsc9953_analyzer {
165 struct vsc9953_ana_port port[11];
167 struct vsc9953_ana_pol pol[164];
168 struct vsc9953_ana_ana_tables ana_tables;
170 struct vsc9953_ana_ana ana;
172 struct vsc9953_ana_pgid port_id_tbl;
174 struct vsc9953_ana_pfc pfc[10];
175 struct vsc9953_ana_pol_misc pol_misc;
177 struct vsc9953_ana_common common;
179 /* END VSC9953 ANA structure for T1040 U-boot*/
181 /* VSC9953 DEV_GMII structure for T1040 U-boot*/
183 struct vsc9953_dev_gmii_port_mode {
190 struct vsc9953_dev_gmii_mac_cfg_status {
198 u32 mac_fc_mac_low_cfg;
199 u32 mac_fc_mac_high_cfg;
203 struct vsc9953_dev_gmii {
204 struct vsc9953_dev_gmii_port_mode port_mode;
205 struct vsc9953_dev_gmii_mac_cfg_status mac_cfg_status;
208 /* END VSC9953 DEV_GMII structure for T1040 U-boot*/
210 /* VSC9953 QSYS structure for T1040 U-boot*/
212 struct vsc9953_qsys_hsch {
221 struct vsc9953_qsys_sys {
223 u32 switch_port_mode[11];
235 struct vsc9953_qsys_qos_cfg {
240 struct vsc9953_qsys_drop_cfg {
244 struct vsc9953_qsys_mmgt {
249 struct vsc9953_qsys_hsch_misc {
254 struct vsc9953_qsys_res_ctrl {
260 struct vsc9953_qsys_reg {
261 struct vsc9953_qsys_hsch hsch[108];
262 struct vsc9953_qsys_sys sys;
263 struct vsc9953_qsys_qos_cfg qos_cfg;
264 struct vsc9953_qsys_drop_cfg drop_cfg;
265 struct vsc9953_qsys_mmgt mmgt;
266 struct vsc9953_qsys_hsch_misc hsch_misc;
267 struct vsc9953_qsys_res_ctrl res_ctrl[1024];
270 /* END VSC9953 QSYS structure for T1040 U-boot*/
272 /* VSC9953 SYS structure for T1040 U-boot*/
274 struct vsc9953_sys_stat {
281 struct vsc9953_sys_sys {
286 u32 front_port_mode[10];
292 struct vsc9953_sys_pause_cfg {
295 u32 tail_drop_level[11];
296 u32 tot_tail_drop_lvl;
300 struct vsc9953_sys_mmgt {
304 struct vsc9953_system_reg {
305 struct vsc9953_sys_stat stat;
306 struct vsc9953_sys_sys sys;
307 struct vsc9953_sys_pause_cfg pause_cfg;
308 struct vsc9953_sys_mmgt mmgt;
311 /* END VSC9953 SYS structure for T1040 U-boot*/
314 /* VSC9953 DEVCPU_GCB structure for T1040 U-boot*/
316 struct vsc9953_chip_regs {
322 struct vsc9953_gpio {
323 u32 gpio_out_set[10];
324 u32 gpio_out_clr[10];
329 struct vsc9953_mii_mng {
337 u32 miiscan_lst_rslts;
338 u32 miiscan_lst_rslts_valid;
341 struct vsc9953_mii_read_scan {
342 u32 mii_scan_results_sticky[2];
345 struct vsc9953_devcpu_gcb {
346 struct vsc9953_chip_regs chip_regs;
347 struct vsc9953_gpio gpio;
348 struct vsc9953_mii_mng mii_mng[2];
349 struct vsc9953_mii_read_scan mii_read_scan;
352 /* END VSC9953 DEVCPU_GCB structure for T1040 U-boot*/
354 /* VSC9953 IS* structure for T1040 U-boot*/
356 struct vsc9953_vcap_core_cfg {
357 u32 vcap_update_ctrl;
361 struct vsc9953_vcap {
362 struct vsc9953_vcap_core_cfg vcap_core_cfg;
365 /* END VSC9953 IS* structure for T1040 U-boot*/
367 #define VSC9953_PORT_INFO_INITIALIZER(idx) \
373 .enet_if = PHY_INTERFACE_MODE_NONE, \
378 /* Structure to describe a VSC9953 port */
379 struct vsc9953_port_info {
384 phy_interface_t enet_if;
386 struct phy_device *phydev;
389 /* Structure to describe a VSC9953 switch */
390 struct vsc9953_info {
391 struct vsc9953_port_info port[VSC9953_MAX_PORTS];
394 void vsc9953_init(bd_t *bis);
396 void vsc9953_port_info_set_mdio(int port, struct mii_dev *bus);
397 void vsc9953_port_info_set_phy_address(int port, int address);
398 void vsc9953_port_enable(int port);
399 void vsc9953_port_disable(int port);
400 void vsc9953_port_info_set_phy_int(int port, phy_interface_t phy_int);
402 #endif /* _VSC9953_H_ */