Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 May 2021 20:40:38 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Mark Murray <markm@freebsd.org>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: I2C/IIC working on RPI4 8GB? [gpio2 and 3 input vs. alt0 control via sysctl use is avilable]
Message-ID:  <50FE148B-5A5C-4847-8AAD-17DAD4978DFA@yahoo.com>
In-Reply-To: <38E50925-7010-48F3-94A0-DD195DC442F4@yahoo.com>
References:  <1C2DD11C-B1F6-4C2A-9AB0-5F1553520FF5@FreeBSD.org> <20210426161138.a8f44b6e1134f73a411be57d@bidouilliste.com> <CF4C4332-BB2F-47E9-B879-8EEA0E53E848@FreeBSD.org> <C4828BF2-E8B7-45D1-B0F8-5E72AF84D565@yahoo.com> <47A634E3-4938-4AFC-9341-E480CEBF67FB@FreeBSD.org> <20210428101945.67417ef8eba251dcbcb38078@bidouilliste.com> <ED9ABBBE-9B5A-4B51-806C-F91AABE39731@FreeBSD.org> <486E3EA3-EBAE-492E-B12E-E72E3E3E7B6A@FreeBSD.org> <A10EA46D-6FE5-4FCD-895C-5A08A974D6DB@yahoo.com> <E9098242-5ED4-401B-9D46-E11A214A0E2F@FreeBSD.org> <F38325DB-DC0E-44F8-A256-A5D6A23925D0@googlemail.com> <501CB1C0-73D4-4BEF-A1E6-1F13C02EFA42@FreeBSD.org> <D205D9F9-8A4D-433B-9AAA-8904850AF787@yahoo.com> <8CBBAE44-E736-4DEF-BA60-4D5068D25C15@yahoo.com> <38E50925-7010-48F3-94A0-DD195DC442F4@yahoo.com>

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


On 2021-May-1, at 20:14, Mark Millard <marklmi at yahoo.com> wrote:

>=20
>=20
> On 2021-May-1, at 19:58, Mark Millard <marklmi at yahoo.com> wrote:
>=20
> On 2021-May-1, at 08:31, Mark Millard <marklmi at yahoo.com> wrote:
>=20
>> On 2021-May-1, at 04:48, Mark Murray <markm at freebsd.org> wrote:
>>=20
>>> On 30 Apr 2021, at 15:22, Klaus K=C3=BCchemann <maciphone2 at =
googlemail.com> wrote:
>>>>=20
>>>>=20
>>>> yet another useful document(at least that's what I hope to fix your =
usecase) :
>>>>=20
>>>> =
https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md=

>>>=20
>>> BINGO!!
>>>=20
>>> I added
>>>=20
>>> gpio=3D2,3=3Da0
>>>=20
>>> to my config.txt file and after a reboot,
>>>=20
>>> # i2c -f /dev/iic0 -s worked!
>>=20
>>=20
>> Cool.
>>=20
>> But it leaves me wondering what the FreeBSD equivalent
>> for setting the mode of those 2 gpio's to a0 (or other
>> alternatives) is supposed to look like (even if such
>> code would not work as things are in the implementation).
>>=20
>> (But, for me, it is idle wondering.)
>=20
> [I was given a code hint that I've not investigated yet.]
> . . .

Going more in a code exploration direction I found evidence
of sysctl for:

# sysctl dev.gpio.0.pin.3.function dev.gpio.0.pin.2.function
dev.gpio.0.pin.3.function: input
dev.gpio.0.pin.2.function: input

and for:

# sysctl dev.gpio.0.pin.3.function=3Dalt0 dev.gpio.0.pin.2.function=3Dalt0=

dev.gpio.0.pin.3.function: input -> alt0
dev.gpio.0.pin.2.function: input -> alt0

# sysctl dev.gpio.0.pin.3.function dev.gpio.0.pin.2.function
dev.gpio.0.pin.3.function: alt0
dev.gpio.0.pin.2.function: alt0

# gpioctl -f /dev/gpioc0 -l -v
pin 00: 1       pin 0<IN>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 01: 1       pin 1<IN>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 02: 1       pin 2<>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 03: 1       pin 3<>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 04: 1       pin 4<IN>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 05: 1       pin 5<IN>, =
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
. . .

So it appears that there is no need of the config.txt
way of doing it and there is both command-line and
code-internal ways of controlling the assignments (via
the internal way of initiating sysctl activity).

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50FE148B-5A5C-4847-8AAD-17DAD4978DFA>