LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 01-29-2018, 12:27 PM   #1
kylewgale
LQ Newbie
 
Registered: Jan 2018
Location: San Jose, CA
Posts: 4

Rep: Reputation: Disabled
Help registering memory-mapped UART8250/16550


Here is brief summary of my situation:
I have two identical x86 boards, connected via an FPGA<->FPGA UART. The FPGAs have some memory-mapped registers which are supposed to implement UART8250/16550. The FPGA SDK provides some user-space driver that can facilitate communication via API calls, but I was hoping to use standard Linux 8250/16550 drivers and have a device file that I can use with picocom or something similar.

My question is, how would I register this UART console with the kernel and have a /dev/ttyS# to use?

I tried putting this in my kernel boot line with the memory-mapped offset of the 8250/16550 registers:
console=uart8250,mmio32,0x908030a0,115200n8

I don't think it quite accomplishes what I want. Seems like just some kind of early console that doesn't carry on after boot.
[ 0.000000] earlycon: Early serial console at MMIO32 0x908030a0 (options '115200n8')
[ 0.000000] bootconsole [uart0] enabled
...
[ 9.589154] bootconsole [uart0] disabled
 
Old 01-30-2018, 05:51 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,144

Rep: Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308
The first thing I would say is that the 8250 and 16550 are very different animals. The 8250 was primitive; you want the 16550 if you're offered the choice, 16550A actually.

The kernel loads modules for what it detects. Do your serial ports show in dmesg/syslog?
 
1 members found this post helpful.
Old 01-30-2018, 12:11 PM   #3
kylewgale
LQ Newbie
 
Registered: Jan 2018
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
The first thing I would say is that the 8250 and 16550 are very different animals. The 8250 was primitive; you want the 16550 if you're offered the choice, 16550A actually.

The kernel loads modules for what it detects. Do your serial ports show in dmesg/syslog?
Thanks - the FPGA implements a 16550 UART. It doesn't show up in dmesg unless I use that earlycon/console flag shown in my initial post, but then it disables itself after kernel boots and disappears (I think this is expected behavior). I believe the issue is that the UART implementation right now is just a range of registers in memory mapped PCI space and kernel has no way to detect it as a UART without being informed that it is. Most people I see online use some kind of device tree for this situation but I don't know if that is really the only solution.
 
Old 01-30-2018, 02:14 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
When you use the boot mode option, does the output show up on this console? Are you able to receive anything on the FPGA? If yes, the UART is compatible with the generic driver. If it doesn't, it might mean that the register set is different and you'll have to look which hardware block it is and if there's another driver in Linux to support it.

When you're done with finding out if the port is compatible, it should be possible to create the right device tree so that you have the console all the time.
 
Old 01-30-2018, 06:58 PM   #5
kylewgale
LQ Newbie
 
Registered: Jan 2018
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Mara View Post
When you use the boot mode option, does the output show up on this console? Are you able to receive anything on the FPGA? If yes, the UART is compatible with the generic driver. If it doesn't, it might mean that the register set is different and you'll have to look which hardware block it is and if there's another driver in Linux to support it.

When you're done with finding out if the port is compatible, it should be possible to create the right device tree so that you have the console all the time.
I am not really looking at this console yet since it is an FPGA<->FPGA UART and I don't have a driver working on the Rx side to see.

But, if we assume UART is compatible with the generic driver, and the kernel just doesn't know about it, is device tree the only way to resolve this? I know very little about device trees but my platform is not currently using one and it doesn't seem that common on x86. I wonder if this is something BIOS/UEFI might be able to establish before kernel gets loaded.
 
Old 02-02-2018, 01:02 PM   #6
kylewgale
LQ Newbie
 
Registered: Jan 2018
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: Disabled
Just answering my own question in case anyone in the future finds this,

I was able to add my FPGA's PCI/UART IP information in the drivers/tty/serial/8250/8250_pci.c data structures so that the kernel could detect it at boot & create /dev/ttySN for each UART channel.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How memory mapped IO works? haribabu1836 Linux - Hardware 1 04-18-2013 11:17 AM
Memory mapped devices skorek Linux - Embedded & Single-board computer 3 10-24-2011 02:27 PM
memory mapped i/o and i/o mapped i/o shilpa rangappa General 1 12-14-2009 10:27 PM
Network device Memory mapped or Port mapped ?? Bignon Linux - Hardware 0 10-20-2009 08:36 AM
Memory Mapped file IO problems legogt Programming 0 08-01-2003 01:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration