From b41b03a2e00f8a2bc31f957f52bd31365caa5f32 Mon Sep 17 00:00:00 2001 From: rrs Date: Sat, 20 Feb 2010 17:24:33 +0000 Subject: Fix for the rge driver for boards without rge6 and rge7. - changes to avoid adding theses instances on specific chips Obtained from: C. Jayachandran - JC - c.jayachandran@gmail.com --- sys/mips/rmi/board.c | 15 +++++++++++++++ sys/mips/rmi/iodi.c | 14 +++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'sys/mips') diff --git a/sys/mips/rmi/board.c b/sys/mips/rmi/board.c index 932fee2..ae7b43f 100644 --- a/sys/mips/rmi/board.c +++ b/sys/mips/rmi/board.c @@ -27,6 +27,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * *****************************RMI_2**********************************/ +#include /* RCS ID & Copyright macro defns */ +__FBSDID("$FreeBSD$"); #include #include #include @@ -93,6 +95,7 @@ struct xlr_board_info xlr_board_info; int xlr_board_info_setup() { + if (xlr_is_xls()) { xlr_board_info.is_xls = 1; xlr_board_info.nr_cpus = 8; @@ -122,6 +125,18 @@ xlr_board_info_setup() /* network block 1 */ xlr_board_info.gmac_block[1].type = XLR_GMAC; xlr_board_info.gmac_block[1].enabled = 0xf; + if (xlr_is_xls4xx()) { + xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_GPIO_OFFSET); + uint32_t tmp; + + /* some ports are not enabled on 4xx, figure this out + from the GPIO fuse bank */ + tmp = xlr_read_reg(mmio, 35); + if (tmp & (1<<28)) + xlr_board_info.gmac_block[1].enabled &= ~0x8; + if (tmp & (1<<29)) + xlr_board_info.gmac_block[1].enabled &= ~0x4; + } xlr_board_info.gmac_block[1].credit_config = &xls_cc_table_gmac1; xlr_board_info.gmac_block[1].station_txbase = MSGRNG_STNID_GMAC1_TX0; xlr_board_info.gmac_block[1].station_rfr = MSGRNG_STNID_GMAC1_FR_0; diff --git a/sys/mips/rmi/iodi.c b/sys/mips/rmi/iodi.c index 76796ad..dd8780b 100644 --- a/sys/mips/rmi/iodi.c +++ b/sys/mips/rmi/iodi.c @@ -271,11 +271,15 @@ iodi_attach(device_t dev) tmpd = device_add_child(dev, "rge", 5); device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); - tmpd = device_add_child(dev, "rge", 6); - device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); - - tmpd = device_add_child(dev, "rge", 7); - device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + if (xlr_board_info.gmac_block[1].enabled & 0x4) { + tmpd = device_add_child(dev, "rge", 6); + device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + } + + if (xlr_board_info.gmac_block[1].enabled & 0x8) { + tmpd = device_add_child(dev, "rge", 7); + device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + } } else if (xlr_board_info.gmac_block[1].type == XLR_XGMAC) { #if 0 /* XGMAC not yet */ tmpd = device_add_child(dev, "rge", 4); -- cgit v1.1