From nobody Sat Dec 07 09:56:11 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 4Y53SN12XJz5gqcp for ; Sat, 07 Dec 2024 09:56:52 +0000 (UTC) (envelope-from furaisanjin@gmail.com) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 4Y53SL4hJvz4PZW for ; Sat, 7 Dec 2024 09:56:50 +0000 (UTC) (envelope-from furaisanjin@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=XTfMgKH6; spf=pass (mx1.freebsd.org: domain of furaisanjin@gmail.com designates 2a00:1450:4864:20::631 as permitted sender) smtp.mailfrom=furaisanjin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-aa662795ca3so26149166b.1 for ; Sat, 07 Dec 2024 01:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733565408; x=1734170208; darn=freebsd.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=1zHN5QXHNFEzZr0ZEQOYEMXfGE9Lwp/ZO++/fXoPiYM=; b=XTfMgKH6FxkB4FxpkXuKEs7/yPDnQObhkeQkOdy1JbGkz73E6wA9S3jnkD5qGC2a6e SQONQO4idp7O4qAiaO/qMzY0ZBkZK2CS2AftG1L6m27DUUb5QnROOubvlhJOO0U/qM9g svltJkzI2SxaKLOSPmdRmZImqXSdQDDu9dYve300G4bFEbpixVQ0+3nxbXrFky59SqYS 73U4V30LnGu25ZFJ/ma2hA6VdSB2HhzwX9DuFcHUPkG/lzz1MFq7DGyWF5jBvZwje+SX cabrPT8ikvhy/ZEWRYq/m0wMnyPuNtX8bgtJ8bRwgdY5WyXBN4YoDEqM+YFJpu4GWY1p R5oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733565408; x=1734170208; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1zHN5QXHNFEzZr0ZEQOYEMXfGE9Lwp/ZO++/fXoPiYM=; b=Eknj8PF9cRv3crJkyqH3Zt8Ra0KCDoRXjbL+5fnO4Sqf6Rhi1FDv9+i7i6Cgf7Xg0z detgiZshj0fCXqDkr/89LDrz59M5rimebkw5XWVHF2nQEfpXbive7eSoMmudZJVLf9sE Ljx6vE/bPFr9tzY+qMe0HoQjkOshyv11bNtXC0c9MtQ8ZK8NxtS4zjIDynK3C+jyYQ+h tH32n30937/awxjEOmVzunuTTJ8t4OQqUeBKluykb7ju7wj67+y/1938nHQw5wE2fhSn upNNcnOeeCgvQvikcI6EZeGuuP1aPqp93KRcQrWyZbKRnk7dSVswDB5iq5br9auM/fGx 0QhQ== X-Gm-Message-State: AOJu0Yw7VI29JeyOA1r226xhVMSc+3txt0DtukF/R1kp31dcY9/NPc7V yXdow4DkSM27XWN5HAEI++wm7wf3q+Nr9PicdpOFXSOKmhqdpbmx08agLMGrktNiISnnkev3rol i9pV/F++71zAS6owt5X58i2lLeRSFfQp3 X-Gm-Gg: ASbGncuqTGhjdttha36XXMY7nhSFSy8h2EFVu4pnswDUNcrGKm3F5gU1V6/S1DoUzbz +uvfFEE78+v9yX+1q7sSh9kkLbL+hmSNQ X-Google-Smtp-Source: AGHT+IEISp1iI8diwPWM6PRfc1LXtbko4bF/mGAsFE7ho8807SYFEuytcuLNwUdfjAJRWv4z9RIY+oDsltfVJy75yqQ= X-Received: by 2002:a17:906:3ca9:b0:a9a:616c:459e with SMTP id a640c23a62f3a-aa637621b57mr561896466b.27.1733565407825; Sat, 07 Dec 2024 01:56:47 -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 From: =?UTF-8?B?6aKo5L6G5pWj5Lq6?= Date: Sat, 7 Dec 2024 18:56:11 +0900 Message-ID: Subject: DS1307 on rpi4B To: FreeBSD ARM List Content-Type: multipart/alternative; boundary="00000000000054161c0628ab26d8" X-Spamd-Result: default: False [-3.60 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.60)[-0.599]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_DN_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MISSING_XM_UA(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; RCVD_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::631:from] X-Rspamd-Queue-Id: 4Y53SL4hJvz4PZW X-Spamd-Bar: --- --00000000000054161c0628ab26d8 Content-Type: text/plain; charset="UTF-8" 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=i2c-rtc,ds1307,i2c5,addr=0x68 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 pin 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=alt5 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 = "raspberrypi,4-model-b", "brcm,bcm2711"; fragment@0 { target = <&i2c5>; __overlay__ { brcm,pins = <12 13>; brcm,function = <2>; brcm,pull = <2 2>; status = "okay"; }; }; }; However this doesn't work at all. How can I configure gpio12/13 for i2c5? Best regards, furaisanjin --00000000000054161c0628ab26d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello all,

I'm trying connect DS1307 on rpi4B (8M). I'm not s= ure 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 b= elow.

dtoverlay=3Di2c-rtc,ds1307,i2c5,addr=3D0x68<= /div>

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 simple= bus0
iichb1: <BCM2708/2835 BSC controller> mem 0x7e205a00-0x7e205b= ff irq 52 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
iic0: = <I2C generic I/O> on iicbus0
iicbus1: <OFW I2C bus> on iichb= 1
iic1: <I2C generic I/O> on iicbus1
ds13070: <Dallas DS1307= > at addr 0xd0 on iicbus1
ds13070: is_dev_time_valid: cannot read fro= m RTC: 35
ds13070: WARNING: RTC clock stopped, check the battery.
ds1= 3070: registered as a time-of-day clock, resolution 1.000000s
ds13070: d= s1307_gettime: cannot read from RTC: 35
ds13070: ds1307_settime: cannot = write to RTC: 35

The command "i2c -s -v -f /d= ev/iic1" can't detect anything at all. The pin 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.func= tion: input

If I set alt5 on these pins by sysctl = and change pin configuration by gpioctl to enable internal pullup, iic1 wor= ks 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 /dev/iic1<= /div>
---

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

=C2=A0 =C2=A0 =C2=A0 =C2=A0 compatible =3D "raspberrypi= ,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 __overla= y__ {
=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,function = =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 status = =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 };
};
However thi= s doesn't work at all. How can I configure gpio12/13 for i2c5?

Best regards,
furaisanjin


--00000000000054161c0628ab26d8--