aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uio/uio_pruss.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/uio/uio_pruss.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'drivers/uio/uio_pruss.c')
-rw-r--r--drivers/uio/uio_pruss.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 6e2ab007fe9..e67b566e7aa 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 <linux/genalloc.h> 28#include <mach/sram.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,11 +65,10 @@ 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 unsigned long sram_vaddr; 68 void *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;
73}; 72};
74 73
75static irqreturn_t pruss_handler(int irq, struct uio_info *info) 74static irqreturn_t pruss_handler(int irq, struct uio_info *info)
@@ -107,15 +106,13 @@ static void pruss_cleanup(struct platform_device *dev,
107 gdev->ddr_paddr); 106 gdev->ddr_paddr);
108 } 107 }
109 if (gdev->sram_vaddr) 108 if (gdev->sram_vaddr)
110 gen_pool_free(gdev->sram_pool, 109 sram_free(gdev->sram_vaddr, sram_pool_sz);
111 gdev->sram_vaddr,
112 sram_pool_sz);
113 kfree(gdev->info); 110 kfree(gdev->info);
114 clk_put(gdev->pruss_clk); 111 clk_put(gdev->pruss_clk);
115 kfree(gdev); 112 kfree(gdev);
116} 113}
117 114
118static int pruss_probe(struct platform_device *dev) 115static int __devinit pruss_probe(struct platform_device *dev)
119{ 116{
120 struct uio_info *p; 117 struct uio_info *p;
121 struct uio_pruss_dev *gdev; 118 struct uio_pruss_dev *gdev;
@@ -155,17 +152,10 @@ static int pruss_probe(struct platform_device *dev)
155 goto out_free; 152 goto out_free;
156 } 153 }
157 154
158 if (pdata->sram_pool) { 155 gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
159 gdev->sram_pool = pdata->sram_pool; 156 if (!gdev->sram_vaddr) {
160 gdev->sram_vaddr = 157 dev_err(&dev->dev, "Could not allocate SRAM pool\n");
161 gen_pool_alloc(gdev->sram_pool, sram_pool_sz); 158 goto out_free;
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);
169 } 159 }
170 160
171 gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, 161 gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
@@ -219,7 +209,7 @@ out_free:
219 return ret; 209 return ret;
220} 210}
221 211
222static int pruss_remove(struct platform_device *dev) 212static int __devexit pruss_remove(struct platform_device *dev)
223{ 213{
224 struct uio_pruss_dev *gdev = platform_get_drvdata(dev); 214 struct uio_pruss_dev *gdev = platform_get_drvdata(dev);
225 215
@@ -230,14 +220,26 @@ static int pruss_remove(struct platform_device *dev)
230 220
231static struct platform_driver pruss_driver = { 221static struct platform_driver pruss_driver = {
232 .probe = pruss_probe, 222 .probe = pruss_probe,
233 .remove = pruss_remove, 223 .remove = __devexit_p(pruss_remove),
234 .driver = { 224 .driver = {
235 .name = DRV_NAME, 225 .name = DRV_NAME,
236 .owner = THIS_MODULE, 226 .owner = THIS_MODULE,
237 }, 227 },
238}; 228};
239 229
240module_platform_driver(pruss_driver); 230static int __init pruss_init_module(void)
231{
232 return platform_driver_register(&pruss_driver);
233}
234
235module_init(pruss_init_module);
236
237static void __exit pruss_exit_module(void)
238{
239 platform_driver_unregister(&pruss_driver);
240}
241
242module_exit(pruss_exit_module);
241 243
242MODULE_LICENSE("GPL v2"); 244MODULE_LICENSE("GPL v2");
243MODULE_VERSION(DRV_VERSION); 245MODULE_VERSION(DRV_VERSION);