lkml.org 
[lkml]   [2009]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (1/3)
From
2009/1/29 Adrian McMenamin <adrian@newgolddream.dyndns.info>:
> On Thu, January 29, 2009 4:43 pm, Adrian McMenamin wrote:
>> On Thu, January 29, 2009 3:13 am, Paul Mundt wrote:

>>>>
>>> Please do not abuse P2SEGADDR in this fashion. No new code should be
>>> using P2SEGADDR anyways. maple is particularly abusive in this case
>>> since
>>> it bounces back and forth between P2SEGADDR and PHYSADDR to try and
>>> ignore the fact cache flushing has to be handled.
>>>
>>> You may also wish to consider ioremap/ioremap_nocache().
>>>
>>
>> Can I just use dma_cache_sync before each dma run and then use the P1
>> address space?
>>
>
> After the dma run I mean - the cache is flushed before the run - but not
> after.
>


So I have done this:

Removing P2SEGADDR call and flushing caches
---

diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 4d9b8b3..5dca308 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -186,7 +186,7 @@ static struct mapleq *maple_allocq(struct
maple_device *mdev)
mq->recvbuf = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL);
if (!mq->recvbuf)
goto failed_p2;
- mq->recvbuf->buf = (void *)P2SEGADDR(&((mq->recvbuf->bufx)[0]));
+ mq->recvbuf->buf = &((mq->recvbuf->bufx)[0]);

return mq;

@@ -639,9 +639,11 @@ static void maple_dma_handler(struct work_struct *work)
ctrl_outl(0, MAPLE_ENABLE);
if (!list_empty(&maple_sentq)) {
list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
+ mdev = mq->dev;
recvbuf = mq->recvbuf->buf;
+ dma_cache_sync(&mdev->dev, recvbuf, 0x400,
+ DMA_FROM_DEVICE);
code = recvbuf[0];
- mdev = mq->dev;
kfree(mq->sendbuf);
list_del_init(&mq->list);
switch (code) {

Seems to work...


\
 
 \ /
  Last update: 2009-01-30 10:59    [W:0.049 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site