* partition split defined below.
*
* $Log: axisflashmap.c,v $
+ * Revision 1.8 2004/05/14 07:58:03 starvik
+ * Merge of changes from 2.4
+ *
* Revision 1.6 2003/07/04 08:27:37 starvik
* Merge of Linux 2.5.74
*
/* From head.S */
extern unsigned long romfs_start, romfs_length, romfs_in_flash;
+/* The master mtd for the entire flash. */
+struct mtd_info* axisflash_mtd = NULL;
+
/* Map driver functions. */
static __u8 flash_read8(struct map_info *map, unsigned long ofs)
{
struct mtd_info *mtd_cs = NULL;
- printk("%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
+ printk(KERN_INFO
+ "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
map_cs->name, map_cs->size, map_cs->map_priv_1);
#ifdef CONFIG_MTD_AMDSTD
struct mtd_info *mymtd;
int err = 0;
int pidx = 0;
- struct partitiontable_head *ptable_head;
+ struct partitiontable_head *ptable_head = NULL;
struct partitiontable_entry *ptable;
int use_default_ptable = 1; /* Until proven otherwise. */
const char *pmsg = " /dev/flash%d at 0x%08x, size 0x%08x\n";
/* There's no reason to use this module if no flash chip can
* be identified. Make sure that's understood.
*/
- panic("axisflashmap found no flash chip!\n");
+ printk(KERN_INFO "axisflashmap: Found no flash chip.\n");
+ } else {
+ printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n",
+ mymtd->name, mymtd->size);
+ axisflash_mtd = mymtd;
}
- printk("%s: 0x%08x bytes of flash memory.\n",
- mymtd->name, mymtd->size);
-
- mymtd->owner = THIS_MODULE;
-
- ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
- CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET);
+ if (mymtd) {
+ mymtd->owner = THIS_MODULE;
+ ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
+ CONFIG_ETRAX_PTABLE_SECTOR +
+ PARTITION_TABLE_OFFSET);
+ }
pidx++; /* First partition is always set to the default. */
- if ((ptable_head->magic == PARTITION_TABLE_MAGIC)
+ if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC)
&& (ptable_head->size <
(MAX_PARTITIONS * sizeof(struct partitiontable_entry) +
PARTITIONTABLE_END_MARKER_SIZE))
ptable_ok = (csum == ptable_head->checksum);
/* Read the entries and use/show the info. */
- printk(" Found a%s partition table at 0x%p-0x%p.\n",
+ printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n",
(ptable_ok ? " valid" : "n invalid"), ptable_head,
max_addr);
axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR;
axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
- printk(" Adding readonly flash partition for romfs image:\n");
+ printk(KERN_INFO
+ " Adding readonly flash partition for romfs image:\n");
printk(pmsg, pidx, axis_partitions[pidx].offset,
axis_partitions[pidx].size);
pidx++;
}
- if (use_default_ptable) {
- printk(" Using default partition table.\n");
- err = add_mtd_partitions(mymtd, axis_default_partitions,
- NUM_DEFAULT_PARTITIONS);
- } else {
- err = add_mtd_partitions(mymtd, axis_partitions, pidx);
- }
+ if (mymtd) {
+ if (use_default_ptable) {
+ printk(KERN_INFO " Using default partition table.\n");
+ err = add_mtd_partitions(mymtd, axis_default_partitions,
+ NUM_DEFAULT_PARTITIONS);
+ } else {
+ err = add_mtd_partitions(mymtd, axis_partitions, pidx);
+ }
- if (err) {
- panic("axisflashmap could not add MTD partitions!\n");
+ if (err) {
+ panic("axisflashmap could not add MTD partitions!\n");
+ }
}
if (!romfs_in_flash) {
"mtd_info!\n");
}
- printk(" Adding RAM partition for romfs image:\n");
+ printk(KERN_INFO " Adding RAM partition for romfs image:\n");
printk(pmsg, pidx, romfs_start, romfs_length);
err = mtdram_init_device(mtd_ram, (void*)romfs_start,
/* This adds the above to the kernels init-call chain. */
module_init(init_axis_flash);
+
+EXPORT_SYMBOL(axisflash_mtd);