Lines Matching refs:nand
179 struct nand_chip *nand = mtd_to_nand(mtd); in omap_enable_hwecc() local
180 struct omap_nand_info *info = nand_get_controller_data(nand); in omap_enable_hwecc()
181 unsigned int dev_width = (nand->options & NAND_BUSWIDTH_16) ? 1 : 0; in omap_enable_hwecc()
711 static int omap_select_ecc_scheme(struct nand_chip *nand, in omap_select_ecc_scheme() argument
713 struct omap_nand_info *info = nand_get_controller_data(nand); in omap_select_ecc_scheme()
724 nand->ecc.mode = NAND_ECC_SOFT; in omap_select_ecc_scheme()
725 nand->ecc.layout = NULL; in omap_select_ecc_scheme()
726 nand->ecc.size = 0; in omap_select_ecc_scheme()
739 memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl)); in omap_select_ecc_scheme()
740 nand->ecc.mode = NAND_ECC_HW; in omap_select_ecc_scheme()
741 nand->ecc.strength = 1; in omap_select_ecc_scheme()
742 nand->ecc.size = SECTOR_BYTES; in omap_select_ecc_scheme()
743 nand->ecc.bytes = 3; in omap_select_ecc_scheme()
744 nand->ecc.hwctl = omap_enable_hwecc; in omap_select_ecc_scheme()
745 nand->ecc.correct = omap_correct_data; in omap_select_ecc_scheme()
746 nand->ecc.calculate = omap_calculate_ecc; in omap_select_ecc_scheme()
748 ecclayout->eccbytes = nand->ecc.bytes * eccsteps; in omap_select_ecc_scheme()
750 if (nand->options & NAND_BUSWIDTH_16) in omap_select_ecc_scheme()
776 memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl)); in omap_select_ecc_scheme()
777 nand->ecc.mode = NAND_ECC_HW; in omap_select_ecc_scheme()
778 nand->ecc.strength = 8; in omap_select_ecc_scheme()
779 nand->ecc.size = SECTOR_BYTES; in omap_select_ecc_scheme()
780 nand->ecc.bytes = 13; in omap_select_ecc_scheme()
781 nand->ecc.hwctl = omap_enable_hwecc; in omap_select_ecc_scheme()
782 nand->ecc.correct = omap_correct_data_bch_sw; in omap_select_ecc_scheme()
783 nand->ecc.calculate = omap_calculate_ecc; in omap_select_ecc_scheme()
785 ecclayout->eccbytes = nand->ecc.bytes * eccsteps; in omap_select_ecc_scheme()
788 if (i % nand->ecc.bytes) in omap_select_ecc_scheme()
817 memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl)); in omap_select_ecc_scheme()
818 nand->ecc.mode = NAND_ECC_HW; in omap_select_ecc_scheme()
819 nand->ecc.strength = 8; in omap_select_ecc_scheme()
820 nand->ecc.size = SECTOR_BYTES; in omap_select_ecc_scheme()
821 nand->ecc.bytes = 14; in omap_select_ecc_scheme()
822 nand->ecc.hwctl = omap_enable_hwecc; in omap_select_ecc_scheme()
823 nand->ecc.correct = omap_correct_data_bch; in omap_select_ecc_scheme()
824 nand->ecc.calculate = omap_calculate_ecc; in omap_select_ecc_scheme()
825 nand->ecc.read_page = omap_read_page_bch; in omap_select_ecc_scheme()
827 ecclayout->eccbytes = nand->ecc.bytes * eccsteps; in omap_select_ecc_scheme()
851 nand->ecc.mode = NAND_ECC_HW; in omap_select_ecc_scheme()
852 nand->ecc.size = SECTOR_BYTES; in omap_select_ecc_scheme()
853 nand->ecc.bytes = 26; in omap_select_ecc_scheme()
854 nand->ecc.strength = 16; in omap_select_ecc_scheme()
855 nand->ecc.hwctl = omap_enable_hwecc; in omap_select_ecc_scheme()
856 nand->ecc.correct = omap_correct_data_bch; in omap_select_ecc_scheme()
857 nand->ecc.calculate = omap_calculate_ecc; in omap_select_ecc_scheme()
858 nand->ecc.read_page = omap_read_page_bch; in omap_select_ecc_scheme()
860 ecclayout->eccbytes = nand->ecc.bytes * eccsteps; in omap_select_ecc_scheme()
864 ecclayout->oobfree[0].length = oobsize - nand->ecc.bytes - in omap_select_ecc_scheme()
878 nand->ecc.layout = ecclayout; in omap_select_ecc_scheme()
895 struct nand_chip *nand; in omap_nand_switch_ecc() local
904 nand = mtd_to_nand(mtd); in omap_nand_switch_ecc()
905 nand->options |= NAND_OWN_BUFFERS; in omap_nand_switch_ecc()
906 nand->options &= ~NAND_SUBPAGE_READ; in omap_nand_switch_ecc()
910 err = omap_select_ecc_scheme(nand, in omap_nand_switch_ecc()
914 err = omap_select_ecc_scheme(nand, in omap_nand_switch_ecc()
918 err = omap_select_ecc_scheme(nand, in omap_nand_switch_ecc()
927 err = omap_select_ecc_scheme(nand, in omap_nand_switch_ecc()
931 err = omap_select_ecc_scheme(nand, in omap_nand_switch_ecc()
962 int board_nand_init(struct nand_chip *nand) in board_nand_init() argument
993 nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat; in board_nand_init()
994 nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; in board_nand_init()
998 nand_set_controller_data(nand, &omap_nand_info[cs]); in board_nand_init()
999 nand->cmd_ctrl = omap_nand_hwcontrol; in board_nand_init()
1000 nand->options |= NAND_NO_PADDING | NAND_CACHEPRG; in board_nand_init()
1001 nand->chip_delay = 100; in board_nand_init()
1002 nand->ecc.layout = &omap_ecclayout; in board_nand_init()
1007 nand->options |= NAND_BUSWIDTH_16; in board_nand_init()
1010 nand->options &= ~NAND_BUSWIDTH_16; in board_nand_init()
1015 err = omap_select_ecc_scheme(nand, CONFIG_NAND_OMAP_ECCSCHEME, in board_nand_init()
1019 err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_SW, in board_nand_init()
1026 nand->read_buf = omap_nand_read_prefetch; in board_nand_init()
1028 if (nand->options & NAND_BUSWIDTH_16) in board_nand_init()
1029 nand->read_buf = nand_read_buf16; in board_nand_init()
1031 nand->read_buf = nand_read_buf; in board_nand_init()
1034 nand->dev_ready = omap_dev_ready; in board_nand_init()