Sunix PCI parallel port chips and cards Linux

More
4 years 9 months ago - 4 years 8 months ago #233454 by wearyhacker
 

File Attachment:

File Name: sunix.conf.txt
File Size:104 B
I have just managed to get a Sunix pci-e parallel port card to provide the correct /proc/sys/dev file system structure to allow the board to be driven from the LinuCNC rtapi on modern Linux kernels. I have tested on both Linux v4 and v5.

This is how I went about it.

1. DO NOT use the sunix provided linux driver. If you have installed it purge it and its configuration files from your system.

2. Use lspci to find the domain id of your device. It is the bit at the start of each line that looks like this nn:nn.n e.g. 02:00.0.

3. Use lspci -vvns nn:nn.n (Use your boards domain id) to find the vendor code and device codes. These are the two 4 digit hexadecimal codes separated by a colon at the end of the first line of output. Further down you will find the boards IRQ and io port address. Depending on how many ports your particular board has there will a different number of IO port regions. In my 1S1P board the correct one was Region 1.

4. Add a file (I called mine sunix.conf) to /etc/modprobe containing the following lines.

```
#LPC parport to PCI-E card
alias parport_low_level parport_pc
options parport_pc io=0xd050 irq=11,auto
```

5. Add a file to /etc/udev/rules.d (I called mine 99-sunix.rules) with following line.

```
ATTR{device}=="0x1999", ATTR{vendor}=="0x1fd4", RUN+="/sbin/modprobe parport_low_level"
```

That all you need to do. If you reboot you should a file structure something like under /proc/sys/dev/parport.

```
parport
├── default
│   ├── spintime
│   └── timeslice
└── parport0
├── autoprobe
├── autoprobe0
├── autoprobe1
├── autoprobe2
├── autoprobe3
├── base-addr
├── devices
│   └── active
├── dma
├── irq
├── modes
└── spintime

```
 
I have attached examples of the above two configuration files. I had to add an allowed extension to their names 

File Attachment:

File Name: 99-sunix.rules.txt
File Size:88 B
 

File Attachment:

File Name: instructions.md.txt
File Size:1.88 KB
 

File Attachment:

File Name: module-aliases.txt
File Size:3.32 KB
Last edit: 4 years 8 months ago by wearyhacker.
The following user(s) said Thank You: tommylight, phew

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #234117 by wearyhacker
The code and the instructions are now on github here.
The following user(s) said Thank You: seuchato

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #234798 by DigiDet
Hello, probably this is my rescue. But I am still a noob, even if I have a nice running Wheezy/2.7.14 in use since about four years...
i am going to setup a new ( older Core i3 PC) with the contemporary Buster/2.8.2 iso image. But I have problems with two PCIe Parallel cards. One of them is also a sunix and my aim is to make at least one of the cards usable for linuxcnc.
So I tried to follow this instruction:
But the command "lspci --vvns nn:nn.n" wich I changed in "lspci --vvns 02:00:0" is not accepted by my linux.
As I mentioned I am still a noob.image missing /media/kunena/emoticons/unsure.png could anybody help me to solve?

regards
Detlev

This is the current situation:

df@cnc282:~$ uname -a
Linux cnc282 4.19.0-18-rt-amd64 #1 SMP PREEMPT RT Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux
df@cnc282:~$ lsb_release -a
Description:    Debian GNU/Linux 10 (buster)

02:00.0 Parallel controller: SUNIX Co., Ltd. Multiport serial controller (prog-if 03 [IEEE1284])
    Subsystem: SUNIX Co., Ltd. Multiport serial controller
    Flags: fast devsel, IRQ 255
    I/O ports at 4020 [disabled]
    I/O ports at 4028 [disabled]
    I/O ports at 4000 [disabled]
    Capabilities: <access denied>

03:00.2 Parallel controller: Asix Electronics Corporation Device 9100 (prog-if 03 [IEEE1284])
    Subsystem: Device a000:2000
    Flags: fast devsel, IRQ 255
    I/O ports at 5008 [disabled]
    I/O ports at 5010 [disabled]
    Memory at e1102000 (32-bit, non-prefetchable) [disabled] [size=4K]
    Memory at e1103000 (32-bit, non-prefetchable) [disabled] [size=4K]
    Capabilities: <access denied>
    
 lsmod does not show any parport related module!





  

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #234799 by wearyhacker
PCI domain ids have a period not a colon seperating the second and third parts.

NN:NN.N

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #234804 by DigiDet
Thanks a lot!

df@cnc282:~$ lspci --vvns 02:00.0
lspci: invalid option -- '-'
is still not accepted, but I played and tried a bit and:
df@cnc282:~$ lspci -vv -n -s 02:00.0 did work
02:00.0 0701: 1fd4:1999 (prog-if 03 [IEEE1284])
    Subsystem: 1fd4:0100
    Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Interrupt: pin A routed to IRQ 255
    Region 1: I/O ports at 4020 [disabled]
    Region 2: I/O ports at 4028 [disabled]
    Region 3: I/O ports at 4000 [disabled]

1. So I have to go further with device 0x1999 and vendor 0x1fd4 (the same as in your case) ?
2. Does it matter at this point that Region/ports are disabled? Was it like this also in your case?
3. Is the IRQ 255 reasonable here ?
4. Should I use exactly "options parport_pc io=0xd050 irq=11,auto"

I really appreciate your help

regards
Detlev



 

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #234808 by tommylight
lspci --vvns 02:00.0
The above line is wrong and should not be used to find ... well anything as it will return info ONLY for the device on the second PCI bus.
use:
Code:
sudo lspci -v and cat /proc/ioports | grep parport
From your results
Code:
02:00.0 Parallel controller: SUNIX Co., Ltd. Multiport serial controller (prog-if 03 [IEEE1284]) Subsystem: SUNIX Co., Ltd. Multiport serial controller Flags: fast devsel, IRQ 255 I/O ports at 4020 [disabled] I/O ports at 4028 [disabled] I/O ports at 4000 [disabled] Capabilities: <access denied> 03:00.2 Parallel controller: Asix Electronics Corporation Device 9100 (prog-if 03 [IEEE1284]) Subsystem: Device a000:2000 Flags: fast devsel, IRQ 255 I/O ports at 5008 [disabled] I/O ports at 5010 [disabled] Memory at e1102000 (32-bit, non-prefetchable) [disabled] [size=4K] Memory at e1103000 (32-bit, non-prefetchable) [disabled] [size=4K] Capabilities: <access denied>
I/O ports are there, use the first one for both, and try the second address for the first port if the first does not work, but do reboot the PC before testing.

Please Log in or Create an account to join the conversation.

Time to create page: 0.200 seconds
Powered by Kunena Forum