16aff0509Spekon gupta /* 26aff0509Spekon gupta * (C) Copyright 2004-2008 Texas Instruments, <www.ti.com> 36aff0509Spekon gupta * Rohit Choraria <rohitkc@ti.com> 46aff0509Spekon gupta * 509c2b8f3SAndreas Bießmann * (C) Copyright 2013 Andreas Bießmann <andreas@biessmann.org> 66aff0509Spekon gupta * 76aff0509Spekon gupta * SPDX-License-Identifier: GPL-2.0+ 86aff0509Spekon gupta */ 96aff0509Spekon gupta #ifndef __ASM_OMAP_GPMC_H 106aff0509Spekon gupta #define __ASM_OMAP_GPMC_H 116aff0509Spekon gupta 126aff0509Spekon gupta #define GPMC_BUF_EMPTY 0 136aff0509Spekon gupta #define GPMC_BUF_FULL 1 148d13a730Spekon gupta #define GPMC_MAX_SECTORS 8 156aff0509Spekon gupta 166aff0509Spekon gupta enum omap_ecc { 176aff0509Spekon gupta /* 1-bit ECC calculation by Software, Error detection by Software */ 186aff0509Spekon gupta OMAP_ECC_HAM1_CODE_SW = 1, /* avoid un-initialized int can be 0x0 */ 196aff0509Spekon gupta /* 1-bit ECC calculation by GPMC, Error detection by Software */ 206aff0509Spekon gupta /* ECC layout compatible to legacy ROMCODE. */ 216aff0509Spekon gupta OMAP_ECC_HAM1_CODE_HW, 226aff0509Spekon gupta /* 4-bit ECC calculation by GPMC, Error detection by Software */ 236aff0509Spekon gupta OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, 246aff0509Spekon gupta /* 4-bit ECC calculation by GPMC, Error detection by ELM */ 256aff0509Spekon gupta OMAP_ECC_BCH4_CODE_HW, 266aff0509Spekon gupta /* 8-bit ECC calculation by GPMC, Error detection by Software */ 276aff0509Spekon gupta OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, 286aff0509Spekon gupta /* 8-bit ECC calculation by GPMC, Error detection by ELM */ 296aff0509Spekon gupta OMAP_ECC_BCH8_CODE_HW, 3046840f66Spekon gupta /* 16-bit ECC calculation by GPMC, Error detection by ELM */ 3146840f66Spekon gupta OMAP_ECC_BCH16_CODE_HW, 326aff0509Spekon gupta }; 336aff0509Spekon gupta 346aff0509Spekon gupta struct gpmc_cs { 356aff0509Spekon gupta u32 config1; /* 0x00 */ 366aff0509Spekon gupta u32 config2; /* 0x04 */ 376aff0509Spekon gupta u32 config3; /* 0x08 */ 386aff0509Spekon gupta u32 config4; /* 0x0C */ 396aff0509Spekon gupta u32 config5; /* 0x10 */ 406aff0509Spekon gupta u32 config6; /* 0x14 */ 416aff0509Spekon gupta u32 config7; /* 0x18 */ 426aff0509Spekon gupta u32 nand_cmd; /* 0x1C */ 436aff0509Spekon gupta u32 nand_adr; /* 0x20 */ 446aff0509Spekon gupta u32 nand_dat; /* 0x24 */ 456aff0509Spekon gupta u8 res[8]; /* blow up to 0x30 byte */ 466aff0509Spekon gupta }; 476aff0509Spekon gupta 486aff0509Spekon gupta struct bch_res_0_3 { 496aff0509Spekon gupta u32 bch_result_x[4]; 506aff0509Spekon gupta }; 516aff0509Spekon gupta 5246840f66Spekon gupta struct bch_res_4_6 { 5346840f66Spekon gupta u32 bch_result_x[3]; 5446840f66Spekon gupta }; 5546840f66Spekon gupta 566aff0509Spekon gupta struct gpmc { 576aff0509Spekon gupta u8 res1[0x10]; 586aff0509Spekon gupta u32 sysconfig; /* 0x10 */ 596aff0509Spekon gupta u8 res2[0x4]; 606aff0509Spekon gupta u32 irqstatus; /* 0x18 */ 616aff0509Spekon gupta u32 irqenable; /* 0x1C */ 626aff0509Spekon gupta u8 res3[0x20]; 636aff0509Spekon gupta u32 timeout_control; /* 0x40 */ 646aff0509Spekon gupta u8 res4[0xC]; 656aff0509Spekon gupta u32 config; /* 0x50 */ 666aff0509Spekon gupta u32 status; /* 0x54 */ 676aff0509Spekon gupta u8 res5[0x8]; /* 0x58 */ 686aff0509Spekon gupta struct gpmc_cs cs[8]; /* 0x60, 0x90, .. */ 69c316f577SDaniel Mack u32 prefetch_config1; /* 0x1E0 */ 70c316f577SDaniel Mack u32 prefetch_config2; /* 0x1E4 */ 71c316f577SDaniel Mack u32 res6; /* 0x1E8 */ 72c316f577SDaniel Mack u32 prefetch_control; /* 0x1EC */ 73c316f577SDaniel Mack u32 prefetch_status; /* 0x1F0 */ 746aff0509Spekon gupta u32 ecc_config; /* 0x1F4 */ 756aff0509Spekon gupta u32 ecc_control; /* 0x1F8 */ 766aff0509Spekon gupta u32 ecc_size_config; /* 0x1FC */ 776aff0509Spekon gupta u32 ecc1_result; /* 0x200 */ 786aff0509Spekon gupta u32 ecc2_result; /* 0x204 */ 796aff0509Spekon gupta u32 ecc3_result; /* 0x208 */ 806aff0509Spekon gupta u32 ecc4_result; /* 0x20C */ 816aff0509Spekon gupta u32 ecc5_result; /* 0x210 */ 826aff0509Spekon gupta u32 ecc6_result; /* 0x214 */ 836aff0509Spekon gupta u32 ecc7_result; /* 0x218 */ 846aff0509Spekon gupta u32 ecc8_result; /* 0x21C */ 856aff0509Spekon gupta u32 ecc9_result; /* 0x220 */ 866aff0509Spekon gupta u8 res7[12]; /* 0x224 */ 876aff0509Spekon gupta u32 testmomde_ctrl; /* 0x230 */ 886aff0509Spekon gupta u8 res8[12]; /* 0x234 */ 898d13a730Spekon gupta struct bch_res_0_3 bch_result_0_3[GPMC_MAX_SECTORS]; /* 0x240,0x250, */ 9046840f66Spekon gupta u8 res9[16 * 4]; /* 0x2C0 - 0x2FF */ 9146840f66Spekon gupta struct bch_res_4_6 bch_result_4_6[GPMC_MAX_SECTORS]; /* 0x300,0x310, */ 926aff0509Spekon gupta }; 936aff0509Spekon gupta 946aff0509Spekon gupta /* Used for board specific gpmc initialization */ 950568dd06SLadislav Michl extern const struct gpmc *gpmc_cfg; 96*22d6ac49SLadislav Michl extern char gpmc_cs0_flash; 976aff0509Spekon gupta 986aff0509Spekon gupta #endif /* __ASM_OMAP_GPMC_H */ 99