From owner-freebsd-hackers@freebsd.org Sat Mar 3 22:03:02 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC2D0F4029E for ; Sat, 3 Mar 2018 22:03:01 +0000 (UTC) (envelope-from sblachmann@gmail.com) Received: from mail-qk0-x232.google.com (mail-qk0-x232.google.com [IPv6:2607:f8b0:400d:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AAB478C68; Sat, 3 Mar 2018 22:03:01 +0000 (UTC) (envelope-from sblachmann@gmail.com) Received: by mail-qk0-x232.google.com with SMTP id s188so16383134qkb.2; Sat, 03 Mar 2018 14:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9yOi6fFg5xVF4dDH3fKWNXX6mPrEVr34TuPmdjTCo30=; b=TcCWmq4Ua2ulcrd22mdRaM1is6Pujyy6z5VT0n2pL7MFPpghNUyl/4tr8BA3biatSe GdDaqeqnKNtKK8CRF+PNac+0nIWBLFEmJccdbLzJc9MrT/GXPNwR1ishnkQfe3yx4Dbe d5+5m9lyx9A2TfUVS6t2LBmB+eRClpAJ/F4HBAH3NPn1J/NvuScw3FV/pBbLN5b2kXlO A8+A7fdhOlD5NXmrPo+kvAP6W58rMLivok3Je3HZ4evvHPnUsSyhSpJcAmJsShqvhJX4 rjb0x02VRjFmLPpSonUUYM6fTn2/Pkgmx9+BkRM8BM9OYDY9UkOLgDiXEZyVILh2rUku Yqhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9yOi6fFg5xVF4dDH3fKWNXX6mPrEVr34TuPmdjTCo30=; b=mjhaBHqJuQpura8JNMgpW0e1ee5b3MiGzK6bzmbZUx0cnep6UHCl4D9K1wlPsmrzk4 v3YDudc32PUFlg6jB+Qvzwbg5CVvfvrSC2/HQnXLndC7NnvPPDRY/0tCaUjp2sZhwqnB czi/gXujUy0D7HT9K7sYmux/68+6Gf1AgSU/1bTA2OWVERuMZ2D6aIHWy5/D1fAbjK47 881tgdflo5IEshCtWG5B07vGFZj4sZXHtmYST1fIPr1L95RnuigTC5SD1h4ru9PZbSYo Xadg7HFSLjha7MT6LUaaX0cUdF4EHVgDGQY2Tyi3sUUB8rHGh94HjAPVSuzxYY/xB+tt +6ag== X-Gm-Message-State: AElRT7FYVpwBkGpNmNoT4F6TzN6Wikv6UxyxeHMTdaB0WH6FPu4/gNAZ hIDXHNO5/sG0Slzn/H4jKHEa/K6zDQIGI5QJ4PE= X-Google-Smtp-Source: AG47ELsTnZLIxuUPkQx5rk0Vd803sBnKaOKYpeZXHUeHzgTfGIMZxor3U3SmEwFpD3GHAZqg1Svdsz+bq0mcjecxixw= X-Received: by 10.55.148.6 with SMTP id w6mr15308706qkd.293.1520114581044; Sat, 03 Mar 2018 14:03:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.32.74 with HTTP; Sat, 3 Mar 2018 14:03:00 -0800 (PST) In-Reply-To: <20180303202345.GA32478@bali> References: <20180302061852.GA7887@bali> <20180303064400.GA27337@bali> <20180303184359.GA29745@bali> <20180303202345.GA32478@bali> From: Stefan Blachmann Date: Sat, 3 Mar 2018 23:03:00 +0100 Message-ID: Subject: Re: Adding support for MosChip 9912 PCIe (serial/parallel) cards To: Andre Albsmeier Cc: Daniel Eischen , freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Mar 2018 22:03:02 -0000 In the forums there is a thread where a guy had to download the chips' datasheet to obtain the correct IDs to add to pucdata.c. You find code and links here: https://forums.freebsd.org/threads/pcie-6-port-serial-card.63489/ HTH On 3/3/18, Andre Albsmeier wrote: > On Sat, 03-Mar-2018 at 14:41:58 -0500, Daniel Eischen wrote: >> On Sat, 3 Mar 2018, Andre Albsmeier wrote: >> >> > On Sat, 03-Mar-2018 at 10:53:20 -0500, Daniel Eischen wrote: >> >> On Sat, 3 Mar 2018, Andre Albsmeier wrote: >> >> >> >>> On Fri, 02-Mar-2018 at 08:36:40 -0500, Daniel Eischen wrote: >> >>>> On Fri, 2 Mar 2018, Andre Albsmeier wrote: >> >>>> >> >>>>> I have a MosChip 9912 card (PCIe card with 1 parallel and 2 serial >> >>>>> ports) sitting here which does not get detected on 11.1. I tried >> >>>>> to simply add it to the uart and ppc drivers with >> >>>>> >> >>>> [ ... ] >> >>>> >> >>>> Do you try adding similar support to puc_pci_devices[] in >> >>>> sys/dev/puc/pucdata.c? >> >>> >> >>> Just tried that: >> >>> >> >>> @@ -1204,6 +1204,11 @@ >> >>> PUC_PORT_1S1P, 0x10, 4, 0, >> >>> }, >> >>> >> >>> +{ 0x9710, 0x9912, 0xa000, 0x3012, >> >>> + "NetMos NM9912 Dual UART and 1284 Printer port", >> >>> + DEFAULT_RCLK, >> >>> + PUC_PORT_2S1P, 0x10, 4, 0, >> >>> +}, >> >>> { 0x9710, 0x9865, 0xa000, 0x3012, >> >>> "NetMos NM9865 Dual UART and 1284 Printer port", >> >>> DEFAULT_RCLK, >> >>> >> >>> But the results are exactly the same. It also doesn't >> >>> matter if puc.ko is loaded at all. >> >> >> >> Are you sure your subvendor and subdevice are correct? I would >> > >> > No ;-). I have to use: 0x9710, 0x9912, 0xa000, 0x2000, >> > >> > Now I have the following behaviour: >> > >> > When I load puc.ko I get: >> > puc0: at device 0.2 on >> > pci9 >> > >> > If I load ppc.ko now, I get: >> > ppc0: parallel port not found. >> > >> > But if I unload puc and ppc and load ppc again, I get: >> > >> > ppc0: port >> > 0xd000-0xd007,0xd008-0xd00f mem 0x89200000-0x89200fff irq 20 at device >> > 0.2 on pci9 >> > ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode >> > ppbus0: on ppc0 >> > lpt0: on ppbus0 >> > lpt0: Interrupt-driven port >> > >> > For all this I have to disable /boot/device.hints -- otherwise >> > the messages "driver bug: Unable to set devclass" comes back. >> > >> > So I think there are two problems: >> > >> > First the settings of the ISA stuff in /boot/device.hints conflicted >> > with the settings the driver probed. This would be easy to solve -- >> > just disable them in /boot/device.hints. >> > >> > Second it appears that ppc only attaches if puc did some kind of >> > initialisation first. But we have to detach puc so the ppc can attach. >> >> Strange. Did you try setting puc_load="YES" in /boot/loader.conf >> and rebooting? Or are you just loading and unloading modules >> for now? > > The latter. After each successful try I reboot to get rid of that > magic initialisation puc does. > > But maybe I am getting closer: The card has 2 serial and 1 parallel > port. But these 3 ports appear in pciconf as 3 seperate devices: > > none7@pci0:9:0:0: class=0x070002 card=0x1000a000 chip=0x99129710 > rev=0x00 hdr=0x00 > vendor = 'MosChip Semiconductor Technology Ltd.' > device = 'PCIe 9912 Multi-I/O Controller' > class = simple comms > subclass = UART > none8@pci0:9:0:1: class=0x070002 card=0x1000a000 chip=0x99129710 > rev=0x00 hdr=0x00 > vendor = 'MosChip Semiconductor Technology Ltd.' > device = 'PCIe 9912 Multi-I/O Controller' > class = simple comms > subclass = UART > none9@pci0:9:0:2: class=0x070103 card=0x2000a000 chip=0x99129710 > rev=0x00 hdr=0x00 > vendor = 'MosChip Semiconductor Technology Ltd.' > device = 'PCIe 9912 Multi-I/O Controller' > class = simple comms > subclass = parallel port > > Looking at the source code of puc, I find a place where it checks > the number of ports a device provides and aborts if it has only > one port. This would match my understanding that puc only exists > in order to help uart and ppc to work with multi-port devices > where all ports are handled by a single device in pciconf. > > Until now, I used PUC_PORT_2S1P in my puc entry. So puc assumes > that the card 0x2000a000 has 2 serial and 1 parallel port but > this is probably wrong as this 0x2000a000 card only has one > parallel port and the serials are handled by other devices. > So the correct entry would be PUC_PORT_1P but with one single > port puc does not attach. > > If all this is correct, I assume that puc should be left alone > and ppc_pci.c is the thing I have to look at. > > This also matches the fact that uart attaches well to these two > serial ports without the need of loading and unloading puc first > so there is probably some kind of device specific initialisation > missing in ppc_pci.c... > > -Andre > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >