diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2016-08-02 17:06:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 19:35:34 -0400 |
commit | e519685de3e44bb013d81f5ead04ac4b33c9b3a1 (patch) | |
tree | 27519f32fb0941337133f594082a7cf8882f1076 | |
parent | cb782cdd2ffffbf7fd17e4aefb20f4db5c67caeb (diff) |
rapidio/tsi721: add messaging mbox selector parameter
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.
Link: http://lkml.kernel.org/r/1469125134-16523-7-git-send-email-alexandre.bounine@idt.com
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Tested-by: Barry Wood <barry.wood@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Barry Wood <barry.wood@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/rapidio/tsi721.txt | 5 | ||||
-rw-r--r-- | 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 9c6ee3853793..cd2a2935d51d 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). | |||
46 | 0 = 128B, 1 = 256B, 2 = 512B, 3 = 1024B, 4 = 2048B and 5 = 4096B. | 46 | 0 = 128B, 1 = 256B, 2 = 512B, 3 = 1024B, 4 = 2048B and 5 = 4096B. |
47 | Default value is '-1' (= keep platform setting). | 47 | Default value is '-1' (= keep platform setting). |
48 | 48 | ||
49 | - 'mbox_sel' - RIO messaging MBOX selection mask. This is a bitmask that defines | ||
50 | messaging MBOXes are managed by this device driver. Mask bits 0 - 3 | ||
51 | correspond to MBOX0 - MBOX3. MBOX is under driver's control if the | ||
52 | corresponding bit is set to '1'. Default value is 0x0f (= all). | ||
53 | |||
49 | II. Known problems | 54 | II. Known problems |
50 | 55 | ||
51 | None. | 56 | None. |
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 85098f8973a9..8e07cd56abdc 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
@@ -46,6 +46,11 @@ static int pcie_mrrs = -1; | |||
46 | module_param(pcie_mrrs, int, S_IRUGO); | 46 | module_param(pcie_mrrs, int, S_IRUGO); |
47 | MODULE_PARM_DESC(pcie_mrrs, "PCIe MRRS override value (0...5)"); | 47 | MODULE_PARM_DESC(pcie_mrrs, "PCIe MRRS override value (0...5)"); |
48 | 48 | ||
49 | static u8 mbox_sel = 0x0f; | ||
50 | module_param(mbox_sel, byte, S_IRUGO); | ||
51 | MODULE_PARM_DESC(mbox_sel, | ||
52 | "RIO Messaging MBOX Selection Mask (default: 0x0f = all)"); | ||
53 | |||
49 | static void tsi721_omsg_handler(struct tsi721_device *priv, int ch); | 54 | static void tsi721_omsg_handler(struct tsi721_device *priv, int ch); |
50 | static void tsi721_imsg_handler(struct tsi721_device *priv, int ch); | 55 | static void tsi721_imsg_handler(struct tsi721_device *priv, int ch); |
51 | 56 | ||
@@ -1881,6 +1886,11 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, | |||
1881 | goto out; | 1886 | goto out; |
1882 | } | 1887 | } |
1883 | 1888 | ||
1889 | if ((mbox_sel & (1 << mbox)) == 0) { | ||
1890 | rc = -ENODEV; | ||
1891 | goto out; | ||
1892 | } | ||
1893 | |||
1884 | priv->omsg_ring[mbox].dev_id = dev_id; | 1894 | priv->omsg_ring[mbox].dev_id = dev_id; |
1885 | priv->omsg_ring[mbox].size = entries; | 1895 | priv->omsg_ring[mbox].size = entries; |
1886 | priv->omsg_ring[mbox].sts_rdptr = 0; | 1896 | priv->omsg_ring[mbox].sts_rdptr = 0; |
@@ -2165,6 +2175,11 @@ static int tsi721_open_inb_mbox(struct rio_mport *mport, void *dev_id, | |||
2165 | goto out; | 2175 | goto out; |
2166 | } | 2176 | } |
2167 | 2177 | ||
2178 | if ((mbox_sel & (1 << mbox)) == 0) { | ||
2179 | rc = -ENODEV; | ||
2180 | goto out; | ||
2181 | } | ||
2182 | |||
2168 | /* Initialize IB Messaging Ring */ | 2183 | /* Initialize IB Messaging Ring */ |
2169 | priv->imsg_ring[mbox].dev_id = dev_id; | 2184 | priv->imsg_ring[mbox].dev_id = dev_id; |
2170 | priv->imsg_ring[mbox].size = entries; | 2185 | priv->imsg_ring[mbox].size = entries; |