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

rapidio: add outbound window support

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>

authored by

Alexandre Bounine and committed by
Linus Torvalds
93bdaca5 2ece1caf

+59
+50
drivers/rapidio/rio.c
··· 700 700 EXPORT_SYMBOL_GPL(rio_unmap_inb_region); 701 701 702 702 /** 703 + * rio_map_outb_region -- Map outbound memory region. 704 + * @mport: Master port. 705 + * @destid: destination id window points to 706 + * @rbase: RIO base address window translates to 707 + * @size: Size of the memory region 708 + * @rflags: Flags for mapping. 709 + * @local: physical address of memory region mapped 710 + * 711 + * Return: 0 -- Success. 712 + * 713 + * This function will create the mapping from RIO space to local memory. 714 + */ 715 + int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase, 716 + u32 size, u32 rflags, dma_addr_t *local) 717 + { 718 + int rc = 0; 719 + unsigned long flags; 720 + 721 + if (!mport->ops->map_outb) 722 + return -ENODEV; 723 + 724 + spin_lock_irqsave(&rio_mmap_lock, flags); 725 + rc = mport->ops->map_outb(mport, destid, rbase, size, 726 + rflags, local); 727 + spin_unlock_irqrestore(&rio_mmap_lock, flags); 728 + 729 + return rc; 730 + } 731 + EXPORT_SYMBOL_GPL(rio_map_outb_region); 732 + 733 + /** 734 + * rio_unmap_inb_region -- Unmap the inbound memory region 735 + * @mport: Master port 736 + * @destid: destination id mapping points to 737 + * @rstart: RIO base address window translates to 738 + */ 739 + void rio_unmap_outb_region(struct rio_mport *mport, u16 destid, u64 rstart) 740 + { 741 + unsigned long flags; 742 + 743 + if (!mport->ops->unmap_outb) 744 + return; 745 + 746 + spin_lock_irqsave(&rio_mmap_lock, flags); 747 + mport->ops->unmap_outb(mport, destid, rstart); 748 + spin_unlock_irqrestore(&rio_mmap_lock, flags); 749 + } 750 + EXPORT_SYMBOL_GPL(rio_unmap_outb_region); 751 + 752 + /** 703 753 * rio_mport_get_physefb - Helper function that returns register offset 704 754 * for Physical Layer Extended Features Block. 705 755 * @port: Master port to issue transaction
+5
include/linux/rio.h
··· 400 400 * @map_inb: Callback to map RapidIO address region into local memory space. 401 401 * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb(). 402 402 * @query_mport: Callback to query mport device attributes. 403 + * @map_outb: Callback to map outbound address region into local memory space. 404 + * @unmap_outb: Callback to unmap outbound RapidIO address region. 403 405 */ 404 406 struct rio_ops { 405 407 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, ··· 429 427 void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart); 430 428 int (*query_mport)(struct rio_mport *mport, 431 429 struct rio_mport_attr *attr); 430 + int (*map_outb)(struct rio_mport *mport, u16 destid, u64 rstart, 431 + u32 size, u32 flags, dma_addr_t *laddr); 432 + void (*unmap_outb)(struct rio_mport *mport, u16 destid, u64 rstart); 432 433 }; 433 434 434 435 #define RIO_RESOURCE_MEM 0x00000100
+4
include/linux/rio_drv.h
··· 369 369 extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local, 370 370 u64 rbase, u32 size, u32 rflags); 371 371 extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart); 372 + extern int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase, 373 + u32 size, u32 rflags, dma_addr_t *local); 374 + extern void rio_unmap_outb_region(struct rio_mport *mport, 375 + u16 destid, u64 rstart); 372 376 373 377 /* Port-Write management */ 374 378 extern int rio_request_inb_pwrite(struct rio_dev *,