Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
sata_dwc_460ex.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/libata.h>
#include <linux/slab.h>
#include "libata.h"
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>

Go to the source code of this file.

Data Structures

struct  dmareg
 
struct  dma_chan_regs
 
struct  dma_interrupt_regs
 
struct  ahb_dma_regs
 
struct  lli
 
struct  sata_dwc_regs
 
struct  sata_dwc_device
 
struct  sata_dwc_device_port
 
struct  sata_dwc_host_priv
 

Macros

#define DRV_NAME   "sata-dwc"
 
#define DRV_VERSION   "1.3"
 
#define DMA_NUM_CHANS   1
 
#define DMA_NUM_CHAN_REGS   8
 
#define AHB_DMA_BRST_DFLT   64 /* 16 data items burst length*/
 
#define DMA_CTL_BLK_TS(size)   ((size) & 0x000000FFF) /* Blk Transfer size */
 
#define DMA_CHANNEL(ch)   (0x00000001 << (ch)) /* Select channel */
 
#define DMA_ENABLE_CHAN(ch)
 
#define DMA_DISABLE_CHAN(ch)   (0x00000000 | ((0x000000001 << (ch)) << 8))
 
#define DMA_CTL_TTFC(type)   (((type) & 0x7) << 20)
 
#define DMA_CTL_SMS(num)   (((num) & 0x3) << 25) /* Src Master Select */
 
#define DMA_CTL_DMS(num)   (((num) & 0x3) << 23)/* Dst Master Select */
 
#define DMA_CTL_SRC_MSIZE(size)   (((size) & 0x7) << 14)
 
#define DMA_CTL_DST_MSIZE(size)   (((size) & 0x7) << 11)
 
#define DMA_CTL_SRC_TRWID(size)   (((size) & 0x7) << 4)
 
#define DMA_CTL_DST_TRWID(size)   (((size) & 0x7) << 1)
 
#define DMA_CFG_HW_HS_DEST(int_num)   (((int_num) & 0xF) << 11)
 
#define DMA_CFG_HW_HS_SRC(int_num)   (((int_num) & 0xF) << 7)
 
#define DMA_CFG_HW_CH_PRIOR(int_num)   (((int_num) & 0xF) << 5)
 
#define DMA_LLP_LMS(addr, master)   (((addr) & 0xfffffffc) | (master))
 
#define SATA_DWC_SCR0_SPD_GET(v)   (((v) >> 4) & 0x0000000F)
 
#define SATA_DWC_DMACR_TX_CLEAR(v)
 
#define SATA_DWC_DMACR_RX_CLEAR(v)
 
#define SATA_DWC_DBTSR_MWR(size)   (((size)/4) & SATA_DWC_TXFIFO_DEPTH)
 
#define SATA_DWC_DBTSR_MRD(size)
 
#define SATA_DWC_QCMD_MAX   32
 
#define HSDEV_FROM_HOST(host)
 
#define HSDEV_FROM_AP(ap)
 
#define HSDEVP_FROM_AP(ap)
 
#define HSDEV_FROM_QC(qc)
 
#define HSDEV_FROM_HSDEVP(p)
 

Enumerations

enum  {
  SATA_DWC_DMAC_LLI_SZ = (sizeof(struct lli)), SATA_DWC_DMAC_LLI_NUM = 256, SATA_DWC_DMAC_LLI_TBL_SZ, SATA_DWC_DMAC_TWIDTH_BYTES = 4,
  SATA_DWC_DMAC_CTRL_TSIZE_MAX
}
 
enum  { DMA_EN = 0x00000001, DMA_CTL_LLP_SRCEN = 0x10000000, DMA_CTL_LLP_DSTEN = 0x08000000 }
 
enum  {
  DMA_CTL_LLP_DISABLE_LE32 = 0xffffffe7, DMA_CTL_TTFC_P2M_DMAC = 0x00000002, DMA_CTL_TTFC_M2P_PER = 0x00000003, DMA_CTL_SINC_INC = 0x00000000,
  DMA_CTL_SINC_DEC = 0x00000200, DMA_CTL_SINC_NOCHANGE = 0x00000400, DMA_CTL_DINC_INC = 0x00000000, DMA_CTL_DINC_DEC = 0x00000080,
  DMA_CTL_DINC_NOCHANGE = 0x00000100, DMA_CTL_INT_EN = 0x00000001, DMA_CFG_FCMOD_REQ = 0x00000001, DMA_CFG_PROTCTL = (0x00000003 << 2),
  DMA_CFG_RELD_DST = 0x80000000, DMA_CFG_RELD_SRC = 0x40000000, DMA_CFG_HS_SELSRC = 0x00000800, DMA_CFG_HS_SELDST = 0x00000400,
  DMA_CFG_FIFOEMPTY = (0x00000001 << 9), DMA_LLP_AHBMASTER1 = 0, DMA_LLP_AHBMASTER2 = 1, SATA_DWC_MAX_PORTS = 1,
  SATA_DWC_SCR_OFFSET = 0x24, SATA_DWC_REG_OFFSET = 0x64
}
 
enum  {
  SCR_SCONTROL_DET_ENABLE = 0x00000001, SCR_SSTATUS_DET_PRESENT = 0x00000001, SCR_SERROR_DIAG_X = 0x04000000, SATA_DWC_TXFIFO_DEPTH = 0x01FF,
  SATA_DWC_RXFIFO_DEPTH = 0x01FF, SATA_DWC_DMACR_TMOD_TXCHEN = 0x00000004, SATA_DWC_DMACR_TXCHEN = (0x00000001 | SATA_DWC_DMACR_TMOD_TXCHEN), SATA_DWC_DMACR_RXCHEN = (0x00000002 | SATA_DWC_DMACR_TMOD_TXCHEN),
  SATA_DWC_DMACR_TXRXCH_CLEAR = SATA_DWC_DMACR_TMOD_TXCHEN, SATA_DWC_INTPR_DMAT = 0x00000001, SATA_DWC_INTPR_NEWFP = 0x00000002, SATA_DWC_INTPR_PMABRT = 0x00000004,
  SATA_DWC_INTPR_ERR = 0x00000008, SATA_DWC_INTPR_NEWBIST = 0x00000010, SATA_DWC_INTPR_IPF = 0x10000000, SATA_DWC_INTMR_DMATM = 0x00000001,
  SATA_DWC_INTMR_NEWFPM = 0x00000002, SATA_DWC_INTMR_PMABRTM = 0x00000004, SATA_DWC_INTMR_ERRM = 0x00000008, SATA_DWC_INTMR_NEWBISTM = 0x00000010,
  SATA_DWC_LLCR_SCRAMEN = 0x00000001, SATA_DWC_LLCR_DESCRAMEN = 0x00000002, SATA_DWC_LLCR_RPDEN = 0x00000004, SATA_DWC_SERROR_ERR_BITS = 0x0FFF0F03
}
 
enum  {
  SATA_DWC_CMD_ISSUED_NOT = 0, SATA_DWC_CMD_ISSUED_PEND = 1, SATA_DWC_CMD_ISSUED_EXEC = 2, SATA_DWC_CMD_ISSUED_NODATA = 3,
  SATA_DWC_DMA_PENDING_NONE = 0, SATA_DWC_DMA_PENDING_TX = 1, SATA_DWC_DMA_PENDING_RX = 2
}
 

Functions

int sata_dwc_hardreset (struct ata_link *link, unsigned int *class, unsigned long deadline)
 
 MODULE_DEVICE_TABLE (of, sata_dwc_match)
 
 module_platform_driver (sata_dwc_driver)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Mark Miesfeld <[email protected]>")
 
 MODULE_DESCRIPTION ("DesignWare Cores SATA controller low lever driver")
 
 MODULE_VERSION (DRV_VERSION)
 

Variables

struct sata_dwc_host_priv host_pvt
 

Macro Definition Documentation

#define AHB_DMA_BRST_DFLT   64 /* 16 data items burst length*/

Definition at line 54 of file sata_dwc_460ex.c.

#define DMA_CFG_HW_CH_PRIOR (   int_num)    (((int_num) & 0xF) << 5)

Definition at line 161 of file sata_dwc_460ex.c.

#define DMA_CFG_HW_HS_DEST (   int_num)    (((int_num) & 0xF) << 11)

Definition at line 159 of file sata_dwc_460ex.c.

#define DMA_CFG_HW_HS_SRC (   int_num)    (((int_num) & 0xF) << 7)

Definition at line 160 of file sata_dwc_460ex.c.

#define DMA_CHANNEL (   ch)    (0x00000001 << (ch)) /* Select channel */

Definition at line 139 of file sata_dwc_460ex.c.

#define DMA_CTL_BLK_TS (   size)    ((size) & 0x000000FFF) /* Blk Transfer size */

Definition at line 138 of file sata_dwc_460ex.c.

#define DMA_CTL_DMS (   num)    (((num) & 0x3) << 23)/* Dst Master Select */

Definition at line 148 of file sata_dwc_460ex.c.

#define DMA_CTL_DST_MSIZE (   size)    (((size) & 0x7) << 11)

Definition at line 152 of file sata_dwc_460ex.c.

#define DMA_CTL_DST_TRWID (   size)    (((size) & 0x7) << 1)

Definition at line 156 of file sata_dwc_460ex.c.

#define DMA_CTL_SMS (   num)    (((num) & 0x3) << 25) /* Src Master Select */

Definition at line 147 of file sata_dwc_460ex.c.

#define DMA_CTL_SRC_MSIZE (   size)    (((size) & 0x7) << 14)

Definition at line 150 of file sata_dwc_460ex.c.

#define DMA_CTL_SRC_TRWID (   size)    (((size) & 0x7) << 4)

Definition at line 154 of file sata_dwc_460ex.c.

#define DMA_CTL_TTFC (   type)    (((type) & 0x7) << 20)

Definition at line 146 of file sata_dwc_460ex.c.

#define DMA_DISABLE_CHAN (   ch)    (0x00000000 | ((0x000000001 << (ch)) << 8))

Definition at line 144 of file sata_dwc_460ex.c.

#define DMA_ENABLE_CHAN (   ch)
Value:
((0x00000001 << (ch)) | \
((0x000000001 << (ch)) << 8))

Definition at line 141 of file sata_dwc_460ex.c.

#define DMA_LLP_LMS (   addr,
  master 
)    (((addr) & 0xfffffffc) | (master))

Definition at line 162 of file sata_dwc_460ex.c.

#define DMA_NUM_CHAN_REGS   8

Definition at line 51 of file sata_dwc_460ex.c.

#define DMA_NUM_CHANS   1

Definition at line 50 of file sata_dwc_460ex.c.

#define DRV_NAME   "sata-dwc"

Definition at line 46 of file sata_dwc_460ex.c.

#define DRV_VERSION   "1.3"

Definition at line 47 of file sata_dwc_460ex.c.

#define HSDEV_FROM_AP (   ap)
Value:
((struct sata_dwc_device *)\
(ap)->host->private_data)

Definition at line 295 of file sata_dwc_460ex.c.

#define HSDEV_FROM_HOST (   host)
Value:
((struct sata_dwc_device *)\
(host)->private_data)

Definition at line 293 of file sata_dwc_460ex.c.

#define HSDEV_FROM_HSDEVP (   p)
Value:
((struct sata_dwc_device *)\
(hsdevp)->hsdev)

Definition at line 301 of file sata_dwc_460ex.c.

#define HSDEV_FROM_QC (   qc)
Value:
((struct sata_dwc_device *)\
(qc)->ap->host->private_data)

Definition at line 299 of file sata_dwc_460ex.c.

#define HSDEVP_FROM_AP (   ap)
Value:
(ap)->private_data)

Definition at line 297 of file sata_dwc_460ex.c.

#define SATA_DWC_DBTSR_MRD (   size)
Value:
<< 16)

Definition at line 268 of file sata_dwc_460ex.c.

#define SATA_DWC_DBTSR_MWR (   size)    (((size)/4) & SATA_DWC_TXFIFO_DEPTH)

Definition at line 267 of file sata_dwc_460ex.c.

#define SATA_DWC_DMACR_RX_CLEAR (   v)
Value:
SATA_DWC_DMACR_TMOD_TXCHEN)

Definition at line 265 of file sata_dwc_460ex.c.

#define SATA_DWC_DMACR_TX_CLEAR (   v)
Value:
SATA_DWC_DMACR_TMOD_TXCHEN)

Definition at line 263 of file sata_dwc_460ex.c.

#define SATA_DWC_QCMD_MAX   32

Definition at line 279 of file sata_dwc_460ex.c.

#define SATA_DWC_SCR0_SPD_GET (   v)    (((v) >> 4) & 0x0000000F)

Definition at line 262 of file sata_dwc_460ex.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
SATA_DWC_DMAC_LLI_SZ 
SATA_DWC_DMAC_LLI_NUM 
SATA_DWC_DMAC_LLI_TBL_SZ 
SATA_DWC_DMAC_TWIDTH_BYTES 
SATA_DWC_DMAC_CTRL_TSIZE_MAX 

Definition at line 121 of file sata_dwc_460ex.c.

anonymous enum
Enumerator:
DMA_EN 
DMA_CTL_LLP_SRCEN 
DMA_CTL_LLP_DSTEN 

Definition at line 132 of file sata_dwc_460ex.c.

anonymous enum
Enumerator:
DMA_CTL_LLP_DISABLE_LE32 
DMA_CTL_TTFC_P2M_DMAC 
DMA_CTL_TTFC_M2P_PER 
DMA_CTL_SINC_INC 
DMA_CTL_SINC_DEC 
DMA_CTL_SINC_NOCHANGE 
DMA_CTL_DINC_INC 
DMA_CTL_DINC_DEC 
DMA_CTL_DINC_NOCHANGE 
DMA_CTL_INT_EN 
DMA_CFG_FCMOD_REQ 
DMA_CFG_PROTCTL 
DMA_CFG_RELD_DST 
DMA_CFG_RELD_SRC 
DMA_CFG_HS_SELSRC 
DMA_CFG_HS_SELDST 
DMA_CFG_FIFOEMPTY 
DMA_LLP_AHBMASTER1 
DMA_LLP_AHBMASTER2 
SATA_DWC_MAX_PORTS 
SATA_DWC_SCR_OFFSET 
SATA_DWC_REG_OFFSET 

Definition at line 169 of file sata_dwc_460ex.c.

anonymous enum
Enumerator:
SCR_SCONTROL_DET_ENABLE 
SCR_SSTATUS_DET_PRESENT 
SCR_SERROR_DIAG_X 
SATA_DWC_TXFIFO_DEPTH 
SATA_DWC_RXFIFO_DEPTH 
SATA_DWC_DMACR_TMOD_TXCHEN 
SATA_DWC_DMACR_TXCHEN 
SATA_DWC_DMACR_RXCHEN 
SATA_DWC_DMACR_TXRXCH_CLEAR 
SATA_DWC_INTPR_DMAT 
SATA_DWC_INTPR_NEWFP 
SATA_DWC_INTPR_PMABRT 
SATA_DWC_INTPR_ERR 
SATA_DWC_INTPR_NEWBIST 
SATA_DWC_INTPR_IPF 
SATA_DWC_INTMR_DMATM 
SATA_DWC_INTMR_NEWFPM 
SATA_DWC_INTMR_PMABRTM 
SATA_DWC_INTMR_ERRM 
SATA_DWC_INTMR_NEWBISTM 
SATA_DWC_LLCR_SCRAMEN 
SATA_DWC_LLCR_DESCRAMEN 
SATA_DWC_LLCR_RPDEN 
SATA_DWC_SERROR_ERR_BITS 

Definition at line 233 of file sata_dwc_460ex.c.

anonymous enum
Enumerator:
SATA_DWC_CMD_ISSUED_NOT 
SATA_DWC_CMD_ISSUED_PEND 
SATA_DWC_CMD_ISSUED_EXEC 
SATA_DWC_CMD_ISSUED_NODATA 
SATA_DWC_DMA_PENDING_NONE 
SATA_DWC_DMA_PENDING_TX 
SATA_DWC_DMA_PENDING_RX 

Definition at line 304 of file sata_dwc_460ex.c.

Function Documentation

MODULE_AUTHOR ( "Mark Miesfeld <[email protected]>"  )
MODULE_DESCRIPTION ( "DesignWare Cores SATA controller low lever driver )
MODULE_DEVICE_TABLE ( of  ,
sata_dwc_match   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( sata_dwc_driver  )
MODULE_VERSION ( DRV_VERSION  )
int sata_dwc_hardreset ( struct ata_link link,
unsigned int class,
unsigned long  deadline 
)

Definition at line 1592 of file sata_dwc_460ex.c.

Variable Documentation

Definition at line 324 of file sata_dwc_460ex.c.