Date: Fri, 29 Nov 2019 11:16:15 -0700 From: Ian Lepore <ian@freebsd.org> To: James Shuriff <james@opentech.cc>, Ross Alexander <rwa@athabascau.ca>, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: rpi3 clock drift Message-ID: <731a9e57ba62d5a6ede74fdde3fd82543484813b.camel@freebsd.org> In-Reply-To: <MWHPR06MB313445553D73F019FEEAF50EAA460@MWHPR06MB3134.namprd06.prod.outlook.com> References: <alpine.BSF.2.21.99999.352.1911271039470.281@autopsy.pc.athabascau.ca> <MWHPR06MB3134EC22EC3148DA800B2B7DAA440@MWHPR06MB3134.namprd06.prod.outlook.com> <alpine.BSF.2.21.99999.352.1911272214050.28592@autopsy.pc.athabascau.ca> <20191129052800.GA37113@server.rulingia.com> <alpine.BSF.2.21.99999.352.1911282333250.90234@autopsy.pc.athabascau.ca> <65be6d3628a8d35084f7c98266582090f59b18be.camel@freebsd.org> <alpine.BSF.2.21.99999.352.1911291053140.17959@autopsy.pc.athabascau.ca> <MWHPR06MB313445553D73F019FEEAF50EAA460@MWHPR06MB3134.namprd06.prod.outlook.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2019-11-29 at 18:06 +0000, James Shuriff wrote: > Can you help me determine where the timecounter frequency is being > pulled from? I believe that 54 MHz value is being pulled from the FDT > I just don't know where specifically. My board is supposed to be 19.2 > MHz. I booted up FreeBSD's own RPI3 image and I got 19.2 MHz and > didn't have any drift issues. Only when I use the environment I built > from source do I get 54 MHz, as if an RPI 4 DTB somehow made it into > the build. > You can get a definitive look at the fdt data in use by decompiling it on the running system, like this: sysctl -b hw.fdt.dtb | dtc -I dtb -O dts >/tmp/active.dts That would help you confirm your theory by finding which node has the 54mhz value in it. What to do beyond that, I'm not sure. RPi fdt data always confuses me. I think these days it's loaded from the msdos partition by uboot, but I'm not sure of that. > I'm also interested in getting an RTC hat. I know how to build > support for it in the bootloader and OS but how do you tell FreeBSD > to start using it for system timing once it's connected? > > - James Shuriff > The only thing an RTC does is initially set the system time once at boot. (On systems that support suspend/resume, it also resets the kernel clock on resume from sleep/low-power modes.) There is no way to use an RTC as the system timecounter. To use an RTC to set the time intially at boot, you only need to load its driver via the loader.conf setting and enable the i2c device with an fdt overlay. The device driver registers itself as an RTC, and the kernel automatically sets the time from the registered RTC that has the best resolution. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?731a9e57ba62d5a6ede74fdde3fd82543484813b.camel>