Lines Matching refs:err

233 	int err;  in airoha_snand_set_fifo_op()  local
236 err = regmap_write(as_ctrl->regmap_ctrl, REG_SPI_CTRL_OPFIFO_WDATA, 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_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_set_fifo_op()
246 if (err) in airoha_snand_set_fifo_op()
247 return err; in airoha_snand_set_fifo_op()
249 err = regmap_write(as_ctrl->regmap_ctrl, REG_SPI_CTRL_OPFIFO_WR, in airoha_snand_set_fifo_op()
251 if (err) in airoha_snand_set_fifo_op()
252 return err; in airoha_snand_set_fifo_op()
271 int err; in airoha_snand_write_data_to_fifo() local
275 err = regmap_read_poll_timeout(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_write(as_ctrl->regmap_ctrl, in airoha_snand_write_data_to_fifo()
286 if (err) in airoha_snand_write_data_to_fifo()
287 return err; in airoha_snand_write_data_to_fifo()
290 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_write_data_to_fifo()
294 if (err) in airoha_snand_write_data_to_fifo()
295 return err; in airoha_snand_write_data_to_fifo()
307 int err; in airoha_snand_read_data_from_fifo() local
311 err = regmap_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_read_data_from_fifo()
315 if (err) in airoha_snand_read_data_from_fifo()
316 return err; in airoha_snand_read_data_from_fifo()
319 err = regmap_read(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()
326 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_read_data_from_fifo()
328 if (err) in airoha_snand_read_data_from_fifo()
329 return err; in airoha_snand_read_data_from_fifo()
338 int err; in airoha_snand_set_mode() local
344 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
346 if (err) in airoha_snand_set_mode()
347 return err; in airoha_snand_set_mode()
349 err = regmap_write(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_read_poll_timeout(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
358 if (err) in airoha_snand_set_mode()
359 return err; in airoha_snand_set_mode()
361 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
363 if (err) in airoha_snand_set_mode()
364 return err; in airoha_snand_set_mode()
366 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
368 if (err) in airoha_snand_set_mode()
369 return err; in airoha_snand_set_mode()
373 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
376 if (err < 0) in airoha_snand_set_mode()
377 return err; in airoha_snand_set_mode()
379 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
381 if (err < 0) in airoha_snand_set_mode()
382 return err; in airoha_snand_set_mode()
384 err = regmap_write(as_ctrl->regmap_ctrl, in airoha_snand_set_mode()
386 if (err < 0) in airoha_snand_set_mode()
387 return err; in airoha_snand_set_mode()
403 int err; in airoha_snand_write_data() local
406 err = airoha_snand_set_fifo_op(as_ctrl, cmd, data_len); in airoha_snand_write_data()
407 if (err) in airoha_snand_write_data()
408 return err; in airoha_snand_write_data()
410 err = airoha_snand_write_data_to_fifo(as_ctrl, &data[i], in airoha_snand_write_data()
412 if (err < 0) in airoha_snand_write_data()
413 return err; in airoha_snand_write_data()
425 int err; in airoha_snand_read_data() local
428 err = airoha_snand_set_fifo_op(as_ctrl, 0xc, data_len); in airoha_snand_read_data()
429 if (err) in airoha_snand_read_data()
430 return err; in airoha_snand_read_data()
432 err = airoha_snand_read_data_from_fifo(as_ctrl, &data[i], in airoha_snand_read_data()
434 if (err < 0) in airoha_snand_read_data()
435 return err; in airoha_snand_read_data()
443 int err; in airoha_snand_nfi_init() local
446 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_NFI_CNFG, in airoha_snand_nfi_init()
448 if (err) in airoha_snand_nfi_init()
449 return err; in airoha_snand_nfi_init()
458 int err; in airoha_snand_nfi_config() local
461 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_nfi_config()
463 if (err) in airoha_snand_nfi_config()
464 return err; in airoha_snand_nfi_config()
467 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
469 if (err) in airoha_snand_nfi_config()
470 return err; in airoha_snand_nfi_config()
473 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
475 if (err) in airoha_snand_nfi_config()
476 return err; in airoha_snand_nfi_config()
479 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_nfi_config()
481 if (err) in airoha_snand_nfi_config()
482 return err; in airoha_snand_nfi_config()
500 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_PAGEFMT, in airoha_snand_nfi_config()
502 if (err) in airoha_snand_nfi_config()
503 return err; in airoha_snand_nfi_config()
517 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_PAGEFMT, in airoha_snand_nfi_config()
519 if (err) in airoha_snand_nfi_config()
520 return err; in airoha_snand_nfi_config()
524 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_nfi_config()
526 if (err) in airoha_snand_nfi_config()
527 return err; in airoha_snand_nfi_config()
530 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE, in airoha_snand_nfi_config()
532 if (err) in airoha_snand_nfi_config()
533 return err; in airoha_snand_nfi_config()
642 int err; in airoha_snand_dirmap_read() local
657 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_DMA); in airoha_snand_dirmap_read()
658 if (err < 0) in airoha_snand_dirmap_read()
659 return err; in airoha_snand_dirmap_read()
661 err = airoha_snand_nfi_config(as_ctrl); in airoha_snand_dirmap_read()
662 if (err) in airoha_snand_dirmap_read()
663 return err; in airoha_snand_dirmap_read()
669 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_STRADDR, in airoha_snand_dirmap_read()
671 if (err) in airoha_snand_dirmap_read()
672 return err; in airoha_snand_dirmap_read()
677 err = regmap_update_bits(as_ctrl->regmap_nfi, in airoha_snand_dirmap_read()
680 if (err) in airoha_snand_dirmap_read()
681 return err; in airoha_snand_dirmap_read()
684 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL2, in airoha_snand_dirmap_read()
686 if (err) in airoha_snand_dirmap_read()
687 return err; in airoha_snand_dirmap_read()
690 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL, in airoha_snand_dirmap_read()
692 if (err) in airoha_snand_dirmap_read()
693 return err; in airoha_snand_dirmap_read()
696 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL3, 0x0); in airoha_snand_dirmap_read()
697 if (err) in airoha_snand_dirmap_read()
698 return err; in airoha_snand_dirmap_read()
701 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_read()
704 if (err) in airoha_snand_dirmap_read()
705 return err; in airoha_snand_dirmap_read()
707 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_read()
709 if (err) in airoha_snand_dirmap_read()
710 return err; in airoha_snand_dirmap_read()
712 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CMD, 0x0); in airoha_snand_dirmap_read()
713 if (err) in airoha_snand_dirmap_read()
714 return err; in airoha_snand_dirmap_read()
717 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_read()
719 if (err) in airoha_snand_dirmap_read()
720 return err; in airoha_snand_dirmap_read()
722 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_read()
724 if (err) in airoha_snand_dirmap_read()
725 return err; in airoha_snand_dirmap_read()
727 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, in airoha_snand_dirmap_read()
731 if (err) in airoha_snand_dirmap_read()
732 return err; in airoha_snand_dirmap_read()
738 err = regmap_write_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1, in airoha_snand_dirmap_read()
741 if (err) in airoha_snand_dirmap_read()
742 return err; in airoha_snand_dirmap_read()
744 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, REG_SPI_NFI_INTR, in airoha_snand_dirmap_read()
747 if (err) in airoha_snand_dirmap_read()
748 return err; in airoha_snand_dirmap_read()
755 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_read()
756 if (err < 0) in airoha_snand_dirmap_read()
757 return err; in airoha_snand_dirmap_read()
772 int err; in airoha_snand_dirmap_write() local
775 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_write()
776 if (err < 0) in airoha_snand_dirmap_write()
777 return err; in airoha_snand_dirmap_write()
785 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_DMA); in airoha_snand_dirmap_write()
786 if (err < 0) in airoha_snand_dirmap_write()
787 return err; in airoha_snand_dirmap_write()
789 err = airoha_snand_nfi_config(as_ctrl); in airoha_snand_dirmap_write()
790 if (err) in airoha_snand_dirmap_write()
791 return err; in airoha_snand_dirmap_write()
799 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_STRADDR, in airoha_snand_dirmap_write()
801 if (err) in airoha_snand_dirmap_write()
802 return err; in airoha_snand_dirmap_write()
806 err = regmap_update_bits(as_ctrl->regmap_nfi, in airoha_snand_dirmap_write()
809 if (err) in airoha_snand_dirmap_write()
810 return err; in airoha_snand_dirmap_write()
812 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL1, in airoha_snand_dirmap_write()
815 if (err) in airoha_snand_dirmap_write()
816 return err; in airoha_snand_dirmap_write()
818 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL, in airoha_snand_dirmap_write()
820 if (err) in airoha_snand_dirmap_write()
821 return err; in airoha_snand_dirmap_write()
823 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL2, 0x0); in airoha_snand_dirmap_write()
824 if (err) in airoha_snand_dirmap_write()
825 return err; in airoha_snand_dirmap_write()
827 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
829 if (err) in airoha_snand_dirmap_write()
830 return err; in airoha_snand_dirmap_write()
832 err = regmap_update_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
835 if (err) in airoha_snand_dirmap_write()
836 return err; in airoha_snand_dirmap_write()
838 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CNFG, in airoha_snand_dirmap_write()
840 if (err) in airoha_snand_dirmap_write()
841 return err; in airoha_snand_dirmap_write()
843 err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CMD, 0x80); in airoha_snand_dirmap_write()
844 if (err) in airoha_snand_dirmap_write()
845 return err; in airoha_snand_dirmap_write()
847 err = regmap_clear_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_write()
849 if (err) in airoha_snand_dirmap_write()
850 return err; in airoha_snand_dirmap_write()
852 err = regmap_set_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, in airoha_snand_dirmap_write()
854 if (err) in airoha_snand_dirmap_write()
855 return err; in airoha_snand_dirmap_write()
857 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, REG_SPI_NFI_INTR, in airoha_snand_dirmap_write()
860 if (err) in airoha_snand_dirmap_write()
861 return err; in airoha_snand_dirmap_write()
863 err = regmap_read_poll_timeout(as_ctrl->regmap_nfi, in airoha_snand_dirmap_write()
867 if (err) in airoha_snand_dirmap_write()
868 return err; in airoha_snand_dirmap_write()
874 err = regmap_write_bits(as_ctrl->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1, in airoha_snand_dirmap_write()
877 if (err) in airoha_snand_dirmap_write()
878 return err; in airoha_snand_dirmap_write()
880 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_dirmap_write()
881 if (err < 0) in airoha_snand_dirmap_write()
882 return err; in airoha_snand_dirmap_write()
892 int i, err; in airoha_snand_exec_op() local
897 err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); in airoha_snand_exec_op()
898 if (err < 0) in airoha_snand_exec_op()
899 return err; in airoha_snand_exec_op()
901 err = airoha_snand_set_cs(as_ctrl, SPI_CHIP_SEL_LOW); in airoha_snand_exec_op()
902 if (err < 0) in airoha_snand_exec_op()
903 return err; in airoha_snand_exec_op()
906 err = airoha_snand_write_data(as_ctrl, 0x8, &opcode, sizeof(opcode)); in airoha_snand_exec_op()
907 if (err) in airoha_snand_exec_op()
908 return err; in airoha_snand_exec_op()
916 err = airoha_snand_write_data(as_ctrl, cmd, &data[i], in airoha_snand_exec_op()
918 if (err) in airoha_snand_exec_op()
919 return err; in airoha_snand_exec_op()
925 err = airoha_snand_write_data(as_ctrl, 0x8, &data[0], in airoha_snand_exec_op()
927 if (err) in airoha_snand_exec_op()
928 return err; in airoha_snand_exec_op()
933 err = airoha_snand_read_data(as_ctrl, op->data.buf.in, in airoha_snand_exec_op()
935 if (err) in airoha_snand_exec_op()
936 return err; in airoha_snand_exec_op()
938 err = airoha_snand_write_data(as_ctrl, 0x8, op->data.buf.out, in airoha_snand_exec_op()
940 if (err) in airoha_snand_exec_op()
941 return err; in airoha_snand_exec_op()
998 int err; in airoha_snand_nfi_setup() local
1000 err = regmap_read(as_ctrl->regmap_nfi, REG_SPI_NFI_CON, &val); in airoha_snand_nfi_setup()
1001 if (err) in airoha_snand_nfi_setup()
1002 return err; in airoha_snand_nfi_setup()
1006 err = regmap_read(as_ctrl->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE, &val); in airoha_snand_nfi_setup()
1007 if (err) in airoha_snand_nfi_setup()
1008 return err; in airoha_snand_nfi_setup()
1018 err = airoha_snand_nfi_init(as_ctrl); in airoha_snand_nfi_setup()
1019 if (err) in airoha_snand_nfi_setup()
1020 return err; in airoha_snand_nfi_setup()
1053 int err; in airoha_snand_probe() local
1087 err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32)); in airoha_snand_probe()
1088 if (err) in airoha_snand_probe()
1089 return err; in airoha_snand_probe()
1099 err = airoha_snand_nfi_setup(as_ctrl); in airoha_snand_probe()
1100 if (err) in airoha_snand_probe()
1101 return err; in airoha_snand_probe()