[adm5120] change switch register access macros
[openwrt-10.03/.git] / target / linux / adm5120 / files / drivers / mtd / trxsplit.c
index 19d1e9da97978c623ba658fb8c370cab9e93175b..caf6b76a5a69f75c360e10ba0240a234f9259b11 100644 (file)
@@ -51,7 +51,7 @@ struct trx_header {
        u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */
 };
 
-#define BLOCK_LEN_MIN          0x10000
+#define TRX_ALIGN      0x1000
 
 static int trx_nr_parts;
 static unsigned long trx_offset;
@@ -104,17 +104,12 @@ err_out:
 static void trxsplit_findtrx(struct mtd_info *mtd)
 {
        unsigned long offset;
-       unsigned long blocklen;
        int err;
 
-       blocklen = mtd->erasesize;
-       if (blocklen < BLOCK_LEN_MIN)
-               blocklen = BLOCK_LEN_MIN;
-
        printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name);
 
        err = 0;
-       for (offset = 0; offset < mtd->size; offset += blocklen) {
+       for (offset = 0; offset < mtd->size; offset += TRX_ALIGN) {
                err = trxsplit_checktrx(mtd, offset);
                if (err == 0)
                        break;
@@ -192,6 +187,12 @@ err:
 
 static void __init trxsplit_add_mtd(struct mtd_info *mtd)
 {
+       if (mtd->type != MTD_NORFLASH) {
+               printk(KERN_INFO PFX "'%s' is not a NOR flash, skipped\n",
+                               mtd->name);
+               return;
+       }
+
        if (!trx_mtd)
                trxsplit_findtrx(mtd);
 }