2006-05-10 09:24:56

by Andrea Galbusera

[permalink] [raw]
Subject: custom parallel interface driver

In the context of a PowerPC Linux project I am required to support a
custom parallel interface. The hardware module implementing such
interface lives on a FPGA board connected to the PowerPC by the PCI
bus.

I'm reading developer's docs about the parport subsystem: I'm asking
myself how to use (if possible) all that already available code. Do I
have to develop a new low-level driver using pci and parport
interfaces? Or may I expect to be able to use parport_pc?
Unfortunately I still don't have the hardware available and I'm
evaluating the complexity of this task.

Here are some specifications of the hardware module to support (not
developed by me):
- single unidirectional Centronics-like with control signals interface
- 1K x 8bit FIFO for data

Minimal driver requirements are:
- capability to read data from the FIFO (possiblbly through ususal
device file interfaces and using interrupts)
- capability to read/write control registers of the interface

These may sound as very preliminar questions. In fact, they are! My
kernel development experience is just at the beginning, but I have a
basic knowledge of kernel module writing and I read Rubini's book on
the subject.

Hope somebody can suggest me how to approach the problem, to avoid
re-inventing the wheel...

TIA


2006-05-10 16:57:51

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: custom parallel interface driver

On Wednesday 10 May 2006 03:24, Andrea Galbusera wrote:
> Here are some specifications of the hardware module to support (not
> developed by me):
> - single unidirectional Centronics-like with control signals interface
> - 1K x 8bit FIFO for data
>
> Minimal driver requirements are:
> - capability to read data from the FIFO (possiblbly through ususal
> device file interfaces and using interrupts)
> - capability to read/write control registers of the interface

If the parallel interface is directly exposed as a PCI device
and it supports the typical 8255 programming model, it should
just work if you add the appropriate vendor and device IDs to
parport_pc_pci_tbl[].

The serial driver has a default case that claims any device that
PCI_CLASS_COMMUNICATION_SERIAL class code. In theory, the parport
driver could claim anything with PCI_CLASS_COMMUNICATION_PARALLEL.
In that case, you wouldn't even need to modify anything. But
maybe there are issues that prevent parport_pc.c from doing this.

The following sites have lots of information that might be useful
to you:
http://www.torque.net/linux-pp.html
http://www.lvr.com/parport.htm