/* The following code cannot be run from FLASH!  */
static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd)
/* The following code cannot be run from FLASH!  */
static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd)
{
	if(width==4) {
	    unsigned long cmd32=(cmd<<16)|cmd;
	    *(volatile unsigned long *)(addr+offset*2)=cmd32;
	} else if (width == 2) {
	    *(volatile unsigned short *)((unsigned short*)addr+offset)=cmd;
	} else {
	    *(volatile unsigned char *)(addr+offset)=cmd;
	}
}