FreeBSD 12.0 RBPI3B+ and hardware clock support

Oleksandr Tymoshenko gonzo at bluezbox.com
Wed Nov 21 21:09:21 UTC 2018


Stefan Parvu (sparvu at kronometrix.org) wrote:
> 
> 
> > On 21 Nov 2018, at 22.51, Ian Lepore <ian at freebsd.org> wrote:
> > 
> > On Wed, 2018-11-21 at 22:42 +0200, Stefan Parvu wrote:
> >>> 
> >>> Oddly enough, the ds1307 driver supports that chip. I think it's
> >>> because the register set on the two chips is identical (or close
> >>> enough
> >>> to work right).
> >> uauu. nice one. 
> >> 
> >> how on earth i can enable ds1307 - no need to rebuild anything
> >> right ? Can I load the driver , if yes how ? 
> >> 
> >> 
> >> Stefan
> > 
> > You can load it interactively with "kldload ds1307". Add
> > ds1307_load=YES to /boot/loader.conf to load it every time you boot.
> 
> done. cheers.
> 
> root at k50:~ # kldstat
> Id Refs Address                Size Name
>  1   17 0xffff000000000000  13ca6f0 kernel
>  2    1 0xffff0000013cb000    41730 mac_portacl.ko
>  3    1 0xffff000053600000    41000 tmpfs.ko
>  4    1 0xffff000053641000    41000 uftdi.ko
>  5    1 0xffff000053682000    41000 ucom.ko
>  6    1 0xffff0000536c3000    31000 mac_ntpd.ko
>  7    1 0xffff0000536f4000    41000 ds1307.ko
> 
> > But without modified FDT data, just loading the driver won't make it
> > attach to the hardware.
> > The new way to do all that is to code an overlay that enables the bus
> > and adds the device, then set a loader.conf variable to make that
> > overlay get loaded. But I don't know the details of how to do that,
> > hopefully one of the folks who does know more about overlays can reply
> > with that info.
> 
> okay, I see. Lets hope somebody which can help on this might answer.

With Raspberry Pi there are two ways to apply overlays: at the frimware
stage or at FreeBSD's loader stage. There seems to be official overlay
for i2c RTC clocks [1] that can be used with the firmware stage

To enalbe it try following steps:

- Download i2c-rtc.dtbo and copy it to "overlays/" directory on FAT
  partition
- Edit config.txt on FAT partition and add following line:
  dtoverlay=i2c-rtc,mcp7941x
- Reboot RPi and check whether overlay is applied:
  sysctl -b hw.fdt.dtb | dtc -I dtb -O dts | grep mcp7941x

If this doesn't work I'll write up on how to build and enable dtbo for
the loader.

[1] https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo


-- 
gonzo


More information about the freebsd-arm mailing list