#if (CONFIG_COMMANDS & CFG_CMD_DOC)
#include <linux/mtd/nftl.h>
-#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_legacy.h>
#include <linux/mtd/nand_ids.h>
+
#include <linux/mtd/doc2000.h>
#include <linux/mtd/nftl.h>
cmd ? "read" : "write", curr_device, off, size);
ret = doc_rw(doc_dev_desc + curr_device, cmd, off, size,
- &total, (u_char*)addr);
+ (size_t *)&total, (u_char*)addr);
printf ("%d bytes %s: %s\n", total, cmd ? "read" : "write",
ret ? "ERROR" : "OK");
return rcode;
}
}
-cmd_tbl_t U_BOOT_CMD(DOC) = MK_CMD_ENTRY(
- "doc", 5, 1, do_doc,
+U_BOOT_CMD(
+ doc, 5, 1, do_doc,
"doc - Disk-On-Chip sub-system\n",
"info - show available DOC devices\n"
"doc device [dev] - show or set current device\n"
return rcode;
}
-cmd_tbl_t U_BOOT_CMD(DOCBOOT) = MK_CMD_ENTRY(
- "docboot", 4, 1, do_docboot,
+U_BOOT_CMD(
+ docboot, 4, 1, do_docboot,
"docboot - boot from DOC device\n",
"loadAddr dev\n"
);
if (cmd)
ret = doc_read_ecc(this, from, len,
- &n, (u_char*)buf,
- noecc ? NULL : eccbuf);
+ (size_t *)&n, (u_char*)buf,
+ noecc ? (uchar *)NULL : (uchar *)eccbuf);
else
ret = doc_write_ecc(this, from, len,
- &n, (u_char*)buf,
- noecc ? NULL : eccbuf);
+ (size_t *)&n, (u_char*)buf,
+ noecc ? (uchar *)NULL : (uchar *)eccbuf);
if (ret)
break;
return DoC_WaitReady(doc);
}
-/* Read a buffer from DoC, taking care of Millennium odditys */
+/* Read a buffer from DoC, taking care of Millennium oddities */
static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len)
{
volatile int dummy;
}
}
-/* Write a buffer to DoC, taking care of Millennium odditys */
+/* Write a buffer to DoC, taking care of Millennium oddities */
static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len)
{
unsigned long docptr;
/* Check for ANAND header first. Then can whinge if it's found but later
checks fail */
if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize, SECTORSIZE,
- &retlen, buf, NULL))) {
+ (size_t *)&retlen, buf, NULL))) {
static int warncount = 5;
if (warncount) {
/* To be safer with BIOS, also use erase mark as discriminant */
if ((ret = doc_read_oob(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
- 8, &retlen, (char *)&h1) < 0)) {
+ 8, (size_t *)&retlen, (uchar *)&h1) < 0)) {
#ifdef NFTL_DEBUG
printf("ANAND header found at 0x%x, but OOB data read failed\n",
block * nftl->EraseSize);
memcpy(mh, buf, sizeof(struct NFTLMediaHeader));
/* Do some sanity checks on it */
- if (mh->UnitSizeFactor != 0xff) {
- puts ("Sorry, we don't support UnitSizeFactor "
+ if (mh->UnitSizeFactor == 0) {
+#ifdef NFTL_DEBUG
+ puts ("UnitSizeFactor 0x00 detected.\n"
+ "This violates the spec but we think we know what it means...\n");
+#endif
+ } else if (mh->UnitSizeFactor != 0xff) {
+ printf ("Sorry, we don't support UnitSizeFactor "
"of != 1 yet.\n");
return -1;
}
/* read one sector for every SECTORSIZE of blocks */
if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize +
i + SECTORSIZE, SECTORSIZE,
- &retlen, buf, (char *)&oob)) < 0) {
+ (size_t *)&retlen, buf, (uchar *)&oob)) < 0) {
puts ("Read of bad sector table failed\n");
return -1;
}
/* Ident all the chips present. */
DoC_ScanChips(this);
+ if ((!this->numchips) || (!this->chips))
+ return;
nftl = &this->nftl;
printf("ECC needs a full sector read (adr: %lx size %lx)\n",
(long) from, (long) len);
-#ifdef PHYCH_DEBUG
+#ifdef PSYCHO_DEBUG
printf("DoC_Read (adr: %lx size %lx)\n", (long) from, (long) len);
#endif