mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
OneNAND: Fill in MTD function pointers for OneNAND.
onenand_print_device_info(): - Now returns a string to be placed in mtd->name, rather than calling printf. - Remove verbose parameter as it becomes useless. Signed-off-by: Fathi Boudra <fabo@debian.org> Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
aa646643b6
commit
195ccfc599
3 changed files with 20 additions and 8 deletions
|
@ -38,7 +38,7 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||||
onenand_init();
|
onenand_init();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
onenand_print_device_info(onenand_chip.device_id, 1);
|
printf("%s\n", onenand_mtd.name);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/errno.h>
|
#include <asm/errno.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
/* It should access 16-bit instead of 8-bit */
|
/* It should access 16-bit instead of 8-bit */
|
||||||
static inline void *memcpy_16(void *dst, const void *src, unsigned int len)
|
static inline void *memcpy_16(void *dst, const void *src, unsigned int len)
|
||||||
|
@ -1110,21 +1111,21 @@ int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
|
||||||
*
|
*
|
||||||
* Print device ID
|
* Print device ID
|
||||||
*/
|
*/
|
||||||
void onenand_print_device_info(int device, int verbose)
|
char * onenand_print_device_info(int device)
|
||||||
{
|
{
|
||||||
int vcc, demuxed, ddp, density;
|
int vcc, demuxed, ddp, density;
|
||||||
|
char *dev_info = malloc(80);
|
||||||
if (!verbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
vcc = device & ONENAND_DEVICE_VCC_MASK;
|
vcc = device & ONENAND_DEVICE_VCC_MASK;
|
||||||
demuxed = device & ONENAND_DEVICE_IS_DEMUX;
|
demuxed = device & ONENAND_DEVICE_IS_DEMUX;
|
||||||
ddp = device & ONENAND_DEVICE_IS_DDP;
|
ddp = device & ONENAND_DEVICE_IS_DDP;
|
||||||
density = device >> ONENAND_DEVICE_DENSITY_SHIFT;
|
density = device >> ONENAND_DEVICE_DENSITY_SHIFT;
|
||||||
printk(KERN_INFO "%sOneNAND%s %dMB %sV 16-bit (0x%02x)\n",
|
sprintf(dev_info, "%sOneNAND%s %dMB %sV 16-bit (0x%02x)",
|
||||||
demuxed ? "" : "Muxed ",
|
demuxed ? "" : "Muxed ",
|
||||||
ddp ? "(DDP)" : "",
|
ddp ? "(DDP)" : "",
|
||||||
(16 << density), vcc ? "2.65/3.3" : "1.8", device);
|
(16 << density), vcc ? "2.65/3.3" : "1.8", device);
|
||||||
|
|
||||||
|
return dev_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct onenand_manufacturers onenand_manuf_ids[] = {
|
static const struct onenand_manufacturers onenand_manuf_ids[] = {
|
||||||
|
@ -1203,7 +1204,7 @@ static int onenand_probe(struct mtd_info *mtd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flash device information */
|
/* Flash device information */
|
||||||
onenand_print_device_info(dev_id, 0);
|
mtd->name = onenand_print_device_info(dev_id);
|
||||||
this->device_id = dev_id;
|
this->device_id = dev_id;
|
||||||
|
|
||||||
density = dev_id >> ONENAND_DEVICE_DENSITY_SHIFT;
|
density = dev_id >> ONENAND_DEVICE_DENSITY_SHIFT;
|
||||||
|
@ -1239,6 +1240,17 @@ static int onenand_probe(struct mtd_info *mtd)
|
||||||
this->options |= ONENAND_CONT_LOCK;
|
this->options |= ONENAND_CONT_LOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtd->erase = onenand_erase;
|
||||||
|
mtd->read = onenand_read;
|
||||||
|
mtd->write = onenand_write;
|
||||||
|
mtd->read_ecc = onenand_read_ecc;
|
||||||
|
mtd->write_ecc = onenand_write_ecc;
|
||||||
|
mtd->read_oob = onenand_read_oob;
|
||||||
|
mtd->write_oob = onenand_write_oob;
|
||||||
|
mtd->sync = onenand_sync;
|
||||||
|
mtd->block_isbad = onenand_block_isbad;
|
||||||
|
mtd->block_markbad = onenand_block_markbad;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,6 @@ extern int onenand_erase(struct mtd_info *mtd, struct erase_info *instr);
|
||||||
|
|
||||||
extern int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len);
|
extern int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len);
|
||||||
|
|
||||||
extern void onenand_print_device_info(int device, int verbose);
|
extern char *onenand_print_device_info(int device);
|
||||||
|
|
||||||
#endif /* __UBOOT_ONENAND_H */
|
#endif /* __UBOOT_ONENAND_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue