13 #include <linux/stat.h>
20 #define LOCAL_RTE_CONF_DESTID_SEL 0x010070
21 #define LOCAL_RTE_CONF_DESTID_SEL_PSEL 0x0000001f
23 #define IDT_LT_ERR_REPORT_EN 0x03100c
25 #define IDT_PORT_ERR_REPORT_EN(n) (0x031044 + (n)*0x40)
26 #define IDT_PORT_ERR_REPORT_EN_BC 0x03ff04
28 #define IDT_PORT_ISERR_REPORT_EN(n) (0x03104C + (n)*0x40)
29 #define IDT_PORT_ISERR_REPORT_EN_BC 0x03ff0c
30 #define IDT_PORT_INIT_TX_ACQUIRED 0x00000020
32 #define IDT_LANE_ERR_REPORT_EN(n) (0x038010 + (n)*0x100)
33 #define IDT_LANE_ERR_REPORT_EN_BC 0x03ff10
35 #define IDT_DEV_CTRL_1 0xf2000c
36 #define IDT_DEV_CTRL_1_GENPW 0x02000000
37 #define IDT_DEV_CTRL_1_PRSTBEH 0x00000001
39 #define IDT_CFGBLK_ERR_CAPTURE_EN 0x020008
40 #define IDT_CFGBLK_ERR_REPORT 0xf20014
41 #define IDT_CFGBLK_ERR_REPORT_GENPW 0x00000002
43 #define IDT_AUX_PORT_ERR_CAP_EN 0x020000
44 #define IDT_AUX_ERR_REPORT_EN 0xf20018
45 #define IDT_AUX_PORT_ERR_LOG_I2C 0x00000002
46 #define IDT_AUX_PORT_ERR_LOG_JTAG 0x00000001
48 #define IDT_ISLTL_ADDRESS_CAP 0x021014
50 #define IDT_RIO_DOMAIN 0xf20020
51 #define IDT_RIO_DOMAIN_MASK 0x000000ff
53 #define IDT_PW_INFO_CSR 0xf20024
55 #define IDT_SOFT_RESET 0xf20040
56 #define IDT_SOFT_RESET_REQ 0x00030097
58 #define IDT_I2C_MCTRL 0xf20050
59 #define IDT_I2C_MCTRL_GENPW 0x04000000
61 #define IDT_JTAG_CTRL 0xf2005c
62 #define IDT_JTAG_CTRL_GENPW 0x00000002
64 #define IDT_LANE_CTRL(n) (0xff8000 + (n)*0x100)
65 #define IDT_LANE_CTRL_BC 0xffff00
66 #define IDT_LANE_CTRL_GENPW 0x00200000
67 #define IDT_LANE_DFE_1_BC 0xffff18
68 #define IDT_LANE_DFE_2_BC 0xffff1c
70 #define IDT_PORT_OPS(n) (0xf40004 + (n)*0x100)
71 #define IDT_PORT_OPS_GENPW 0x08000000
72 #define IDT_PORT_OPS_PL_ELOG 0x00000040
73 #define IDT_PORT_OPS_LL_ELOG 0x00000020
74 #define IDT_PORT_OPS_LT_ELOG 0x00000010
75 #define IDT_PORT_OPS_BC 0xf4ff04
77 #define IDT_PORT_ISERR_DET(n) (0xf40008 + (n)*0x100)
79 #define IDT_ERR_CAP 0xfd0000
80 #define IDT_ERR_CAP_LOG_OVERWR 0x00000004
82 #define IDT_ERR_RD 0xfd0004
84 #define IDT_DEFAULT_ROUTE 0xde
85 #define IDT_NO_ROUTE 0xdf
147 *route_port = (
u8)result;
153 idtg2_route_clr_table(
struct rio_mport *mport,
u16 destid,
u8 hopcount,
185 idtg2_set_domain(
struct rio_mport *mport,
u16 destid,
u8 hopcount,
197 idtg2_get_domain(
struct rio_mport *mport,
u16 destid,
u8 hopcount,
208 *sw_domain = (
u8)(regval & 0xff);
258 for (i = 0; i <
tmp; i++) {
260 rio_write_config_32(rdev,
280 for (i = 0; i <
tmp; i++) {
316 rio_write_config_32(rdev,
323 idtg2_em_handler(
struct rio_dev *rdev,
u8 portnum)
327 rio_read_config_32(rdev,
333 rio_read_config_32(rdev,
336 pr_debug(
"RIO: %s Implementation Specific LTL errors" \
338 rio_name(rdev), em_ltlerrdet, regval);
346 rio_read_config_32(rdev,
354 rio_read_config_32(rdev,
357 pr_debug(
"RIO: %s Implementation Specific Port" \
358 " errors 0x%x\n", rio_name(rdev), regval);
361 rio_write_config_32(rdev,
376 while (!rio_read_config_32(rdev,
IDT_ERR_RD, ®val)) {
399 dev_err(dev,
"Unable create sysfs errlog file\n");
406 static int idtg2_switch_init(
struct rio_dev *rdev,
int do_enum)
408 pr_debug(
"RIO: %s for %s\n", __func__, rio_name(rdev));
409 rdev->
rswitch->add_entry = idtg2_route_add_entry;
410 rdev->
rswitch->get_entry = idtg2_route_get_entry;
411 rdev->
rswitch->clr_table = idtg2_route_clr_table;
412 rdev->
rswitch->set_domain = idtg2_set_domain;
413 rdev->
rswitch->get_domain = idtg2_get_domain;
414 rdev->
rswitch->em_init = idtg2_em_init;
415 rdev->
rswitch->em_handle = idtg2_em_handler;
416 rdev->
rswitch->sw_sysfs = idtg2_sysfs;
420 rio_write_config_32(rdev,