|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
| 2 | +// This file is released under the GPL v2.0 License, and comes without warranty, express or implied. |
| 3 | +// (C) Josh Blake, 2026 |
| 4 | + |
| 5 | +/* |
| 6 | + * dtparams: |
| 7 | + * pin: (integer) Specifies the PPS Input pin. |
| 8 | + * Takes the pin number correlating to the RPi 40-pin GPIO. |
| 9 | + * Defaults to GPIO 18. |
| 10 | + * pull-none: (boolean) Disable pull-up/down resistors on the PPS Input pin. |
| 11 | + * pull-up: (boolean) Enable pull-up resistor on the PPS Input pin. |
| 12 | + * pull-down: (boolean) Enable pull-down resistor on the PPS Input pin. |
| 13 | + * schmitt-trigger: (boolean) Enable the Schmitt-trigger on the PPS Input pin. |
| 14 | + * Defaults to off. |
| 15 | + * echo-pin: (integer) Specifies the PPS Echo Output pin. |
| 16 | + * Takes the pin number correlating to the RPi 40-pin GPIO. |
| 17 | + * Defaults to GPIO 17. |
| 18 | + * echo-ms: (integer) Specifies the pulse-width in ms that the echo signal outputs |
| 19 | + * on the PPS Echo Output pin. |
| 20 | + * Must be less than 999. |
| 21 | + * Defaults to 10ms. |
| 22 | + * echo: (boolean) Enables the PPS Echo Output signal. |
| 23 | + * Defaults to off. |
| 24 | + * capture-clear: (boolean) Captures the clear event time. |
| 25 | + * Defaults to off. |
| 26 | + * assert-falling-edge: (boolean) Uses the falling signal edge instead of the |
| 27 | + * rising signal edge. |
| 28 | + * Defaults to off. |
| 29 | + */ |
| 30 | + |
| 31 | +/dts-v1/; |
| 32 | +/plugin/; |
| 33 | + |
| 34 | +/ { |
| 35 | + compatible = "brcm,bcm2712"; |
| 36 | + |
| 37 | + fragment@0 { |
| 38 | + target-path = "/"; |
| 39 | + __overlay__ { |
| 40 | + pps: pps@ { |
| 41 | + compatible = "pps-gpio"; |
| 42 | + pinctrl-names = "default"; |
| 43 | + pinctrl-0 = <&pps_gpios>; |
| 44 | + gpios = <&gpio 18 0>; |
| 45 | + status = "okay"; |
| 46 | + }; |
| 47 | + }; |
| 48 | + }; |
| 49 | + |
| 50 | + fragment@1 { |
| 51 | + target = <&gpio>; |
| 52 | + __overlay__ { |
| 53 | + pps_gpios: pps_gpios@ { |
| 54 | + pps_in: pps_in@ { |
| 55 | + function = "gpio"; |
| 56 | + input-enable; |
| 57 | + }; |
| 58 | + }; |
| 59 | + }; |
| 60 | + }; |
| 61 | + |
| 62 | + fragment@2 { |
| 63 | + target = <&pps_gpios>; |
| 64 | + __dormant__ { |
| 65 | + pps_out: pps_out@ { |
| 66 | + function = "gpio"; |
| 67 | + output-enable; |
| 68 | + drive-push-pull; |
| 69 | + bias-disable; |
| 70 | + }; |
| 71 | + }; |
| 72 | + }; |
| 73 | + |
| 74 | + fragment@3 { |
| 75 | + target = <&pps>; |
| 76 | + pps_echo: __dormant__ { |
| 77 | + echo-gpios = <&gpio 17 0>; |
| 78 | + echo-active-ms = <10>; |
| 79 | + }; |
| 80 | + }; |
| 81 | + |
| 82 | + __overrides__ { |
| 83 | + // A very annoying and inelegant pinctrl to pin number LUT |
| 84 | + pin = |
| 85 | + <&pps>,"reg:0{,=18}", |
| 86 | + <&pps>,"gpios:4{,=18}", |
| 87 | + <&pps_gpios>,"reg:0{,=18}", |
| 88 | + <&pps_in>,"reg:0{,=18}", |
| 89 | + <&pps_in>,"pins{2=gpio2,3=gpio3,4=gpio4,17=gpio17,27=gpio27,22=gpio22,10=gpio10,9=gpio9,11=gpio11,0=gpio0,5=gpio5,6=gpio6,13=gpio13,19=gpio19,26=gpio26,14=gpio14,15=gpio15,18=gpio18,23=gpio23,24=gpio24,25=gpio25,8=gpio8,7=gpio7,1=gpio1,12=gpio12,16=gpio16,20=gpio20,21=gpio21,=gpio18}"; |
| 90 | + pull-none = <&pps_in>,"bias-disable?"; |
| 91 | + pull-up = <&pps_in>,"bias-pull-up?"; |
| 92 | + pull-down = <&pps_in>,"bias-pull-down?"; |
| 93 | + schmitt-trigger = <&pps_in>,"input-enable!",<&pps_in>,"input-schmitt-enable?"; |
| 94 | + assert-falling-edge = <&pps>,"assert-falling-edge?"; |
| 95 | + capture-clear = <&pps>,"capture-clear?"; |
| 96 | + echo-pin = |
| 97 | + <&pps_out>,"reg:0{,=17}", |
| 98 | + <&pps_out>,"pins{2=gpio2,3=gpio3,4=gpio4,17=gpio17,27=gpio27,22=gpio22,10=gpio10,9=gpio9,11=gpio11,0=gpio0,5=gpio5,6=gpio6,13=gpio13,19=gpio19,26=gpio26,14=gpio14,15=gpio15,18=gpio18,23=gpio23,24=gpio24,25=gpio25,8=gpio8,7=gpio7,1=gpio1,12=gpio12,16=gpio16,20=gpio20,21=gpio21,=gpio17}", |
| 99 | + <&pps_echo>,"echo-gpios:4{,=17}"; |
| 100 | + echo-ms = <&pps_echo>,"echo-active-ms:0"; |
| 101 | + echo = <0>,"+2+3"; |
| 102 | + }; |
| 103 | +}; |
0 commit comments