diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2010-05-26 17:44:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:51 -0400 |
commit | 7a88d6286240f1e8a0cf9c07252e1576169020f5 (patch) | |
tree | 8fc7d9d6b00a8f2b319f78b1dd9db489395a99fd /drivers/rapidio/switches/tsi57x.c | |
parent | 058f88d672b3161fe511ebe2996c3faef63c1c8e (diff) |
rapidio: add switch domain routines
Add switch specific domain routines required for 16-bit routing support in
switches with hierarchical implementation of routing tables.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/switches/tsi57x.c')
-rw-r--r-- | drivers/rapidio/switches/tsi57x.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 | |||
40 | static int | 44 | static int |
41 | tsi57x_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, | 45 | tsi57x_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 | ||
115 | static int | 119 | static int |
120 | tsi57x_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, ®val); | ||
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 | |||
141 | static int | ||
142 | tsi57x_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, ®val); | ||
152 | |||
153 | *sw_domain = (u8)(regval >> 24); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static int | ||
116 | tsi57x_em_init(struct rio_dev *rdev) | 159 | tsi57x_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 | ||