aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/switches/idtcps.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2010-05-26 17:44:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:51 -0400
commit7a88d6286240f1e8a0cf9c07252e1576169020f5 (patch)
tree8fc7d9d6b00a8f2b319f78b1dd9db489395a99fd /drivers/rapidio/switches/idtcps.c
parent058f88d672b3161fe511ebe2996c3faef63c1c8e (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/idtcps.c')
-rw-r--r--drivers/rapidio/switches/idtcps.c33
1 files changed, 33 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