diff options
author | wdenk <wdenk> | 2002-09-18 20:04:01 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2002-09-18 20:04:01 +0000 |
commit | dd7d41f00d413bbb91d758d0936c0eb24c59ce2c (patch) | |
tree | 83db4db0b389bed534375cbae229ed068c73a189 | |
parent | 5b88144d013493f2c9c073bf991737d2173409d4 (diff) | |
download | bootable_bootloader_goldelico_gta04-dd7d41f00d413bbb91d758d0936c0eb24c59ce2c.zip bootable_bootloader_goldelico_gta04-dd7d41f00d413bbb91d758d0936c0eb24c59ce2c.tar.gz bootable_bootloader_goldelico_gta04-dd7d41f00d413bbb91d758d0936c0eb24c59ce2c.tar.bz2 |
Initial revision
-rw-r--r-- | board/gen860t/fpga.h | 45 | ||||
-rw-r--r-- | common/cmd_mii.c | 131 |
2 files changed, 176 insertions, 0 deletions
diff --git a/board/gen860t/fpga.h b/board/gen860t/fpga.h new file mode 100644 index 0000000..01967a4 --- /dev/null +++ b/board/gen860t/fpga.h @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2002 + * Rich Ireland, Enterasys Networks, rireland@enterasys.com. + * Keith Outwater, keith_outwater@mvis.com. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +/* + * Virtex2 FPGA configuration support for the GEN860T computer + */ + +extern int gen860t_init_fpga(void); +extern int fpga_pgm_fn(int assert_pgm, int flush, int cookie); +extern int fpga_init_fn(int cookie); +extern int fpga_err_fn(int cookie); +extern int fpga_done_fn(int cookie); +extern int fpga_clk_fn(int assert_clk, int flush, int cookie); +extern int fpga_cs_fn(int assert_cs, int flush, int cookie); +extern int fpga_wr_fn(int assert_write, int flush, int cookie); +extern int fpga_read_data_fn(unsigned char *data, int cookie); +extern int fpga_write_data_fn(unsigned char data, int flush, int cookie); +extern int fpga_busy_fn(int cookie); +extern int fpga_abort_fn(int cookie ); +extern int fpga_pre_config_fn(int cookie ); +extern int fpga_post_config_fn(int cookie ); + +/* vim: set ts=4 sw=4 tw=78: */ diff --git a/common/cmd_mii.c b/common/cmd_mii.c new file mode 100644 index 0000000..b5963f1 --- /dev/null +++ b/common/cmd_mii.c @@ -0,0 +1,131 @@ +/* + * (C) Copyright 2001 + * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* + * MII Utilities + */ + +#include <common.h> +#include <command.h> +#include <cmd_mii.h> +#include <miiphy.h> + +#if (CONFIG_COMMANDS & CFG_CMD_MII) + +/* + * Display values from last command. + */ +uint last_op; +uint last_addr; +uint last_data; +uint last_reg; + +/* + * MII read/write + * + * Syntax: + * 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; + +#ifdef CONFIG_MPC860 + 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); + } + + /* + * check info/read/write. + */ + if (op == 'i') { + int j; + unsigned int oui; + unsigned char model; + unsigned char rev; + + /* + * Look for any and all PHYs. Valid addresses are 0..31. + */ + for (j = 0; j < 32; j++) { + if (miiphy_info (j, &oui, &model, &rev) == 0) { + printf ("PHY 0x%02X: " + "OUI = 0x%04X, " + "Model = 0x%02X, " + "Rev = 0x%02X, " + "%3dbaseT, %s\n", + j, oui, model, rev, + miiphy_speed (j) == _100BASET ? 100 : 10, + miiphy_duplex (j) == FULL ? "FDX" : "HDX"); + } + } + } else if (op == 'r') { + if (miiphy_read (addr, reg, &data) != 0) { + printf ("Error reading from the PHY\n"); + rcode = 1; + } + printf ("%04X\n", data & 0x0000FFFF); + } else if (op == 'w') { + if (miiphy_write (addr, reg, data) != 0) { + printf ("Error writing to the PHY\n"); + rcode = 1; + } + } else { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + /* + * Save the parameters for repeats. + */ + last_op = op; + last_addr = addr; + last_data = data; + + return rcode; +} + +#endif /* CFG_CMD_MII */ |