Commit 0eeca14f authored by Samuel Iglesias Gonsalvez's avatar Samuel Iglesias Gonsalvez Committed by Greg Kroah-Hartman

Staging: ipack: added support for the TEWS TPCI-200 carrier board

Driver for the carrier board TEWS TPCI-200, a bridge between PCIe bus and
IndustryPack bus.
Signed-off-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d3465872
......@@ -7,3 +7,8 @@ menuconfig IPACK_BUS
---help---
If you say Y here you get support for the IndustryPack Framework.
if IPACK_BUS
source "drivers/staging/ipack/bridges/Kconfig"
endif # IPACK
......@@ -2,3 +2,4 @@
# Makefile for the IPACK bridge device drivers.
#
obj-$(CONFIG_IPACK_BUS) += ipack.o
obj-y += bridges/
......@@ -12,6 +12,16 @@ operations between the two kind of boards.
TODO
====
TPCI-200
--------
* It receives the name of the mezzanine plugged in each slot by SYSFS.
No autodetection supported yet, because the mezzanine driver could not be
loaded at the time that the tpci200 driver loads.
* It has a linked list with the tpci200 devices it is managing. Get rid of it
and use driver_for_each_device() instead.
Ipack
-----
......
config BOARD_TPCI200
tristate "TEWS TPCI-200 support for IndustryPack bus"
depends on IPACK_BUS
depends on PCI
help
This driver supports the TEWS TPCI200 device for the IndustryPack bus.
default n
obj-$(CONFIG_BOARD_TPCI200) += tpci200.o
This diff is collapsed.
/**
* tpci200.h
*
* driver for the carrier TEWS TPCI-200
* Copyright (c) 2009 Nicolas Serafini, EIC2 SA
* Copyright (c) 2010,2011 Samuel Iglesias Gonsalvez <siglesia@cern.ch>, CERN
* Copyright (c) 2012 Samuel Iglesias Gonsalvez <siglesias@igalia.com>, Igalia
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#ifndef _TPCI200_H_
#define _TPCI200_H_
#include <linux/version.h>
#include <linux/limits.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/swab.h>
#include <linux/io.h>
#include "../ipack.h"
#define TPCI200_SHORTNAME "TPCI200"
#define TPCI200_NB_SLOT 0x4
#define TPCI200_NB_BAR 0x6
#define TPCI200_VENDOR_ID 0x1498
#define TPCI200_DEVICE_ID 0x30C8
#define TPCI200_SUBVENDOR_ID 0x1498
#define TPCI200_SUBDEVICE_ID 0x300A
#define TPCI200_IP_INTERFACE_BAR 2
#define TPCI200_IO_ID_INT_SPACES_BAR 3
#define TPCI200_MEM16_SPACE_BAR 4
#define TPCI200_MEM8_SPACE_BAR 5
#define TPCI200_REVISION_REG 0x00
#define TPCI200_CONTROL_A_REG 0x02
#define TPCI200_CONTROL_B_REG 0x04
#define TPCI200_CONTROL_C_REG 0x06
#define TPCI200_CONTROL_D_REG 0x08
#define TPCI200_RESET_REG 0x0A
#define TPCI200_STATUS_REG 0x0C
#define TPCI200_IFACE_SIZE 0x100
#define TPCI200_IO_SPACE_OFF 0x0000
#define TPCI200_IO_SPACE_GAP 0x0100
#define TPCI200_IO_SPACE_SIZE 0x0080
#define TPCI200_ID_SPACE_OFF 0x0080
#define TPCI200_ID_SPACE_GAP 0x0100
#define TPCI200_ID_SPACE_SIZE 0x0040
#define TPCI200_INT_SPACE_OFF 0x00C0
#define TPCI200_INT_SPACE_GAP 0x0100
#define TPCI200_INT_SPACE_SIZE 0x0040
#define TPCI200_IOIDINT_SIZE 0x0400
#define TPCI200_MEM8_GAP 0x00400000
#define TPCI200_MEM8_SIZE 0x00400000
#define TPCI200_MEM16_GAP 0x00800000
#define TPCI200_MEM16_SIZE 0x00800000
#define TPCI200_INT0_EN 0x0040
#define TPCI200_INT1_EN 0x0080
#define TPCI200_INT0_EDGE 0x0010
#define TPCI200_INT1_EDGE 0x0020
#define TPCI200_ERR_INT_EN 0x0008
#define TPCI200_TIME_INT_EN 0x0004
#define TPCI200_RECOVER_EN 0x0002
#define TPCI200_CLK32 0x0001
#define TPCI200_A_RESET 0x0001
#define TPCI200_B_RESET 0x0002
#define TPCI200_C_RESET 0x0004
#define TPCI200_D_RESET 0x0008
#define TPCI200_A_TIMEOUT 0x1000
#define TPCI200_B_TIMEOUT 0x2000
#define TPCI200_C_TIMEOUT 0x4000
#define TPCI200_D_TIMEOUT 0x8000
#define TPCI200_A_ERROR 0x0100
#define TPCI200_B_ERROR 0x0200
#define TPCI200_C_ERROR 0x0400
#define TPCI200_D_ERROR 0x0800
#define TPCI200_A_INT0 0x0001
#define TPCI200_A_INT1 0x0002
#define TPCI200_B_INT0 0x0004
#define TPCI200_B_INT1 0x0008
#define TPCI200_C_INT0 0x0010
#define TPCI200_C_INT1 0x0020
#define TPCI200_D_INT0 0x0040
#define TPCI200_D_INT1 0x0080
#define TPCI200_SLOT_INT_MASK 0x00FF
#define VME_IOID_SPACE "IOID"
#define VME_MEM_SPACE "MEM"
/**
* struct slot_irq - slot IRQ definition.
* @vector Vector number
* @handler Handler called when IRQ arrives
* @arg Handler argument
* @name IRQ name
*
*/
struct slot_irq {
int vector;
int (*handler)(void *);
void *arg;
char name[IPACK_IRQ_NAME_SIZE];
};
/**
* struct tpci200_slot - data specific to the tpci200 slot.
* @slot_id Slot identification gived to external interface
* @irq Slot IRQ infos
* @io_phys IO physical base address register of the slot
* @id_phys ID physical base address register of the slot
* @mem_phys MEM physical base address register of the slot
*
*/
struct tpci200_slot {
struct ipack_device *dev;
struct slot_irq *irq;
struct ipack_addr_space io_phys;
struct ipack_addr_space id_phys;
struct ipack_addr_space mem_phys;
};
/**
* struct tpci200_infos - informations specific of the TPCI200 tpci200.
* @pci_dev PCI device
* @interface_regs Pointer to IP interface space (Bar 2)
* @ioidint_space Pointer to IP ID, IO and INT space (Bar 3)
* @mem8_space Pointer to MEM space (Bar 4)
* @access_lock Mutex lock for simultaneous access
*
*/
struct tpci200_infos {
struct pci_dev *pdev;
struct pci_device_id *id_table;
void *interface_regs;
void *ioidint_space;
void *mem8_space;
spinlock_t access_lock;
struct ipack_bus_device drv;
};
struct tpci200_board {
struct list_head list;
unsigned int number;
struct mutex mutex;
struct tpci200_slot *slots;
struct tpci200_infos *info;
};
#endif /* _TPCI200_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment