/* * Blackfin On-Chip SPI Driver * * Copyright 2004-2007 Analog Devices Inc. * * Enter bugs at http://blackfin.uclinux.org/ * * Licensed under the GPL-2 or later. */#include<linux/init.h>#include<linux/module.h>#include<linux/delay.h>#include<linux/device.h>#include<linux/io.h>#include<linux/ioport.h>#include<linux/irq.h>#include<linux/errno.h>#include<linux/interrupt.h>#include<linux/platform_device.h>#include<linux/dma-mapping.h>#include<linux/spi/spi.h>#include<linux/workqueue.h>#include<asm/dma.h>#include<asm/portmux.h>#include<asm/bfin5xx_spi.h>#include<asm/cacheflush.h>#define DRV_NAME "bfin-spi"#define DRV_AUTHOR "Bryan Wu, Luke Yang"#define DRV_DESC "Blackfin on-chip SPI Controller Driver"#define DRV_VERSION "1.0"MODULE_AUTHOR(DRV_AUTHOR);MODULE_DESCRIPTION(DRV_DESC);MODULE_LICENSE("GPL");#define START_STATE ((void *)0)#define RUNNING_STATE ((void *)1)#define DONE_STATE ((void *)2)#define ERROR_STATE ((void *)-1)#define QUEUE_RUNNING 0#define QUEUE_STOPPED 1/* Value to send if no TX value is supplied */#define SPI_IDLE_TXVAL 0x0000structdriver_data{/* Driver model hookup */structplatform_device*pdev;/* SPI framework hookup */structspi_master*master;/* Regs base of SPI controller */void__iomem*regs_base;/* Pin request list */u16*pin_req;/* BFIN hookup */structbfin5xx_spi_master*master_info;/* Driver message queue */structworkqueue_struct*workqueue;structwork_structpump_messages;spinlock_tlock;structlist_headqueue;intbusy;intrun;/* Message Transfer pump */structtasklet_structpump_transfers;/* Current message transfer state info */structspi_message*cur_msg;structspi_transfer*cur_transfer;