Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2017 16:33:47 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Karl Denninger <karl@denninger.net>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: i2c on Pi3?
Message-ID:  <CANCZdfqNe7LEP5Mkyh%2B%2BQhoN-c2iRs3KwEEMD1vT=_UycFPD%2Bw@mail.gmail.com>
In-Reply-To: <1b44d729-eb76-782f-ba8b-d727e18dfd5a@denninger.net>
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> <e2a42066-c2f8-107d-b436-185c8a197ede@denninger.net> <20170324194431.GA66320@bluezbox.com> <1b44d729-eb76-782f-ba8b-d727e18dfd5a@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 24, 2017 at 3:09 PM, Karl Denninger <karl@denninger.net> wrote:
>
>
> On 3/24/2017 14:44, Oleksandr Tymoshenko wrote:
>> Karl Denninger (karl@denninger.net) wrote:
>>> 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.
>> Looks like DTB in your firmware is different from what I have (my is
>> relatively old). Try applying this patch to your kernel:
>>
>> https://people.freebsd.org/~gonzo/arm/patches/rpi3-bcm2835-i2c.diff
>>
>
> OK, that fixed it with "device iic" added to the kernel config (which is
> NOT in GENERIC)
>
> Can we get that one-liner committed in -HEAD and "device iic" added to
> GENERIC?  (There's no particular reason for it not to be there I don't
> think.... without it the device nodes do not get set up and while the
> device might be recognized getting to it is a bit of a problem!)

It's in the 'arm' GENERIC kernel, but not in arm64. Since you report
it works, I've just added it in r315918.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqNe7LEP5Mkyh%2B%2BQhoN-c2iRs3KwEEMD1vT=_UycFPD%2Bw>