Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
spi-s3c64xx.c File Reference
#include <linux/init.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/spi/spi.h>
#include <linux/gpio.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <mach/dma.h>
#include <linux/platform_data/spi-s3c64xx.h>

Go to the source code of this file.

Data Structures

struct  s3c64xx_spi_dma_data
 
struct  s3c64xx_spi_port_config
 
struct  s3c64xx_spi_driver_data
 

Macros

#define MAX_SPI_PORTS   3
 
#define S3C64XX_SPI_CH_CFG   0x00
 
#define S3C64XX_SPI_CLK_CFG   0x04
 
#define S3C64XX_SPI_MODE_CFG   0x08
 
#define S3C64XX_SPI_SLAVE_SEL   0x0C
 
#define S3C64XX_SPI_INT_EN   0x10
 
#define S3C64XX_SPI_STATUS   0x14
 
#define S3C64XX_SPI_TX_DATA   0x18
 
#define S3C64XX_SPI_RX_DATA   0x1C
 
#define S3C64XX_SPI_PACKET_CNT   0x20
 
#define S3C64XX_SPI_PENDING_CLR   0x24
 
#define S3C64XX_SPI_SWAP_CFG   0x28
 
#define S3C64XX_SPI_FB_CLK   0x2C
 
#define S3C64XX_SPI_CH_HS_EN   (1<<6) /* High Speed Enable */
 
#define S3C64XX_SPI_CH_SW_RST   (1<<5)
 
#define S3C64XX_SPI_CH_SLAVE   (1<<4)
 
#define S3C64XX_SPI_CPOL_L   (1<<3)
 
#define S3C64XX_SPI_CPHA_B   (1<<2)
 
#define S3C64XX_SPI_CH_RXCH_ON   (1<<1)
 
#define S3C64XX_SPI_CH_TXCH_ON   (1<<0)
 
#define S3C64XX_SPI_CLKSEL_SRCMSK   (3<<9)
 
#define S3C64XX_SPI_CLKSEL_SRCSHFT   9
 
#define S3C64XX_SPI_ENCLK_ENABLE   (1<<8)
 
#define S3C64XX_SPI_PSR_MASK   0xff
 
#define S3C64XX_SPI_MODE_CH_TSZ_BYTE   (0<<29)
 
#define S3C64XX_SPI_MODE_CH_TSZ_HALFWORD   (1<<29)
 
#define S3C64XX_SPI_MODE_CH_TSZ_WORD   (2<<29)
 
#define S3C64XX_SPI_MODE_CH_TSZ_MASK   (3<<29)
 
#define S3C64XX_SPI_MODE_BUS_TSZ_BYTE   (0<<17)
 
#define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD   (1<<17)
 
#define S3C64XX_SPI_MODE_BUS_TSZ_WORD   (2<<17)
 
#define S3C64XX_SPI_MODE_BUS_TSZ_MASK   (3<<17)
 
#define S3C64XX_SPI_MODE_RXDMA_ON   (1<<2)
 
#define S3C64XX_SPI_MODE_TXDMA_ON   (1<<1)
 
#define S3C64XX_SPI_MODE_4BURST   (1<<0)
 
#define S3C64XX_SPI_SLAVE_AUTO   (1<<1)
 
#define S3C64XX_SPI_SLAVE_SIG_INACT   (1<<0)
 
#define S3C64XX_SPI_INT_TRAILING_EN   (1<<6)
 
#define S3C64XX_SPI_INT_RX_OVERRUN_EN   (1<<5)
 
#define S3C64XX_SPI_INT_RX_UNDERRUN_EN   (1<<4)
 
#define S3C64XX_SPI_INT_TX_OVERRUN_EN   (1<<3)
 
#define S3C64XX_SPI_INT_TX_UNDERRUN_EN   (1<<2)
 
#define S3C64XX_SPI_INT_RX_FIFORDY_EN   (1<<1)
 
#define S3C64XX_SPI_INT_TX_FIFORDY_EN   (1<<0)
 
#define S3C64XX_SPI_ST_RX_OVERRUN_ERR   (1<<5)
 
#define S3C64XX_SPI_ST_RX_UNDERRUN_ERR   (1<<4)
 
#define S3C64XX_SPI_ST_TX_OVERRUN_ERR   (1<<3)
 
#define S3C64XX_SPI_ST_TX_UNDERRUN_ERR   (1<<2)
 
#define S3C64XX_SPI_ST_RX_FIFORDY   (1<<1)
 
#define S3C64XX_SPI_ST_TX_FIFORDY   (1<<0)
 
#define S3C64XX_SPI_PACKET_CNT_EN   (1<<16)
 
#define S3C64XX_SPI_PND_TX_UNDERRUN_CLR   (1<<4)
 
#define S3C64XX_SPI_PND_TX_OVERRUN_CLR   (1<<3)
 
#define S3C64XX_SPI_PND_RX_UNDERRUN_CLR   (1<<2)
 
#define S3C64XX_SPI_PND_RX_OVERRUN_CLR   (1<<1)
 
#define S3C64XX_SPI_PND_TRAILING_CLR   (1<<0)
 
#define S3C64XX_SPI_SWAP_RX_HALF_WORD   (1<<7)
 
#define S3C64XX_SPI_SWAP_RX_BYTE   (1<<6)
 
#define S3C64XX_SPI_SWAP_RX_BIT   (1<<5)
 
#define S3C64XX_SPI_SWAP_RX_EN   (1<<4)
 
#define S3C64XX_SPI_SWAP_TX_HALF_WORD   (1<<3)
 
#define S3C64XX_SPI_SWAP_TX_BYTE   (1<<2)
 
#define S3C64XX_SPI_SWAP_TX_BIT   (1<<1)
 
#define S3C64XX_SPI_SWAP_TX_EN   (1<<0)
 
#define S3C64XX_SPI_FBCLK_MSK   (3<<0)
 
#define FIFO_LVL_MASK(i)   ((i)->port_conf->fifo_lvl_mask[i->port_id])
 
#define S3C64XX_SPI_ST_TX_DONE(v, i)
 
#define TX_FIFO_LVL(v, i)   (((v) >> 6) & FIFO_LVL_MASK(i))
 
#define RX_FIFO_LVL(v, i)
 
#define S3C64XX_SPI_MAX_TRAILCNT   0x3ff
 
#define S3C64XX_SPI_TRAILCNT_OFF   19
 
#define S3C64XX_SPI_TRAILCNT   S3C64XX_SPI_MAX_TRAILCNT
 
#define msecs_to_loops(t)   (loops_per_jiffy / 1000 * HZ * t)
 
#define RXBUSY   (1<<2)
 
#define TXBUSY   (1<<3)
 
#define XFER_DMAADDR_INVALID   DMA_BIT_MASK(32)
 

Functions

 MODULE_ALIAS ("platform:s3c64xx-spi")
 
 subsys_initcall (s3c64xx_spi_init)
 
 module_exit (s3c64xx_spi_exit)
 
 MODULE_AUTHOR ("Jaswinder Singh <[email protected]>")
 
 MODULE_DESCRIPTION ("S3C64XX SPI Controller Driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define FIFO_LVL_MASK (   i)    ((i)->port_conf->fifo_lvl_mask[i->port_id])

Definition at line 116 of file spi-s3c64xx.c.

#define MAX_SPI_PORTS   3

Definition at line 37 of file spi-s3c64xx.c.

#define msecs_to_loops (   t)    (loops_per_jiffy / 1000 * HZ * t)

Definition at line 128 of file spi-s3c64xx.c.

#define RX_FIFO_LVL (   v,
  i 
)
Value:
(((v) >> (i)->port_conf->rx_lvl_offset) & \

Definition at line 120 of file spi-s3c64xx.c.

#define RXBUSY   (1<<2)

Definition at line 130 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_CFG   0x00

Definition at line 41 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_HS_EN   (1<<6) /* High Speed Enable */

Definition at line 54 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_RXCH_ON   (1<<1)

Definition at line 59 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_SLAVE   (1<<4)

Definition at line 56 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_SW_RST   (1<<5)

Definition at line 55 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CH_TXCH_ON   (1<<0)

Definition at line 60 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CLK_CFG   0x04

Definition at line 42 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CLKSEL_SRCMSK   (3<<9)

Definition at line 62 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CLKSEL_SRCSHFT   9

Definition at line 63 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CPHA_B   (1<<2)

Definition at line 58 of file spi-s3c64xx.c.

#define S3C64XX_SPI_CPOL_L   (1<<3)

Definition at line 57 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ENCLK_ENABLE   (1<<8)

Definition at line 64 of file spi-s3c64xx.c.

#define S3C64XX_SPI_FB_CLK   0x2C

Definition at line 52 of file spi-s3c64xx.c.

#define S3C64XX_SPI_FBCLK_MSK   (3<<0)

Definition at line 114 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_EN   0x10

Definition at line 45 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_RX_FIFORDY_EN   (1<<1)

Definition at line 87 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_RX_OVERRUN_EN   (1<<5)

Definition at line 83 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_RX_UNDERRUN_EN   (1<<4)

Definition at line 84 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_TRAILING_EN   (1<<6)

Definition at line 82 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_TX_FIFORDY_EN   (1<<0)

Definition at line 88 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_TX_OVERRUN_EN   (1<<3)

Definition at line 85 of file spi-s3c64xx.c.

#define S3C64XX_SPI_INT_TX_UNDERRUN_EN   (1<<2)

Definition at line 86 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MAX_TRAILCNT   0x3ff

Definition at line 123 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_4BURST   (1<<0)

Definition at line 77 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_BUS_TSZ_BYTE   (0<<17)

Definition at line 71 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD   (1<<17)

Definition at line 72 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_BUS_TSZ_MASK   (3<<17)

Definition at line 74 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_BUS_TSZ_WORD   (2<<17)

Definition at line 73 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_CFG   0x08

Definition at line 43 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_CH_TSZ_BYTE   (0<<29)

Definition at line 67 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_CH_TSZ_HALFWORD   (1<<29)

Definition at line 68 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_CH_TSZ_MASK   (3<<29)

Definition at line 70 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_CH_TSZ_WORD   (2<<29)

Definition at line 69 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_RXDMA_ON   (1<<2)

Definition at line 75 of file spi-s3c64xx.c.

#define S3C64XX_SPI_MODE_TXDMA_ON   (1<<1)

Definition at line 76 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PACKET_CNT   0x20

Definition at line 49 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PACKET_CNT_EN   (1<<16)

Definition at line 97 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PENDING_CLR   0x24

Definition at line 50 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PND_RX_OVERRUN_CLR   (1<<1)

Definition at line 102 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PND_RX_UNDERRUN_CLR   (1<<2)

Definition at line 101 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PND_TRAILING_CLR   (1<<0)

Definition at line 103 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PND_TX_OVERRUN_CLR   (1<<3)

Definition at line 100 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PND_TX_UNDERRUN_CLR   (1<<4)

Definition at line 99 of file spi-s3c64xx.c.

#define S3C64XX_SPI_PSR_MASK   0xff

Definition at line 65 of file spi-s3c64xx.c.

#define S3C64XX_SPI_RX_DATA   0x1C

Definition at line 48 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SLAVE_AUTO   (1<<1)

Definition at line 79 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SLAVE_SEL   0x0C

Definition at line 44 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SLAVE_SIG_INACT   (1<<0)

Definition at line 80 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_RX_FIFORDY   (1<<1)

Definition at line 94 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_RX_OVERRUN_ERR   (1<<5)

Definition at line 90 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_RX_UNDERRUN_ERR   (1<<4)

Definition at line 91 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_TX_DONE (   v,
  i 
)
Value:
(((v) & \
(1 << (i)->port_conf->tx_st_done)) ? 1 : 0)

Definition at line 117 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_TX_FIFORDY   (1<<0)

Definition at line 95 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_TX_OVERRUN_ERR   (1<<3)

Definition at line 92 of file spi-s3c64xx.c.

#define S3C64XX_SPI_ST_TX_UNDERRUN_ERR   (1<<2)

Definition at line 93 of file spi-s3c64xx.c.

#define S3C64XX_SPI_STATUS   0x14

Definition at line 46 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_CFG   0x28

Definition at line 51 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_RX_BIT   (1<<5)

Definition at line 107 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_RX_BYTE   (1<<6)

Definition at line 106 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_RX_EN   (1<<4)

Definition at line 108 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_RX_HALF_WORD   (1<<7)

Definition at line 105 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_TX_BIT   (1<<1)

Definition at line 111 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_TX_BYTE   (1<<2)

Definition at line 110 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_TX_EN   (1<<0)

Definition at line 112 of file spi-s3c64xx.c.

#define S3C64XX_SPI_SWAP_TX_HALF_WORD   (1<<3)

Definition at line 109 of file spi-s3c64xx.c.

#define S3C64XX_SPI_TRAILCNT   S3C64XX_SPI_MAX_TRAILCNT

Definition at line 126 of file spi-s3c64xx.c.

#define S3C64XX_SPI_TRAILCNT_OFF   19

Definition at line 124 of file spi-s3c64xx.c.

#define S3C64XX_SPI_TX_DATA   0x18

Definition at line 47 of file spi-s3c64xx.c.

#define TX_FIFO_LVL (   v,
  i 
)    (((v) >> 6) & FIFO_LVL_MASK(i))

Definition at line 119 of file spi-s3c64xx.c.

#define TXBUSY   (1<<3)

Definition at line 131 of file spi-s3c64xx.c.

#define XFER_DMAADDR_INVALID   DMA_BIT_MASK(32)

Definition at line 583 of file spi-s3c64xx.c.

Function Documentation

MODULE_ALIAS ( "platform:s3c64xx-spi )
MODULE_AUTHOR ( "Jaswinder Singh <[email protected]>"  )
MODULE_DESCRIPTION ( "S3C64XX SPI Controller Driver"  )
module_exit ( s3c64xx_spi_exit  )
MODULE_LICENSE ( "GPL"  )
subsys_initcall ( s3c64xx_spi_init  )