.. | .. |
---|
103 | 103 | u32 ctrl1n; |
---|
104 | 104 | }; |
---|
105 | 105 | |
---|
| 106 | +#define GPMI_MAX_TRANSFERS 8 |
---|
| 107 | + |
---|
| 108 | +struct gpmi_transfer { |
---|
| 109 | + u8 cmdbuf[8]; |
---|
| 110 | + struct scatterlist sgl; |
---|
| 111 | + enum dma_data_direction direction; |
---|
| 112 | +}; |
---|
| 113 | + |
---|
106 | 114 | struct gpmi_nand_data { |
---|
107 | 115 | /* Devdata */ |
---|
108 | 116 | const struct gpmi_devdata *devdata; |
---|
.. | .. |
---|
126 | 134 | struct boot_rom_geometry rom_geometry; |
---|
127 | 135 | |
---|
128 | 136 | /* MTD / NAND */ |
---|
| 137 | + struct nand_controller base; |
---|
129 | 138 | struct nand_chip nand; |
---|
130 | 139 | |
---|
131 | | - /* General-use Variables */ |
---|
132 | | - int current_chip; |
---|
133 | | - unsigned int command_length; |
---|
| 140 | + struct gpmi_transfer transfers[GPMI_MAX_TRANSFERS]; |
---|
| 141 | + int ntransfers; |
---|
134 | 142 | |
---|
135 | | - struct scatterlist cmd_sgl; |
---|
136 | | - char *cmd_buffer; |
---|
| 143 | + bool bch; |
---|
| 144 | + uint32_t bch_flashlayout0; |
---|
| 145 | + uint32_t bch_flashlayout1; |
---|
137 | 146 | |
---|
138 | | - struct scatterlist data_sgl; |
---|
139 | 147 | char *data_buffer_dma; |
---|
140 | | - |
---|
141 | | - void *page_buffer_virt; |
---|
142 | | - dma_addr_t page_buffer_phys; |
---|
143 | | - unsigned int page_buffer_size; |
---|
144 | | - |
---|
145 | | - void *payload_virt; |
---|
146 | | - dma_addr_t payload_phys; |
---|
147 | 148 | |
---|
148 | 149 | void *auxiliary_virt; |
---|
149 | 150 | dma_addr_t auxiliary_phys; |
---|
.. | .. |
---|
154 | 155 | #define DMA_CHANS 8 |
---|
155 | 156 | struct dma_chan *dma_chans[DMA_CHANS]; |
---|
156 | 157 | struct completion dma_done; |
---|
157 | | - |
---|
158 | | - /* private */ |
---|
159 | | - void *private; |
---|
160 | 158 | }; |
---|
161 | | - |
---|
162 | | -/* Common Services */ |
---|
163 | | -int common_nfc_set_geometry(struct gpmi_nand_data *); |
---|
164 | | -struct dma_chan *get_dma_chan(struct gpmi_nand_data *); |
---|
165 | | -bool prepare_data_dma(struct gpmi_nand_data *, const void *buf, int len, |
---|
166 | | - enum dma_data_direction dr); |
---|
167 | | -int start_dma_without_bch_irq(struct gpmi_nand_data *, |
---|
168 | | - struct dma_async_tx_descriptor *); |
---|
169 | | -int start_dma_with_bch_irq(struct gpmi_nand_data *, |
---|
170 | | - struct dma_async_tx_descriptor *); |
---|
171 | | - |
---|
172 | | -/* GPMI-NAND helper function library */ |
---|
173 | | -int gpmi_init(struct gpmi_nand_data *); |
---|
174 | | -void gpmi_clear_bch(struct gpmi_nand_data *); |
---|
175 | | -void gpmi_dump_info(struct gpmi_nand_data *); |
---|
176 | | -int bch_set_geometry(struct gpmi_nand_data *); |
---|
177 | | -int gpmi_is_ready(struct gpmi_nand_data *, unsigned chip); |
---|
178 | | -int gpmi_send_command(struct gpmi_nand_data *); |
---|
179 | | -int gpmi_enable_clk(struct gpmi_nand_data *this); |
---|
180 | | -int gpmi_disable_clk(struct gpmi_nand_data *this); |
---|
181 | | -int gpmi_setup_data_interface(struct mtd_info *mtd, int chipnr, |
---|
182 | | - const struct nand_data_interface *conf); |
---|
183 | | -void gpmi_nfc_apply_timings(struct gpmi_nand_data *this); |
---|
184 | | -int gpmi_read_data(struct gpmi_nand_data *, void *buf, int len); |
---|
185 | | -int gpmi_send_data(struct gpmi_nand_data *, const void *buf, int len); |
---|
186 | | - |
---|
187 | | -int gpmi_send_page(struct gpmi_nand_data *, |
---|
188 | | - dma_addr_t payload, dma_addr_t auxiliary); |
---|
189 | | -int gpmi_read_page(struct gpmi_nand_data *, |
---|
190 | | - dma_addr_t payload, dma_addr_t auxiliary); |
---|
191 | | - |
---|
192 | | -void gpmi_copy_bits(u8 *dst, size_t dst_bit_off, |
---|
193 | | - const u8 *src, size_t src_bit_off, |
---|
194 | | - size_t nbits); |
---|
195 | 159 | |
---|
196 | 160 | /* BCH : Status Block Completion Codes */ |
---|
197 | 161 | #define STATUS_GOOD 0x00 |
---|
.. | .. |
---|
207 | 171 | |
---|
208 | 172 | #define GPMI_IS_MX6(x) (GPMI_IS_MX6Q(x) || GPMI_IS_MX6SX(x) || \ |
---|
209 | 173 | GPMI_IS_MX7D(x)) |
---|
| 174 | +#define GPMI_IS_MXS(x) (GPMI_IS_MX23(x) || GPMI_IS_MX28(x)) |
---|
210 | 175 | #endif |
---|