From owner-freebsd-arm@FreeBSD.ORG Sat May 10 12:25:02 2014 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD7A439B; Sat, 10 May 2014 12:25:02 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 265398FE; Sat, 10 May 2014 12:25:02 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Wj6Kq-0007Om-Qe; Sat, 10 May 2014 12:25:00 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s4ACOvPO031642; Sat, 10 May 2014 06:24:57 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19wvFaFCQ2/t8L6xpHXZJI9 Subject: Re: USB isochronous traffic with Rasberry Pi [WAS: Re: USB audio device on Raspberry Pi] From: Ian Lepore To: Hans Petter Selasky In-Reply-To: <536DDA6D.7060101@selasky.org> References: <20140425154430.GA76168@utility-01.thismonkey.com> <535A8AEA.1000100@selasky.org> <20140425204134.GA458@cicely7.cicely.de> <20140430091411.GA45015@utility-01.thismonkey.com> <5360C0A7.9010407@selasky.org> <1398867266.22079.51.camel@revolution.hippie.lan> <5362638B.1080104@selasky.org> <5363C133.2000304@selasky.org> <53677CB8.5000800@selasky.org> <1399303695.22079.239.camel@revolution.hippie.lan> <1399304157.22079.243.camel@revolution.hippie.lan> <5368A93D.3070608@selasky.org> <5368AC03.8080401@selasky.org> <536CE5E9.8020408@selasky.org> <1399647986.22079.367.camel@revolution.hippie.lan> <536D0575.1040407@selasky.org> <1399661378.22079.376.camel@revolution.hippie.lan> <536DDA6D.7060101@selasky.org> Content-Type: multipart/mixed; boundary="=-krHKqv4ZbluoRwj6a33k" Date: Sat, 10 May 2014 06:24:57 -0600 Message-ID: <1399724697.22079.386.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: "freebsd-arm@freebsd.org" , Alexander Motin X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2014 12:25:02 -0000 --=-krHKqv4ZbluoRwj6a33k Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Sat, 2014-05-10 at 09:51 +0200, Hans Petter Selasky wrote: > Hi, > > I've made one more patch to the DWC OTG driver. Nice if you can test > that too. > > http://svnweb.freebsd.org/changeset/base/265806 > > BTW: I think I've found what is causing the glitches when using USB > audio devices: > > diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c > index 0490be7..de7f015 100644 > --- a/sys/arm/arm/machdep.c > +++ b/sys/arm/arm/machdep.c > @@ -423,7 +423,7 @@ cpu_est_clockrate(int cpu_id, uint64_t *rate) > void > cpu_idle(int busy) > { > - > +#if 0 > CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", > busy, curcpu); > #ifndef NO_EVENTTIMERS > @@ -442,6 +442,7 @@ cpu_idle(int busy) > #endif > CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", > busy, curcpu); > +#endif > } > > int > > > It appears that cpu_idle() is going to sleep when there are pending > interrupts, and then waking up on the next timer IRQ! Can someone > familiar with these parts of the kernel comment? > > Please try for yourself, with and without the patch above, using an USB > audio device with the RPI-B! > > Still when the console is printing, there are significant glitches too > :-) That's because the TTY layer is synchronously writing data to the > serial line. That's OK for now. > > --HPS If there's an interrupt pending when the WaitForInterrupt instruction is executed, the cpu doesn't go to sleep -- it acts like a nop. I think the problem might be that the device write that re-enables the interrupt hasn't yet made it to the device when the cpu clock stops. I don't have any usb audio gear to test with, could you please test the attached patch and see if it fixes the glitches? -- Ian --=-krHKqv4ZbluoRwj6a33k Content-Disposition: inline; filename="cpu_sleep_dsb.diff" Content-Type: text/x-patch; name="cpu_sleep_dsb.diff"; charset="us-ascii" Content-Transfer-Encoding: 7bit Index: sys/arm/arm/cpufunc_asm_arm11.S =================================================================== --- sys/arm/arm/cpufunc_asm_arm11.S (revision 265783) +++ sys/arm/arm/cpufunc_asm_arm11.S (working copy) @@ -129,6 +129,7 @@ END(arm11_drain_writebuf) ENTRY_NP(arm11_sleep) mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* Drain write buffer / DSB */ mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */ RET END(arm11_sleep) --=-krHKqv4ZbluoRwj6a33k--