Date: Mon, 17 Mar 2014 09:55:45 -0300 From: Luiz Otavio O Souza <loos.br@gmail.com> To: Warner Losh <imp@bsdimp.com> Cc: freebsd-arm@freebsd.org, "freebsd-embedded@freebsd.org" <freebsd-embedded@freebsd.org> Subject: Re: FDT/OFW GPIO bus Message-ID: <CAJ8CS7pp1icV-N8P0sxnP7iHz3nSA21TQvv3x%2BgQEOd_RORBtg@mail.gmail.com> In-Reply-To: <C8E49E48-F575-466F-8036-8E57CC025ADE@bsdimp.com> References: <2D5F2707-FD55-46BB-A44F-8870B48E2BB1@gmail.com> <C8E49E48-F575-466F-8036-8E57CC025ADE@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--f46d0444ecaf21df5704f4ccf00f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Feb 7, 2014 at 1:21 AM, Warner Losh wrote: > > On Feb 6, 2014, at 11:53 AM, Luiz Otavio O Souza wrote: > >> Hello guys, >> >> Last call for alcohol^Wtest and reviews. >> >> I've finally managed to test these changes on a some FDT and non FDT sys= tems, so now it is all cleared to commit. >> >> I plan to commit these changes on the weekend unless someone objects. > > This is cool. > >> They add support to describe GPIO connections on the DTS files. It also = add the support to the in tree GPIO devices (gpioiic(4), gpioled(4)). >> >> The last patch (005-bbb-gpioled.diff) sets the gpioled(4) for the 4 on b= oard LEDs on BBB (beaglebone-black). The RPi led is already set and just ne= ed the first patch (001-ofw-gpiobus.diff) to work. >> >> The tests were done on RPi and BBB using I2C devices (two lm75 on the sa= me bus), LEDs (for gpioled(4)) and even with some non committed ethernet ov= er SPI. The I2C tests are conducted using the hardware I2C controller (when= available) and also the software big bang controller - gpioiic(4). >> >> I used the RSPRO (MIPS/ar71xx) to check for regressions without any visi= ble problem. >> >> gpioiic(4) devices can be described in DTS as follow: >> >> gpio { >> >> gpioiic { >> compatible =3D "gpioiic"; > > Linux uses 'i2c-gpio' here. Can we follow that standard rather than inven= t our own? Or at least support both? > >> gpios =3D <&gpio 17 2 0 >> &gpio 21 2 0>; >> scl =3D <0>; >> sda =3D <1>; > > Linux doesn't have these at all, it seems, since they are implicit in the= gpios property. It would be ideal if the scl and sda properties were optio= nal... > > In addition, you'll often see things like: > > i2c-gpio,sda-open-drain; > i2c-gpio,scl-open-drain; > i2c-gpio,delay-us =3D <2>; > > as well. These should be easy enough to add and shouldn't gate things. > > There's also many DTS files that don't have this as a direct child of gpi= o... But that's not strictly required. I'll cope with adding support for th= at when I get the Atmel stuff working... The first attached adds the ability to attach nodes compatible with 'i2c-gpio' and also nodes that are not direct childs of gpio controllers (tested with parts of an Atmel dts). The second patch changes the string identification for gpioiic(4) and gpioled(4) from 'gpioiic'/'gpioled' to 'freebsd,gpioiic' and 'freebsd,gpioled'. Did they look fine ? Thanks, Luiz --f46d0444ecaf21df5704f4ccf00f Content-Type: text/plain; charset=US-ASCII; name="gpioiic-linux-dts.diff" Content-Disposition: attachment; filename="gpioiic-linux-dts.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hsvr22830 SW5kZXg6IHN5cy9kZXYvZ3Bpby9ncGlvaWljLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL2Rldi9ncGlv L2dwaW9paWMuYwkocmV2aXNpb24gMjYyMTMxKQorKysgc3lzL2Rldi9ncGlvL2dwaW9paWMuYwko d29ya2luZyBjb3B5KQpAQCAtNDEsOSArNDEsOSBAQAogI2luY2x1ZGUgImdwaW9idXNfaWYuaCIK IAogI2lmZGVmIEZEVAotI2luY2x1ZGUgPGRldi9vZncvb2Z3X2J1cy5oPgorI2luY2x1ZGUgPGRl di9mZHQvZmR0X2NvbW1vbi5oPgorI2luY2x1ZGUgPGRldi9ncGlvL2dwaW9idXN2YXIuaD4KICNp bmNsdWRlIDxkZXYvb2Z3L29md19idXNfc3Vici5oPgotI2luY2x1ZGUgPGRldi9mZHQvZmR0X2Nv bW1vbi5oPgogI2Vu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3MgPSA8JkdQSU8gMyAxIDAKKyAgICAgICAgICAgICAgICAg ICAgICAgICAmR1BJTyAyIDEgMD47CisKKwkJLyogVGhpcyBpcyBhbm90aGVyIGV4YW1wbGUgb2Yg YSBncGlvaWljIGNoaWxkLiAqLworCQlncGlvaWljLWNoaWxkMCB7CisJCQljb21wYXRpYmxlID0g ImxtNzUiOworCQkJaTJjLWFkZHJlc3MgPSA8MHg0Zj47CisJCX07CisJfTsKK307CisuRWQKKy5Q cAogV2hlcmU6CiAuQmwgLXRhZyAtd2lkdGggIi5WYSBjb21wYXRpYmxlIgogLkl0IFZhIGNvbXBh dGlibGUKLVNob3VsZCBhbHdheXMgYmUgc2V0IHRvICJncGlvaWljIi4KK1Nob3VsZCBiZSBzZXQg dG8gImdwaW9paWMiIG9yICJpMmMtZ3BpbyIuCiAuSXQgVmEgZ3Bpb3MKIFRoZQogLlZhIGdwaW9z Cg== --f46d0444ecaf21df5704f4ccf00f Content-Type: text/plain; charset=US-ASCII; name="gpioiic-gpioled-freebsd-specific.diff" Content-Disposition: attachment; filename="gpioiic-gpioled-freebsd-specific.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hsvr29wf1 SW5kZXg6IHN5cy9kZXYvZ3Bpby9ncGlvbGVkLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL2Rldi9ncGlv L2dwaW9sZWQuYwkocmV2aXNpb24gMjYyMTMxKQorKysgc3lzL2Rldi9ncGlvL2dwaW9sZWQuYwko d29ya2luZyBjb3B5KQpAQCAtMTI4LDcgKzEyOCw3IEBACiAJICogbGVkcyBub2RlcyBvbiB0aGUg ZHRzLgogCSAqLwogCW1hdGNoID0gMDsKLQlpZiAob2Z3X2J1c19pc19jb21wYXRpYmxlKGRldiwg ImdwaW9sZWQiKSkKKwlpZiAob2Z3X2J1c19pc19jb21wYXRpYmxlKGRldiwgImZyZWVic2QsZ3Bp b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MtY2hpbGQwIHsKLQkJCWNvbXBhdGlibGUgPSAibG03NSI7 CisJCQljb21wYXRpYmxlID0gImZyZWVic2QsbG03NSI7CiAJCQlpMmMtYWRkcmVzcyA9IDwweDRm PjsKIAkJfTsKIAl9OwpAQCAtMTQxLDcgKzE0MSw3IEBACiBXaGVyZToKIC5CbCAtdGFnIC13aWR0 aCAiLlZhIGNvbXBhdGlibGUiCiAuSXQgVmEgY29tcGF0aWJsZQotU2hvdWxkIGJlIHNldCB0byAi Z3Bpb2lpYyIgb3IgImkyYy1ncGlvIi4KK1Nob3VsZCBiZSBzZXQgdG8gImZyZWVic2QsZ3Bpb2lp YyIgb3IgImkyYy1ncGlvIi4KIC5JdCBWYSBncGlvcwogVGhlCiAuVmEgZ3Bpb3MK --f46d0444ecaf21df5704f4ccf00f--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ8CS7pp1icV-N8P0sxnP7iHz3nSA21TQvv3x%2BgQEOd_RORBtg>