Exemplo n.º 1
0
/*
 *  Inlineable function to Generic Reset the Chip
 */
static __inline void
fl_reset(struct fl_map *map)
{

	switch(map->fl_map_bus) {
	case FL_BUS_8:
		if(!map->fl_type)fl_mydetect(map);
#if NMOD_FLASH_SST
		if(map->fl_type==TYPE_SST)
		{
		outb((map->fl_map_base), 0xf0);
		break;
		}
#endif
#if NMOD_FLASH_AMD
        if(map->fl_type==TYPE_AMD)
        {
		outb((map->fl_map_base), 0x90);
		outb((map->fl_map_base), 0x00);
		break;
		}
#endif
#if NMOD_FLASH_ST
		if(map->fl_type==TYPE_ST)
		{
		outb(map->fl_map_base, 0xf0);
		break;
		}
#endif
		break;

        case FL_BUS_16:
                SETWIDE(FL_RESET);
                outw(map->fl_map_base, widedata);
                break;

        case FL_BUS_32:
                SETWIDE(FL_RESET);
                outl(map->fl_map_base, widedata);
                break;
       
	case FL_BUS_64:
	case FL_BUS_8_ON_64:
                SETWIDE(FL_RESET);
		movequad((void *)map->fl_map_base, &widedata);
		break;
	}
}
Exemplo n.º 2
0
static __inline void
fl_autoselect(struct fl_map *map)
{

	switch(map->fl_map_bus) {
	case FL_BUS_8:
		if((map->fl_type>>16)!=0x5a5a)fl_mydetect(map);
#if NMOD_FLASH_SST || NMOD_FLASH_WINBOND	
		if(map->fl_type==TYPE_SST) //SST or WINBOND
		{
		outb((map->fl_map_base + SST_CMDOFFS1), 0xAA);
		outb((map->fl_map_base + SST_CMDOFFS2), 0x55);
		outb((map->fl_map_base + SST_CMDOFFS1), FL_AUTOSEL);
		break;
		}
#endif
#if NMOD_FLASH_AMD
		if(map->fl_type==TYPE_AMD)
		{
		outb((map->fl_map_base + AMD_CMDOFFS1), 0xAA);
		outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
		outb((map->fl_map_base + AMD_CMDOFFS1), FL_AUTOSEL);
		break;
		}
#endif
#if NMOD_FLASH_ST
		if(map->fl_type==TYPE_ST)
		{
		outb((map->fl_map_base + ConvAddr1(0x555)), 0xAA);
		outb((map->fl_map_base + ConvAddr1(0x2aa)), 0x55);
		outb((map->fl_map_base + ConvAddr1(0x555)), FL_AUTOSEL);
		break;
		}
#endif

		break;

	case FL_BUS_16:
#if 0
		SETWIDE(0xaa);
		outw(map->fl_map_base + (0x5555 << 2), widedata);
		SETWIDE(0x55);
		outw(map->fl_map_base + (0xaaaa << 2), widedata);
		SETWIDE(FL_AUTOSEL);
		outw(map->fl_map_base + (0x5555 << 2), widedata);
#else
		SETWIDE(0xaa);
		outw(map->fl_map_base + ConvAddr2(0x00555), widedata);
		SETWIDE(0x55);
		outw(map->fl_map_base + ConvAddr2(0x002AA), widedata);
		SETWIDE(FL_AUTOSEL);
		outw(map->fl_map_base + ConvAddr2(0x00555), widedata);
#endif
		break;

	case FL_BUS_32:
		SETWIDE(0xaa);
		outl(map->fl_map_base + (0x5555 << 4), widedata);
		SETWIDE(0x55);
		outl(map->fl_map_base + (0xaaaa << 4), widedata);
		SETWIDE(FL_AUTOSEL);
		outl(map->fl_map_base + (0x5555 << 4), widedata);
		break;

	case FL_BUS_64:
	case FL_BUS_8_ON_64:
		SETWIDE(0xAA);
		movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata);
		SETWIDE(0x55);
		movequad((void *)map->fl_map_base + (0x2AAA << 3), &widedata);
		SETWIDE(FL_AUTOSEL);
		movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata);
		break;
	}
}
Exemplo n.º 3
0
static __inline void
fl_autoselect(struct fl_map *map)
{

	switch(map->fl_map_bus) {
	case FL_BUS_8:
		if((map->fl_type>>16)!=0x5a5a)fl_mydetect(map);
#if NMOD_FLASH_SST || NMOD_FLASH_WINBOND	
		if(map->fl_type==TYPE_SST) //SST or WINBOND
		{
		outb((map->fl_map_base + SST_CMDOFFS1), 0xAA);
		outb((map->fl_map_base + SST_CMDOFFS2), 0x55);
		outb((map->fl_map_base + SST_CMDOFFS1), FL_AUTOSEL);
		break;
		}
#endif
#if NMOD_FLASH_AMD
		if(map->fl_type==TYPE_AMD)
		{
		outb((map->fl_map_base + AMD_CMDOFFS1), 0xAA);
		outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
		outb((map->fl_map_base + AMD_CMDOFFS1), FL_AUTOSEL);
		break;
		}
#endif
#if NMOD_FLASH_ST
		if(map->fl_type==TYPE_ST)
		{
		outb((map->fl_map_base + ConvAddr1(0x555)), 0xAA);
		outb((map->fl_map_base + ConvAddr1(0x2aa)), 0x55);
		outb((map->fl_map_base + ConvAddr1(0x555)), FL_AUTOSEL);
		break;
		}
#endif

		break;

	case FL_BUS_16:
	{
		short oldc=inw(map->fl_map_base);	
        outw((map->fl_map_base + ConvAddr2(SST_CMDOFFS1)), 0xAA);
        outw((map->fl_map_base + ConvAddr2(SST_CMDOFFS2)), 0x55);
        outw((map->fl_map_base + ConvAddr2(SST_CMDOFFS1)), FL_AUTOSEL);
        if(inw(map->fl_map_base)!=oldc){map->fl_type=TYPE_SST;return;}
		outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xAA);
		outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
		outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), FL_AUTOSEL);
        if(inw(map->fl_map_base)!=oldc){map->fl_type=TYPE_AMD;return;}
	    else {map->fl_type=0;printf("unknow flash type\n");	}
	}
		break;

	case FL_BUS_32:
		SETWIDE(0xaa);
		outl(map->fl_map_base + (0x5555 << 4), widedata);
		SETWIDE(0x55);
		outl(map->fl_map_base + (0xaaaa << 4), widedata);
		SETWIDE(FL_AUTOSEL);
		outl(map->fl_map_base + (0x5555 << 4), widedata);
		break;

	case FL_BUS_64:
	case FL_BUS_8_ON_64:
		SETWIDE(0xAA);
		movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata);
		SETWIDE(0x55);
		movequad((void *)map->fl_map_base + (0x2AAA << 3), &widedata);
		SETWIDE(FL_AUTOSEL);
		movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata);
		break;
	}
}