PINE64
PPS-GPIO - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Linux on Pine A64(+) (https://forum.pine64.org/forumdisplay.php?fid=6)
+--- Thread: PPS-GPIO (/showthread.php?tid=1590)

Pages: 1 2


PPS-GPIO - Sebastian - 06-30-2016

Hello Forum,

i want to set up a stratum 1 server on the pine, with the Adafruit GPS-Board. On the Pi it's no problem, because i don't need to make big changes.

What I have done so far on pine:
Code:
$ git clone --depth 1 --single-branch -b pine64-hacks-1.2 https://github.com/longsleep/linux-pine64
$ curl -sSL https://github.com/longsleep/build-pine64-image/raw/master/blobs/pine64.dts > linux-pine64/arch/arm64/boot/dts/sun50i-a64-pine64-plus.dts
$ make menuconfig

The pps-part in the config looks like this:
Code:
#
# PPS support
#
CONFIG_PPS=m
CONFIG_PPS_DEBUG=y

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=m
CONFIG_PPS_CLIENT_LDISC=m
CONFIG_PPS_CLIENT_PARPORT=m
CONFIG_PPS_CLIENT_GPIO=m

#
# PPS generators support
#
After build dmesg shows:

Code:
# dmesg | grep pps
[   14.067625] pps_core: LinuxPPS API ver. 1 registered
[   14.092242] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>

But where the pin is defined?
The pps-source is connected to Pin 18 on the board.
That's all what I have found:
https://www.kernel.org/doc/Documentation/devicetree/bindings/pps/pps-gpio.txt
https://dev.openwrt.org/browser/trunk/target/linux/brcm2708/patches-3.18/0078-Add-pps-gpio-DT-overlay.patch?rev=44392

For me that sounds like rocket science. :/

Could somebody "take me by the hand" please, and tell me what is the next step?



(And please, excuse my bad english.)


RE: PPS-GPIO - janjwerner - 06-30-2016

Sebastian,
To make it work I believe there are changes needed to the DTS.
If you look at the procedure for Raspberry Pi you have to used so called "overlays". As far as I know current U-Boot does not support such mechanism, so it will require the changes to main DT file.
I was looking into using Pine as ntp server (better time resolution on 64bit system), unfortunately work is getting in the way Smile


RE: PPS-GPIO - Sebastian - 06-30-2016

(06-30-2016, 10:43 AM)janjwerner Wrote: As far as I know current U-Boot does not support such mechanism, so it will require the changes to main DT file.
I was looking into using Pine as ntp server (better time resolution on 64bit system), unfortunately work is getting in the way Smile
A NTP-Server was my Idea too. Smile
And i read about the DT-Files but i have no Idea where to start.
I opened the pine64.dts but as i said, it looks like rocket science for me. Maybe someone could take care of our little Problem. Smile


RE: PPS-GPIO - lospinos - 07-05-2016

(06-30-2016, 11:50 AM)Sebastian Wrote:
(06-30-2016, 10:43 AM)janjwerner Wrote: As far as I know current U-Boot does not support such mechanism, so it will require the changes to main DT file.
I was looking into using Pine as ntp server (better time resolution on 64bit system), unfortunately work is getting in the way Smile
A NTP-Server was my Idea too. Smile
And i read about the DT-Files but i have no Idea where to start.
I opened the pine64.dts but as i said, it looks like rocket science for me. Maybe someone could take care of our little Problem. Smile

Any progress with this project?


RE: PPS-GPIO - Sebastian - 07-06-2016

Nope, not yet. :/
I have no idea what i need to do with the dts file(s).


RE: PPS-GPIO - MarkHaysHarris777 - 07-06-2016

(07-06-2016, 11:29 PM)Sebastian Wrote: Nope, not yet. :/
I have no idea what i need to do with the dts file(s).

Are we discussing device tree ?

There should be stuff on-line about it... between the on-line stuff, and a cross with the Raspberry PI, we ought to be able to figure this out...

marcus


RE: PPS-GPIO - Sebastian - 07-07-2016

Hi Marcus,

i have read a lot about it but i don't understand the half...
I know how to enable pps in the Kernel, but i have no idea how to define the Pin PC8 as the pps source in the device-tree.
For the Odroid C1+ its

pps {
compatible = "pps-gpio";
gpios = "GPIOY_3";
};

Any tips?


RE: PPS-GPIO - martinayotte - 07-07-2016

You first need to define the pin in pinctrl section, probably after Vdevice@0 :


Code:
                       my_pps_pin@0 {
                               linux,phandle = <0xba>;
                               phandle = <0xba>;
                               allwinner,pins = "PC8";
                               allwinner,function = "gpio_in";
                               allwinner,pname = "pps_gpio";
                               allwinner,muxsel = <0x0>;
                               allwinner,pull = <0x1>;
                               allwinner,drive = <0x0>;
                               allwinner,data = <0xffffffff>;
                       };

Then, you declare the device (again after vdevice@0) :

Code:
               ppsgpio_device@0 {
                       compatible = "pps-gpio";
                       gpios = <0x30 0x2 0x8 0x0 0x0 0x0 0x0>;
                       pinctrl-names = "default";
                       pinctrl-0 = <0xba>;
                       status = "okay";
               };

Then, recompile the dtb (always keep a backup of the original)


RE: PPS-GPIO - Sebastian - 07-07-2016

(07-07-2016, 03:25 PM)martinayotte Wrote: You first need to define the pin in pinctrl section, probably after Vdevice@0 :


Code:
                       my_pps_pin@0 {
                               linux,phandle = <0xba>;
                               phandle = <0xba>;
                               allwinner,pins = "PC8";
                               allwinner,function = "gpio_in";
                               allwinner,pname = "pps_gpio";
                               allwinner,muxsel = <0x0>;
                               allwinner,pull = <0x1>;
                               allwinner,drive = <0x0>;
                               allwinner,data = <0xffffffff>;
                       };

Then, you declare the device (again after vdevice@0) :

Code:
               ppsgpio_device@0 {
                       compatible = "pps-gpio";
                       gpio = <0x30 0x2 0x8 0x0>;
                       pinctrl-names = "default";
                       pinctrl-0 = <0xba>;
                       status = "okay";
               };

Then, recompile the dtb (always keep a backup of the original)

thx. Smile  i'll give it a try after the wedding... maybe tomorrow.


RE: PPS-GPIO - tllim - 07-08-2016

(07-07-2016, 10:46 PM)Sebastian Wrote:
(07-07-2016, 03:25 PM)martinayotte Wrote: You first need to define the pin in pinctrl section, probably after Vdevice@0 :


Code:
                       my_pps_pin@0 {
                               linux,phandle = <0xba>;
                               phandle = <0xba>;
                               allwinner,pins = "PC8";
                               allwinner,function = "gpio_in";
                               allwinner,pname = "pps_gpio";
                               allwinner,muxsel = <0x0>;
                               allwinner,pull = <0x1>;
                               allwinner,drive = <0x0>;
                               allwinner,data = <0xffffffff>;
                       };

Then, you declare the device (again after vdevice@0) :

Code:
               ppsgpio_device@0 {
                       compatible = "pps-gpio";
                       gpio = <0x30 0x2 0x8 0x0>;
                       pinctrl-names = "default";
                       pinctrl-0 = <0xba>;
                       status = "okay";
               };

Then, recompile the dtb (always keep a backup of the original)

thx. Smile  i'll give it a try after the wedding... maybe tomorrow.

Congratulation on the wedding.