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

uio: uio_pruss: replace private SRAM API with genalloc

Remove the use of the private DaVinci SRAM API in favor
of genalloc. The pool to be used is provided by platform
data.

Signed-off-by: Matt Porter <mporter@ti.com>
Signed-off-by: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

authored by

Matt Porter and committed by
Sekhar Nori
2eb2478d 76d57ce6

+20 -8
+1
drivers/uio/Kconfig
··· 97 97 config UIO_PRUSS 98 98 tristate "Texas Instruments PRUSS driver" 99 99 depends on ARCH_DAVINCI_DA850 100 + select GENERIC_ALLOCATOR 100 101 help 101 102 PRUSS driver for OMAPL138/DA850/AM18XX devices 102 103 PRUSS driver requires user space components, examples and user space
+17 -7
drivers/uio/uio_pruss.c
··· 25 25 #include <linux/clk.h> 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/slab.h> 28 - #include <mach/sram.h> 28 + #include <linux/genalloc.h> 29 29 30 30 #define DRV_NAME "pruss_uio" 31 31 #define DRV_VERSION "1.0" ··· 65 65 dma_addr_t sram_paddr; 66 66 dma_addr_t ddr_paddr; 67 67 void __iomem *prussio_vaddr; 68 - void *sram_vaddr; 68 + unsigned long sram_vaddr; 69 69 void *ddr_vaddr; 70 70 unsigned int hostirq_start; 71 71 unsigned int pintc_base; 72 + struct gen_pool *sram_pool; 72 73 }; 73 74 74 75 static irqreturn_t pruss_handler(int irq, struct uio_info *info) ··· 107 106 gdev->ddr_paddr); 108 107 } 109 108 if (gdev->sram_vaddr) 110 - sram_free(gdev->sram_vaddr, sram_pool_sz); 109 + gen_pool_free(gdev->sram_pool, 110 + gdev->sram_vaddr, 111 + sram_pool_sz); 111 112 kfree(gdev->info); 112 113 clk_put(gdev->pruss_clk); 113 114 kfree(gdev); ··· 155 152 goto out_free; 156 153 } 157 154 158 - gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr)); 159 - if (!gdev->sram_vaddr) { 160 - dev_err(&dev->dev, "Could not allocate SRAM pool\n"); 161 - goto out_free; 155 + if (pdata->sram_pool) { 156 + gdev->sram_pool = pdata->sram_pool; 157 + gdev->sram_vaddr = 158 + gen_pool_alloc(gdev->sram_pool, sram_pool_sz); 159 + if (!gdev->sram_vaddr) { 160 + dev_err(&dev->dev, "Could not allocate SRAM pool\n"); 161 + goto out_free; 162 + } 163 + gdev->sram_paddr = 164 + gen_pool_virt_to_phys(gdev->sram_pool, 165 + gdev->sram_vaddr); 162 166 } 163 167 164 168 gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
+2 -1
include/linux/platform_data/uio_pruss.h
··· 20 20 21 21 /* To configure the PRUSS INTC base offset for UIO driver */ 22 22 struct uio_pruss_pdata { 23 - u32 pintc_base; 23 + u32 pintc_base; 24 + struct gen_pool *sram_pool; 24 25 }; 25 26 #endif /* _UIO_PRUSS_H_ */