aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rapidio/rio.c')
-rw-r--r--drivers/rapidio/rio.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 6395c780008b..67a379216959 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -451,6 +451,110 @@ struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from)
451 return rio_get_asm(vid, did, RIO_ANY_ID, RIO_ANY_ID, from); 451 return rio_get_asm(vid, did, RIO_ANY_ID, RIO_ANY_ID, from);
452} 452}
453 453
454/**
455 * rio_std_route_add_entry - Add switch route table entry using standard
456 * registers defined in RIO specification rev.1.3
457 * @mport: Master port to issue transaction
458 * @destid: Destination ID of the device
459 * @hopcount: Number of switch hops to the device
460 * @table: routing table ID (global or port-specific)
461 * @route_destid: destID entry in the RT
462 * @route_port: destination port for specified destID
463 */
464int rio_std_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
465 u16 table, u16 route_destid, u8 route_port)
466{
467 if (table == RIO_GLOBAL_TABLE) {
468 rio_mport_write_config_32(mport, destid, hopcount,
469 RIO_STD_RTE_CONF_DESTID_SEL_CSR,
470 (u32)route_destid);
471 rio_mport_write_config_32(mport, destid, hopcount,
472 RIO_STD_RTE_CONF_PORT_SEL_CSR,
473 (u32)route_port);
474 }
475 udelay(10);
476 return 0;
477}
478
479/**
480 * rio_std_route_get_entry - Read switch route table entry (port number)
481 * assosiated with specified destID using standard registers defined in RIO
482 * specification rev.1.3
483 * @mport: Master port to issue transaction
484 * @destid: Destination ID of the device
485 * @hopcount: Number of switch hops to the device
486 * @table: routing table ID (global or port-specific)
487 * @route_destid: destID entry in the RT
488 * @route_port: returned destination port for specified destID
489 */
490int rio_std_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
491 u16 table, u16 route_destid, u8 *route_port)
492{
493 u32 result;
494
495 if (table == RIO_GLOBAL_TABLE) {
496 rio_mport_write_config_32(mport, destid, hopcount,
497 RIO_STD_RTE_CONF_DESTID_SEL_CSR, route_destid);
498 rio_mport_read_config_32(mport, destid, hopcount,
499 RIO_STD_RTE_CONF_PORT_SEL_CSR, &result);
500
501 *route_port = (u8)result;
502 }
503
504 return 0;
505}
506
507/**
508 * rio_std_route_clr_table - Clear swotch route table using standard registers
509 * defined in RIO specification rev.1.3.
510 * @mport: Master port to issue transaction
511 * @local: Indicate a local master port or remote device access
512 * @destid: Destination ID of the device
513 * @hopcount: Number of switch hops to the device
514 * @table: routing table ID (global or port-specific)
515 */
516int rio_std_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
517 u16 table)
518{
519 u32 max_destid = 0xff;
520 u32 i, pef, id_inc = 1, ext_cfg = 0;
521 u32 port_sel = RIO_INVALID_ROUTE;
522
523 if (table == RIO_GLOBAL_TABLE) {
524 rio_mport_read_config_32(mport, destid, hopcount,
525 RIO_PEF_CAR, &pef);
526
527 if (mport->sys_size) {
528 rio_mport_read_config_32(mport, destid, hopcount,
529 RIO_SWITCH_RT_LIMIT,
530 &max_destid);
531 max_destid &= RIO_RT_MAX_DESTID;
532 }
533
534 if (pef & RIO_PEF_EXT_RT) {
535 ext_cfg = 0x80000000;
536 id_inc = 4;
537 port_sel = (RIO_INVALID_ROUTE << 24) |
538 (RIO_INVALID_ROUTE << 16) |
539 (RIO_INVALID_ROUTE << 8) |
540 RIO_INVALID_ROUTE;
541 }
542
543 for (i = 0; i <= max_destid;) {
544 rio_mport_write_config_32(mport, destid, hopcount,
545 RIO_STD_RTE_CONF_DESTID_SEL_CSR,
546 ext_cfg | i);
547 rio_mport_write_config_32(mport, destid, hopcount,
548 RIO_STD_RTE_CONF_PORT_SEL_CSR,
549 port_sel);
550 i += id_inc;
551 }
552 }
553
554 udelay(10);
555 return 0;
556}
557
454static void rio_fixup_device(struct rio_dev *dev) 558static void rio_fixup_device(struct rio_dev *dev)
455{ 559{
456} 560}