Commit ba88b5e2 authored by Alessandro Rubini's avatar Alessandro Rubini

basic core: does nothing but registers successfully

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 1e143662
/*
* Copyright (C) 2010-2012 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*
* This work is part of the White Rabbit project, a research effort led
* by CERN, the European Institute for Nuclear Research.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/io.h>
#include "spec.h"
static char *spec_names[SPEC_MAX_BOARDS];
static int spec_n_names;
module_param_array_named(name, spec_names, charp, &spec_n_names, 0444);
DEFINE_PCI_DEVICE_TABLE(spec_idtable) = {
{ PCI_DEVICE(PCI_VENDOR_ID_CERN, PCI_DEVICE_ID_SPEC) },
{ PCI_DEVICE(PCI_VENDOR_ID_GENNUM, PCI_DEVICE_ID_GN4124) },
{ 0,},
};
/* The loader is laid out as a kernel thread, to simplify stuff */
/* FIXME */
static struct list_head spec_list;
/* The probe can be called in atomic context, so all loading is delayed */
static int spec_probe (struct pci_dev *pdev, const struct pci_device_id *id)
{
struct spec_dev *dev;
printk("%s\n", __func__);
/* FIXME */
return 0;
}
static void spec_remove(struct pci_dev *pdev)
{
printk("%s\n", __func__);
/* FIXME */
}
static struct pci_driver spec_driver = {
.name = "spec",
.id_table = spec_idtable,
.probe = spec_probe,
.remove = spec_remove,
};
static int spec_init(void)
{
INIT_LIST_HEAD(&spec_list);
return pci_register_driver(&spec_driver);
}
static void spec_exit(void)
{
pci_unregister_driver(&spec_driver);
}
module_init(spec_init);
module_exit(spec_exit);
MODULE_LICENSE("GPL");
/*
* Copyright (C) 2010-2012 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*
* This work is part of the White Rabbit project, a research effort led
* by CERN, the European Institute for Nuclear Research.
*/
#ifndef __SPEC_H__
#define __SPEC_H__
#include <linux/pci.h>
#include <linux/workqueue.h>
#include <linux/firmware.h>
#include <linux/list.h>
#define PCI_VENDOR_ID_CERN 0x10dc
#define PCI_DEVICE_ID_SPEC 0x018d
#define PCI_VENDOR_ID_GENNUM 0x1a39
#define PCI_DEVICE_ID_GN4124 0x0004
#define SPEC_MAX_BOARDS 8
/* Our device structure */
struct spec_dev {
struct pci_driver *pci_driver;
struct pci_dev *pdev;
struct resource *area[3]; /* bar 0, 2, 4 */
void *remap[3]; /* ioremap of bar 0, 2, 4 */
char *fw_name;
char *elf_name;
char *submod_name;
struct work_struct work;
const struct firmware *fw;
struct list_head list;
unsigned long irqcount;
};
/* Registers from the gennum header files */
enum {
GNGPIO_BASE = 0xA00,
GNGPIO_DIRECTION_MODE = GNGPIO_BASE + 0x4,
GNGPIO_OUTPUT_ENABLE = GNGPIO_BASE + 0x8,
GNGPIO_OUTPUT_VALUE = GNGPIO_BASE + 0xC,
GNGPIO_INPUT_VALUE = GNGPIO_BASE + 0x10,
FCL_BASE = 0xB00,
FCL_CTRL = FCL_BASE,
FCL_STATUS = FCL_BASE + 0x4,
FCL_IODATA_IN = FCL_BASE + 0x8,
FCL_IODATA_OUT = FCL_BASE + 0xC,
FCL_EN = FCL_BASE + 0x10,
FCL_TIMER_0 = FCL_BASE + 0x14,
FCL_TIMER_1 = FCL_BASE + 0x18,
FCL_CLK_DIV = FCL_BASE + 0x1C,
FCL_IRQ = FCL_BASE + 0x20,
FCL_TIMER_CTRL = FCL_BASE + 0x24,
FCL_IM = FCL_BASE + 0x28,
FCL_TIMER2_0 = FCL_BASE + 0x2C,
FCL_TIMER2_1 = FCL_BASE + 0x30,
FCL_DBG_STS = FCL_BASE + 0x34,
FCL_FIFO = 0xE00,
PCI_SYS_CFG_SYSTEM = 0x800
};
#endif /* __SPEC_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