Date: Fri, 24 Mar 2017 14:37:13 -0500 From: Karl Denninger <karl@denninger.net> To: Oleksandr Tymoshenko <gonzo@bluezbox.com> Cc: "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: i2c on Pi3? Message-ID: <e2a42066-c2f8-107d-b436-185c8a197ede@denninger.net> In-Reply-To: <20170324185652.GA65910@bluezbox.com> References: <0b83d41a-1a9e-28cc-6ecd-03e6a63a06a2@denninger.net> <DAC58CC9-9D1C-483F-B748-3BD20A8245CE@thehowies.com> <f1c3c4bb-976c-05ba-24ec-212bc9412a33@denninger.net> <20170323175342.GA55627@bluezbox.com> <843bbe39-0b74-0d27-598d-ae16aea52a37@denninger.net> <20170324185652.GA65910@bluezbox.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 3/24/2017 13:56, Oleksandr Tymoshenko wrote: > Karl Denninger (karl@denninger.net) wrote: >> On 3/23/2017 12:53, Oleksandr Tymoshenko wrote: >>> Karl Denninger (karl@denninger.net) wrote: >>>> On 3/23/2017 12:34, John Howie wrote: >>>> >>>>> Hi Karl, >>>>> >>>>> I can only speak to the Raspberry Pi 2 kernel, but I2C is supported. For an example how to use it from userland, check out a project I posted on github eighteen months ago, that was for the PiFace RTC. >>>>> >>>>> https://github.com/jhowie/FreeBSDPiFaceRTC >>>>> >>>>> There are useful routines I created for working with devices on the I2C bus, which you are free to use. They are not RPI2-specific, so they should work on other boards. >>> .. skipped .. >>>> It works on the Pi2; I am using it in production. >>>> >>>> The driver appears to be /missing /in the Pi3 kernel. >>> Probably it's not enabled in DTB. Try adding this line to config.txt: >>> >>> dtparam=i2c_arm=on,spi=on >>> >> Nope, already in the base config.txt file: >> >> arm_control=0x200 >> dtparam=audio=on,i2c_arm=on,spi=on >> dtoverlay=mmc >> dtoverlay=pi3-disable-bt >> device_tree_address=0x4000 >> kernel=u-boot.bin > I just built latest HEAD, i2c driver is available in GENERIC kernel: > # dmesg | grep iic > iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 31 > on simplebus0 > iicbus0: <OFW I2C bus> on iichb0 > random: harvesting attach, 8 bytes (4 bits) from iicbus0 > random: harvesting attach, 8 bytes (4 bits) from iichb0 > > The driver itself is sys/arm/broadcom/bcm2835/bcm2835_bsc.c > > Could you run this command on your Pi3 and send output? Thanks > > sysctl -b hw.fdt.dtb | dtc -I dtb | grep -A 13 'i2c@.*{' > I have a copy of Generic with a couple of tweaks in it; I DO NOT get the iic identifiers. Here's what I have in the dtb; I will svn update and rebuild with GENERIC (don't see why the tweaks would change anything, but will try with GENERIC anyway and see if anything changes. root@rpi3:~ # sysctl -b hw.fdt.dtb | dtc -I dtb | grep -A 13 'i2c@.*{' <stdout>: Warning (unit_address_vs_reg): Node /axi/vc_mem has a reg or ranges property, but no unit name <stdout>: Warning (unit_address_vs_reg): Node /soc has a reg or ranges property, but no unit name <stdout>: Warning (unit_address_vs_reg): Node /soc/gpiomem has a reg or ranges property, but no unit name <stdout>: Warning (unit_address_vs_reg): Node /soc/vchiq has a reg or ranges property, but no unit name <stdout>: Warning (unit_address_vs_reg): Node /soc/local_intc has a reg or ranges property, but no unit name <stdout>: Warning (unit_address_vs_reg): Node /memory has a reg or ranges property, but no unit name <stdout>: Warning (avoid_default_addr_size): Relying on default #address-cells value for /axi/vc_mem <stdout>: Warning (avoid_default_addr_size): Relying on default #size-cells value for /axi/vc_mem i2c@7e205000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e205000 0x1000>; interrupts = <0x2 0x15>; clocks = <0x7 0x14>; #address-cells = <0x1>; #size-cells = <0x0>; status = "disabled"; pinctrl-names = "default"; pinctrl-0 = <0xf>; clock-frequency = <0x186a0>; phandle = <0x25>; }; -- i2c@7e804000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>; interrupts = <0x2 0x15>; clocks = <0x7 0x14>; #address-cells = <0x1>; #size-cells = <0x0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <0x13>; clock-frequency = <0x186a0>; phandle = <0x26>; }; i2c@7e805000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e805000 0x1000>; interrupts = <0x2 0x15>; clocks = <0x7 0x14>; #address-cells = <0x1>; #size-cells = <0x0>; status = "disabled"; clock-frequency = <0x186a0>; phandle = <0x14>; }; vec@7e806000 { compatible = "brcm,bcm2835-vec"; -- Karl Denninger karl@denninger.net <mailto:karl@denninger.net> /The Market Ticker/ /[S/MIME encrypted email preferred]/ [-- Attachment #2 --] 0 *H 010 `He 0 *H \0X0@=0 *H 010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA0 161218194535Z 211217194535Z0W10 UUS10UFlorida10U Cuda Systems LLC10Ukarl@denninger.net0"0 *H 0 ͍fd`1ie6";fSz`5¹/?{=Ӵowjħ_fnӴMG\ҢҖ4ib}>@mJo&mM; Q9U cj]p퐆W.2E= ^¢tzĄ'5i7_`~#dY `]R]N%R}EXzqV@[oN T>5AwYˡA"\v&YG]+($p:M,T?=mJkMљg*ym L!J[./d?W^LysD'1 +V'~{-SSX= q-f=%&V<m4BeSet| l2m 6iO{wv +aHXˈ5=~é*C!?uJr3tb'3`Oe)üLxt&3N526llU .|Cp[l? 007++0)0'+0http://cudasystems.net:88880 U0 0 `HB0U0, `HB OpenSSL Generated Certificate0U/Zi 0GhG0U#0$q}ݽʒm50U0karl@denninger.net0 *H b%X%gwq Ɂэr K[DMJ35W6 sz8d|qB2Cyw2PbV} â[!W{HD7oD.TZ'w6~g( -,]R8P{*[f<1=7jGj9铚~3f2AʺN k~@vz^j(>ͺyh2y{/9}4.45#S|<fW!.,Bss*Q+h=}l@ "q "M&6J5*,G {hɫjbNgǠ.ЃXȶ4$O.5evHlZba!4eE!x|Za1nZ5TuPvW|#G+ DZpI7S'n0 haGa@vZ e|]Cu+))vRyY100010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA=0 `He M0 *H 1 *H 0 *H 1 170324193713Z0O *H 1B@)Bg+De?\Z J}$v9:$ pzK6#3~0l *H 1_0]0 `He*0 `He0 *H 0*H 0 *H @0+0 *H (0 +710010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA=0*H 1010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA=0 *H k՚%C**v$F R~[)M_"$&y-edfF6 (!9hSoߘ "Dco;α@v1F_W]NSxĈсhob.bb (QC.,ٯzLF!uW~<mfB]g"ϛ? ybJz81Tq?Ga$kY^ t&ՖǼ'F/ciLdʘύ05?e_T`2obp>b-0TrLijtV/&tMѻA ~Bs%|"lY]VlNп#$5 Aȷ.{.pǓK_e<o oK:ɻ&=wStQFBI'?@4c_#zfPyEq 7xȂ|PRgR)MX
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e2a42066-c2f8-107d-b436-185c8a197ede>
