From owner-freebsd-arm@freebsd.org Mon Mar 12 01:12:13 2018 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BA18F37A07 for ; Mon, 12 Mar 2018 01:12:13 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B82F88098 for ; Mon, 12 Mar 2018 01:12:13 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1 (FreeBSD)) (envelope-from ) id 1evC0S-000Fs9-07; Sun, 11 Mar 2018 18:12:04 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w2C1C3WW061016; Sun, 11 Mar 2018 18:12:03 -0700 (PDT) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Sun, 11 Mar 2018 18:12:02 -0700 From: Oleksandr Tymoshenko To: Shamim Shahriar Cc: freebsd-arm@freebsd.org Subject: Re: PPS or /dev/ppsN on Raspberry Pi 3 Message-ID: <20180312011202.GA60784@bluezbox.com> References: <819975e8-56a8-677b-e5f5-003ff2091553@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <819975e8-56a8-677b-e5f5-003ff2091553@gmail.com> X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Shamim Shahriar (shamim.shahriar@gmail.com) wrote: > Good evening everyone. > > Objective: get a GPS module work with Raspberry Pi 3 and FreeBSD > v12-CURRENT (it has been indicated on several sites t [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2018 01:12:13 -0000 Shamim Shahriar (shamim.shahriar@gmail.com) wrote: > Good evening everyone. > > Objective: get a GPS module work with Raspberry Pi 3 and FreeBSD > v12-CURRENT (it has been indicated on several sites that the earlier > versions of FreeBSD do not play well with Pi3), and get a /dev/pps0 so I > can get the PPS from gpio 18 and time from a usb serial converter. > > I have the hardware and they are all plugged in exactly as they should. > if I replace the pi with a Pi-B then it all works exactly as they > should, but with Pi3 it is proving to be more challenging. I had been > trying various things in the Kernel to get the /dev/pps0 (and also > /dev/pps1, which I am enabling in case I get to use another module) > which has not created even once so far. > > IAll the documentation I have come across refers to rPi up to model 2, > and nothing on 3. As far as I can gather, I need to put > options PPS_SYNC > > in the kernel configuration, which I did. There are also instructions on > adding pps lines to the various dtb files that goes into the /boot/msdos > folder -- but Rasperry Pi3 /does not/ have the /boot/msdos, it has efi, > and my understanding is that the content of the efi is actually pulled > from the github (no source available, only the final binaries to put in > there). I tried to put those on rpi2.dts, didn't work. > > here are the relevant lines from the file. Please note, I want to PPS, > one on gpio18 the other on gpio 23/ > > rpi_ft5406 { > compatible = "rpi,rpi-ft5406"; > status = "okay"; > }; > > > pps@0 { > compatible = "pps-gpio"; > gpios = <&gpio 18 0>; > status = "okay"; > }; > > pps@1 { > compatible = "pps-gpio"; > gpios = <&gpio 23 0>; > status = "okay"; > }; > > > leds { > compatible = "gpio-leds"; > > > my understanding is, whatever dtb file is being used on RPi3, these are > downloaded from github > (https://github.com/raspberrypi/firmware/tree/master/boot) and there is > no way of modifying them as they are all binary files. Would appreciate > if someone could please confirm that for me. > > Would appreciate if someone could please point me to the correct > direction as I seem to be going around very blindly and not seeing the > possible solution to the problem. You can use FDT overlays for this: - Use https://people.freebsd.org/~gonzo/pps-overlay-example.dts as a starting point. - Compile overlay: dtc -@ -o pps.dtbo pps-overlay-example.dts - Copy pps.dtbo to overlays/ directory on FAT partition - Add "dtoverlay=pps" to config.txt on FAT partition. - Reboot Pi3 and check if pps nodes are in active DTB: sysctl -b hw.fdt.dtb | dtc -I dtb -O dts | grep pps The problem with this approach is that it depends on default pinmux configuration. The right way is to use this example as a base: https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts This is self-contained overlay that also includes pinmux configuration but requires pinctrl driver. Driver is implemented but not committed to HEAD yet because it depends on couple of changes that are still pending reviews. -- gonzo