aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-scan.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2010-05-26 17:43:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:50 -0400
commit07590ff03935a2efbc03bc7861f20c059576a479 (patch)
tree2da1ee2032e1425a138bc2864066a2e10533ce64 /drivers/rapidio/rio-scan.c
parentf67231f80126f4e08c79c7b2056989c5c89ad4c6 (diff)
rapidio: add IDT CPS/TSI switches
Extentions to RapidIO switch support: 1. modify switch route operation declarations to allow using single switch-specific file for family of switches that share the same route table operations. 2. add standard route table operations for switches that that support route table manipulation registers as defined in the Rev.1.3 of RapidIO specification. 3. add clear-route-table operation for switches 4. add CPSxx and TSIxxx families of RapidIO switches Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Tested-by: Thomas Moll <thomas.moll@sysgo.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Li Yang <leoli@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio-scan.c')
-rw-r--r--drivers/rapidio/rio-scan.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 45415096c294..7f1a675d835d 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -55,6 +55,7 @@ static int rio_mport_phys_table[] = {
55static int rio_sport_phys_table[] = { 55static int rio_sport_phys_table[] = {
56 RIO_EFB_PAR_EP_FREE_ID, 56 RIO_EFB_PAR_EP_FREE_ID,
57 RIO_EFB_SER_EP_FREE_ID, 57 RIO_EFB_SER_EP_FREE_ID,
58 RIO_EFB_SER_EP_FREC_ID,
58 -1, 59 -1,
59}; 60};
60 61
@@ -246,10 +247,20 @@ static void rio_route_set_ops(struct rio_dev *rdev)
246 pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev)); 247 pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev));
247 rdev->rswitch->add_entry = cur->add_hook; 248 rdev->rswitch->add_entry = cur->add_hook;
248 rdev->rswitch->get_entry = cur->get_hook; 249 rdev->rswitch->get_entry = cur->get_hook;
250 rdev->rswitch->clr_table = cur->clr_hook;
251 break;
249 } 252 }
250 cur++; 253 cur++;
251 } 254 }
252 255
256 if ((cur >= end) && (rdev->pef & RIO_PEF_STD_RT)) {
257 pr_debug("RIO: adding STD routing ops for %s\n",
258 rio_name(rdev));
259 rdev->rswitch->add_entry = rio_std_route_add_entry;
260 rdev->rswitch->get_entry = rio_std_route_get_entry;
261 rdev->rswitch->clr_table = rio_std_route_clr_table;
262 }
263
253 if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry) 264 if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry)
254 printk(KERN_ERR "RIO: missing routing ops for %s\n", 265 printk(KERN_ERR "RIO: missing routing ops for %s\n",
255 rio_name(rdev)); 266 rio_name(rdev));
@@ -349,7 +360,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
349 if (rio_is_switch(rdev)) { 360 if (rio_is_switch(rdev)) {
350 rio_mport_read_config_32(port, destid, hopcount, 361 rio_mport_read_config_32(port, destid, hopcount,
351 RIO_SWP_INFO_CAR, &rdev->swpinfo); 362 RIO_SWP_INFO_CAR, &rdev->swpinfo);
352 rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL); 363 rswitch = kzalloc(sizeof(struct rio_switch), GFP_KERNEL);
353 if (!rswitch) 364 if (!rswitch)
354 goto cleanup; 365 goto cleanup;
355 rswitch->switchid = next_switchid; 366 rswitch->switchid = next_switchid;
@@ -369,6 +380,10 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
369 rdev->rswitch->switchid); 380 rdev->rswitch->switchid);
370 rio_route_set_ops(rdev); 381 rio_route_set_ops(rdev);
371 382
383 if (do_enum && rdev->rswitch->clr_table)
384 rdev->rswitch->clr_table(port, destid, hopcount,
385 RIO_GLOBAL_TABLE);
386
372 list_add_tail(&rswitch->node, &rio_switches); 387 list_add_tail(&rswitch->node, &rio_switches);
373 388
374 } else 389 } else
@@ -866,6 +881,9 @@ static void rio_update_route_tables(struct rio_mport *port)
866 continue; 881 continue;
867 882
868 if (RIO_INVALID_ROUTE == rswitch->route_table[destid]) { 883 if (RIO_INVALID_ROUTE == rswitch->route_table[destid]) {
884 /* Skip if destid ends in empty switch*/
885 if (rswitch->destid == destid)
886 continue;
869 887
870 sport = rio_get_swpinfo_inport(port, 888 sport = rio_get_swpinfo_inport(port,
871 rswitch->destid, rswitch->hopcount); 889 rswitch->destid, rswitch->hopcount);