how difficult is making a miniPCI/PCI card for Linux? - Page 1
Forum section: electronics / general

author: legacy
author_rank: Super Contributor
timestamp: March 11, 2019, 01:38:37 pm
content: I am so irritated because my RSP router does not accept any PCI_IO cards, it only accepts PCI_MEM_ONLY cards and I am not able to find a multi-uart card that fits this need.Besides, I also have *A LOT* of troubles with VIDEO cards on SGI IP30, because SGI didn't respect the intel specification about the PCI, so ... a Matrox M1/M2 does not work, neither a 3DFX voodoo1 ... and similarsIn short I'd like to develop- a miniPCI card with 4 uart chips on it- a very simple VDU(1) with a little of support (not accelerated) fox X11(1) I have already designed and implemented a fully working USB-TO-LCD-320x240 module so I can recycle a part of the kernel module.Now *THE* question: is there any development kit for making such cards? reference design? anything?

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 11, 2019, 01:52:18 pm
content: You can use a PCI FPGA board, not sure if they're really cheap nowadays thanks to the original PCI being obsolete for a long time or really hard to find for a reasonable price.https://www.fpga4fun.com/PCI.html

author: legacy
author_rank: Super Contributor
timestamp: March 11, 2019, 02:48:23 pm
content: I am more tempted about using a PLX chip rather than implementing the PCI_bus's stuff inside the FPGA.So I am more oriented to something that comes with a PLX chip in the middle.It's really weird, but it's true, neither Ubiquiti nor Mikrotik have ever done a Linux-friendly router concerning the (mini)PCI. I haven't yet tested product with miniPCIe, but about the old-line (2003-2008). some do not implement PCI_IO, some have a lot of PCI-quirks in the PCI (forget miniPCI-sATA, miniPCI-usb, and similar: they just do not work), and recent models have features deliberately limited with Linux in order to make the performance to drop on cool stuff if you do not pay for specialized proprietary modules, and something similar applies to specialized proprietary hardware modules, e.g. crypto accelerators for VPN

author: legacy
author_rank: Super Contributor
timestamp: March 11, 2019, 11:33:59 pm
content: Code:PCI host bridge to bus 0000:00pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]pci_bus 0000:00: root bus resource [io 0x18800000-0x188fffff]pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]pci 0000:00:00.0: [Firmware Bug]: reg 0x14: invalid BAR (can't size)pci 0000:00:00.0: [Firmware Bug]: reg 0x18: invalid BAR (can't size)This is another annoying thing that sometimes (too often) happens with common PC cards used on routers.

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 12, 2019, 02:19:53 am
content: Could you use a PCI NIC that's compatible along with a single board computer or network enabled microcontroller of some sort? I'm having a hard time of thinking of other ways to implement PCI without a FPGA. (What sort of PCI cards do work?)

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 10:47:36 am
content: Quote from: NiHaoMike on March 12, 2019, 02:19:53 amPLX chip! do offer a bridge between the PCI bus and kind of simple local bus.Old MESA PCI-FPGA cards were made this way.The problem is: these chip are not easy to be programmed, and I cannot find a miniPCI development board -> do I need to design my own board?I'd prefer a kit with an SDK ... or a skeleton for getting started.Quote from: NiHaoMike on March 12, 2019, 02:19:53 amPCI_MEM_ONLY, without PCI-quirks about BARs: so basically Ubiquiti routers (e.g. the RS/Pro) only accept Atheros wifi cards

author: OwO
author_rank: Super Contributor
timestamp: March 12, 2019, 11:06:14 am
content: PCI is probably trivial to do on an old Spartan 6 since it doesn't need any transceivers or high clock rates.

author: magic
author_rank: Super Contributor
timestamp: March 12, 2019, 11:30:05 am
content: Maybe USB? PCI EHCIs appear to only use MMIO.Maybe you could find something off the shelf or see if any chips are available in low quantities and with public datasheet.

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 12:12:08 pm
content: Quote from: magic on March 12, 2019, 11:30:05 amit's weird but I haven't yet found a PCI_MEM_ONLY miniPCI-EHCI, however, NEC EHCI cards are compatible with the weird SGI_PCI (so they use a subset of the Intel specs and they are 100% compliant with this) and do work.I asked a vendor if they have a PCI_MEM_ONLY miniPCI-EHCI cardslegacy: do you happen to have any PCI_MEM_ONLY miniPCI-EHCI cards for sale?vendor: no, but we can reconfigure our cards PCI_MEM_ONLYlegacy: awesome!vendor: How many units are you willing to order? 1000? 10.000? 100.000?legacy: Ummm just a couple of boards for evaluating ...... hang up ... no more replies ...Anyway, this means it can be done!

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 12:15:10 pm
content: Quote from: OwO on March 12, 2019, 11:06:14 amYup! MESA gen2 (superIO cards) were made this way. It's a bit expensive, but for PCI it might be interesting. Unfortunately, they do not offer any miniPCI card.When you say trivial ... well, the HDL code for the interface part is really complex and I'd like to avoid it.

author: brucehoult
author_rank: Super Contributor
timestamp: March 12, 2019, 12:52:41 pm
content: There's a pretty nice "Implement PCI in an FPGA" tutorialherestarting from a blinky, and going on to implementing a small PCI RAM and other things. Complete with source code for the PC side driver too.

author: brucehoult
author_rank: Super Contributor
timestamp: March 12, 2019, 12:56:47 pm
content: Ah, damn, there was already a link to that site posted. As you were...But it does look easy.

author: magic
author_rank: Super Contributor
timestamp: March 12, 2019, 01:05:38 pm
content: Okay, first of all, if I google PCI_MEM_ONLY, I only get 10 hits and for all I know all of them may have been written by youSo, what exactly do you mean by that? If it's only a matter of the device using solely memory BARs rather than IO, I expect that every EHCI will be the same as any other for the sake of compatibility and common drivers. In fact, I checked that the EHCI spec clearly prescribes the standard register block (USBBASE) to be memory-mapped. It doesn't prohibit additional vendor-specific registers, but I doubt anyone does it. Certainly not the Intel EHCI on my laptop here. So, if you can get something/anything, just get it and try.

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 01:24:29 pm
content: Quote from: magic on March 12, 2019, 01:05:38 pmsome chips do really need to operate with both PCI_MEM and PCI_IO spaces, some can be reprogrammed, and when it's possible PCI chips can be programmed for operating in a way rather than in another. E.g. (I have reimplemented so I know it can be done) the Oxford Semiconductor can be reprogrammed for being PCI_MEM_ONLY, but .. you have to know how to configure the EEPROM on the card, otherwise, the PCI_localbus bridge on the chip might use both spaces.try lspci -v and look at how the chip is configured on the miniPCI card: if the vendor did program it for PCI_IO then that chip requires the PCI_IO space.Code:00:03.0 Ethernet controller: VIA Technologies, Inc. VT6105/VT6106S [Rhine-III] (rev 86)Subsystem: AST Research Inc Device 086cFlags: bus master, stepping, medium devsel, latency 64, IRQ 143I/O ports at 18800400 [size=257] <--------------- PCI_IO spaceMemory at 50014100 (32-bit, non-prefetchable) [size=257] <---------- PCI_MEM spaceCapabilities:  Power Management version 2Kernel driver in use: via-rhineexample of PCI_MEM + PCI_IO deviceCode:00:04.0 Network controller: Atheros Communications Inc. Device 0029 (rev 01)Subsystem: Atheros Communications Inc. Device 2091Flags: bus master, 66MHz, medium devsel, latency 168, IRQ 142Memory at 50000000 (32-bit, non-prefetchable) [size=64K]Capabilities:  Power Management version 2Kernel driver in use: ath9kexample of PCI_MEM_ONLY device

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 01:31:01 pm
content: Quote from: magic on March 12, 2019, 01:05:38 pmTry to find a miniPCI card with an EHCI chip on it that operates PCI_MEM_ONLYMy NEC-PCI Card is PCI_MEM_ONLY, but it's PCI not miniPCI. I haven't yet found a miniPCI one that works this way.Dunno why/what, I know that I am not able to find anything on the market, except a card that, when tested on the RS/Pro Linux box, exposed a couple of PCI_IO regs, so I sent an email to the vendor and they wrote me back that it can technically be done but it's not what they are currently selling, so for getting their attention on a what is clearly defined "a customization" I need to order q.ty 1000 for the minimal.This is interesting for making my own EHCI card, anyway.

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 02:13:23 pm
content: Code:0001:10:18.0 USB controller: Apple Inc. KeyLargo USB (prog-if 10 )Flags: bus master, medium devsel, latency 16, IRQ 27Memory at 80081000 (32-bit, non-prefetchable) [size=4K]Kernel driver in use: ohci-pcithis is the built-in USB chip on the MDD PowerMacG4: PCI_MEM_ONLY. So, technically it's even easier, and about USB miniPCI cards implementing PCI_IO it seems more about a vendor strategyCode:0002:20:0e.0 FireWire (IEEE 1394): Apple Inc. UniNorth 2 FireWire (rev 01) (prog-if 10 )Subsystem: Apple Inc. iBook G4 2004Flags: bus master, medium devsel, latency 64, IRQ 40Memory at f5000000 (32-bit, non-prefetchable) [size=4K]Capabilities:  Power Management version 2Kernel driver in use: firewire_ohciThis is more interesting: the above shot comes from "lspci -v" on the PowerMacG4 and it's clearly another example of PCI_MEM_ONLY device. Firewire cards should be all PCI_MEM_ONLY. That's awesome, I also happen to have a couple of miniPCI firewire/400 cards, so I thought that this ought to work on my MIPS-routers ... unfortunately, there is a big problem with firewire: it's PCI BUS master, a thing that cannot work because it's not supported in rb532 and rs/proTests:LE-366 router SBC mini board AMD (x86) Geode LX 800, Linux 4.9.6: fw-sotrage does works! ip-on-fw does worksUbiquiti RouterStation/pro (aka rs/pro), Linux 2.6.39: fw-storage does not work, probe failure, ip-on-fw crashes the kernel at the first tryMikrotik rb532a, Linux 4.9.91: fw-storage does not work, ip-on-fw stalls forever or causes a kernel crashSo ... we are moving a couple of tasks to the LE-366 router, which is actually an x86-compatible PC.

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 02:19:31 pm
content: E-366 router: PCI_MEM and full PCI_IOMikrotik rb532: PCI_MEM, partial PCI_IO, some IO regs are not implemented/availableUbiquiti RouterStation/Pro: PCI_MEM_ONLY, PCI_IO space NOT implemented

author: magic
author_rank: Super Contributor
timestamp: March 12, 2019, 05:42:22 pm
content: Quote from: legacy on March 12, 2019, 01:31:01 pmSo you actually own that hardware and the only thing the vendor refused is to make a custom version?I suppose it works on Linux just fine? Can you post lspci -vvvxxx of that thing?

author: legacy
author_rank: Super Contributor
timestamp: March 12, 2019, 07:56:00 pm
content: Quote from: magic on March 12, 2019, 05:42:22 pmso it wasthe onlyminiPCI EHCI card I was able to find.Quote from: magic on March 12, 2019, 05:42:22 pmIt worked only on the LE-366 with Linux, it did neither work with rb532 and nor with rs/p. I have already sent the unit back to the vendor for money back since it's a bit expensive and the LE-366 already has the USB stuff.

author: magic
author_rank: Super Contributor
timestamp: March 13, 2019, 11:36:11 am
content: Meh, nevermind then. I wondered if it could be hacked - if the important USBBASE registers are MMIO as they ought to be, Linux could perhaps be made to STFU about the irrelevant ones.

author: technix
author_rank: Super Contributor
timestamp: March 13, 2019, 03:20:08 pm
content: If you are going the FPGA route, you can consider just use PCI IP cores as concrete black boxes.