xref: /rk3399_rockchip-uboot/include/linux/mtd/omap_gpmc.h (revision 6aff05098864233caf9d24cb020e67b00ada4e3e)
1*6aff0509Spekon gupta /*
2*6aff0509Spekon gupta  * (C) Copyright 2004-2008 Texas Instruments, <www.ti.com>
3*6aff0509Spekon gupta  * Rohit Choraria <rohitkc@ti.com>
4*6aff0509Spekon gupta  *
5*6aff0509Spekon gupta  * (C) Copyright 2013 Andreas Bießmann <andreas.devel@googlemail.com>
6*6aff0509Spekon gupta  *
7*6aff0509Spekon gupta  * SPDX-License-Identifier:	GPL-2.0+
8*6aff0509Spekon gupta  */
9*6aff0509Spekon gupta #ifndef __ASM_OMAP_GPMC_H
10*6aff0509Spekon gupta #define __ASM_OMAP_GPMC_H
11*6aff0509Spekon gupta 
12*6aff0509Spekon gupta #define GPMC_BUF_EMPTY	0
13*6aff0509Spekon gupta #define GPMC_BUF_FULL	1
14*6aff0509Spekon gupta 
15*6aff0509Spekon gupta enum omap_ecc {
16*6aff0509Spekon gupta 	/* 1-bit  ECC calculation by Software, Error detection by Software */
17*6aff0509Spekon gupta 	OMAP_ECC_HAM1_CODE_SW = 1, /* avoid un-initialized int can be 0x0 */
18*6aff0509Spekon gupta 	/* 1-bit  ECC calculation by GPMC, Error detection by Software */
19*6aff0509Spekon gupta 	/* ECC layout compatible to legacy ROMCODE. */
20*6aff0509Spekon gupta 	OMAP_ECC_HAM1_CODE_HW,
21*6aff0509Spekon gupta 	/* 4-bit  ECC calculation by GPMC, Error detection by Software */
22*6aff0509Spekon gupta 	OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
23*6aff0509Spekon gupta 	/* 4-bit  ECC calculation by GPMC, Error detection by ELM */
24*6aff0509Spekon gupta 	OMAP_ECC_BCH4_CODE_HW,
25*6aff0509Spekon gupta 	/* 8-bit  ECC calculation by GPMC, Error detection by Software */
26*6aff0509Spekon gupta 	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
27*6aff0509Spekon gupta 	/* 8-bit  ECC calculation by GPMC, Error detection by ELM */
28*6aff0509Spekon gupta 	OMAP_ECC_BCH8_CODE_HW,
29*6aff0509Spekon gupta };
30*6aff0509Spekon gupta 
31*6aff0509Spekon gupta struct gpmc_cs {
32*6aff0509Spekon gupta 	u32 config1;		/* 0x00 */
33*6aff0509Spekon gupta 	u32 config2;		/* 0x04 */
34*6aff0509Spekon gupta 	u32 config3;		/* 0x08 */
35*6aff0509Spekon gupta 	u32 config4;		/* 0x0C */
36*6aff0509Spekon gupta 	u32 config5;		/* 0x10 */
37*6aff0509Spekon gupta 	u32 config6;		/* 0x14 */
38*6aff0509Spekon gupta 	u32 config7;		/* 0x18 */
39*6aff0509Spekon gupta 	u32 nand_cmd;		/* 0x1C */
40*6aff0509Spekon gupta 	u32 nand_adr;		/* 0x20 */
41*6aff0509Spekon gupta 	u32 nand_dat;		/* 0x24 */
42*6aff0509Spekon gupta 	u8 res[8];		/* blow up to 0x30 byte */
43*6aff0509Spekon gupta };
44*6aff0509Spekon gupta 
45*6aff0509Spekon gupta struct bch_res_0_3 {
46*6aff0509Spekon gupta 	u32 bch_result_x[4];
47*6aff0509Spekon gupta };
48*6aff0509Spekon gupta 
49*6aff0509Spekon gupta struct gpmc {
50*6aff0509Spekon gupta 	u8 res1[0x10];
51*6aff0509Spekon gupta 	u32 sysconfig;		/* 0x10 */
52*6aff0509Spekon gupta 	u8 res2[0x4];
53*6aff0509Spekon gupta 	u32 irqstatus;		/* 0x18 */
54*6aff0509Spekon gupta 	u32 irqenable;		/* 0x1C */
55*6aff0509Spekon gupta 	u8 res3[0x20];
56*6aff0509Spekon gupta 	u32 timeout_control;	/* 0x40 */
57*6aff0509Spekon gupta 	u8 res4[0xC];
58*6aff0509Spekon gupta 	u32 config;		/* 0x50 */
59*6aff0509Spekon gupta 	u32 status;		/* 0x54 */
60*6aff0509Spekon gupta 	u8 res5[0x8];		/* 0x58 */
61*6aff0509Spekon gupta 	struct gpmc_cs cs[8];	/* 0x60, 0x90, .. */
62*6aff0509Spekon gupta 	u8 res6[0x14];		/* 0x1E0 */
63*6aff0509Spekon gupta 	u32 ecc_config;		/* 0x1F4 */
64*6aff0509Spekon gupta 	u32 ecc_control;	/* 0x1F8 */
65*6aff0509Spekon gupta 	u32 ecc_size_config;	/* 0x1FC */
66*6aff0509Spekon gupta 	u32 ecc1_result;	/* 0x200 */
67*6aff0509Spekon gupta 	u32 ecc2_result;	/* 0x204 */
68*6aff0509Spekon gupta 	u32 ecc3_result;	/* 0x208 */
69*6aff0509Spekon gupta 	u32 ecc4_result;	/* 0x20C */
70*6aff0509Spekon gupta 	u32 ecc5_result;	/* 0x210 */
71*6aff0509Spekon gupta 	u32 ecc6_result;	/* 0x214 */
72*6aff0509Spekon gupta 	u32 ecc7_result;	/* 0x218 */
73*6aff0509Spekon gupta 	u32 ecc8_result;	/* 0x21C */
74*6aff0509Spekon gupta 	u32 ecc9_result;	/* 0x220 */
75*6aff0509Spekon gupta 	u8 res7[12];		/* 0x224 */
76*6aff0509Spekon gupta 	u32 testmomde_ctrl;	/* 0x230 */
77*6aff0509Spekon gupta 	u8 res8[12];		/* 0x234 */
78*6aff0509Spekon gupta 	struct bch_res_0_3 bch_result_0_3[2];	/* 0x240 */
79*6aff0509Spekon gupta };
80*6aff0509Spekon gupta 
81*6aff0509Spekon gupta /* Used for board specific gpmc initialization */
82*6aff0509Spekon gupta extern struct gpmc *gpmc_cfg;
83*6aff0509Spekon gupta 
84*6aff0509Spekon gupta #endif /* __ASM_OMAP_GPMC_H */
85