From patchwork Fri Jan 30 09:55:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian McMenamin X-Patchwork-Id: 4714 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0U9thUl025037 for ; Fri, 30 Jan 2009 09:55:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbZA3Jzm (ORCPT ); Fri, 30 Jan 2009 04:55:42 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752383AbZA3Jzm (ORCPT ); Fri, 30 Jan 2009 04:55:42 -0500 Received: from mail-fx0-f20.google.com ([209.85.220.20]:63682 "EHLO mail-fx0-f20.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612AbZA3Jzk (ORCPT ); Fri, 30 Jan 2009 04:55:40 -0500 Received: by fxm13 with SMTP id 13so128854fxm.13 for ; Fri, 30 Jan 2009 01:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=U4/0qlGtlRkaiIGNVCq3++jixl+JTgXFOw43yrryfvY=; b=n7DAJt5DV6+JzplgI6u71wIDuvr7T6Q+wryadFOjVcCSnSwFWe4sH47SA3K+LhURJU tWs9xMjNFfHbHbpdNnObOuGtHxXCVbBy/NQag+IfbCaWgAYEdaA08WLuXetrQV5TpkKt NSnjYtMenL49WSKxgDLbDytrmEZuKGsXJ8spE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=WZnUEJvRsnBzyQXat6w9aDUBIlRto2A/tRnjDmOAEyRKTOb/e3YfuTBB9i4aP0r0vS nW3jmAQSFL/+jGDyzEelUAfJQCV6GusblFAjEApdpsTLsz0T3lwAwC1ZTkh7LVstq5sn bCTB0Eg6cWo8lhq3GcGd4rYaoH4b7Uk4RTMV4= MIME-Version: 1.0 Received: by 10.181.240.10 with SMTP id s10mr145826bkr.12.1233309338129; Fri, 30 Jan 2009 01:55:38 -0800 (PST) In-Reply-To: <793692118a2f4bdd17326e8bed6c9792.squirrel@newgolddream.dyndns.info> References: <1233186456.6734.16.camel@localhost.localdomain> <1233187069.6734.21.camel@localhost.localdomain> <20090129031341.GD31096@linux-sh.org> <3ca9ec7a13c1a13ea7be6c37bbdfdb0c.squirrel@newgolddream.dyndns.info> <793692118a2f4bdd17326e8bed6c9792.squirrel@newgolddream.dyndns.info> Date: Fri, 30 Jan 2009 09:55:38 +0000 Message-ID: <8b67d60901300155n66f86d4ch875d01cd1620409e@mail.gmail.com> Subject: Re: [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (1/3) From: Adrian McMenamin To: Adrian McMenamin Cc: Paul Mundt , Greg KH , Dmitry Torokhov , dwmw2 , linux-sh , LKML , linux-input Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 2009/1/29 Adrian McMenamin : > 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 --- @@ -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... -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;