diff options
author | Chuanxiao Dong <chuanxiao.dong@intel.com> | 2010-08-06 06:19:09 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-06 11:30:26 -0400 |
commit | 08b9ab9996c7e582f86da319f43d2dcb8ff55993 (patch) | |
tree | de127bcf41c849449ecef88fae8b226f0e2f61fd /drivers/mtd/nand | |
parent | db9a321049ead6424848b1040a714290d5df39d7 (diff) |
mtd: denali: Add multi connected NAND support
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/denali.c | 22 | ||||
-rw-r--r-- | drivers/mtd/nand/denali.h | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index f20d1b14ea1d..1422edda3e71 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c | |||
@@ -1677,6 +1677,25 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1677 | goto failed_nand; | 1677 | goto failed_nand; |
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | /* support for multi nand | ||
1681 | * MTD known nothing about multi nand, | ||
1682 | * so we should tell it the real pagesize | ||
1683 | * and anything necessery | ||
1684 | */ | ||
1685 | denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED); | ||
1686 | denali->nand.chipsize <<= (denali->devnum - 1); | ||
1687 | denali->nand.page_shift += (denali->devnum - 1); | ||
1688 | denali->nand.pagemask = (denali->nand.chipsize >> | ||
1689 | denali->nand.page_shift) - 1; | ||
1690 | denali->nand.bbt_erase_shift += (denali->devnum - 1); | ||
1691 | denali->nand.phys_erase_shift = denali->nand.bbt_erase_shift; | ||
1692 | denali->nand.chip_shift += (denali->devnum - 1); | ||
1693 | denali->mtd.writesize <<= (denali->devnum - 1); | ||
1694 | denali->mtd.oobsize <<= (denali->devnum - 1); | ||
1695 | denali->mtd.erasesize <<= (denali->devnum - 1); | ||
1696 | denali->mtd.size = denali->nand.numchips * denali->nand.chipsize; | ||
1697 | denali->bbtskipbytes *= denali->devnum; | ||
1698 | |||
1680 | /* second stage of the NAND scan | 1699 | /* second stage of the NAND scan |
1681 | * this stage requires information regarding ECC and | 1700 | * this stage requires information regarding ECC and |
1682 | * bad block management. */ | 1701 | * bad block management. */ |
@@ -1713,6 +1732,7 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1713 | denali_write32(8, denali->flash_reg + ECC_CORRECTION); | 1732 | denali_write32(8, denali->flash_reg + ECC_CORRECTION); |
1714 | } | 1733 | } |
1715 | 1734 | ||
1735 | denali->nand.ecc.bytes *= denali->devnum; | ||
1716 | denali->nand.ecc.layout->eccbytes *= | 1736 | denali->nand.ecc.layout->eccbytes *= |
1717 | denali->mtd.writesize / ECC_SECTOR_SIZE; | 1737 | denali->mtd.writesize / ECC_SECTOR_SIZE; |
1718 | denali->nand.ecc.layout->oobfree[0].offset = | 1738 | denali->nand.ecc.layout->oobfree[0].offset = |
@@ -1738,7 +1758,7 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1738 | denali->nand.ecc.hwctl = denali_ecc_hwctl; | 1758 | denali->nand.ecc.hwctl = denali_ecc_hwctl; |
1739 | 1759 | ||
1740 | /* override the default read operations */ | 1760 | /* override the default read operations */ |
1741 | denali->nand.ecc.size = denali->mtd.writesize; | 1761 | denali->nand.ecc.size = ECC_SECTOR_SIZE * denali->devnum; |
1742 | denali->nand.ecc.read_page = denali_read_page; | 1762 | denali->nand.ecc.read_page = denali_read_page; |
1743 | denali->nand.ecc.read_page_raw = denali_read_page_raw; | 1763 | denali->nand.ecc.read_page_raw = denali_read_page_raw; |
1744 | denali->nand.ecc.write_page = denali_write_page; | 1764 | denali->nand.ecc.write_page = denali_write_page; |
diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index bdf5c2af5000..b680474e6333 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h | |||
@@ -764,6 +764,7 @@ struct denali_nand_info { | |||
764 | int irq_debug_array[32]; | 764 | int irq_debug_array[32]; |
765 | int idx; | 765 | int idx; |
766 | 766 | ||
767 | uint32_t devnum; /* represent how many nands connected */ | ||
767 | uint32_t fwblks; /* represent how many blocks FW used */ | 768 | uint32_t fwblks; /* represent how many blocks FW used */ |
768 | uint32_t totalblks; | 769 | uint32_t totalblks; |
769 | uint32_t blksperchip; | 770 | uint32_t blksperchip; |