Commit 2eb2478d471e45e1d0c8bb3defbf82bf7204e13d

Authored by Matt Porter
Committed by Sekhar Nori
1 parent 76d57ce6ef

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>

Showing 3 changed files with 20 additions and 8 deletions Side-by-side Diff

... ... @@ -97,6 +97,7 @@
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
drivers/uio/uio_pruss.c
... ... @@ -25,7 +25,7 @@
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"
32 32  
... ... @@ -65,10 +65,11 @@
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)
... ... @@ -106,7 +107,9 @@
106 107 gdev->ddr_paddr);
107 108 }
108 109 if (gdev->sram_vaddr)
109   - sram_free(gdev->sram_vaddr, sram_pool_sz);
  110 + gen_pool_free(gdev->sram_pool,
  111 + gdev->sram_vaddr,
  112 + sram_pool_sz);
110 113 kfree(gdev->info);
111 114 clk_put(gdev->pruss_clk);
112 115 kfree(gdev);
... ... @@ -152,10 +155,17 @@
152 155 goto out_free;
153 156 }
154 157  
155   - gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
156   - if (!gdev->sram_vaddr) {
157   - dev_err(&dev->dev, "Could not allocate SRAM pool\n");
158   - goto out_free;
  158 + if (pdata->sram_pool) {
  159 + gdev->sram_pool = pdata->sram_pool;
  160 + gdev->sram_vaddr =
  161 + gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
  162 + if (!gdev->sram_vaddr) {
  163 + dev_err(&dev->dev, "Could not allocate SRAM pool\n");
  164 + goto out_free;
  165 + }
  166 + gdev->sram_paddr =
  167 + gen_pool_virt_to_phys(gdev->sram_pool,
  168 + gdev->sram_vaddr);
159 169 }
160 170  
161 171 gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
include/linux/platform_data/uio_pruss.h
... ... @@ -20,7 +20,8 @@
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_ */