Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 318977 - PCMCIA serial port couldn't be properly detected
Summary: PCMCIA serial port couldn't be properly detected
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: PPC Linux
: High enhancement
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-08 16:41 UTC by Paul Osmialowski
Modified: 2010-09-12 17:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Osmialowski 2010-05-08 16:41:43 UTC
It's not a bug, rather regression with some misery workaround.
Some days ago I replaced Fedora 8 on my PowerBook G4 with Gentoo. It resulted in some advantages (backlight working again!), however soon I discovered one drawback. Since I need serial port on this machine (and PowerBook does not have any), I am using PCMCIA card Argosy SP320-1P (single serial port, rather rare thing) (mainly because it has real 16550A UART). There was no problem with it on Fedora.
First problem is that this is 16-bit card and it uses ISA hardware interrupts. During kernel configuration I was mislead by help page on ISA bus which says I don't need it really on Apple machines. Looking at Fedora dmesgs I've found:
Yenta: ISA IRQ mask 0x000 PCI irq 53
while there was no such dmesg message on Gentoo. So I configured ISA bus no matter what help page says, and finally I got the same dmesg message on Gentoo. What more, my card started to be discovered. Unfortunately wrong way.
setserial /dev/ttyS0 says:
/dev/ttyS0, UART: unknown, Port: 0x103f8, irq: 53
while on Fedora it says:
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 53
So I added such a line to /etc/serial.conf (I did rc-update add serial boot):
/dev/ttyS0 uart 16550A port 0x3f8
...and after reboot my serial port is working!
I spent two days to find it (changing HDD in PowerBook can make crazy the most patient person in the world: I have Fedora on old disk and Gentoo on new one).


Reproducible: Always

Steps to Reproduce:
Well, it is rare PCMCIA card, so rather you won't reproduce it.

Actual Results:  
card cannot be used

Expected Results:  
card is working as in Fedora

It's not the first time Fedora autodetection capabilities helped me with configuring hardware. Why so?
Comment 1 Matti Bickel (RETIRED) gentoo-dev 2010-05-18 10:13:03 UTC
Thanks for reporting this bug. To help the maintainers diagnose why this problem occured, please attach your emerge --info output.
Comment 2 Paul Osmialowski 2010-05-19 08:20:49 UTC
Portage 2.1.8.3 (default/linux/powerpc/ppc32/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.32-gentoo-r7 ppc)
=================================================================
System uname: Linux-2.6.32-gentoo-r7-ppc-7447A,_altivec_supported-with-gentoo-1.12.13
Timestamp of tree: Sun, 16 May 2010 10:30:01 +0000
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.8.5-r4, 1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="ppc"
ACCEPT_LICENSE="*"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -fomit-frame-pointer -pipe"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1"
LINGUAS="pl"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="7zip R aalib acl aio alisp alsa altivec amr animgif ao apm audio autotrace bash-completion bcmath berkdb bittorrent blas bzip2 calendar caps catalogs cblas cdf cgi chicken chm clamd clamdtop cleartype cli clisp consolekit contrib cracklib crypt ctype ctypes-python curl cvs cxx daemon dbus deprecated devfs-compat dirac discard-path discouraged djbfft djvu dri ebook edit elisp emacs encode enscript eselect exceptions exif expat extensions extras faac faad fame ffmpeg fftw filter finger fits flac fluidsynth fontconfig fontforge fortran ftp fts3 gd gdbm geoip geos gif ginac glibc-omitfp gmath gml gmp gnutls gopher gphoto2 gpm graphviz gs gsm gstreamer guile gzip-el hal hardcoded-tables hash hdf5 hlapi ibam iconv icu idn ieee1394 imlib inifile iodbc ipv6 jack java java6 javacomm javascript jbig jms jpeg jpeg2k json ladspa lame lapack laptop largefile lash lasi latex lcms libcaca libproxy libsamplerate libssh2 libwww libyaml linuxkeys llvm lua lvm1 lzo m17n-lib mad mcve md5sum metis mew mhash mikmod mmap mode-owner modules motif mozsha1 mp3 mudflap mzscheme native-exceptions ncurses net netcdf network networking new-clx nls nntp no-old-linux nodrm nptl nptlonly nss ntlm ntp objc objc++ objc-gc ocaml ocamlopt octave odbc ogdi ogg openmp pam pari pasteafter pcntl pcre pdf pdo perl perl-geoipupdate pg-intdatetime php pic plotutils plugins pm-utils png portaudio posix postgres ppc ppcsha1 pppd proj python qhull rcs readline reflection regex rle ruby sasl schroedinger script sctp sdl server session sha512 sharedext sharedmem shm simplexml slang sms sndfile snmp soap sockets sound soundex sparse speex spell spl sql sqlite3 ssl staticsocket subversion suexec suhosin supernodal svg svm sysfs sysvipc szip tcl tcpd theora threads threadsafe tidy tiff tilepath tk tokenizer toolbar toolkit-scroll-bars tools truetype type3 unicode usb utils uuid v4l v4l2 vdpau video vorbis wddx webdav webdav-neon x264 xbase xcb xft xgetdefault xinetd xml xmlreader xmlwriter xmp xorg xpdf-headers xpm xsl xvid yaz zip zlib" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus aoa-soundbus-i2s aoa-tas aoa-toonie powermac usb-audio via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias asis imagemap proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http" APACHE2_MPMS="prefork" CAMERAS="canon spca50x template" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="pl" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="dummy radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 3 SpanKY gentoo-dev 2010-05-20 02:40:24 UTC
base-system doesnt deal with kernel problems or user misconfiguration

probably better to seek help in the gentoo powerpc forums/irc channels since this doesnt appear to be a bug in source
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2010-05-20 13:21:00 UTC
So Fedora detects it properly but gentoo-sources does not? Now is the time to attach the relevant kernel configs to this bug report.
Comment 5 Michael Weber (RETIRED) gentoo-dev 2010-06-07 00:33:12 UTC
Hi, thanks for tracing this down. Can you provide any vendor/hardware id of this device? Just to assist search engines/crawlers to pick up this bug and direct other users to this bug. You might change the Subject to carry the relevant data, if another user searches here.

I think that this is valuable information, but assigned to bug-wranglers is the wrong location. Someone might assign it to a specific herd (gentoo-sources maintainer is kernel@g.o), but we need the config first.
Comment 6 Paul Osmialowski 2010-06-07 09:35:22 UTC
All informations I could get:
lspcmcia -v
Socket 0 Bridge:        [yenta_cardbus]         (bus ID: 0001:10:13.0)
        Configuration:  state: on       ready: yes
                        Voltage: 5.0V Vcc: 5.0V Vpp: 0.0V
Socket 0 Device 0:      [serial_cs]             (bus ID: 0.0)
        Configuration:  state: on
        Product Name:   ARGOSY RS-COM 1P 2V1
        Identification: function: 2 (serial)
                        prod_id(1): "ARGOSY" (0x78f308dc)
                        prod_id(2): "RS-COM 1P" (0x860de295)
                        prod_id(3): "2V1" (0x9ad0cb16)
                        prod_id(4): --- (---)

pccardctl config:
PRODID_1="ARGOSY"
PRODID_2="RS-COM 1P"
PRODID_3="2V1"
PRODID_4=""
MANFID=0000,0000
FUNCID=2

pccardctl info:
Socket 0:
  5.0V 16-bit PC Card
  Subdevice 0 (function 0) bound to driver "serial_cs"

Looking at drivers/serial/serial_cs.c it is not clear which of static struct pcmcia_device_id serial_ids[] was taken, the closest one would be
PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"),
which is quite popular card, however, this my card is a rare thing, it is "RS-COM 1P" so I'm pretty sure this cis/RS-COM-2P.cis file will not fit to this (unfortunately, I can't find cis/RS-COM-1P.cis file). It is operated by kernel anyway, I don't know how, and I can see this table didn't change much since Fedora 8, so the problem of proper setting by setserial lies somewhere else.

Dmesg about cardbus, pcmcia, ISA bus:

[    0.009637] pci 0001:10:13.0: CardBus bridge, secondary bus 0001:11
[    0.009657] pci 0001:10:13.0:   IO window: 0x001000-0x0010ff
[    0.009675] pci 0001:10:13.0:   IO window: 0x001100-0x0011ff
[    0.009693] pci 0001:10:13.0:   PREFETCH window: 0x84000000-0x87ffffff
[    0.009712] pci 0001:10:13.0:   MEM window: 0x88000000-0x8bffffff
[    1.124846] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.125919] pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
[    1.126168] ttyPZ0 at MMIO 0x80013020 (irq = 22) is a Z85c30 ESCC - Serial port
[    1.126689] ttyPZ1 at MMIO 0x80013000 (irq = 23) is a Z85c30 ESCC - Serial port
[    5.852814] yenta_cardbus 0001:10:13.0: CardBus bridge found [0000:0000]
[    5.861324] yenta_cardbus 0001:10:13.0: Enabling burst memory read transactions
[    5.869815] yenta_cardbus 0001:10:13.0: Using CSCINT to route CSC interrupts to PCI
[    5.878316] yenta_cardbus 0001:10:13.0: Routing CardBus interrupts to PCI
[    5.886754] yenta_cardbus 0001:10:13.0: TI: mfunc 0x00001002, devctl 0x60
[    5.996199] yenta_cardbus 0001:10:13.0: ISA IRQ mask 0x0000, PCI irq 53
[    6.004462] yenta_cardbus 0001:10:13.0: Socket status: 30000410
[    6.012641] yenta_cardbus 0001:10:13.0: pcmcia: parent PCI bridge I/O window: 0x0 - 0x7fffff
[    6.021017] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x0-0x7fffff: clean.
[    6.271088] yenta_cardbus 0001:10:13.0: pcmcia: parent PCI bridge Memory window: 0xf3000000 - 0xf3ffffff
[    6.279705] yenta_cardbus 0001:10:13.0: pcmcia: parent PCI bridge Memory window: 0x80000000 - 0xafffffff
[    6.544358] Intel ISA PCIC probe: Machine check in kernel mode.
[    7.300343] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0
[    7.307682] pcmcia_socket pcmcia_socket0: cs: memory probe 0xf3000000-0xf3ffffff: clean.
[    7.320161] pcmcia 0.0: pcmcia: registering new device pcmcia0.0

My setserial is sys-apps/setserial-2.17-r4

I don't plan to place whole .config file here, this is mission critical machine.
Comment 7 Michael Weber (RETIRED) gentoo-dev 2010-06-07 10:21:41 UTC
data provided
Comment 8 SpanKY gentoo-dev 2010-07-31 06:49:16 UTC
... but it's still a kernel bug or kernel misconfiguration, not setserial issue

simply look at the `strace` of it and the only thing it does is TIOCGSERIAL.  and the .type field of serial_struct is read directly.

you can check it yourself:
$ setserial /dev/ttyUSB0
/dev/ttyUSB0, UART: 16654, Port: 0x0000, IRQ: 0

$ cat test.c
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <asm/ioctls.h>
#include <linux/serial.h>
int main(int argc, char *argv[]) {
    struct serial_struct x;
    int fd = open(argv[1] ? : "/dev/ttyS0", O_RDONLY);
    printf("ioctl(%i)=%i\n", fd, ioctl(fd, TIOCGSERIAL, &x));
    printf(".type = %i\n", x.type);
}

$ gcc test.c
$ ./a.out /dev/ttyUSB0
ioctl(3)=0
.type = 11

$ grep PORT_.*11 /usr/include/linux/serial.h
#define PORT_16654      11
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-03 03:52:16 UTC
It would be helpful if you could point out the kernel misconfiguration that causes this. I don't see how withholding your kernel config helps solve the problem here.
Comment 10 Paul Osmialowski 2010-09-12 17:25:26 UTC
After kernel update to 2.6.34-gentoo-r1 I cannot track this anymore: enabling PCMCIA in kernel config (with yenta socket and so on) causes whole system to crash at boot time. Messages are spinning too fast to figure out what's wrong and since sysklogd is not started yet, there's no easy way to get the reason for a crash. Disabling PCMCIA solves the problem.