* [PATCH 00/13] RapidIO subsystem updates
@ 2016-07-21 18:18 Alexandre Bounine
2016-07-21 18:18 ` [PATCH 01/13] rapidio: Remove unnecessary 0x prefixes before %pa extension uses Alexandre Bounine
` (12 more replies)
0 siblings, 13 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
This set of patches contains RapidIO subsystem fixes and updates that have
been made since kernel v4.6. The most significant update brings changes
related to the latest revision of RapidIO specification (rev.3.x) and
introduction of next generation of RapidIO switches by IDT (RXS1632
and RXS2448).
Alexandre Bounine (12):
rapidio/documentation: fix mangled paragraph in mport_cdev
rapidio: fix return value description for dma_prep functions
rapidio/tsi721_dma: add channel mask and queue size parameters
rapidio/tsi721: add PCIe MRRS override parameter
rapidio/tsi721: add messaging mbox selector parameter
rapidio/tsi721_dma: advance queue processing from transfer submit
call
rapidio: fix error handling in mbox request/release functions
rapidio/idt_gen2: fix locking warning
rapidio: change inbound window size type to u64
rapidio: modify for rev.3 specification changes
powerpc/fsl_rio: apply changes for RIO spec rev 3
rapidio/switches: add driver for IDT gen3 switches
Joe Perches (1):
rapidio: Remove unnecessary 0x prefixes before %pa extension uses
Documentation/rapidio/mport_cdev.txt | 3 +-
Documentation/rapidio/tsi721.txt | 26 ++
arch/powerpc/sysdev/fsl_rio.c | 16 +-
drivers/rapidio/devices/rio_mport_cdev.c | 6 +-
drivers/rapidio/devices/tsi721.c | 57 ++++-
drivers/rapidio/devices/tsi721.h | 2 +-
drivers/rapidio/devices/tsi721_dma.c | 27 ++-
drivers/rapidio/rio-scan.c | 74 ++-----
drivers/rapidio/rio.c | 211 ++++++++++-------
drivers/rapidio/rio.h | 2 +-
drivers/rapidio/switches/Kconfig | 6 +
drivers/rapidio/switches/Makefile | 1 +
drivers/rapidio/switches/idt_gen2.c | 7 +-
drivers/rapidio/switches/idt_gen3.c | 381 ++++++++++++++++++++++++++++++
drivers/rapidio/switches/tsi57x.c | 26 +-
include/linux/rio.h | 13 +-
include/linux/rio_ids.h | 2 +
include/linux/rio_regs.h | 167 ++++++++++---
18 files changed, 783 insertions(+), 244 deletions(-)
create mode 100644 drivers/rapidio/switches/idt_gen3.c
--
1.7.8.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/13] rapidio: Remove unnecessary 0x prefixes before %pa extension uses
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 02/13] rapidio/documentation: fix mangled paragraph in mport_cdev Alexandre Bounine
` (11 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Joe Perches, Alexandre Bounine, Matt Porter, Andre van Herk,
Barry Wood, linux-kernel
From: Joe Perches <joe@perches.com>
This is RapidIO part of the original patch submitted by Joe Perches.
(see: https://lkml.org/lkml/2016/3/5/19)
Since commit 3cab1e711297 ("lib/vsprintf: refactor duplicate code
to special_hex_number()") %pa uses have been output with a 0x prefix.
These 0x prefixes in the formats are unnecessary.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/devices/rio_mport_cdev.c | 4 ++--
drivers/rapidio/devices/tsi721.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index e165b7c..de0c692 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -2242,7 +2242,7 @@ static void mport_mm_open(struct vm_area_struct *vma)
{
struct rio_mport_mapping *map = vma->vm_private_data;
-rmcd_debug(MMAP, "0x%pad", &map->phys_addr);
+ rmcd_debug(MMAP, "%pad", &map->phys_addr);
kref_get(&map->ref);
}
@@ -2250,7 +2250,7 @@ static void mport_mm_close(struct vm_area_struct *vma)
{
struct rio_mport_mapping *map = vma->vm_private_data;
-rmcd_debug(MMAP, "0x%pad", &map->phys_addr);
+ rmcd_debug(MMAP, "%pad", &map->phys_addr);
mutex_lock(&map->md->buf_mutex);
kref_put(&map->ref, mport_release_mapping);
mutex_unlock(&map->md->buf_mutex);
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index b5b4556..4c20e99 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -1101,7 +1101,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
ibw_start = lstart & ~(ibw_size - 1);
tsi_debug(IBW, &priv->pdev->dev,
- "Direct (RIO_0x%llx -> PCIe_0x%pad), size=0x%x, ibw_start = 0x%llx",
+ "Direct (RIO_0x%llx -> PCIe_%pad), size=0x%x, ibw_start = 0x%llx",
rstart, &lstart, size, ibw_start);
while ((lstart + size) > (ibw_start + ibw_size)) {
@@ -1120,7 +1120,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
} else {
tsi_debug(IBW, &priv->pdev->dev,
- "Translated (RIO_0x%llx -> PCIe_0x%pad), size=0x%x",
+ "Translated (RIO_0x%llx -> PCIe_%pad), size=0x%x",
rstart, &lstart, size);
if (!is_power_of_2(size) || size < 0x1000 ||
@@ -1215,7 +1215,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
priv->ibwin_cnt--;
tsi_debug(IBW, &priv->pdev->dev,
- "Configured IBWIN%d (RIO_0x%llx -> PCIe_0x%pad), size=0x%llx",
+ "Configured IBWIN%d (RIO_0x%llx -> PCIe_%pad), size=0x%llx",
i, ibw_start, &loc_start, ibw_size);
return 0;
@@ -1237,7 +1237,7 @@ static void tsi721_rio_unmap_inb_mem(struct rio_mport *mport,
int i;
tsi_debug(IBW, &priv->pdev->dev,
- "Unmap IBW mapped to PCIe_0x%pad", &lstart);
+ "Unmap IBW mapped to PCIe_%pad", &lstart);
/* Search for matching active inbound translation window */
for (i = 0; i < TSI721_IBWIN_NUM; i++) {
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/13] rapidio/documentation: fix mangled paragraph in mport_cdev
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
2016-07-21 18:18 ` [PATCH 01/13] rapidio: Remove unnecessary 0x prefixes before %pa extension uses Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 03/13] rapidio: fix return value description for dma_prep functions Alexandre Bounine
` (10 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Minor edits to correct parameter description.
This patch is applicable to kernel versions starting from v4.6.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Reported-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>
Cc: linux-kernel@vger.kernel.org
---
Documentation/rapidio/mport_cdev.txt | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/Documentation/rapidio/mport_cdev.txt b/Documentation/rapidio/mport_cdev.txt
index 20c120d..6e491a6 100644
--- a/Documentation/rapidio/mport_cdev.txt
+++ b/Documentation/rapidio/mport_cdev.txt
@@ -82,8 +82,7 @@ III. Module parameters
- 'dbg_level' - This parameter allows to control amount of debug information
generated by this device driver. This parameter is formed by set of
- This parameter can be changed bit masks that correspond to the specific
- functional block.
+ bit masks that correspond to the specific functional blocks.
For mask definitions see 'drivers/rapidio/devices/rio_mport_cdev.c'
This parameter can be changed dynamically.
Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/13] rapidio: fix return value description for dma_prep functions
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
2016-07-21 18:18 ` [PATCH 01/13] rapidio: Remove unnecessary 0x prefixes before %pa extension uses Alexandre Bounine
2016-07-21 18:18 ` [PATCH 02/13] rapidio/documentation: fix mangled paragraph in mport_cdev Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 04/13] rapidio/tsi721_dma: add channel mask and queue size parameters Alexandre Bounine
` (9 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Update return value description for rio_dma_prep_... functions to include
error-valued pointer that can be returned by HW mport device drivers.
Return values from these functions must be checked using IS_ERR_OR_NULL
macro.
This patch is applicable to kernel versions starting from v4.6-rc1.
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/rio.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 0dcaa66..8408029 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -1848,7 +1848,9 @@ EXPORT_SYMBOL_GPL(rio_release_dma);
* Initializes RapidIO capable DMA channel for the specified data transfer.
* Uses DMA channel private extension to pass information related to remote
* target RIO device.
- * Returns pointer to DMA transaction descriptor or NULL if failed.
+ *
+ * Returns: pointer to DMA transaction descriptor if successful,
+ * error-valued pointer or NULL if failed.
*/
struct dma_async_tx_descriptor *rio_dma_prep_xfer(struct dma_chan *dchan,
u16 destid, struct rio_dma_data *data,
@@ -1883,7 +1885,9 @@ EXPORT_SYMBOL_GPL(rio_dma_prep_xfer);
* Initializes RapidIO capable DMA channel for the specified data transfer.
* Uses DMA channel private extension to pass information related to remote
* target RIO device.
- * Returns pointer to DMA transaction descriptor or NULL if failed.
+ *
+ * Returns: pointer to DMA transaction descriptor if successful,
+ * error-valued pointer or NULL if failed.
*/
struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(struct rio_dev *rdev,
struct dma_chan *dchan, struct rio_dma_data *data,
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/13] rapidio/tsi721_dma: add channel mask and queue size parameters
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (2 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 03/13] rapidio: fix return value description for dma_prep functions Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 05/13] rapidio/tsi721: add PCIe MRRS override parameter Alexandre Bounine
` (8 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add module parameters to allow load time configuration of DMA channels.
Depending on application, performance of DMA data transfers can benefit
from adjusted sizes of buffer descriptor ring and/or transaction requests
queue.
Having HW DMA channel selector mask allows to define which channels (from
seven available) are controlled by the mport device driver and reserve
some of them for direct use by other drivers.
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>
Cc: linux-kernel@vger.kernel.org
---
Documentation/rapidio/tsi721.txt | 14 ++++++++++++++
drivers/rapidio/devices/tsi721.h | 2 +-
drivers/rapidio/devices/tsi721_dma.c | 26 +++++++++++++++++---------
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/Documentation/rapidio/tsi721.txt b/Documentation/rapidio/tsi721.txt
index 7c1c7bf..0e0e90be 100644
--- a/Documentation/rapidio/tsi721.txt
+++ b/Documentation/rapidio/tsi721.txt
@@ -25,6 +25,20 @@ fully compatible with RIONET driver (Ethernet over RapidIO messaging services).
This parameter can be changed dynamically.
Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
+- 'dma_desc_per_channel' - This parameter defines number of hardware buffer
+ descriptors allocated for each registered Tsi721 DMA channel.
+ Its default value is 128.
+
+- 'dma_txqueue_sz' - DMA transactions queue size. Defines number of pending
+ transaction requests that can be accepted by each DMA channel.
+ Default value is 16.
+
+- 'dma_sel' - DMA channel selection mask. Bitmask that defines which hardware
+ DMA channels (0 ... 6) will be registered with DmaEngine core.
+ If bit is set to 1, the corresponding DMA channel will be registered.
+ DMA channels not selected by this mask will not be used by this device
+ driver. Default value is 0x7f (use all channels).
+
II. Known problems
None.
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h
index 5456dbd..5941437 100644
--- a/drivers/rapidio/devices/tsi721.h
+++ b/drivers/rapidio/devices/tsi721.h
@@ -661,7 +661,7 @@ enum dma_rtype {
*/
#define TSI721_DMA_CHNUM TSI721_DMA_MAXCH
-#define TSI721_DMACH_MAINT 0 /* DMA channel for maint requests */
+#define TSI721_DMACH_MAINT 7 /* DMA channel for maint requests */
#define TSI721_DMACH_MAINT_NBD 32 /* Number of BDs for maint requests */
#define TSI721_DMACH_DMA 1 /* DMA channel for data transfers */
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index 155cae1..13c669b 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -36,18 +36,26 @@
#include "tsi721.h"
-#define TSI721_DMA_TX_QUEUE_SZ 16 /* number of transaction descriptors */
-
#ifdef CONFIG_PCI_MSI
static irqreturn_t tsi721_bdma_msix(int irq, void *ptr);
#endif
static int tsi721_submit_sg(struct tsi721_tx_desc *desc);
static unsigned int dma_desc_per_channel = 128;
-module_param(dma_desc_per_channel, uint, S_IWUSR | S_IRUGO);
+module_param(dma_desc_per_channel, uint, S_IRUGO);
MODULE_PARM_DESC(dma_desc_per_channel,
"Number of DMA descriptors per channel (default: 128)");
+static unsigned int dma_txqueue_sz = 16;
+module_param(dma_txqueue_sz, uint, S_IRUGO);
+MODULE_PARM_DESC(dma_txqueue_sz,
+ "DMA Transactions Queue Size (default: 16)");
+
+static u8 dma_sel = 0x7f;
+module_param(dma_sel, byte, S_IRUGO);
+MODULE_PARM_DESC(dma_sel,
+ "DMA Channel Selection Mask (default: 0x7f = all)");
+
static inline struct tsi721_bdma_chan *to_tsi721_chan(struct dma_chan *chan)
{
return container_of(chan, struct tsi721_bdma_chan, dchan);
@@ -732,7 +740,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
tsi_debug(DMA, &dchan->dev->device, "DMAC%d", bdma_chan->id);
if (bdma_chan->bd_base)
- return TSI721_DMA_TX_QUEUE_SZ;
+ return dma_txqueue_sz;
/* Initialize BDMA channel */
if (tsi721_bdma_ch_init(bdma_chan, dma_desc_per_channel)) {
@@ -742,7 +750,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
}
/* Allocate queue of transaction descriptors */
- desc = kcalloc(TSI721_DMA_TX_QUEUE_SZ, sizeof(struct tsi721_tx_desc),
+ desc = kcalloc(dma_txqueue_sz, sizeof(struct tsi721_tx_desc),
GFP_ATOMIC);
if (!desc) {
tsi_err(&dchan->dev->device,
@@ -754,7 +762,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
bdma_chan->tx_desc = desc;
- for (i = 0; i < TSI721_DMA_TX_QUEUE_SZ; i++) {
+ for (i = 0; i < dma_txqueue_sz; i++) {
dma_async_tx_descriptor_init(&desc[i].txd, dchan);
desc[i].txd.tx_submit = tsi721_tx_submit;
desc[i].txd.flags = DMA_CTRL_ACK;
@@ -766,7 +774,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
bdma_chan->active = true;
tsi721_bdma_interrupt_enable(bdma_chan, 1);
- return TSI721_DMA_TX_QUEUE_SZ;
+ return dma_txqueue_sz;
}
static void tsi721_sync_dma_irq(struct tsi721_bdma_chan *bdma_chan)
@@ -962,7 +970,7 @@ void tsi721_dma_stop_all(struct tsi721_device *priv)
int i;
for (i = 0; i < TSI721_DMA_MAXCH; i++) {
- if (i != TSI721_DMACH_MAINT)
+ if ((i != TSI721_DMACH_MAINT) && (dma_sel & (1 << i)))
tsi721_dma_stop(&priv->bdma[i]);
}
}
@@ -979,7 +987,7 @@ int tsi721_register_dma(struct tsi721_device *priv)
for (i = 0; i < TSI721_DMA_MAXCH; i++) {
struct tsi721_bdma_chan *bdma_chan = &priv->bdma[i];
- if (i == TSI721_DMACH_MAINT)
+ if ((i == TSI721_DMACH_MAINT) || (dma_sel & (1 << i)) == 0)
continue;
bdma_chan->regs = priv->regs + TSI721_DMAC_BASE(i);
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/13] rapidio/tsi721: add PCIe MRRS override parameter
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (3 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 04/13] rapidio/tsi721_dma: add channel mask and queue size parameters Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 06/13] rapidio/tsi721: add messaging mbox selector parameter Alexandre Bounine
` (7 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add PCIe Maximum Read Request Size (MRRS) adjustment parameter to allow
users to override configuration register value set during PCIe bus
initialization.
Performance of Tsi721 device as PCIe bus master can be improved if MRRS
is set to its maximum value (4096 bytes).
Some platforms have limitations for supported MRRS and therefore the
default value should be preserved, unless it is known that given platform
supports full set of MRRS values defined by PCI Express specification.
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
Documentation/rapidio/tsi721.txt | 7 +++++++
drivers/rapidio/devices/tsi721.c | 16 +++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/Documentation/rapidio/tsi721.txt b/Documentation/rapidio/tsi721.txt
index 0e0e90be..9c6ee38 100644
--- a/Documentation/rapidio/tsi721.txt
+++ b/Documentation/rapidio/tsi721.txt
@@ -39,6 +39,13 @@ fully compatible with RIONET driver (Ethernet over RapidIO messaging services).
DMA channels not selected by this mask will not be used by this device
driver. Default value is 0x7f (use all channels).
+- 'pcie_mrrs' - override value for PCIe Maximum Read Request Size (MRRS).
+ This parameter gives an ability to override MRRS value set during PCIe
+ configuration process. Tsi721 supports read request sizes up to 4096B.
+ Value for this parameter must be set as defined by PCIe specification:
+ 0 = 128B, 1 = 256B, 2 = 512B, 3 = 1024B, 4 = 2048B and 5 = 4096B.
+ Default value is '-1' (= keep platform setting).
+
II. Known problems
None.
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 4c20e99..85098f8 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -37,11 +37,15 @@
#include "tsi721.h"
#ifdef DEBUG
-u32 dbg_level = DBG_INIT | DBG_EXIT;
+u32 dbg_level;
module_param(dbg_level, uint, S_IWUSR | S_IRUGO);
MODULE_PARM_DESC(dbg_level, "Debugging output level (default 0 = none)");
#endif
+static int pcie_mrrs = -1;
+module_param(pcie_mrrs, int, S_IRUGO);
+MODULE_PARM_DESC(pcie_mrrs, "PCIe MRRS override value (0...5)");
+
static void tsi721_omsg_handler(struct tsi721_device *priv, int ch);
static void tsi721_imsg_handler(struct tsi721_device *priv, int ch);
@@ -2840,6 +2844,16 @@ static int tsi721_probe(struct pci_dev *pdev,
pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN, 0);
+ /* Override PCIe Maximum Read Request Size setting if requested */
+ if (pcie_mrrs >= 0) {
+ if (pcie_mrrs <= 5)
+ pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL,
+ PCI_EXP_DEVCTL_READRQ, pcie_mrrs << 12);
+ else
+ tsi_info(&pdev->dev,
+ "Invalid MRRS override value %d", pcie_mrrs);
+ }
+
/* Adjust PCIe completion timeout. */
pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL2, 0xf, 0x2);
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/13] rapidio/tsi721: add messaging mbox selector parameter
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (4 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 05/13] rapidio/tsi721: add PCIe MRRS override parameter Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 07/13] rapidio/tsi721_dma: advance queue processing from transfer submit call Alexandre Bounine
` (6 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add module parameter to allow load time configuration of available RapidIO
messaging mailboxes (MBOX1 - MBOX4).
Having a messaging MBOX selector mask allows to define which MBOXes are
controlled by the mport device driver and reserve some of them for
direct use by other drivers.
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>
Cc: linux-kernel@vger.kernel.org
---
Documentation/rapidio/tsi721.txt | 5 +++++
drivers/rapidio/devices/tsi721.c | 15 +++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Documentation/rapidio/tsi721.txt b/Documentation/rapidio/tsi721.txt
index 9c6ee38..cd2a293 100644
--- a/Documentation/rapidio/tsi721.txt
+++ b/Documentation/rapidio/tsi721.txt
@@ -46,6 +46,11 @@ fully compatible with RIONET driver (Ethernet over RapidIO messaging services).
0 = 128B, 1 = 256B, 2 = 512B, 3 = 1024B, 4 = 2048B and 5 = 4096B.
Default value is '-1' (= keep platform setting).
+- 'mbox_sel' - RIO messaging MBOX selection mask. This is a bitmask that defines
+ messaging MBOXes are managed by this device driver. Mask bits 0 - 3
+ correspond to MBOX0 - MBOX3. MBOX is under driver's control if the
+ corresponding bit is set to '1'. Default value is 0x0f (= all).
+
II. Known problems
None.
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 85098f8..8e07cd5 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -46,6 +46,11 @@ static int pcie_mrrs = -1;
module_param(pcie_mrrs, int, S_IRUGO);
MODULE_PARM_DESC(pcie_mrrs, "PCIe MRRS override value (0...5)");
+static u8 mbox_sel = 0x0f;
+module_param(mbox_sel, byte, S_IRUGO);
+MODULE_PARM_DESC(mbox_sel,
+ "RIO Messaging MBOX Selection Mask (default: 0x0f = all)");
+
static void tsi721_omsg_handler(struct tsi721_device *priv, int ch);
static void tsi721_imsg_handler(struct tsi721_device *priv, int ch);
@@ -1881,6 +1886,11 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id,
goto out;
}
+ if ((mbox_sel & (1 << mbox)) == 0) {
+ rc = -ENODEV;
+ goto out;
+ }
+
priv->omsg_ring[mbox].dev_id = dev_id;
priv->omsg_ring[mbox].size = entries;
priv->omsg_ring[mbox].sts_rdptr = 0;
@@ -2165,6 +2175,11 @@ static int tsi721_open_inb_mbox(struct rio_mport *mport, void *dev_id,
goto out;
}
+ if ((mbox_sel & (1 << mbox)) == 0) {
+ rc = -ENODEV;
+ goto out;
+ }
+
/* Initialize IB Messaging Ring */
priv->imsg_ring[mbox].dev_id = dev_id;
priv->imsg_ring[mbox].size = entries;
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/13] rapidio/tsi721_dma: advance queue processing from transfer submit call
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (5 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 06/13] rapidio/tsi721: add messaging mbox selector parameter Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 08/13] rapidio: fix error handling in mbox request/release functions Alexandre Bounine
` (5 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add advancing transfer queue immediately from transfer submit call.
DMA performance improvement: This will start transfer without waiting for
'issue_pending' command if there is no DMA transfer in progress.
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/devices/tsi721_dma.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index 13c669b..e2a4185 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -726,6 +726,7 @@ static dma_cookie_t tsi721_tx_submit(struct dma_async_tx_descriptor *txd)
cookie = dma_cookie_assign(txd);
desc->status = DMA_IN_PROGRESS;
list_add_tail(&desc->desc_node, &bdma_chan->queue);
+ tsi721_advance_work(bdma_chan, NULL);
spin_unlock_bh(&bdma_chan->lock);
return cookie;
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/13] rapidio: fix error handling in mbox request/release functions
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (6 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 07/13] rapidio/tsi721_dma: advance queue processing from transfer submit call Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 09/13] rapidio/idt_gen2: fix locking warning Alexandre Bounine
` (4 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add checking for error code returned by HW-specific mbox open routines.
Ensure that resources are properly release if failed.
This patch is applicable to kernel versions starting from v2.6.15.
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/rio.c | 54 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 8408029..1cd3260 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -268,6 +268,12 @@ int rio_request_inb_mbox(struct rio_mport *mport,
mport->inb_msg[mbox].mcback = minb;
rc = mport->ops->open_inb_mbox(mport, dev_id, mbox, entries);
+ if (rc) {
+ mport->inb_msg[mbox].mcback = NULL;
+ mport->inb_msg[mbox].res = NULL;
+ release_resource(res);
+ kfree(res);
+ }
} else
rc = -ENOMEM;
@@ -285,13 +291,22 @@ int rio_request_inb_mbox(struct rio_mport *mport,
*/
int rio_release_inb_mbox(struct rio_mport *mport, int mbox)
{
- if (mport->ops->close_inb_mbox) {
- mport->ops->close_inb_mbox(mport, mbox);
+ int rc;
- /* Release the mailbox resource */
- return release_resource(mport->inb_msg[mbox].res);
- } else
- return -ENOSYS;
+ if (!mport->ops->close_inb_mbox || !mport->inb_msg[mbox].res)
+ return -EINVAL;
+
+ mport->ops->close_inb_mbox(mport, mbox);
+ mport->inb_msg[mbox].mcback = NULL;
+
+ rc = release_resource(mport->inb_msg[mbox].res);
+ if (rc)
+ return rc;
+
+ kfree(mport->inb_msg[mbox].res);
+ mport->inb_msg[mbox].res = NULL;
+
+ return 0;
}
/**
@@ -336,6 +351,12 @@ int rio_request_outb_mbox(struct rio_mport *mport,
mport->outb_msg[mbox].mcback = moutb;
rc = mport->ops->open_outb_mbox(mport, dev_id, mbox, entries);
+ if (rc) {
+ mport->outb_msg[mbox].mcback = NULL;
+ mport->outb_msg[mbox].res = NULL;
+ release_resource(res);
+ kfree(res);
+ }
} else
rc = -ENOMEM;
@@ -353,13 +374,22 @@ int rio_request_outb_mbox(struct rio_mport *mport,
*/
int rio_release_outb_mbox(struct rio_mport *mport, int mbox)
{
- if (mport->ops->close_outb_mbox) {
- mport->ops->close_outb_mbox(mport, mbox);
+ int rc;
- /* Release the mailbox resource */
- return release_resource(mport->outb_msg[mbox].res);
- } else
- return -ENOSYS;
+ if (!mport->ops->close_outb_mbox || !mport->outb_msg[mbox].res)
+ return -EINVAL;
+
+ mport->ops->close_outb_mbox(mport, mbox);
+ mport->outb_msg[mbox].mcback = NULL;
+
+ rc = release_resource(mport->outb_msg[mbox].res);
+ if (rc)
+ return rc;
+
+ kfree(mport->outb_msg[mbox].res);
+ mport->outb_msg[mbox].res = NULL;
+
+ return 0;
}
/**
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/13] rapidio/idt_gen2: fix locking warning
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (7 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 08/13] rapidio: fix error handling in mbox request/release functions Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 10/13] rapidio: change inbound window size type to u64 Alexandre Bounine
` (3 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Fix lockdep warning during device probing: move sysfs initialization out
of code protected by a spin lock.
Signed-off-by: Alexandre Bounine <alexandre.bounine@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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/switches/idt_gen2.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c
index 9f7fe21..e67b923 100644
--- a/drivers/rapidio/switches/idt_gen2.c
+++ b/drivers/rapidio/switches/idt_gen2.c
@@ -436,10 +436,11 @@ static int idtg2_probe(struct rio_dev *rdev, const struct rio_device_id *id)
RIO_STD_RTE_DEFAULT_PORT, IDT_NO_ROUTE);
}
+ spin_unlock(&rdev->rswitch->lock);
+
/* Create device-specific sysfs attributes */
idtg2_sysfs(rdev, true);
- spin_unlock(&rdev->rswitch->lock);
return 0;
}
@@ -452,11 +453,9 @@ static void idtg2_remove(struct rio_dev *rdev)
return;
}
rdev->rswitch->ops = NULL;
-
+ spin_unlock(&rdev->rswitch->lock);
/* Remove device-specific sysfs attributes */
idtg2_sysfs(rdev, false);
-
- spin_unlock(&rdev->rswitch->lock);
}
static struct rio_device_id idtg2_id_table[] = {
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/13] rapidio: change inbound window size type to u64
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (8 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 09/13] rapidio/idt_gen2: fix locking warning Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 11/13] rapidio: modify for rev.3 specification changes Alexandre Bounine
` (2 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Benjamin Herrenschmidt,
Michael Ellerman, Andre van Herk, Barry Wood, linux-kernel,
linuxppc-dev
Current definition of map_inb() mport operations callback uses u32 type to
specify required inbound window (IBW) size. This is limiting factor
because existing hardware - tsi721 and fsl_rio, both support IBW size
up to 16GB.
Changing type of size parameter to u64 to allow IBW size configurations
larger than 4GB.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Barry Wood <barry.wood@idt.com>
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/sysdev/fsl_rio.c | 4 ++--
drivers/rapidio/devices/tsi721.c | 14 +++++++++-----
include/linux/rio.h | 2 +-
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index f5bf38b9..1958838 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -289,7 +289,7 @@ static void fsl_rio_inbound_mem_init(struct rio_priv *priv)
}
int fsl_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
- u64 rstart, u32 size, u32 flags)
+ u64 rstart, u64 size, u32 flags)
{
struct rio_priv *priv = mport->priv;
u32 base_size;
@@ -298,7 +298,7 @@ int fsl_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
u32 riwar;
int i;
- if ((size & (size - 1)) != 0)
+ if ((size & (size - 1)) != 0 || size > 0x400000000UL)
return -EINVAL;
base_size_log = ilog2(size);
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 8e07cd5..53daf63 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -1090,7 +1090,7 @@ static void tsi721_init_pc2sr_mapping(struct tsi721_device *priv)
* from rstart to lstart.
*/
static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
- u64 rstart, u32 size, u32 flags)
+ u64 rstart, u64 size, u32 flags)
{
struct tsi721_device *priv = mport->priv;
int i, avail = -1;
@@ -1103,6 +1103,10 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
struct tsi721_ib_win_mapping *map = NULL;
int ret = -EBUSY;
+ /* Max IBW size supported by HW is 16GB */
+ if (size > 0x400000000UL)
+ return -EINVAL;
+
if (direct) {
/* Calculate minimal acceptable window size and base address */
@@ -1110,15 +1114,15 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
ibw_start = lstart & ~(ibw_size - 1);
tsi_debug(IBW, &priv->pdev->dev,
- "Direct (RIO_0x%llx -> PCIe_%pad), size=0x%x, ibw_start = 0x%llx",
+ "Direct (RIO_0x%llx -> PCIe_%pad), size=0x%llx, ibw_start = 0x%llx",
rstart, &lstart, size, ibw_start);
while ((lstart + size) > (ibw_start + ibw_size)) {
ibw_size *= 2;
ibw_start = lstart & ~(ibw_size - 1);
- if (ibw_size > 0x80000000) { /* Limit max size to 2GB */
+ /* Check for crossing IBW max size 16GB */
+ if (ibw_size > 0x400000000UL)
return -EBUSY;
- }
}
loc_start = ibw_start;
@@ -1129,7 +1133,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
} else {
tsi_debug(IBW, &priv->pdev->dev,
- "Translated (RIO_0x%llx -> PCIe_%pad), size=0x%x",
+ "Translated (RIO_0x%llx -> PCIe_%pad), size=0x%llx",
rstart, &lstart, size);
if (!is_power_of_2(size) || size < 0x1000 ||
diff --git a/include/linux/rio.h b/include/linux/rio.h
index aa23238..f7ec35b 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -425,7 +425,7 @@ struct rio_ops {
int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
void *(*get_inb_message)(struct rio_mport *mport, int mbox);
int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
- u64 rstart, u32 size, u32 flags);
+ u64 rstart, u64 size, u32 flags);
void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
int (*query_mport)(struct rio_mport *mport,
struct rio_mport_attr *attr);
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/13] rapidio: modify for rev.3 specification changes
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (9 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 10/13] rapidio: change inbound window size type to u64 Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-27 4:53 ` Michael Ellerman
2016-07-21 18:18 ` [PATCH 12/13] powerpc/fsl_rio: apply changes for RIO spec rev 3 Alexandre Bounine
2016-07-21 18:18 ` [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches Alexandre Bounine
12 siblings, 1 reply; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
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.
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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/devices/rio_mport_cdev.c | 2 +-
drivers/rapidio/devices/tsi721.c | 8 +-
drivers/rapidio/rio-scan.c | 74 +++----------
drivers/rapidio/rio.c | 149 ++++++++++++++-------------
drivers/rapidio/rio.h | 2 +-
drivers/rapidio/switches/tsi57x.c | 26 ++---
include/linux/rio.h | 11 +--
include/linux/rio_regs.h | 167 +++++++++++++++++++++++------
8 files changed, 248 insertions(+), 191 deletions(-)
diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index de0c692..436dfe8 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -1813,7 +1813,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
if (rdev->pef & RIO_PEF_EXT_FEATURES) {
rdev->efptr = rval & 0xffff;
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,
hopcount, RIO_EFB_ERR_MGMNT);
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 53daf63..32f0f01 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -2555,11 +2555,11 @@ static int tsi721_query_mport(struct rio_mport *mport,
struct tsi721_device *priv = mport->priv;
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) {
- 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;
- 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;
} else
attr->link_speed = RIO_LINK_DOWN;
@@ -2673,9 +2673,9 @@ static int tsi721_setup_mport(struct tsi721_device *priv)
mport->ops = &tsi721_rio_ops;
mport->index = 0;
mport->sys_size = 0; /* small system */
- mport->phy_type = RIO_PHY_SERIAL;
mport->priv = (void *)priv;
mport->phys_efptr = 0x100;
+ mport->phys_rmap = 1;
mport->dev.parent = &pdev->dev;
mport->dev.release = tsi721_mport_release;
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index a63a380..23429bd 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -49,15 +49,6 @@ struct rio_id_table {
static int next_destid = 0;
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
* @net: RIO network
@@ -380,10 +371,15 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
if (rdev->pef & RIO_PEF_EXT_FEATURES) {
rdev->efptr = result & 0xffff;
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,
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,
@@ -445,7 +441,7 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0);
} else {
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);
dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id,
@@ -481,10 +477,8 @@ cleanup:
/**
* rio_sport_is_active- Tests if a switch port has an active connection.
- * @port: Master port to send transaction
- * @destid: Associated destination ID for switch
- * @hopcount: Hopcount to reach switch
- * @sport: Switch port number
+ * @rdev: RapidIO device object
+ * @sp: Switch port number
*
* Reads the port error status CSR for a particular switch port to
* determine if the port has an active link. Returns
@@ -492,31 +486,12 @@ cleanup:
* inactive.
*/
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 ext_ftr_ptr;
- ext_ftr_ptr = rio_mport_get_efb(port, 0, destid, hopcount, 0);
-
- while (ext_ftr_ptr) {
- 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);
+ rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, sp),
+ &result);
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,
cur_destid = next_destid;
- if (rio_sport_is_active
- (port, RIO_ANY_DESTID(port->sys_size), hopcount,
- port_num)) {
+ if (rio_sport_is_active(rdev, port_num)) {
pr_debug(
"RIO: scanning device on port %d\n",
port_num);
@@ -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)
continue;
- if (rio_sport_is_active
- (port, destid, hopcount, port_num)) {
+ if (rio_sport_is_active(rdev, port_num)) {
pr_debug(
"RIO: scanning device on port %d\n",
port_num);
@@ -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)
{
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,
- ext_ftr_ptr +
- RIO_PORT_N_ERR_STS_CSR(port->index),
- &result);
+ rio_local_read_config_32(port,
+ port->phys_efptr +
+ RIO_PORT_N_ERR_STS_CSR(port->index, port->phys_rmap),
+ &result);
return result & RIO_PORT_N_ERR_STS_PORT_OK;
}
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 1cd3260..3de81e0 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -789,7 +789,7 @@ EXPORT_SYMBOL_GPL(rio_unmap_outb_region);
*/
u32
rio_mport_get_physefb(struct rio_mport *port, int local,
- u16 destid, u8 hopcount)
+ u16 destid, u8 hopcount, u32 *rmap)
{
u32 ext_ftr_ptr;
u32 ftr_header;
@@ -807,14 +807,21 @@ rio_mport_get_physefb(struct rio_mport *port, int local,
ftr_header = RIO_GET_BLOCK_ID(ftr_header);
switch (ftr_header) {
- case RIO_EFB_SER_EP_ID_V13P:
- case RIO_EFB_SER_EP_REC_ID_V13P:
- case RIO_EFB_SER_EP_FREE_ID_V13P:
case RIO_EFB_SER_EP_ID:
case RIO_EFB_SER_EP_REC_ID:
case RIO_EFB_SER_EP_FREE_ID:
- case RIO_EFB_SER_EP_FREC_ID:
+ case RIO_EFB_SER_EP_M1_ID:
+ case RIO_EFB_SER_EP_SW_M1_ID:
+ case RIO_EFB_SER_EPF_M1_ID:
+ case RIO_EFB_SER_EPF_SW_M1_ID:
+ *rmap = 1;
+ return ext_ftr_ptr;
+ case RIO_EFB_SER_EP_M2_ID:
+ case RIO_EFB_SER_EP_SW_M2_ID:
+ case RIO_EFB_SER_EPF_M2_ID:
+ case RIO_EFB_SER_EPF_SW_M2_ID:
+ *rmap = 2;
return ext_ftr_ptr;
default:
@@ -873,16 +880,16 @@ int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock)
u32 regval;
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
- ®val);
+ RIO_DEV_PORT_N_CTL_CSR(rdev, pnum),
+ ®val);
if (lock)
regval |= RIO_PORT_N_CTL_LOCKOUT;
else
regval &= ~RIO_PORT_N_CTL_LOCKOUT;
rio_write_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
- regval);
+ RIO_DEV_PORT_N_CTL_CSR(rdev, pnum),
+ regval);
return 0;
}
EXPORT_SYMBOL_GPL(rio_set_port_lockout);
@@ -906,6 +913,7 @@ int rio_enable_rx_tx_port(struct rio_mport *port,
#ifdef CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS
u32 regval;
u32 ext_ftr_ptr;
+ u32 rmap;
/*
* enable rx input tx output port
@@ -913,34 +921,29 @@ int rio_enable_rx_tx_port(struct rio_mport *port,
pr_debug("rio_enable_rx_tx_port(local = %d, destid = %d, hopcount = "
"%d, port_num = %d)\n", local, destid, hopcount, port_num);
- ext_ftr_ptr = rio_mport_get_physefb(port, local, destid, hopcount);
+ ext_ftr_ptr = rio_mport_get_physefb(port, local, destid,
+ hopcount, &rmap);
if (local) {
- rio_local_read_config_32(port, ext_ftr_ptr +
- RIO_PORT_N_CTL_CSR(0),
+ rio_local_read_config_32(port,
+ ext_ftr_ptr + RIO_PORT_N_CTL_CSR(0, rmap),
®val);
} else {
if (rio_mport_read_config_32(port, destid, hopcount,
- ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), ®val) < 0)
+ ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num, rmap),
+ ®val) < 0)
return -EIO;
}
- if (regval & RIO_PORT_N_CTL_P_TYP_SER) {
- /* serial */
- regval = regval | RIO_PORT_N_CTL_EN_RX_SER
- | RIO_PORT_N_CTL_EN_TX_SER;
- } else {
- /* parallel */
- regval = regval | RIO_PORT_N_CTL_EN_RX_PAR
- | RIO_PORT_N_CTL_EN_TX_PAR;
- }
+ regval = regval | RIO_PORT_N_CTL_EN_RX | RIO_PORT_N_CTL_EN_TX;
if (local) {
- rio_local_write_config_32(port, ext_ftr_ptr +
- RIO_PORT_N_CTL_CSR(0), regval);
+ rio_local_write_config_32(port,
+ ext_ftr_ptr + RIO_PORT_N_CTL_CSR(0, rmap), regval);
} else {
if (rio_mport_write_config_32(port, destid, hopcount,
- ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), regval) < 0)
+ ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num, rmap),
+ regval) < 0)
return -EIO;
}
#endif
@@ -1042,14 +1045,14 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
/* Read from link maintenance response register
* to clear valid bit */
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
+ RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
®val);
udelay(50);
}
/* Issue Input-status command */
rio_write_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum),
+ RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
RIO_MNT_REQ_CMD_IS);
/* Exit if the response is not expected */
@@ -1060,7 +1063,7 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
while (checkcount--) {
udelay(50);
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
+ RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
®val);
if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
*lnkresp = regval;
@@ -1076,6 +1079,13 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
* @rdev: Pointer to RIO device control structure
* @pnum: Switch port number to clear errors
* @err_status: port error status (if 0 reads register from device)
+ *
+ * TODO: Currently this routine is not compatible with recovery process
+ * specified for idt_gen3 RapidIO switch devices. It has to be reviewed
+ * to implement universal recovery process that is compatible full range
+ * off available devices.
+ * IDT gen3 switch driver now implements HW-specific error handler that
+ * issues soft port reset to the port to reset ERR_STOP bits and ackIDs.
*/
static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
{
@@ -1085,10 +1095,10 @@ static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
if (err_status == 0)
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
+ RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
&err_status);
- if (err_status & RIO_PORT_N_ERR_STS_PW_OUT_ES) {
+ if (err_status & RIO_PORT_N_ERR_STS_OUT_ES) {
pr_debug("RIO_EM: servicing Output Error-Stopped state\n");
/*
* Send a Link-Request/Input-Status control symbol
@@ -1103,7 +1113,7 @@ static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
far_ackid = (regval & RIO_PORT_N_MNT_RSP_ASTAT) >> 5;
far_linkstat = regval & RIO_PORT_N_MNT_RSP_LSTAT;
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
+ RIO_DEV_PORT_N_ACK_STS_CSR(rdev, pnum),
®val);
pr_debug("RIO_EM: SP%d_ACK_STS_CSR=0x%08x\n", pnum, regval);
near_ackid = (regval & RIO_PORT_N_ACK_INBOUND) >> 24;
@@ -1121,43 +1131,43 @@ static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
* far inbound.
*/
rio_write_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
+ RIO_DEV_PORT_N_ACK_STS_CSR(rdev, pnum),
(near_ackid << 24) |
(far_ackid << 8) | far_ackid);
/* Align far outstanding/outbound ackIDs with
* near inbound.
*/
far_ackid++;
- if (nextdev)
- rio_write_config_32(nextdev,
- nextdev->phys_efptr +
- RIO_PORT_N_ACK_STS_CSR(RIO_GET_PORT_NUM(nextdev->swpinfo)),
- (far_ackid << 24) |
- (near_ackid << 8) | near_ackid);
- else
- pr_debug("RIO_EM: Invalid nextdev pointer (NULL)\n");
+ if (!nextdev) {
+ pr_debug("RIO_EM: nextdev pointer == NULL\n");
+ goto rd_err;
+ }
+
+ rio_write_config_32(nextdev,
+ RIO_DEV_PORT_N_ACK_STS_CSR(nextdev,
+ RIO_GET_PORT_NUM(nextdev->swpinfo)),
+ (far_ackid << 24) |
+ (near_ackid << 8) | near_ackid);
}
rd_err:
- rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
- &err_status);
+ rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
+ &err_status);
pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
}
- if ((err_status & RIO_PORT_N_ERR_STS_PW_INP_ES) && nextdev) {
+ if ((err_status & RIO_PORT_N_ERR_STS_INP_ES) && nextdev) {
pr_debug("RIO_EM: servicing Input Error-Stopped state\n");
rio_get_input_status(nextdev,
RIO_GET_PORT_NUM(nextdev->swpinfo), NULL);
udelay(50);
- rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
- &err_status);
+ rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
+ &err_status);
pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
}
- return (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
- RIO_PORT_N_ERR_STS_PW_INP_ES)) ? 1 : 0;
+ return (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
+ RIO_PORT_N_ERR_STS_INP_ES)) ? 1 : 0;
}
/**
@@ -1257,9 +1267,8 @@ int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
if (rdev->rswitch->ops && rdev->rswitch->ops->em_handle)
rdev->rswitch->ops->em_handle(rdev, portnum);
- rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
- &err_status);
+ rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
+ &err_status);
pr_debug("RIO_PW: SP%d_ERR_STS_CSR=0x%08x\n", portnum, err_status);
if (err_status & RIO_PORT_N_ERR_STS_PORT_OK) {
@@ -1276,8 +1285,8 @@ int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
* Depending on the link partner state, two attempts
* may be needed for successful recovery.
*/
- if (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
- RIO_PORT_N_ERR_STS_PW_INP_ES)) {
+ if (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
+ RIO_PORT_N_ERR_STS_INP_ES)) {
if (rio_clr_err_stopped(rdev, portnum, err_status))
rio_clr_err_stopped(rdev, portnum, 0);
}
@@ -1287,10 +1296,18 @@ int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
rdev->rswitch->port_ok &= ~(1 << portnum);
rio_set_port_lockout(rdev, portnum, 1);
+ if (rdev->phys_rmap == 1) {
rio_write_config_32(rdev,
- rdev->phys_efptr +
- RIO_PORT_N_ACK_STS_CSR(portnum),
+ RIO_DEV_PORT_N_ACK_STS_CSR(rdev, portnum),
RIO_PORT_N_ACK_CLEAR);
+ } else {
+ rio_write_config_32(rdev,
+ RIO_DEV_PORT_N_OB_ACK_CSR(rdev, portnum),
+ RIO_PORT_N_OB_ACK_CLEAR);
+ rio_write_config_32(rdev,
+ RIO_DEV_PORT_N_IB_ACK_CSR(rdev, portnum),
+ 0);
+ }
/* Schedule Extraction Service */
pr_debug("RIO_PW: Device Extraction on [%s]-P%d\n",
@@ -1319,9 +1336,8 @@ int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
}
/* Clear remaining error bits and Port-Write Pending bit */
- rio_write_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
- err_status);
+ rio_write_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
+ err_status);
return 0;
}
@@ -1372,20 +1388,7 @@ EXPORT_SYMBOL_GPL(rio_mport_get_efb);
* Tell if a device supports a given RapidIO capability.
* Returns the offset of the requested extended feature
* block within the device's RIO configuration space or
- * 0 in case the device does not support it. Possible
- * values for @ftr:
- *
- * %RIO_EFB_PAR_EP_ID LP/LVDS EP Devices
- *
- * %RIO_EFB_PAR_EP_REC_ID LP/LVDS EP Recovery Devices
- *
- * %RIO_EFB_PAR_EP_FREE_ID LP/LVDS EP Free Devices
- *
- * %RIO_EFB_SER_EP_ID LP/Serial EP Devices
- *
- * %RIO_EFB_SER_EP_REC_ID LP/Serial EP Recovery Devices
- *
- * %RIO_EFB_SER_EP_FREE_ID LP/Serial EP Free Devices
+ * 0 in case the device does not support it.
*/
u32
rio_mport_get_feature(struct rio_mport * port, int local, u16 destid,
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index 625d09a..9796b3f 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -22,7 +22,7 @@
extern u32 rio_mport_get_feature(struct rio_mport *mport, int local, u16 destid,
u8 hopcount, int ftr);
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,
u8 hopcount, u32 from);
extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid,
diff --git a/drivers/rapidio/switches/tsi57x.c b/drivers/rapidio/switches/tsi57x.c
index 42c8b01..2700d15 100644
--- a/drivers/rapidio/switches/tsi57x.c
+++ b/drivers/rapidio/switches/tsi57x.c
@@ -175,12 +175,10 @@ tsi57x_em_init(struct rio_dev *rdev)
/* Clear all pending interrupts */
rio_read_config_32(rdev,
- rdev->phys_efptr +
- RIO_PORT_N_ERR_STS_CSR(portnum),
+ RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
®val);
rio_write_config_32(rdev,
- rdev->phys_efptr +
- RIO_PORT_N_ERR_STS_CSR(portnum),
+ RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
regval & 0x07120214);
rio_read_config_32(rdev,
@@ -198,7 +196,7 @@ tsi57x_em_init(struct rio_dev *rdev)
/* Skip next (odd) port if the current port is in x4 mode */
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
+ RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
®val);
if ((regval & RIO_PORT_N_CTL_PWIDTH) == RIO_PORT_N_CTL_PWIDTH_4)
portnum++;
@@ -221,23 +219,23 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
u32 regval;
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);
if ((err_status & RIO_PORT_N_ERR_STS_PORT_OK) &&
- (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
- RIO_PORT_N_ERR_STS_PW_INP_ES))) {
+ (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
+ RIO_PORT_N_ERR_STS_INP_ES))) {
/* Remove any queued packets by locking/unlocking port */
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
+ RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
®val);
if (!(regval & RIO_PORT_N_CTL_LOCKOUT)) {
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);
udelay(50);
rio_write_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
+ RIO_DEV_PORT_N_CTL_CSR(rdev, portnum),
regval);
}
@@ -245,7 +243,7 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
* valid bit
*/
rio_read_config_32(rdev,
- rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(portnum),
+ RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, portnum),
®val);
/* Send a Packet-Not-Accepted/Link-Request-Input-Status control
@@ -259,8 +257,8 @@ tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
while (checkcount--) {
udelay(50);
rio_read_config_32(rdev,
- rdev->phys_efptr +
- RIO_PORT_N_MNT_RSP_CSR(portnum),
+ RIO_DEV_PORT_N_MNT_RSP_CSR(rdev,
+ portnum),
®val);
if (regval & RIO_PORT_N_MNT_RSP_RVAL)
goto exit_es;
diff --git a/include/linux/rio.h b/include/linux/rio.h
index f7ec35b..37b95c4 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -163,6 +163,7 @@ enum rio_device_state {
* @dst_ops: Destination operation capabilities
* @comp_tag: RIO component tag
* @phys_efptr: RIO device extended features pointer
+ * @phys_rmap: LP-Serial Register Map Type (1 or 2)
* @em_efptr: RIO Error Management features pointer
* @dma_mask: Mask of bits of RIO address this device implements
* @driver: Driver claiming this device
@@ -193,6 +194,7 @@ struct rio_dev {
u32 dst_ops;
u32 comp_tag;
u32 phys_efptr;
+ u32 phys_rmap;
u32 em_efptr;
u64 dma_mask;
struct rio_driver *driver; /* RIO driver claiming this device */
@@ -237,11 +239,6 @@ struct rio_dbell {
void *dev_id;
};
-enum rio_phy_type {
- RIO_PHY_PARALLEL,
- RIO_PHY_SERIAL,
-};
-
/**
* struct rio_mport - RIO master port info
* @dbells: List of doorbell events
@@ -259,8 +256,8 @@ enum rio_phy_type {
* @id: Port ID, unique among all ports
* @index: Port index, unique among all port interfaces of the same type
* @sys_size: RapidIO common transport system size
- * @phy_type: RapidIO phy type
* @phys_efptr: RIO port extended features pointer
+ * @phys_rmap: LP-Serial EFB Register Mapping type (1 or 2).
* @name: Port name string
* @dev: device structure associated with an mport
* @priv: Master port private data
@@ -289,8 +286,8 @@ struct rio_mport {
* 0 - Small size. 256 devices.
* 1 - Large size, 65536 devices.
*/
- enum rio_phy_type phy_type; /* RapidIO phy type */
u32 phys_efptr;
+ u32 phys_rmap;
unsigned char name[RIO_MAX_MPORT_NAME];
struct device dev;
void *priv; /* Master port private data */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index 1063ae3..40c04ef 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -42,9 +42,11 @@
#define RIO_PEF_INB_MBOX2 0x00200000 /* [II, <= 1.2] Mailbox 2 */
#define RIO_PEF_INB_MBOX3 0x00100000 /* [II, <= 1.2] Mailbox 3 */
#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II, <= 1.2] Doorbells */
+#define RIO_PEF_DEV32 0x00001000 /* [III] PE supports Common TRansport Dev32 */
#define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */
#define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */
-#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */
+#define RIO_PEF_CTLS 0x00000010 /* [III] Common Transport Large System (< rev.3) */
+#define RIO_PEF_DEV16 0x00000010 /* [III] PE Supports Common Transport Dev16 (rev.3) */
#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */
#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */
#define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */
@@ -194,70 +196,101 @@
#define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK)
/* Extended Feature Block IDs */
-#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */
-#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */
-#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */
-#define RIO_EFB_SER_EP_ID_V13P 0x0001 /* [VI] LP/Serial EP Devices, RapidIO Spec ver 1.3 and above */
-#define RIO_EFB_SER_EP_REC_ID_V13P 0x0002 /* [VI] LP/Serial EP Recovery Devices, RapidIO Spec ver 1.3 and above */
-#define RIO_EFB_SER_EP_FREE_ID_V13P 0x0003 /* [VI] LP/Serial EP Free Devices, RapidIO Spec ver 1.3 and above */
-#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */
-#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */
-#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */
-#define RIO_EFB_SER_EP_FREC_ID 0x0009 /* [VI] LP/Serial EP Free Recovery Devices */
+#define RIO_EFB_SER_EP_M1_ID 0x0001 /* [VI] LP-Serial EP Devices, Map I */
+#define RIO_EFB_SER_EP_SW_M1_ID 0x0002 /* [VI] LP-Serial EP w SW Recovery Devices, Map I */
+#define RIO_EFB_SER_EPF_M1_ID 0x0003 /* [VI] LP-Serial EP Free Devices, Map I */
+#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP-Serial EP Devices, RIO 1.2 */
+#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP-Serial EP w SW Recovery Devices, RIO 1.2 */
+#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP-Serial EP Free Devices, RIO 1.2 */
#define RIO_EFB_ERR_MGMNT 0x0007 /* [VIII] Error Management Extensions */
+#define RIO_EFB_SER_EPF_SW_M1_ID 0x0009 /* [VI] LP-Serial EP Free w SW Recovery Devices, Map I */
+#define RIO_EFB_SW_ROUTING_TBL 0x000E /* [III] Switch Routing Table Block */
+#define RIO_EFB_SER_EP_M2_ID 0x0011 /* [VI] LP-Serial EP Devices, Map II */
+#define RIO_EFB_SER_EP_SW_M2_ID 0x0012 /* [VI] LP-Serial EP w SW Recovery Devices, Map II */
+#define RIO_EFB_SER_EPF_M2_ID 0x0013 /* [VI] LP-Serial EP Free Devices, Map II */
+#define RIO_EFB_ERR_MGMNT_HS 0x0017 /* [VIII] Error Management Extensions, Hot-Swap only */
+#define RIO_EFB_SER_EPF_SW_M2_ID 0x0019 /* [VI] LP-Serial EP Free w SW Recovery Devices, Map II */
/*
- * Physical 8/16 LP-LVDS
- * ID=0x0001, Generic End Point Devices
- * ID=0x0002, Generic End Point Devices, software assisted recovery option
- * ID=0x0003, Generic End Point Free Devices
- *
- * Physical LP-Serial
- * ID=0x0004, Generic End Point Devices
- * ID=0x0005, Generic End Point Devices, software assisted recovery option
- * ID=0x0006, Generic End Point Free Devices
+ * Physical LP-Serial Registers Definitions
+ * Parameters in register macros:
+ * n - port number, m - Register Map Type (1 or 2)
*/
#define RIO_PORT_MNT_HEADER 0x0000
#define RIO_PORT_REQ_CTL_CSR 0x0020
-#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */
-#define RIO_PORT_LINKTO_CTL_CSR 0x0020 /* Serial */
-#define RIO_PORT_RSPTO_CTL_CSR 0x0024 /* Serial */
+#define RIO_PORT_RSP_CTL_CSR 0x0024
+#define RIO_PORT_LINKTO_CTL_CSR 0x0020
+#define RIO_PORT_RSPTO_CTL_CSR 0x0024
#define RIO_PORT_GEN_CTL_CSR 0x003c
#define RIO_PORT_GEN_HOST 0x80000000
#define RIO_PORT_GEN_MASTER 0x40000000
#define RIO_PORT_GEN_DISCOVERED 0x20000000
-#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */
+#define RIO_PORT_N_MNT_REQ_CSR(n, m) (0x40 + (n) * (0x20 * (m)))
#define RIO_MNT_REQ_CMD_RD 0x03 /* Reset-device command */
#define RIO_MNT_REQ_CMD_IS 0x04 /* Input-status command */
-#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */
+#define RIO_PORT_N_MNT_RSP_CSR(n, m) (0x44 + (n) * (0x20 * (m)))
#define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */
#define RIO_PORT_N_MNT_RSP_ASTAT 0x000007e0 /* ackID Status */
#define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */
-#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */
+#define RIO_PORT_N_ACK_STS_CSR(n) (0x48 + (n) * 0x20) /* Only in RM-I */
#define RIO_PORT_N_ACK_CLEAR 0x80000000
#define RIO_PORT_N_ACK_INBOUND 0x3f000000
#define RIO_PORT_N_ACK_OUTSTAND 0x00003f00
#define RIO_PORT_N_ACK_OUTBOUND 0x0000003f
-#define RIO_PORT_N_CTL2_CSR(x) (0x0054 + x*0x20)
+#define RIO_PORT_N_CTL2_CSR(n, m) (0x54 + (n) * (0x20 * (m)))
#define RIO_PORT_N_CTL2_SEL_BAUD 0xf0000000
-#define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20)
-#define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */
-#define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */
+#define RIO_PORT_N_ERR_STS_CSR(n, m) (0x58 + (n) * (0x20 * (m)))
+#define RIO_PORT_N_ERR_STS_OUT_ES 0x00010000 /* Output Error-stopped */
+#define RIO_PORT_N_ERR_STS_INP_ES 0x00000100 /* Input Error-stopped */
#define RIO_PORT_N_ERR_STS_PW_PEND 0x00000010 /* Port-Write Pending */
+#define RIO_PORT_N_ERR_STS_PORT_UA 0x00000008 /* Port Unavailable */
#define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004
#define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002
#define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001
-#define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20)
+#define RIO_PORT_N_CTL_CSR(n, m) (0x5c + (n) * (0x20 * (m)))
#define RIO_PORT_N_CTL_PWIDTH 0xc0000000
#define RIO_PORT_N_CTL_PWIDTH_1 0x00000000
#define RIO_PORT_N_CTL_PWIDTH_4 0x40000000
#define RIO_PORT_N_CTL_IPW 0x38000000 /* Initialized Port Width */
#define RIO_PORT_N_CTL_P_TYP_SER 0x00000001
#define RIO_PORT_N_CTL_LOCKOUT 0x00000002
-#define RIO_PORT_N_CTL_EN_RX_SER 0x00200000
-#define RIO_PORT_N_CTL_EN_TX_SER 0x00400000
-#define RIO_PORT_N_CTL_EN_RX_PAR 0x08000000
-#define RIO_PORT_N_CTL_EN_TX_PAR 0x40000000
+#define RIO_PORT_N_CTL_EN_RX 0x00200000
+#define RIO_PORT_N_CTL_EN_TX 0x00400000
+#define RIO_PORT_N_OB_ACK_CSR(n) (0x60 + (n) * 0x40) /* Only in RM-II */
+#define RIO_PORT_N_OB_ACK_CLEAR 0x80000000
+#define RIO_PORT_N_OB_ACK_OUTSTD 0x00fff000
+#define RIO_PORT_N_OB_ACK_OUTBND 0x00000fff
+#define RIO_PORT_N_IB_ACK_CSR(n) (0x64 + (n) * 0x40) /* Only in RM-II */
+#define RIO_PORT_N_IB_ACK_INBND 0x00000fff
+
+/*
+ * Device-based helper macros for serial port register access.
+ * d - pointer to rapidio device object, n - port number
+ */
+
+#define RIO_DEV_PORT_N_MNT_REQ_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(n, d->phys_rmap))
+
+#define RIO_DEV_PORT_N_MNT_RSP_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(n, d->phys_rmap))
+
+#define RIO_DEV_PORT_N_ACK_STS_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_ACK_STS_CSR(n))
+
+#define RIO_DEV_PORT_N_CTL2_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_CTL2_CSR(n, d->phys_rmap))
+
+#define RIO_DEV_PORT_N_ERR_STS_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_ERR_STS_CSR(n, d->phys_rmap))
+
+#define RIO_DEV_PORT_N_CTL_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_CTL_CSR(n, d->phys_rmap))
+
+#define RIO_DEV_PORT_N_OB_ACK_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_OB_ACK_CSR(n))
+
+#define RIO_DEV_PORT_N_IB_ACK_CSR(d, n) \
+ (d->phys_efptr + RIO_PORT_N_IB_ACK_CSR(n))
/*
* Error Management Extensions (RapidIO 1.3+, Part 8)
@@ -268,6 +301,7 @@
/* General EM Registers (Common for all Ports) */
#define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */
+#define RIO_EM_EMHS_CAR 0x004 /* EM Functionality CAR */
#define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */
#define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */
#define REM_LTL_ERR_ILLTRAN 0x08000000 /* Illegal Transaction decode */
@@ -278,15 +312,33 @@
#define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */
#define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */
#define RIO_EM_LTL_CTRL_CAP 0x01c /* Logical/Transport Layer Control Capture CSR */
+#define RIO_EM_LTL_DID32_CAP 0x020 /* Logical/Transport Layer Dev32 DestID Capture CSR */
+#define RIO_EM_LTL_SID32_CAP 0x024 /* Logical/Transport Layer Dev32 source ID Capture CSR */
#define RIO_EM_PW_TGT_DEVID 0x028 /* Port-write Target deviceID CSR */
+#define RIO_EM_PW_TGT_DEVID_D16M 0xff000000 /* Port-write Target DID16 MSB */
+#define RIO_EM_PW_TGT_DEVID_D8 0x00ff0000 /* Port-write Target DID16 LSB or DID8 */
+#define RIO_EM_PW_TGT_DEVID_DEV16 0x00008000 /* Port-write Target DID16 LSB or DID8 */
+#define RIO_EM_PW_TGT_DEVID_DEV32 0x00004000 /* Port-write Target DID16 LSB or DID8 */
#define RIO_EM_PKT_TTL 0x02c /* Packet Time-to-live CSR */
+#define RIO_EM_PKT_TTL_VAL 0xffff0000 /* Packet Time-to-live value */
+#define RIO_EM_PW_TGT32_DEVID 0x030 /* Port-write Dev32 Target deviceID CSR */
+#define RIO_EM_PW_TX_CTRL 0x034 /* Port-write Transmission Control CSR */
+#define RIO_EM_PW_TX_CTRL_PW_DIS 0x00000001 /* Port-write Transmission Disable bit */
/* Per-Port EM Registers */
#define RIO_EM_PN_ERR_DETECT(x) (0x040 + x*0x40) /* Port N Error Detect CSR */
#define REM_PED_IMPL_SPEC 0x80000000
+#define REM_PED_LINK_OK2U 0x40000000 /* Link OK to Uninit transition */
+#define REM_PED_LINK_UPDA 0x20000000 /* Link Uninit Packet Discard Active */
+#define REM_PED_LINK_U2OK 0x10000000 /* Link Uninit to OK transition */
#define REM_PED_LINK_TO 0x00000001
+
#define RIO_EM_PN_ERRRATE_EN(x) (0x044 + x*0x40) /* Port N Error Rate Enable CSR */
+#define RIO_EM_PN_ERRRATE_EN_OK2U 0x40000000 /* Enable notification for OK2U */
+#define RIO_EM_PN_ERRRATE_EN_UPDA 0x20000000 /* Enable notification for UPDA */
+#define RIO_EM_PN_ERRRATE_EN_U2OK 0x10000000 /* Enable notification for U2OK */
+
#define RIO_EM_PN_ATTRIB_CAP(x) (0x048 + x*0x40) /* Port N Attributes Capture CSR */
#define RIO_EM_PN_PKT_CAP_0(x) (0x04c + x*0x40) /* Port N Packet/Control Symbol Capture 0 CSR */
#define RIO_EM_PN_PKT_CAP_1(x) (0x050 + x*0x40) /* Port N Packet Capture 1 CSR */
@@ -294,5 +346,50 @@
#define RIO_EM_PN_PKT_CAP_3(x) (0x058 + x*0x40) /* Port N Packet Capture 3 CSR */
#define RIO_EM_PN_ERRRATE(x) (0x068 + x*0x40) /* Port N Error Rate CSR */
#define RIO_EM_PN_ERRRATE_TR(x) (0x06c + x*0x40) /* Port N Error Rate Threshold CSR */
+#define RIO_EM_PN_LINK_UDT(x) (0x070 + x*0x40) /* Port N Link Uninit Discard Timer CSR */
+#define RIO_EM_PN_LINK_UDT_TO 0xffffff00 /* Link Uninit Timeout value */
+
+/*
+ * Switch Routing Table Register Block ID=0x000E (RapidIO 3.0+, part 3)
+ * Register offsets are defined from beginning of the block.
+ */
+
+/* Broadcast Routing Table Control CSR */
+#define RIO_BC_RT_CTL_CSR 0x020
+#define RIO_RT_CTL_THREE_LVL 0x80000000
+#define RIO_RT_CTL_DEV32_RT_CTRL 0x40000000
+#define RIO_RT_CTL_MC_MASK_SZ 0x03000000 /* 3.0+ Part 11: Multicast */
+
+/* Broadcast Level 0 Info CSR */
+#define RIO_BC_RT_LVL0_INFO_CSR 0x030
+#define RIO_RT_L0I_NUM_GR 0xff000000
+#define RIO_RT_L0I_GR_PTR 0x00fffc00
+
+/* Broadcast Level 1 Info CSR */
+#define RIO_BC_RT_LVL1_INFO_CSR 0x034
+#define RIO_RT_L1I_NUM_GR 0xff000000
+#define RIO_RT_L1I_GR_PTR 0x00fffc00
+
+/* Broadcast Level 2 Info CSR */
+#define RIO_BC_RT_LVL2_INFO_CSR 0x038
+#define RIO_RT_L2I_NUM_GR 0xff000000
+#define RIO_RT_L2I_GR_PTR 0x00fffc00
+
+/* Per-Port Routing Table registers.
+ * Register fields defined in the broadcast section above are
+ * applicable to the corresponding registers below.
+ */
+#define RIO_SPx_RT_CTL_CSR(x) (0x040 + (0x20 * x))
+#define RIO_SPx_RT_LVL0_INFO_CSR(x) (0x50 + (0x20 * x))
+#define RIO_SPx_RT_LVL1_INFO_CSR(x) (0x54 + (0x20 * x))
+#define RIO_SPx_RT_LVL2_INFO_CSR(x) (0x58 + (0x20 * x))
+
+/* Register Formats for Routing Table Group entry.
+ * Register offsets are calculated using GR_PTR field in the corresponding
+ * table Level_N and group/entry numbers (see RapidIO 3.0+ Part 3).
+ */
+#define RIO_RT_Ln_ENTRY_IMPL_DEF 0xf0000000
+#define RIO_RT_Ln_ENTRY_RTE_VAL 0x000003ff
+#define RIO_RT_ENTRY_DROP_PKT 0x300
#endif /* LINUX_RIO_REGS_H */
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/13] powerpc/fsl_rio: apply changes for RIO spec rev 3
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (10 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 11/13] rapidio: modify for rev.3 specification changes Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:18 ` [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches Alexandre Bounine
12 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Benjamin Herrenschmidt,
Michael Ellerman, Andre van Herk, Barry Wood, linux-kernel,
linuxppc-dev
- Remove check for parallel PHY
- Set LP-Serial Register Map type
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Barry Wood <barry.wood@idt.com>
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/sysdev/fsl_rio.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 1958838..ee5b9f1 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -643,19 +643,11 @@ int fsl_rio_setup(struct platform_device *dev)
port->ops = ops;
port->priv = priv;
port->phys_efptr = 0x100;
+ port->phys_rmap = 1;
priv->regs_win = rio_regs_win;
- /* Probe the master port phy type */
ccsr = in_be32(priv->regs_win + RIO_CCSR + i*0x20);
- port->phy_type = (ccsr & 1) ? RIO_PHY_SERIAL : RIO_PHY_PARALLEL;
- if (port->phy_type == RIO_PHY_PARALLEL) {
- dev_err(&dev->dev, "RIO: Parallel PHY type, unsupported port type!\n");
- release_resource(&port->iores);
- kfree(priv);
- kfree(port);
- continue;
- }
- dev_info(&dev->dev, "RapidIO PHY type: Serial\n");
+
/* Checking the port training status */
if (in_be32((priv->regs_win + RIO_ESCSR + i*0x20)) & 1) {
dev_err(&dev->dev, "Port %d is not ready. "
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
` (11 preceding siblings ...)
2016-07-21 18:18 ` [PATCH 12/13] powerpc/fsl_rio: apply changes for RIO spec rev 3 Alexandre Bounine
@ 2016-07-21 18:18 ` Alexandre Bounine
2016-07-21 18:36 ` Andrew Morton
12 siblings, 1 reply; 21+ messages in thread
From: Alexandre Bounine @ 2016-07-21 18:18 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Add RapidIO switch driver for IDT Gen3 switch devices: RXS1632 and RXS2448.
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>
Cc: linux-kernel@vger.kernel.org
---
drivers/rapidio/switches/Kconfig | 6 +
drivers/rapidio/switches/Makefile | 1 +
drivers/rapidio/switches/idt_gen3.c | 381 +++++++++++++++++++++++++++++++++++
include/linux/rio_ids.h | 2 +
4 files changed, 390 insertions(+), 0 deletions(-)
create mode 100644 drivers/rapidio/switches/idt_gen3.c
diff --git a/drivers/rapidio/switches/Kconfig b/drivers/rapidio/switches/Kconfig
index 3458415..92767fd 100644
--- a/drivers/rapidio/switches/Kconfig
+++ b/drivers/rapidio/switches/Kconfig
@@ -22,3 +22,9 @@ config RAPIDIO_CPS_GEN2
default n
---help---
Includes support for ITD CPS Gen.2 serial RapidIO switches.
+
+config RAPIDIO_RXS_GEN3
+ tristate "IDT RXS Gen.3 SRIO switch support"
+ default n
+ ---help---
+ Includes support for ITD RXS Gen.3 serial RapidIO switches.
diff --git a/drivers/rapidio/switches/Makefile b/drivers/rapidio/switches/Makefile
index 051cc6b..6bdd54c 100644
--- a/drivers/rapidio/switches/Makefile
+++ b/drivers/rapidio/switches/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_RAPIDIO_TSI57X) += tsi57x.o
obj-$(CONFIG_RAPIDIO_CPS_XX) += idtcps.o
obj-$(CONFIG_RAPIDIO_TSI568) += tsi568.o
obj-$(CONFIG_RAPIDIO_CPS_GEN2) += idt_gen2.o
+obj-$(CONFIG_RAPIDIO_RXS_GEN3) += idt_gen3.o
diff --git a/drivers/rapidio/switches/idt_gen3.c b/drivers/rapidio/switches/idt_gen3.c
new file mode 100644
index 0000000..93fbba8
--- /dev/null
+++ b/drivers/rapidio/switches/idt_gen3.c
@@ -0,0 +1,381 @@
+/*
+ * IDT RXS Gen.3 Serial RapidIO switch family support
+ *
+ * Copyright 2016 Integrated Device Technology, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stat.h>
+#include <linux/module.h>
+#include <linux/rio.h>
+#include <linux/rio_drv.h>
+#include <linux/rio_ids.h>
+#include <linux/delay.h>
+
+#include <asm/page.h>
+#include "../rio.h"
+
+#define RIO_EM_PW_STAT 0x40020
+#define RIO_PW_CTL 0x40204
+#define RIO_PW_CTL_PW_TMR 0xffffff00
+#define RIO_PW_ROUTE 0x40208
+
+#define RIO_EM_DEV_INT_EN 0x40030
+
+#define RIO_PLM_SPx_IMP_SPEC_CTL(x) (0x10100 + (x)*0x100)
+#define RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST 0x02000000
+
+#define RIO_PLM_SPx_PW_EN(x) (0x10118 + (x)*0x100)
+#define RIO_PLM_SPx_PW_EN_OK2U 0x40000000
+#define RIO_PLM_SPx_PW_EN_LINIT 0x10000000
+
+#define RIO_BC_L2_Gn_ENTRYx_CSR(n, x) (0x31000 + (n)*0x400 + (x)*0x4)
+#define RIO_SPx_L2_Gn_ENTRYy_CSR(x, n, y) \
+ (0x51000 + (x)*0x2000 + (n)*0x400 + (y)*0x4)
+
+static int
+idtg3_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+ u16 table, u16 route_destid, u8 route_port)
+{
+ u32 rval;
+ u32 entry = route_port;
+ int err = 0;
+
+ pr_debug("RIO: %s t=0x%x did_%x to p_%x\n",
+ __func__, table, route_destid, entry);
+
+ if (route_destid > 0xFF)
+ return -EINVAL;
+
+ if (route_port == RIO_INVALID_ROUTE)
+ entry = RIO_RT_ENTRY_DROP_PKT;
+
+ if (table == RIO_GLOBAL_TABLE) {
+ /* Use broadcast register to update all per-port tables */
+ err = rio_mport_write_config_32(mport, destid, hopcount,
+ RIO_BC_L2_Gn_ENTRYx_CSR(0, route_destid),
+ entry);
+ return err;
+ }
+
+ /*
+ * Verify that specified port/table number is valid
+ */
+ err = rio_mport_read_config_32(mport, destid, hopcount,
+ RIO_SWP_INFO_CAR, &rval);
+ if (err)
+ return err;
+
+ if (table >= RIO_GET_TOTAL_PORTS(rval))
+ return -EINVAL;
+
+ err = rio_mport_write_config_32(mport, destid, hopcount,
+ RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, route_destid),
+ entry);
+ return err;
+}
+
+static int
+idtg3_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+ u16 table, u16 route_destid, u8 *route_port)
+{
+ u32 rval;
+ int err;
+
+ if (route_destid > 0xFF)
+ return -EINVAL;
+
+ err = rio_mport_read_config_32(mport, destid, hopcount,
+ RIO_SWP_INFO_CAR, &rval);
+ if (err)
+ return err;
+
+ /*
+ * This switch device does not have the dedicated global routing table.
+ * It is substituted by reading routing table of the ingress port of
+ * maintenance read requests.
+ */
+ if (table == RIO_GLOBAL_TABLE)
+ table = RIO_GET_PORT_NUM(rval);
+ else if (table >= RIO_GET_TOTAL_PORTS(rval))
+ return -EINVAL;
+
+ err = rio_mport_read_config_32(mport, destid, hopcount,
+ RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, route_destid),
+ &rval);
+ if (err)
+ return err;
+
+ if (rval == RIO_RT_ENTRY_DROP_PKT)
+ *route_port = RIO_INVALID_ROUTE;
+ else
+ *route_port = (u8)rval;
+
+ return 0;
+}
+
+static int
+idtg3_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
+ u16 table)
+{
+ u32 i;
+ u32 rval;
+ int err;
+
+ if (table == RIO_GLOBAL_TABLE) {
+ for (i = 0; i <= 0xff; i++) {
+ err = rio_mport_write_config_32(mport, destid, hopcount,
+ RIO_BC_L2_Gn_ENTRYx_CSR(0, i),
+ RIO_RT_ENTRY_DROP_PKT);
+ if (err)
+ break;
+ }
+
+ return err;
+ }
+
+ err = rio_mport_read_config_32(mport, destid, hopcount,
+ RIO_SWP_INFO_CAR, &rval);
+ if (err)
+ return err;
+
+ if (table >= RIO_GET_TOTAL_PORTS(rval))
+ return -EINVAL;
+
+ for (i = 0; i <= 0xff; i++) {
+ err = rio_mport_write_config_32(mport, destid, hopcount,
+ RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, i),
+ RIO_RT_ENTRY_DROP_PKT);
+ if (err)
+ break;
+ }
+
+ return err;
+}
+
+/*
+ * This routine performs device-specific initialization only.
+ * All standard EM configuration should be performed at upper level.
+ */
+static int
+idtg3_em_init(struct rio_dev *rdev)
+{
+ int i, tmp;
+ u32 rval;
+
+ pr_debug("RIO: %s [%d:%d]\n", __func__, rdev->destid, rdev->hopcount);
+
+ /* Disable assertion of interrupt signal */
+ rio_write_config_32(rdev, RIO_EM_DEV_INT_EN, 0);
+
+ /* Disable port-write event notifications during initialization */
+ rio_write_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TX_CTRL, 0);
+
+ /* Configure Port-Write notifications for hot-swap events */
+ tmp = RIO_GET_TOTAL_PORTS(rdev->swpinfo);
+ for (i = 0; i < tmp; i++) {
+
+ rio_read_config_32(rdev,
+ RIO_DEV_PORT_N_ERR_STS_CSR(rdev, i),
+ &rval);
+ if (rval & RIO_PORT_N_ERR_STS_PORT_UA)
+ continue;
+
+ /* Clear events signaled before enabling notification */
+ rio_write_config_32(rdev,
+ rdev->em_efptr + RIO_EM_PN_ERR_DETECT(i), 0);
+
+ /* Enable event notifications */
+ rio_write_config_32(rdev,
+ rdev->em_efptr + RIO_EM_PN_ERRRATE_EN(i),
+ RIO_EM_PN_ERRRATE_EN_OK2U | RIO_EM_PN_ERRRATE_EN_U2OK);
+ /* Enable port-write generation on events */
+ rio_write_config_32(rdev, RIO_PLM_SPx_PW_EN(i),
+ RIO_PLM_SPx_PW_EN_OK2U | RIO_PLM_SPx_PW_EN_LINIT);
+
+ }
+
+ /* Set Port-Write destination port */
+ tmp = RIO_GET_PORT_NUM(rdev->swpinfo);
+ rio_write_config_32(rdev, RIO_PW_ROUTE, 1 << tmp);
+
+
+ /* Enable sending port-write event notifications */
+ rio_write_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TX_CTRL, 0);
+
+ /* set TVAL = ~50us */
+ rio_write_config_32(rdev,
+ rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
+ return 0;
+}
+
+
+/*
+ * idtg3_em_handler - device-specific error handler
+ *
+ * If the link is down (PORT_UNINIT) does nothing - this is considered
+ * as link partner removal from the port.
+ *
+ * If the link is up (PORT_OK) - situation is handled as *new* device insertion.
+ * In this case ERR_STOP bits are cleared by issuing soft reset command to the
+ * reporting port. Inbound and outbound ackIDs are cleared by the reset as well.
+ * This way the port is synchronized with freshly inserted device (assuming it
+ * was reset/powered-up on insertion).
+ *
+ * TODO: This is not sufficient in a situation when a link between two devices
+ * was down and up again (e.g. cable disconnect). For that situation full ackID
+ * realignment process has to be implemented.
+ */
+static int
+idtg3_em_handler(struct rio_dev *rdev, u8 pnum)
+{
+ u32 err_status;
+ u32 rval;
+
+ rio_read_config_32(rdev,
+ RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
+ &err_status);
+
+ /* Do nothing for device/link removal */
+ if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT)
+ return 0;
+
+ /* When link is OK we have a device insertion.
+ * Request port soft reset to clear errors if they present.
+ * Inbound and outbound ackIDs will be 0 after reset.
+ */
+ if (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
+ RIO_PORT_N_ERR_STS_INP_ES)) {
+ rio_read_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), &rval);
+ rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
+ rval | RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST);
+ udelay(10);
+ rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), rval);
+ mdelay(500);
+ }
+
+ return 0;
+}
+
+static struct rio_switch_ops idtg3_switch_ops = {
+ .owner = THIS_MODULE,
+ .add_entry = idtg3_route_add_entry,
+ .get_entry = idtg3_route_get_entry,
+ .clr_table = idtg3_route_clr_table,
+ .em_init = idtg3_em_init,
+ .em_handle = idtg3_em_handler,
+};
+
+static int idtg3_probe(struct rio_dev *rdev, const struct rio_device_id *id)
+{
+ pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
+
+ spin_lock(&rdev->rswitch->lock);
+
+ if (rdev->rswitch->ops) {
+ spin_unlock(&rdev->rswitch->lock);
+ return -EINVAL;
+ }
+
+ rdev->rswitch->ops = &idtg3_switch_ops;
+
+ if (rdev->do_enum) {
+ /* Disable hierarchical routing support: Existing fabric
+ * enumeration/discovery process (see rio-scan.c) uses 8-bit
+ * flat destination ID routing only.
+ */
+ rio_write_config_32(rdev, 0x5000 + RIO_BC_RT_CTL_CSR, 0);
+ }
+
+ spin_unlock(&rdev->rswitch->lock);
+
+ return 0;
+}
+
+static void idtg3_remove(struct rio_dev *rdev)
+{
+ pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
+ spin_lock(&rdev->rswitch->lock);
+ if (rdev->rswitch->ops == &idtg3_switch_ops)
+ rdev->rswitch->ops = NULL;
+ spin_unlock(&rdev->rswitch->lock);
+}
+
+/*
+ * Gen3 switches repeat sending PW messages until a corresponding event flag
+ * is cleared. Use shutdown notification to disable generation of port-write
+ * messages if their destination node is shut down.
+ */
+static void idtg3_shutdown(struct rio_dev *rdev)
+{
+ int i;
+ u32 rval;
+ u16 destid;
+
+ /* Currently the enumerator node acts also as PW handler */
+ if (!rdev->do_enum)
+ return;
+
+ pr_debug("RIO: %s(%s)\n", __func__, rio_name(rdev));
+
+ rio_read_config_32(rdev, RIO_PW_ROUTE, &rval);
+ i = RIO_GET_PORT_NUM(rdev->swpinfo);
+
+ /* Check port-write destination port */
+ if (!((1 << i) & rval))
+ return;
+
+ /* Disable sending port-write event notifications if PW destID
+ * matches to one of the enumerator node
+ */
+ rio_read_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TGT_DEVID, &rval);
+
+ if (rval & RIO_EM_PW_TGT_DEVID_DEV16)
+ destid = rval >> 16;
+ else
+ destid = ((rval & RIO_EM_PW_TGT_DEVID_D8) >> 16);
+
+ if (rdev->net->hport->host_deviceid == destid) {
+ rio_write_config_32(rdev,
+ rdev->em_efptr + RIO_EM_PW_TX_CTRL, 0);
+ pr_debug("RIO: %s(%s) PW transmission disabled\n",
+ __func__, rio_name(rdev));
+ }
+}
+
+static struct rio_device_id idtg3_id_table[] = {
+ {RIO_DEVICE(RIO_DID_IDTRXS1632, RIO_VID_IDT)},
+ {RIO_DEVICE(RIO_DID_IDTRXS2448, RIO_VID_IDT)},
+ { 0, } /* terminate list */
+};
+
+static struct rio_driver idtg3_driver = {
+ .name = "idt_gen3",
+ .id_table = idtg3_id_table,
+ .probe = idtg3_probe,
+ .remove = idtg3_remove,
+ .shutdown = idtg3_shutdown,
+};
+
+static int __init idtg3_init(void)
+{
+ return rio_register_driver(&idtg3_driver);
+}
+
+static void __exit idtg3_exit(void)
+{
+ pr_debug("RIO: %s\n", __func__);
+ rio_unregister_driver(&idtg3_driver);
+ pr_debug("RIO: %s done\n", __func__);
+}
+
+device_initcall(idtg3_init);
+module_exit(idtg3_exit);
+
+MODULE_DESCRIPTION("IDT RXS Gen.3 Serial RapidIO switch family driver");
+MODULE_AUTHOR("Integrated Device Technology, Inc.");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index 2543bc1..334c576 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -38,5 +38,7 @@
#define RIO_DID_IDTVPS1616 0x0377
#define RIO_DID_IDTSPS1616 0x0378
#define RIO_DID_TSI721 0x80ab
+#define RIO_DID_IDTRXS1632 0x80e5
+#define RIO_DID_IDTRXS2448 0x80e6
#endif /* LINUX_RIO_IDS_H */
--
1.7.8.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches
2016-07-21 18:18 ` [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches Alexandre Bounine
@ 2016-07-21 18:36 ` Andrew Morton
2016-07-21 18:48 ` Bounine, Alexandre
0 siblings, 1 reply; 21+ messages in thread
From: Andrew Morton @ 2016-07-21 18:36 UTC (permalink / raw)
To: Alexandre Bounine; +Cc: Matt Porter, Andre van Herk, Barry Wood, linux-kernel
On Thu, 21 Jul 2016 14:18:54 -0400 Alexandre Bounine <alexandre.bounine@idt.com> wrote:
> Add RapidIO switch driver for IDT Gen3 switch devices: RXS1632 and RXS2448.
>
> ...
>
> +static int
> +idtg3_em_handler(struct rio_dev *rdev, u8 pnum)
> +{
> + u32 err_status;
> + u32 rval;
> +
> + rio_read_config_32(rdev,
> + RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
> + &err_status);
> +
> + /* Do nothing for device/link removal */
> + if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT)
> + return 0;
> +
> + /* When link is OK we have a device insertion.
> + * Request port soft reset to clear errors if they present.
> + * Inbound and outbound ackIDs will be 0 after reset.
> + */
> + if (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
> + RIO_PORT_N_ERR_STS_INP_ES)) {
> + rio_read_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), &rval);
> + rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
> + rval | RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST);
> + udelay(10);
> + rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), rval);
> + mdelay(500);
Yikes, that's a very long busywait. A half-second machine freeze on
uniprocessor (if such exists ;)). We can't use msleep()?
> + }
> +
> + return 0;
> +}
>
> ...
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches
2016-07-21 18:36 ` Andrew Morton
@ 2016-07-21 18:48 ` Bounine, Alexandre
2016-07-21 19:01 ` Andrew Morton
0 siblings, 1 reply; 21+ messages in thread
From: Bounine, Alexandre @ 2016-07-21 18:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matt Porter, Andre van Herk, Wood, Barry, linux-kernel
> -----Original Message-----
> From: Andrew Morton [mailto:akpm@linux-foundation.org]
> Sent: Thursday, July 21, 2016 2:37 PM
> To: Bounine, Alexandre
> Cc: Matt Porter; Andre van Herk; Wood, Barry; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 13/13] rapidio/switches: add driver for IDT gen3
> switches
>
> On Thu, 21 Jul 2016 14:18:54 -0400 Alexandre Bounine
> <alexandre.bounine@idt.com> wrote:
>
> > Add RapidIO switch driver for IDT Gen3 switch devices: RXS1632 and
> RXS2448.
> >
> > ...
> >
> > +static int
> > +idtg3_em_handler(struct rio_dev *rdev, u8 pnum)
> > +{
> > + u32 err_status;
> > + u32 rval;
> > +
> > + rio_read_config_32(rdev,
> > + RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
> > + &err_status);
> > +
> > + /* Do nothing for device/link removal */
> > + if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT)
> > + return 0;
> > +
> > + /* When link is OK we have a device insertion.
> > + * Request port soft reset to clear errors if they present.
> > + * Inbound and outbound ackIDs will be 0 after reset.
> > + */
> > + if (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
> > + RIO_PORT_N_ERR_STS_INP_ES)) {
> > + rio_read_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
> &rval);
> > + rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
> > + rval | RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST);
> > + udelay(10);
> > + rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
> rval);
> > + mdelay(500);
>
> Yikes, that's a very long busywait. A half-second machine freeze on
> uniprocessor (if such exists ;)). We can't use msleep()?
>
My bad ;) No problem with msleep() at all. We just need to give enough time
for Rapidio link to get back (spec defines 500mS).
Do you want a patch on patch?
> > + }
> > +
> > + return 0;
> > +}
> >
> > ...
> >
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches
2016-07-21 18:48 ` Bounine, Alexandre
@ 2016-07-21 19:01 ` Andrew Morton
0 siblings, 0 replies; 21+ messages in thread
From: Andrew Morton @ 2016-07-21 19:01 UTC (permalink / raw)
To: Bounine, Alexandre; +Cc: Matt Porter, Andre van Herk, Wood, Barry, linux-kernel
On Thu, 21 Jul 2016 18:48:17 +0000 "Bounine, Alexandre" <Alexandre.Bounine@idt.com> wrote:
> > > + udelay(10);
> > > + rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
> > rval);
> > > + mdelay(500);
> >
> > Yikes, that's a very long busywait. A half-second machine freeze on
> > uniprocessor (if such exists ;)). We can't use msleep()?
> >
>
> My bad ;) No problem with msleep() at all. We just need to give enough time
> for Rapidio link to get back (spec defines 500mS).
> Do you want a patch on patch?
Patch on patch is good. But something tested, please ;)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/13] rapidio: modify for rev.3 specification changes
2016-07-21 18:18 ` [PATCH 11/13] rapidio: modify for rev.3 specification changes Alexandre Bounine
@ 2016-07-27 4:53 ` Michael Ellerman
2016-07-27 10:20 ` Wood, Barry
2016-07-27 19:37 ` Andrew Morton
0 siblings, 2 replies; 21+ messages in thread
From: Michael Ellerman @ 2016-07-27 4:53 UTC (permalink / raw)
To: Alexandre Bounine, Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Alexandre Bounine <alexandre.bounine@idt.com> writes:
> 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.
>
> 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>
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/rapidio/devices/rio_mport_cdev.c | 2 +-
> drivers/rapidio/devices/tsi721.c | 8 +-
> drivers/rapidio/rio-scan.c | 74 +++----------
> drivers/rapidio/rio.c | 149 ++++++++++++++-------------
> drivers/rapidio/rio.h | 2 +-
> drivers/rapidio/switches/tsi57x.c | 26 ++---
> include/linux/rio.h | 11 +--
> include/linux/rio_regs.h | 167 +++++++++++++++++++++++------
> 8 files changed, 248 insertions(+), 191 deletions(-)
This is breaking the build for me on powerpc, for
corenet64_smp_defconfig at least.
eg.
http://kisskb.ellerman.id.au/kisskb/buildresult/12750751/
Commit: Add linux-next specific files for 20160722
13123042d0dbf7635f052efc2ae69fd9af624f1d
Compiler: powerpc-linux-gcc (GCC) 4.6.3
Possible errors
---------------
arch/powerpc/sysdev/fsl_rio.c:702:11: error: 'struct rio_mport' has no member named 'phy_type'
arch/powerpc/sysdev/fsl_rio.c:702:25: error: 'RIO_PHY_SERIAL' undeclared (first use in this function)
make[2]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1
make[1]: *** [arch/powerpc/sysdev] Error 2
make: *** [sub-make] Error 2
cheers
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 11/13] rapidio: modify for rev.3 specification changes
2016-07-27 4:53 ` Michael Ellerman
@ 2016-07-27 10:20 ` Wood, Barry
2016-07-27 19:37 ` Andrew Morton
1 sibling, 0 replies; 21+ messages in thread
From: Wood, Barry @ 2016-07-27 10:20 UTC (permalink / raw)
To: Michael Ellerman, Bounine, Alexandre, Andrew Morton
Cc: Bounine, Alexandre, Matt Porter, Andre van Herk, linux-kernel
Hi Michael,
Alex is currently on vacation, but will return August 2. He will resolve this issue at that time.
Cheers,
Barry
-----Original Message-----
From: Michael Ellerman [mailto:mpe@ellerman.id.au]
Sent: Wednesday, July 27, 2016 12:53 AM
To: Bounine, Alexandre; Andrew Morton
Cc: Bounine, Alexandre; Matt Porter; Andre van Herk; Wood, Barry; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/13] rapidio: modify for rev.3 specification changes
Alexandre Bounine <alexandre.bounine@idt.com> writes:
> 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.
>
> 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>
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/rapidio/devices/rio_mport_cdev.c | 2 +-
> drivers/rapidio/devices/tsi721.c | 8 +-
> drivers/rapidio/rio-scan.c | 74 +++----------
> drivers/rapidio/rio.c | 149 ++++++++++++++-------------
> drivers/rapidio/rio.h | 2 +-
> drivers/rapidio/switches/tsi57x.c | 26 ++---
> include/linux/rio.h | 11 +--
> include/linux/rio_regs.h | 167 +++++++++++++++++++++++------
> 8 files changed, 248 insertions(+), 191 deletions(-)
This is breaking the build for me on powerpc, for corenet64_smp_defconfig at least.
eg.
http://kisskb.ellerman.id.au/kisskb/buildresult/12750751/
Commit: Add linux-next specific files for 20160722
13123042d0dbf7635f052efc2ae69fd9af624f1d
Compiler: powerpc-linux-gcc (GCC) 4.6.3
Possible errors
---------------
arch/powerpc/sysdev/fsl_rio.c:702:11: error: 'struct rio_mport' has no member named 'phy_type'
arch/powerpc/sysdev/fsl_rio.c:702:25: error: 'RIO_PHY_SERIAL' undeclared (first use in this function)
make[2]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1
make[1]: *** [arch/powerpc/sysdev] Error 2
make: *** [sub-make] Error 2
cheers
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/13] rapidio: modify for rev.3 specification changes
2016-07-27 4:53 ` Michael Ellerman
2016-07-27 10:20 ` Wood, Barry
@ 2016-07-27 19:37 ` Andrew Morton
2016-07-28 13:52 ` Michael Ellerman
1 sibling, 1 reply; 21+ messages in thread
From: Andrew Morton @ 2016-07-27 19:37 UTC (permalink / raw)
To: Michael Ellerman
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
On Wed, 27 Jul 2016 14:53:25 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
> Alexandre Bounine <alexandre.bounine@idt.com> writes:
>
> > 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.
> >
> > 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>
> > Cc: linux-kernel@vger.kernel.org
> > ---
> > drivers/rapidio/devices/rio_mport_cdev.c | 2 +-
> > drivers/rapidio/devices/tsi721.c | 8 +-
> > drivers/rapidio/rio-scan.c | 74 +++----------
> > drivers/rapidio/rio.c | 149 ++++++++++++++-------------
> > drivers/rapidio/rio.h | 2 +-
> > drivers/rapidio/switches/tsi57x.c | 26 ++---
> > include/linux/rio.h | 11 +--
> > include/linux/rio_regs.h | 167 +++++++++++++++++++++++------
> > 8 files changed, 248 insertions(+), 191 deletions(-)
>
> This is breaking the build for me on powerpc, for
> corenet64_smp_defconfig at least.
>
> eg.
>
> http://kisskb.ellerman.id.au/kisskb/buildresult/12750751/
>
> Commit: Add linux-next specific files for 20160722
> 13123042d0dbf7635f052efc2ae69fd9af624f1d
> Compiler: powerpc-linux-gcc (GCC) 4.6.3
>
> Possible errors
> ---------------
>
> arch/powerpc/sysdev/fsl_rio.c:702:11: error: 'struct rio_mport' has no member named 'phy_type'
> arch/powerpc/sysdev/fsl_rio.c:702:25: error: 'RIO_PHY_SERIAL' undeclared (first use in this function)
> make[2]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1
> make[1]: *** [arch/powerpc/sysdev] Error 2
> make: *** [sub-make] Error 2
I'll go out on a limb and assume it's this:
--- a/arch/powerpc/sysdev/fsl_rio.c~powerpc-fsl_rio-apply-changes-for-rio-spec-rev-3-fix
+++ a/arch/powerpc/sysdev/fsl_rio.c
@@ -698,11 +698,6 @@ int fsl_rio_setup(struct platform_device
RIO_INB_ATMU_REGS_PORT2_OFFSET));
- /* Set to receive any dist ID for serial RapidIO controller. */
- if (port->phy_type == RIO_PHY_SERIAL)
- out_be32((priv->regs_win
- + RIO_ISR_AACR + i*0x80), RIO_ISR_AACR_AA);
-
/* Configure maintenance transaction window */
out_be32(&priv->maint_atmu_regs->rowbar,
port->iores.start >> 12);
_
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/13] rapidio: modify for rev.3 specification changes
2016-07-27 19:37 ` Andrew Morton
@ 2016-07-28 13:52 ` Michael Ellerman
0 siblings, 0 replies; 21+ messages in thread
From: Michael Ellerman @ 2016-07-28 13:52 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexandre Bounine, Matt Porter, Andre van Herk, Barry Wood, linux-kernel
Andrew Morton <akpm@linux-foundation.org> writes:
> On Wed, 27 Jul 2016 14:53:25 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
>> arch/powerpc/sysdev/fsl_rio.c:702:11: error: 'struct rio_mport' has no member named 'phy_type'
>> arch/powerpc/sysdev/fsl_rio.c:702:25: error: 'RIO_PHY_SERIAL' undeclared (first use in this function)
>
> I'll go out on a limb and assume it's this:
>
> --- a/arch/powerpc/sysdev/fsl_rio.c~powerpc-fsl_rio-apply-changes-for-rio-spec-rev-3-fix
> +++ a/arch/powerpc/sysdev/fsl_rio.c
> @@ -698,11 +698,6 @@ int fsl_rio_setup(struct platform_device
> RIO_INB_ATMU_REGS_PORT2_OFFSET));
>
>
> - /* Set to receive any dist ID for serial RapidIO controller. */
> - if (port->phy_type == RIO_PHY_SERIAL)
> - out_be32((priv->regs_win
> - + RIO_ISR_AACR + i*0x80), RIO_ISR_AACR_AA);
> -
Yep, thanks.
Hopefully someone somewhere is testing this on powerpc, I don't have one
of those FSL boxes. But at least it will build now.
cheers
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2016-07-28 13:52 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 18:18 [PATCH 00/13] RapidIO subsystem updates Alexandre Bounine
2016-07-21 18:18 ` [PATCH 01/13] rapidio: Remove unnecessary 0x prefixes before %pa extension uses Alexandre Bounine
2016-07-21 18:18 ` [PATCH 02/13] rapidio/documentation: fix mangled paragraph in mport_cdev Alexandre Bounine
2016-07-21 18:18 ` [PATCH 03/13] rapidio: fix return value description for dma_prep functions Alexandre Bounine
2016-07-21 18:18 ` [PATCH 04/13] rapidio/tsi721_dma: add channel mask and queue size parameters Alexandre Bounine
2016-07-21 18:18 ` [PATCH 05/13] rapidio/tsi721: add PCIe MRRS override parameter Alexandre Bounine
2016-07-21 18:18 ` [PATCH 06/13] rapidio/tsi721: add messaging mbox selector parameter Alexandre Bounine
2016-07-21 18:18 ` [PATCH 07/13] rapidio/tsi721_dma: advance queue processing from transfer submit call Alexandre Bounine
2016-07-21 18:18 ` [PATCH 08/13] rapidio: fix error handling in mbox request/release functions Alexandre Bounine
2016-07-21 18:18 ` [PATCH 09/13] rapidio/idt_gen2: fix locking warning Alexandre Bounine
2016-07-21 18:18 ` [PATCH 10/13] rapidio: change inbound window size type to u64 Alexandre Bounine
2016-07-21 18:18 ` [PATCH 11/13] rapidio: modify for rev.3 specification changes Alexandre Bounine
2016-07-27 4:53 ` Michael Ellerman
2016-07-27 10:20 ` Wood, Barry
2016-07-27 19:37 ` Andrew Morton
2016-07-28 13:52 ` Michael Ellerman
2016-07-21 18:18 ` [PATCH 12/13] powerpc/fsl_rio: apply changes for RIO spec rev 3 Alexandre Bounine
2016-07-21 18:18 ` [PATCH 13/13] rapidio/switches: add driver for IDT gen3 switches Alexandre Bounine
2016-07-21 18:36 ` Andrew Morton
2016-07-21 18:48 ` Bounine, Alexandre
2016-07-21 19:01 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.