Commit 1ae842de authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds

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.comSigned-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Tested-by: default avatarBarry 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a057a52e
...@@ -1813,7 +1813,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, ...@@ -1813,7 +1813,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
if (rdev->pef & RIO_PEF_EXT_FEATURES) { if (rdev->pef & RIO_PEF_EXT_FEATURES) {
rdev->efptr = rval & 0xffff; rdev->efptr = rval & 0xffff;
rdev->phys_efptr = rio_mport_get_physefb(mport, 0, destid, rdev->phys_efptr = rio_mport_get_physefb(mport, 0, destid,
hopcount); hopcount, &rdev->phys_rmap);
rdev->em_efptr = rio_mport_get_feature(mport, 0, destid, rdev->em_efptr = rio_mport_get_feature(mport, 0, destid,
hopcount, RIO_EFB_ERR_MGMNT); hopcount, RIO_EFB_ERR_MGMNT);
......
...@@ -2555,11 +2555,11 @@ static int tsi721_query_mport(struct rio_mport *mport, ...@@ -2555,11 +2555,11 @@ static int tsi721_query_mport(struct rio_mport *mport,
struct tsi721_device *priv = mport->priv; struct tsi721_device *priv = mport->priv;
u32 rval; u32 rval;
rval = ioread32(priv->regs + (0x100 + RIO_PORT_N_ERR_STS_CSR(0))); rval = ioread32(priv->regs + 0x100 + RIO_PORT_N_ERR_STS_CSR(0, 0));
if (rval & RIO_PORT_N_ERR_STS_PORT_OK) { if (rval & RIO_PORT_N_ERR_STS_PORT_OK) {
rval = ioread32(priv->regs + (0x100 + RIO_PORT_N_CTL2_CSR(0))); rval = ioread32(priv->regs + 0x100 + RIO_PORT_N_CTL2_CSR(0, 0));
attr->link_speed = (rval & RIO_PORT_N_CTL2_SEL_BAUD) >> 28; attr->link_speed = (rval & RIO_PORT_N_CTL2_SEL_BAUD) >> 28;
rval = ioread32(priv->regs + (0x100 + RIO_PORT_N_CTL_CSR(0))); rval = ioread32(priv->regs + 0x100 + RIO_PORT_N_CTL_CSR(0, 0));
attr->link_width = (rval & RIO_PORT_N_CTL_IPW) >> 27; attr->link_width = (rval & RIO_PORT_N_CTL_IPW) >> 27;
} else } else
attr->link_speed = RIO_LINK_DOWN; attr->link_speed = RIO_LINK_DOWN;
...@@ -2673,9 +2673,9 @@ static int tsi721_setup_mport(struct tsi721_device *priv) ...@@ -2673,9 +2673,9 @@ static int tsi721_setup_mport(struct tsi721_device *priv)
mport->ops = &tsi721_rio_ops; mport->ops = &tsi721_rio_ops;
mport->index = 0; mport->index = 0;
mport->sys_size = 0; /* small system */ mport->sys_size = 0; /* small system */
mport->phy_type = RIO_PHY_SERIAL;
mport->priv = (void *)priv; mport->priv = (void *)priv;
mport->phys_efptr = 0x100; mport->phys_efptr = 0x100;
mport->phys_rmap = 1;
mport->dev.parent = &pdev->dev; mport->dev.parent = &pdev->dev;
mport->dev.release = tsi721_mport_release; mport->dev.release = tsi721_mport_release;
......
...@@ -49,15 +49,6 @@ struct rio_id_table { ...@@ -49,15 +49,6 @@ struct rio_id_table {
static int next_destid = 0; static int next_destid = 0;
static int next_comptag = 1; static int next_comptag = 1;
static int rio_mport_phys_table[] = {
RIO_EFB_PAR_EP_ID,
RIO_EFB_PAR_EP_REC_ID,
RIO_EFB_SER_EP_ID,
RIO_EFB_SER_EP_REC_ID,
-1,
};
/** /**
* rio_destid_alloc - Allocate next available destID for given network * rio_destid_alloc - Allocate next available destID for given network
* @net: RIO network * @net: RIO network
...@@ -380,10 +371,15 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, ...@@ -380,10 +371,15 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
if (rdev->pef & RIO_PEF_EXT_FEATURES) { if (rdev->pef & RIO_PEF_EXT_FEATURES) {
rdev->efptr = result & 0xffff; rdev->efptr = result & 0xffff;
rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid, rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid,
hopcount); hopcount, &rdev->phys_rmap);
pr_debug("RIO: %s Register Map %d device\n",
__func__, rdev->phys_rmap);
rdev->em_efptr = rio_mport_get_feature(port, 0, destid, rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
hopcount, RIO_EFB_ERR_MGMNT); hopcount, RIO_EFB_ERR_MGMNT);
if (!rdev->em_efptr)
rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
hopcount, RIO_EFB_ERR_MGMNT_HS);
} }
rio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR, 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,7 +441,7 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0); rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0);
} else { } else {
if (do_enum) if (do_enum)
/*Enable Input Output Port (transmitter reviever)*/ /*Enable Input Output Port (transmitter receiver)*/
rio_enable_rx_tx_port(port, 0, destid, hopcount, 0); rio_enable_rx_tx_port(port, 0, destid, hopcount, 0);
dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id, dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id,
...@@ -481,10 +477,8 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, ...@@ -481,10 +477,8 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
/** /**
* rio_sport_is_active- Tests if a switch port has an active connection. * rio_sport_is_active- Tests if a switch port has an active connection.
* @port: Master port to send transaction * @rdev: RapidIO device object
* @destid: Associated destination ID for switch * @sp: Switch port number
* @hopcount: Hopcount to reach switch
* @sport: Switch port number
* *
* Reads the port error status CSR for a particular switch port to * Reads the port error status CSR for a particular switch port to
* determine if the port has an active link. Returns * determine if the port has an active link. Returns
...@@ -492,30 +486,11 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, ...@@ -492,30 +486,11 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
* inactive. * inactive.
*/ */
static int static int
rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport) rio_sport_is_active(struct rio_dev *rdev, int sp)
{ {
u32 result = 0; u32 result = 0;
u32 ext_ftr_ptr;
ext_ftr_ptr = rio_mport_get_efb(port, 0, destid, hopcount, 0);
while (ext_ftr_ptr) { rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, sp),
rio_mport_read_config_32(port, destid, hopcount,
ext_ftr_ptr, &result);
result = RIO_GET_BLOCK_ID(result);
if ((result == RIO_EFB_SER_EP_FREE_ID) ||
(result == RIO_EFB_SER_EP_FREE_ID_V13P) ||
(result == RIO_EFB_SER_EP_FREC_ID))
break;
ext_ftr_ptr = rio_mport_get_efb(port, 0, destid, hopcount,
ext_ftr_ptr);
}
if (ext_ftr_ptr)
rio_mport_read_config_32(port, destid, hopcount,
ext_ftr_ptr +
RIO_PORT_N_ERR_STS_CSR(sport),
&result); &result);
return result & RIO_PORT_N_ERR_STS_PORT_OK; return result & RIO_PORT_N_ERR_STS_PORT_OK;
...@@ -655,9 +630,7 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port, ...@@ -655,9 +630,7 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
cur_destid = next_destid; cur_destid = next_destid;
if (rio_sport_is_active if (rio_sport_is_active(rdev, port_num)) {
(port, RIO_ANY_DESTID(port->sys_size), hopcount,
port_num)) {
pr_debug( pr_debug(
"RIO: scanning device on port %d\n", "RIO: scanning device on port %d\n",
port_num); port_num);
...@@ -785,8 +758,7 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid, ...@@ -785,8 +758,7 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num) if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num)
continue; continue;
if (rio_sport_is_active if (rio_sport_is_active(rdev, port_num)) {
(port, destid, hopcount, port_num)) {
pr_debug( pr_debug(
"RIO: scanning device on port %d\n", "RIO: scanning device on port %d\n",
port_num); port_num);
...@@ -831,21 +803,11 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid, ...@@ -831,21 +803,11 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
static int rio_mport_is_active(struct rio_mport *port) static int rio_mport_is_active(struct rio_mport *port)
{ {
u32 result = 0; u32 result = 0;
u32 ext_ftr_ptr;
int *entry = rio_mport_phys_table;
do {
if ((ext_ftr_ptr =
rio_mport_get_feature(port, 1, 0, 0, *entry)))
break;
} while (*++entry >= 0);
if (ext_ftr_ptr)
rio_local_read_config_32(port, rio_local_read_config_32(port,
ext_ftr_ptr + port->phys_efptr +
RIO_PORT_N_ERR_STS_CSR(port->index), RIO_PORT_N_ERR_STS_CSR(port->index, port->phys_rmap),
&result); &result);
return result & RIO_PORT_N_ERR_STS_PORT_OK; return result & RIO_PORT_N_ERR_STS_PORT_OK;
} }
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
extern u32 rio_mport_get_feature(struct rio_mport *mport, int local, u16 destid, extern u32 rio_mport_get_feature(struct rio_mport *mport, int local, u16 destid,
u8 hopcount, int ftr); u8 hopcount, int ftr);
extern u32 rio_mport_get_physefb(struct rio_mport *port, int local, extern u32 rio_mport_get_physefb(struct rio_mport *port, int local,
u16 destid, u8 hopcount); u16 destid, u8 hopcount, u32 *rmap);
extern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid, extern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid,
u8 hopcount, u32 from); u8 hopcount, u32 from);
extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid,
......
...@@ -175,12 +175,10 @@ tsi57x_em_init(struct rio_dev *rdev) ...@@ -175,12 +175,10 @@ tsi57x_em_init(struct rio_dev *rdev)
/* Clear all pending interrupts */ /* Clear all pending interrupts */
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
RIO_PORT_N_ERR_STS_CSR(portnum),
&regval); &regval);
rio_write_config_32(rdev, rio_write_config_32(rdev,
rdev->phys_efptr + RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
RIO_PORT_N_ERR_STS_CSR(portnum),
regval & 0x07120214); regval & 0x07120214);
rio_read_config_32(rdev, rio_read_config_32(rdev,
...@@ -198,7 +196,7 @@ tsi57x_em_init(struct rio_dev *rdev) ...@@ -198,7 +196,7 @@ tsi57x_em_init(struct rio_dev *rdev)
/* Skip next (odd) port if the current port is in x4 mode */ /* Skip next (odd) port if the current port is in x4 mode */
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum), RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
&regval); &regval);
if ((regval & RIO_PORT_N_CTL_PWIDTH) == RIO_PORT_N_CTL_PWIDTH_4) if ((regval & RIO_PORT_N_CTL_PWIDTH) == RIO_PORT_N_CTL_PWIDTH_4)
portnum++; portnum++;
...@@ -221,23 +219,23 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum) ...@@ -221,23 +219,23 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
u32 regval; u32 regval;
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum), RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
&err_status); &err_status);
if ((err_status & RIO_PORT_N_ERR_STS_PORT_OK) && if ((err_status & RIO_PORT_N_ERR_STS_PORT_OK) &&
(err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES | (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
RIO_PORT_N_ERR_STS_PW_INP_ES))) { RIO_PORT_N_ERR_STS_INP_ES))) {
/* Remove any queued packets by locking/unlocking port */ /* Remove any queued packets by locking/unlocking port */
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum), RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
&regval); &regval);
if (!(regval & RIO_PORT_N_CTL_LOCKOUT)) { if (!(regval & RIO_PORT_N_CTL_LOCKOUT)) {
rio_write_config_32(rdev, rio_write_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum), RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
regval | RIO_PORT_N_CTL_LOCKOUT); regval | RIO_PORT_N_CTL_LOCKOUT);
udelay(50); udelay(50);
rio_write_config_32(rdev, rio_write_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum), RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
regval); regval);
} }
...@@ -245,7 +243,7 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum) ...@@ -245,7 +243,7 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
* valid bit * valid bit
*/ */
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(portnum), RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, portnum),
&regval); &regval);
/* Send a Packet-Not-Accepted/Link-Request-Input-Status control /* Send a Packet-Not-Accepted/Link-Request-Input-Status control
...@@ -259,8 +257,8 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum) ...@@ -259,8 +257,8 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
while (checkcount--) { while (checkcount--) {
udelay(50); udelay(50);
rio_read_config_32(rdev, rio_read_config_32(rdev,
rdev->phys_efptr + RIO_DEV_PORT_N_MNT_RSP_CSR(rdev,
RIO_PORT_N_MNT_RSP_CSR(portnum), portnum),
&regval); &regval);
if (regval & RIO_PORT_N_MNT_RSP_RVAL) if (regval & RIO_PORT_N_MNT_RSP_RVAL)
goto exit_es; goto exit_es;
......
...@@ -163,6 +163,7 @@ enum rio_device_state { ...@@ -163,6 +163,7 @@ enum rio_device_state {
* @dst_ops: Destination operation capabilities * @dst_ops: Destination operation capabilities
* @comp_tag: RIO component tag * @comp_tag: RIO component tag
* @phys_efptr: RIO device extended features pointer * @phys_efptr: RIO device extended features pointer
* @phys_rmap: LP-Serial Register Map Type (1 or 2)
* @em_efptr: RIO Error Management features pointer * @em_efptr: RIO Error Management features pointer
* @dma_mask: Mask of bits of RIO address this device implements * @dma_mask: Mask of bits of RIO address this device implements
* @driver: Driver claiming this device * @driver: Driver claiming this device
...@@ -193,6 +194,7 @@ struct rio_dev { ...@@ -193,6 +194,7 @@ struct rio_dev {
u32 dst_ops; u32 dst_ops;
u32 comp_tag; u32 comp_tag;
u32 phys_efptr; u32 phys_efptr;
u32 phys_rmap;
u32 em_efptr; u32 em_efptr;
u64 dma_mask; u64 dma_mask;
struct rio_driver *driver; /* RIO driver claiming this device */ struct rio_driver *driver; /* RIO driver claiming this device */
...@@ -237,11 +239,6 @@ struct rio_dbell { ...@@ -237,11 +239,6 @@ struct rio_dbell {
void *dev_id; void *dev_id;
}; };
enum rio_phy_type {
RIO_PHY_PARALLEL,
RIO_PHY_SERIAL,
};
/** /**
* struct rio_mport - RIO master port info * struct rio_mport - RIO master port info
* @dbells: List of doorbell events * @dbells: List of doorbell events
...@@ -259,8 +256,8 @@ enum rio_phy_type { ...@@ -259,8 +256,8 @@ enum rio_phy_type {
* @id: Port ID, unique among all ports * @id: Port ID, unique among all ports
* @index: Port index, unique among all port interfaces of the same type * @index: Port index, unique among all port interfaces of the same type
* @sys_size: RapidIO common transport system size * @sys_size: RapidIO common transport system size
* @phy_type: RapidIO phy type
* @phys_efptr: RIO port extended features pointer * @phys_efptr: RIO port extended features pointer
* @phys_rmap: LP-Serial EFB Register Mapping type (1 or 2).
* @name: Port name string * @name: Port name string
* @dev: device structure associated with an mport * @dev: device structure associated with an mport
* @priv: Master port private data * @priv: Master port private data
...@@ -289,8 +286,8 @@ struct rio_mport { ...@@ -289,8 +286,8 @@ struct rio_mport {
* 0 - Small size. 256 devices. * 0 - Small size. 256 devices.
* 1 - Large size, 65536 devices. * 1 - Large size, 65536 devices.
*/ */
enum rio_phy_type phy_type; /* RapidIO phy type */
u32 phys_efptr; u32 phys_efptr;
u32 phys_rmap;
unsigned char name[RIO_MAX_MPORT_NAME]; unsigned char name[RIO_MAX_MPORT_NAME];
struct device dev; struct device dev;
void *priv; /* Master port private data */ void *priv; /* Master port private data */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment