00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef AXIS_SPI_IO_H
00035 #define AXIS_SPI_IO_H
00036 #ifndef _LINUX_KERNEL_H
00037
00038 #include <linux/kernel.h>
00039 #include <linux/sched.h>
00040 #include <linux/version.h>
00041 #include <linux/module.h>
00042 #include <linux/proc_fs.h>
00043 #include <linux/delay.h>
00044 #include <linux/pci.h>
00045 #include <linux/list.h>
00046 #include <linux/ioport.h>
00047 #include <linux/serial.h>
00048 #include <linux/interrupt.h>
00049 #include <linux/string.h>
00050 #include <linux/spinlock.h>
00051 #include <linux/mtd/mtd.h>
00052 #include <linux/crypto.h>
00053 #include <asm/uaccess.h>
00054
00055 #endif //_LINUX_KERNEL_H
00056
00057 #ifndef AXIS_HARDWARE_H
00058 #include "axis_hardware.h"
00059 #endif //AXIS_HARDWARE_H
00060
00061
00062 #define MAX_AXIS_SPI_DEVICES 4
00063 #define SPI_DATA_REGISTER_OFFSET 0x60
00064 #define SPI_CONTROL_REGISTER_1_OFFSET (SPI_DATA_REGISTER_OFFSET+1)
00065 #define SPI_CONTROL_REGISTER_2_OFFSET (SPI_DATA_REGISTER_OFFSET+2)
00066 #define SPI_ADDRESS_REGISTER_OFFSET (SPI_DATA_REGISTER_OFFSET+3)
00067 #define SPI_ENABLE_BIT (1<<7)
00068 #define SPI_ERROR_CLEAR_BIT (1<<0)
00069 #define SPI_MASTER_ACTIVE (1<<3)
00070 #define SPI_TX_REG_EMPTY (1<<2)
00071 #define SPI_RX_REG_READY (1<<1)
00072 #define SPI_OVERRUN (1<<0)
00073 #define SPI_INTERRUPT_ENABLE (1<<7)
00074 #define SPI_MASTER_MODE (1<<6)
00075 #define SPI_LSB_FIRST (1<<5)
00076
00077
00078 struct spi_op ;
00086 struct spi_channel
00087 {
00088 atomic_t open_count ;
00089 struct axis_pci_device_entry * parent_device ;
00090 unsigned char channel_number ;
00091 unsigned char control ;
00092 long minimum_inter_char_time ;
00093 } ;
00094
00104 struct spi_op
00105 {
00106 struct spi_channel * channel ;
00107 unsigned char * data ;
00108 unsigned long number_to_do ;
00109 unsigned char status ;
00110 } ;
00111
00112 void init_spi(struct axis_pci_device_entry * device);
00113
00114 extern struct file_operations spi_file_operations ;
00115
00116 #endif //AXIS_SPI_IO_H
00117
00118