0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __ASM_FSL_IFC_H
0010 #define __ASM_FSL_IFC_H
0011
0012 #include <linux/compiler.h>
0013 #include <linux/types.h>
0014 #include <linux/io.h>
0015
0016 #include <linux/of_platform.h>
0017 #include <linux/interrupt.h>
0018
0019
0020
0021
0022
0023
0024 #define FSL_IFC_BANK_COUNT 8
0025
0026 #define FSL_IFC_VERSION_MASK 0x0F0F0000
0027 #define FSL_IFC_VERSION_1_0_0 0x01000000
0028 #define FSL_IFC_VERSION_1_1_0 0x01010000
0029 #define FSL_IFC_VERSION_2_0_0 0x02000000
0030
0031 #define PGOFFSET_64K (64*1024)
0032 #define PGOFFSET_4K (4*1024)
0033
0034
0035
0036
0037 #define CSPR_BA 0xFFFF0000
0038 #define CSPR_BA_SHIFT 16
0039 #define CSPR_PORT_SIZE 0x00000180
0040 #define CSPR_PORT_SIZE_SHIFT 7
0041
0042 #define CSPR_PORT_SIZE_8 0x00000080
0043
0044 #define CSPR_PORT_SIZE_16 0x00000100
0045
0046 #define CSPR_PORT_SIZE_32 0x00000180
0047
0048 #define CSPR_WP 0x00000040
0049 #define CSPR_WP_SHIFT 6
0050
0051 #define CSPR_MSEL 0x00000006
0052 #define CSPR_MSEL_SHIFT 1
0053
0054 #define CSPR_MSEL_NOR 0x00000000
0055
0056 #define CSPR_MSEL_NAND 0x00000002
0057
0058 #define CSPR_MSEL_GPCM 0x00000004
0059
0060 #define CSPR_V 0x00000001
0061 #define CSPR_V_SHIFT 0
0062
0063
0064
0065
0066 #define IFC_AMASK_MASK 0xFFFF0000
0067 #define IFC_AMASK_SHIFT 16
0068 #define IFC_AMASK(n) (IFC_AMASK_MASK << \
0069 (__ilog2(n) - IFC_AMASK_SHIFT))
0070
0071
0072
0073
0074
0075 #define CSOR_NAND_ECC_ENC_EN 0x80000000
0076 #define CSOR_NAND_ECC_MODE_MASK 0x30000000
0077
0078 #define CSOR_NAND_ECC_MODE_4 0x00000000
0079
0080 #define CSOR_NAND_ECC_MODE_8 0x10000000
0081
0082 #define CSOR_NAND_ECC_DEC_EN 0x04000000
0083
0084 #define CSOR_NAND_RAL_MASK 0x01800000
0085 #define CSOR_NAND_RAL_SHIFT 20
0086 #define CSOR_NAND_RAL_1 0x00000000
0087 #define CSOR_NAND_RAL_2 0x00800000
0088 #define CSOR_NAND_RAL_3 0x01000000
0089 #define CSOR_NAND_RAL_4 0x01800000
0090
0091 #define CSOR_NAND_PGS_MASK 0x00180000
0092 #define CSOR_NAND_PGS_SHIFT 16
0093 #define CSOR_NAND_PGS_512 0x00000000
0094 #define CSOR_NAND_PGS_2K 0x00080000
0095 #define CSOR_NAND_PGS_4K 0x00100000
0096 #define CSOR_NAND_PGS_8K 0x00180000
0097
0098 #define CSOR_NAND_SPRZ_MASK 0x0000E000
0099 #define CSOR_NAND_SPRZ_SHIFT 13
0100 #define CSOR_NAND_SPRZ_16 0x00000000
0101 #define CSOR_NAND_SPRZ_64 0x00002000
0102 #define CSOR_NAND_SPRZ_128 0x00004000
0103 #define CSOR_NAND_SPRZ_210 0x00006000
0104 #define CSOR_NAND_SPRZ_218 0x00008000
0105 #define CSOR_NAND_SPRZ_224 0x0000A000
0106 #define CSOR_NAND_SPRZ_CSOR_EXT 0x0000C000
0107
0108 #define CSOR_NAND_PB_MASK 0x00000700
0109 #define CSOR_NAND_PB_SHIFT 8
0110 #define CSOR_NAND_PB(n) ((__ilog2(n) - 5) << CSOR_NAND_PB_SHIFT)
0111
0112 #define CSOR_NAND_TRHZ_MASK 0x0000001C
0113 #define CSOR_NAND_TRHZ_SHIFT 2
0114 #define CSOR_NAND_TRHZ_20 0x00000000
0115 #define CSOR_NAND_TRHZ_40 0x00000004
0116 #define CSOR_NAND_TRHZ_60 0x00000008
0117 #define CSOR_NAND_TRHZ_80 0x0000000C
0118 #define CSOR_NAND_TRHZ_100 0x00000010
0119
0120 #define CSOR_NAND_BCTLD 0x00000001
0121
0122
0123
0124
0125
0126 #define CSOR_NOR_ADM_SHFT_MODE_EN 0x80000000
0127
0128 #define CSOR_NOR_PGRD_EN 0x10000000
0129
0130 #define CSOR_NOR_AVD_TGL_PGM_EN 0x01000000
0131
0132 #define CSOR_NOR_ADM_MASK 0x0003E000
0133 #define CSOR_NOR_ADM_SHIFT_SHIFT 13
0134 #define CSOR_NOR_ADM_SHIFT(n) ((n) << CSOR_NOR_ADM_SHIFT_SHIFT)
0135
0136 #define CSOR_NOR_NOR_MODE_AYSNC_NOR 0x00000000
0137 #define CSOR_NOR_NOR_MODE_AVD_NOR 0x00000020
0138
0139 #define CSOR_NOR_TRHZ_MASK 0x0000001C
0140 #define CSOR_NOR_TRHZ_SHIFT 2
0141 #define CSOR_NOR_TRHZ_20 0x00000000
0142 #define CSOR_NOR_TRHZ_40 0x00000004
0143 #define CSOR_NOR_TRHZ_60 0x00000008
0144 #define CSOR_NOR_TRHZ_80 0x0000000C
0145 #define CSOR_NOR_TRHZ_100 0x00000010
0146
0147 #define CSOR_NOR_BCTLD 0x00000001
0148
0149
0150
0151
0152
0153 #define CSOR_GPCM_GPMODE_NORMAL 0x00000000
0154
0155 #define CSOR_GPCM_GPMODE_ASIC 0x80000000
0156
0157 #define CSOR_GPCM_PARITY_EVEN 0x40000000
0158
0159 #define CSOR_GPCM_PAR_EN 0x20000000
0160
0161 #define CSOR_GPCM_GPTO_MASK 0x0F000000
0162 #define CSOR_GPCM_GPTO_SHIFT 24
0163 #define CSOR_GPCM_GPTO(n) ((__ilog2(n) - 8) << CSOR_GPCM_GPTO_SHIFT)
0164
0165 #define CSOR_GPCM_RGETA_EXT 0x00080000
0166
0167 #define CSOR_GPCM_WGETA_EXT 0x00040000
0168
0169 #define CSOR_GPCM_ADM_MASK 0x0003E000
0170 #define CSOR_GPCM_ADM_SHIFT_SHIFT 13
0171 #define CSOR_GPCM_ADM_SHIFT(n) ((n) << CSOR_GPCM_ADM_SHIFT_SHIFT)
0172
0173 #define CSOR_GPCM_GAPERRD_MASK 0x00000180
0174 #define CSOR_GPCM_GAPERRD_SHIFT 7
0175 #define CSOR_GPCM_GAPERRD(n) (((n) - 1) << CSOR_GPCM_GAPERRD_SHIFT)
0176
0177 #define CSOR_GPCM_TRHZ_MASK 0x0000001C
0178 #define CSOR_GPCM_TRHZ_20 0x00000000
0179 #define CSOR_GPCM_TRHZ_40 0x00000004
0180 #define CSOR_GPCM_TRHZ_60 0x00000008
0181 #define CSOR_GPCM_TRHZ_80 0x0000000C
0182 #define CSOR_GPCM_TRHZ_100 0x00000010
0183
0184 #define CSOR_GPCM_BCTLD 0x00000001
0185
0186
0187
0188
0189
0190 #define IFC_RB_STAT_READY_CS0 0x80000000
0191 #define IFC_RB_STAT_READY_CS1 0x40000000
0192 #define IFC_RB_STAT_READY_CS2 0x20000000
0193 #define IFC_RB_STAT_READY_CS3 0x10000000
0194
0195
0196
0197
0198 #define IFC_GCR_MASK 0x8000F800
0199
0200 #define IFC_GCR_SOFT_RST_ALL 0x80000000
0201
0202 #define IFC_GCR_TBCTL_TRN_TIME 0x0000F800
0203 #define IFC_GCR_TBCTL_TRN_TIME_SHIFT 11
0204
0205
0206
0207
0208
0209 #define IFC_CM_EVTER_STAT_CSER 0x80000000
0210
0211
0212
0213
0214
0215 #define IFC_CM_EVTER_EN_CSEREN 0x80000000
0216
0217
0218
0219
0220
0221 #define IFC_CM_EVTER_INTR_EN_CSERIREN 0x80000000
0222
0223
0224
0225
0226
0227 #define IFC_CM_ERATTR0_ERTYP_READ 0x80000000
0228 #define IFC_CM_ERATTR0_ERAID 0x0FF00000
0229 #define IFC_CM_ERATTR0_ERAID_SHIFT 20
0230 #define IFC_CM_ERATTR0_ESRCID 0x0000FF00
0231 #define IFC_CM_ERATTR0_ESRCID_SHIFT 8
0232
0233
0234
0235
0236 #define IFC_CCR_MASK 0x0F0F8800
0237
0238 #define IFC_CCR_CLK_DIV_MASK 0x0F000000
0239 #define IFC_CCR_CLK_DIV_SHIFT 24
0240 #define IFC_CCR_CLK_DIV(n) ((n-1) << IFC_CCR_CLK_DIV_SHIFT)
0241
0242 #define IFC_CCR_CLK_DLY_MASK 0x000F0000
0243 #define IFC_CCR_CLK_DLY_SHIFT 16
0244 #define IFC_CCR_CLK_DLY(n) ((n) << IFC_CCR_CLK_DLY_SHIFT)
0245
0246 #define IFC_CCR_INV_CLK_EN 0x00008000
0247
0248 #define IFC_CCR_FB_IFC_CLK_SEL 0x00000800
0249
0250
0251
0252
0253
0254 #define IFC_CSR_CLK_STAT_STABLE 0x80000000
0255
0256
0257
0258
0259
0260
0261
0262
0263 #define IFC_NAND_NCFGR_BOOT 0x80000000
0264
0265 #define IFC_NAND_NCFGR_SRAM_INIT_EN 0x20000000
0266
0267 #define IFC_NAND_NCFGR_ADDR_MODE_RC0 0x00000000
0268
0269 #define IFC_NAND_NCFGR_ADDR_MODE_RC1 0x00400000
0270
0271 #define IFC_NAND_NCFGR_NUM_LOOP_MASK 0x0000F000
0272 #define IFC_NAND_NCFGR_NUM_LOOP_SHIFT 12
0273 #define IFC_NAND_NCFGR_NUM_LOOP(n) ((n) << IFC_NAND_NCFGR_NUM_LOOP_SHIFT)
0274
0275 #define IFC_NAND_NCFGR_NUM_WAIT_MASK 0x000000FF
0276 #define IFC_NAND_NCFGR_NUM_WAIT_SHIFT 0
0277
0278
0279
0280
0281
0282 #define IFC_NAND_FCR0_CMD0 0xFF000000
0283 #define IFC_NAND_FCR0_CMD0_SHIFT 24
0284 #define IFC_NAND_FCR0_CMD1 0x00FF0000
0285 #define IFC_NAND_FCR0_CMD1_SHIFT 16
0286 #define IFC_NAND_FCR0_CMD2 0x0000FF00
0287 #define IFC_NAND_FCR0_CMD2_SHIFT 8
0288 #define IFC_NAND_FCR0_CMD3 0x000000FF
0289 #define IFC_NAND_FCR0_CMD3_SHIFT 0
0290 #define IFC_NAND_FCR1_CMD4 0xFF000000
0291 #define IFC_NAND_FCR1_CMD4_SHIFT 24
0292 #define IFC_NAND_FCR1_CMD5 0x00FF0000
0293 #define IFC_NAND_FCR1_CMD5_SHIFT 16
0294 #define IFC_NAND_FCR1_CMD6 0x0000FF00
0295 #define IFC_NAND_FCR1_CMD6_SHIFT 8
0296 #define IFC_NAND_FCR1_CMD7 0x000000FF
0297 #define IFC_NAND_FCR1_CMD7_SHIFT 0
0298
0299
0300
0301
0302
0303 #define IFC_NAND_COL_MS 0x80000000
0304
0305 #define IFC_NAND_COL_CA_MASK 0x00000FFF
0306
0307
0308
0309
0310
0311 #define IFC_NAND_BC 0x000001FF
0312
0313
0314
0315
0316
0317 #define IFC_NAND_FIR0_OP0 0xFC000000
0318 #define IFC_NAND_FIR0_OP0_SHIFT 26
0319 #define IFC_NAND_FIR0_OP1 0x03F00000
0320 #define IFC_NAND_FIR0_OP1_SHIFT 20
0321 #define IFC_NAND_FIR0_OP2 0x000FC000
0322 #define IFC_NAND_FIR0_OP2_SHIFT 14
0323 #define IFC_NAND_FIR0_OP3 0x00003F00
0324 #define IFC_NAND_FIR0_OP3_SHIFT 8
0325 #define IFC_NAND_FIR0_OP4 0x000000FC
0326 #define IFC_NAND_FIR0_OP4_SHIFT 2
0327 #define IFC_NAND_FIR1_OP5 0xFC000000
0328 #define IFC_NAND_FIR1_OP5_SHIFT 26
0329 #define IFC_NAND_FIR1_OP6 0x03F00000
0330 #define IFC_NAND_FIR1_OP6_SHIFT 20
0331 #define IFC_NAND_FIR1_OP7 0x000FC000
0332 #define IFC_NAND_FIR1_OP7_SHIFT 14
0333 #define IFC_NAND_FIR1_OP8 0x00003F00
0334 #define IFC_NAND_FIR1_OP8_SHIFT 8
0335 #define IFC_NAND_FIR1_OP9 0x000000FC
0336 #define IFC_NAND_FIR1_OP9_SHIFT 2
0337 #define IFC_NAND_FIR2_OP10 0xFC000000
0338 #define IFC_NAND_FIR2_OP10_SHIFT 26
0339 #define IFC_NAND_FIR2_OP11 0x03F00000
0340 #define IFC_NAND_FIR2_OP11_SHIFT 20
0341 #define IFC_NAND_FIR2_OP12 0x000FC000
0342 #define IFC_NAND_FIR2_OP12_SHIFT 14
0343 #define IFC_NAND_FIR2_OP13 0x00003F00
0344 #define IFC_NAND_FIR2_OP13_SHIFT 8
0345 #define IFC_NAND_FIR2_OP14 0x000000FC
0346 #define IFC_NAND_FIR2_OP14_SHIFT 2
0347
0348
0349
0350
0351
0352 enum ifc_nand_fir_opcodes {
0353 IFC_FIR_OP_NOP,
0354 IFC_FIR_OP_CA0,
0355 IFC_FIR_OP_CA1,
0356 IFC_FIR_OP_CA2,
0357 IFC_FIR_OP_CA3,
0358 IFC_FIR_OP_RA0,
0359 IFC_FIR_OP_RA1,
0360 IFC_FIR_OP_RA2,
0361 IFC_FIR_OP_RA3,
0362 IFC_FIR_OP_CMD0,
0363 IFC_FIR_OP_CMD1,
0364 IFC_FIR_OP_CMD2,
0365 IFC_FIR_OP_CMD3,
0366 IFC_FIR_OP_CMD4,
0367 IFC_FIR_OP_CMD5,
0368 IFC_FIR_OP_CMD6,
0369 IFC_FIR_OP_CMD7,
0370 IFC_FIR_OP_CW0,
0371 IFC_FIR_OP_CW1,
0372 IFC_FIR_OP_CW2,
0373 IFC_FIR_OP_CW3,
0374 IFC_FIR_OP_CW4,
0375 IFC_FIR_OP_CW5,
0376 IFC_FIR_OP_CW6,
0377 IFC_FIR_OP_CW7,
0378 IFC_FIR_OP_WBCD,
0379 IFC_FIR_OP_RBCD,
0380 IFC_FIR_OP_BTRD,
0381 IFC_FIR_OP_RDSTAT,
0382 IFC_FIR_OP_NWAIT,
0383 IFC_FIR_OP_WFR,
0384 IFC_FIR_OP_SBRD,
0385 IFC_FIR_OP_UA,
0386 IFC_FIR_OP_RB,
0387 };
0388
0389
0390
0391
0392 #define IFC_NAND_CSEL 0x0C000000
0393 #define IFC_NAND_CSEL_SHIFT 26
0394 #define IFC_NAND_CSEL_CS0 0x00000000
0395 #define IFC_NAND_CSEL_CS1 0x04000000
0396 #define IFC_NAND_CSEL_CS2 0x08000000
0397 #define IFC_NAND_CSEL_CS3 0x0C000000
0398
0399
0400
0401
0402
0403 #define IFC_NAND_SEQ_STRT_FIR_STRT 0x80000000
0404
0405 #define IFC_NAND_SEQ_STRT_AUTO_ERS 0x00800000
0406
0407 #define IFC_NAND_SEQ_STRT_AUTO_PGM 0x00100000
0408
0409 #define IFC_NAND_SEQ_STRT_AUTO_CPB 0x00020000
0410
0411 #define IFC_NAND_SEQ_STRT_AUTO_RD 0x00004000
0412
0413 #define IFC_NAND_SEQ_STRT_AUTO_STAT_RD 0x00000800
0414
0415
0416
0417
0418
0419 #define IFC_NAND_EVTER_STAT_OPC 0x80000000
0420
0421 #define IFC_NAND_EVTER_STAT_FTOER 0x08000000
0422
0423 #define IFC_NAND_EVTER_STAT_WPER 0x04000000
0424
0425 #define IFC_NAND_EVTER_STAT_ECCER 0x02000000
0426
0427 #define IFC_NAND_EVTER_STAT_RCW_DN 0x00008000
0428
0429 #define IFC_NAND_EVTER_STAT_BOOT_DN 0x00004000
0430
0431 #define IFC_NAND_EVTER_STAT_BBI_SRCH_SE 0x00000800
0432
0433
0434
0435
0436
0437 #define PGRDCMPL_EVT_STAT_MASK 0xFFFF0000
0438
0439 #define PGRDCMPL_EVT_STAT_SECTION_SP(n) (1 << (31 - (n)))
0440
0441 #define PGRDCMPL_EVT_STAT_LP_2K(n) (0xF << (28 - (n)*4))
0442
0443 #define PGRDCMPL_EVT_STAT_LP_4K(n) (0xFF << (24 - (n)*8))
0444
0445
0446
0447
0448
0449 #define IFC_NAND_EVTER_EN_OPC_EN 0x80000000
0450
0451 #define IFC_NAND_EVTER_EN_PGRDCMPL_EN 0x20000000
0452
0453 #define IFC_NAND_EVTER_EN_FTOER_EN 0x08000000
0454
0455 #define IFC_NAND_EVTER_EN_WPER_EN 0x04000000
0456
0457 #define IFC_NAND_EVTER_EN_ECCER_EN 0x02000000
0458
0459
0460
0461
0462
0463 #define IFC_NAND_EVTER_INTR_OPCIR_EN 0x80000000
0464
0465 #define IFC_NAND_EVTER_INTR_PGRDCMPLIR_EN 0x20000000
0466
0467 #define IFC_NAND_EVTER_INTR_FTOERIR_EN 0x08000000
0468
0469 #define IFC_NAND_EVTER_INTR_WPERIR_EN 0x04000000
0470
0471 #define IFC_NAND_EVTER_INTR_ECCERIR_EN 0x02000000
0472
0473
0474
0475
0476 #define IFC_NAND_ERATTR0_MASK 0x0C080000
0477
0478 #define IFC_NAND_ERATTR0_ERCS_CS0 0x00000000
0479 #define IFC_NAND_ERATTR0_ERCS_CS1 0x04000000
0480 #define IFC_NAND_ERATTR0_ERCS_CS2 0x08000000
0481 #define IFC_NAND_ERATTR0_ERCS_CS3 0x0C000000
0482
0483 #define IFC_NAND_ERATTR0_ERTTYPE_READ 0x00080000
0484
0485
0486
0487
0488
0489 #define IFC_NAND_NFSR_RS0 0xFF000000
0490
0491 #define IFC_NAND_NFSR_RS1 0x00FF0000
0492
0493
0494
0495
0496
0497 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_MASK 0x0F000000
0498 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_SHIFT 24
0499 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_MASK 0x000F0000
0500 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_SHIFT 16
0501 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_MASK 0x00000F00
0502 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_SHIFT 8
0503 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_MASK 0x0000000F
0504 #define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_SHIFT 0
0505 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_MASK 0x0F000000
0506 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_SHIFT 24
0507 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_MASK 0x000F0000
0508 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_SHIFT 16
0509 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_MASK 0x00000F00
0510 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_SHIFT 8
0511 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_MASK 0x0000000F
0512 #define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_SHIFT 0
0513 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_MASK 0x0F000000
0514 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_SHIFT 24
0515 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_MASK 0x000F0000
0516 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_SHIFT 16
0517 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_MASK 0x00000F00
0518 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_SHIFT 8
0519 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_MASK 0x0000000F
0520 #define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_SHIFT 0
0521 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_MASK 0x0F000000
0522 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_SHIFT 24
0523 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_MASK 0x000F0000
0524 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_SHIFT 16
0525 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_MASK 0x00000F00
0526 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_SHIFT 8
0527 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_MASK 0x0000000F
0528 #define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_SHIFT 0
0529
0530
0531
0532
0533 #define IFC_NAND_NCR_FTOCNT_MASK 0x1E000000
0534 #define IFC_NAND_NCR_FTOCNT_SHIFT 25
0535 #define IFC_NAND_NCR_FTOCNT(n) ((_ilog2(n) - 8) << IFC_NAND_NCR_FTOCNT_SHIFT)
0536
0537
0538
0539
0540
0541 #define IFC_NAND_AUTOBOOT_TRGR_RCW_LD 0x80000000
0542
0543 #define IFC_NAND_AUTOBOOT_TRGR_BOOT_LD 0x20000000
0544
0545
0546
0547
0548
0549 #define IFC_NAND_MDR_RDATA0 0xFF000000
0550
0551 #define IFC_NAND_MDR_RDATA1 0x00FF0000
0552
0553
0554
0555
0556
0557
0558
0559
0560 #define IFC_NOR_EVTER_STAT_OPC_NOR 0x80000000
0561
0562 #define IFC_NOR_EVTER_STAT_WPER 0x04000000
0563
0564 #define IFC_NOR_EVTER_STAT_STOER 0x01000000
0565
0566
0567
0568
0569
0570 #define IFC_NOR_EVTER_EN_OPCEN_NOR 0x80000000
0571
0572 #define IFC_NOR_EVTER_EN_WPEREN 0x04000000
0573
0574 #define IFC_NOR_EVTER_EN_STOEREN 0x01000000
0575
0576
0577
0578
0579
0580 #define IFC_NOR_EVTER_INTR_OPCEN_NOR 0x80000000
0581
0582 #define IFC_NOR_EVTER_INTR_WPEREN 0x04000000
0583
0584 #define IFC_NOR_EVTER_INTR_STOEREN 0x01000000
0585
0586
0587
0588
0589
0590 #define IFC_NOR_ERATTR0_ERSRCID 0xFF000000
0591
0592 #define IFC_NOR_ERATTR0_ERAID 0x000FF000
0593
0594 #define IFC_NOR_ERATTR0_ERCS_CS0 0x00000000
0595 #define IFC_NOR_ERATTR0_ERCS_CS1 0x00000010
0596 #define IFC_NOR_ERATTR0_ERCS_CS2 0x00000020
0597 #define IFC_NOR_ERATTR0_ERCS_CS3 0x00000030
0598
0599 #define IFC_NOR_ERATTR0_ERTYPE_READ 0x00000001
0600
0601
0602
0603
0604 #define IFC_NOR_ERATTR2_ER_NUM_PHASE_EXP 0x000F0000
0605 #define IFC_NOR_ERATTR2_ER_NUM_PHASE_PER 0x00000F00
0606
0607
0608
0609
0610 #define IFC_NORCR_MASK 0x0F0F0000
0611
0612 #define IFC_NORCR_NUM_PHASE_MASK 0x0F000000
0613 #define IFC_NORCR_NUM_PHASE_SHIFT 24
0614 #define IFC_NORCR_NUM_PHASE(n) ((n-1) << IFC_NORCR_NUM_PHASE_SHIFT)
0615
0616 #define IFC_NORCR_STOCNT_MASK 0x000F0000
0617 #define IFC_NORCR_STOCNT_SHIFT 16
0618 #define IFC_NORCR_STOCNT(n) ((__ilog2(n) - 8) << IFC_NORCR_STOCNT_SHIFT)
0619
0620
0621
0622
0623
0624
0625
0626
0627 #define IFC_GPCM_EVTER_STAT_TOER 0x04000000
0628
0629 #define IFC_GPCM_EVTER_STAT_PER 0x01000000
0630
0631
0632
0633
0634
0635 #define IFC_GPCM_EVTER_EN_TOER_EN 0x04000000
0636
0637 #define IFC_GPCM_EVTER_EN_PER_EN 0x01000000
0638
0639
0640
0641
0642
0643 #define IFC_GPCM_EEIER_TOERIR_EN 0x04000000
0644
0645 #define IFC_GPCM_EEIER_PERIR_EN 0x01000000
0646
0647
0648
0649
0650
0651 #define IFC_GPCM_ERATTR0_ERSRCID 0xFF000000
0652
0653 #define IFC_GPCM_ERATTR0_ERAID 0x000FF000
0654
0655 #define IFC_GPCM_ERATTR0_ERCS_CS0 0x00000000
0656 #define IFC_GPCM_ERATTR0_ERCS_CS1 0x00000040
0657 #define IFC_GPCM_ERATTR0_ERCS_CS2 0x00000080
0658 #define IFC_GPCM_ERATTR0_ERCS_CS3 0x000000C0
0659
0660 #define IFC_GPCM_ERATTR0_ERTYPE_READ 0x00000001
0661
0662
0663
0664
0665
0666 #define IFC_GPCM_ERATTR2_PERR_BEAT 0x00000C00
0667
0668 #define IFC_GPCM_ERATTR2_PERR_BYTE 0x000000F0
0669
0670 #define IFC_GPCM_ERATTR2_PERR_DATA_PHASE 0x00000001
0671
0672
0673
0674
0675 #define IFC_GPCM_STAT_BSY 0x80000000
0676
0677
0678
0679
0680 struct fsl_ifc_nand {
0681 __be32 ncfgr;
0682 u32 res1[0x4];
0683 __be32 nand_fcr0;
0684 __be32 nand_fcr1;
0685 u32 res2[0x8];
0686 __be32 row0;
0687 u32 res3;
0688 __be32 col0;
0689 u32 res4;
0690 __be32 row1;
0691 u32 res5;
0692 __be32 col1;
0693 u32 res6;
0694 __be32 row2;
0695 u32 res7;
0696 __be32 col2;
0697 u32 res8;
0698 __be32 row3;
0699 u32 res9;
0700 __be32 col3;
0701 u32 res10[0x24];
0702 __be32 nand_fbcr;
0703 u32 res11;
0704 __be32 nand_fir0;
0705 __be32 nand_fir1;
0706 __be32 nand_fir2;
0707 u32 res12[0x10];
0708 __be32 nand_csel;
0709 u32 res13;
0710 __be32 nandseq_strt;
0711 u32 res14;
0712 __be32 nand_evter_stat;
0713 u32 res15;
0714 __be32 pgrdcmpl_evt_stat;
0715 u32 res16[0x2];
0716 __be32 nand_evter_en;
0717 u32 res17[0x2];
0718 __be32 nand_evter_intr_en;
0719 __be32 nand_vol_addr_stat;
0720 u32 res18;
0721 __be32 nand_erattr0;
0722 __be32 nand_erattr1;
0723 u32 res19[0x10];
0724 __be32 nand_fsr;
0725 u32 res20;
0726 __be32 nand_eccstat[8];
0727 u32 res21[0x1c];
0728 __be32 nanndcr;
0729 u32 res22[0x2];
0730 __be32 nand_autoboot_trgr;
0731 u32 res23;
0732 __be32 nand_mdr;
0733 u32 res24[0x1C];
0734 __be32 nand_dll_lowcfg0;
0735 __be32 nand_dll_lowcfg1;
0736 u32 res25;
0737 __be32 nand_dll_lowstat;
0738 u32 res26[0x3c];
0739 };
0740
0741
0742
0743
0744 struct fsl_ifc_nor {
0745 __be32 nor_evter_stat;
0746 u32 res1[0x2];
0747 __be32 nor_evter_en;
0748 u32 res2[0x2];
0749 __be32 nor_evter_intr_en;
0750 u32 res3[0x2];
0751 __be32 nor_erattr0;
0752 __be32 nor_erattr1;
0753 __be32 nor_erattr2;
0754 u32 res4[0x4];
0755 __be32 norcr;
0756 u32 res5[0xEF];
0757 };
0758
0759
0760
0761
0762 struct fsl_ifc_gpcm {
0763 __be32 gpcm_evter_stat;
0764 u32 res1[0x2];
0765 __be32 gpcm_evter_en;
0766 u32 res2[0x2];
0767 __be32 gpcm_evter_intr_en;
0768 u32 res3[0x2];
0769 __be32 gpcm_erattr0;
0770 __be32 gpcm_erattr1;
0771 __be32 gpcm_erattr2;
0772 __be32 gpcm_stat;
0773 };
0774
0775
0776
0777
0778 struct fsl_ifc_global {
0779 __be32 ifc_rev;
0780 u32 res1[0x2];
0781 struct {
0782 __be32 cspr_ext;
0783 __be32 cspr;
0784 u32 res2;
0785 } cspr_cs[FSL_IFC_BANK_COUNT];
0786 u32 res3[0xd];
0787 struct {
0788 __be32 amask;
0789 u32 res4[0x2];
0790 } amask_cs[FSL_IFC_BANK_COUNT];
0791 u32 res5[0xc];
0792 struct {
0793 __be32 csor;
0794 __be32 csor_ext;
0795 u32 res6;
0796 } csor_cs[FSL_IFC_BANK_COUNT];
0797 u32 res7[0xc];
0798 struct {
0799 __be32 ftim[4];
0800 u32 res8[0x8];
0801 } ftim_cs[FSL_IFC_BANK_COUNT];
0802 u32 res9[0x30];
0803 __be32 rb_stat;
0804 __be32 rb_map;
0805 __be32 wb_map;
0806 __be32 ifc_gcr;
0807 u32 res10[0x2];
0808 __be32 cm_evter_stat;
0809 u32 res11[0x2];
0810 __be32 cm_evter_en;
0811 u32 res12[0x2];
0812 __be32 cm_evter_intr_en;
0813 u32 res13[0x2];
0814 __be32 cm_erattr0;
0815 __be32 cm_erattr1;
0816 u32 res14[0x2];
0817 __be32 ifc_ccr;
0818 __be32 ifc_csr;
0819 __be32 ddr_ccr_low;
0820 };
0821
0822
0823 struct fsl_ifc_runtime {
0824 struct fsl_ifc_nand ifc_nand;
0825 struct fsl_ifc_nor ifc_nor;
0826 struct fsl_ifc_gpcm ifc_gpcm;
0827 };
0828
0829 extern unsigned int convert_ifc_address(phys_addr_t addr_base);
0830 extern int fsl_ifc_find(phys_addr_t addr_base);
0831
0832
0833
0834 struct fsl_ifc_ctrl {
0835
0836 struct device *dev;
0837 struct fsl_ifc_global __iomem *gregs;
0838 struct fsl_ifc_runtime __iomem *rregs;
0839 int irq;
0840 int nand_irq;
0841 spinlock_t lock;
0842 void *nand;
0843 int version;
0844 int banks;
0845
0846 u32 nand_stat;
0847 wait_queue_head_t nand_wait;
0848 bool little_endian;
0849 };
0850
0851 extern struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
0852
0853 static inline u32 ifc_in32(void __iomem *addr)
0854 {
0855 u32 val;
0856
0857 if (fsl_ifc_ctrl_dev->little_endian)
0858 val = ioread32(addr);
0859 else
0860 val = ioread32be(addr);
0861
0862 return val;
0863 }
0864
0865 static inline u16 ifc_in16(void __iomem *addr)
0866 {
0867 u16 val;
0868
0869 if (fsl_ifc_ctrl_dev->little_endian)
0870 val = ioread16(addr);
0871 else
0872 val = ioread16be(addr);
0873
0874 return val;
0875 }
0876
0877 static inline u8 ifc_in8(void __iomem *addr)
0878 {
0879 return ioread8(addr);
0880 }
0881
0882 static inline void ifc_out32(u32 val, void __iomem *addr)
0883 {
0884 if (fsl_ifc_ctrl_dev->little_endian)
0885 iowrite32(val, addr);
0886 else
0887 iowrite32be(val, addr);
0888 }
0889
0890 static inline void ifc_out16(u16 val, void __iomem *addr)
0891 {
0892 if (fsl_ifc_ctrl_dev->little_endian)
0893 iowrite16(val, addr);
0894 else
0895 iowrite16be(val, addr);
0896 }
0897
0898 static inline void ifc_out8(u8 val, void __iomem *addr)
0899 {
0900 iowrite8(val, addr);
0901 }
0902
0903 #endif