Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jan 2019 09:09:35 +0200
From:      Daniel Braniss <danny@cs.huji.ac.il>
To:        Emmanuel Vadot <manu@bidouilliste.com>
Cc:        Per Hedeland <per@hedeland.org>, freebsd-arm@freebsd.org
Subject:   Re: i2c on RPi Zero?
Message-ID:  <DB6E425B-618C-4F92-9E6B-C6899E00EC8B@cs.huji.ac.il>
In-Reply-To: <20190106005857.baa1313ba0f70de5a2913e6d@bidouilliste.com>
References:  <229e0d36-a07b-8551-9613-0bf5748352e7@hedeland.org> <dc9441e2-9858-989e-a135-3ae37de0925b@hedeland.org> <20190105195808.GA53872@bluezbox.com> <e981729d-bb71-c74e-aaa7-86c7447b1f24@hedeland.org> <20190105215608.GA55315@bluezbox.com> <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> <d846cf54-6550-6ab6-58fd-3324f2df6543@hedeland.org> <20190106005857.baa1313ba0f70de5a2913e6d@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help


> On 6 Jan 2019, at 01:58, Emmanuel Vadot <manu@bidouilliste.com> wrote:
>=20
> On Sun, 6 Jan 2019 00:39:48 +0100
> Per Hedeland <per@hedeland.org <mailto:per@hedeland.org>> wrote:
>=20
>> On 2019-01-05 23:03, Emmanuel Vadot wrote:
>>> On Sat, 5 Jan 2019 13:56:08 -0800
>>> Oleksandr Tymoshenko <gonzo@bluezbox.com> wrote:
>>>=20
>>>> Per Hedeland (per@hedeland.org) wrote:
>>>>> On 2019-01-05 20:58, Oleksandr Tymoshenko wrote:
>>>>>> Per Hedeland (per@hedeland.org) wrote:
>>>>>>> I did a bit more testing on the Zero to see if the FreeBSD =
version
>>>>>>> mattered:
>>>>>>>=20
>>>>>>> FreeBSD-12.0-STABLE-arm-armv6-RPI-B-20190103-r342709.img - still =
no
>>>>>>> luck.
>>>>>>>=20
>>>>>>> FreeBSD-11.2-STABLE-arm-armv6-RPI-B-20190103-r342709.img - =
works!
>>>>>>> (I.e. dmesg reports as below and /dev/iic{0,1} get created - I =
haven't
>>>>>>> tested actual usage beyond having 'i2c -s' report "no devices =
found".)
>>>>>>>=20
>>>>>>> I guess that the i2c support hasn't been removed intentionally,
>>>>>>> i.e. this seems to be a regression - or is there some additional
>>>>>>> config etc required to enable it with FreeBSD-12? The iic and =
iicbus
>>>>>>> drivers appear to be built into the kernel in both 11 and 12.
>>>>>>>=20
>>>>>>> (I haven't tested FreeBSD-12 on the Pi B, but I would guess that =
the
>>>>>>> result will be the same as on the Zero, since it seems the =
hardware is
>>>>>>> the same.)
>>>>>>=20
>>>>>> There was a transition in device tree files between 11 and 12.
>>>>>> bcm2708-rpi-0-w.dtb has i2c nodes but they're disabled by =
default.
>>>>>> Try editing config.txt on FAT partition and adding following =
line:
>>>>>>=20
>>>>>> dtparam=3Di2c
>>>>>>=20
>>>>>> This should make boot firmware to enable device nodes in the =
device
>>>>>> tree blob during the boot.
>>>>>=20
>>>>> Thanks a lot! I can confirm that this makes i2c "work" on Zero =
with
>>>>> 12-RELEASE (almost) to the extent described above for 11.2-STABLE =
(it
>>>>> detects/creates only iic0, not iic1, but as far as I understand =
from
>>>>> other sources, iic0 is all that is needed for "plain B" and thus =
also
>>>>> for Zero).
>>>>>=20
>>>>> Should I file a PR for this? I assume that the i2c nodes being
>>>>> disabled is not intentional...
>>>>=20
>>>> Yes, please do. There are also other devices, that should be =
enabled by
>>>> default, like SPI.
>>>=20
>>>  Why should we enabled them by default ?
>>>  We have no correct way for switching a pin to gpio mode (you can do
>>> that with gpioctl on some system but I consider it as a bug) so if I
>>> want to use the i2c/spi/whatever pins as gpio and the default image =
set
>>> it to another function I'm stuck.
>>>  Using the rpi fundation dtb means that every settings that they set
>>> for Linux will also be set for us, so every tutorial on the web =
where
>>> people saying that you should set something in config.txt will apply =
to
>>> FreeBSD too.
>>>  The current settings aren't a bug, it's a feature (c).
>>=20
>> OK... - so your take seems to be that FreeBSD users should google for
>> the "Linux way" to (e.g.) enable i2c on RPi. I googled "enable i2c on
>> raspberry pi" now, and indeed it brought up lots of Linux stuff, but
>> unfortunately it mostly says to run 'raspi-config', which I can't =
find
>> on my FreeBSD installation (and didn't actually expect to, of =
course).
>=20
> No, my take is that FreeBSD users should be able to tweak rpi the same
> way (more of less) than the Linux users. Unfortunatly, as you pointed
> out, sometimes it's hidden via a script/binary that do it for you.
>=20
> But more important is that I don't want to enable i2c (or any other
> function on pins) if the board doesn't requires it. DTS/DTB is =
supposed
> to represent the hardware and if the hardware doesn't have i2c (or,
> again, any other stuff on some pins) there is no reason for us to
> switch by default to those functions.
>=20
>> If I explicitly add "config.txt" to the search string, I do indeed
>> find some info about what to put in that file - but of course I
>> wouldn't have done that if I didn't already know that this was the
>> file that needed to be edited...
>>=20
>> I'm all for using "standard" components (even when "standard" means
>> "Linux"), and reducing the amount of FreeBSD-specific work that you
>> and others need to put in to support FreeBSD on these "odd" systems -
>> and as a long time (Free)BSD user, I actually prefer to edit a file
>> over running some GUI tool without knowing what it does.
>>=20
>> But I really think there needs to be a bit more help directed
>> specifically at the FreeBSD user here (if there is and I just haven't
>> found it, please enlighten me). A few words (besides "configuration
>> for start.elf":-) about what config.txt is good for, and perhaps a
>> pointer to e.g.
>> =
https://www.raspberrypi.org/documentation/configuration/device-tree.md
>> (found it from your hints, thanks!), on the
>> https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi page may be
>> enough.
>=20
> The wiki probably need a lot of updates on how to use i2c/spi or
> whatever on rpi* (with dtb overlays examples etc =E2=80=A6).

yes, absolutely, but why only RPI*, there is also Allwinner and others,
so some =E2=80=98standard=E2=80=99 way should exist. It=E2=80=99s a =
moving target, fine, but some
minor doc would be nice =E2=80=A6
SMWT =E2=80=94 Sunday Morning Wishful Thinking

danny

>=20
>> And despite the whining above, I really do appreciate all your =
efforts
>> to make it possible to run FreeBSD on these systems - many thanks!
>>=20
>> --Per Hedeland
>=20
> Cheers,
>=20
> --=20
> Emmanuel Vadot <manu@bidouilliste.com <mailto:manu@bidouilliste.com>> =
<manu@freebsd.org <mailto:manu@freebsd.org>>
> _______________________________________________
> freebsd-arm@freebsd.org <mailto:freebsd-arm@freebsd.org> mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm =
<https://lists.freebsd.org/mailman/listinfo/freebsd-arm>;
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org =
<mailto:freebsd-arm-unsubscribe@freebsd.org>"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DB6E425B-618C-4F92-9E6B-C6899E00EC8B>