xref: /freebsd/share/man/man4/man4.arm/am335x_dmtpps.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
14159fbabSIan Lepore.\"
24159fbabSIan Lepore.\" Copyright (c) 2015 Ian Lepore <ian@freebsd.org>
34159fbabSIan Lepore.\" All rights reserved.
44159fbabSIan Lepore.\"
54159fbabSIan Lepore.\" Redistribution and use in source and binary forms, with or without
64159fbabSIan Lepore.\" modification, are permitted provided that the following conditions
74159fbabSIan Lepore.\" are met:
84159fbabSIan Lepore.\"
94159fbabSIan Lepore.\" 1. Redistributions of source code must retain the above copyright
104159fbabSIan Lepore.\"    notice, this list of conditions and the following disclaimer.
114159fbabSIan Lepore.\" 2. Redistributions in binary form must reproduce the above copyright
124159fbabSIan Lepore.\"    notice, this list of conditions and the following disclaimer in the
134159fbabSIan Lepore.\"    documentation and/or other materials provided with the distribution.
144159fbabSIan Lepore.\"
154159fbabSIan Lepore.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
164159fbabSIan Lepore.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
174159fbabSIan Lepore.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
184159fbabSIan Lepore.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
194159fbabSIan Lepore.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
204159fbabSIan Lepore.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
214159fbabSIan Lepore.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
224159fbabSIan Lepore.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
234159fbabSIan Lepore.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
244159fbabSIan Lepore.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
254159fbabSIan Lepore.\"
264159fbabSIan Lepore.Dd August 12, 2015
274159fbabSIan Lepore.Dt AM335X_DMTPPS 4
284159fbabSIan Lepore.Os
294159fbabSIan Lepore.Sh NAME
304159fbabSIan Lepore.Nm am335x_dmtpps
314159fbabSIan Lepore.Nd RFC 2783 Pulse Per Second API driver for AM335x systems
324159fbabSIan Lepore.Sh SYNOPSIS
334159fbabSIan Lepore.Cd "device am335x_dmtpps"
344159fbabSIan Lepore.Pp
354159fbabSIan LeporeOptional in
364159fbabSIan Lepore.Pa /boot/loader.conf :
374159fbabSIan Lepore.Cd hw.am335x_dmtpps.input="pin name"
384159fbabSIan Lepore.\"
394159fbabSIan Lepore.Sh DESCRIPTION
404159fbabSIan LeporeThe
414159fbabSIan Lepore.Nm
424159fbabSIan Leporedevice driver provides a system time counter that includes precise
434159fbabSIan Leporecapture of Pulse Per Second (PPS) signals emitted by GPS receivers
444159fbabSIan Leporeand other timing devices.
454159fbabSIan LeporeThe
464159fbabSIan Lepore.Nm
474159fbabSIan Leporedriver may be compiled into the kernel or loaded as a module.
484159fbabSIan Lepore.Pp
494159fbabSIan LeporeThe AM335x timer hardware captures the value of the system time counter
504159fbabSIan Leporeon the leading edge of the PPS pulse.
514159fbabSIan LeporeBecause the capture is done by the hardware there is no interrupt
524159fbabSIan Leporelatency in the measurement.
534159fbabSIan LeporeThe time counter runs at 24Mhz, providing a measurement resolution
544159fbabSIan Leporeof 42 nanoseconds.
554159fbabSIan Lepore.Pp
564159fbabSIan LeporeTo use the PPS timing information provided by this driver with
574159fbabSIan Lepore.Xr ntpd 8 ,
584159fbabSIan Leporesymlink the
59*d3c2497cSChristian Brueffer.Pa /dev/dmtpps
604159fbabSIan Leporedevice to
61*d3c2497cSChristian Brueffer.Pa /dev/pps0
624159fbabSIan Leporeand configure server
634159fbabSIan Lepore.Va 127.127.22.0
644159fbabSIan Leporein
654159fbabSIan Lepore.Xr ntp.conf 5
664159fbabSIan Leporeto configure a type 22 (ATOM) refclock.
674159fbabSIan Lepore.\"
684159fbabSIan Lepore.Sh DRIVER CONFIGURATION
694159fbabSIan LeporeThe AM335x hardware provides four timer devices with a capture input
704159fbabSIan Leporepin, DMTimer4 through DMTimer7.
714159fbabSIan LeporeBecause it also provides the active system time counter,
724159fbabSIan Leporeonly one instance of the
734159fbabSIan Lepore.Nm
744159fbabSIan Leporedriver can be active at a time.
754159fbabSIan LeporeThe driver uses system pin configuration to determine which hardware
764159fbabSIan Leporetimer device to use.
774159fbabSIan LeporeConfigure the timer input pin in the system's FDT data, or by
784159fbabSIan Leporesupplying the pin name using a tunable variable in
794159fbabSIan Lepore.Xr loader.conf 5 .
804159fbabSIan Lepore.Pp
814159fbabSIan LeporeTo use a standard kernel and FDT data, use
824159fbabSIan Lepore.Xr loader.conf 5
834159fbabSIan Leporeto load the
844159fbabSIan Lepore.Nm
854159fbabSIan Leporemodule and set the
864159fbabSIan Lepore.Va hw.am335x_dmtpps.input
874159fbabSIan Leporetunable variable to the name of the input pin, one of the following:
884159fbabSIan Lepore.Pp
894159fbabSIan Lepore.Bl -tag -width "GPMC_ADVn_ALE MMMM" -offset MMMM -compact
904159fbabSIan Lepore.It Em Name
914159fbabSIan Lepore.Em Hardware
924159fbabSIan Lepore.It P8-7
934159fbabSIan LeporeDMTimer4; Beaglebone P8 header pin 7.
944159fbabSIan Lepore.It P8-8
954159fbabSIan LeporeDMTimer7; Beaglebone P8 header pin 8.
964159fbabSIan Lepore.It P8-9
974159fbabSIan LeporeDMTimer5; Beaglebone P8 header pin 9.
984159fbabSIan Lepore.It P8-10
994159fbabSIan LeporeDMTimer6; Beaglebone P8 header pin 10.
1004159fbabSIan Lepore.It GPMC_ADVn_ALE
1014159fbabSIan LeporeDMTimer4.
1024159fbabSIan Lepore.It GPMC_BEn0_CLE
1034159fbabSIan LeporeDMTimer5.
1044159fbabSIan Lepore.It GPMC_WEn
1054159fbabSIan LeporeDMTimer6.
1064159fbabSIan Lepore.It GPMC_OEn_REn
1074159fbabSIan LeporeDMTimer7.
1084159fbabSIan Lepore.El
1094159fbabSIan Lepore.Pp
1104159fbabSIan LeporeTo configure the
1114159fbabSIan Lepore.Nm
1124159fbabSIan Leporedriver using FDT data, create a new pinctrl node by referencing the standard
1134159fbabSIan Lepore.Va am33xx_pinmux
1144159fbabSIan Leporedriver node (which is defined in am33xx.dtsi) in your dts file.
1154159fbabSIan LeporeFor example:
1164159fbabSIan Lepore.Bd -literal
1174159fbabSIan Lepore   &am33xx_pinmux {
1184159fbabSIan Lepore      timer4_pins: timer4_pins {
1194159fbabSIan Lepore         pinctrl-single,pins = <0x90 (PIN_INPUT | MUX_MODE2)>;
1204159fbabSIan Lepore      };
1214159fbabSIan Lepore   };
1224159fbabSIan Lepore.Ed
1234159fbabSIan Lepore.Pp
1244159fbabSIan LeporeAdd pinctrl properties referencing
1254159fbabSIan Lepore.Va timer4_pins
1264159fbabSIan Leporeto the standard
1274159fbabSIan Lepore.Va timer4
1284159fbabSIan Leporedevice node (also defined in am33xx.dtsi) by referencing it in
1294159fbabSIan Leporeyour dts file as follows:
1304159fbabSIan Lepore.Bd -literal
1314159fbabSIan Lepore   &timer4 {
1324159fbabSIan Lepore      pinctrl-names = "default";
1334159fbabSIan Lepore      pinctrl-0 = <&timer4_pins>;
1344159fbabSIan Lepore   };
1354159fbabSIan Lepore.Ed
1364159fbabSIan Lepore.\"
1374159fbabSIan Lepore.Sh FILES
1384159fbabSIan Lepore.Bl -tag -width ".Pa /dev/dmtpps" -compact
1394159fbabSIan Lepore.It Pa /dev/dmtpps
1404159fbabSIan LeporeThe device providing
1414159fbabSIan Lepore.Xr ioctl 2
1424159fbabSIan Leporeaccess to the RFC 2783 API.
1434159fbabSIan Lepore.El
1444159fbabSIan Lepore.\"
1454159fbabSIan Lepore.Sh SEE ALSO
1464159fbabSIan Lepore.Xr timecounters 4 ,
1474159fbabSIan Lepore.Xr loader.conf 5 ,
1484159fbabSIan Lepore.Xr ntp.conf 5 ,
1494159fbabSIan Lepore.Xr ntpd 8
1504159fbabSIan Lepore.\"
1514159fbabSIan Lepore.Sh HISTORY
1524159fbabSIan LeporeThe
1534159fbabSIan Lepore.Nm
1544159fbabSIan Leporedevice driver first appeared in
1554159fbabSIan Lepore.Fx 11.0 .
1564159fbabSIan Lepore.\"
1574159fbabSIan Lepore.Sh AUTHORS
1584159fbabSIan LeporeThe
1594159fbabSIan Lepore.Nm
1604159fbabSIan Leporedevice driver and this manual page were written by
161*d3c2497cSChristian Brueffer.An Ian Lepore Aq Mt ian@FreeBSD.org .
162