to make u-boot work for fat32 filesystem
[jz_uboot.git] / cpu / mips / jz4740_cpm_test.c
blob9cc820b4832d16fa5351f4f3af570ca0050e0c2a
1 #include <config.h>
3 #ifdef CONFIG_JZ4740
4 #include <common.h>
5 #include <command.h>
6 #include <asm/jz4740.h>
7 #include <asm/io.h> /* virt_to_phys() */
8 #define JZ4740_CPM_TEST
12 int cpm_value;
13 void mdelay(int dly)
15 udelay(dly * 1000);
18 int myatoi(char *string)
20 int res = 0;
21 while (*string>='0' && *string <='9')
23 res *= 10;
24 res += *string-'0';
25 string++;
28 return res;
31 int myhatoi(char *string)
33 int res = 0;
35 if ( *string != '0' || *(string+1) != 'x' ) {
36 return 0;
39 string += 2;
41 while ( *string )
43 res *= 16;
44 if (*string>='0' && *string <='9')
45 res += *string-'0';
46 else if (*string>='a' && *string <='f')
47 res += *string-'a' + 10;
48 else
49 return res;
51 string++;
54 return res;
57 int atoi( char * string )
59 if ( *string == '0' && *(string+1) == 'x' ) {
60 return myhatoi(string);
62 else
63 return myatoi(string);
66 void cpm_add_test(void)
68 pll_add_test(cpm_value);
69 //sdram_add_test(cpm_value);
70 calc_clocks_add_test();
73 int do_jz_cpmtest_function(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
76 if ( !strncmp(argv[1], "add", 3 ) ) {
77 if ( argc == 3 ) {
78 cpm_value = atoi( argv[2] );
79 printf("cpm value:%d\n",cpm_value);
80 if((cpm_value >= 999) || (cpm_value <= 100)) {
81 printf("param is wrong!\n");
83 cpm_value *= 1000000;
84 cpm_add_test();
86 } else {
87 printf("command is wrong!\n");
89 return 0;
92 U_BOOT_CMD(
93 cpm, 4, 1, do_jz_cpmtest_function,
94 "cpm:\t - Usage: cpmtest [add][cpm_value]\n",
95 NULL
98 #endif /* CONFIG_JZ4740 */