16MB flash on dir-601?

I have seen that some people have modified their routers with larger flash chips. I want to install a 16MB flash but I don't know what I need to change either in the source or the uboot in order for openwrt to recognize the larger flash. I have a linux working environment. I know about it having poor ram and so on, I can change ram and flash chips in a second since I do microsoldering at work every day. I just want to know what to change so I can compile an image that will accept the flash size I wish to install.

1 Like

The only lines that I have found in the router's FW source (d-link fw source) that make reference to Maxim chips are in:

"Matrix\platform\kernel\AR7240\kernels\mips-linux-2.6.15\include\linux" in the following files:

jedec.c with the following on lines 79-85:

{
		
.jedec		= 0xC2AD,
		
.name		= "Macronix MX29F016",
				.size		= 2*1024*1024,
				.sectorsize	= 64*1024,
				.capabilities	= MTD_CAP_NORFLASH
	
},

jedec_probe.c with the following on lines 110-117, 1107-1136, 1153-1230 which seem to be the flash definitions:

****************110-117:

#define MX29LV040C	0x004F

#define MX29LV160T	0x22C4

#define MX29LV160B	0x2249

#define MX29F016	0x00AD

#define MX29F002T	0x00B0

#define MX29F004T	0x0045

#define MX29F004B	0x0046

****************1107-1136:

},{
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29LV040C,
.name		= "Macronix MX29LV040C",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0555_0x02AA,  /* x8 */
		
},
		

.DevSize	= SIZE_512KiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 1,
		
.regions	= {
			
ERASEINFO(0x10000,8),
		
}
	
}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29LV160T,
		
.name		= "MXIC MX29LV160T",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0AAA_0x0555,  /* x8 */
			[1] = MTD_UADDR_0x0555_0x02AA,  /* x16 */
		
},
		
.DevSize	= SIZE_2MiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 4,
		
.regions	= {
			
ERASEINFO(0x10000,31),
			
ERASEINFO(0x08000,1),
			
ERASEINFO(0x02000,2),
			
ERASEINFO(0x04000,1)
		
}

****************1153-1230:

}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29LV160B,
		
.name		= "MXIC MX29LV160B",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0AAA_0x0555,  /* x8 */
			[1] = MTD_UADDR_0x0555_0x02AA,  /* x16 */
		
},
		
.DevSize	= SIZE_2MiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 4,
		
.regions	= {
			
ERASEINFO(0x04000,1),
			
ERASEINFO(0x02000,2),
			
ERASEINFO(0x08000,1),
			
ERASEINFO(0x10000,31)
		
}
	
}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29F016,
		
.name		= "Macronix MX29F016",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0555_0x02AA /* x8 */
		
},
		
.DevSize	= SIZE_2MiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 1,
		
.regions	= {
			
ERASEINFO(0x10000,32),
		
}
        
}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29F004T,
		
.name		= "Macronix MX29F004T",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0555_0x02AA /* x8 */
		
},
		.DevSize	= SIZE_512KiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 4,
		
.regions	= {
			
ERASEINFO(0x10000,7),
			
ERASEINFO(0x08000,1),
			
ERASEINFO(0x02000,2),
			
ERASEINFO(0x04000,1),
		
}
        
}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29F004B,
		
.name		= "Macronix MX29F004B",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0555_0x02AA /* x8 */
		
},
		
.DevSize	= SIZE_512KiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 4,
		
.regions	= {
			
ERASEINFO(0x04000,1),
			
ERASEINFO(0x02000,2),
			
ERASEINFO(0x08000,1),
			
ERASEINFO(0x10000,7),
		
}
	
}, {
		
.mfr_id		= MANUFACTURER_MACRONIX,
		
.dev_id		= MX29F002T,
		
.name		= "Macronix MX29F002T",
		
.uaddr		= {
			
[0] = MTD_UADDR_0x0555_0x02AA /* x8 */
		
},
		
.DevSize	= SIZE_256KiB,
		
.CmdSet		= P_ID_AMD_STD,
		
.NumEraseRegions= 4,
		
.regions	= {
			
ERASEINFO(0x10000,3),
			
ERASEINFO(0x08000,1),
			
ERASEINFO(0x02000,2),
			
ERASEINFO(0x04000,1),
		
}

I have MX25xxx chips, Do I need to add a definition for it? Where original fw o openwrt? I did clone the factory one to the MX25 bigger one and off course it works but recognized only 4mb.

1 Like

If the chip's JEDEC number is already listed and compiled in, the kernel will recognize the chip size and know how to communicate with it.

The problem is that the mtd partition table only allocates space in the first 4 MB. The table needs to be changed. In an ar71xx build the table is in some device specific C file. In an ath79 build there is a dts file. Porting your "new model" to ath79 would be advisable.

3 Likes