Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexandre Bounine and committed by
Linus Torvalds
e519685d cb782cdd

+20
+5
Documentation/rapidio/tsi721.txt
··· 46 46 0 = 128B, 1 = 256B, 2 = 512B, 3 = 1024B, 4 = 2048B and 5 = 4096B. 47 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 54 II. Known problems 50 55 51 56 None.
+15
drivers/rapidio/devices/tsi721.c
··· 46 46 module_param(pcie_mrrs, int, S_IRUGO); 47 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 54 static void tsi721_omsg_handler(struct tsi721_device *priv, int ch); 50 55 static void tsi721_imsg_handler(struct tsi721_device *priv, int ch); 51 56 ··· 1886 1881 goto out; 1887 1882 } 1888 1883 1884 + if ((mbox_sel & (1 << mbox)) == 0) { 1885 + rc = -ENODEV; 1886 + goto out; 1887 + } 1888 + 1889 1889 priv->omsg_ring[mbox].dev_id = dev_id; 1890 1890 priv->omsg_ring[mbox].size = entries; 1891 1891 priv->omsg_ring[mbox].sts_rdptr = 0; ··· 2172 2162 (entries > TSI721_IMSGD_RING_SIZE) || 2173 2163 (!is_power_of_2(entries)) || mbox >= RIO_MAX_MBOX) { 2174 2164 rc = -EINVAL; 2165 + goto out; 2166 + } 2167 + 2168 + if ((mbox_sel & (1 << mbox)) == 0) { 2169 + rc = -ENODEV; 2175 2170 goto out; 2176 2171 } 2177 2172