Lines Matching refs:this

18  * with this program; if not, write to the Free Software Foundation, Inc.,
79 * You will see a DMA timeout in this case. The bug has been fixed
82 * To avoid this bug, just add a new parameter `just_enable` for
127 static int __gpmi_enable_clk(struct gpmi_nand_data *this, bool v)
134 clk = this->resources.clock[i];
150 clk_disable_unprepare(this->resources.clock[i - 1]);
157 int gpmi_init(struct gpmi_nand_data *this)
159 struct resources *r = &this->resources;
162 ret = gpmi_enable_clk(this);
173 ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
197 gpmi_disable_clk(this);
204 void gpmi_dump_info(struct gpmi_nand_data *this)
206 struct resources *r = &this->resources;
207 struct bch_geometry *geo = &this->bch_geometry;
211 dev_err(this->dev, "Show GPMI registers :\n");
214 dev_err(this->dev, "offset 0x%.3x : 0x%.8x\n", i * 0x10, reg);
218 dev_err(this->dev, "Show BCH registers :\n");
221 dev_err(this->dev, "offset 0x%.3x : 0x%.8x\n", i * 0x10, reg);
223 dev_err(this->dev, "BCH Geometry :\n"
249 int bch_set_geometry(struct gpmi_nand_data *this)
251 struct resources *r = &this->resources;
252 struct bch_geometry *bch_geo = &this->bch_geometry;
261 if (common_nfc_set_geometry(this))
271 ret = gpmi_enable_clk(this);
276 * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
283 ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
290 | BF_BCH_FLASH0LAYOUT0_ECC0(ecc_strength, this)
291 | BF_BCH_FLASH0LAYOUT0_GF(gf_len, this)
292 | BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(block_size, this),
296 | BF_BCH_FLASH0LAYOUT1_ECCN(ecc_strength, this)
297 | BF_BCH_FLASH0LAYOUT1_GF(gf_len, this)
298 | BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(block_size, this),
308 gpmi_disable_clk(this);
327 static int gpmi_nfc_compute_hardware_timing(struct gpmi_nand_data *this,
331 struct resources *r = &this->resources;
332 struct nand_chip *nand = &this->nand;
333 struct nand_timing target = this->timing;
414 * Let's re-arrange this in a way that's more useful to us:
420 * The reference period is either the clock period or half that, so this
435 * reduce the cost of this conversion by using bit shifts instead of
521 * sample delay factor. We do this because the form of the
572 * time by a single clock cycle. We do this until either the eye is
593 * After some algebra, this simplifies to the code immediately below.
673 * delay factor. We do this because the form of the computation is the
858 static void gpmi_compute_edo_timing(struct gpmi_nand_data *this,
861 struct resources *r = &this->resources;
863 int mode = this->timing_mode;
864 int dll_threshold = this->devdata->max_chain_delay;
918 static int enable_edo_mode(struct gpmi_nand_data *this, int mode)
920 struct resources *r = &this->resources;
921 struct nand_chip *nand = &this->nand;
922 struct mtd_info *mtd = &this->mtd;
954 this->flags &= ~GPMI_TIMING_INIT_OK;
956 this->flags |= GPMI_ASYNC_EDO_ENABLED;
957 this->timing_mode = mode;
959 dev_info(this->dev, "enable the asynchronous EDO mode %d\n", mode);
965 dev_err(this->dev, "mode:%d ,failed in set feature.\n", mode);
969 int gpmi_extra_init(struct gpmi_nand_data *this)
971 struct nand_chip *chip = &this->nand;
974 if (GPMI_IS_MX6(this) && chip->onfi_version) {
985 return enable_edo_mode(this, mode);
991 void gpmi_begin(struct gpmi_nand_data *this)
993 struct resources *r = &this->resources;
1002 ret = gpmi_enable_clk(this);
1004 dev_err(this->dev, "We failed in enable the clk\n");
1009 if (this->flags & GPMI_TIMING_INIT_OK)
1011 this->flags |= GPMI_TIMING_INIT_OK;
1013 if (this->flags & GPMI_ASYNC_EDO_ENABLED)
1014 gpmi_compute_edo_timing(this, &hw);
1016 gpmi_nfc_compute_hardware_timing(this, &hw);
1074 void gpmi_end(struct gpmi_nand_data *this)
1076 gpmi_disable_clk(this);
1080 void gpmi_clear_bch(struct gpmi_nand_data *this)
1082 struct resources *r = &this->resources;
1087 int gpmi_is_ready(struct gpmi_nand_data *this, unsigned chip)
1089 struct resources *r = &this->resources;
1093 if (GPMI_IS_MX23(this)) {
1096 } else if (GPMI_IS_MX28(this) || GPMI_IS_MX6(this)) {
1101 if (GPMI_IS_MX6(this))
1108 dev_err(this->dev, "unknow arch.\n");
1112 static inline void set_dma_type(struct gpmi_nand_data *this,
1115 this->last_dma_type = this->dma_type;
1116 this->dma_type = type;
1119 int gpmi_send_command(struct gpmi_nand_data *this)
1121 struct dma_chan *channel = get_dma_chan(this);
1124 int chip = this->current_chip;
1130 | BF_GPMI_CTRL0_CS(chip, this)
1131 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1134 | BF_GPMI_CTRL0_XFER_COUNT(this->command_length);
1143 sgl = &this->cmd_sgl;
1145 sg_init_one(sgl, this->cmd_buffer, this->command_length);
1146 dma_map_sg(this->dev, sgl, 1, DMA_TO_DEVICE);
1154 set_dma_type(this, DMA_FOR_COMMAND);
1155 return start_dma_without_bch_irq(this, desc);
1158 int gpmi_send_data(struct gpmi_nand_data *this)
1161 struct dma_chan *channel = get_dma_chan(this);
1162 int chip = this->current_chip;
1173 | BF_GPMI_CTRL0_CS(chip, this)
1174 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1176 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len);
1184 prepare_data_dma(this, DMA_TO_DEVICE);
1185 desc = dmaengine_prep_slave_sg(channel, &this->data_sgl,
1192 set_dma_type(this, DMA_FOR_WRITE_DATA);
1193 return start_dma_without_bch_irq(this, desc);
1196 int gpmi_read_data(struct gpmi_nand_data *this)
1199 struct dma_chan *channel = get_dma_chan(this);
1200 int chip = this->current_chip;
1206 | BF_GPMI_CTRL0_CS(chip, this)
1207 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1209 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len);
1218 prepare_data_dma(this, DMA_FROM_DEVICE);
1219 desc = dmaengine_prep_slave_sg(channel, &this->data_sgl,
1226 set_dma_type(this, DMA_FOR_READ_DATA);
1227 return start_dma_without_bch_irq(this, desc);
1230 int gpmi_send_page(struct gpmi_nand_data *this,
1233 struct bch_geometry *geo = &this->bch_geometry;
1239 struct dma_chan *channel = get_dma_chan(this);
1240 int chip = this->current_chip;
1252 | BF_GPMI_CTRL0_CS(chip, this)
1253 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1271 set_dma_type(this, DMA_FOR_WRITE_ECC_PAGE);
1272 return start_dma_with_bch_irq(this, desc);
1275 int gpmi_read_page(struct gpmi_nand_data *this,
1278 struct bch_geometry *geo = &this->bch_geometry;
1284 struct dma_chan *channel = get_dma_chan(this);
1285 int chip = this->current_chip;
1294 | BF_GPMI_CTRL0_CS(chip, this)
1295 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1314 | BF_GPMI_CTRL0_CS(chip, this)
1315 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1339 | BF_GPMI_CTRL0_CS(chip, this)
1340 | BF_GPMI_CTRL0_LOCK_CS(LOCK_CS_ENABLE, this)
1353 set_dma_type(this, DMA_FOR_READ_ECC_PAGE);
1354 return start_dma_with_bch_irq(this, desc);