From owner-freebsd-arm@freebsd.org Thu Apr 25 13:29:14 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ABA3159737E for ; Thu, 25 Apr 2019 13:29:14 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A3EC9849AF for ; Thu, 25 Apr 2019 13:29:13 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: by mailman.ysv.freebsd.org (Postfix) id 67D011597378; Thu, 25 Apr 2019 13:29:13 +0000 (UTC) Delivered-To: arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07E841597376 for ; Thu, 25 Apr 2019 13:29:13 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (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 1BA55849A3; Thu, 25 Apr 2019 13:29:11 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cs.huji.ac.il; s=57791128; h=References:To:Cc:In-Reply-To:Date:Subject:Mime-Version:Content-Type:Message-Id:From; bh=ibWTu3BgWezA+KTSVrjgS3yj0EpRrRgTn2Aqn+gDC64=; b=ZxjxOtmhK6J3SN+3YxLVU6pdU7LV5WDGqNv4xcqVnJK9P7E+vzSnN5XIFuvqRuvoy8tAcJiOw3X63c4wmmDQzYbW8hVTjXk2BqeBkETRmwwcz3UaOQEWJWaiMTk3vHqKIYvWw+aLj4tSXpMmcwVMQnOIoKIcGIOBpNuQvlOjLkVRcYG2PazV2TJeKkRNiurEMDBDZuu15yhVi+qKRNCWkAY4oGB9QQr3uTuBpD2TS3Hb5QO1WgnCJ8OGpwXSG9twWfk1H4eas9NW9yc7YcYrXinglZwmlTEfV1Irz3VvKktbM5zGXGrZnqoqo3Crf/Yu7/E1SRlNmcBwtkKqKyuWWQ==; Received: from macmini.bk.cs.huji.ac.il ([132.65.179.19]) by kabab.cs.huji.ac.il with esmtp id 1hJeQr-000L96-OF; Thu, 25 Apr 2019 16:28:57 +0300 From: Daniel Braniss Message-Id: <6D8540BA-2612-4FB6-B364-5D9D6569CC46@cs.huji.ac.il> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: i2c almost working for me, was Re: i2c still not working for me Date: Thu, 25 Apr 2019 16:28:57 +0300 In-Reply-To: <20190425150142.bab9fb212c6c7704fdf950d8@bidouilliste.com> Cc: "freebsd-arm@freebsd.org" , Ian Lepore To: Emmanuel Vadot References: <12F641C3-9FAA-4A3A-BA18-A7302F3A0F5E@cs.huji.ac.il> <20190409095819.c560dbc156c46e5ca0244e3e@bidouilliste.com> <23A47048-642A-481C-B7BE-B61E55F82955@cs.huji.ac.il> <20190409171604.GA4581@bluezbox.com> <6119CE3B-6042-4DDC-82BE-B0C0C7ADA838@cs.huji.ac.il> <5D4799BC-08DF-4F3D-81A4-C2D938F4AF93@cs.huji.ac.il> <20190417222601.c037efe0cb48987c81032bac@bidouilliste.com> <64b5598e2c8c7265f89a31b1f191cb1be318788a.camel@freebsd.org> <20190419100502.5546770a5795c20e3f4fa9db@bidouilliste.com> <0FDE4A01-D79E-4AFE-BA4C-3F39C4360AF8@cs.huji.ac.il> <20190424130211.7a575f57150882eb3dfabc76@bidouilliste.com> <20190424131517.140d6d4839d2435e08b67d43@bidouilliste.com> <7554C2C1-9FC1-4945-AC1B-2EB115A22D4E@cs.huji.ac.il> <20190425150142.bab9fb212c6c7704fdf950d8@bidouilliste.com> X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: 1BA55849A3 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.954,0] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Apr 2019 13:29:14 -0000 > On 25 Apr 2019, at 16:01, Emmanuel Vadot = wrote: >=20 > On Thu, 25 Apr 2019 10:37:05 +0300 > Daniel Braniss > = wrote: >=20 >>=20 >>=20 >>> On 24 Apr 2019, at 16:06, Daniel Braniss = wrote: >>>=20 >>>=20 >>>=20 >>>> On 24 Apr 2019, at 14:15, Emmanuel Vadot = wrote: >>>>=20 >>>> On Wed, 24 Apr 2019 13:02:11 +0200 >>>> Emmanuel Vadot > wrote: >>>>=20 >>>>> On Fri, 19 Apr 2019 11:35:09 +0300 >>>>> Daniel Braniss wrote: >>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On 19 Apr 2019, at 11:05, Emmanuel Vadot = wrote: >>>>>>>=20 >>>>>>> On Fri, 19 Apr 2019 10:20:47 +0300 >>>>>>> Daniel Braniss > wrote: >>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>> On 18 Apr 2019, at 17:19, Ian Lepore wrote: >>>>>>>>>=20 >>>>>>>>> On Thu, 2019-04-18 at 10:12 +0300, Daniel Braniss wrote: >>>>>>>>>>> On 17 Apr 2019, at 23:26, Emmanuel Vadot = >>>>>>>>>>> wrote: >>>>>>>>>>>=20 >>>>>>>>>>> On Tue, 16 Apr 2019 09:16:02 +0300 >>>>>>>>>>> Daniel Braniss > >>>>>>>>>>> wrote: >>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>>> On 11 Apr 2019, at 09:56, Daniel Braniss = >>>>>>>>>>>>> wrote: >>>>>>>>>>>>>=20 >>>>>>>>>>>>> if no device is connected, I2CRDWR hangs,=20 >>>>>>>>>>>>> it also happens with i2c(8) -s, only reboot helps. >>>>>>>>>>>>>=20 >>>>>>>>>>>>> ichb1: twsi_reset: Using IIC_FASTEST/UNKNOWN mode with = speed >>>>>>>>>>>>> param=3D2a >>>>>>>>>>>>> iichb1: TWSI_WRITE: Writing 0 to 18 >>>>>>>>>>>>> iichb1: TWSI_WRITE: Writing 2a to 14 >>>>>>>>>>>>> iichb1: TWSI_WRITE: Writing 40 to c >>>>>>>>>>>>> iichb1: TWSI_WRITE: Writing c4 to c >>>>>>>>>>>>> iichb1: twsi_transfer: transmitting 2 messages >>>>>>>>>>>>> iichb1: TWSI_READ: read f8 from 10 >>>>>>>>>>>>> iichb1: twsi_transfer: status=3Df8 >>>>>>>>>>>>> iichb1: twsi_transfer: msg[0] flags: 0 >>>>>>>>>>>>> iichb1: twsi_transfer: msg[0] len: 9 >>>>>>>>>>>>> iichb1: TWSI_WRITE: Writing e4 to c >>>>=20 >>>> So looking at this is seems that the "START condition transmitted" >>>> interrupt is never triggered, I'll see to add some type of timeout >>>> around the pause_sbt. >>>=20 >>> GREAT! I was about to send you a Nanopi-neo ?,=20 >>> I might just do that if you send me an address. >>>=20 >> this patch is not that elegant, but works for me: >> Index: twsi.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- twsi.c (revision 346538) >> +++ twsi.c (working copy) >> @@ -458,8 +458,15 @@ >> if (sc->msg->len =3D=3D 1) >> sc->control_val &=3D ~TWSI_CONTROL_ACK; >> TWSI_WRITE(sc, sc->reg_control, sc->control_val | = TWSI_CONTROL_START); >> - while (sc->error =3D=3D 0 && sc->transfer !=3D 0) { >> - pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0); >> + { >> + int count =3D 10; >> + while (sc->error =3D=3D 0 && sc->transfer !=3D = 0) { >> + pause_sbt("twsi", SBT_1MS * 30, = SBT_1MS, 0); >> + if(count-- =3D=3D 0) { >> + sc->error =3D EDEADLK; >> + break; >> + } >> + } >> } >>=20 >> debugf(dev, "Done with msg[%d]\n", i); >=20 > I think that pause_sbt returns non-zero if the time has elapsed so > check this will possibly be enough. > I'm more interested on why the controller didn't triggered an > interrupt. from my signal analyser I can see that nothing is xmitted, may be this a = clue? >=20 >>> danny >>>=20 >>>>=20 >>>>>>>>>>>>> and now it?s hung >>>>>>>>>>>>=20 >>>>>>>>>>>> [?] >>>>>>>>>>>=20 >>>>>>>>>>> I don't see that on my OrangePi One or Pine64-LTS. >>>>>>>>>>=20 >>>>>>>>>> well, mine is are Nanopi Neo, maybe it?s a dts issue? >>>>>>>>>> I also have a orangepi-zero but it will take me some time to = make >>>>>>>>>> a sdcard >>>>>>>>=20 >>>>>>>> I managed to boot my OrangePi Zero, and i2c -s has no issues, = does not hang. >>>>>>>> still, with the latest (r346368) my NanoPi Neo hangs when no = i2c device is present, >>>>>>>> so what is the difference? or where can I look? >>>>>>>=20 >>>>>>> Are you using the same i2c controller on both ? >>>>>> yes, and have tested with several controllers and nanopies,=20 >>>>>>=20 >>>>>>> Could you paste somewhere the overlays or dts patches ? >>>>>> cat ./allwinner/dts/12/h3-i2c.dtso >>>>>> /dts-v1/; >>>>>> /plugin/; >>>>>>=20 >>>>>> //#include "sun8i-h3-nanopi-neo.dts" >>>>>>=20 >>>>>> / { >>>>>> compatible =3D "allwinner,sun8i-h3"; >>>>>> }; >>>>>>=20 >>>>>> &i2c0 { >>>>>> ##frequency =3D <50000>; >>>>>> status =3D "okay"; >>>>>> }; >>>>>>=20 >>>>>> &i2c1 { >>>>>> ##frequency =3D <50000>; >>>>>> status =3D "okay"; >>>>>> }; >>>>>>=20 >>>>>>=20 >>>>>=20 >>>>> And you have hang on both i2c0 and i2c1 ? >>>>> Also please note that i2c1 pins aren't routed on this PCB, I don't >>>>> think that this could/should make the i2c controller hangs but ... >>>>>=20 >>>>> --=20 >>>>> Emmanuel Vadot >>>>> _______________________________________________ >>>>> freebsd-arm@freebsd.org mailing = list >>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-arm = >>>>> To unsubscribe, send any mail to = "freebsd-arm-unsubscribe@freebsd.org = " >>>>=20 >>>>=20 >>>> --=20 >>>> Emmanuel Vadot > > >>>=20 >>> _______________________________________________ >>> freebsd-arm@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-arm >>> To unsubscribe, send any mail to = "freebsd-arm-unsubscribe@freebsd.org" >=20 >=20 > --=20 > Emmanuel Vadot > = >