diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2013-08-12 13:14:54 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2013-08-30 16:34:58 -0400 |
commit | ec82135a011cf657ef02cfa2038331b381e39960 (patch) | |
tree | 01460137413d894a4e20395a457db3bbf791004f /drivers/mtd | |
parent | f455578dd961087a5cf94730d9f6489bb1d355f0 (diff) |
mtd: nand: pxa3xx: Remove unneeded internal cmdset
Use the defined macros for NAND command instead of using a constant
internal structure. This commit is only a cleanup, there's no
functionality modification.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 63 |
1 files changed, 17 insertions, 46 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 8757491d19d1..ad63e8c02fd8 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -131,7 +131,6 @@ enum pxa3xx_nand_variant { | |||
131 | 131 | ||
132 | struct pxa3xx_nand_host { | 132 | struct pxa3xx_nand_host { |
133 | struct nand_chip chip; | 133 | struct nand_chip chip; |
134 | struct pxa3xx_nand_cmdset *cmdset; | ||
135 | struct mtd_info *mtd; | 134 | struct mtd_info *mtd; |
136 | void *info_data; | 135 | void *info_data; |
137 | 136 | ||
@@ -205,23 +204,6 @@ static bool use_dma = 1; | |||
205 | module_param(use_dma, bool, 0444); | 204 | module_param(use_dma, bool, 0444); |
206 | MODULE_PARM_DESC(use_dma, "enable DMA for data transferring to/from NAND HW"); | 205 | MODULE_PARM_DESC(use_dma, "enable DMA for data transferring to/from NAND HW"); |
207 | 206 | ||
208 | /* | ||
209 | * Default NAND flash controller configuration setup by the | ||
210 | * bootloader. This configuration is used only when pdata->keep_config is set | ||
211 | */ | ||
212 | static struct pxa3xx_nand_cmdset default_cmdset = { | ||
213 | .read1 = 0x3000, | ||
214 | .read2 = 0x0050, | ||
215 | .program = 0x1080, | ||
216 | .read_status = 0x0070, | ||
217 | .read_id = 0x0090, | ||
218 | .erase = 0xD060, | ||
219 | .reset = 0x00FF, | ||
220 | .lock = 0x002A, | ||
221 | .unlock = 0x2423, | ||
222 | .lock_status = 0x007A, | ||
223 | }; | ||
224 | |||
225 | static struct pxa3xx_nand_timing timing[] = { | 207 | static struct pxa3xx_nand_timing timing[] = { |
226 | { 40, 80, 60, 100, 80, 100, 90000, 400, 40, }, | 208 | { 40, 80, 60, 100, 80, 100, 90000, 400, 40, }, |
227 | { 10, 0, 20, 40, 30, 40, 11123, 110, 10, }, | 209 | { 10, 0, 20, 40, 30, 40, 11123, 110, 10, }, |
@@ -530,7 +512,6 @@ static inline int is_buf_blank(uint8_t *buf, size_t len) | |||
530 | static int prepare_command_pool(struct pxa3xx_nand_info *info, int command, | 512 | static int prepare_command_pool(struct pxa3xx_nand_info *info, int command, |
531 | uint16_t column, int page_addr) | 513 | uint16_t column, int page_addr) |
532 | { | 514 | { |
533 | uint16_t cmd; | ||
534 | int addr_cycle, exec_cmd; | 515 | int addr_cycle, exec_cmd; |
535 | struct pxa3xx_nand_host *host; | 516 | struct pxa3xx_nand_host *host; |
536 | struct mtd_info *mtd; | 517 | struct mtd_info *mtd; |
@@ -580,21 +561,17 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command, | |||
580 | switch (command) { | 561 | switch (command) { |
581 | case NAND_CMD_READOOB: | 562 | case NAND_CMD_READOOB: |
582 | case NAND_CMD_READ0: | 563 | case NAND_CMD_READ0: |
583 | cmd = host->cmdset->read1; | 564 | info->buf_start = column; |
565 | info->ndcb0 |= NDCB0_CMD_TYPE(0) | ||
566 | | addr_cycle | ||
567 | | NAND_CMD_READ0; | ||
568 | |||
584 | if (command == NAND_CMD_READOOB) | 569 | if (command == NAND_CMD_READOOB) |
585 | info->buf_start = mtd->writesize + column; | 570 | info->buf_start += mtd->writesize; |
586 | else | ||
587 | info->buf_start = column; | ||
588 | 571 | ||
589 | if (unlikely(host->page_size < PAGE_CHUNK_SIZE)) | 572 | /* Second command setting for large pages */ |
590 | info->ndcb0 |= NDCB0_CMD_TYPE(0) | 573 | if (host->page_size >= PAGE_CHUNK_SIZE) |
591 | | addr_cycle | 574 | info->ndcb0 |= NDCB0_DBC | (NAND_CMD_READSTART << 8); |
592 | | (cmd & NDCB0_CMD1_MASK); | ||
593 | else | ||
594 | info->ndcb0 |= NDCB0_CMD_TYPE(0) | ||
595 | | NDCB0_DBC | ||
596 | | addr_cycle | ||
597 | | cmd; | ||
598 | 575 | ||
599 | case NAND_CMD_SEQIN: | 576 | case NAND_CMD_SEQIN: |
600 | /* small page addr setting */ | 577 | /* small page addr setting */ |
@@ -625,62 +602,58 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command, | |||
625 | break; | 602 | break; |
626 | } | 603 | } |
627 | 604 | ||
628 | cmd = host->cmdset->program; | ||
629 | info->ndcb0 |= NDCB0_CMD_TYPE(0x1) | 605 | info->ndcb0 |= NDCB0_CMD_TYPE(0x1) |
630 | | NDCB0_AUTO_RS | 606 | | NDCB0_AUTO_RS |
631 | | NDCB0_ST_ROW_EN | 607 | | NDCB0_ST_ROW_EN |
632 | | NDCB0_DBC | 608 | | NDCB0_DBC |
633 | | cmd | 609 | | (NAND_CMD_PAGEPROG << 8) |
610 | | NAND_CMD_SEQIN | ||
634 | | addr_cycle; | 611 | | addr_cycle; |
635 | break; | 612 | break; |
636 | 613 | ||
637 | case NAND_CMD_PARAM: | 614 | case NAND_CMD_PARAM: |
638 | cmd = NAND_CMD_PARAM; | ||
639 | info->buf_count = 256; | 615 | info->buf_count = 256; |
640 | info->ndcb0 |= NDCB0_CMD_TYPE(0) | 616 | info->ndcb0 |= NDCB0_CMD_TYPE(0) |
641 | | NDCB0_ADDR_CYC(1) | 617 | | NDCB0_ADDR_CYC(1) |
642 | | NDCB0_LEN_OVRD | 618 | | NDCB0_LEN_OVRD |
643 | | cmd; | 619 | | command; |
644 | info->ndcb1 = (column & 0xFF); | 620 | info->ndcb1 = (column & 0xFF); |
645 | info->ndcb3 = 256; | 621 | info->ndcb3 = 256; |
646 | info->data_size = 256; | 622 | info->data_size = 256; |
647 | break; | 623 | break; |
648 | 624 | ||
649 | case NAND_CMD_READID: | 625 | case NAND_CMD_READID: |
650 | cmd = host->cmdset->read_id; | ||
651 | info->buf_count = host->read_id_bytes; | 626 | info->buf_count = host->read_id_bytes; |
652 | info->ndcb0 |= NDCB0_CMD_TYPE(3) | 627 | info->ndcb0 |= NDCB0_CMD_TYPE(3) |
653 | | NDCB0_ADDR_CYC(1) | 628 | | NDCB0_ADDR_CYC(1) |
654 | | cmd; | 629 | | command; |
655 | info->ndcb1 = (column & 0xFF); | 630 | info->ndcb1 = (column & 0xFF); |
656 | 631 | ||
657 | info->data_size = 8; | 632 | info->data_size = 8; |
658 | break; | 633 | break; |
659 | case NAND_CMD_STATUS: | 634 | case NAND_CMD_STATUS: |
660 | cmd = host->cmdset->read_status; | ||
661 | info->buf_count = 1; | 635 | info->buf_count = 1; |
662 | info->ndcb0 |= NDCB0_CMD_TYPE(4) | 636 | info->ndcb0 |= NDCB0_CMD_TYPE(4) |
663 | | NDCB0_ADDR_CYC(1) | 637 | | NDCB0_ADDR_CYC(1) |
664 | | cmd; | 638 | | command; |
665 | 639 | ||
666 | info->data_size = 8; | 640 | info->data_size = 8; |
667 | break; | 641 | break; |
668 | 642 | ||
669 | case NAND_CMD_ERASE1: | 643 | case NAND_CMD_ERASE1: |
670 | cmd = host->cmdset->erase; | ||
671 | info->ndcb0 |= NDCB0_CMD_TYPE(2) | 644 | info->ndcb0 |= NDCB0_CMD_TYPE(2) |
672 | | NDCB0_AUTO_RS | 645 | | NDCB0_AUTO_RS |
673 | | NDCB0_ADDR_CYC(3) | 646 | | NDCB0_ADDR_CYC(3) |
674 | | NDCB0_DBC | 647 | | NDCB0_DBC |
675 | | cmd; | 648 | | (NAND_CMD_ERASE2 << 8) |
649 | | NAND_CMD_ERASE1; | ||
676 | info->ndcb1 = page_addr; | 650 | info->ndcb1 = page_addr; |
677 | info->ndcb2 = 0; | 651 | info->ndcb2 = 0; |
678 | 652 | ||
679 | break; | 653 | break; |
680 | case NAND_CMD_RESET: | 654 | case NAND_CMD_RESET: |
681 | cmd = host->cmdset->reset; | ||
682 | info->ndcb0 |= NDCB0_CMD_TYPE(5) | 655 | info->ndcb0 |= NDCB0_CMD_TYPE(5) |
683 | | cmd; | 656 | | command; |
684 | 657 | ||
685 | break; | 658 | break; |
686 | 659 | ||
@@ -876,7 +849,6 @@ static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info, | |||
876 | } | 849 | } |
877 | 850 | ||
878 | /* calculate flash information */ | 851 | /* calculate flash information */ |
879 | host->cmdset = &default_cmdset; | ||
880 | host->page_size = f->page_size; | 852 | host->page_size = f->page_size; |
881 | host->read_id_bytes = (f->page_size == 2048) ? 4 : 2; | 853 | host->read_id_bytes = (f->page_size == 2048) ? 4 : 2; |
882 | 854 | ||
@@ -922,7 +894,6 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
922 | } | 894 | } |
923 | 895 | ||
924 | host->reg_ndcr = ndcr & ~NDCR_INT_MASK; | 896 | host->reg_ndcr = ndcr & ~NDCR_INT_MASK; |
925 | host->cmdset = &default_cmdset; | ||
926 | 897 | ||
927 | host->ndtr0cs0 = nand_readl(info, NDTR0CS0); | 898 | host->ndtr0cs0 = nand_readl(info, NDTR0CS0); |
928 | host->ndtr1cs0 = nand_readl(info, NDTR1CS0); | 899 | host->ndtr1cs0 = nand_readl(info, NDTR1CS0); |