[LinuxPPS] AMBA driver

Gerhard Bertelsmann info at gerhard-bertelsmann.de
Tue Jun 10 12:07:52 CEST 2008


Hi,
> On Sun, Feb 17, 2008 at 11:38:07AM +0100, Erik Larsson wrote:
> >/ Hi,
> />/ 
> />/ I’m new to LinuxPPS so please don’t shoot me if this is a stupid question.
> />/ 
> />/ I would like to use LinuxPPS on a Infinion SOC processor with a MIPS arch. It
> />/ uses AMBA seriel driver. TO get LinuxPPS running in the AMBA driver do I need
> />/ to patch that driver as the 8250 driver is patched? Or is it impossible to use
> />/ AMBA and LinuxPPS?
> /
> The AMBA serial driver is based on serial-core? If so you have nothing
> to do, otherwise you must provide a proper interface. Please, see
> Documentation/pps/pps.txt.
>
> >/ Or has someone already done this?
> /
> I don't think so...
>
> Ciao,
>
> Rodolfo
I'm using a Edimax BR-6104KP board to setup a NTP server. The AMBA 
serial code is based on serial core.
I have added following patch:

--- a/drivers/serial/amba-pl010.c    2008-06-04 22:46:36.000000000 +0200
+++ b/drivers/serial/amba-pl010.c    2008-06-04 22:46:19.000000000 +0200
@@ -252,7 +260,7 @@
 
             status = readl(uap->port.membase + UART010_IIR);
         } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
-                   UART010_IIR_TIS));
+                   UART010_IIR_TIS | UART010_IIR_MIS));
         handled = 1;
     }
 
@@ -454,6 +462,12 @@
     if (UART_ENABLE_MS(port, termios->c_cflag))
         old_cr |= UART010_CR_MSIE;
 
+    if (uap->port.flags & UPF_HARDPPS_CD)
+    {
+        printk(KERN_INFO "Serial: AMBA driver:DCD enable (UART010_CR_MSIE)\n");
+        old_cr |= UART010_CR_MSIE;        /* enable interrupts */
+    }
+
     writel(0, uap->port.membase + UART010_CR);
 
     /* Set baud rate */


Base is http://squidge.sourceforge.net/ - I have put the patch into 
231-pps_amba.patch. It will be
used right after 230-pps_support.patch, which is actually 
ntp-pps-2.6.24-ter.diff 
<http://ftp.enneenne.com/pub/misc/linuxpps/patches/ntp-pps-2.6.24-ter.diff>. 
It seems to be important
to compile pps and serial driver as modul.
After loading:

root at OpenWrt:~# dmesg | tail -8
Software ver. 5.1.0 - Copyright 2005-2007 Rodolfo Giometti 
<giometti at linux.it>
Serial: AMBA driver $Revision: 1.41 $
APB:UART0: ttyS0 at MMIO 0x12600000 (irq = 9) is a AMBA
APB:UART1: ttyS1 at MMIO 0x12800000 (irq = 10) is a AMBA
new PPS source ttyS0 at ID 0
Serial: AMBA driver:DCD enable (UART010_CR_MSIE)
Serial: AMBA driver:DCD enable (UART010_CR_MSIE)
Serial: AMBA driver:DCD enable (UART010_CR_MSIE)

With PQFP Pin#123 connected thru 74HC00 as 5V to 3V3 driver from a 
Motorola Oncore UT+ PPS signal,
ppstest is working:

root at OpenWrt:~# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1213023986.000843597, sequence: 240564 - clear 
1213023985.199521690, sequence: 240564
source 0 - assert 1213023986.000843597, sequence: 240564 - clear 
1213023986.199584229, sequence: 240565
source 0 - assert 1213023987.000843042, sequence: 240565 - clear 
1213023986.199584229, sequence: 240565
source 0 - assert 1213023987.000843042, sequence: 240565 - clear 
1213023987.199647188, sequence: 240566
source 0 - assert 1213023988.000843458, sequence: 240566 - clear 
1213023987.199647188, sequence: 240566
source 0 - assert 1213023988.000843458, sequence: 240566 - clear 
1213023988.199709978, sequence: 240567

But ntp is not:

ntpq> version
ntpq 4.2.4p4 at 1.1520 Tue Jun 3 19:33:58 UTC 2008 (1)
ntpq> lpeers
remote refid st t when poll reach delay offset jitter
==============================================================================
PPS(0) .PPS. 0 l - 16 0 0.000 0.000 0.244
-192.168.0.2 192.53.103.108 2 u 123 128 377 5.218 -6.911 4.462
*noname .GPS. 1 u 123 128 377 0.791 -1.259 0.290
+ptbtime1.ptb.de .PTB. 1 u 52 128 377 28.684 -5.514 4.836
+ntp1.sda.t-onli 10.40.8.8 2 u 65 128 377 11.549 -1.266 4.416
ntpq> lpassociations

ind assID status conf reach auth condition last_event cnt
===========================================================
1 11066 8015 yes yes none reject clock expt 1
2 11067 9314 yes yes none outlyer reachable 1
3 11068 9614 yes yes none sys.peer reachable 1
4 11069 9414 yes yes none candidat reachable 1
5 11070 9414 yes yes none candidat reachable 1

ntpq> pstatus 11066
assID=11066 status=8015 unreach, conf, 1 event, event_peer_clock,
srcadr=PPS(0), srcport=123, dstadr=127.0.0.1, dstport=123, leap=11,
stratum=0, precision=-20, rootdelay=0.000, rootdispersion=0.000,
refid=PPS, reach=000, unreach=0, hmode=3, pmode=4, hpoll=4, ppoll=4,
flash=1600 peer_stratum, peer_dist, peer_unfit, keyid=0, ttl=0,
offset=0.000, delay=0.000, dispersion=16000.000, jitter=0.244,
reftime=00000000.00000000 Thu, Feb 7 2036 6:28:16.000,
org=00000000.00000000 Thu, Feb 7 2036 6:28:16.000,
rec=00000000.00000000 Thu, Feb 7 2036 6:28:16.000,
xmt=cbf8cfe4.3bbf9122 Tue, Jun 10 2008 10:03:16.233,
filtdelay= 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00,
filtoffset= 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00,
filtdisp= 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0

This is my actual ntp.conf:
root at OpenWrt:~# cat /etc/ntp.conf

logfile /tmp/ntp.log
logconfig =syncstatus +sysevents
logconfig =all

driftfile /tmp/ntp.drift

# server 127.127.1.0
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 flag2 0
server 192.168.0.2
server 192.168.0.129 prefer
server ptbtime1.ptb.de
server ntp1.t-online.de

Any hints regarding the missing PPS on ntpd ?

Regards

Gerd






More information about the LinuxPPS mailing list