blob: 7a15778631952c5e65933a28e4307ee182caa8e3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Vasutc140e982011-11-08 23:18:08 +00002/*
3 * Freescale i.MX28 GPMI Register Definitions
4 *
5 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
6 * on behalf of DENX Software Engineering GmbH
7 *
8 * Based on code from LTIB:
9 * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
Marek Vasutc140e982011-11-08 23:18:08 +000010 */
11
12#ifndef __MX28_REGS_GPMI_H__
13#define __MX28_REGS_GPMI_H__
14
Stefano Babic33731bc2017-06-29 10:16:06 +020015#include <asm/mach-imx/regs-common.h>
Marek Vasutc140e982011-11-08 23:18:08 +000016
17#ifndef __ASSEMBLY__
Otavio Salvador22f4ff92012-08-05 09:05:31 +000018struct mxs_gpmi_regs {
Otavio Salvador5309b002012-08-05 09:05:30 +000019 mxs_reg_32(hw_gpmi_ctrl0)
20 mxs_reg_32(hw_gpmi_compare)
21 mxs_reg_32(hw_gpmi_eccctrl)
22 mxs_reg_32(hw_gpmi_ecccount)
23 mxs_reg_32(hw_gpmi_payload)
24 mxs_reg_32(hw_gpmi_auxiliary)
25 mxs_reg_32(hw_gpmi_ctrl1)
26 mxs_reg_32(hw_gpmi_timing0)
27 mxs_reg_32(hw_gpmi_timing1)
Marek Vasutc140e982011-11-08 23:18:08 +000028
29 uint32_t reserved[4];
30
Otavio Salvador5309b002012-08-05 09:05:30 +000031 mxs_reg_32(hw_gpmi_data)
32 mxs_reg_32(hw_gpmi_stat)
33 mxs_reg_32(hw_gpmi_debug)
34 mxs_reg_32(hw_gpmi_version)
Marek Vasutc140e982011-11-08 23:18:08 +000035};
36#endif
37
38#define GPMI_CTRL0_SFTRST (1 << 31)
39#define GPMI_CTRL0_CLKGATE (1 << 30)
40#define GPMI_CTRL0_RUN (1 << 29)
41#define GPMI_CTRL0_DEV_IRQ_EN (1 << 28)
42#define GPMI_CTRL0_LOCK_CS (1 << 27)
43#define GPMI_CTRL0_UDMA (1 << 26)
44#define GPMI_CTRL0_COMMAND_MODE_MASK (0x3 << 24)
45#define GPMI_CTRL0_COMMAND_MODE_OFFSET 24
46#define GPMI_CTRL0_COMMAND_MODE_WRITE (0x0 << 24)
47#define GPMI_CTRL0_COMMAND_MODE_READ (0x1 << 24)
48#define GPMI_CTRL0_COMMAND_MODE_READ_AND_COMPARE (0x2 << 24)
49#define GPMI_CTRL0_COMMAND_MODE_WAIT_FOR_READY (0x3 << 24)
50#define GPMI_CTRL0_WORD_LENGTH (1 << 23)
51#define GPMI_CTRL0_CS_MASK (0x7 << 20)
52#define GPMI_CTRL0_CS_OFFSET 20
53#define GPMI_CTRL0_ADDRESS_MASK (0x7 << 17)
54#define GPMI_CTRL0_ADDRESS_OFFSET 17
55#define GPMI_CTRL0_ADDRESS_NAND_DATA (0x0 << 17)
56#define GPMI_CTRL0_ADDRESS_NAND_CLE (0x1 << 17)
57#define GPMI_CTRL0_ADDRESS_NAND_ALE (0x2 << 17)
58#define GPMI_CTRL0_ADDRESS_INCREMENT (1 << 16)
59#define GPMI_CTRL0_XFER_COUNT_MASK 0xffff
60#define GPMI_CTRL0_XFER_COUNT_OFFSET 0
61
62#define GPMI_COMPARE_MASK_MASK (0xffff << 16)
63#define GPMI_COMPARE_MASK_OFFSET 16
64#define GPMI_COMPARE_REFERENCE_MASK 0xffff
65#define GPMI_COMPARE_REFERENCE_OFFSET 0
66
67#define GPMI_ECCCTRL_HANDLE_MASK (0xffff << 16)
68#define GPMI_ECCCTRL_HANDLE_OFFSET 16
69#define GPMI_ECCCTRL_ECC_CMD_MASK (0x3 << 13)
70#define GPMI_ECCCTRL_ECC_CMD_OFFSET 13
71#define GPMI_ECCCTRL_ECC_CMD_DECODE (0x0 << 13)
72#define GPMI_ECCCTRL_ECC_CMD_ENCODE (0x1 << 13)
Igor Opaniukdb6f1fa2019-11-03 16:49:42 +010073#define GPMI_ECCCTRL_RANDOMIZER_ENABLE (1 << 11)
74#define GPMI_ECCCTRL_RANDOMIZER_TYPE0 0
75#define GPMI_ECCCTRL_RANDOMIZER_TYPE1 (1 << 9)
76#define GPMI_ECCCTRL_RANDOMIZER_TYPE2 (2 << 9)
77
Marek Vasutc140e982011-11-08 23:18:08 +000078#define GPMI_ECCCTRL_ENABLE_ECC (1 << 12)
79#define GPMI_ECCCTRL_BUFFER_MASK_MASK 0x1ff
80#define GPMI_ECCCTRL_BUFFER_MASK_OFFSET 0
81#define GPMI_ECCCTRL_BUFFER_MASK_BCH_AUXONLY 0x100
82#define GPMI_ECCCTRL_BUFFER_MASK_BCH_PAGE 0x1ff
83
84#define GPMI_ECCCOUNT_COUNT_MASK 0xffff
85#define GPMI_ECCCOUNT_COUNT_OFFSET 0
86
87#define GPMI_PAYLOAD_ADDRESS_MASK (0x3fffffff << 2)
88#define GPMI_PAYLOAD_ADDRESS_OFFSET 2
89
90#define GPMI_AUXILIARY_ADDRESS_MASK (0x3fffffff << 2)
91#define GPMI_AUXILIARY_ADDRESS_OFFSET 2
92
93#define GPMI_CTRL1_DECOUPLE_CS (1 << 24)
94#define GPMI_CTRL1_WRN_DLY_SEL_MASK (0x3 << 22)
95#define GPMI_CTRL1_WRN_DLY_SEL_OFFSET 22
Michael Trimarchi67406622022-08-30 16:47:51 +020096#define GPMI_CTRL1_WRN_DLY_SEL_4_TO_8NS 0x0
97#define GPMI_CTRL1_WRN_DLY_SEL_6_TO_10NS 0x1
98#define GPMI_CTRL1_WRN_DLY_SEL_7_TO_12NS 0x2
99#define GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY 0x3
100
Marek Vasutc140e982011-11-08 23:18:08 +0000101#define GPMI_CTRL1_TIMEOUT_IRQ_EN (1 << 20)
102#define GPMI_CTRL1_GANGED_RDYBUSY (1 << 19)
103#define GPMI_CTRL1_BCH_MODE (1 << 18)
104#define GPMI_CTRL1_DLL_ENABLE (1 << 17)
105#define GPMI_CTRL1_HALF_PERIOD (1 << 16)
106#define GPMI_CTRL1_RDN_DELAY_MASK (0xf << 12)
107#define GPMI_CTRL1_RDN_DELAY_OFFSET 12
108#define GPMI_CTRL1_DMA2ECC_MODE (1 << 11)
109#define GPMI_CTRL1_DEV_IRQ (1 << 10)
110#define GPMI_CTRL1_TIMEOUT_IRQ (1 << 9)
111#define GPMI_CTRL1_BURST_EN (1 << 8)
112#define GPMI_CTRL1_ABORT_WAIT_REQUEST (1 << 7)
113#define GPMI_CTRL1_ABORT_WAIT_FOR_READY_CHANNEL_MASK (0x7 << 4)
114#define GPMI_CTRL1_ABORT_WAIT_FOR_READY_CHANNEL_OFFSET 4
115#define GPMI_CTRL1_DEV_RESET (1 << 3)
116#define GPMI_CTRL1_ATA_IRQRDY_POLARITY (1 << 2)
117#define GPMI_CTRL1_CAMERA_MODE (1 << 1)
118#define GPMI_CTRL1_GPMI_MODE (1 << 0)
Michael Trimarchi67406622022-08-30 16:47:51 +0200119#define GPMI_CTRL1_CLEAR_MASK (GPMI_CTRL1_WRN_DLY_SEL_MASK | \
120 GPMI_CTRL1_DLL_ENABLE | \
121 GPMI_CTRL1_RDN_DELAY_MASK | \
122 GPMI_CTRL1_HALF_PERIOD)
Marek Vasutc140e982011-11-08 23:18:08 +0000123
124#define GPMI_TIMING0_ADDRESS_SETUP_MASK (0xff << 16)
125#define GPMI_TIMING0_ADDRESS_SETUP_OFFSET 16
126#define GPMI_TIMING0_DATA_HOLD_MASK (0xff << 8)
127#define GPMI_TIMING0_DATA_HOLD_OFFSET 8
128#define GPMI_TIMING0_DATA_SETUP_MASK 0xff
129#define GPMI_TIMING0_DATA_SETUP_OFFSET 0
130
131#define GPMI_TIMING1_DEVICE_BUSY_TIMEOUT_MASK (0xffff << 16)
132#define GPMI_TIMING1_DEVICE_BUSY_TIMEOUT_OFFSET 16
133
134#define GPMI_TIMING2_UDMA_TRP_MASK (0xff << 24)
135#define GPMI_TIMING2_UDMA_TRP_OFFSET 24
136#define GPMI_TIMING2_UDMA_ENV_MASK (0xff << 16)
137#define GPMI_TIMING2_UDMA_ENV_OFFSET 16
138#define GPMI_TIMING2_UDMA_HOLD_MASK (0xff << 8)
139#define GPMI_TIMING2_UDMA_HOLD_OFFSET 8
140#define GPMI_TIMING2_UDMA_SETUP_MASK 0xff
141#define GPMI_TIMING2_UDMA_SETUP_OFFSET 0
142
143#define GPMI_DATA_DATA_MASK 0xffffffff
144#define GPMI_DATA_DATA_OFFSET 0
145
146#define GPMI_STAT_READY_BUSY_MASK (0xff << 24)
147#define GPMI_STAT_READY_BUSY_OFFSET 24
148#define GPMI_STAT_RDY_TIMEOUT_MASK (0xff << 16)
149#define GPMI_STAT_RDY_TIMEOUT_OFFSET 16
150#define GPMI_STAT_DEV7_ERROR (1 << 15)
151#define GPMI_STAT_DEV6_ERROR (1 << 14)
152#define GPMI_STAT_DEV5_ERROR (1 << 13)
153#define GPMI_STAT_DEV4_ERROR (1 << 12)
154#define GPMI_STAT_DEV3_ERROR (1 << 11)
155#define GPMI_STAT_DEV2_ERROR (1 << 10)
156#define GPMI_STAT_DEV1_ERROR (1 << 9)
157#define GPMI_STAT_DEV0_ERROR (1 << 8)
158#define GPMI_STAT_ATA_IRQ (1 << 4)
159#define GPMI_STAT_INVALID_BUFFER_MASK (1 << 3)
160#define GPMI_STAT_FIFO_EMPTY (1 << 2)
161#define GPMI_STAT_FIFO_FULL (1 << 1)
162#define GPMI_STAT_PRESENT (1 << 0)
163
164#define GPMI_DEBUG_WAIT_FOR_READY_END_MASK (0xff << 24)
165#define GPMI_DEBUG_WAIT_FOR_READY_END_OFFSET 24
166#define GPMI_DEBUG_DMA_SENSE_MASK (0xff << 16)
167#define GPMI_DEBUG_DMA_SENSE_OFFSET 16
168#define GPMI_DEBUG_DMAREQ_MASK (0xff << 8)
169#define GPMI_DEBUG_DMAREQ_OFFSET 8
170#define GPMI_DEBUG_CMD_END_MASK 0xff
171#define GPMI_DEBUG_CMD_END_OFFSET 0
172
173#define GPMI_VERSION_MAJOR_MASK (0xff << 24)
174#define GPMI_VERSION_MAJOR_OFFSET 24
175#define GPMI_VERSION_MINOR_MASK (0xff << 16)
176#define GPMI_VERSION_MINOR_OFFSET 16
177#define GPMI_VERSION_STEP_MASK 0xffff
178#define GPMI_VERSION_STEP_OFFSET 0
179
180#define GPMI_DEBUG2_UDMA_STATE_MASK (0xf << 24)
181#define GPMI_DEBUG2_UDMA_STATE_OFFSET 24
182#define GPMI_DEBUG2_BUSY (1 << 23)
183#define GPMI_DEBUG2_PIN_STATE_MASK (0x7 << 20)
184#define GPMI_DEBUG2_PIN_STATE_OFFSET 20
185#define GPMI_DEBUG2_PIN_STATE_PSM_IDLE (0x0 << 20)
186#define GPMI_DEBUG2_PIN_STATE_PSM_BYTCNT (0x1 << 20)
187#define GPMI_DEBUG2_PIN_STATE_PSM_ADDR (0x2 << 20)
188#define GPMI_DEBUG2_PIN_STATE_PSM_STALL (0x3 << 20)
189#define GPMI_DEBUG2_PIN_STATE_PSM_STROBE (0x4 << 20)
190#define GPMI_DEBUG2_PIN_STATE_PSM_ATARDY (0x5 << 20)
191#define GPMI_DEBUG2_PIN_STATE_PSM_DHOLD (0x6 << 20)
192#define GPMI_DEBUG2_PIN_STATE_PSM_DONE (0x7 << 20)
193#define GPMI_DEBUG2_MAIN_STATE_MASK (0xf << 16)
194#define GPMI_DEBUG2_MAIN_STATE_OFFSET 16
195#define GPMI_DEBUG2_MAIN_STATE_MSM_IDLE (0x0 << 16)
196#define GPMI_DEBUG2_MAIN_STATE_MSM_BYTCNT (0x1 << 16)
197#define GPMI_DEBUG2_MAIN_STATE_MSM_WAITFE (0x2 << 16)
198#define GPMI_DEBUG2_MAIN_STATE_MSM_WAITFR (0x3 << 16)
199#define GPMI_DEBUG2_MAIN_STATE_MSM_DMAREQ (0x4 << 16)
200#define GPMI_DEBUG2_MAIN_STATE_MSM_DMAACK (0x5 << 16)
201#define GPMI_DEBUG2_MAIN_STATE_MSM_WAITFF (0x6 << 16)
202#define GPMI_DEBUG2_MAIN_STATE_MSM_LDFIFO (0x7 << 16)
203#define GPMI_DEBUG2_MAIN_STATE_MSM_LDDMAR (0x8 << 16)
204#define GPMI_DEBUG2_MAIN_STATE_MSM_RDCMP (0x9 << 16)
205#define GPMI_DEBUG2_MAIN_STATE_MSM_DONE (0xa << 16)
206#define GPMI_DEBUG2_SYND2GPMI_BE_MASK (0xf << 12)
207#define GPMI_DEBUG2_SYND2GPMI_BE_OFFSET 12
208#define GPMI_DEBUG2_GPMI2SYND_VALID (1 << 11)
209#define GPMI_DEBUG2_GPMI2SYND_READY (1 << 10)
210#define GPMI_DEBUG2_SYND2GPMI_VALID (1 << 9)
211#define GPMI_DEBUG2_SYND2GPMI_READY (1 << 8)
212#define GPMI_DEBUG2_VIEW_DELAYED_RDN (1 << 7)
213#define GPMI_DEBUG2_UPDATE_WINDOW (1 << 6)
214#define GPMI_DEBUG2_RDN_TAP_MASK 0x3f
215#define GPMI_DEBUG2_RDN_TAP_OFFSET 0
216
217#define GPMI_DEBUG3_APB_WORD_CNTR_MASK (0xffff << 16)
218#define GPMI_DEBUG3_APB_WORD_CNTR_OFFSET 16
219#define GPMI_DEBUG3_DEV_WORD_CNTR_MASK 0xffff
220#define GPMI_DEBUG3_DEV_WORD_CNTR_OFFSET 0
221
222#endif /* __MX28_REGS_GPMI_H__ */