Lines Matching +full:nand +full:- +full:ecc +full:- +full:algo

1 // SPDX-License-Identifier: GPL-2.0-only
32 * socrates_nand_write_buf - write buffer to chip
33 * @this: NAND chip object
44 out_be32(host->io_base, FPGA_NAND_ENABLE | in socrates_nand_write_buf()
51 * socrates_nand_read_buf - read chip data into buffer
52 * @this: NAND chip object
65 out_be32(host->io_base, val); in socrates_nand_read_buf()
67 buf[i] = (in_be32(host->io_base) >> in socrates_nand_read_buf()
73 * socrates_nand_read_byte - read one byte from the chip
84 * Hardware specific access to control-lines
105 out_be32(host->io_base, val); in socrates_nand_cmd_ctrl()
115 if (in_be32(host->io_base) & FPGA_NAND_BUSY) in socrates_nand_device_ready()
122 if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT && in socrates_attach_chip()
123 chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN) in socrates_attach_chip()
124 chip->ecc.algo = NAND_ECC_ALGO_HAMMING; in socrates_attach_chip()
134 * Probe for the NAND device.
144 host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); in socrates_nand_probe()
146 return -ENOMEM; in socrates_nand_probe()
148 host->io_base = of_iomap(ofdev->dev.of_node, 0); in socrates_nand_probe()
149 if (host->io_base == NULL) { in socrates_nand_probe()
150 dev_err(&ofdev->dev, "ioremap failed\n"); in socrates_nand_probe()
151 return -EIO; in socrates_nand_probe()
154 nand_chip = &host->nand_chip; in socrates_nand_probe()
156 host->dev = &ofdev->dev; in socrates_nand_probe()
158 nand_controller_init(&host->controller); in socrates_nand_probe()
159 host->controller.ops = &socrates_ops; in socrates_nand_probe()
160 nand_chip->controller = &host->controller; in socrates_nand_probe()
164 nand_set_flash_node(nand_chip, ofdev->dev.of_node); in socrates_nand_probe()
165 mtd->name = "socrates_nand"; in socrates_nand_probe()
166 mtd->dev.parent = &ofdev->dev; in socrates_nand_probe()
168 nand_chip->legacy.cmd_ctrl = socrates_nand_cmd_ctrl; in socrates_nand_probe()
169 nand_chip->legacy.read_byte = socrates_nand_read_byte; in socrates_nand_probe()
170 nand_chip->legacy.write_buf = socrates_nand_write_buf; in socrates_nand_probe()
171 nand_chip->legacy.read_buf = socrates_nand_read_buf; in socrates_nand_probe()
172 nand_chip->legacy.dev_ready = socrates_nand_device_ready; in socrates_nand_probe()
175 nand_chip->legacy.chip_delay = 20; /* 20us command delay time */ in socrates_nand_probe()
178 * This driver assumes that the default ECC engine should be TYPE_SOFT. in socrates_nand_probe()
179 * Set ->engine_type before registering the NAND devices in order to in socrates_nand_probe()
182 nand_chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; in socrates_nand_probe()
184 dev_set_drvdata(&ofdev->dev, host); in socrates_nand_probe()
197 iounmap(host->io_base); in socrates_nand_probe()
202 * Remove a NAND device.
206 struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev); in socrates_nand_remove()
207 struct nand_chip *chip = &host->nand_chip; in socrates_nand_remove()
214 iounmap(host->io_base); in socrates_nand_remove()
222 .compatible = "abb,socrates-nand",
242 MODULE_DESCRIPTION("NAND driver for Socrates board");