LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   GPIO access on a Fujitsu Mini-ITX Industrial Mainboard, PCI Driver for GPIO (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/gpio-access-on-a-fujitsu-mini-itx-industrial-mainboard-pci-driver-for-gpio-914260/)

mechatrix 11-18-2011 10:42 AM

GPIO access on a Fujitsu Mini-ITX Industrial Mainboard, PCI Driver for GPIO
 
Hey folks,
I'd like to ask you for some help to get access to the GPIO-Pins on my Fujitsu Mini-ITX Industrial Mainboard (D2963-S).
I found a documentation already,
http://www.avrfreaks.net/wiki/index....PIO#gpio-sysfs
but I don't know what's the right way to set the registers etc in my case.
The datasheet says....
Code:

  8Bit gpio port connected to the SB600.
  Gpio00 to Gpio07 are connected to gpio53 to gpio60 of SB600
  The registers are in PCI config space: Bus 00h, Device 14h, Function 00h

                              Direction (0-output;1-input)  input status    output value(0-Low;1-high)
                                    default is output                              default is low

Feature connector Gpio 0  Gpio53  PCI_Reg:52h;Bit[4]      PCI_Reg:52h;Bit[8]    PCI-Reg:52h;Bit[0]
Feature connector Gpio 1  Gpio54  PCI_Reg:52h;Bit[5]      PCI_Reg:52h;Bit[9]    PCI-Reg:52h;Bit[1]
Feature connector Gpio 2  Gpio55  PCI_Reg:52h;Bit[6]      PCI_Reg:52h;Bit[10]  PCI-Reg:52h;Bit[2]
Feature connector Gpio 3  Gpio56  PCI_Reg:52h;Bit[7]      PCI_Reg:52h;Bit[11]  PCI-Reg:52h;Bit[3]

Feature connector Gpio 4  Gpio57  PCI_Reg:52h;Bit[4]      PCI_Reg:52h;Bit[8]    PCI-Reg:52h;Bit[0]
Feature connector Gpio 5  Gpio58  PCI_Reg:52h;Bit[5]      PCI_Reg:52h;Bit[9]    PCI-Reg:52h;Bit[1]
Feature connector Gpio 6  Gpio59  PCI_Reg:52h;Bit[6]      PCI_Reg:52h;Bit[10]  PCI-Reg:52h;Bit[2]
Feature connector Gpio 7  Gpio60  PCI_Reg:52h;Bit[7]      PCI_Reg:52h;Bit[11]  PCI-Reg:52h;Bit[3]

Anybody some hints for me? :)
thanks

Doc CPU 11-18-2011 03:40 PM

Hi there,

Quote:

Originally Posted by mechatrix (Post 4527624)
I'd like to ask you for some help to get access to the GPIO-Pins on my Fujitsu Mini-ITX Industrial Mainboard (D2963-S).
I found a documentation already,
http://www.avrfreaks.net/wiki/index....PIO#gpio-sysfs

what a pity that the documentation you found doesn't match your problem. Not at all.
The document you linked to describes Linux running on an AVR micro controller system, not on a PC-like hardware.

This How-To seems more appropriate to your situation.

[X] Doc CPU

mechatrix 11-20-2011 07:28 AM

Thanks a lot for your advice Doc CPU!
But I'm still not sure if I realy understand the howto / if I understand the hole task right:
The GPIOs are connected via PCI
Quote:

8Bit gpio port connected to the SB600.
Gpio00 to Gpio07 are connected to gpio53 to gpio60 of SB600
The registers are in PCI config space: Bus 00h, Device 14h, Function 00h
Do I have to write a driver for the access to the GPIOs first?
The howto explains giving permission with ioperm, but [...] ioperm() can only give access to ports 0x000 through 0x3ff
Athttp://www.makelinux.co.il/ldd3/chp-12-sect-1
I found a explanation of PCI,
Quote:

[...]Each PCI peripheral is identified by a bus number, a device number, and a function number. [...]Each function can be identified at hardware level by a 16-bit address, or key. Device drivers written for Linux, though, don't need to deal with those binary addresses, because they use a specific data structure, called pci_dev, to act on the devices.[...]When power is applied to a PCI device, the hardware remains inactive. In other words, the device responds only to configuration transactions.[...]
Nevertheless I'm not sure what to do next, someone out there who can push me in the right direction?

Doc CPU 11-20-2011 03:57 PM

Hi there,

Quote:

Originally Posted by mechatrix (Post 4528890)
But I'm still not sure if I realy understand the howto / if I understand the hole task right:
The GPIOs are connected via PCI

in a way, you have to write your own PCI driver to access the GPIO port on that board. I hadn't thought it would be that complicated; all boards featuring a GPIO board that I've had so far, initialized that port on their own during BIOS startup, so that I only had to read or write one I/O address to use the GPIO.

Your Fujitsu board, however, seems to leave the entire task of addressing and initializing this port to the application. And honestly I've never done that. Would probably take me hours to dig into PCI documentation.

Quote:

Originally Posted by mechatrix (Post 4528890)
The howto explains giving permission with ioperm, but [...] ioperm() can only give access to ports 0x000 through 0x3ff

Using the PCI functions of the Linux kernel, you probably don't need ioperm().

Quote:

Originally Posted by mechatrix (Post 4528890)
At http://www.makelinux.co.il/ldd3/chp-12-sect-1
I found a explanation of PCI

That looks promising, but I'd allow for at least a day of studying this and other documents before I could achieve anything.
Sorry I'm out here, I thought it would be easier ...

[X] Doc CPU


All times are GMT -5. The time now is 11:32 PM.