static void do_command(char *c) { char *token; token = get_token(&c); if(strcmp(token, "mr") == 0) mr(get_token(&c), get_token(&c)); else if(strcmp(token, "mw") == 0) mw(get_token(&c), get_token(&c), get_token(&c)); else if(strcmp(token, "mc") == 0) mc(get_token(&c), get_token(&c), get_token(&c)); else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c)); else if(strcmp(token, "ident") == 0) ident(); #ifdef CONFIG_L2_SIZE else if(strcmp(token, "flushl2") == 0) flush_l2_cache(); #endif #ifdef FLASH_BOOT_ADDRESS else if(strcmp(token, "flashboot") == 0) flashboot(); #endif #ifdef ROM_BOOT_ADDRESS else if(strcmp(token, "romboot") == 0) romboot(); #endif else if(strcmp(token, "serialboot") == 0) serialboot(); #ifdef CSR_ETHMAC_BASE else if(strcmp(token, "netboot") == 0) netboot(); #endif else if(strcmp(token, "help") == 0) help(); #ifdef __lm32__ else if(strcmp(token, "rcsr") == 0) rcsr(get_token(&c)); else if(strcmp(token, "wcsr") == 0) wcsr(get_token(&c), get_token(&c)); #endif #ifdef CSR_DFII_BASE else if(strcmp(token, "sdrrow") == 0) sdrrow(get_token(&c)); else if(strcmp(token, "sdrsw") == 0) sdrsw(); else if(strcmp(token, "sdrhw") == 0) sdrhw(); else if(strcmp(token, "sdrrdbuf") == 0) sdrrdbuf(-1); else if(strcmp(token, "sdrrd") == 0) sdrrd(get_token(&c), get_token(&c)); else if(strcmp(token, "sdrrderr") == 0) sdrrderr(get_token(&c)); else if(strcmp(token, "sdrwr") == 0) sdrwr(get_token(&c)); #ifdef CSR_DDRPHY_BASE else if(strcmp(token, "sdrwlon") == 0) sdrwlon(); else if(strcmp(token, "sdrwloff") == 0) sdrwloff(); else if(strcmp(token, "sdrlevel") == 0) sdrlevel(); #endif else if(strcmp(token, "memtest") == 0) memtest(); else if(strcmp(token, "sdrinit") == 0) sdrinit(); #endif else if(strcmp(token, "") != 0) printf("Command not found\n"); }
static int write_level(int *delay, int *high_skew) { int i; int dq_address; unsigned char dq; int ok; printf("Write leveling: "); sdrwlon(); cdelay(100); for(i=0;i<DFII_PIX_DATA_SIZE/2;i++) { dq_address = sdram_dfii_pix_rddata_addr[0]+4*(DFII_PIX_DATA_SIZE/2-1-i); ddrphy_dly_sel_write(1 << i); ddrphy_wdly_dq_rst_write(1); ddrphy_wdly_dqs_rst_write(1); delay[i] = 0; ddrphy_wlevel_strobe_write(1); cdelay(10); dq = MMPTR(dq_address); if(dq != 0) { /* * Assume this DQ group has between 1 and 2 bit times of skew. * Bring DQS into the CK=0 zone before continuing leveling. */ high_skew[i] = 1; while(dq != 0) { delay[i]++; if(delay[i] >= ERR_DDRPHY_DELAY) break; ddrphy_wdly_dq_inc_write(1); ddrphy_wdly_dqs_inc_write(1); ddrphy_wlevel_strobe_write(1); cdelay(10); dq = MMPTR(dq_address); } } else high_skew[i] = 0; while(dq == 0) { delay[i]++; if(delay[i] >= ERR_DDRPHY_DELAY) break; ddrphy_wdly_dq_inc_write(1); ddrphy_wdly_dqs_inc_write(1); ddrphy_wlevel_strobe_write(1); cdelay(10); dq = MMPTR(dq_address); } } sdrwloff(); ok = 1; for(i=DFII_PIX_DATA_SIZE/2-1;i>=0;i--) { printf("%2d%c ", delay[i], high_skew[i] ? '*' : ' '); if(delay[i] >= ERR_DDRPHY_DELAY) ok = 0; } if(ok) printf("completed\n"); else printf("failed\n"); return ok; }