Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  linux/include/linux/mtd/onenand_regs.h
0004  *
0005  *  OneNAND Register header file
0006  *
0007  *  Copyright (C) 2005-2007 Samsung Electronics
0008  *  Kyungmin Park <kyungmin.park@samsung.com>
0009  */
0010 
0011 #ifndef __ONENAND_REG_H
0012 #define __ONENAND_REG_H
0013 
0014 /* Memory Address Map Translation (Word order) */
0015 #define ONENAND_MEMORY_MAP(x)       ((x) << 1)
0016 
0017 /*
0018  * External BufferRAM area
0019  */
0020 #define ONENAND_BOOTRAM         ONENAND_MEMORY_MAP(0x0000)
0021 #define ONENAND_DATARAM         ONENAND_MEMORY_MAP(0x0200)
0022 #define ONENAND_SPARERAM        ONENAND_MEMORY_MAP(0x8010)
0023 
0024 /*
0025  * OneNAND Registers
0026  */
0027 #define ONENAND_REG_MANUFACTURER_ID ONENAND_MEMORY_MAP(0xF000)
0028 #define ONENAND_REG_DEVICE_ID       ONENAND_MEMORY_MAP(0xF001)
0029 #define ONENAND_REG_VERSION_ID      ONENAND_MEMORY_MAP(0xF002)
0030 #define ONENAND_REG_DATA_BUFFER_SIZE    ONENAND_MEMORY_MAP(0xF003)
0031 #define ONENAND_REG_BOOT_BUFFER_SIZE    ONENAND_MEMORY_MAP(0xF004)
0032 #define ONENAND_REG_NUM_BUFFERS     ONENAND_MEMORY_MAP(0xF005)
0033 #define ONENAND_REG_TECHNOLOGY      ONENAND_MEMORY_MAP(0xF006)
0034 
0035 #define ONENAND_REG_START_ADDRESS1  ONENAND_MEMORY_MAP(0xF100)
0036 #define ONENAND_REG_START_ADDRESS2  ONENAND_MEMORY_MAP(0xF101)
0037 #define ONENAND_REG_START_ADDRESS3  ONENAND_MEMORY_MAP(0xF102)
0038 #define ONENAND_REG_START_ADDRESS4  ONENAND_MEMORY_MAP(0xF103)
0039 #define ONENAND_REG_START_ADDRESS5  ONENAND_MEMORY_MAP(0xF104)
0040 #define ONENAND_REG_START_ADDRESS6  ONENAND_MEMORY_MAP(0xF105)
0041 #define ONENAND_REG_START_ADDRESS7  ONENAND_MEMORY_MAP(0xF106)
0042 #define ONENAND_REG_START_ADDRESS8  ONENAND_MEMORY_MAP(0xF107)
0043 
0044 #define ONENAND_REG_START_BUFFER    ONENAND_MEMORY_MAP(0xF200)
0045 #define ONENAND_REG_COMMAND     ONENAND_MEMORY_MAP(0xF220)
0046 #define ONENAND_REG_SYS_CFG1        ONENAND_MEMORY_MAP(0xF221)
0047 #define ONENAND_REG_SYS_CFG2        ONENAND_MEMORY_MAP(0xF222)
0048 #define ONENAND_REG_CTRL_STATUS     ONENAND_MEMORY_MAP(0xF240)
0049 #define ONENAND_REG_INTERRUPT       ONENAND_MEMORY_MAP(0xF241)
0050 #define ONENAND_REG_START_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24C)
0051 #define ONENAND_REG_END_BLOCK_ADDRESS   ONENAND_MEMORY_MAP(0xF24D)
0052 #define ONENAND_REG_WP_STATUS       ONENAND_MEMORY_MAP(0xF24E)
0053 
0054 #define ONENAND_REG_ECC_STATUS      ONENAND_MEMORY_MAP(0xFF00)
0055 #define ONENAND_REG_ECC_M0      ONENAND_MEMORY_MAP(0xFF01)
0056 #define ONENAND_REG_ECC_S0      ONENAND_MEMORY_MAP(0xFF02)
0057 #define ONENAND_REG_ECC_M1      ONENAND_MEMORY_MAP(0xFF03)
0058 #define ONENAND_REG_ECC_S1      ONENAND_MEMORY_MAP(0xFF04)
0059 #define ONENAND_REG_ECC_M2      ONENAND_MEMORY_MAP(0xFF05)
0060 #define ONENAND_REG_ECC_S2      ONENAND_MEMORY_MAP(0xFF06)
0061 #define ONENAND_REG_ECC_M3      ONENAND_MEMORY_MAP(0xFF07)
0062 #define ONENAND_REG_ECC_S3      ONENAND_MEMORY_MAP(0xFF08)
0063 
0064 /*
0065  * Device ID Register F001h (R)
0066  */
0067 #define DEVICE_IS_FLEXONENAND       (1 << 9)
0068 #define FLEXONENAND_PI_MASK     (0x3ff)
0069 #define FLEXONENAND_PI_UNLOCK_SHIFT (14)
0070 #define ONENAND_DEVICE_DENSITY_MASK (0xf)
0071 #define ONENAND_DEVICE_DENSITY_SHIFT    (4)
0072 #define ONENAND_DEVICE_IS_DDP       (1 << 3)
0073 #define ONENAND_DEVICE_IS_DEMUX     (1 << 2)
0074 #define ONENAND_DEVICE_VCC_MASK     (0x3)
0075 
0076 #define ONENAND_DEVICE_DENSITY_512Mb    (0x002)
0077 #define ONENAND_DEVICE_DENSITY_1Gb  (0x003)
0078 #define ONENAND_DEVICE_DENSITY_2Gb  (0x004)
0079 #define ONENAND_DEVICE_DENSITY_4Gb  (0x005)
0080 #define ONENAND_DEVICE_DENSITY_8Gb  (0x006)
0081 
0082 /*
0083  * Version ID Register F002h (R)
0084  */
0085 #define ONENAND_VERSION_PROCESS_SHIFT   (8)
0086 
0087 /*
0088  * Technology Register F006h (R)
0089  */
0090 #define ONENAND_TECHNOLOGY_IS_MLC   (1 << 0)
0091 
0092 /*
0093  * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W)
0094  */
0095 #define ONENAND_DDP_SHIFT       (15)
0096 #define ONENAND_DDP_CHIP0       (0)
0097 #define ONENAND_DDP_CHIP1       (1 << ONENAND_DDP_SHIFT)
0098 
0099 /*
0100  * Start Address 8 F107h (R/W)
0101  */
0102 /* Note: It's actually 0x3f in case of SLC */
0103 #define ONENAND_FPA_MASK        (0x7f)
0104 #define ONENAND_FPA_SHIFT       (2)
0105 #define ONENAND_FSA_MASK        (0x03)
0106 
0107 /*
0108  * Start Buffer Register F200h (R/W)
0109  */
0110 #define ONENAND_BSA_MASK        (0x03)
0111 #define ONENAND_BSA_SHIFT       (8)
0112 #define ONENAND_BSA_BOOTRAM     (0 << 2)
0113 #define ONENAND_BSA_DATARAM0        (2 << 2)
0114 #define ONENAND_BSA_DATARAM1        (3 << 2)
0115 /* Note: It's actually 0x03 in case of SLC */
0116 #define ONENAND_BSC_MASK        (0x07)
0117 
0118 /*
0119  * Command Register F220h (R/W)
0120  */
0121 #define ONENAND_CMD_READ        (0x00)
0122 #define ONENAND_CMD_READOOB     (0x13)
0123 #define ONENAND_CMD_PROG        (0x80)
0124 #define ONENAND_CMD_PROGOOB     (0x1A)
0125 #define ONENAND_CMD_2X_PROG     (0x7D)
0126 #define ONENAND_CMD_2X_CACHE_PROG   (0x7F)
0127 #define ONENAND_CMD_UNLOCK      (0x23)
0128 #define ONENAND_CMD_LOCK        (0x2A)
0129 #define ONENAND_CMD_LOCK_TIGHT      (0x2C)
0130 #define ONENAND_CMD_UNLOCK_ALL      (0x27)
0131 #define ONENAND_CMD_ERASE       (0x94)
0132 #define ONENAND_CMD_MULTIBLOCK_ERASE    (0x95)
0133 #define ONENAND_CMD_ERASE_VERIFY    (0x71)
0134 #define ONENAND_CMD_RESET       (0xF0)
0135 #define ONENAND_CMD_OTP_ACCESS      (0x65)
0136 #define ONENAND_CMD_READID      (0x90)
0137 #define FLEXONENAND_CMD_PI_UPDATE   (0x05)
0138 #define FLEXONENAND_CMD_PI_ACCESS   (0x66)
0139 #define FLEXONENAND_CMD_RECOVER_LSB (0x05)
0140 
0141 /* NOTE: Those are not *REAL* commands */
0142 #define ONENAND_CMD_BUFFERRAM       (0x1978)
0143 #define FLEXONENAND_CMD_READ_PI     (0x1985)
0144 
0145 /*
0146  * System Configuration 1 Register F221h (R, R/W)
0147  */
0148 #define ONENAND_SYS_CFG1_SYNC_READ  (1 << 15)
0149 #define ONENAND_SYS_CFG1_BRL_7      (7 << 12)
0150 #define ONENAND_SYS_CFG1_BRL_6      (6 << 12)
0151 #define ONENAND_SYS_CFG1_BRL_5      (5 << 12)
0152 #define ONENAND_SYS_CFG1_BRL_4      (4 << 12)
0153 #define ONENAND_SYS_CFG1_BRL_3      (3 << 12)
0154 #define ONENAND_SYS_CFG1_BRL_10     (2 << 12)
0155 #define ONENAND_SYS_CFG1_BRL_9      (1 << 12)
0156 #define ONENAND_SYS_CFG1_BRL_8      (0 << 12)
0157 #define ONENAND_SYS_CFG1_BRL_SHIFT  (12)
0158 #define ONENAND_SYS_CFG1_BL_32      (4 << 9)
0159 #define ONENAND_SYS_CFG1_BL_16      (3 << 9)
0160 #define ONENAND_SYS_CFG1_BL_8       (2 << 9)
0161 #define ONENAND_SYS_CFG1_BL_4       (1 << 9)
0162 #define ONENAND_SYS_CFG1_BL_CONT    (0 << 9)
0163 #define ONENAND_SYS_CFG1_BL_SHIFT   (9)
0164 #define ONENAND_SYS_CFG1_NO_ECC     (1 << 8)
0165 #define ONENAND_SYS_CFG1_RDY        (1 << 7)
0166 #define ONENAND_SYS_CFG1_INT        (1 << 6)
0167 #define ONENAND_SYS_CFG1_IOBE       (1 << 5)
0168 #define ONENAND_SYS_CFG1_RDY_CONF   (1 << 4)
0169 #define ONENAND_SYS_CFG1_VHF        (1 << 3)
0170 #define ONENAND_SYS_CFG1_HF     (1 << 2)
0171 #define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1)
0172 
0173 /*
0174  * Controller Status Register F240h (R)
0175  */
0176 #define ONENAND_CTRL_ONGO       (1 << 15)
0177 #define ONENAND_CTRL_LOCK       (1 << 14)
0178 #define ONENAND_CTRL_LOAD       (1 << 13)
0179 #define ONENAND_CTRL_PROGRAM        (1 << 12)
0180 #define ONENAND_CTRL_ERASE      (1 << 11)
0181 #define ONENAND_CTRL_ERROR      (1 << 10)
0182 #define ONENAND_CTRL_RSTB       (1 << 7)
0183 #define ONENAND_CTRL_OTP_L      (1 << 6)
0184 #define ONENAND_CTRL_OTP_BL     (1 << 5)
0185 
0186 /*
0187  * Interrupt Status Register F241h (R)
0188  */
0189 #define ONENAND_INT_MASTER      (1 << 15)
0190 #define ONENAND_INT_READ        (1 << 7)
0191 #define ONENAND_INT_WRITE       (1 << 6)
0192 #define ONENAND_INT_ERASE       (1 << 5)
0193 #define ONENAND_INT_RESET       (1 << 4)
0194 #define ONENAND_INT_CLEAR       (0 << 0)
0195 
0196 /*
0197  * NAND Flash Write Protection Status Register F24Eh (R)
0198  */
0199 #define ONENAND_WP_US           (1 << 2)
0200 #define ONENAND_WP_LS           (1 << 1)
0201 #define ONENAND_WP_LTS          (1 << 0)
0202 
0203 /*
0204  * ECC Status Reigser FF00h (R)
0205  */
0206 #define ONENAND_ECC_1BIT        (1 << 0)
0207 #define ONENAND_ECC_1BIT_ALL        (0x5555)
0208 #define ONENAND_ECC_2BIT        (1 << 1)
0209 #define ONENAND_ECC_2BIT_ALL        (0xAAAA)
0210 #define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
0211 #define ONENAND_ECC_3BIT        (1 << 2)
0212 #define ONENAND_ECC_4BIT        (1 << 3)
0213 #define ONENAND_ECC_4BIT_UNCORRECTABLE  (0x1010)
0214 
0215 /*
0216  * One-Time Programmable (OTP)
0217  */
0218 #define FLEXONENAND_OTP_LOCK_OFFSET     (2048)
0219 #define ONENAND_OTP_LOCK_OFFSET     (14)
0220 
0221 #endif  /* __ONENAND_REG_H */