Date: Sat, 11 Aug 2018 15:21:54 +0000 (UTC) From: lyd mc <alydiomc@yahoo.com> To: "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>, Ian Lepore <ian@freebsd.org> Subject: Re: Nanopi Neo I2C Message-ID: <2122126425.5355832.1534000914963@mail.yahoo.com> In-Reply-To: <1533999888.31375.6.camel@freebsd.org> References: <165877705.5351934.1533988165694.ref@mail.yahoo.com> <165877705.5351934.1533988165694@mail.yahoo.com> <1533999888.31375.6.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Ian, The iic bus seem to be working on linux image. I can detect the device at 0= x18. root@nanopi-neo:~/prog/I2C #=C2=A0 i2c -f /dev/iic0 -s Hardware may not support START/STOP scanning; trying less-reliable read met= hod. Scanning I2C devices on /dev/iic0: <none found> some kdump output of above command:=C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2CRSTCARD,0xbfbfec64) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl 0 =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2C= START,0xbfbfec64) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl -1= errno 2 No such file or directory =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2C= STOP,0xbfbfec64) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl 0 .<snip>=C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(= 0x3,I2CRSTCARD,0xbfbfec64) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl 0 =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2C= RDWR,0xbfbfec50) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl -1= errno 2 No such file or directory =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2C= RSTCARD,0xbfbfec64) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl 0 =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2C= RDWR,0xbfbfec50) =C2=A0=C2=A0 871 i2c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 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: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 i2c@1c2ac00 { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible = =3D "allwinner,sun6i-a31-i2c"; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg =3D <0x= 1c2ac00 0x400>; =C2=A0=C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=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #address-ce= lls =3D <0x1>; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #size-cells= =3D <0x0>; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle =3D= <0x41>; Regards,Alyd On Saturday, August 11, 2018, 11:04:54 PM GMT+8, Ian Lepore <ian@freebs= d.org> 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.=C2=A0 >=20 > root@nanopi-neo:~/prog/I2C # dmesg |grep iic > iichb0: <Allwinner Integrated I2C Bus Controller> mem 0x1c2ac00- > 0x1c2afff irq 34 on simplebus0 > iicbus0: <OFW I2C bus> on iichb0 > iichb1: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b000- > 0x1c2b3ff irq 35 on simplebus0 > iicbus1: <OFW I2C bus> on iichb1 > iichb2: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b400- > 0x1c2b7ff irq 36 on simplebus0 > iicbus2: <OFW I2C bus> on iichb2 > iic0: <I2C generic I/O> on iicbus0 > iic1: <I2C generic I/O> on iicbus1 > iic2: <I2C generic I/O> on iicbus2 >=20 > kdump output: >=20 > =C2=A0 1290 mcp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 NAMI=C2=A0 "/dev/iic0" > =C2=A0 1290 mcp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 openat 3 > =C2=A0 1290 mcp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CALL=C2=A0 ioctl(0x3,I2CRDW= R,0xbfbfecd4) > =C2=A0 1290 mcp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl -1 er= rno 2 No such file or directory >=20 > This seems to work on my RPI. >=20 In this case, I wonder if the "errno 2" is not ENOENT, but rather=C2=A0IIC_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. Is the bus working in general? Do any devices show up on a scan with =C2=A0 i2c -f /dev/iic0 -s -- Ian =20 From owner-freebsd-arm@freebsd.org Sat Aug 11 15:50:37 2018 Return-Path: <owner-freebsd-arm@freebsd.org> 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 1B277107115A for <freebsd-arm@mailman.ysv.freebsd.org>; Sat, 11 Aug 2018 15:50:37 +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 9522584519; Sat, 11 Aug 2018 15:50:36 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from imac.bk.cs.huji.ac.il ([132.65.179.42]) by kabab.cs.huji.ac.il with esmtp id 1foW9i-00088Z-Hb; Sat, 11 Aug 2018 18:50:18 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Nanopi Neo I2C From: Daniel Braniss <danny@cs.huji.ac.il> In-Reply-To: <2122126425.5355832.1534000914963@mail.yahoo.com> Date: Sat, 11 Aug 2018 18:50:18 +0300 Cc: "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>, Ian Lepore <ian@freebsd.org>, eval@iptk.ru, Milan Obuch <freebsd-arm@dino.sk> Content-Transfer-Encoding: quoted-printable Message-Id: <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> To: lyd mc <alydiomc@yahoo.com> X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." <freebsd-arm.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-arm>, <mailto:freebsd-arm-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-arm/> List-Post: <mailto:freebsd-arm@freebsd.org> List-Help: <mailto:freebsd-arm-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-arm>, <mailto:freebsd-arm-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sat, 11 Aug 2018 15:50:37 -0000 > On 11 Aug 2018, at 18:21, lyd mc via freebsd-arm = <freebsd-arm@freebsd.org> 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: <none found> >=20 > some kdump output of above command: 871 i2c CALL = ioctl(0x3,I2CRSTCARD,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 > .<snip> 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 = <ian@freebsd.org> 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: <Allwinner Integrated I2C Bus Controller> mem 0x1c2ac00- >> 0x1c2afff irq 34 on simplebus0 >> iicbus0: <OFW I2C bus> on iichb0 >> iichb1: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b000- >> 0x1c2b3ff irq 35 on simplebus0 >> iicbus1: <OFW I2C bus> on iichb1 >> iichb2: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b400- >> 0x1c2b7ff irq 36 on simplebus0 >> iicbus2: <OFW I2C bus> on iichb2 >> iic0: <I2C generic I/O> on iicbus0 >> iic1: <I2C generic I/O> on iicbus1 >> iic2: <I2C generic I/O> 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 the driver has timing issues (among others :-). I=E2=80=99m cc=E2=80=99ing= the guys I got a =E2=80=98working=E2=80=99 twsi stuff=20 to see if I can pass it on. danny
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2122126425.5355832.1534000914963>