Lines Matching refs:err

226 	int err;  in airoha_snand_set_fifo_op()  local
229 err = regmap_write(as_ctrl->regmap_ctrl, REG_SPI_CTRL_OPFIFO_WDATA, in airoha_snand_set_fifo_op()
232 if (err) in airoha_snand_set_fifo_op()
233 return err; in airoha_snand_set_fifo_op()
235 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_set_fifo_op()
239 if (err) in airoha_snand_set_fifo_op()
240 return err; in airoha_snand_set_fifo_op()
242 err = regmap_write(as_ctrl->regmap_ctrl, REG_SPI_CTRL_OPFIFO_WR, in airoha_snand_set_fifo_op()
244 if (err) in airoha_snand_set_fifo_op()
245 return err; in airoha_snand_set_fifo_op()
264 int err; in airoha_snand_write_data_to_fifo() local
268 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_write_data_to_fifo()
272 if (err) in airoha_snand_write_data_to_fifo()
273 return err; in airoha_snand_write_data_to_fifo()
276 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_write_data_to_fifo()
279 if (err) in airoha_snand_write_data_to_fifo()
280 return err; in airoha_snand_write_data_to_fifo()
283 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_write_data_to_fifo()
287 if (err) in airoha_snand_write_data_to_fifo()
288 return err; in airoha_snand_write_data_to_fifo()
300 int err; in airoha_snand_read_data_from_fifo() local
304 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_read_data_from_fifo()
308 if (err) in airoha_snand_read_data_from_fifo()
309 return err; in airoha_snand_read_data_from_fifo()
312 err = regmap_read(as_ctrl->regmap_ctrl, in airoha_snand_read_data_from_fifo()
314 if (err) in airoha_snand_read_data_from_fifo()
315 return err; in airoha_snand_read_data_from_fifo()
319 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_read_data_from_fifo()
321 if (err) in airoha_snand_read_data_from_fifo()
322 return err; in airoha_snand_read_data_from_fifo()
331 int err; in airoha_snand_set_mode() local
337 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
339 if (err) in airoha_snand_set_mode()
340 return err; in airoha_snand_set_mode()
342 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
344 if (err) in airoha_snand_set_mode()
345 return err; in airoha_snand_set_mode()
347 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
351 if (err) in airoha_snand_set_mode()
352 return err; in airoha_snand_set_mode()
354 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
356 if (err) in airoha_snand_set_mode()
357 return err; in airoha_snand_set_mode()
359 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
361 if (err) in airoha_snand_set_mode()
362 return err; in airoha_snand_set_mode()
366 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
369 if (err < 0) in airoha_snand_set_mode()
370 return err; in airoha_snand_set_mode()
372 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
374 if (err < 0) in airoha_snand_set_mode()
375 return err; in airoha_snand_set_mode()
377 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
379 if (err < 0) in airoha_snand_set_mode()
380 return err; in airoha_snand_set_mode()
396 int err; in airoha_snand_write_data() local
399 err = airoha_snand_set_fifo_op(as_ctrl, cmd, data_len); in airoha_snand_write_data()
400 if (err) in airoha_snand_write_data()
401 return err; in airoha_snand_write_data()
403 err = airoha_snand_write_data_to_fifo(as_ctrl, &data[i], in airoha_snand_write_data()
405 if (err < 0) in airoha_snand_write_data()
406 return err; in airoha_snand_write_data()
418 int err; in airoha_snand_read_data() local
421 err = airoha_snand_set_fifo_op(as_ctrl, 0xc, data_len); in airoha_snand_read_data()
422 if (err) in airoha_snand_read_data()
423 return err; in airoha_snand_read_data()
425 err = airoha_snand_read_data_from_fifo(as_ctrl, &data[i], in airoha_snand_read_data()
427 if (err < 0) in airoha_snand_read_data()
428 return err; in airoha_snand_read_data()
436 int err; in airoha_snand_nfi_init() local
439 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_NFI_CNFG, in airoha_snand_nfi_init()
441 if (err) in airoha_snand_nfi_init()
442 return err; in airoha_snand_nfi_init()
451 int err; in airoha_snand_nfi_config() local
454 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_nfi_config()
456 if (err) in airoha_snand_nfi_config()
457 return err; in airoha_snand_nfi_config()
460 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
462 if (err) in airoha_snand_nfi_config()
463 return err; in airoha_snand_nfi_config()
466 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
468 if (err) in airoha_snand_nfi_config()
469 return err; in airoha_snand_nfi_config()
472 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
474 if (err) in airoha_snand_nfi_config()
475 return err; in airoha_snand_nfi_config()
493 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_PAGEFMT, in airoha_snand_nfi_config()
495 if (err) in airoha_snand_nfi_config()
496 return err; in airoha_snand_nfi_config()
510 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_PAGEFMT, in airoha_snand_nfi_config()
512 if (err) in airoha_snand_nfi_config()
513 return err; in airoha_snand_nfi_config()
517 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_nfi_config()
519 if (err) in airoha_snand_nfi_config()
520 return err; in airoha_snand_nfi_config()
523 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE, in airoha_snand_nfi_config()
525 if (err) in airoha_snand_nfi_config()
526 return err; in airoha_snand_nfi_config()
636 int err; in airoha_snand_dirmap_read() local
651 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_DMA); in airoha_snand_dirmap_read()
652 if (err < 0) in airoha_snand_dirmap_read()
653 return err; in airoha_snand_dirmap_read()
655 err = airoha_snand_nfi_config(as_ctrl); in airoha_snand_dirmap_read()
656 if (err) in airoha_snand_dirmap_read()
657 return err; in airoha_snand_dirmap_read()
661 err = dma_mapping_error(as_ctrl->dev, dma_addr); in airoha_snand_dirmap_read()
662 if (err) in airoha_snand_dirmap_read()
663 return err; in airoha_snand_dirmap_read()
666 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_STRADDR, in airoha_snand_dirmap_read()
668 if (err) in airoha_snand_dirmap_read()
674 err = regmap_update_bits(as_ctrl->regmap_nfi, in airoha_snand_dirmap_read()
677 if (err) in airoha_snand_dirmap_read()
681 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL2, in airoha_snand_dirmap_read()
683 if (err) in airoha_snand_dirmap_read()
687 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL, in airoha_snand_dirmap_read()
689 if (err) in airoha_snand_dirmap_read()
693 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL3, 0x0); in airoha_snand_dirmap_read()
694 if (err) in airoha_snand_dirmap_read()
698 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_read()
701 if (err) in airoha_snand_dirmap_read()
704 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_read()
706 if (err) in airoha_snand_dirmap_read()
709 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CMD, 0x0); in airoha_snand_dirmap_read()
710 if (err) in airoha_snand_dirmap_read()
714 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_read()
716 if (err) in airoha_snand_dirmap_read()
719 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_read()
721 if (err) in airoha_snand_dirmap_read()
724 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, in airoha_snand_dirmap_read()
728 if (err) in airoha_snand_dirmap_read()
735 err = regmap_write_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1, in airoha_snand_dirmap_read()
738 if (err) in airoha_snand_dirmap_read()
741 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, REG_SPI_NFI_INTR, in airoha_snand_dirmap_read()
744 if (err) in airoha_snand_dirmap_read()
752 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_read()
753 if (err < 0) in airoha_snand_dirmap_read()
754 return err; in airoha_snand_dirmap_read()
763 return err; in airoha_snand_dirmap_read()
775 int err; in airoha_snand_dirmap_write() local
778 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_write()
779 if (err < 0) in airoha_snand_dirmap_write()
780 return err; in airoha_snand_dirmap_write()
785 err = dma_mapping_error(as_ctrl->dev, dma_addr); in airoha_snand_dirmap_write()
786 if (err) in airoha_snand_dirmap_write()
787 return err; in airoha_snand_dirmap_write()
789 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_DMA); in airoha_snand_dirmap_write()
790 if (err < 0) in airoha_snand_dirmap_write()
793 err = airoha_snand_nfi_config(as_ctrl); in airoha_snand_dirmap_write()
794 if (err) in airoha_snand_dirmap_write()
803 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_STRADDR, in airoha_snand_dirmap_write()
805 if (err) in airoha_snand_dirmap_write()
810 err = regmap_update_bits(as_ctrl->regmap_nfi, in airoha_snand_dirmap_write()
813 if (err) in airoha_snand_dirmap_write()
816 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL1, in airoha_snand_dirmap_write()
819 if (err) in airoha_snand_dirmap_write()
822 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL, in airoha_snand_dirmap_write()
824 if (err) in airoha_snand_dirmap_write()
827 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL2, 0x0); in airoha_snand_dirmap_write()
828 if (err) in airoha_snand_dirmap_write()
831 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
833 if (err) in airoha_snand_dirmap_write()
836 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
839 if (err) in airoha_snand_dirmap_write()
842 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
844 if (err) in airoha_snand_dirmap_write()
847 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CMD, 0x80); in airoha_snand_dirmap_write()
848 if (err) in airoha_snand_dirmap_write()
851 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_write()
853 if (err) in airoha_snand_dirmap_write()
856 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_write()
858 if (err) in airoha_snand_dirmap_write()
861 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, REG_SPI_NFI_INTR, in airoha_snand_dirmap_write()
864 if (err) in airoha_snand_dirmap_write()
867 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, in airoha_snand_dirmap_write()
871 if (err) in airoha_snand_dirmap_write()
878 err = regmap_write_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1, in airoha_snand_dirmap_write()
881 if (err) in airoha_snand_dirmap_write()
886 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_write()
887 if (err < 0) in airoha_snand_dirmap_write()
888 return err; in airoha_snand_dirmap_write()
895 return err; in airoha_snand_dirmap_write()
903 int i, err; in airoha_snand_exec_op() local
908 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_exec_op()
909 if (err < 0) in airoha_snand_exec_op()
910 return err; in airoha_snand_exec_op()
912 err = airoha_snand_set_cs(as_ctrl, SPI_CHIP_SEL_LOW); in airoha_snand_exec_op()
913 if (err < 0) in airoha_snand_exec_op()
914 return err; in airoha_snand_exec_op()
917 err = airoha_snand_write_data(as_ctrl, 0x8, &opcode, sizeof(opcode)); in airoha_snand_exec_op()
918 if (err) in airoha_snand_exec_op()
919 return err; in airoha_snand_exec_op()
927 err = airoha_snand_write_data(as_ctrl, cmd, &data[i], in airoha_snand_exec_op()
929 if (err) in airoha_snand_exec_op()
930 return err; in airoha_snand_exec_op()
936 err = airoha_snand_write_data(as_ctrl, 0x8, &data[0], in airoha_snand_exec_op()
938 if (err) in airoha_snand_exec_op()
939 return err; in airoha_snand_exec_op()
944 err = airoha_snand_read_data(as_ctrl, op->data.buf.in, in airoha_snand_exec_op()
946 if (err) in airoha_snand_exec_op()
947 return err; in airoha_snand_exec_op()
949 err = airoha_snand_write_data(as_ctrl, 0x8, op->data.buf.out, in airoha_snand_exec_op()
951 if (err) in airoha_snand_exec_op()
952 return err; in airoha_snand_exec_op()
987 int err; in airoha_snand_nfi_setup() local
989 err = regmap_read(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, &val); in airoha_snand_nfi_setup()
990 if (err) in airoha_snand_nfi_setup()
991 return err; in airoha_snand_nfi_setup()
995 err = regmap_read(as_ctrl->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE, &val); in airoha_snand_nfi_setup()
996 if (err) in airoha_snand_nfi_setup()
997 return err; in airoha_snand_nfi_setup()
1007 err = airoha_snand_nfi_init(as_ctrl); in airoha_snand_nfi_setup()
1008 if (err) in airoha_snand_nfi_setup()
1009 return err; in airoha_snand_nfi_setup()
1042 int err; in airoha_snand_probe() local
1076 err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32)); in airoha_snand_probe()
1077 if (err) in airoha_snand_probe()
1078 return err; in airoha_snand_probe()
1087 err = airoha_snand_nfi_setup(as_ctrl); in airoha_snand_probe()
1088 if (err) in airoha_snand_probe()
1089 return err; in airoha_snand_probe()