Commit 2eb2478d authored by Matt Porter's avatar Matt Porter Committed by Sekhar Nori

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: default avatarMatt Porter <mporter@ti.com>
Signed-off-by: default avatar"Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 76d57ce6
...@@ -97,6 +97,7 @@ config UIO_NETX ...@@ -97,6 +97,7 @@ config UIO_NETX
config UIO_PRUSS config UIO_PRUSS
tristate "Texas Instruments PRUSS driver" tristate "Texas Instruments PRUSS driver"
depends on ARCH_DAVINCI_DA850 depends on ARCH_DAVINCI_DA850
select GENERIC_ALLOCATOR
help help
PRUSS driver for OMAPL138/DA850/AM18XX devices PRUSS driver for OMAPL138/DA850/AM18XX devices
PRUSS driver requires user space components, examples and user space PRUSS driver requires user space components, examples and user space
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <mach/sram.h> #include <linux/genalloc.h>
#define DRV_NAME "pruss_uio" #define DRV_NAME "pruss_uio"
#define DRV_VERSION "1.0" #define DRV_VERSION "1.0"
...@@ -65,10 +65,11 @@ struct uio_pruss_dev { ...@@ -65,10 +65,11 @@ struct uio_pruss_dev {
dma_addr_t sram_paddr; dma_addr_t sram_paddr;
dma_addr_t ddr_paddr; dma_addr_t ddr_paddr;
void __iomem *prussio_vaddr; void __iomem *prussio_vaddr;
void *sram_vaddr; unsigned long sram_vaddr;
void *ddr_vaddr; void *ddr_vaddr;
unsigned int hostirq_start; unsigned int hostirq_start;
unsigned int pintc_base; unsigned int pintc_base;
struct gen_pool *sram_pool;
}; };
static irqreturn_t pruss_handler(int irq, struct uio_info *info) static irqreturn_t pruss_handler(int irq, struct uio_info *info)
...@@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev, ...@@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev,
gdev->ddr_paddr); gdev->ddr_paddr);
} }
if (gdev->sram_vaddr) if (gdev->sram_vaddr)
sram_free(gdev->sram_vaddr, sram_pool_sz); gen_pool_free(gdev->sram_pool,
gdev->sram_vaddr,
sram_pool_sz);
kfree(gdev->info); kfree(gdev->info);
clk_put(gdev->pruss_clk); clk_put(gdev->pruss_clk);
kfree(gdev); kfree(gdev);
...@@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev) ...@@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev)
goto out_free; goto out_free;
} }
gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr)); if (pdata->sram_pool) {
if (!gdev->sram_vaddr) { gdev->sram_pool = pdata->sram_pool;
dev_err(&dev->dev, "Could not allocate SRAM pool\n"); gdev->sram_vaddr =
goto out_free; gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
if (!gdev->sram_vaddr) {
dev_err(&dev->dev, "Could not allocate SRAM pool\n");
goto out_free;
}
gdev->sram_paddr =
gen_pool_virt_to_phys(gdev->sram_pool,
gdev->sram_vaddr);
} }
gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
/* To configure the PRUSS INTC base offset for UIO driver */ /* To configure the PRUSS INTC base offset for UIO driver */
struct uio_pruss_pdata { struct uio_pruss_pdata {
u32 pintc_base; u32 pintc_base;
struct gen_pool *sram_pool;
}; };
#endif /* _UIO_PRUSS_H_ */ #endif /* _UIO_PRUSS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment