From owner-freebsd-arm@freebsd.org Sat Aug 11 15:26:32 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 6E3111070776 for ; Sat, 11 Aug 2018 15:26:32 +0000 (UTC) (envelope-from alydiomc@yahoo.com) Received: from sonic302-48.consmr.mail.ne1.yahoo.com (sonic302-48.consmr.mail.ne1.yahoo.com [66.163.186.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F31D683958 for ; Sat, 11 Aug 2018 15:26:31 +0000 (UTC) (envelope-from alydiomc@yahoo.com) X-YMail-OSG: QkzY2i8VM1mxG_D17cBGvzcjzLMKedctGQGz1DhBoFNG72n9uha5AWLm2LkjnQC BpVlexrk4SFQ34gmOEJ6MYoyQxfLArsuT1O9HG_nR8Rwf3..QH.We0tpcNPSfp2x.Zr7j9LCsDvZ LtunebdEL9sht7nczNkk18B7BdyPHzqjulPv.xK1oe0MiAeC7Ghs5SR2MLArTfFkxikVjw6HVYzZ cFNPxXasyTpdI8LGpFnIix9WqjM_FBPLl90aIdshtq6mzv7aI_65PWscGIk8eT8YarkmUjeE6HlA OIEPqFjm1eNdXlNilQqslM0EAbeQCuSpX28jX0McDyVJY_oRS27VqPWphKqPoweyocvYzWhmp6H0 AS6d9AUQ3VQFmPYj.0IJ9Uv8PKCnJmOB4RimQgcIwkyB8FCXt4KwuuMGEdwgUbXrCXKV0ej1icG8 .3fZ4ZHnfRbWFkz5xyMjPEi4TixTrN.hLziXLTEENJdrrnRt7UhZPPMhA654X57yxhRRkSRgvtZi MWYzkCzqOhlMu8Bw7q1N4P7Fk1ShKlv3991L6kv1m5ybF730s_iJqgJ88Wt4Wd8v1sz1EVOrhncS rVUe2LHMCaj_PeESwdTWCNyQfKcP7q6w84EPD_WQmxgPliHZ7TDq8vcygZofVCaqxRa3YrDkDWlA j0iRVTm1ZxtDJrYddqatkqiAKWCU.CkdTvk6SdORpOGzCNvQQS1_CM9Trr8jeumlGfPlHoFlF9D7 5STr7tB8hDsPkXzLokwDZNzXWqAgtdPqEahiKrys.Tjh2Duf6SND1JtILV8c24SdEnwvR60tTwcb fDbYb2C5B9mzpXsCYsZIUahjDuY9T9v9hNhLQt4tTpwSZFma9HE7gfNBvwTBF4cJqV.jW1VfnhGi .H_oXhDrHEPn8zf24oXS5ZLxPeWbd3rExxhi6j9JzmDEk_6R00Jx_C53r88m5FgHUdxhfl5j5ewe ZqC81PJvJBNk9K0Axq.FjU4EV6ilRMfavonIwRUP9q1iDUds.ZA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Sat, 11 Aug 2018 15:26:30 +0000 Date: Sat, 11 Aug 2018 15:21:54 +0000 (UTC) From: lyd mc To: "freebsd-arm@freebsd.org" , Ian Lepore 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> Subject: Re: Nanopi Neo I2C MIME-Version: 1.0 X-Mailer: WebService/1.1.12206 YMailNorrin Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 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: Sat, 11 Aug 2018 15:26:32 -0000 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: 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 .=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=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 interrupts = =3D <0x0 0x6 0x4>; =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 clocks =3D = <0x1d 0x3b>; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=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2=A0=C2=A0 phandle =3D= <0x41>; 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.=C2=A0 >=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 > =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: 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 ; 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 In-Reply-To: <2122126425.5355832.1534000914963@mail.yahoo.com> Date: Sat, 11 Aug 2018 18:50:18 +0300 Cc: "freebsd-arm@freebsd.org" , Ian Lepore , eval@iptk.ru, Milan Obuch 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 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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 = 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,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 > . 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 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