aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorKyungmin Park <kmpark@infradead.org>2010-05-27 22:03:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-04 05:51:47 -0400
commitad0d363b8fb7559a410483635349e22de6727988 (patch)
treedafbf0a1958b2334b917733dea32a8c86b4834bc /drivers/mtd/onenand
parent42b0aab1cc30b2fa7e0a99b832bd1b5c9b59757d (diff)
mtd: OneNAND: Introduce chip_probe function
Samsung SoCs use the own OneNAND controler and detect OneNAND chip at power on. To use this feature, introduce the chip_probe function. Also remove workaround for Samsung SoCs. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r--drivers/mtd/onenand/onenand_base.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f749935f3cb5..a2bb520286f8 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3733,17 +3733,16 @@ out:
3733} 3733}
3734 3734
3735/** 3735/**
3736 * onenand_probe - [OneNAND Interface] Probe the OneNAND device 3736 * onenand_chip_probe - [OneNAND Interface] The generic chip probe
3737 * @param mtd MTD device structure 3737 * @param mtd MTD device structure
3738 * 3738 *
3739 * OneNAND detection method: 3739 * OneNAND detection method:
3740 * Compare the values from command with ones from register 3740 * Compare the values from command with ones from register
3741 */ 3741 */
3742static int onenand_probe(struct mtd_info *mtd) 3742static int onenand_chip_probe(struct mtd_info *mtd)
3743{ 3743{
3744 struct onenand_chip *this = mtd->priv; 3744 struct onenand_chip *this = mtd->priv;
3745 int bram_maf_id, bram_dev_id, maf_id, dev_id, ver_id; 3745 int bram_maf_id, bram_dev_id, maf_id, dev_id;
3746 int density;
3747 int syscfg; 3746 int syscfg;
3748 3747
3749 /* Save system configuration 1 */ 3748 /* Save system configuration 1 */
@@ -3766,12 +3765,6 @@ static int onenand_probe(struct mtd_info *mtd)
3766 /* Restore system configuration 1 */ 3765 /* Restore system configuration 1 */
3767 this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1); 3766 this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
3768 3767
3769 /* Workaround */
3770 if (syscfg & ONENAND_SYS_CFG1_SYNC_WRITE) {
3771 bram_maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
3772 bram_dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
3773 }
3774
3775 /* Check manufacturer ID */ 3768 /* Check manufacturer ID */
3776 if (onenand_check_maf(bram_maf_id)) 3769 if (onenand_check_maf(bram_maf_id))
3777 return -ENXIO; 3770 return -ENXIO;
@@ -3779,13 +3772,35 @@ static int onenand_probe(struct mtd_info *mtd)
3779 /* Read manufacturer and device IDs from Register */ 3772 /* Read manufacturer and device IDs from Register */
3780 maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID); 3773 maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
3781 dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID); 3774 dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
3782 ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
3783 this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
3784 3775
3785 /* Check OneNAND device */ 3776 /* Check OneNAND device */
3786 if (maf_id != bram_maf_id || dev_id != bram_dev_id) 3777 if (maf_id != bram_maf_id || dev_id != bram_dev_id)
3787 return -ENXIO; 3778 return -ENXIO;
3788 3779
3780 return 0;
3781}
3782
3783/**
3784 * onenand_probe - [OneNAND Interface] Probe the OneNAND device
3785 * @param mtd MTD device structure
3786 */
3787static int onenand_probe(struct mtd_info *mtd)
3788{
3789 struct onenand_chip *this = mtd->priv;
3790 int maf_id, dev_id, ver_id;
3791 int density;
3792 int ret;
3793
3794 ret = this->chip_probe(mtd);
3795 if (ret)
3796 return ret;
3797
3798 /* Read manufacturer and device IDs from Register */
3799 maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
3800 dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
3801 ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
3802 this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
3803
3789 /* Flash device information */ 3804 /* Flash device information */
3790 onenand_print_device_info(dev_id, ver_id); 3805 onenand_print_device_info(dev_id, ver_id);
3791 this->device_id = dev_id; 3806 this->device_id = dev_id;
@@ -3912,6 +3927,9 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
3912 if (!this->unlock_all) 3927 if (!this->unlock_all)
3913 this->unlock_all = onenand_unlock_all; 3928 this->unlock_all = onenand_unlock_all;
3914 3929
3930 if (!this->chip_probe)
3931 this->chip_probe = onenand_chip_probe;
3932
3915 if (!this->read_bufferram) 3933 if (!this->read_bufferram)
3916 this->read_bufferram = onenand_read_bufferram; 3934 this->read_bufferram = onenand_read_bufferram;
3917 if (!this->write_bufferram) 3935 if (!this->write_bufferram)