Commit 2e9f6600 authored by Cesar Prados's avatar Cesar Prados

vme_wb: dummy driver for kernels > 3.10, under development

parent 265296e7
/*
* Copyright (C) 2012-2013 GSI (www.gsi.de)
* Author: Cesar Prados <c.prados@gsi.de>
*
* Released according to the GNU GPL, version 2 or any later version
*
* VME-WB bridge for VME
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/firmware.h>
#include <linux/delay.h>
#include <linux/io.h>
#include "vme_wb.h"
#include "wishbone.h"
#if defined(__BIG_ENDIAN)
#define endian_addr(width, shift) (sizeof(wb_data_t)-width)-shift
#elif defined(__LITTLE_ENDIAN)
#define endian_addr(width, shift) shift
#else
#error "unknown machine byte order (endian)"
#endif
/* Module parameters */
static int slot[VME_MAX_DEVICES];
static unsigned int slot_num;
static unsigned int vmebase[VME_MAX_DEVICES];
static unsigned int vmebase_num;
static int vector[VME_MAX_DEVICES];
static int level[VME_MAX_DEVICES];
static unsigned int vector_num;
static unsigned int vector_lev;
static int lun[VME_MAX_DEVICES] = VME_DEFAULT_IDX;
static unsigned int lun_num;
static unsigned int debug = 0;
static void wb_cycle(struct wishbone *wb, int on)
{
}
static wb_data_t wb_read_cfg(struct wishbone *wb, wb_addr_t addr)
{
return 0;
}
static void wb_write(struct wishbone *wb, wb_addr_t addr, wb_data_t data)
{
}
static wb_data_t wb_read(struct wishbone *wb, wb_addr_t addr)
{
return 0;
}
static int wb_request(struct wishbone *wb, struct wishbone_request *req)
{
return 0;
}
static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
{
}
static void wb_byteenable(struct wishbone *wb, unsigned char be)
{
}
static const struct wishbone_operations wb_ops = {
.cycle = wb_cycle,
.byteenable = wb_byteenable,
.write = wb_write,
.read = wb_read,
.read_cfg = wb_read_cfg,
.request = wb_request,
.reply = wb_reply,
};
static int __init vme_init(void)
{
printk(KERN_ALERT "This module is under development, you should load it\n");
return 0;
}
static void __exit vme_exit(void)
{
printk(KERN_ALERT "Removing the module \n");
}
module_init(vme_init);
module_exit(vme_exit);
module_param_array(slot, int, &slot_num, S_IRUGO);
MODULE_PARM_DESC(slot, "Slot where VME card is installed");
module_param_array(vmebase, uint, &vmebase_num, S_IRUGO);
MODULE_PARM_DESC(vmebase, "VME Base address of the VME card registers");
module_param_array(vector, int, &vector_num, S_IRUGO);
MODULE_PARM_DESC(vector, "IRQ vector");
module_param_array(level, int, &vector_lev, S_IRUGO);
MODULE_PARM_DESC(level, "IRQ level");
module_param_array(lun, int, &lun_num, S_IRUGO);
MODULE_PARM_DESC(lun, "Index value for VME card");
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Enable debugging information");
MODULE_AUTHOR("Cesar Prados Boda");
MODULE_LICENSE("GPL");
/* MODULE_VERSION(GIT_VERSION); */
MODULE_VERSION("v0.1");
MODULE_DESCRIPTION("vme wb bridge driver");
/*
* Copyright (C) 2012-2013 GSI (www.gsi.de)
* Author: Cesar Prados <c.prados@gsi.de>
*
* Released according to the GNU GPL, version 2 or any later version
*
* Driver for VME VME board.
*/
#ifndef __VME_H__
#define __VME_H__
#include <linux/firmware.h>
#include <wishbone.h>
#define VME_WB "vme_wb"
#define VME_MAX_DEVICES 32
#define VME_DEFAULT_IDX { [0 ... (VME_MAX_DEVICES-1)] = -1 }
/* VME CSR offsets */
#define FUN0ADER 0x7FF63
#define FUN1ADER 0x7FF73
#define WB_32_64 0x7ff33
#define BIT_SET_REG 0x7FFFB
#define BIT_CLR_REG 0x7FFF7
#define IRQ_VECTOR 0x7FF5F
#define IRQ_LEVEL 0x7FF5B
#define VME_VENDOR_ID_OFFSET 0x24
/* VME CSR VALUES */
#define WB32 1
#define WB64 0
#define RESET_CORE 0x80
#define ENABLE_CORE 0x10
#define VME_IRQ_LEVEL 0x6
#define VME_VENDOR_ID 0x80031
/* VME WB Interdace*/
#define ERROR_FLAG 0
#define SDWB_ADDRESS 8
#define CTRL 16
#define MASTER_CTRL 24
#define MASTER_ADD 32
#define MASTER_DATA 40
#define EMUL_DAT_WD 48
#define WINDOW_OFFSET_LOW 56
#define WINDOW_OFFSET_HIGH 64
#define WBM_ADD_MASK 0xFFFFFFFC
#define WINDOW_HIGH 0xFFFF0000UL
#define WINDOW_LOW 0x0000FFFCUL
enum vme_map_win {
MAP_CR_CSR = 0, /* CR/CSR */
MAP_REG, /* A32 wb space */
MAP_CTRL /* A24 wb ctrl space */
};
/* Our device structure */
struct vme_dev {
int lun;
int slot;
uint32_t vmebase;
int vector;
int level;
char driver[16];
char description[80];
struct vme_mapping *map[3];
/* struct work_struct work; */
unsigned long irq;
};
struct vme_wb_dev {
struct device *vme_dev;
struct wishbone wb;
struct vme_dev vme_res;
struct mutex mutex;
unsigned int window_offset;
unsigned int low_addr, width, shift;
};
/* Functions and data in vme_wb.c */
extern void vme_setup_csr_fa0(void *base, u32 vme, unsigned vector,
unsigned level);
extern int vme_unmap_window(struct vme_wb_dev *vetar,
enum vme_map_win map_type);
extern int vme_map_window(struct vme_wb_dev *vetar, enum vme_map_win map_type);
#endif /* __VME_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