Linux Device Driver ZL50408

Linu Cherian linucherian at
Sat Nov 1 08:48:05 UTC 2008

On Fri Oct 24, 2008 at 07:58:49AM +0530, Linu Cherian wrote:

> Caleb,
> I would like to help on this. I have worked on the management
> driver of similar chip. Probably we need two seperate drivers, CMIIW.
> - management driver with a char interface for switch management
> - network driver for managing the data packets
> and Iam interested to work on the management driver if you agree with
> the above. Or do we have a better way of doing it?

Caleb, iam posting the top level design to the list for feedbacks.

The processor interface provides three basic operations
1. read/write configuration register
2. send/receive Contorl command frames - for reading port statistics,
   manipulating the MAC table etc.
3. send/receive Ethernet frame
   This is the case in which the CPU management interface is used as a
   switch data port. In this case, CPU has to be assigned a MAC address.

Obviously, the driver for the ZL50408, should provide mechanisms to
carry out the above three operations.

* Operations 1 & 2 can be exported using two char dev interfaces, say
  /dev/zlreg and /dev/zlctrlfrm. User space applications can
  make use of read/write system calls to do configuration register
  access or to send/receive control frames.

* Operation 1(configuration register access) through /dev/zlreg:
  Congiguration registes are accessed through the memory mapped index
  register and data register.

  /* Cofiguration register write */
  uint16_t address;
  uint8_t data;

  address = 0x10;
  data = 0xaa; 
  ioctl(fd, SET_CONFIGADDR, &address);
  write(fd, &data, 1); /* write to single register */

  /* Configuraton register read */
  uint16_t address;
  uint8_t data;

  address = 0x10;
  ioctl(fd, SET_CONFIGADDR, &address);
  read(fd, &data, 1); /* read from single register */
  Since the interface supports consecutive reads/writes, user space
  can request for multiple register read/write using a single system call.

* Operation 2(send/receive control command frames) through
  /dev/zlctrlfrm. Framing and decoding of control frames need to be
  handled in a user space library.

* Operation 3(sending and receiving ethernet frames) can be exported
  using the network interface say eth1. So, the driver should have
  (say)eth_frame_tx and eth_frame_rx functions exported to the network layer.

Processor interface document is available here. 

Is this the right design to move forward?

Linu cherian

More information about the devel mailing list