Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Feb 2021 19:23:46 +0100
From:      Oskar Holmlund <info@ohdata.se>
To:        Kristoff <kristoff@skypro.be>
Cc:        freebsd-arm@freebsd.org, owner-freebsd-arm@freebsd.org
Subject:   Re: device-tree on BeagleBone Black (enabling UART)
Message-ID:  <cbddc3782c8b0a55a3691fa586c08eb7@ohdata.se>
In-Reply-To: <629d6766-763b-0120-6bd8-9bcdbc280561@skypro.be>
References:  <29ee61d3-6eb7-ccf7-3de9-2ecdccdcbb6b@skypro.be> <06f5ba53fac300855b580d127fdfc57466807a9c.camel@freebsd.org> <a9c73d47-f0a6-3c3a-645a-bedd709b9f3d@skypro.be> <596e6c178a78a8c5bdb62505f593b3878aae1a1f.camel@freebsd.org> <629d6766-763b-0120-6bd8-9bcdbc280561@skypro.be>

next in thread | previous in thread | raw e-mail | index | archive | help
2021-02-19 00:52 skrev Kristoff:
> Hi all,
> 
> (inline comments)
> 
> On 12/02/2021 3:15 a.m., Ian Lepore wrote:
>> 
>>>> The beaglebone has a special pps driver that uses the am335x chip's
>>>> timer hardware to measure the pps pulse time with better accuracy
>>>> than
>>>> the generic gpio-pps driver.  To use it, add
>>>> 
>>>>     am335x_dmtpps_load=YES
>>> At the same time I also wanted to try the pps driver you mention.
>>> 
>>> However, it does not seams to load.
>>> 
>>> I get this:
>>> 
>>> [root@black1 ~]# kldload am335x_dmtpps
>>> kldload: can't load am335x_dmtpps: No such file or directory
>>> 
>>> 
>>> The issue seams to be this:
>>> 
>>> # dmesg
>>> (...)
>>> KLD am335x_dmtpps.ko: depends on ti_sysc - not available or version
>>> mismatch
>>> 
>>> Looking on my system, I seems to have the source of 'to_sysc', but
>>> not
>>> the .ko.
>>> [root@black1 ~]# locate ti_sysc
>>> /usr/src/sys/arm/ti/ti_sysc.c
>>> /usr/src/sys/arm/ti/ti_sysc.h
>>> 
>>> 
>>> What is the procedure to compile one single kernel-module?
>>> I tried "make ti_sysc", but that failed due to compilation errors
>>> 
>>> 
>> Hmm, are you using the GENERIC kernel, or a custom kernel, or what?
>> The ti_sysc device is a relative newcomer, and we may have neglected 
>> to
>> add it to the GENERIC config.  There probably isn't a makefile to 
>> build
>> it as a module.
>> 
>> So the fix for that would be to add 'device ti_sysc' to whatever 
>> kernel
>> config you're using and rebuild the kernel.
> 
> OK, still working on this.
> 
> Still stuck:
> UART now works!
> PPS does not.
> 
> 
> Sofar not solution. This is my situation:
> 
> - FreeBSD 12.1: device-tree does not seams to work
> - FreeBSD 12.2: for some reason, all "beaglebone" images I find on
> https://download.freebsd.org/ftp/snapshots/arm/armv7/ISO-IMAGES/12.2/
> do not boot at all, or -if they boot- have strange issues. (like a
> simple reboot taking up 2 hours!)
> 

To get FreeBSD 12.2 to work on BBB you need to revert the devicetree.
https://reviews.freebsd.org/D26552
Its probably not worth your time to get 12.2 up n running, spend the 
time on getting head to compile and run on your device instead.

> - FreeBSD 13.0: Now still running an version:
> --> the version I do have now is this one:
> FreeBSD 13.0-CURRENT #0 f2ea0734875-c254544(main): Thu Nov 19 09:15:27
> UTC 2020
> root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC
> 
> But that does not contain the "ti_sysc" module.
> (as stated earlier)
> 

Its in the kernel for BBB, you dont need to build ti_sysc as a module.
If you dont have the ti_sysc you cant start the BBB at all.

# kldstat -v | grep ti_sysc

> -> I wanted to try a newer version, all "beaglebone" images for 13.0
> seams to have disappeared from the ftp-server
> https://download.freebsd.org/ftp/snapshots/arm/armv7/ISO-IMAGES/13.0/
> 
> (actually, that folder does not even exist any more)
> 
> -> I also tried using the 13.0 kernel with gpiopps module (better then
> nothing), sofar without success.
> 
> 
> 
> So, I guess, the next step is -as you proposed- to try to compile a new 
> kernel.
> 
> I have never done this. I have been looking in the handbook how to do 
> this.
> I guess I need to create a 'MYKERNEL' file for the beaglebone.
> 
> Question. Is there a repository of 'MYKERNEL' files for board so I
> have a config-file to start from.
> I do not know all the kernel-options and hardware-features of the
> beaglebone black, it would be nice to have something to start from
> that I know actually works!
> 
> 
> Note:
> As proposed, I added the line "device ti_sysc" at the end of the
> configuration-file, but I get this error:
> 
> config: Error: device "ti_sysc" is unknown
> 
> I guess that one line in the config-file is not enough?
> 

A workaround for current codebase is to add following to your kernel 
config (MYKERNEL/GENERIC/whatever you call it)
device am335x_dmtpps

Recompile and ensure you have modified your loader.conf
(in my case hw.am335x_dmtpps.input="P8-9" or issue # kenv 
hw.am335x_dmtpps.input="P8-9")

  # dmesg | grep -i pps
uart0: PPS capture mode: DCD
am335x_dmtpps: configured pin P8-9 as input for timer5
am335x_dmtpps0: <AM335x PPS-Capture DMTimer5> mem 0-0x3ff irq 23 on 
ti_sysc18
am335x_dmtpps0: Using DMTimer5 for PPS device /dev/dmtpps




To get am335x_dmtpps to work as a module ti_sysc.c needs to be modified. 
Append to the end of sys/arm/ti/ti_sysc.c
MODULE_VERSION(ti_sysc, 1);

# kldload am335x_dmtpps.ko
ti_pinmux0: setting internal 2a for timer5
am335x_dmtpps: configured pin P8-9 as input for timer5
am335x_dmtpps0: <AM335x PPS-Capture DMTimer5> mem 0-0x3ff irq 23 on 
ti_sysc18
Timecounter "DMTimer5" frequency 24000000 Hz quality 1000
am335x_dmtpps0: Using DMTimer5 for PPS device /dev/dmtpps



> 
> 
> (Anycase, I am really learning a lot here)
> 
> 
>> -- Ian
>> 
> Cheerio!
> 
> Kr. Bonne.
> _______________________________________________
> freebsd-arm@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"

-- 
Bästa Hälsningar
Oskar Holmlund
Tel 070-3220292



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cbddc3782c8b0a55a3691fa586c08eb7>