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>
This commit is contained in:
parent
42b0aab1cc
commit
ad0d363b8f
|
@ -3733,17 +3733,16 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* onenand_probe - [OneNAND Interface] Probe the OneNAND device
|
* onenand_chip_probe - [OneNAND Interface] The generic chip probe
|
||||||
* @param mtd MTD device structure
|
* @param mtd MTD device structure
|
||||||
*
|
*
|
||||||
* OneNAND detection method:
|
* OneNAND detection method:
|
||||||
* Compare the values from command with ones from register
|
* Compare the values from command with ones from register
|
||||||
*/
|
*/
|
||||||
static int onenand_probe(struct mtd_info *mtd)
|
static int onenand_chip_probe(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
struct onenand_chip *this = mtd->priv;
|
struct onenand_chip *this = mtd->priv;
|
||||||
int bram_maf_id, bram_dev_id, maf_id, dev_id, ver_id;
|
int bram_maf_id, bram_dev_id, maf_id, dev_id;
|
||||||
int density;
|
|
||||||
int syscfg;
|
int syscfg;
|
||||||
|
|
||||||
/* Save system configuration 1 */
|
/* Save system configuration 1 */
|
||||||
|
@ -3766,12 +3765,6 @@ static int onenand_probe(struct mtd_info *mtd)
|
||||||
/* Restore system configuration 1 */
|
/* Restore system configuration 1 */
|
||||||
this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
|
this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
|
||||||
|
|
||||||
/* Workaround */
|
|
||||||
if (syscfg & ONENAND_SYS_CFG1_SYNC_WRITE) {
|
|
||||||
bram_maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
|
|
||||||
bram_dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check manufacturer ID */
|
/* Check manufacturer ID */
|
||||||
if (onenand_check_maf(bram_maf_id))
|
if (onenand_check_maf(bram_maf_id))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
@ -3779,13 +3772,35 @@ static int onenand_probe(struct mtd_info *mtd)
|
||||||
/* Read manufacturer and device IDs from Register */
|
/* Read manufacturer and device IDs from Register */
|
||||||
maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
|
maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
|
||||||
dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
|
dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
|
||||||
ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
|
|
||||||
this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
|
|
||||||
|
|
||||||
/* Check OneNAND device */
|
/* Check OneNAND device */
|
||||||
if (maf_id != bram_maf_id || dev_id != bram_dev_id)
|
if (maf_id != bram_maf_id || dev_id != bram_dev_id)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onenand_probe - [OneNAND Interface] Probe the OneNAND device
|
||||||
|
* @param mtd MTD device structure
|
||||||
|
*/
|
||||||
|
static int onenand_probe(struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
struct onenand_chip *this = mtd->priv;
|
||||||
|
int maf_id, dev_id, ver_id;
|
||||||
|
int density;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = this->chip_probe(mtd);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Read manufacturer and device IDs from Register */
|
||||||
|
maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
|
||||||
|
dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
|
||||||
|
ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
|
||||||
|
this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
|
||||||
|
|
||||||
/* Flash device information */
|
/* Flash device information */
|
||||||
onenand_print_device_info(dev_id, ver_id);
|
onenand_print_device_info(dev_id, ver_id);
|
||||||
this->device_id = dev_id;
|
this->device_id = dev_id;
|
||||||
|
@ -3912,6 +3927,9 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
|
||||||
if (!this->unlock_all)
|
if (!this->unlock_all)
|
||||||
this->unlock_all = onenand_unlock_all;
|
this->unlock_all = onenand_unlock_all;
|
||||||
|
|
||||||
|
if (!this->chip_probe)
|
||||||
|
this->chip_probe = onenand_chip_probe;
|
||||||
|
|
||||||
if (!this->read_bufferram)
|
if (!this->read_bufferram)
|
||||||
this->read_bufferram = onenand_read_bufferram;
|
this->read_bufferram = onenand_read_bufferram;
|
||||||
if (!this->write_bufferram)
|
if (!this->write_bufferram)
|
||||||
|
|
|
@ -68,6 +68,7 @@ struct onenand_bufferram {
|
||||||
* @write_word: [REPLACEABLE] hardware specific function for write
|
* @write_word: [REPLACEABLE] hardware specific function for write
|
||||||
* register of OneNAND
|
* register of OneNAND
|
||||||
* @mmcontrol: sync burst read function
|
* @mmcontrol: sync burst read function
|
||||||
|
* @chip_probe: [REPLACEABLE] hardware specific function for chip probe
|
||||||
* @block_markbad: function to mark a block as bad
|
* @block_markbad: function to mark a block as bad
|
||||||
* @scan_bbt: [REPLACEALBE] hardware specific function for scanning
|
* @scan_bbt: [REPLACEALBE] hardware specific function for scanning
|
||||||
* Bad block Table
|
* Bad block Table
|
||||||
|
@ -114,6 +115,7 @@ struct onenand_chip {
|
||||||
unsigned short (*read_word)(void __iomem *addr);
|
unsigned short (*read_word)(void __iomem *addr);
|
||||||
void (*write_word)(unsigned short value, void __iomem *addr);
|
void (*write_word)(unsigned short value, void __iomem *addr);
|
||||||
void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
|
void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
|
||||||
|
int (*chip_probe)(struct mtd_info *mtd);
|
||||||
int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
|
int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
|
||||||
int (*scan_bbt)(struct mtd_info *mtd);
|
int (*scan_bbt)(struct mtd_info *mtd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue