Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
docg4.c File Reference
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/export.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/bitops.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/bch.h>
#include <linux/bitrev.h>

Go to the source code of this file.

Data Structures

struct  docg4_priv
 

Macros

#define DOC_IOSPACE_DATA   0x0800
 
#define DOC_CHIPID   0x1000
 
#define DOC_DEVICESELECT   0x100a
 
#define DOC_ASICMODE   0x100c
 
#define DOC_DATAEND   0x101e
 
#define DOC_NOP   0x103e
 
#define DOC_FLASHSEQUENCE   0x1032
 
#define DOC_FLASHCOMMAND   0x1034
 
#define DOC_FLASHADDRESS   0x1036
 
#define DOC_FLASHCONTROL   0x1038
 
#define DOC_ECCCONF0   0x1040
 
#define DOC_ECCCONF1   0x1042
 
#define DOC_HAMMINGPARITY   0x1046
 
#define DOC_BCH_SYNDROM(idx)   (0x1048 + idx)
 
#define DOC_ASICMODECONFIRM   0x1072
 
#define DOC_CHIPID_INV   0x1074
 
#define DOC_POWERMODE   0x107c
 
#define DOCG4_MYSTERY_REG   0x1050
 
#define DOCG4_OOB_6_7   0x1052
 
#define DOC_SEQ_RESET   0x00
 
#define DOCG4_SEQ_PAGE_READ   0x03
 
#define DOCG4_SEQ_FLUSH   0x29
 
#define DOCG4_SEQ_PAGEWRITE   0x16
 
#define DOCG4_SEQ_PAGEPROG   0x1e
 
#define DOCG4_SEQ_BLOCKERASE   0x24
 
#define DOCG4_CMD_PAGE_READ   0x00
 
#define DOC_CMD_ERASECYCLE2   0xd0
 
#define DOCG4_CMD_FLUSH   0x70
 
#define DOCG4_CMD_READ2   0x30
 
#define DOC_CMD_PROG_BLOCK_ADDR   0x60
 
#define DOCG4_CMD_PAGEWRITE   0x80
 
#define DOC_CMD_PROG_CYCLE2   0x10
 
#define DOC_CMD_RESET   0xff
 
#define DOC_POWERDOWN_READY   0x80
 
#define DOC_CTRL_CE   0x10
 
#define DOC_CTRL_UNKNOWN   0x40
 
#define DOC_CTRL_FLASHREADY   0x01
 
#define DOC_ECCCONF0_READ_MODE   0x8000
 
#define DOC_ECCCONF0_UNKNOWN   0x2000
 
#define DOC_ECCCONF0_ECC_ENABLE   0x1000
 
#define DOC_ECCCONF0_DATA_BYTES_MASK   0x07ff
 
#define DOC_ECCCONF1_BCH_SYNDROM_ERR   0x80
 
#define DOC_ECCCONF1_ECC_ENABLE   0x07
 
#define DOC_ECCCONF1_PAGE_IS_WRITTEN   0x20
 
#define DOC_ASICMODE_RESET   0x00
 
#define DOC_ASICMODE_NORMAL   0x01
 
#define DOC_ASICMODE_POWERDOWN   0x02
 
#define DOC_ASICMODE_MDWREN   0x04
 
#define DOC_ASICMODE_BDETCT_RESET   0x08
 
#define DOC_ASICMODE_RSTIN_RESET   0x10
 
#define DOC_ASICMODE_RAM_WE   0x20
 
#define DOCG4_PROGSTATUS_GOOD   0x51
 
#define DOCG4_PROGSTATUS_GOOD_2   0xe0
 
#define DOCG4_READ_ERROR   0x02 /* bit 1 indicates read error */
 
#define DOCG4_CHIP_SIZE   0x8000000
 
#define DOCG4_PAGE_SIZE   0x200
 
#define DOCG4_PAGES_PER_BLOCK   0x200
 
#define DOCG4_BLOCK_SIZE   (DOCG4_PAGES_PER_BLOCK * DOCG4_PAGE_SIZE)
 
#define DOCG4_NUMBLOCKS   (DOCG4_CHIP_SIZE / DOCG4_BLOCK_SIZE)
 
#define DOCG4_OOB_SIZE   0x10
 
#define DOCG4_CHIP_SHIFT   27 /* log_2(DOCG4_CHIP_SIZE) */
 
#define DOCG4_PAGE_SHIFT   9 /* log_2(DOCG4_PAGE_SIZE) */
 
#define DOCG4_ERASE_SHIFT   18 /* log_2(DOCG4_BLOCK_SIZE) */
 
#define DOCG4_BCH_SIZE   (DOCG4_PAGE_SIZE + DOCG4_OOB_SIZE - 1)
 
#define DOCG4_USERDATA_LEN   520 /* 512 byte page plus 8 oob avail to user */
 
#define DOCG4_IDREG1_VALUE   0x0400
 
#define DOCG4_IDREG2_VALUE   0xfbff
 
#define DOCG4_PRIMITIVE_POLY   0x4443
 
#define DOCG4_M   14 /* Galois field is of order 2^14 */
 
#define DOCG4_T   4 /* BCH alg corrects up to 4 bit errors */
 
#define DOCG4_FACTORY_BBT_PAGE   16 /* page where read-only factory bbt lives */
 

Functions

 module_param (ignore_badblocks, bool, 0)
 
 MODULE_PARM_DESC (ignore_badblocks,"no badblock checking performed")
 
 module_init (docg4_init)
 
 module_exit (docg4_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Mike Dunn")
 
 MODULE_DESCRIPTION ("M-Systems DiskOnChip G4 device driver")
 

Macro Definition Documentation

#define DOC_ASICMODE   0x100c

Definition at line 87 of file docg4.c.

#define DOC_ASICMODE_BDETCT_RESET   0x08

Definition at line 151 of file docg4.c.

#define DOC_ASICMODE_MDWREN   0x04

Definition at line 150 of file docg4.c.

#define DOC_ASICMODE_NORMAL   0x01

Definition at line 148 of file docg4.c.

#define DOC_ASICMODE_POWERDOWN   0x02

Definition at line 149 of file docg4.c.

#define DOC_ASICMODE_RAM_WE   0x20

Definition at line 153 of file docg4.c.

#define DOC_ASICMODE_RESET   0x00

Definition at line 147 of file docg4.c.

#define DOC_ASICMODE_RSTIN_RESET   0x10

Definition at line 152 of file docg4.c.

#define DOC_ASICMODECONFIRM   0x1072

Definition at line 100 of file docg4.c.

#define DOC_BCH_SYNDROM (   idx)    (0x1048 + idx)

Definition at line 98 of file docg4.c.

#define DOC_CHIPID   0x1000

Definition at line 85 of file docg4.c.

#define DOC_CHIPID_INV   0x1074

Definition at line 101 of file docg4.c.

#define DOC_CMD_ERASECYCLE2   0xd0

Definition at line 119 of file docg4.c.

#define DOC_CMD_PROG_BLOCK_ADDR   0x60

Definition at line 122 of file docg4.c.

#define DOC_CMD_PROG_CYCLE2   0x10

Definition at line 124 of file docg4.c.

#define DOC_CMD_RESET   0xff

Definition at line 125 of file docg4.c.

#define DOC_CTRL_CE   0x10

Definition at line 131 of file docg4.c.

#define DOC_CTRL_FLASHREADY   0x01

Definition at line 133 of file docg4.c.

#define DOC_CTRL_UNKNOWN   0x40

Definition at line 132 of file docg4.c.

#define DOC_DATAEND   0x101e

Definition at line 88 of file docg4.c.

#define DOC_DEVICESELECT   0x100a

Definition at line 86 of file docg4.c.

#define DOC_ECCCONF0   0x1040

Definition at line 95 of file docg4.c.

#define DOC_ECCCONF0_DATA_BYTES_MASK   0x07ff

Definition at line 139 of file docg4.c.

#define DOC_ECCCONF0_ECC_ENABLE   0x1000

Definition at line 138 of file docg4.c.

#define DOC_ECCCONF0_READ_MODE   0x8000

Definition at line 136 of file docg4.c.

#define DOC_ECCCONF0_UNKNOWN   0x2000

Definition at line 137 of file docg4.c.

#define DOC_ECCCONF1   0x1042

Definition at line 96 of file docg4.c.

#define DOC_ECCCONF1_BCH_SYNDROM_ERR   0x80

Definition at line 142 of file docg4.c.

#define DOC_ECCCONF1_ECC_ENABLE   0x07

Definition at line 143 of file docg4.c.

#define DOC_ECCCONF1_PAGE_IS_WRITTEN   0x20

Definition at line 144 of file docg4.c.

#define DOC_FLASHADDRESS   0x1036

Definition at line 93 of file docg4.c.

#define DOC_FLASHCOMMAND   0x1034

Definition at line 92 of file docg4.c.

#define DOC_FLASHCONTROL   0x1038

Definition at line 94 of file docg4.c.

#define DOC_FLASHSEQUENCE   0x1032

Definition at line 91 of file docg4.c.

#define DOC_HAMMINGPARITY   0x1046

Definition at line 97 of file docg4.c.

#define DOC_IOSPACE_DATA   0x0800

Definition at line 82 of file docg4.c.

#define DOC_NOP   0x103e

Definition at line 89 of file docg4.c.

#define DOC_POWERDOWN_READY   0x80

Definition at line 128 of file docg4.c.

#define DOC_POWERMODE   0x107c

Definition at line 102 of file docg4.c.

#define DOC_SEQ_RESET   0x00

Definition at line 110 of file docg4.c.

#define DOCG4_BCH_SIZE   (DOCG4_PAGE_SIZE + DOCG4_OOB_SIZE - 1)

Definition at line 178 of file docg4.c.

#define DOCG4_BLOCK_SIZE   (DOCG4_PAGES_PER_BLOCK * DOCG4_PAGE_SIZE)

Definition at line 170 of file docg4.c.

#define DOCG4_CHIP_SHIFT   27 /* log_2(DOCG4_CHIP_SIZE) */

Definition at line 173 of file docg4.c.

#define DOCG4_CHIP_SIZE   0x8000000

Definition at line 167 of file docg4.c.

#define DOCG4_CMD_FLUSH   0x70

Definition at line 120 of file docg4.c.

#define DOCG4_CMD_PAGE_READ   0x00

Definition at line 118 of file docg4.c.

#define DOCG4_CMD_PAGEWRITE   0x80

Definition at line 123 of file docg4.c.

#define DOCG4_CMD_READ2   0x30

Definition at line 121 of file docg4.c.

#define DOCG4_ERASE_SHIFT   18 /* log_2(DOCG4_BLOCK_SIZE) */

Definition at line 175 of file docg4.c.

#define DOCG4_FACTORY_BBT_PAGE   16 /* page where read-only factory bbt lives */

Definition at line 192 of file docg4.c.

#define DOCG4_IDREG1_VALUE   0x0400

Definition at line 183 of file docg4.c.

#define DOCG4_IDREG2_VALUE   0xfbff

Definition at line 184 of file docg4.c.

#define DOCG4_M   14 /* Galois field is of order 2^14 */

Definition at line 189 of file docg4.c.

#define DOCG4_MYSTERY_REG   0x1050

Definition at line 104 of file docg4.c.

#define DOCG4_NUMBLOCKS   (DOCG4_CHIP_SIZE / DOCG4_BLOCK_SIZE)

Definition at line 171 of file docg4.c.

#define DOCG4_OOB_6_7   0x1052

Definition at line 107 of file docg4.c.

#define DOCG4_OOB_SIZE   0x10

Definition at line 172 of file docg4.c.

#define DOCG4_PAGE_SHIFT   9 /* log_2(DOCG4_PAGE_SIZE) */

Definition at line 174 of file docg4.c.

#define DOCG4_PAGE_SIZE   0x200

Definition at line 168 of file docg4.c.

#define DOCG4_PAGES_PER_BLOCK   0x200

Definition at line 169 of file docg4.c.

#define DOCG4_PRIMITIVE_POLY   0x4443

Definition at line 187 of file docg4.c.

#define DOCG4_PROGSTATUS_GOOD   0x51

Definition at line 156 of file docg4.c.

#define DOCG4_PROGSTATUS_GOOD_2   0xe0

Definition at line 157 of file docg4.c.

#define DOCG4_READ_ERROR   0x02 /* bit 1 indicates read error */

Definition at line 164 of file docg4.c.

#define DOCG4_SEQ_BLOCKERASE   0x24

Definition at line 115 of file docg4.c.

#define DOCG4_SEQ_FLUSH   0x29

Definition at line 112 of file docg4.c.

#define DOCG4_SEQ_PAGE_READ   0x03

Definition at line 111 of file docg4.c.

#define DOCG4_SEQ_PAGEPROG   0x1e

Definition at line 114 of file docg4.c.

#define DOCG4_SEQ_PAGEWRITE   0x16

Definition at line 113 of file docg4.c.

#define DOCG4_T   4 /* BCH alg corrects up to 4 bit errors */

Definition at line 190 of file docg4.c.

#define DOCG4_USERDATA_LEN   520 /* 512 byte page plus 8 oob avail to user */

Definition at line 180 of file docg4.c.

Function Documentation

MODULE_AUTHOR ( "Mike Dunn"  )
MODULE_DESCRIPTION ( "M-Systems DiskOnChip G4 device driver )
module_exit ( docg4_exit  )
module_init ( docg4_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( ignore_badblocks  ,
bool  ,
 
)
MODULE_PARM_DESC ( ignore_badblocks  ,
"no badblock checking performed"   
)