Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
mxc_nand.c File Reference
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/completion.h>
#include <linux/of_device.h>
#include <linux/of_mtd.h>
#include <asm/mach/flash.h>
#include <linux/platform_data/mtd-mxc_nand.h>
#include <mach/hardware.h>

Go to the source code of this file.

Data Structures

struct  mxc_nand_devtype_data
 
struct  mxc_nand_host
 

Macros

#define DRIVER_NAME   "mxc_nand"
 
#define nfc_is_v21()   (cpu_is_mx25() || cpu_is_mx35())
 
#define nfc_is_v1()   (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21())
 
#define nfc_is_v3_2a()   cpu_is_mx51()
 
#define nfc_is_v3_2b()   cpu_is_mx53()
 
#define NFC_V1_V2_BUF_SIZE   (host->regs + 0x00)
 
#define NFC_V1_V2_BUF_ADDR   (host->regs + 0x04)
 
#define NFC_V1_V2_FLASH_ADDR   (host->regs + 0x06)
 
#define NFC_V1_V2_FLASH_CMD   (host->regs + 0x08)
 
#define NFC_V1_V2_CONFIG   (host->regs + 0x0a)
 
#define NFC_V1_V2_ECC_STATUS_RESULT   (host->regs + 0x0c)
 
#define NFC_V1_V2_RSLTMAIN_AREA   (host->regs + 0x0e)
 
#define NFC_V1_V2_RSLTSPARE_AREA   (host->regs + 0x10)
 
#define NFC_V1_V2_WRPROT   (host->regs + 0x12)
 
#define NFC_V1_UNLOCKSTART_BLKADDR   (host->regs + 0x14)
 
#define NFC_V1_UNLOCKEND_BLKADDR   (host->regs + 0x16)
 
#define NFC_V21_UNLOCKSTART_BLKADDR0   (host->regs + 0x20)
 
#define NFC_V21_UNLOCKSTART_BLKADDR1   (host->regs + 0x24)
 
#define NFC_V21_UNLOCKSTART_BLKADDR2   (host->regs + 0x28)
 
#define NFC_V21_UNLOCKSTART_BLKADDR3   (host->regs + 0x2c)
 
#define NFC_V21_UNLOCKEND_BLKADDR0   (host->regs + 0x22)
 
#define NFC_V21_UNLOCKEND_BLKADDR1   (host->regs + 0x26)
 
#define NFC_V21_UNLOCKEND_BLKADDR2   (host->regs + 0x2a)
 
#define NFC_V21_UNLOCKEND_BLKADDR3   (host->regs + 0x2e)
 
#define NFC_V1_V2_NF_WRPRST   (host->regs + 0x18)
 
#define NFC_V1_V2_CONFIG1   (host->regs + 0x1a)
 
#define NFC_V1_V2_CONFIG2   (host->regs + 0x1c)
 
#define NFC_V2_CONFIG1_ECC_MODE_4   (1 << 0)
 
#define NFC_V1_V2_CONFIG1_SP_EN   (1 << 2)
 
#define NFC_V1_V2_CONFIG1_ECC_EN   (1 << 3)
 
#define NFC_V1_V2_CONFIG1_INT_MSK   (1 << 4)
 
#define NFC_V1_V2_CONFIG1_BIG   (1 << 5)
 
#define NFC_V1_V2_CONFIG1_RST   (1 << 6)
 
#define NFC_V1_V2_CONFIG1_CE   (1 << 7)
 
#define NFC_V2_CONFIG1_ONE_CYCLE   (1 << 8)
 
#define NFC_V2_CONFIG1_PPB(x)   (((x) & 0x3) << 9)
 
#define NFC_V2_CONFIG1_FP_INT   (1 << 11)
 
#define NFC_V1_V2_CONFIG2_INT   (1 << 15)
 
#define NFC_CMD   (1 << 0)
 
#define NFC_ADDR   (1 << 1)
 
#define NFC_INPUT   (1 << 2)
 
#define NFC_OUTPUT   (1 << 3)
 
#define NFC_ID   (1 << 4)
 
#define NFC_STATUS   (1 << 5)
 
#define NFC_V3_FLASH_CMD   (host->regs_axi + 0x00)
 
#define NFC_V3_FLASH_ADDR0   (host->regs_axi + 0x04)
 
#define NFC_V3_CONFIG1   (host->regs_axi + 0x34)
 
#define NFC_V3_CONFIG1_SP_EN   (1 << 0)
 
#define NFC_V3_CONFIG1_RBA(x)   (((x) & 0x7 ) << 4)
 
#define NFC_V3_ECC_STATUS_RESULT   (host->regs_axi + 0x38)
 
#define NFC_V3_LAUNCH   (host->regs_axi + 0x40)
 
#define NFC_V3_WRPROT   (host->regs_ip + 0x0)
 
#define NFC_V3_WRPROT_LOCK_TIGHT   (1 << 0)
 
#define NFC_V3_WRPROT_LOCK   (1 << 1)
 
#define NFC_V3_WRPROT_UNLOCK   (1 << 2)
 
#define NFC_V3_WRPROT_BLS_UNLOCK   (2 << 6)
 
#define NFC_V3_WRPROT_UNLOCK_BLK_ADD0   (host->regs_ip + 0x04)
 
#define NFC_V3_CONFIG2   (host->regs_ip + 0x24)
 
#define NFC_V3_CONFIG2_PS_512   (0 << 0)
 
#define NFC_V3_CONFIG2_PS_2048   (1 << 0)
 
#define NFC_V3_CONFIG2_PS_4096   (2 << 0)
 
#define NFC_V3_CONFIG2_ONE_CYCLE   (1 << 2)
 
#define NFC_V3_CONFIG2_ECC_EN   (1 << 3)
 
#define NFC_V3_CONFIG2_2CMD_PHASES   (1 << 4)
 
#define NFC_V3_CONFIG2_NUM_ADDR_PHASE0   (1 << 5)
 
#define NFC_V3_CONFIG2_ECC_MODE_8   (1 << 6)
 
#define NFC_V3_CONFIG2_PPB(x, shift)   (((x) & 0x3) << shift)
 
#define NFC_V3_CONFIG2_NUM_ADDR_PHASE1(x)   (((x) & 0x3) << 12)
 
#define NFC_V3_CONFIG2_INT_MSK   (1 << 15)
 
#define NFC_V3_CONFIG2_ST_CMD(x)   (((x) & 0xff) << 24)
 
#define NFC_V3_CONFIG2_SPAS(x)   (((x) & 0xff) << 16)
 
#define NFC_V3_CONFIG3   (host->regs_ip + 0x28)
 
#define NFC_V3_CONFIG3_ADD_OP(x)   (((x) & 0x3) << 0)
 
#define NFC_V3_CONFIG3_FW8   (1 << 3)
 
#define NFC_V3_CONFIG3_SBB(x)   (((x) & 0x7) << 8)
 
#define NFC_V3_CONFIG3_NUM_OF_DEVICES(x)   (((x) & 0x7) << 12)
 
#define NFC_V3_CONFIG3_RBB_MODE   (1 << 15)
 
#define NFC_V3_CONFIG3_NO_SDMA   (1 << 20)
 
#define NFC_V3_IPC   (host->regs_ip + 0x2C)
 
#define NFC_V3_IPC_CREQ   (1 << 0)
 
#define NFC_V3_IPC_INT   (1 << 31)
 
#define NFC_V3_DELAY_LINE   (host->regs_ip + 0x34)
 

Functions

 module_platform_driver (mxcnd_driver)
 
 MODULE_AUTHOR ("Freescale Semiconductor, Inc.")
 
 MODULE_DESCRIPTION ("MXC NAND MTD driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DRIVER_NAME   "mxc_nand"

Definition at line 42 of file mxc_nand.c.

#define NFC_ADDR   (1 << 1)

Definition at line 91 of file mxc_nand.c.

#define NFC_CMD   (1 << 0)

Definition at line 90 of file mxc_nand.c.

#define NFC_ID   (1 << 4)

Definition at line 94 of file mxc_nand.c.

#define NFC_INPUT   (1 << 2)

Definition at line 92 of file mxc_nand.c.

#define nfc_is_v1 ( )    (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21())

Definition at line 45 of file mxc_nand.c.

#define nfc_is_v21 ( )    (cpu_is_mx25() || cpu_is_mx35())

Definition at line 44 of file mxc_nand.c.

#define nfc_is_v3_2a ( )    cpu_is_mx51()

Definition at line 46 of file mxc_nand.c.

#define nfc_is_v3_2b ( )    cpu_is_mx53()

Definition at line 47 of file mxc_nand.c.

#define NFC_OUTPUT   (1 << 3)

Definition at line 93 of file mxc_nand.c.

#define NFC_STATUS   (1 << 5)

Definition at line 95 of file mxc_nand.c.

#define NFC_V1_UNLOCKEND_BLKADDR   (host->regs + 0x16)

Definition at line 60 of file mxc_nand.c.

#define NFC_V1_UNLOCKSTART_BLKADDR   (host->regs + 0x14)

Definition at line 59 of file mxc_nand.c.

#define NFC_V1_V2_BUF_ADDR   (host->regs + 0x04)

Definition at line 51 of file mxc_nand.c.

#define NFC_V1_V2_BUF_SIZE   (host->regs + 0x00)

Definition at line 50 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG   (host->regs + 0x0a)

Definition at line 54 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1   (host->regs + 0x1a)

Definition at line 70 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_BIG   (1 << 5)

Definition at line 77 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_CE   (1 << 7)

Definition at line 79 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_ECC_EN   (1 << 3)

Definition at line 75 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_INT_MSK   (1 << 4)

Definition at line 76 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_RST   (1 << 6)

Definition at line 78 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG1_SP_EN   (1 << 2)

Definition at line 74 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG2   (host->regs + 0x1c)

Definition at line 71 of file mxc_nand.c.

#define NFC_V1_V2_CONFIG2_INT   (1 << 15)

Definition at line 84 of file mxc_nand.c.

#define NFC_V1_V2_ECC_STATUS_RESULT   (host->regs + 0x0c)

Definition at line 55 of file mxc_nand.c.

#define NFC_V1_V2_FLASH_ADDR   (host->regs + 0x06)

Definition at line 52 of file mxc_nand.c.

#define NFC_V1_V2_FLASH_CMD   (host->regs + 0x08)

Definition at line 53 of file mxc_nand.c.

#define NFC_V1_V2_NF_WRPRST   (host->regs + 0x18)

Definition at line 69 of file mxc_nand.c.

#define NFC_V1_V2_RSLTMAIN_AREA   (host->regs + 0x0e)

Definition at line 56 of file mxc_nand.c.

#define NFC_V1_V2_RSLTSPARE_AREA   (host->regs + 0x10)

Definition at line 57 of file mxc_nand.c.

#define NFC_V1_V2_WRPROT   (host->regs + 0x12)

Definition at line 58 of file mxc_nand.c.

#define NFC_V21_UNLOCKEND_BLKADDR0   (host->regs + 0x22)

Definition at line 65 of file mxc_nand.c.

#define NFC_V21_UNLOCKEND_BLKADDR1   (host->regs + 0x26)

Definition at line 66 of file mxc_nand.c.

#define NFC_V21_UNLOCKEND_BLKADDR2   (host->regs + 0x2a)

Definition at line 67 of file mxc_nand.c.

#define NFC_V21_UNLOCKEND_BLKADDR3   (host->regs + 0x2e)

Definition at line 68 of file mxc_nand.c.

#define NFC_V21_UNLOCKSTART_BLKADDR0   (host->regs + 0x20)

Definition at line 61 of file mxc_nand.c.

#define NFC_V21_UNLOCKSTART_BLKADDR1   (host->regs + 0x24)

Definition at line 62 of file mxc_nand.c.

#define NFC_V21_UNLOCKSTART_BLKADDR2   (host->regs + 0x28)

Definition at line 63 of file mxc_nand.c.

#define NFC_V21_UNLOCKSTART_BLKADDR3   (host->regs + 0x2c)

Definition at line 64 of file mxc_nand.c.

#define NFC_V2_CONFIG1_ECC_MODE_4   (1 << 0)

Definition at line 73 of file mxc_nand.c.

#define NFC_V2_CONFIG1_FP_INT   (1 << 11)

Definition at line 82 of file mxc_nand.c.

#define NFC_V2_CONFIG1_ONE_CYCLE   (1 << 8)

Definition at line 80 of file mxc_nand.c.

#define NFC_V2_CONFIG1_PPB (   x)    (((x) & 0x3) << 9)

Definition at line 81 of file mxc_nand.c.

#define NFC_V3_CONFIG1   (host->regs_axi + 0x34)

Definition at line 100 of file mxc_nand.c.

#define NFC_V3_CONFIG1_RBA (   x)    (((x) & 0x7 ) << 4)

Definition at line 102 of file mxc_nand.c.

#define NFC_V3_CONFIG1_SP_EN   (1 << 0)

Definition at line 101 of file mxc_nand.c.

#define NFC_V3_CONFIG2   (host->regs_ip + 0x24)

Definition at line 116 of file mxc_nand.c.

#define NFC_V3_CONFIG2_2CMD_PHASES   (1 << 4)

Definition at line 122 of file mxc_nand.c.

#define NFC_V3_CONFIG2_ECC_EN   (1 << 3)

Definition at line 121 of file mxc_nand.c.

#define NFC_V3_CONFIG2_ECC_MODE_8   (1 << 6)

Definition at line 124 of file mxc_nand.c.

#define NFC_V3_CONFIG2_INT_MSK   (1 << 15)

Definition at line 127 of file mxc_nand.c.

#define NFC_V3_CONFIG2_NUM_ADDR_PHASE0   (1 << 5)

Definition at line 123 of file mxc_nand.c.

#define NFC_V3_CONFIG2_NUM_ADDR_PHASE1 (   x)    (((x) & 0x3) << 12)

Definition at line 126 of file mxc_nand.c.

#define NFC_V3_CONFIG2_ONE_CYCLE   (1 << 2)

Definition at line 120 of file mxc_nand.c.

#define NFC_V3_CONFIG2_PPB (   x,
  shift 
)    (((x) & 0x3) << shift)

Definition at line 125 of file mxc_nand.c.

#define NFC_V3_CONFIG2_PS_2048   (1 << 0)

Definition at line 118 of file mxc_nand.c.

#define NFC_V3_CONFIG2_PS_4096   (2 << 0)

Definition at line 119 of file mxc_nand.c.

#define NFC_V3_CONFIG2_PS_512   (0 << 0)

Definition at line 117 of file mxc_nand.c.

#define NFC_V3_CONFIG2_SPAS (   x)    (((x) & 0xff) << 16)

Definition at line 129 of file mxc_nand.c.

#define NFC_V3_CONFIG2_ST_CMD (   x)    (((x) & 0xff) << 24)

Definition at line 128 of file mxc_nand.c.

#define NFC_V3_CONFIG3   (host->regs_ip + 0x28)

Definition at line 131 of file mxc_nand.c.

#define NFC_V3_CONFIG3_ADD_OP (   x)    (((x) & 0x3) << 0)

Definition at line 132 of file mxc_nand.c.

#define NFC_V3_CONFIG3_FW8   (1 << 3)

Definition at line 133 of file mxc_nand.c.

#define NFC_V3_CONFIG3_NO_SDMA   (1 << 20)

Definition at line 137 of file mxc_nand.c.

#define NFC_V3_CONFIG3_NUM_OF_DEVICES (   x)    (((x) & 0x7) << 12)

Definition at line 135 of file mxc_nand.c.

#define NFC_V3_CONFIG3_RBB_MODE   (1 << 15)

Definition at line 136 of file mxc_nand.c.

#define NFC_V3_CONFIG3_SBB (   x)    (((x) & 0x7) << 8)

Definition at line 134 of file mxc_nand.c.

#define NFC_V3_DELAY_LINE   (host->regs_ip + 0x34)

Definition at line 143 of file mxc_nand.c.

#define NFC_V3_ECC_STATUS_RESULT   (host->regs_axi + 0x38)

Definition at line 104 of file mxc_nand.c.

#define NFC_V3_FLASH_ADDR0   (host->regs_axi + 0x04)

Definition at line 98 of file mxc_nand.c.

#define NFC_V3_FLASH_CMD   (host->regs_axi + 0x00)

Definition at line 97 of file mxc_nand.c.

#define NFC_V3_IPC   (host->regs_ip + 0x2C)

Definition at line 139 of file mxc_nand.c.

#define NFC_V3_IPC_CREQ   (1 << 0)

Definition at line 140 of file mxc_nand.c.

#define NFC_V3_IPC_INT   (1 << 31)

Definition at line 141 of file mxc_nand.c.

#define NFC_V3_LAUNCH   (host->regs_axi + 0x40)

Definition at line 106 of file mxc_nand.c.

#define NFC_V3_WRPROT   (host->regs_ip + 0x0)

Definition at line 108 of file mxc_nand.c.

#define NFC_V3_WRPROT_BLS_UNLOCK   (2 << 6)

Definition at line 112 of file mxc_nand.c.

#define NFC_V3_WRPROT_LOCK   (1 << 1)

Definition at line 110 of file mxc_nand.c.

#define NFC_V3_WRPROT_LOCK_TIGHT   (1 << 0)

Definition at line 109 of file mxc_nand.c.

#define NFC_V3_WRPROT_UNLOCK   (1 << 2)

Definition at line 111 of file mxc_nand.c.

#define NFC_V3_WRPROT_UNLOCK_BLK_ADD0   (host->regs_ip + 0x04)

Definition at line 114 of file mxc_nand.c.

Function Documentation

MODULE_AUTHOR ( "Freescale  Semiconductor,
Inc."   
)
MODULE_DESCRIPTION ( "MXC NAND MTD driver )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( mxcnd_driver  )