summaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-scan.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2016-08-02 17:06:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-02 19:35:37 -0400
commit1ae842de1dd8051cbb65b396b6f029d07f992641 (patch)
tree8611cc33a11229df919f3d87561d803d5e5986a9 /drivers/rapidio/rio-scan.c
parenta057a52e94e15d89be8af557584e0144a496b6c6 (diff)
rapidio: modify for rev.3 specification changes
Implement changes made in RapidIO specification rev.3 to LP-Serial Physical Layer register definitions: - use per-port register offset calculations based on LP-Serial Extended Features Block (EFB) Register Map type (I or II) with different per-port offset step (0x20 vs 0x40 respectfully). - remove deprecated Parallel Physical layer definitions and related code. [alexandre.bounine@idt.com: fix DocBook warning for gen3 update] Link: http://lkml.kernel.org/r/1469191173-19338-1-git-send-email-alexandre.bounine@idt.com Link: http://lkml.kernel.org/r/1469125134-16523-12-git-send-email-alexandre.bounine@idt.com Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Tested-by: Barry Wood <barry.wood@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com> Cc: Barry Wood <barry.wood@idt.com> 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.c74
1 files changed, 18 insertions, 56 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index a63a380809d1..23429bdaca84 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -49,15 +49,6 @@ struct rio_id_table {
49static int next_destid = 0; 49static int next_destid = 0;
50static int next_comptag = 1; 50static int next_comptag = 1;
51 51
52static int rio_mport_phys_table[] = {
53 RIO_EFB_PAR_EP_ID,
54 RIO_EFB_PAR_EP_REC_ID,
55 RIO_EFB_SER_EP_ID,
56 RIO_EFB_SER_EP_REC_ID,
57 -1,
58};
59
60
61/** 52/**
62 * rio_destid_alloc - Allocate next available destID for given network 53 * rio_destid_alloc - Allocate next available destID for given network
63 * @net: RIO network 54 * @net: RIO network
@@ -380,10 +371,15 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
380 if (rdev->pef & RIO_PEF_EXT_FEATURES) { 371 if (rdev->pef & RIO_PEF_EXT_FEATURES) {
381 rdev->efptr = result & 0xffff; 372 rdev->efptr = result & 0xffff;
382 rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid, 373 rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid,
383 hopcount); 374 hopcount, &rdev->phys_rmap);
375 pr_debug("RIO: %s Register Map %d device\n",
376 __func__, rdev->phys_rmap);
384 377
385 rdev->em_efptr = rio_mport_get_feature(port, 0, destid, 378 rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
386 hopcount, RIO_EFB_ERR_MGMNT); 379 hopcount, RIO_EFB_ERR_MGMNT);
380 if (!rdev->em_efptr)
381 rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
382 hopcount, RIO_EFB_ERR_MGMNT_HS);
387 } 383 }
388 384
389 rio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR, 385 rio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR,
@@ -445,7 +441,7 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
445 rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0); 441 rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0);
446 } else { 442 } else {
447 if (do_enum) 443 if (do_enum)
448 /*Enable Input Output Port (transmitter reviever)*/ 444 /*Enable Input Output Port (transmitter receiver)*/
449 rio_enable_rx_tx_port(port, 0, destid, hopcount, 0); 445 rio_enable_rx_tx_port(port, 0, destid, hopcount, 0);
450 446
451 dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id, 447 dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id,
@@ -481,10 +477,8 @@ cleanup:
481 477
482/** 478/**
483 * rio_sport_is_active- Tests if a switch port has an active connection. 479 * rio_sport_is_active- Tests if a switch port has an active connection.
484 * @port: Master port to send transaction 480 * @rdev: RapidIO device object
485 * @destid: Associated destination ID for switch 481 * @sp: Switch port number
486 * @hopcount: Hopcount to reach switch
487 * @sport: Switch port number
488 * 482 *
489 * Reads the port error status CSR for a particular switch port to 483 * Reads the port error status CSR for a particular switch port to
490 * determine if the port has an active link. Returns 484 * determine if the port has an active link. Returns
@@ -492,31 +486,12 @@ cleanup:
492 * inactive. 486 * inactive.
493 */ 487 */
494static int 488static int
495rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport) 489rio_sport_is_active(struct rio_dev *rdev, int sp)
496{ 490{
497 u32 result = 0; 491 u32 result = 0;
498 u32 ext_ftr_ptr;
499 492
500 ext_ftr_ptr = rio_mport_get_efb(port, 0, destid, hopcount, 0); 493 rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, sp),
501 494 &result);
502 while (ext_ftr_ptr) {
503 rio_mport_read_config_32(port, destid, hopcount,
504 ext_ftr_ptr, &result);
505 result = RIO_GET_BLOCK_ID(result);
506 if ((result == RIO_EFB_SER_EP_FREE_ID) ||
507 (result == RIO_EFB_SER_EP_FREE_ID_V13P) ||
508 (result == RIO_EFB_SER_EP_FREC_ID))
509 break;
510
511 ext_ftr_ptr = rio_mport_get_efb(port, 0, destid, hopcount,
512 ext_ftr_ptr);
513 }
514
515 if (ext_ftr_ptr)
516 rio_mport_read_config_32(port, destid, hopcount,
517 ext_ftr_ptr +
518 RIO_PORT_N_ERR_STS_CSR(sport),
519 &result);
520 495
521 return result & RIO_PORT_N_ERR_STS_PORT_OK; 496 return result & RIO_PORT_N_ERR_STS_PORT_OK;
522} 497}
@@ -655,9 +630,7 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
655 630
656 cur_destid = next_destid; 631 cur_destid = next_destid;
657 632
658 if (rio_sport_is_active 633 if (rio_sport_is_active(rdev, port_num)) {
659 (port, RIO_ANY_DESTID(port->sys_size), hopcount,
660 port_num)) {
661 pr_debug( 634 pr_debug(
662 "RIO: scanning device on port %d\n", 635 "RIO: scanning device on port %d\n",
663 port_num); 636 port_num);
@@ -785,8 +758,7 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
785 if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num) 758 if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num)
786 continue; 759 continue;
787 760
788 if (rio_sport_is_active 761 if (rio_sport_is_active(rdev, port_num)) {
789 (port, destid, hopcount, port_num)) {
790 pr_debug( 762 pr_debug(
791 "RIO: scanning device on port %d\n", 763 "RIO: scanning device on port %d\n",
792 port_num); 764 port_num);
@@ -831,21 +803,11 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
831static int rio_mport_is_active(struct rio_mport *port) 803static int rio_mport_is_active(struct rio_mport *port)
832{ 804{
833 u32 result = 0; 805 u32 result = 0;
834 u32 ext_ftr_ptr;
835 int *entry = rio_mport_phys_table;
836
837 do {
838 if ((ext_ftr_ptr =
839 rio_mport_get_feature(port, 1, 0, 0, *entry)))
840 break;
841 } while (*++entry >= 0);
842
843 if (ext_ftr_ptr)
844 rio_local_read_config_32(port,
845 ext_ftr_ptr +
846 RIO_PORT_N_ERR_STS_CSR(port->index),
847 &result);
848 806
807 rio_local_read_config_32(port,
808 port->phys_efptr +
809 RIO_PORT_N_ERR_STS_CSR(port->index, port->phys_rmap),
810 &result);
849 return result & RIO_PORT_N_ERR_STS_PORT_OK; 811 return result & RIO_PORT_N_ERR_STS_PORT_OK;
850} 812}
851 813