From owner-freebsd-arm@FreeBSD.ORG Tue Mar 5 20:01:44 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6A58589B for ; Tue, 5 Mar 2013 20:01:44 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [88.198.91.248]) by mx1.freebsd.org (Postfix) with ESMTP id 0C62EA53 for ; Tue, 5 Mar 2013 20:01:43 +0000 (UTC) Received: from [88.198.91.248] (helo=[IPv6:::1]) by id.bluezbox.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1UCy3P-000HVY-HJ; Tue, 05 Mar 2013 12:01:41 -0800 Message-ID: <51364F20.500@bluezbox.com> Date: Tue, 05 Mar 2013 12:01:36 -0800 From: Oleksandr Tymoshenko User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: Daisuke Aoyama Subject: Re: FreeBSD/armv6z/clang on Raspberry Pi 512MB (with U-Boot + ubldr) References: <2659960079254C38ACD2F1DCBB7A1A19@ad.peach.ne.jp> <512FD3E8.4000307@bluezbox.com> <2D2EAE5B346840A49A5D99A9BFD1DA1D@ad.peach.ne.jp> In-Reply-To: <2D2EAE5B346840A49A5D99A9BFD1DA1D@ad.peach.ne.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: On 3/1/2013 12:57 AM, Daisuke Aoyama wrote: >> I'd like to thank you again for your outstanding work. >> I've just committed three patches based on your code: >> >> - Platform DMA support for SDHCI >> - DMA engine driver >> - DMA support for BCM2835 SDHCI driver > > Thank you. I checked the code and found some bug. > I don't check why bus_dma and bus_space is slow. > But using generic code is good. > > > o INFO_WAIT_RESP is cleared when reset. > o dreq is overwritten by next call. > o should reset DMA when error. > > quick fix is like this: > > > --- bcm2835_dma.c (revision 247518) > +++ bcm2835_dma.c (working copy) > @@ -199,6 +199,7 @@ > /* Reset control block */ > cb = sc->sc_dma_ch[ch].cb; > bzero(cb, sizeof(cb)); > + cb->info = INFO_WAIT_RESP; /* XXX */ > } [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 20:01:44 -0000 On 3/1/2013 12:57 AM, Daisuke Aoyama wrote: >> I'd like to thank you again for your outstanding work. >> I've just committed three patches based on your code: >> >> - Platform DMA support for SDHCI >> - DMA engine driver >> - DMA support for BCM2835 SDHCI driver > > Thank you. I checked the code and found some bug. > I don't check why bus_dma and bus_space is slow. > But using generic code is good. > > ---------------------------------------------------------------------- > o INFO_WAIT_RESP is cleared when reset. > o dreq is overwritten by next call. > o should reset DMA when error. > > quick fix is like this: > > > --- bcm2835_dma.c (revision 247518) > +++ bcm2835_dma.c (working copy) > @@ -199,6 +199,7 @@ > /* Reset control block */ > cb = sc->sc_dma_ch[ch].cb; > bzero(cb, sizeof(cb)); > + cb->info = INFO_WAIT_RESP; /* XXX */ > } Fixed > > static int > @@ -409,8 +410,10 @@ > return (-1); > > info = sc->sc_dma_ch[ch].cb->info; > - info &= ~INFO_PERMAP_MASK; > - info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK; > + if (dreq) { > + info &= ~INFO_PERMAP_MASK; > + info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK; > + } > > if (dreq) > info |= INFO_S_DREQ; > @@ -459,8 +462,10 @@ > return (-1); > > info = sc->sc_dma_ch[ch].cb->info; > - info &= ~INFO_PERMAP_MASK; > - info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK; > + if (dreq) { > + info &= ~INFO_PERMAP_MASK; > + info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK; > + } These are not really required. With current code if dreq is zero it will overwrite info bits properly while when patched - bits will be left untouched from previous setup call. > > if (dreq) > info |= INFO_D_DREQ; > @@ -615,6 +693,7 @@ > debug & DEBUG_ERROR_MASK, ch->ch); > bus_write_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch), > debug & DEBUG_ERROR_MASK); > + bcm_dma_reset(sc->sc_dev, ch->ch); > } > Fixed > if (cs & CS_INT) { > ----------------------------------------------------------------------