From nobody Sat Dec 07 10:03:06 2024 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y53bf3cGJz5gr96 for ; Sat, 07 Dec 2024 10:03:10 +0000 (UTC) (envelope-from furaisanjin@gmail.com) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y53bd2jGvz4Q35 for ; Sat, 7 Dec 2024 10:03:09 +0000 (UTC) (envelope-from furaisanjin@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=MhSP1ggp; spf=pass (mx1.freebsd.org: domain of furaisanjin@gmail.com designates 2a00:1450:4864:20::635 as permitted sender) smtp.mailfrom=furaisanjin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aa549d9dffdso415682266b.2 for ; Sat, 07 Dec 2024 02:03:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733565787; x=1734170587; darn=freebsd.org; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3F42VOjgaf3xo0jT5ZzHSyM/py8y3lg3Ea5lK3NBC8s=; b=MhSP1ggpQxv8oYMOb4b94euV5UmdWq2vt2uDFWeZhP6lhz+2xtjSLpEv6cMN8o37C7 6FiYSuH1j7fOzYanD9sSHst+d5shes/1ISry31+wzymXD3gCeti4zQitLJDhQxzwfHxy hyeHQeKidq0YU8nCdAXHg8Nrq3K8OTSxHnhPK+wqdeslK7xoAys1p70zP4tPpEvpHxY5 dAIVgOan69Y8GIy7joznEknj1cUVX+0hd2e26Fzn1nepVBh8UGfn/Wmu76CsKN40w2gG Jm8dCk2j3fEJKOVLexNvEdztMA0u1Q84wcTlwvhYk77qZpgy7t2lE9P4hdq/SKVcG19Q uPcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733565787; x=1734170587; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3F42VOjgaf3xo0jT5ZzHSyM/py8y3lg3Ea5lK3NBC8s=; b=ivARiOKuKmC8GB5Dy54wQTGIOvO0fh6rYmTyWcMW4QejMIqM3xPu+wGP1jdF2G93Bd ix6YVs9C6+WBIoBpoulSwbPU615iEslrkAkTbeUuS34lHrWmYz7VdHMxJod3+HoWvqMo 9HkgYwlnUqlYNArKX6bMUsYPjfpotET+o3+C5RDz5vtqnB0gisHJ2py7QJfVPYyAHyF3 Hfw6CdMmDWxY3TxYgneFZISzJSmwXQLkmg21XMWzC6KdqoQTWxAfnuie5HVrYsVm6CUP pV5PtrUuyHpaepThFntzblOV/LnKmBr1BHW3nVMR1VN/Qp8lIacpsh4Ak91/jYff2VP8 qbcQ== X-Gm-Message-State: AOJu0YxHjvtBzkgCVXO8E/elKeSBYr/zGdyDVnMt6DFJNXU3CYa+08Ee F19WbZYtnh+QDSjUPf23jQmHsRLyA9+EfvIpcRXboWiCrcI6XR9fregdGRc+KrN+oAvIYXb1HUa RwLbC8Qnt9W8i5iSR/2ig3tEEPNUAT+74xSs= X-Gm-Gg: ASbGnctuuQEtrhXGIXe76Y8nO5r1rKfKTRgKf9d6iGo6fXWNaMTF0rfwYyg+Ai9xinP ClAl3Lu98KG5KsNcB+HlKIA4mjxQXYOtO X-Google-Smtp-Source: AGHT+IHcGfZN/948dU7HNf8dcibizVfn1uWEo8C1P4+MC2FzNZl60jpxMEoSEZS9TllZl/2cSpHx0dcDZJ/3R1xVjgo= X-Received: by 2002:a17:906:32d0:b0:aa6:1c4b:9c5b with SMTP id a640c23a62f3a-aa639fa5cfamr367218966b.7.1733565786918; Sat, 07 Dec 2024 02:03:06 -0800 (PST) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@FreeBSD.org MIME-Version: 1.0 Received: by 2002:a05:7412:4e1b:b0:139:4d0f:562f with HTTP; Sat, 7 Dec 2024 02:03:06 -0800 (PST) In-Reply-To: References: From: =?UTF-8?B?6aKo5L6G5pWj5Lq6?= Date: Sat, 7 Dec 2024 19:03:06 +0900 Message-ID: Subject: Re: DS1307 on rpi4B To: FreeBSD ARM List Content-Type: multipart/alternative; boundary="000000000000ec99a60628ab3c73" X-Spamd-Result: default: False [-3.53 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.53)[-0.534]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCPT_COUNT_ONE(0.00)[1]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::635:from] X-Rspamd-Queue-Id: 4Y53bd2jGvz4Q35 X-Spamd-Bar: --- --000000000000ec99a60628ab3c73 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I forgot mentioning the FreeBSD version. I=E2=80=99m still using 14.1. 2024=E5=B9=B412=E6=9C=887=E6=97=A5=E5=9C=9F=E6=9B=9C=E6=97=A5 =E9=A2=A8=E4= =BE=86=E6=95=A3=E4=BA=BA : > Hello all, > > I'm trying connect DS1307 on rpi4B (8M). I'm not sure how much I can rely > on the description in https://github.com/raspberrypi/firmware/tree/ > master/boot/overlays because I don't know the difference between linux > boot loader and FreeBSD one. > > I want to connect DS1307 on GPIO12/13 pin as i2c5 so I assumed i2c-rtc > could be used so that I added one line in config.txt like below. > > dtoverlay=3Di2c-rtc,ds1307,i2c5,addr=3D0x68 > > iic1 is detected at boot but it can't talk to DS1307. > > # dmesg | egrep iic\|ds1307 > iichb0: mem 0x7e804000-0x7e804fff irq 27 on > simplebus0 > iichb1: mem 0x7e205a00-0x7e205bff irq 52 on > simplebus0 > iicbus0: on iichb0 > iic0: on iicbus0 > iicbus1: on iichb1 > iic1: on iicbus1 > ds13070: at addr 0xd0 on iicbus1 > ds13070: is_dev_time_valid: cannot read from RTC: 35 > ds13070: WARNING: RTC clock stopped, check the battery. > ds13070: registered as a time-of-day clock, resolution 1.000000s > ds13070: ds1307_gettime: cannot read from RTC: 35 > ds13070: ds1307_settime: cannot write to RTC: 35 > > The command "i2c -s -v -f /dev/iic1" can't detect anything at all. The pi= n > function doesn't seem to be correct. > # sysctl -a dev.gpio.0.pin|grep 1[23] > dev.gpio.0.pin.13.function: input > dev.gpio.0.pin.12.function: input > > If I set alt5 on these pins by sysctl and change pin configuration by > gpioctl to enable internal pullup, iic1 works fine. > --- > for p in 12 13 > do > sysctl dev.gpio.0.pin.$p.function=3Dalt5 > gpioctl -c $p PU > done > i2c -s -v -f /dev/iic1 > /root/src/ds1307 -r -a 0x68 -f /dev/iic1 > --- > > I'm not familiar with dts stuff but I wrote overlay dts like this. > /dts-v1/; > /plugin/; > / { > > compatible =3D "raspberrypi,4-model-b", "brcm,bcm2711"; > fragment@0 { > target =3D <&i2c5>; > __overlay__ { > brcm,pins =3D <12 13>; > brcm,function =3D <2>; > brcm,pull =3D <2 2>; > status =3D "okay"; > }; > > }; > }; > However this doesn't work at all. How can I configure gpio12/13 for i2c5? > > Best regards, > furaisanjin > > > --000000000000ec99a60628ab3c73 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I forgot mentioning the FreeBSD version. I=E2=80=99m still using 14.1.
<= br>2024=E5=B9=B412=E6=9C=887=E6=97=A5=E5=9C=9F=E6=9B=9C=E6=97=A5 =E9=A2=A8= =E4=BE=86=E6=95=A3=E4=BA=BA <fu= raisanjin@gmail.com>:
Hello all,

=
I'm trying connect DS1307 on rpi4B (8M). I'm not sure how much= I can rely on the description in https://github.com/<= wbr>raspberrypi/firmware/tree/master/boot/overlays because I don&#= 39;t know the difference between linux boot loader and FreeBSD one.

I want to connect DS1307 on GPIO12/13 pin as i2c5 so I as= sumed i2c-rtc could be used so that I added one line in config.txt like bel= ow.

dtoverlay=3Di2c-rtc,ds1307,i2c5,addr=3D0x= 68

iic1 is detected at boot but it can't talk = to DS1307.

# dmesg | egrep iic\|ds1307
iichb0: = <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 27 on sim= plebus0
iichb1: <BCM2708/2835 BSC controller> mem 0x7e205a00-0x7e2= 05bff irq 52 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
iic= 0: <I2C generic I/O> on iicbus0
iicbus1: <OFW I2C bus> on ii= chb1
iic1: <I2C generic I/O> on iicbus1
ds13070: <Dallas DS1= 307> at addr 0xd0 on iicbus1
ds13070: is_dev_time_valid: cannot read = from RTC: 35
ds13070: WARNING: RTC clock stopped, check the battery.
= ds13070: registered as a time-of-day clock, resolution 1.000000s
ds13070= : ds1307_gettime: cannot read from RTC: 35
ds13070: ds1307_settime: cann= ot write to RTC: 35

The command "i2c -s -v -f= /dev/iic1" can't detect anything at all. The pin function doesn&#= 39;t seem to be correct.
# sysctl -a dev.gpio.0.pin|gr= ep 1[23]
dev.gpio.0.pin.13.function: input
dev.gpio.0.pin.12.f= unction: input

If I set alt5 on these pins by sysc= tl and change pin configuration by gpioctl to enable internal pullup, iic1 = works fine.
---
for p in 12 13
do
= =C2=A0 sysctl dev.gpio.0.pin.$p.function=3Dalt5
=C2=A0 gpioctl -c $= p PU
done
i2c -s -v -f /dev/iic1
/root/src/ds1307 -r -a 0x68 -f /d= ev/iic1
---

I'm not familiar with dt= s stuff but I wrote overlay dts like this.
/dts-v1/;
/plugin/;=
/ =C2=A0{

=C2=A0 =C2=A0 =C2=A0 =C2=A0 compatible =3D "raspb= errypi,4-model-b", "brcm,bcm2711";
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 fragment@0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 target =3D <&i2c5>;
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _= _overlay__ {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 brcm,pins =3D <12 13>;
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 brcm,fun= ction =3D <2>;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 brcm,pull =3D <2 2>;
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s= tatus =3D "okay";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 };

=C2=A0 =C2=A0 =C2=A0 =C2=A0 };
};
Howe= ver this doesn't work at all. How can I configure gpio12/13 for i2c5?

Best regards,
furaisanjin

<= /div>

--000000000000ec99a60628ab3c73--