From owner-freebsd-arm@freebsd.org Sun Aug 12 04:53:23 2018 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 94AE21063F71 for ; Sun, 12 Aug 2018 04:53:23 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DBFCF78483; Sun, 12 Aug 2018 04:53:22 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 06e3993c; Sun, 12 Aug 2018 06:53:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=N76+2lymA7uyzcHkVtlYdJrx7hY=; b=BNOASG2fF4ziwGbx/Il8NRLofH2i 5eQsTgnowG9YrI6yFhwvKgbq1N456sRrtInsnvJlhe1bEmG85ZedPx442xjGgXH9 ZM9hmo2oTpSOW4JTjryyI4Wu+kyB2ITKaZMAVOyTY79RH5mAAm2D9JIzOFOPx0wr iqhvTBkXXiL+ipo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=oLA9GZdaMjCpGBA5OcloZ/exiGus++Bt0SANeDoOSPro1RMGI15/UZJT yVn/c5f3VHcBfxt2MYIqbEEX+z8qSKk9cltp/9nRbiUnqzRyPpk3Hx0kUFlye+mR Zf9VX8NP9JO/PASlcsDHqJ0TKinHeb+KqwjpLQyi/DoMcbIoPsM= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 1a97b10c TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sun, 12 Aug 2018 06:53:14 +0200 (CEST) Date: Sun, 12 Aug 2018 06:53:14 +0200 From: Emmanuel Vadot To: Daniel Braniss Cc: lyd mc , "freebsd-arm@freebsd.org" , Ian Lepore Subject: Re: Nanopi Neo I2C Message-Id: <20180812065314.ff83dd595460a0fadee77f59@bidouilliste.com> In-Reply-To: <5E1DB0F5-EF98-46A8-8D33-11052834E35C@cs.huji.ac.il> References: <165877705.5351934.1533988165694.ref@mail.yahoo.com> <165877705.5351934.1533988165694@mail.yahoo.com> <1533999888.31375.6.camel@freebsd.org> <2122126425.5355832.1534000914963@mail.yahoo.com> <5E1DB0F5-EF98-46A8-8D33-11052834E35C@cs.huji.ac.il> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2018 04:53:23 -0000 On Sat, 11 Aug 2018 18:50:18 +0300 Daniel Braniss wrote: >=20 >=20 > > On 11 Aug 2018, at 18:21, lyd mc via freebsd-arm wrote: > >=20 > > Hi Ian, > > The iic bus seem to be working on linux image. I can detect the device = at 0x18. > > root@nanopi-neo:~/prog/I2C # i2c -f /dev/iic0 -s > > Hardware may not support START/STOP scanning; trying less-reliable read= method. > > Scanning I2C devices on /dev/iic0: > >=20 > > some kdump output of above command: 871 i2c CALL ioctl(0x3,I2CR= STCARD,0xbfbfec64) > > 871 i2c RET ioctl 0 > > 871 i2c CALL ioctl(0x3,I2CSTART,0xbfbfec64) > > 871 i2c RET ioctl -1 errno 2 No such file or directory > > 871 i2c CALL ioctl(0x3,I2CSTOP,0xbfbfec64) > > 871 i2c RET ioctl 0 > > . 871 i2c CALL ioctl(0x3,I2CRSTCARD,0xbfbfec64) > > 871 i2c RET ioctl 0 > > 871 i2c CALL ioctl(0x3,I2CRDWR,0xbfbfec50) > > 871 i2c RET ioctl -1 errno 2 No such file or directory > > 871 i2c CALL ioctl(0x3,I2CRSTCARD,0xbfbfec64) > > 871 i2c RET ioctl 0 > > 871 i2c CALL ioctl(0x3,I2CRDWR,0xbfbfec50) > > 871 i2c RET ioctl -1 errno 2 No such file or directory > > Seems I2CRSTCARD and I2CSTOP are the only working ioctl on me. > > I activated i2c0 using below dts code: > > i2c@1c2ac00 { > >=20 > > compatible =3D "allwinner,sun6i-a31-i2c"; > > reg =3D <0x1c2ac00 0x400>; > > interrupts =3D <0x0 0x6 0x4>; > > clocks =3D <0x1d 0x3b>; > > resets =3D <0x1d 0x2e>; > > pinctrl-names =3D "default"; > > pinctrl-0 =3D <0x20>; > > status =3D "okay"; > > #address-cells =3D <0x1>; > > #size-cells =3D <0x0>; > > phandle =3D <0x41>; > >=20 > >=20 > > Regards,Alyd > > On Saturday, August 11, 2018, 11:04:54 PM GMT+8, Ian Lepore wrote: =20 > >=20 > > On Sat, 2018-08-11 at 11:49 +0000, lyd mc via freebsd-arm wrote: > >> Hi List, > >> Can you help me make I2C work in this board? > >> I can detect the controller but cannot access it through iic ioctl.=20 > >>=20 > >> root@nanopi-neo:~/prog/I2C # dmesg |grep iic > >> iichb0: mem 0x1c2ac00- > >> 0x1c2afff irq 34 on simplebus0 > >> iicbus0: on iichb0 > >> iichb1: mem 0x1c2b000- > >> 0x1c2b3ff irq 35 on simplebus0 > >> iicbus1: on iichb1 > >> iichb2: mem 0x1c2b400- > >> 0x1c2b7ff irq 36 on simplebus0 > >> iicbus2: on iichb2 > >> iic0: on iicbus0 > >> iic1: on iicbus1 > >> iic2: on iicbus2 > >>=20 > >> kdump output: > >>=20 > >> 1290 mcp NAMI "/dev/iic0" > >> 1290 mcp RET openat 3 > >> 1290 mcp CALL ioctl(0x3,I2CRDWR,0xbfbfecd4) > >> 1290 mcp RET ioctl -1 errno 2 No such file or directory > >>=20 > >> This seems to work on my RPI. > >>=20 > >=20 > > In this case, I wonder if the "errno 2" is not ENOENT, but > > rather IIC_ENOACK which has not been translated to a proper errno > > before returning. IIC_ENOACK is basically a timeout and can happen if > > the slave address is wrong, or if the pinmux is wrong so that the bus > > is electrically inactive. > >=20 > > Is the bus working in general? Do any devices show up on a scan with > >=20 > > i2c -f /dev/iic0 -s > >=20 > > -- Ian > >=20 >=20 > the driver has timing issues (among others :-). I?m cc?ing the guys I got= a ?working? twsi stuff=20 > to see if I can pass it on. What timing issue and "other issues" are you talking about ? > danny >=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 Emmanuel Vadot