Sunix PCI parallel port chips and cards Linux
- wearyhacker
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 3
29 Jan 2022 17:22 - 14 Feb 2022 14:49 #233454
by wearyhacker
Sunix PCI parallel port chips and cards Linux was created by wearyhacker
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
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
Attachments:
Last edit: 14 Feb 2022 14:49 by wearyhacker.
The following user(s) said Thank You: tommylight, phew
Please Log in or Create an account to join the conversation.
- wearyhacker
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 3
06 Feb 2022 15:44 #234117
by wearyhacker
Replied by wearyhacker on topic Sunix PCI parallel port chips and cards Linux
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.
14 Feb 2022 10:11 #234798
by DigiDet
Replied by DigiDet on topic Sunix PCI parallel port chips and cards Linux
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. 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!
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. 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.
- wearyhacker
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 3
14 Feb 2022 10:24 #234799
by wearyhacker
Replied by wearyhacker on topic Sunix PCI parallel port chips and cards Linux
PCI domain ids have a period not a colon seperating the second and third parts.
NN:NN.N
NN:NN.N
Please Log in or Create an account to join the conversation.
14 Feb 2022 11:31 #234804
by DigiDet
Replied by DigiDet on topic Sunix PCI parallel port chips and cards Linux
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
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.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
14 Feb 2022 12:11 #234808
by tommylight
Replied by tommylight on topic Sunix PCI parallel port chips and cards Linux
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:From your resultsI/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.
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:
sudo lspci -v
and
cat /proc/ioports | grep parport
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>
Please Log in or Create an account to join the conversation.
- wearyhacker
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 3
14 Feb 2022 12:33 #234814
by wearyhacker
Replied by wearyhacker on topic Sunix PCI parallel port chips and cards Linux
The -- is a typo should be a single -. I will fix it in the repo.
This is what I see.
$ lspci -vvns 02:00.0
02:00.0 0708: 1fd4:1999
Subsystem: 1fd4:0101
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-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at d020
Region 1: I/O ports at d050
Region 2: I/O ports at d040
Region 3: I/O ports at d000
Capabilities: <access denied>
You can get more with sudo.
$ sudo lspci -vvns 02:00.0
02:00.0 0708: 1fd4:1999
Subsystem: 1fd4:0101
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-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at d020
Region 1: I/O ports at d050
Region 2: I/O ports at d040
Region 3: I/O ports at d000
Capabilities: [60] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [68] MSI: Enable- Count=1/32 Maskable+ 64bit+
Address: 0000000000000000 Data: 0000
Masking: 00000000 Pending: 00000000
Capabilities: [80] Express (v2) Legacy Endpoint, MSI 00
DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <2us, L1 <32us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR-, OBFF Not Supported
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
This is what I see.
$ lspci -vvns 02:00.0
02:00.0 0708: 1fd4:1999
Subsystem: 1fd4:0101
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-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at d020
Region 1: I/O ports at d050
Region 2: I/O ports at d040
Region 3: I/O ports at d000
Capabilities: <access denied>
You can get more with sudo.
$ sudo lspci -vvns 02:00.0
02:00.0 0708: 1fd4:1999
Subsystem: 1fd4:0101
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-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at d020
Region 1: I/O ports at d050
Region 2: I/O ports at d040
Region 3: I/O ports at d000
Capabilities: [60] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [68] MSI: Enable- Count=1/32 Maskable+ 64bit+
Address: 0000000000000000 Data: 0000
Masking: 00000000 Pending: 00000000
Capabilities: [80] Express (v2) Legacy Endpoint, MSI 00
DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <2us, L1 <32us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR-, OBFF Not Supported
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Please Log in or Create an account to join the conversation.
14 Feb 2022 13:06 #234817
by DigiDet
Replied by DigiDet on topic Sunix PCI parallel port chips and cards Linux
many thanks, Now I can follow your instruction. It works, but I have not really acces to the port via hal.
I think I have to find a way to "enable" the Regions / i/o´s before it will be a win...
any ideas are very welcome...
Detlev
I think I have to find a way to "enable" the Regions / i/o´s before it will be a win...
any ideas are very welcome...
Detlev
Please Log in or Create an account to join the conversation.
Time to create page: 0.138 seconds