blob: 2dbf988863f9560226101f3f53a18429073850e8 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Andreas Bießmann9a48c5c2013-04-02 06:05:54 +00002/*
3 * (C) Copyright 2004-2008 Texas Instruments, <www.ti.com>
4 * Rohit Choraria <rohitkc@ti.com>
5 *
Andreas Bießmann07dafdb2016-05-01 03:46:16 +02006 * (C) Copyright 2013 Andreas Bießmann <andreas@biessmann.org>
Andreas Bießmann9a48c5c2013-04-02 06:05:54 +00007 */
8#ifndef __ASM_OMAP_GPMC_H
9#define __ASM_OMAP_GPMC_H
10
Tom Rinidec7ea02024-05-20 13:35:03 -060011#include <linux/types.h>
12
Roger Quadros7dc75b62022-10-20 16:30:49 +030013/* Maximum Number of Chip Selects */
14#define GPMC_CS_NUM 8
15
Andreas Bießmann9a48c5c2013-04-02 06:05:54 +000016#define GPMC_BUF_EMPTY 0
17#define GPMC_BUF_FULL 1
pekon gupta20fa8e32014-06-02 17:14:41 +053018#define GPMC_MAX_SECTORS 8
Andreas Bießmann9a48c5c2013-04-02 06:05:54 +000019
pekon gupta6bd91a82013-11-18 19:03:00 +053020enum omap_ecc {
21 /* 1-bit ECC calculation by Software, Error detection by Software */
22 OMAP_ECC_HAM1_CODE_SW = 1, /* avoid un-initialized int can be 0x0 */
23 /* 1-bit ECC calculation by GPMC, Error detection by Software */
24 /* ECC layout compatible to legacy ROMCODE. */
25 OMAP_ECC_HAM1_CODE_HW,
26 /* 4-bit ECC calculation by GPMC, Error detection by Software */
27 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
28 /* 4-bit ECC calculation by GPMC, Error detection by ELM */
29 OMAP_ECC_BCH4_CODE_HW,
30 /* 8-bit ECC calculation by GPMC, Error detection by Software */
31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */
33 OMAP_ECC_BCH8_CODE_HW,
pekon gupta046cf862014-06-02 17:14:42 +053034 /* 16-bit ECC calculation by GPMC, Error detection by ELM */
35 OMAP_ECC_BCH16_CODE_HW,
pekon gupta6bd91a82013-11-18 19:03:00 +053036};
37
pekon guptac77f2842013-11-22 16:53:28 +053038struct gpmc_cs {
39 u32 config1; /* 0x00 */
40 u32 config2; /* 0x04 */
41 u32 config3; /* 0x08 */
42 u32 config4; /* 0x0C */
43 u32 config5; /* 0x10 */
44 u32 config6; /* 0x14 */
45 u32 config7; /* 0x18 */
46 u32 nand_cmd; /* 0x1C */
47 u32 nand_adr; /* 0x20 */
48 u32 nand_dat; /* 0x24 */
49 u8 res[8]; /* blow up to 0x30 byte */
50};
51
52struct bch_res_0_3 {
53 u32 bch_result_x[4];
54};
55
pekon gupta046cf862014-06-02 17:14:42 +053056struct bch_res_4_6 {
57 u32 bch_result_x[3];
58};
59
pekon guptac77f2842013-11-22 16:53:28 +053060struct gpmc {
61 u8 res1[0x10];
62 u32 sysconfig; /* 0x10 */
63 u8 res2[0x4];
64 u32 irqstatus; /* 0x18 */
65 u32 irqenable; /* 0x1C */
66 u8 res3[0x20];
67 u32 timeout_control; /* 0x40 */
68 u8 res4[0xC];
69 u32 config; /* 0x50 */
70 u32 status; /* 0x54 */
71 u8 res5[0x8]; /* 0x58 */
72 struct gpmc_cs cs[8]; /* 0x60, 0x90, .. */
Daniel Mackd90e2362014-06-25 14:43:32 +020073 u32 prefetch_config1; /* 0x1E0 */
74 u32 prefetch_config2; /* 0x1E4 */
75 u32 res6; /* 0x1E8 */
76 u32 prefetch_control; /* 0x1EC */
77 u32 prefetch_status; /* 0x1F0 */
pekon guptac77f2842013-11-22 16:53:28 +053078 u32 ecc_config; /* 0x1F4 */
79 u32 ecc_control; /* 0x1F8 */
80 u32 ecc_size_config; /* 0x1FC */
81 u32 ecc1_result; /* 0x200 */
82 u32 ecc2_result; /* 0x204 */
83 u32 ecc3_result; /* 0x208 */
84 u32 ecc4_result; /* 0x20C */
85 u32 ecc5_result; /* 0x210 */
86 u32 ecc6_result; /* 0x214 */
87 u32 ecc7_result; /* 0x218 */
88 u32 ecc8_result; /* 0x21C */
89 u32 ecc9_result; /* 0x220 */
90 u8 res7[12]; /* 0x224 */
91 u32 testmomde_ctrl; /* 0x230 */
92 u8 res8[12]; /* 0x234 */
pekon gupta20fa8e32014-06-02 17:14:41 +053093 struct bch_res_0_3 bch_result_0_3[GPMC_MAX_SECTORS]; /* 0x240,0x250, */
pekon gupta046cf862014-06-02 17:14:42 +053094 u8 res9[16 * 4]; /* 0x2C0 - 0x2FF */
95 struct bch_res_4_6 bch_result_4_6[GPMC_MAX_SECTORS]; /* 0x300,0x310, */
pekon guptac77f2842013-11-22 16:53:28 +053096};
97
98/* Used for board specific gpmc initialization */
Ladislav Michld5b1c272016-07-12 20:28:16 +020099extern const struct gpmc *gpmc_cfg;
Ladislav Michl446e94a2016-07-12 20:28:17 +0200100extern char gpmc_cs0_flash;
pekon guptac77f2842013-11-22 16:53:28 +0530101
Andreas Bießmann9a48c5c2013-04-02 06:05:54 +0000102#endif /* __ASM_OMAP_GPMC_H */