rapidio: add outbound window support
authorAlexandre Bounine <alexandre.bounine@idt.com>
Tue, 22 Mar 2016 21:26:50 +0000 (14:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2016 22:36:02 +0000 (15:36 -0700)
Add RapidIO controller (mport) outbound window configuration operations.

This patch is a part of the original patch submitted by Li Yang:

   https://lists.ozlabs.org/pipermail/linuxppc-dev/2009-April/071210.html

For some reason the original part was not applied to mainline code
tree.  The inbound window mapping part has been applied later during
tsi721 mport driver submission.  Now goes the second part with
corresponding HW support.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rapidio/rio.c
include/linux/rio.h
include/linux/rio_drv.h

index 17973d3caa88721f6230cab8d8607d13d5606ae0..0dcaa660cba1cf6969adfc9980c3ee305424509a 100644 (file)
@@ -699,6 +699,56 @@ void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart)
 }
 EXPORT_SYMBOL_GPL(rio_unmap_inb_region);
 
+/**
+ * rio_map_outb_region -- Map outbound memory region.
+ * @mport: Master port.
+ * @destid: destination id window points to
+ * @rbase: RIO base address window translates to
+ * @size: Size of the memory region
+ * @rflags: Flags for mapping.
+ * @local: physical address of memory region mapped
+ *
+ * Return: 0 -- Success.
+ *
+ * This function will create the mapping from RIO space to local memory.
+ */
+int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase,
+                       u32 size, u32 rflags, dma_addr_t *local)
+{
+       int rc = 0;
+       unsigned long flags;
+
+       if (!mport->ops->map_outb)
+               return -ENODEV;
+
+       spin_lock_irqsave(&rio_mmap_lock, flags);
+       rc = mport->ops->map_outb(mport, destid, rbase, size,
+               rflags, local);
+       spin_unlock_irqrestore(&rio_mmap_lock, flags);
+
+       return rc;
+}
+EXPORT_SYMBOL_GPL(rio_map_outb_region);
+
+/**
+ * rio_unmap_inb_region -- Unmap the inbound memory region
+ * @mport: Master port
+ * @destid: destination id mapping points to
+ * @rstart: RIO base address window translates to
+ */
+void rio_unmap_outb_region(struct rio_mport *mport, u16 destid, u64 rstart)
+{
+       unsigned long flags;
+
+       if (!mport->ops->unmap_outb)
+               return;
+
+       spin_lock_irqsave(&rio_mmap_lock, flags);
+       mport->ops->unmap_outb(mport, destid, rstart);
+       spin_unlock_irqrestore(&rio_mmap_lock, flags);
+}
+EXPORT_SYMBOL_GPL(rio_unmap_outb_region);
+
 /**
  * rio_mport_get_physefb - Helper function that returns register offset
  *                      for Physical Layer Extended Features Block.
index 44f3da512c1583ad0f3324aa31dd8081d8485339..aa2323893e8d68b8156fa6b9422ac12b20dc96a6 100644 (file)
@@ -400,6 +400,8 @@ struct rio_mport_attr {
  * @map_inb: Callback to map RapidIO address region into local memory space.
  * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
  * @query_mport: Callback to query mport device attributes.
+ * @map_outb: Callback to map outbound address region into local memory space.
+ * @unmap_outb: Callback to unmap outbound RapidIO address region.
  */
 struct rio_ops {
        int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -427,6 +429,9 @@ struct rio_ops {
        void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
        int (*query_mport)(struct rio_mport *mport,
                           struct rio_mport_attr *attr);
+       int (*map_outb)(struct rio_mport *mport, u16 destid, u64 rstart,
+                       u32 size, u32 flags, dma_addr_t *laddr);
+       void (*unmap_outb)(struct rio_mport *mport, u16 destid, u64 rstart);
 };
 
 #define RIO_RESOURCE_MEM       0x00000100
index 5dff9a4cb6757be7d07b363686698d468612668e..0834264fb7f2d2411a1527601ef73bd6ddb17a60 100644 (file)
@@ -369,6 +369,10 @@ void rio_release_region(struct rio_dev *, int);
 extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
                        u64 rbase, u32 size, u32 rflags);
 extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart);
+extern int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase,
+                       u32 size, u32 rflags, dma_addr_t *local);
+extern void rio_unmap_outb_region(struct rio_mport *mport,
+                                 u16 destid, u64 rstart);
 
 /* Port-Write management */
 extern int rio_request_inb_pwrite(struct rio_dev *,
This page took 0.028689 seconds and 5 git commands to generate.