| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright © 2004-2008 Simtec Electronics |
|---|
| 3 | 4 | * http://armlinux.simtec.co.uk/ |
|---|
| 4 | 5 | * Ben Dooks <ben@simtec.co.uk> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Samsung S3C2410/S3C2440/S3C2412 NAND driver |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #define pr_fmt(fmt) "nand-s3c2410: " fmt |
|---|
| .. | .. |
|---|
| 304 | 291 | int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4; |
|---|
| 305 | 292 | int tacls, twrph0, twrph1; |
|---|
| 306 | 293 | unsigned long clkrate = clk_get_rate(info->clk); |
|---|
| 307 | | - unsigned long uninitialized_var(set), cfg, uninitialized_var(mask); |
|---|
| 294 | + unsigned long set, cfg, mask; |
|---|
| 308 | 295 | unsigned long flags; |
|---|
| 309 | 296 | |
|---|
| 310 | 297 | /* calculate the timing information for the controller */ |
|---|
| .. | .. |
|---|
| 404 | 391 | |
|---|
| 405 | 392 | /** |
|---|
| 406 | 393 | * s3c2410_nand_select_chip - select the given nand chip |
|---|
| 407 | | - * @mtd: The MTD instance for this chip. |
|---|
| 394 | + * @this: NAND chip object. |
|---|
| 408 | 395 | * @chip: The chip number. |
|---|
| 409 | 396 | * |
|---|
| 410 | 397 | * This is called by the MTD layer to either select a given chip for the |
|---|
| .. | .. |
|---|
| 415 | 402 | * platform specific selection code is called to route nFCE to the specific |
|---|
| 416 | 403 | * chip. |
|---|
| 417 | 404 | */ |
|---|
| 418 | | -static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) |
|---|
| 405 | +static void s3c2410_nand_select_chip(struct nand_chip *this, int chip) |
|---|
| 419 | 406 | { |
|---|
| 420 | 407 | struct s3c2410_nand_info *info; |
|---|
| 421 | 408 | struct s3c2410_nand_mtd *nmtd; |
|---|
| 422 | | - struct nand_chip *this = mtd_to_nand(mtd); |
|---|
| 423 | 409 | unsigned long cur; |
|---|
| 424 | 410 | |
|---|
| 425 | 411 | nmtd = nand_get_controller_data(this); |
|---|
| .. | .. |
|---|
| 457 | 443 | * Issue command and address cycles to the chip |
|---|
| 458 | 444 | */ |
|---|
| 459 | 445 | |
|---|
| 460 | | -static void s3c2410_nand_hwcontrol(struct mtd_info *mtd, int cmd, |
|---|
| 446 | +static void s3c2410_nand_hwcontrol(struct nand_chip *chip, int cmd, |
|---|
| 461 | 447 | unsigned int ctrl) |
|---|
| 462 | 448 | { |
|---|
| 449 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 463 | 450 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 464 | 451 | |
|---|
| 465 | 452 | if (cmd == NAND_CMD_NONE) |
|---|
| .. | .. |
|---|
| 473 | 460 | |
|---|
| 474 | 461 | /* command and control functions */ |
|---|
| 475 | 462 | |
|---|
| 476 | | -static void s3c2440_nand_hwcontrol(struct mtd_info *mtd, int cmd, |
|---|
| 463 | +static void s3c2440_nand_hwcontrol(struct nand_chip *chip, int cmd, |
|---|
| 477 | 464 | unsigned int ctrl) |
|---|
| 478 | 465 | { |
|---|
| 466 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 479 | 467 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 480 | 468 | |
|---|
| 481 | 469 | if (cmd == NAND_CMD_NONE) |
|---|
| .. | .. |
|---|
| 492 | 480 | * returns 0 if the nand is busy, 1 if it is ready |
|---|
| 493 | 481 | */ |
|---|
| 494 | 482 | |
|---|
| 495 | | -static int s3c2410_nand_devready(struct mtd_info *mtd) |
|---|
| 483 | +static int s3c2410_nand_devready(struct nand_chip *chip) |
|---|
| 496 | 484 | { |
|---|
| 485 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 497 | 486 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 498 | 487 | return readb(info->regs + S3C2410_NFSTAT) & S3C2410_NFSTAT_BUSY; |
|---|
| 499 | 488 | } |
|---|
| 500 | 489 | |
|---|
| 501 | | -static int s3c2440_nand_devready(struct mtd_info *mtd) |
|---|
| 490 | +static int s3c2440_nand_devready(struct nand_chip *chip) |
|---|
| 502 | 491 | { |
|---|
| 492 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 503 | 493 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 504 | 494 | return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY; |
|---|
| 505 | 495 | } |
|---|
| 506 | 496 | |
|---|
| 507 | | -static int s3c2412_nand_devready(struct mtd_info *mtd) |
|---|
| 497 | +static int s3c2412_nand_devready(struct nand_chip *chip) |
|---|
| 508 | 498 | { |
|---|
| 499 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 509 | 500 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 510 | 501 | return readb(info->regs + S3C2412_NFSTAT) & S3C2412_NFSTAT_READY; |
|---|
| 511 | 502 | } |
|---|
| 512 | 503 | |
|---|
| 513 | 504 | /* ECC handling functions */ |
|---|
| 514 | 505 | |
|---|
| 515 | | -static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat, |
|---|
| 506 | +static int s3c2410_nand_correct_data(struct nand_chip *chip, u_char *dat, |
|---|
| 516 | 507 | u_char *read_ecc, u_char *calc_ecc) |
|---|
| 517 | 508 | { |
|---|
| 509 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 518 | 510 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 519 | 511 | unsigned int diff0, diff1, diff2; |
|---|
| 520 | 512 | unsigned int bit, byte; |
|---|
| .. | .. |
|---|
| 591 | 583 | * generator block to ECC the data as it passes through] |
|---|
| 592 | 584 | */ |
|---|
| 593 | 585 | |
|---|
| 594 | | -static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode) |
|---|
| 586 | +static void s3c2410_nand_enable_hwecc(struct nand_chip *chip, int mode) |
|---|
| 595 | 587 | { |
|---|
| 596 | | - struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 588 | + struct s3c2410_nand_info *info; |
|---|
| 597 | 589 | unsigned long ctrl; |
|---|
| 598 | 590 | |
|---|
| 591 | + info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip)); |
|---|
| 599 | 592 | ctrl = readl(info->regs + S3C2410_NFCONF); |
|---|
| 600 | 593 | ctrl |= S3C2410_NFCONF_INITECC; |
|---|
| 601 | 594 | writel(ctrl, info->regs + S3C2410_NFCONF); |
|---|
| 602 | 595 | } |
|---|
| 603 | 596 | |
|---|
| 604 | | -static void s3c2412_nand_enable_hwecc(struct mtd_info *mtd, int mode) |
|---|
| 597 | +static void s3c2412_nand_enable_hwecc(struct nand_chip *chip, int mode) |
|---|
| 605 | 598 | { |
|---|
| 606 | | - struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 599 | + struct s3c2410_nand_info *info; |
|---|
| 607 | 600 | unsigned long ctrl; |
|---|
| 608 | 601 | |
|---|
| 602 | + info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip)); |
|---|
| 609 | 603 | ctrl = readl(info->regs + S3C2440_NFCONT); |
|---|
| 610 | 604 | writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC, |
|---|
| 611 | 605 | info->regs + S3C2440_NFCONT); |
|---|
| 612 | 606 | } |
|---|
| 613 | 607 | |
|---|
| 614 | | -static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode) |
|---|
| 608 | +static void s3c2440_nand_enable_hwecc(struct nand_chip *chip, int mode) |
|---|
| 615 | 609 | { |
|---|
| 616 | | - struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 610 | + struct s3c2410_nand_info *info; |
|---|
| 617 | 611 | unsigned long ctrl; |
|---|
| 618 | 612 | |
|---|
| 613 | + info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip)); |
|---|
| 619 | 614 | ctrl = readl(info->regs + S3C2440_NFCONT); |
|---|
| 620 | 615 | writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT); |
|---|
| 621 | 616 | } |
|---|
| 622 | 617 | |
|---|
| 623 | | -static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, |
|---|
| 624 | | - u_char *ecc_code) |
|---|
| 618 | +static int s3c2410_nand_calculate_ecc(struct nand_chip *chip, |
|---|
| 619 | + const u_char *dat, u_char *ecc_code) |
|---|
| 625 | 620 | { |
|---|
| 621 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 626 | 622 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 627 | 623 | |
|---|
| 628 | 624 | ecc_code[0] = readb(info->regs + S3C2410_NFECC + 0); |
|---|
| .. | .. |
|---|
| 634 | 630 | return 0; |
|---|
| 635 | 631 | } |
|---|
| 636 | 632 | |
|---|
| 637 | | -static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, |
|---|
| 638 | | - u_char *ecc_code) |
|---|
| 633 | +static int s3c2412_nand_calculate_ecc(struct nand_chip *chip, |
|---|
| 634 | + const u_char *dat, u_char *ecc_code) |
|---|
| 639 | 635 | { |
|---|
| 636 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 640 | 637 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 641 | 638 | unsigned long ecc = readl(info->regs + S3C2412_NFMECC0); |
|---|
| 642 | 639 | |
|---|
| .. | .. |
|---|
| 649 | 646 | return 0; |
|---|
| 650 | 647 | } |
|---|
| 651 | 648 | |
|---|
| 652 | | -static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, |
|---|
| 653 | | - u_char *ecc_code) |
|---|
| 649 | +static int s3c2440_nand_calculate_ecc(struct nand_chip *chip, |
|---|
| 650 | + const u_char *dat, u_char *ecc_code) |
|---|
| 654 | 651 | { |
|---|
| 652 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 655 | 653 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 656 | 654 | unsigned long ecc = readl(info->regs + S3C2440_NFMECC0); |
|---|
| 657 | 655 | |
|---|
| .. | .. |
|---|
| 668 | 666 | * use read/write block to move the data buffers to/from the controller |
|---|
| 669 | 667 | */ |
|---|
| 670 | 668 | |
|---|
| 671 | | -static void s3c2410_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) |
|---|
| 669 | +static void s3c2410_nand_read_buf(struct nand_chip *this, u_char *buf, int len) |
|---|
| 672 | 670 | { |
|---|
| 673 | | - struct nand_chip *this = mtd_to_nand(mtd); |
|---|
| 674 | | - readsb(this->IO_ADDR_R, buf, len); |
|---|
| 671 | + readsb(this->legacy.IO_ADDR_R, buf, len); |
|---|
| 675 | 672 | } |
|---|
| 676 | 673 | |
|---|
| 677 | | -static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) |
|---|
| 674 | +static void s3c2440_nand_read_buf(struct nand_chip *this, u_char *buf, int len) |
|---|
| 678 | 675 | { |
|---|
| 676 | + struct mtd_info *mtd = nand_to_mtd(this); |
|---|
| 679 | 677 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 680 | 678 | |
|---|
| 681 | 679 | readsl(info->regs + S3C2440_NFDATA, buf, len >> 2); |
|---|
| .. | .. |
|---|
| 689 | 687 | } |
|---|
| 690 | 688 | } |
|---|
| 691 | 689 | |
|---|
| 692 | | -static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, |
|---|
| 690 | +static void s3c2410_nand_write_buf(struct nand_chip *this, const u_char *buf, |
|---|
| 693 | 691 | int len) |
|---|
| 694 | 692 | { |
|---|
| 695 | | - struct nand_chip *this = mtd_to_nand(mtd); |
|---|
| 696 | | - writesb(this->IO_ADDR_W, buf, len); |
|---|
| 693 | + writesb(this->legacy.IO_ADDR_W, buf, len); |
|---|
| 697 | 694 | } |
|---|
| 698 | 695 | |
|---|
| 699 | | -static void s3c2440_nand_write_buf(struct mtd_info *mtd, const u_char *buf, |
|---|
| 696 | +static void s3c2440_nand_write_buf(struct nand_chip *this, const u_char *buf, |
|---|
| 700 | 697 | int len) |
|---|
| 701 | 698 | { |
|---|
| 699 | + struct mtd_info *mtd = nand_to_mtd(this); |
|---|
| 702 | 700 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 703 | 701 | |
|---|
| 704 | 702 | writesl(info->regs + S3C2440_NFDATA, buf, len >> 2); |
|---|
| .. | .. |
|---|
| 781 | 779 | |
|---|
| 782 | 780 | for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) { |
|---|
| 783 | 781 | pr_debug("releasing mtd %d (%p)\n", mtdno, ptr); |
|---|
| 784 | | - nand_release(&ptr->chip); |
|---|
| 782 | + WARN_ON(mtd_device_unregister(nand_to_mtd(&ptr->chip))); |
|---|
| 783 | + nand_cleanup(&ptr->chip); |
|---|
| 785 | 784 | } |
|---|
| 786 | 785 | } |
|---|
| 787 | 786 | |
|---|
| .. | .. |
|---|
| 809 | 808 | return -ENODEV; |
|---|
| 810 | 809 | } |
|---|
| 811 | 810 | |
|---|
| 812 | | -static int s3c2410_nand_setup_data_interface(struct mtd_info *mtd, int csline, |
|---|
| 813 | | - const struct nand_data_interface *conf) |
|---|
| 811 | +static int s3c2410_nand_setup_interface(struct nand_chip *chip, int csline, |
|---|
| 812 | + const struct nand_interface_config *conf) |
|---|
| 814 | 813 | { |
|---|
| 814 | + struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 815 | 815 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 816 | 816 | struct s3c2410_platform_nand *pdata = info->platform; |
|---|
| 817 | 817 | const struct nand_sdr_timings *timings; |
|---|
| .. | .. |
|---|
| 852 | 852 | |
|---|
| 853 | 853 | nand_set_flash_node(chip, set->of_node); |
|---|
| 854 | 854 | |
|---|
| 855 | | - chip->write_buf = s3c2410_nand_write_buf; |
|---|
| 856 | | - chip->read_buf = s3c2410_nand_read_buf; |
|---|
| 857 | | - chip->select_chip = s3c2410_nand_select_chip; |
|---|
| 858 | | - chip->chip_delay = 50; |
|---|
| 855 | + chip->legacy.write_buf = s3c2410_nand_write_buf; |
|---|
| 856 | + chip->legacy.read_buf = s3c2410_nand_read_buf; |
|---|
| 857 | + chip->legacy.select_chip = s3c2410_nand_select_chip; |
|---|
| 858 | + chip->legacy.chip_delay = 50; |
|---|
| 859 | 859 | nand_set_controller_data(chip, nmtd); |
|---|
| 860 | 860 | chip->options = set->options; |
|---|
| 861 | 861 | chip->controller = &info->controller; |
|---|
| .. | .. |
|---|
| 864 | 864 | * let's keep behavior unchanged for legacy boards booting via pdata and |
|---|
| 865 | 865 | * auto-detect timings only when booting with a device tree. |
|---|
| 866 | 866 | */ |
|---|
| 867 | | - if (np) |
|---|
| 868 | | - chip->setup_data_interface = s3c2410_nand_setup_data_interface; |
|---|
| 867 | + if (!np) |
|---|
| 868 | + chip->options |= NAND_KEEP_TIMINGS; |
|---|
| 869 | 869 | |
|---|
| 870 | 870 | switch (info->cpu_type) { |
|---|
| 871 | 871 | case TYPE_S3C2410: |
|---|
| 872 | | - chip->IO_ADDR_W = regs + S3C2410_NFDATA; |
|---|
| 872 | + chip->legacy.IO_ADDR_W = regs + S3C2410_NFDATA; |
|---|
| 873 | 873 | info->sel_reg = regs + S3C2410_NFCONF; |
|---|
| 874 | 874 | info->sel_bit = S3C2410_NFCONF_nFCE; |
|---|
| 875 | | - chip->cmd_ctrl = s3c2410_nand_hwcontrol; |
|---|
| 876 | | - chip->dev_ready = s3c2410_nand_devready; |
|---|
| 875 | + chip->legacy.cmd_ctrl = s3c2410_nand_hwcontrol; |
|---|
| 876 | + chip->legacy.dev_ready = s3c2410_nand_devready; |
|---|
| 877 | 877 | break; |
|---|
| 878 | 878 | |
|---|
| 879 | 879 | case TYPE_S3C2440: |
|---|
| 880 | | - chip->IO_ADDR_W = regs + S3C2440_NFDATA; |
|---|
| 880 | + chip->legacy.IO_ADDR_W = regs + S3C2440_NFDATA; |
|---|
| 881 | 881 | info->sel_reg = regs + S3C2440_NFCONT; |
|---|
| 882 | 882 | info->sel_bit = S3C2440_NFCONT_nFCE; |
|---|
| 883 | | - chip->cmd_ctrl = s3c2440_nand_hwcontrol; |
|---|
| 884 | | - chip->dev_ready = s3c2440_nand_devready; |
|---|
| 885 | | - chip->read_buf = s3c2440_nand_read_buf; |
|---|
| 886 | | - chip->write_buf = s3c2440_nand_write_buf; |
|---|
| 883 | + chip->legacy.cmd_ctrl = s3c2440_nand_hwcontrol; |
|---|
| 884 | + chip->legacy.dev_ready = s3c2440_nand_devready; |
|---|
| 885 | + chip->legacy.read_buf = s3c2440_nand_read_buf; |
|---|
| 886 | + chip->legacy.write_buf = s3c2440_nand_write_buf; |
|---|
| 887 | 887 | break; |
|---|
| 888 | 888 | |
|---|
| 889 | 889 | case TYPE_S3C2412: |
|---|
| 890 | | - chip->IO_ADDR_W = regs + S3C2440_NFDATA; |
|---|
| 890 | + chip->legacy.IO_ADDR_W = regs + S3C2440_NFDATA; |
|---|
| 891 | 891 | info->sel_reg = regs + S3C2440_NFCONT; |
|---|
| 892 | 892 | info->sel_bit = S3C2412_NFCONT_nFCE0; |
|---|
| 893 | | - chip->cmd_ctrl = s3c2440_nand_hwcontrol; |
|---|
| 894 | | - chip->dev_ready = s3c2412_nand_devready; |
|---|
| 893 | + chip->legacy.cmd_ctrl = s3c2440_nand_hwcontrol; |
|---|
| 894 | + chip->legacy.dev_ready = s3c2412_nand_devready; |
|---|
| 895 | 895 | |
|---|
| 896 | 896 | if (readl(regs + S3C2410_NFCONF) & S3C2412_NFCONF_NANDBOOT) |
|---|
| 897 | 897 | dev_info(info->device, "System booted from NAND\n"); |
|---|
| .. | .. |
|---|
| 899 | 899 | break; |
|---|
| 900 | 900 | } |
|---|
| 901 | 901 | |
|---|
| 902 | | - chip->IO_ADDR_R = chip->IO_ADDR_W; |
|---|
| 902 | + chip->legacy.IO_ADDR_R = chip->legacy.IO_ADDR_W; |
|---|
| 903 | 903 | |
|---|
| 904 | 904 | nmtd->info = info; |
|---|
| 905 | 905 | nmtd->set = set; |
|---|
| 906 | 906 | |
|---|
| 907 | | - chip->ecc.mode = info->platform->ecc_mode; |
|---|
| 907 | + chip->ecc.engine_type = info->platform->engine_type; |
|---|
| 908 | 908 | |
|---|
| 909 | 909 | /* |
|---|
| 910 | 910 | * If you use u-boot BBT creation code, specifying this flag will |
|---|
| .. | .. |
|---|
| 929 | 929 | struct mtd_info *mtd = nand_to_mtd(chip); |
|---|
| 930 | 930 | struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); |
|---|
| 931 | 931 | |
|---|
| 932 | | - switch (chip->ecc.mode) { |
|---|
| 932 | + switch (chip->ecc.engine_type) { |
|---|
| 933 | 933 | |
|---|
| 934 | | - case NAND_ECC_NONE: |
|---|
| 934 | + case NAND_ECC_ENGINE_TYPE_NONE: |
|---|
| 935 | 935 | dev_info(info->device, "ECC disabled\n"); |
|---|
| 936 | 936 | break; |
|---|
| 937 | 937 | |
|---|
| 938 | | - case NAND_ECC_SOFT: |
|---|
| 938 | + case NAND_ECC_ENGINE_TYPE_SOFT: |
|---|
| 939 | 939 | /* |
|---|
| 940 | | - * This driver expects Hamming based ECC when ecc_mode is set |
|---|
| 941 | | - * to NAND_ECC_SOFT. Force ecc.algo to NAND_ECC_HAMMING to |
|---|
| 942 | | - * avoid adding an extra ecc_algo field to |
|---|
| 943 | | - * s3c2410_platform_nand. |
|---|
| 940 | + * This driver expects Hamming based ECC when engine_type is set |
|---|
| 941 | + * to NAND_ECC_ENGINE_TYPE_SOFT. Force ecc.algo to |
|---|
| 942 | + * NAND_ECC_ALGO_HAMMING to avoid adding an extra ecc_algo field |
|---|
| 943 | + * to s3c2410_platform_nand. |
|---|
| 944 | 944 | */ |
|---|
| 945 | | - chip->ecc.algo = NAND_ECC_HAMMING; |
|---|
| 945 | + chip->ecc.algo = NAND_ECC_ALGO_HAMMING; |
|---|
| 946 | 946 | dev_info(info->device, "soft ECC\n"); |
|---|
| 947 | 947 | break; |
|---|
| 948 | 948 | |
|---|
| 949 | | - case NAND_ECC_HW: |
|---|
| 949 | + case NAND_ECC_ENGINE_TYPE_ON_HOST: |
|---|
| 950 | 950 | chip->ecc.calculate = s3c2410_nand_calculate_ecc; |
|---|
| 951 | 951 | chip->ecc.correct = s3c2410_nand_correct_data; |
|---|
| 952 | 952 | chip->ecc.strength = 1; |
|---|
| .. | .. |
|---|
| 999 | 999 | |
|---|
| 1000 | 1000 | static const struct nand_controller_ops s3c24xx_nand_controller_ops = { |
|---|
| 1001 | 1001 | .attach_chip = s3c2410_nand_attach_chip, |
|---|
| 1002 | + .setup_interface = s3c2410_nand_setup_interface, |
|---|
| 1002 | 1003 | }; |
|---|
| 1003 | 1004 | |
|---|
| 1004 | 1005 | static const struct of_device_id s3c24xx_nand_dt_ids[] = { |
|---|