diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_mii.c | 144 | ||||
-rw-r--r-- | common/cmd_nvedit.c | 5 | ||||
-rw-r--r-- | common/env_nand.c | 2 | ||||
-rw-r--r-- | common/fdt_support.c | 48 | ||||
-rw-r--r-- | common/main.c | 25 | ||||
-rw-r--r-- | common/usb_kbd.c | 19 |
6 files changed, 89 insertions, 154 deletions
diff --git a/common/cmd_mii.c b/common/cmd_mii.c index f530a38..31ac43d 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -29,143 +29,6 @@ #include <command.h> #include <miiphy.h> -#ifdef CONFIG_TERSE_MII -/* - * Display values from last command. - */ -uint last_op; -uint last_addr; -uint last_data; -uint last_reg; - -/* - * MII device/info/read/write - * - * Syntax: - * mii device {devname} - * mii info {addr} - * mii read {addr} {reg} - * mii write {addr} {reg} {data} - */ -int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) -{ - char op; - unsigned char addr, reg; - unsigned short data; - int rcode = 0; - char *devname; - - if (argc < 2) { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } - -#if defined(CONFIG_8xx) || defined(CONFIG_MCF52x2) - mii_init (); -#endif - - /* - * We use the last specified parameters, unless new ones are - * entered. - */ - op = last_op; - addr = last_addr; - data = last_data; - reg = last_reg; - - if ((flag & CMD_FLAG_REPEAT) == 0) { - op = argv[1][0]; - if (argc >= 3) - addr = simple_strtoul (argv[2], NULL, 16); - if (argc >= 4) - reg = simple_strtoul (argv[3], NULL, 16); - if (argc >= 5) - data = simple_strtoul (argv[4], NULL, 16); - } - - /* use current device */ - devname = miiphy_get_current_dev(); - - /* - * check device/read/write/list. - */ - if (op == 'i') { - unsigned char j, start, end; - unsigned int oui; - unsigned char model; - unsigned char rev; - - /* - * Look for any and all PHYs. Valid addresses are 0..31. - */ - if (argc >= 3) { - start = addr; end = addr + 1; - } else { - start = 0; end = 31; - } - - for (j = start; j < end; j++) { - if (miiphy_info (devname, j, &oui, &model, &rev) == 0) { - printf ("PHY 0x%02X: " - "OUI = 0x%04X, " - "Model = 0x%02X, " - "Rev = 0x%02X, " - "%3dbase%s, %s\n", - j, oui, model, rev, - miiphy_speed (devname, j), - miiphy_is_1000base_x (devname, j) - ? "X" : "T", - (miiphy_duplex (devname, j) == FULL) - ? "FDX" : "HDX"); - } - } - } else if (op == 'r') { - if (miiphy_read (devname, addr, reg, &data) != 0) { - puts ("Error reading from the PHY\n"); - rcode = 1; - } else { - printf ("%04X\n", data & 0x0000FFFF); - } - } else if (op == 'w') { - if (miiphy_write (devname, addr, reg, data) != 0) { - puts ("Error writing to the PHY\n"); - rcode = 1; - } - } else if (op == 'd') { - if (argc == 2) - miiphy_listdev (); - else - miiphy_set_current_dev (argv[2]); - } else { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } - - /* - * Save the parameters for repeats. - */ - last_op = op; - last_addr = addr; - last_data = data; - last_reg = reg; - - return rcode; -} - -/***************************************************/ - -U_BOOT_CMD( - mii, 5, 1, do_mii, - "mii - MII utility commands\n", - "device - list available devices\n" - "mii device <devname> - set current device\n" - "mii info <addr> - display MII PHY info\n" - "mii read <addr> <reg> - read MII PHY <addr> register <reg>\n" - "mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n" -); - -#else /* ! CONFIG_TERSE_MII ================================================= */ - typedef struct _MII_reg_desc_t { ushort regno; char * name; @@ -438,6 +301,11 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) int rcode = 0; char *devname; + if (argc < 2) { + printf("Usage:\n%s\n", cmdtp->usage); + return 1; + } + #if defined(CONFIG_8xx) || defined(CONFIG_MCF532x) mii_init (); #endif @@ -594,5 +462,3 @@ U_BOOT_CMD( "mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n" "Addr and/or reg may be ranges, e.g. 2-7.\n" ); - -#endif /* CONFIG_TERSE_MII */ diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 6770408..dd263b6 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -81,8 +81,6 @@ extern void env_crc_update (void); /************************************************************************ ************************************************************************/ -static int envmatch (uchar *, int); - /* * Table with supported baudrates (defined in config_xyz.h) */ @@ -576,8 +574,7 @@ int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * If the names match, return the index for the value2, else NULL. */ -static int -envmatch (uchar *s1, int i2) +int envmatch (uchar *s1, int i2) { while (*s1 == env_get_char(i2++)) diff --git a/common/env_nand.c b/common/env_nand.c index 38a07f8..ce0a251 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -57,7 +57,7 @@ int nand_legacy_rw (struct nand_chip* nand, int cmd, size_t start, size_t len, size_t * retlen, u_char * buf); -/* info for NAND chips, defined in drivers/nand/nand.c */ +/* info for NAND chips, defined in drivers/mtd/nand/nand.c */ extern nand_info_t nand_info[]; /* references to names in env_common.c */ diff --git a/common/fdt_support.c b/common/fdt_support.c index 92f1c7f..a13c140 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -30,6 +30,9 @@ #include <fdt_support.h> #include <exports.h> +#ifdef CONFIG_QE +#include "../drivers/qe/qe.h" +#endif /* * Global data (for the gd->bd) */ @@ -614,4 +617,49 @@ void fdt_fixup_ethernet(void *fdt, bd_t *bd) #endif } } + +#ifdef CONFIG_QE +/* + * If a QE firmware has been uploaded, then add the 'firmware' node under + * the 'qe' node. + */ +void fdt_fixup_qe_firmware(void *fdt) +{ + struct qe_firmware_info *qe_fw_info; + int node, ret; + + qe_fw_info = qe_get_firmware_info(); + if (!qe_fw_info) + return; + + node = fdt_path_offset(fdt, "/qe"); + if (node < 0) + return; + + /* We assume the node doesn't exist yet */ + node = fdt_add_subnode(fdt, node, "firmware"); + if (node < 0) + return; + + ret = fdt_setprop(fdt, node, "extended-modes", + &qe_fw_info->extended_modes, sizeof(u64)); + if (ret < 0) + goto error; + + ret = fdt_setprop_string(fdt, node, "id", qe_fw_info->id); + if (ret < 0) + goto error; + + ret = fdt_setprop(fdt, node, "virtual-traps", qe_fw_info->vtraps, + sizeof(qe_fw_info->vtraps)); + if (ret < 0) + goto error; + + return; + +error: + fdt_del_node(fdt, node); +} +#endif + #endif diff --git a/common/main.c b/common/main.c index 4253eac..ad2a386 100644 --- a/common/main.c +++ b/common/main.c @@ -59,7 +59,6 @@ extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); #define MAX_DELAY_STOP_STR 32 -static int parse_line (char *, char *[]); #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) static int abortboot(int); #endif @@ -918,8 +917,15 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len) */ int readline (const char *const prompt) { + return readline_into_buffer(prompt, console_buffer); +} + + +int readline_into_buffer (const char *const prompt, char * buffer) +{ + char *p = buffer; + char * p_buf = p; #ifdef CONFIG_CMDLINE_EDITING - char *p = console_buffer; unsigned int len=MAX_CMDBUF_SIZE; int rc; static int initted = 0; @@ -934,7 +940,6 @@ int readline (const char *const prompt) rc = cread_line(prompt, p, &len); return rc < 0 ? rc : len; #else - char *p = console_buffer; int n = 0; /* buffer index */ int plen = 0; /* prompt length */ int col; /* output column cnt */ @@ -972,13 +977,13 @@ int readline (const char *const prompt) case '\n': *p = '\0'; puts ("\r\n"); - return (p - console_buffer); + return (p - p_buf); case '\0': /* nul */ continue; case 0x03: /* ^C - break */ - console_buffer[0] = '\0'; /* discard input */ + p_buf[0] = '\0'; /* discard input */ return (-1); case 0x15: /* ^U - erase line */ @@ -986,20 +991,20 @@ int readline (const char *const prompt) puts (erase_seq); --col; } - p = console_buffer; + p = p_buf; n = 0; continue; case 0x17: /* ^W - erase word */ - p=delete_char(console_buffer, p, &col, &n, plen); + p=delete_char(p_buf, p, &col, &n, plen); while ((n > 0) && (*p != ' ')) { - p=delete_char(console_buffer, p, &col, &n, plen); + p=delete_char(p_buf, p, &col, &n, plen); } continue; case 0x08: /* ^H - backspace */ case 0x7F: /* DEL - backspace */ - p=delete_char(console_buffer, p, &col, &n, plen); + p=delete_char(p_buf, p, &col, &n, plen); continue; default: @@ -1012,7 +1017,7 @@ int readline (const char *const prompt) /* if auto completion triggered just continue */ *p = '\0'; if (cmd_auto_complete(prompt, console_buffer, &n, &col)) { - p = console_buffer + n; /* reset */ + p = p_buf + n; /* reset */ continue; } #endif diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 7bdfcc0..1703b23 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -84,6 +84,7 @@ int repeat_delay; static unsigned char num_lock = 0; static unsigned char caps_lock = 0; static unsigned char scroll_lock = 0; +static unsigned char ctrl = 0; static unsigned char leds __attribute__ ((aligned (0x4))); @@ -120,6 +121,9 @@ static void usb_kbd_put_queue(char data) /* test if a character is in the queue */ static int usb_kbd_testc(void) { +#ifdef CFG_USB_EVENT_POLL + usb_event_poll(); +#endif if(usb_in_pointer==usb_out_pointer) return(0); /* no data */ else @@ -274,6 +278,10 @@ static int usb_kbd_translate(unsigned char scancode,unsigned char modifier,int p else /* non shifted */ keycode=usb_kbd_numkey[scancode-0x1e]; } + + if (ctrl) + keycode = scancode - 0x3; + if(pressed==1) { if(scancode==NUM_LOCK) { num_lock=~num_lock; @@ -306,6 +314,17 @@ static int usb_kbd_irq(struct usb_device *dev) return 1; } res=0; + + switch (new[0]) { + case 0x0: /* No combo key pressed */ + ctrl = 0; + break; + case 0x01: /* Left Ctrl pressed */ + case 0x10: /* Right Ctrl pressed */ + ctrl = 1; + break; + } + for (i = 2; i < 8; i++) { if (old[i] > 3 && memscan(&new[2], old[i], 6) == &new[8]) { res|=usb_kbd_translate(old[i],new[0],0); |