Skip to content

Commit 77a6b06

Browse files
mvduinRobertCNelson
authored andcommitted
fix some uio_pruss braindamage
1 parent 712bc64 commit 77a6b06

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

drivers/uio/uio_pruss.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@
3737
#define DRV_NAME "pruss_uio"
3838
#define DRV_VERSION "1.0"
3939

40+
/* XXX the sram pool support right now is supported for prussv1, even though
41+
* it seems to me it should be easy to support this for prussv2 as well.
42+
*/
43+
#ifdef CONFIG_ARCH_DAVINCI_DA850
4044
static int sram_pool_sz = SZ_16K;
4145
module_param(sram_pool_sz, int, 0);
4246
MODULE_PARM_DESC(sram_pool_sz, "sram pool size to allocate ");
47+
#endif
4348

4449
static int extram_pool_sz = SZ_256K;
4550
module_param(extram_pool_sz, int, 0);
@@ -69,14 +74,16 @@ MODULE_PARM_DESC(extram_pool_sz, "external ram pool size to allocate");
6974
struct uio_pruss_dev {
7075
struct uio_info *info;
7176
struct clk *pruss_clk;
72-
dma_addr_t sram_paddr;
7377
dma_addr_t ddr_paddr;
7478
void __iomem *prussio_vaddr;
75-
unsigned long sram_vaddr;
7679
void *ddr_vaddr;
7780
unsigned int hostirq_start;
7881
unsigned int pintc_base;
82+
#ifdef CONFIG_ARCH_DAVINCI_DA850
83+
dma_addr_t sram_paddr;
84+
unsigned long sram_vaddr;
7985
struct gen_pool *sram_pool;
86+
#endif
8087
};
8188

8289
static irqreturn_t pruss_handler(int irq, struct uio_info *info)
@@ -197,6 +204,18 @@ static int pruss_probe(struct platform_device *pdev)
197204
}
198205

199206

207+
/* XXX this stuff below is complete garbage:
208+
* 1. It's quite common for pruss to have no pinctrl.
209+
* 2. If the pins are to be used as fast PRU I/O then requesting
210+
* the same pins as regular gpios is a conflict (which would be
211+
* detected by the kernel if the dts bothered to declare the
212+
* gpio-to-pinctrl mapping).
213+
* 3. If you really do just want to request a bunch of regular
214+
* gpios, then use gpio-of-helper. That's what it's for.
215+
*
216+
* - Matthijs van Duin
217+
*/
218+
#if 0
200219
pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
201220
if (IS_ERR(pinctrl))
202221
dev_warn(&pdev->dev,
@@ -239,6 +258,8 @@ static int pruss_probe(struct platform_device *pdev)
239258
}
240259
}
241260
}
261+
#endif
262+
#ifdef CONFIG_ARCH_DAVINCI_DA850
242263
if (pdata && pdata->sram_pool) {
243264
gdev->sram_pool = pdata->sram_pool;
244265
gdev->sram_vaddr =
@@ -249,6 +270,7 @@ static int pruss_probe(struct platform_device *pdev)
249270
goto out_free;
250271
}
251272
}
273+
#endif
252274

253275
gdev->ddr_vaddr = dma_alloc_coherent(dev, extram_pool_sz,
254276
&(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA);
@@ -260,7 +282,7 @@ static int pruss_probe(struct platform_device *pdev)
260282
len = resource_size(regs_prussio);
261283
gdev->prussio_vaddr = ioremap(regs_prussio->start, len);
262284
if (!gdev->prussio_vaddr) {
263-
dev_err(dev, "Can't remap PRUSS I/O address range\n");
285+
dev_err(dev, "Can't remap PRUSS I/O address range\n");
264286
goto out_free;
265287
}
266288

@@ -282,6 +304,10 @@ static int pruss_probe(struct platform_device *pdev)
282304
p->mem[0].size = resource_size(regs_prussio);
283305
p->mem[0].memtype = UIO_MEM_PHYS;
284306

307+
/* oh this is nicely done... *barf*
308+
* and of course the userspace libs now hardcode these indices
309+
* - Matthijs van Duin
310+
*/
285311
#ifdef CONFIG_ARCH_DAVINCI_DA850
286312
p->mem[1].addr = gdev->sram_paddr;
287313
p->mem[1].size = sram_pool_sz;

0 commit comments

Comments
 (0)