* can't detect 16550A at port 0x010 on Vortex86dx board
@ 2012-07-06 21:00 Aras Vaichas
2012-07-06 22:54 ` Alan Cox
0 siblings, 1 reply; 5+ messages in thread
From: Aras Vaichas @ 2012-07-06 21:00 UTC (permalink / raw)
To: linux-serial
I've got a board based on the Vortex86DX CPU which is an x86 based
microcontroller. It has five 16550A UARTS, four (COM1-COM4) of which
are at the usual i/o port addresses (0x3f8, 0x2f8, 0x3e8, 0x2e8) but
the fifth (COM9) is at 0x010, irq 9.
http://www.dmp.com.tw/tech/vortex86dx/
The problem is that I can't get the fifth one (COM9) to work in Linux.
COM9 works correctly in a stand-alone DOS application when accessed at
i/o port 0x010, but I can't even detect it from Linux.
What I've done so far:
* added COM9 to /drivers/tty/serial/8250/ (hacked existing driver to
probe at 0x010)
* enabled DEBUG_AUTOCONF in /drivers/tty/serial/8250/8250.c so I can
see when and which addresses are being probed.
* editted /arch/x86/kernel/setup.c because i/o port 0x010 overlapped
an existing region reserved for dma1 which caused request_region() to
fail. Datasheet for CPU confirmed different reserved i/o port regions.
Result: the kernel failed to probe the UART at address 0x010 with the
error "IER test failed".
I used an i/o port probing utility to manually read/write port 0x010
but I could not detect any 16550A registers in the 0x010 to 0x017
region. It appears there is nothing there. I tried to write and read
back data from the scratch register (offset +7), but it did nothing.
My same tests pass on the other four UART addresses.
The datasheet for the CPU doesn't say much about COM9.
ftp://ftp.dmp.com.tw/DMP_Vortex86_Series_Software_Programming_Reference_091216.pdf
On page 156 it mentions an "On-Chip Device Control Register" on the
Southbridge which has a bit for doing "something" with COM9, but it
doesn't say what it does. AFAIK the DOS application does not configure
the Southbridge.
I wrote a utility to read and write the Southbridge registers but I
still failed to detect the UART.
Am I on the right path?
What else should I try?
Would Linux block my ability to manually probe these i/o ports?
thanks,
Aras Vaichas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: can't detect 16550A at port 0x010 on Vortex86dx board
2012-07-06 21:00 can't detect 16550A at port 0x010 on Vortex86dx board Aras Vaichas
@ 2012-07-06 22:54 ` Alan Cox
2012-07-09 12:42 ` Aras Vaichas
0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2012-07-06 22:54 UTC (permalink / raw)
To: Aras Vaichas; +Cc: linux-serial
> Would Linux block my ability to manually probe these i/o ports?
Not beyond reserving the region which you've said you've covered.
What you may want to try is making sure Linux doesn't program the DMA
controller (in case its doing something which disables the port in poking
at it).
Beyond that I guess ask the manufacturer for info.
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: can't detect 16550A at port 0x010 on Vortex86dx board
2012-07-06 22:54 ` Alan Cox
@ 2012-07-09 12:42 ` Aras Vaichas
2012-07-09 15:15 ` Aras Vaichas
0 siblings, 1 reply; 5+ messages in thread
From: Aras Vaichas @ 2012-07-09 12:42 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-serial
On 6 July 2012 23:54, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> Would Linux block my ability to manually probe these i/o ports?
>
> Not beyond reserving the region which you've said you've covered.
>
> What you may want to try is making sure Linux doesn't program the DMA
> controller (in case its doing something which disables the port in poking
> at it).
>
> Beyond that I guess ask the manufacturer for info.
Thank you. It turned out that I needed to configure the Southbridge.
I managed to get a complete datasheet and I have set all the correct
registers in the Southbridge to enable COM9 at port 0x010 with irq 9
(default values). Either the BIOS or Linux changed it from the default
values. I set the correct values in my serial port init_ function and
autoconfig detects the UART now.
# dmesg
<snip>
Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A
serial8250: ttyS3 at I/O 0x2e8 (irq = 3) is a 16550A
Vortex init of South Bridge for COM9
serial8250.11: ttyS4 at I/O 0x10 (irq = 9) is a 16550A
</snip>
I still have a problem though, I can't seem to use the device. e.g.
# echo hello > /dev/ttyS4
sh: write error: Input/output error
# cat /dev/ttyS4
sh: write error: Input/output error
# picocom -b 115200 /dev/ttyS4
FATAL: failed to add device /dev/ttyS4: Filedes is not a tty
# cat .config
<snip>
#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_NR_UARTS=5
CONFIG_SERIAL_8250_RUNTIME_UARTS=5
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_VORTEX=y
</snip>
# cat /proc/tty/drivers
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
serial /dev/ttyS 4 64-68 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
unknown /dev/tty 4 1-63 console
There only appears to only be 4 ttySx drivers in use.
# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:19983 rx:548 RTS|DTR|RI
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0
2: uart:16550A port:000003E8 irq:10 tx:0 rx:0
3: uart:16550A port:000002E8 irq:11 tx:7 rx:0
4: uart:16550A port:00000010 irq:9 tx:0 rx:0
Aras
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: can't detect 16550A at port 0x010 on Vortex86dx board
2012-07-09 12:42 ` Aras Vaichas
@ 2012-07-09 15:15 ` Aras Vaichas
2012-07-09 15:52 ` Alan Cox
0 siblings, 1 reply; 5+ messages in thread
From: Aras Vaichas @ 2012-07-09 15:15 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-serial
> # cat .config
> <snip>
> #
> # Serial drivers
> #
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_FIX_EARLYCON_MEM=y
> CONFIG_SERIAL_8250_NR_UARTS=5
> CONFIG_SERIAL_8250_RUNTIME_UARTS=5
> CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_MANY_PORTS=y
> CONFIG_SERIAL_8250_VORTEX=y
> </snip>
CONFIG_SERIAL_8250_SHARE_IRQ=y
It needed IRQ sharing to make it work.
COM9 on a Vortex86DX is now working in Linux 3.3.8 but it requires
more than a simple serial driver patch.
I'm not entirely sure how to go about creating a proper patch for the
changes I have made. My serial driver writes to the South Bridge, but
it's a quick hack using outl() calls to the right addresses. Should I
use a proper PCI function call?
I also modified the x86 io port mappings in /arch/x86/kernel/setup.c.
Do I either add #ifdef-ery to setup.c, or create a new entry in
arch/x86/kernel/cpu/ and do my different io mappings there?
Aras
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: can't detect 16550A at port 0x010 on Vortex86dx board
2012-07-09 15:15 ` Aras Vaichas
@ 2012-07-09 15:52 ` Alan Cox
0 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2012-07-09 15:52 UTC (permalink / raw)
To: Aras Vaichas; +Cc: linux-serial
> CONFIG_SERIAL_8250_SHARE_IRQ=y
>
> It needed IRQ sharing to make it work.
Fair enough, that's usually set.
> COM9 on a Vortex86DX is now working in Linux 3.3.8 but it requires
> more than a simple serial driver patch.
>
> I'm not entirely sure how to go about creating a proper patch for the
> changes I have made. My serial driver writes to the South Bridge, but
> it's a quick hack using outl() calls to the right addresses. Should I
> use a proper PCI function call?
If the Southbridge is a PCI device then yes.
> I also modified the x86 io port mappings in /arch/x86/kernel/setup.c.
> Do I either add #ifdef-ery to setup.c, or create a new entry in
> arch/x86/kernel/cpu/ and do my different io mappings there?
ifdeffery is bad. New cpu type is preferable. If the differences are
trivial then some kind of runtime handling is even better.
What you could do is post the hack patch with the questions attached -
not as a proposed kernel patch but as a "what is needed" guide so we can
work out the best way to do it.
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-09 15:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 21:00 can't detect 16550A at port 0x010 on Vortex86dx board Aras Vaichas
2012-07-06 22:54 ` Alan Cox
2012-07-09 12:42 ` Aras Vaichas
2012-07-09 15:15 ` Aras Vaichas
2012-07-09 15:52 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox