diff options
| author | Matt Porter <mporter@ti.com> | 2012-10-05 13:04:40 -0400 |
|---|---|---|
| committer | Sekhar Nori <nsekhar@ti.com> | 2012-10-27 06:58:32 -0400 |
| commit | 2eb2478d471e45e1d0c8bb3defbf82bf7204e13d (patch) | |
| tree | 5158b5cb3958b9f14cf89f41939da0d52242c50f | |
| parent | 76d57ce6ef6060f611c14675249b7300a3c96368 (diff) | |
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>
| -rw-r--r-- | drivers/uio/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/uio/uio_pruss.c | 24 | ||||
| -rw-r--r-- | include/linux/platform_data/uio_pruss.h | 3 |
3 files changed, 20 insertions, 8 deletions
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 6f3ea9bbc818..c48b93813fc1 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
| @@ -97,6 +97,7 @@ config UIO_NETX | |||
| 97 | config UIO_PRUSS | 97 | config UIO_PRUSS |
| 98 | tristate "Texas Instruments PRUSS driver" | 98 | tristate "Texas Instruments PRUSS driver" |
| 99 | depends on ARCH_DAVINCI_DA850 | 99 | depends on ARCH_DAVINCI_DA850 |
| 100 | select GENERIC_ALLOCATOR | ||
| 100 | help | 101 | help |
| 101 | PRUSS driver for OMAPL138/DA850/AM18XX devices | 102 | PRUSS driver for OMAPL138/DA850/AM18XX devices |
| 102 | PRUSS driver requires user space components, examples and user space | 103 | PRUSS driver requires user space components, examples and user space |
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index 33a7a273b453..f8738de342be 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <mach/sram.h> | 28 | #include <linux/genalloc.h> |
| 29 | 29 | ||
| 30 | #define DRV_NAME "pruss_uio" | 30 | #define DRV_NAME "pruss_uio" |
| 31 | #define DRV_VERSION "1.0" | 31 | #define DRV_VERSION "1.0" |
| @@ -65,10 +65,11 @@ struct uio_pruss_dev { | |||
| 65 | dma_addr_t sram_paddr; | 65 | dma_addr_t sram_paddr; |
| 66 | dma_addr_t ddr_paddr; | 66 | dma_addr_t ddr_paddr; |
| 67 | void __iomem *prussio_vaddr; | 67 | void __iomem *prussio_vaddr; |
| 68 | void *sram_vaddr; | 68 | unsigned long sram_vaddr; |
| 69 | void *ddr_vaddr; | 69 | void *ddr_vaddr; |
| 70 | unsigned int hostirq_start; | 70 | unsigned int hostirq_start; |
| 71 | unsigned int pintc_base; | 71 | unsigned int pintc_base; |
| 72 | struct gen_pool *sram_pool; | ||
| 72 | }; | 73 | }; |
| 73 | 74 | ||
| 74 | static irqreturn_t pruss_handler(int irq, struct uio_info *info) | 75 | static irqreturn_t pruss_handler(int irq, struct uio_info *info) |
| @@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev, | |||
| 106 | gdev->ddr_paddr); | 107 | gdev->ddr_paddr); |
| 107 | } | 108 | } |
| 108 | if (gdev->sram_vaddr) | 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 | kfree(gdev->info); | 113 | kfree(gdev->info); |
| 111 | clk_put(gdev->pruss_clk); | 114 | clk_put(gdev->pruss_clk); |
| 112 | kfree(gdev); | 115 | kfree(gdev); |
| @@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev) | |||
| 152 | goto out_free; | 155 | goto out_free; |
| 153 | } | 156 | } |
| 154 | 157 | ||
| 155 | gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr)); | 158 | if (pdata->sram_pool) { |
| 156 | if (!gdev->sram_vaddr) { | 159 | gdev->sram_pool = pdata->sram_pool; |
| 157 | dev_err(&dev->dev, "Could not allocate SRAM pool\n"); | 160 | gdev->sram_vaddr = |
| 158 | goto out_free; | 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 | gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, | 171 | gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, |
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h index f39140aabc6f..3d47d219827f 100644 --- a/include/linux/platform_data/uio_pruss.h +++ b/include/linux/platform_data/uio_pruss.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | /* To configure the PRUSS INTC base offset for UIO driver */ | 21 | /* To configure the PRUSS INTC base offset for UIO driver */ |
| 22 | struct uio_pruss_pdata { | 22 | struct uio_pruss_pdata { |
| 23 | u32 pintc_base; | 23 | u32 pintc_base; |
| 24 | struct gen_pool *sram_pool; | ||
| 24 | }; | 25 | }; |
| 25 | #endif /* _UIO_PRUSS_H_ */ | 26 | #endif /* _UIO_PRUSS_H_ */ |
