aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rapidio/switches/idtcps.c33
-rw-r--r--drivers/rapidio/switches/tsi500.c2
-rw-r--r--drivers/rapidio/switches/tsi568.c2
-rw-r--r--drivers/rapidio/switches/tsi57x.c45
-rw-r--r--include/linux/rio.h4
5 files changed, 86 insertions, 0 deletions
diff --git a/drivers/rapidio/switches/idtcps.c b/drivers/rapidio/switches/idtcps.c
index 46e6630dacd3..73c3677e5ac6 100644
--- a/drivers/rapidio/switches/idtcps.c
+++ b/drivers/rapidio/switches/idtcps.c
@@ -17,6 +17,8 @@
17 17
18#define CPS_NO_ROUTE 0xdf 18#define CPS_NO_ROUTE 0xdf
19 19
20#define IDTCPS_RIO_DOMAIN 0xf20020
21
20static int 22static int
21idtcps_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, 23idtcps_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
22 u16 table, u16 route_destid, u8 route_port) 24 u16 table, u16 route_destid, u8 route_port)
@@ -82,12 +84,43 @@ idtcps_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
82 return 0; 84 return 0;
83} 85}
84 86
87static int
88idtcps_set_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
89 u8 sw_domain)
90{
91 /*
92 * Switch domain configuration operates only at global level
93 */
94 rio_mport_write_config_32(mport, destid, hopcount,
95 IDTCPS_RIO_DOMAIN, (u32)sw_domain);
96 return 0;
97}
98
99static int
100idtcps_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
101 u8 *sw_domain)
102{
103 u32 regval;
104
105 /*
106 * Switch domain configuration operates only at global level
107 */
108 rio_mport_read_config_32(mport, destid, hopcount,
109 IDTCPS_RIO_DOMAIN, &regval);
110
111 *sw_domain = (u8)(regval & 0xff);
112
113 return 0;
114}
115
85static int idtcps_switch_init(struct rio_dev *rdev, int do_enum) 116static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
86{ 117{
87 pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev)); 118 pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
88 rdev->rswitch->add_entry = idtcps_route_add_entry; 119 rdev->rswitch->add_entry = idtcps_route_add_entry;
89 rdev->rswitch->get_entry = idtcps_route_get_entry; 120 rdev->rswitch->get_entry = idtcps_route_get_entry;
90 rdev->rswitch->clr_table = idtcps_route_clr_table; 121 rdev->rswitch->clr_table = idtcps_route_clr_table;
122 rdev->rswitch->set_domain = idtcps_set_domain;
123 rdev->rswitch->get_domain = idtcps_get_domain;
91 rdev->rswitch->em_init = NULL; 124 rdev->rswitch->em_init = NULL;
92 rdev->rswitch->em_handle = NULL; 125 rdev->rswitch->em_handle = NULL;
93 126
diff --git a/drivers/rapidio/switches/tsi500.c b/drivers/rapidio/switches/tsi500.c
index 65b865d64d34..914eddd5aa42 100644
--- a/drivers/rapidio/switches/tsi500.c
+++ b/drivers/rapidio/switches/tsi500.c
@@ -67,6 +67,8 @@ static int tsi500_switch_init(struct rio_dev *rdev, int do_enum)
67 rdev->rswitch->add_entry = tsi500_route_add_entry; 67 rdev->rswitch->add_entry = tsi500_route_add_entry;
68 rdev->rswitch->get_entry = tsi500_route_get_entry; 68 rdev->rswitch->get_entry = tsi500_route_get_entry;
69 rdev->rswitch->clr_table = NULL; 69 rdev->rswitch->clr_table = NULL;
70 rdev->rswitch->set_domain = NULL;
71 rdev->rswitch->get_domain = NULL;
70 rdev->rswitch->em_init = NULL; 72 rdev->rswitch->em_init = NULL;
71 rdev->rswitch->em_handle = NULL; 73 rdev->rswitch->em_handle = NULL;
72 74
diff --git a/drivers/rapidio/switches/tsi568.c b/drivers/rapidio/switches/tsi568.c
index 322840d43832..f7fd7898606e 100644
--- a/drivers/rapidio/switches/tsi568.c
+++ b/drivers/rapidio/switches/tsi568.c
@@ -135,6 +135,8 @@ static int tsi568_switch_init(struct rio_dev *rdev, int do_enum)
135 rdev->rswitch->add_entry = tsi568_route_add_entry; 135 rdev->rswitch->add_entry = tsi568_route_add_entry;
136 rdev->rswitch->get_entry = tsi568_route_get_entry; 136 rdev->rswitch->get_entry = tsi568_route_get_entry;
137 rdev->rswitch->clr_table = tsi568_route_clr_table; 137 rdev->rswitch->clr_table = tsi568_route_clr_table;
138 rdev->rswitch->set_domain = NULL;
139 rdev->rswitch->get_domain = NULL;
138 rdev->rswitch->em_init = tsi568_em_init; 140 rdev->rswitch->em_init = tsi568_em_init;
139 rdev->rswitch->em_handle = NULL; 141 rdev->rswitch->em_handle = NULL;
140 142
diff --git a/drivers/rapidio/switches/tsi57x.c b/drivers/rapidio/switches/tsi57x.c
index 2e902d3e1abe..d34df722d95f 100644
--- a/drivers/rapidio/switches/tsi57x.c
+++ b/drivers/rapidio/switches/tsi57x.c
@@ -30,13 +30,17 @@
30#define SPP_ROUTE_CFG_PORT(n) (0x11074 + 0x100*n) 30#define SPP_ROUTE_CFG_PORT(n) (0x11074 + 0x100*n)
31 31
32#define TSI578_SP_MODE(n) (0x11004 + n*0x100) 32#define TSI578_SP_MODE(n) (0x11004 + n*0x100)
33#define TSI578_SP_MODE_GLBL 0x10004
33#define TSI578_SP_MODE_PW_DIS 0x08000000 34#define TSI578_SP_MODE_PW_DIS 0x08000000
35#define TSI578_SP_MODE_LUT_512 0x01000000
34 36
35#define TSI578_SP_CTL_INDEP(n) (0x13004 + n*0x100) 37#define TSI578_SP_CTL_INDEP(n) (0x13004 + n*0x100)
36#define TSI578_SP_LUT_PEINF(n) (0x13010 + n*0x100) 38#define TSI578_SP_LUT_PEINF(n) (0x13010 + n*0x100)
37#define TSI578_SP_CS_TX(n) (0x13014 + n*0x100) 39#define TSI578_SP_CS_TX(n) (0x13014 + n*0x100)
38#define TSI578_SP_INT_STATUS(n) (0x13018 + n*0x100) 40#define TSI578_SP_INT_STATUS(n) (0x13018 + n*0x100)
39 41
42#define TSI578_GLBL_ROUTE_BASE 0x10078
43
40static int 44static int
41tsi57x_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, 45tsi57x_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
42 u16 table, u16 route_destid, u8 route_port) 46 u16 table, u16 route_destid, u8 route_port)
@@ -113,6 +117,45 @@ tsi57x_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
113} 117}
114 118
115static int 119static int
120tsi57x_set_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
121 u8 sw_domain)
122{
123 u32 regval;
124
125 /*
126 * Switch domain configuration operates only at global level
127 */
128
129 /* Turn off flat (LUT_512) mode */
130 rio_mport_read_config_32(mport, destid, hopcount,
131 TSI578_SP_MODE_GLBL, &regval);
132 rio_mport_write_config_32(mport, destid, hopcount, TSI578_SP_MODE_GLBL,
133 regval & ~TSI578_SP_MODE_LUT_512);
134 /* Set switch domain base */
135 rio_mport_write_config_32(mport, destid, hopcount,
136 TSI578_GLBL_ROUTE_BASE,
137 (u32)(sw_domain << 24));
138 return 0;
139}
140
141static int
142tsi57x_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
143 u8 *sw_domain)
144{
145 u32 regval;
146
147 /*
148 * Switch domain configuration operates only at global level
149 */
150 rio_mport_read_config_32(mport, destid, hopcount,
151 TSI578_GLBL_ROUTE_BASE, &regval);
152
153 *sw_domain = (u8)(regval >> 24);
154
155 return 0;
156}
157
158static int
116tsi57x_em_init(struct rio_dev *rdev) 159tsi57x_em_init(struct rio_dev *rdev)
117{ 160{
118 struct rio_mport *mport = rdev->net->hport; 161 struct rio_mport *mport = rdev->net->hport;
@@ -258,6 +301,8 @@ static int tsi57x_switch_init(struct rio_dev *rdev, int do_enum)
258 rdev->rswitch->add_entry = tsi57x_route_add_entry; 301 rdev->rswitch->add_entry = tsi57x_route_add_entry;
259 rdev->rswitch->get_entry = tsi57x_route_get_entry; 302 rdev->rswitch->get_entry = tsi57x_route_get_entry;
260 rdev->rswitch->clr_table = tsi57x_route_clr_table; 303 rdev->rswitch->clr_table = tsi57x_route_clr_table;
304 rdev->rswitch->set_domain = tsi57x_set_domain;
305 rdev->rswitch->get_domain = tsi57x_get_domain;
261 rdev->rswitch->em_init = tsi57x_em_init; 306 rdev->rswitch->em_init = tsi57x_em_init;
262 rdev->rswitch->em_handle = tsi57x_em_handler; 307 rdev->rswitch->em_handle = tsi57x_em_handler;
263 308
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 3d0ac930cbea..19b5f227096e 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -238,6 +238,10 @@ struct rio_switch {
238 u16 table, u16 route_destid, u8 * route_port); 238 u16 table, u16 route_destid, u8 * route_port);
239 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, 239 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
240 u16 table); 240 u16 table);
241 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
242 u8 sw_domain);
243 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
244 u8 *sw_domain);
241 int (*em_init) (struct rio_dev *dev); 245 int (*em_init) (struct rio_dev *dev);
242 int (*em_handle) (struct rio_dev *dev, u8 swport); 246 int (*em_handle) (struct rio_dev *dev, u8 swport);
243}; 247};