Lines Matching full:chip

23  * nand_read_byte - [DEFAULT] read one byte from the chip
24 * @chip: NAND chip object
28 static uint8_t nand_read_byte(struct nand_chip *chip) in nand_read_byte() argument
30 return readb(chip->legacy.IO_ADDR_R); in nand_read_byte()
34 * nand_read_byte16 - [DEFAULT] read one byte endianness aware from the chip
35 * @chip: NAND chip object
40 static uint8_t nand_read_byte16(struct nand_chip *chip) in nand_read_byte16() argument
42 return (uint8_t) cpu_to_le16(readw(chip->legacy.IO_ADDR_R)); in nand_read_byte16()
47 * @chip: NAND chip object
50 * Default select function for 1 chip devices.
52 static void nand_select_chip(struct nand_chip *chip, int chipnr) in nand_select_chip() argument
56 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_select_chip()
68 * nand_write_byte - [DEFAULT] write single byte to chip
69 * @chip: NAND chip object
74 static void nand_write_byte(struct nand_chip *chip, uint8_t byte) in nand_write_byte() argument
76 chip->legacy.write_buf(chip, &byte, 1); in nand_write_byte()
80 * nand_write_byte16 - [DEFAULT] write single byte to a chip with width 16
81 * @chip: NAND chip object
84 * Default function to write a byte to I/O[7:0] on a 16-bit wide chip.
86 static void nand_write_byte16(struct nand_chip *chip, uint8_t byte) in nand_write_byte16() argument
106 chip->legacy.write_buf(chip, (uint8_t *)&word, 2); in nand_write_byte16()
110 * nand_write_buf - [DEFAULT] write buffer to chip
111 * @chip: NAND chip object
117 static void nand_write_buf(struct nand_chip *chip, const uint8_t *buf, int len) in nand_write_buf() argument
119 iowrite8_rep(chip->legacy.IO_ADDR_W, buf, len); in nand_write_buf()
123 * nand_read_buf - [DEFAULT] read chip data into buffer
124 * @chip: NAND chip object
130 static void nand_read_buf(struct nand_chip *chip, uint8_t *buf, int len) in nand_read_buf() argument
132 ioread8_rep(chip->legacy.IO_ADDR_R, buf, len); in nand_read_buf()
136 * nand_write_buf16 - [DEFAULT] write buffer to chip
137 * @chip: NAND chip object
143 static void nand_write_buf16(struct nand_chip *chip, const uint8_t *buf, in nand_write_buf16() argument
148 iowrite16_rep(chip->legacy.IO_ADDR_W, p, len >> 1); in nand_write_buf16()
152 * nand_read_buf16 - [DEFAULT] read chip data into buffer
153 * @chip: NAND chip object
159 static void nand_read_buf16(struct nand_chip *chip, uint8_t *buf, int len) in nand_read_buf16() argument
163 ioread16_rep(chip->legacy.IO_ADDR_R, p, len >> 1); in nand_read_buf16()
168 * @chip: NAND chip object
174 static void panic_nand_wait_ready(struct nand_chip *chip, unsigned long timeo) in panic_nand_wait_ready() argument
180 if (chip->legacy.dev_ready(chip)) in panic_nand_wait_ready()
189 * @chip: NAND chip object
193 void nand_wait_ready(struct nand_chip *chip) in nand_wait_ready() argument
198 return panic_nand_wait_ready(chip, timeo); in nand_wait_ready()
203 if (chip->legacy.dev_ready(chip)) in nand_wait_ready()
208 if (!chip->legacy.dev_ready(chip)) in nand_wait_ready()
209 pr_warn_ratelimited("timeout while waiting for chip to become ready\n"); in nand_wait_ready()
215 * @chip: NAND chip object
220 static void nand_wait_status_ready(struct nand_chip *chip, unsigned long timeo) in nand_wait_status_ready() argument
228 ret = nand_read_data_op(chip, &status, sizeof(status), true); in nand_wait_status_ready()
240 * @chip: NAND chip object
248 static void nand_command(struct nand_chip *chip, unsigned int command, in nand_command() argument
251 struct mtd_info *mtd = nand_to_mtd(chip); in nand_command()
269 chip->legacy.cmd_ctrl(chip, readcmd, ctrl); in nand_command()
273 chip->legacy.cmd_ctrl(chip, command, ctrl); in nand_command()
280 if (chip->options & NAND_BUSWIDTH_16 && in nand_command()
283 chip->legacy.cmd_ctrl(chip, column, ctrl); in nand_command()
287 chip->legacy.cmd_ctrl(chip, page_addr, ctrl); in nand_command()
289 chip->legacy.cmd_ctrl(chip, page_addr >> 8, ctrl); in nand_command()
290 if (chip->options & NAND_ROW_ADDR_3) in nand_command()
291 chip->legacy.cmd_ctrl(chip, page_addr >> 16, ctrl); in nand_command()
293 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command()
313 if (chip->legacy.dev_ready) in nand_command()
315 udelay(chip->legacy.chip_delay); in nand_command()
316 chip->legacy.cmd_ctrl(chip, NAND_CMD_STATUS, in nand_command()
318 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command()
321 nand_wait_status_ready(chip, 250); in nand_command()
341 if (!chip->legacy.dev_ready) { in nand_command()
342 udelay(chip->legacy.chip_delay); in nand_command()
352 nand_wait_ready(chip); in nand_command()
355 static void nand_ccs_delay(struct nand_chip *chip) in nand_ccs_delay() argument
361 if (!(chip->options & NAND_WAIT_TCCS)) in nand_ccs_delay()
368 if (nand_has_setup_data_iface(chip)) in nand_ccs_delay()
369 ndelay(chip->data_interface.timings.sdr.tCCS_min / 1000); in nand_ccs_delay()
376 * @chip: NAND chip object
385 static void nand_command_lp(struct nand_chip *chip, unsigned int command, in nand_command_lp() argument
388 struct mtd_info *mtd = nand_to_mtd(chip); in nand_command_lp()
398 chip->legacy.cmd_ctrl(chip, command, in nand_command_lp()
407 if (chip->options & NAND_BUSWIDTH_16 && in nand_command_lp()
410 chip->legacy.cmd_ctrl(chip, column, ctrl); in nand_command_lp()
415 chip->legacy.cmd_ctrl(chip, column >> 8, ctrl); in nand_command_lp()
418 chip->legacy.cmd_ctrl(chip, page_addr, ctrl); in nand_command_lp()
419 chip->legacy.cmd_ctrl(chip, page_addr >> 8, in nand_command_lp()
421 if (chip->options & NAND_ROW_ADDR_3) in nand_command_lp()
422 chip->legacy.cmd_ctrl(chip, page_addr >> 16, in nand_command_lp()
426 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command_lp()
447 nand_ccs_delay(chip); in nand_command_lp()
451 if (chip->legacy.dev_ready) in nand_command_lp()
453 udelay(chip->legacy.chip_delay); in nand_command_lp()
454 chip->legacy.cmd_ctrl(chip, NAND_CMD_STATUS, in nand_command_lp()
456 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command_lp()
459 nand_wait_status_ready(chip, 250); in nand_command_lp()
464 chip->legacy.cmd_ctrl(chip, NAND_CMD_RNDOUTSTART, in nand_command_lp()
466 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command_lp()
469 nand_ccs_delay(chip); in nand_command_lp()
482 chip->legacy.cmd_ctrl(chip, NAND_CMD_READSTART, in nand_command_lp()
484 chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, in nand_command_lp()
493 if (!chip->legacy.dev_ready) { in nand_command_lp()
494 udelay(chip->legacy.chip_delay); in nand_command_lp()
505 nand_wait_ready(chip); in nand_command_lp()
510 * @chip: nand chip info structure
517 int nand_get_set_features_notsupp(struct nand_chip *chip, int addr, in nand_get_set_features_notsupp() argument
526 * @chip: NAND chip structure
530 static int nand_wait(struct nand_chip *chip) in nand_wait() argument
543 ret = nand_status_op(chip, NULL); in nand_wait()
548 panic_nand_wait(chip, timeo); in nand_wait()
552 if (chip->legacy.dev_ready) { in nand_wait()
553 if (chip->legacy.dev_ready(chip)) in nand_wait()
556 ret = nand_read_data_op(chip, &status, in nand_wait()
568 ret = nand_read_data_op(chip, &status, sizeof(status), true); in nand_wait()
577 void nand_legacy_set_defaults(struct nand_chip *chip) in nand_legacy_set_defaults() argument
579 unsigned int busw = chip->options & NAND_BUSWIDTH_16; in nand_legacy_set_defaults()
581 if (nand_has_exec_op(chip)) in nand_legacy_set_defaults()
585 if (!chip->legacy.chip_delay) in nand_legacy_set_defaults()
586 chip->legacy.chip_delay = 20; in nand_legacy_set_defaults()
589 if (!chip->legacy.cmdfunc) in nand_legacy_set_defaults()
590 chip->legacy.cmdfunc = nand_command; in nand_legacy_set_defaults()
593 if (chip->legacy.waitfunc == NULL) in nand_legacy_set_defaults()
594 chip->legacy.waitfunc = nand_wait; in nand_legacy_set_defaults()
596 if (!chip->legacy.select_chip) in nand_legacy_set_defaults()
597 chip->legacy.select_chip = nand_select_chip; in nand_legacy_set_defaults()
600 if (!chip->legacy.read_byte || chip->legacy.read_byte == nand_read_byte) in nand_legacy_set_defaults()
601 chip->legacy.read_byte = busw ? nand_read_byte16 : nand_read_byte; in nand_legacy_set_defaults()
602 if (!chip->legacy.write_buf || chip->legacy.write_buf == nand_write_buf) in nand_legacy_set_defaults()
603 chip->legacy.write_buf = busw ? nand_write_buf16 : nand_write_buf; in nand_legacy_set_defaults()
604 if (!chip->legacy.write_byte || chip->legacy.write_byte == nand_write_byte) in nand_legacy_set_defaults()
605 chip->legacy.write_byte = busw ? nand_write_byte16 : nand_write_byte; in nand_legacy_set_defaults()
606 if (!chip->legacy.read_buf || chip->legacy.read_buf == nand_read_buf) in nand_legacy_set_defaults()
607 chip->legacy.read_buf = busw ? nand_read_buf16 : nand_read_buf; in nand_legacy_set_defaults()
610 void nand_legacy_adjust_cmdfunc(struct nand_chip *chip) in nand_legacy_adjust_cmdfunc() argument
612 struct mtd_info *mtd = nand_to_mtd(chip); in nand_legacy_adjust_cmdfunc()
615 if (mtd->writesize > 512 && chip->legacy.cmdfunc == nand_command) in nand_legacy_adjust_cmdfunc()
616 chip->legacy.cmdfunc = nand_command_lp; in nand_legacy_adjust_cmdfunc()
619 int nand_legacy_check_hooks(struct nand_chip *chip) in nand_legacy_check_hooks() argument
625 if (nand_has_exec_op(chip)) in nand_legacy_check_hooks()
633 if ((!chip->legacy.cmdfunc || !chip->legacy.select_chip) && in nand_legacy_check_hooks()
634 !chip->legacy.cmd_ctrl) { in nand_legacy_check_hooks()