From a5a614c129eaa6b9f0bdc2ea5da01789e18033b1 Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 21 Jan 2013 03:55:13 +0000 Subject: km/common: remove unneeded ifdefs for I2C All boards from this serie use i2c. There is no need to #ifdef the header. Signed-off-by: Holger Brunck --- board/keymile/common/common.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 6f407b78f25..468c755d67c 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -38,9 +38,7 @@ #include "post.h" #endif #include "common.h" -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) #include -#endif #if !defined(CONFIG_MPC83xx) static void i2c_write_start_seq(void); -- cgit v1.2.3 From 811c8cad7196acb0ae2dd6bf04919689e9d803dc Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 21 Jan 2013 03:55:14 +0000 Subject: km/common/ivm: remove obsolete code EEprom_ivm_addr isn't set in our environment, so remove the usage of this. Signed-off-by: Holger Brunck --- board/keymile/common/ivm.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index eaa924f0e6a..7fe3b0fc097 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -325,14 +325,6 @@ int ivm_read_eeprom(void) } i2c_set_bus_num(dev->busid); #endif - - buf = (unsigned char *) getenv("EEprom_ivm_addr"); - if (buf != NULL) { - ret = strict_strtoul((char *)buf, 16, &dev_addr); - if (ret != 0) - return -3; - } - /* add deblocking here */ i2c_make_abort(); -- cgit v1.2.3 From cf976ce478b8d7fd62184eac24caa1d31c7d8c55 Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 21 Jan 2013 03:55:15 +0000 Subject: km/common/ivm: remove CONFIG_SYS_I2C_IVM_BUS related code This define isn't set within our setup files. So we can safely remove the affected code. Signed-off-by: Holger Brunck --- board/keymile/common/ivm.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index 7fe3b0fc097..607daa6d655 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -312,13 +312,9 @@ int ivm_read_eeprom(void) #if defined(CONFIG_I2C_MUX) /* First init the Bus, select the Bus */ -#if defined(CONFIG_SYS_I2C_IVM_BUS) - dev = i2c_mux_ident_muxstring((uchar *)CONFIG_SYS_I2C_IVM_BUS); -#else buf = (unsigned char *) getenv("EEprom_ivm"); if (buf != NULL) dev = i2c_mux_ident_muxstring(buf); -#endif if (dev == NULL) { printf("Error couldnt add Bus for IVM\n"); return -1; -- cgit v1.2.3 From 1eb95ebe0d466d793fcf1f689fc20f6cc83c7fe1 Mon Sep 17 00:00:00 2001 From: Karlheinz Jerg Date: Mon, 21 Jan 2013 03:55:16 +0000 Subject: km82xx, km83xx: move ethernet_present() from common to cpu specific For kmvect1 we need a special solution and for km_arm boards we already have. So move the common code to the architectur specific file. Signed-off-by: Karlheinz Jerg Signed-off-by: Holger Brunck --- board/keymile/common/common.c | 11 ----------- board/keymile/km82xx/km82xx.c | 8 ++++++++ board/keymile/km83xx/km83xx.c | 24 +++++++++++++++++++++++- 3 files changed, 31 insertions(+), 12 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 468c755d67c..ef93ed3f66e 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -183,17 +183,6 @@ void i2c_init_board(void) } #endif - -#if !defined(MACH_TYPE_KM_KIRKWOOD) -int ethernet_present(void) -{ - struct km_bec_fpga *base = - (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; - - return in_8(&base->bprth) & PIGGY_PRESENT; -} -#endif - int board_eth_init(bd_t *bis) { if (ethernet_present()) diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 67b69f6cb34..defc885db70 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -385,6 +385,14 @@ void handle_mgcoge3un_reset(void) } #endif +int ethernet_present(void) +{ + struct km_bec_fpga *base = + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; + + return in_8(&base->bprth) & PIGGY_PRESENT; +} + /* * Early board initalization. */ diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 83a8753e5a0..b027173725e 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -133,6 +133,28 @@ const uint upma_table[] = { }; #endif +static int piggy_present(void) +{ + struct km_bec_fpga __iomem *base = + (struct km_bec_fpga __iomem *)CONFIG_SYS_KMBEC_FPGA_BASE; + + return in_8(&base->bprth) & PIGGY_PRESENT; +} + +#if defined(CONFIG_KMVECT1) +int ethernet_present(void) +{ + /* ethernet port connected to simple switch without piggy */ + return 1; +} +#else +int ethernet_present(void) +{ + return piggy_present(); +} +#endif + + int board_early_init_r(void) { struct km_bec_fpga *base = @@ -280,7 +302,7 @@ int checkboard(void) { puts("Board: Keymile " CONFIG_KM_BOARD_NAME); - if (ethernet_present()) + if (piggy_present()) puts(" with PIGGY."); puts("\n"); return 0; -- cgit v1.2.3 From 322bb2056ba90d55603f081ae57a652a06357bac Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 21 Jan 2013 03:55:17 +0000 Subject: km/common/ivm: rework piggy mac adress offset generation For the the kmvect1 board we will also need a functionality to add an offset to the IVMs MAC address, because these board will have two valid ethernet ports for debugging purpose. So move the code to an own function. Signed-off-by: Holger Brunck --- board/keymile/common/ivm.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index 607daa6d655..d568fd9def5 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -201,6 +201,22 @@ static int ivm_check_crc(unsigned char *buf, int block) return 0; } +static int calculate_mac_offset(unsigned char *valbuf, unsigned char *buf, + int offset) +{ + unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6]; + + if (offset == 0) + return 0; + + val += offset; + buf[4] = (val >> 16) & 0xff; + buf[5] = (val >> 8) & 0xff; + buf[6] = val & 0xff; + sprintf((char *)valbuf, "%pM", buf + 1); + return 0; +} + static int ivm_analyze_block2(unsigned char *buf, int len) { unsigned char valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN]; @@ -210,17 +226,7 @@ static int ivm_analyze_block2(unsigned char *buf, int len) sprintf((char *)valbuf, "%pM", buf + 1); ivm_set_value("IVM_MacAddress", (char *)valbuf); /* if an offset is defined, add it */ -#if defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET) - if (CONFIG_PIGGY_MAC_ADRESS_OFFSET > 0) { - unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6]; - - val += CONFIG_PIGGY_MAC_ADRESS_OFFSET; - buf[4] = (val >> 16) & 0xff; - buf[5] = (val >> 8) & 0xff; - buf[6] = val & 0xff; - sprintf((char *)valbuf, "%pM", buf + 1); - } -#endif + calculate_mac_offset(buf, valbuf, CONFIG_PIGGY_MAC_ADRESS_OFFSET); #ifdef MACH_TYPE_KM_KIRKWOOD setenv((char *)"ethaddr", (char *)valbuf); #else -- cgit v1.2.3 From 5bcd64cf5c5510365a14d11043033eb7b6144ead Mon Sep 17 00:00:00 2001 From: Karlheinz Jerg Date: Mon, 21 Jan 2013 03:55:18 +0000 Subject: powerpc/83xx/km: add MV88E6122 switch support for kmvect1 kmvect1 has a UEC2 connection to the piggy board and a UEC0 connection to the switch MV88E6122. This switch has a connection to a frontport ethernet interface. The ethernet port used for network booting is automatically selected by u-boot. If a Piggy is plugged, the Piggy port is selected (UEC2, eth1). If the Piggy isn't present, the Frontport is selected (UEC0, eth0). The switch reset is connected to a GPIO on the PRIO3 board FPGA (GPIO28) and released at startup. Signed-off-by: Karlheinz Jerg Signed-off-by: Holger Brunck --- board/keymile/common/ivm.c | 8 +++++- board/keymile/km83xx/km83xx.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) (limited to 'board/keymile') diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index d568fd9def5..22d525602a9 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -233,7 +233,13 @@ static int ivm_analyze_block2(unsigned char *buf, int len) if (getenv("ethaddr") == NULL) setenv((char *)"ethaddr", (char *)valbuf); #endif - +#ifdef CONFIG_KMVECT1 +/* KMVECT1 has two ethernet interfaces */ + if (getenv("eth1addr") == NULL) { + calculate_mac_offset(buf, valbuf, 1); + setenv((char *)"eth1addr", (char *)valbuf); + } +#endif /* IVM_MacCount */ count = (buf[10] << 24) + (buf[11] << 16) + diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index b027173725e..1e8e2cc360d 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -215,8 +215,75 @@ int misc_init_r(void) return 0; } +#if defined(CONFIG_KMVECT1) +#include +/* Marvell MV88E6122 switch configuration */ +static struct mv88e_sw_reg extsw_conf[] = { + /* port 1, FRONT_MDI, autoneg */ + { PORT(1), PORT_PHY, NO_SPEED_FOR }, + { PORT(1), PORT_CTRL, FORWARDING | EGRS_FLD_ALL }, + { PHY(1), PHY_1000_CTRL, NO_ADV }, + { PHY(1), PHY_SPEC_CTRL, AUTO_MDIX_EN }, + { PHY(1), PHY_CTRL, PHY_100_MBPS | AUTONEG_EN | AUTONEG_RST | + FULL_DUPLEX }, + /* port 2, unused */ + { PORT(2), PORT_CTRL, PORT_DIS }, + { PHY(2), PHY_CTRL, PHY_PWR_DOWN }, + { PHY(2), PHY_SPEC_CTRL, SPEC_PWR_DOWN }, + /* port 3, BP_MII (CPU), PHY mode, 100BASE */ + { PORT(3), PORT_CTRL, FORWARDING | EGRS_FLD_ALL }, + /* port 4, ESTAR to slot 11, SerDes, 1000BASE-X */ + { PORT(4), PORT_STATUS, NO_PHY_DETECT }, + { PORT(4), PORT_PHY, SPEED_1000_FOR }, + { PORT(4), PORT_CTRL, FORWARDING | EGRS_FLD_ALL }, + /* port 5, ESTAR to slot 13, SerDes, 1000BASE-X */ + { PORT(5), PORT_STATUS, NO_PHY_DETECT }, + { PORT(5), PORT_PHY, SPEED_1000_FOR }, + { PORT(5), PORT_CTRL, FORWARDING | EGRS_FLD_ALL }, + /* + * Errata Fix: 1.9V Output from Internal 1.8V Regulator, + * acc . MV-S300889-00D.pdf , clause 4.5 + */ + { PORT(5), 0x1A, 0xADB1 }, + /* port 6, unused, this port has no phy */ + { PORT(6), PORT_CTRL, PORT_DIS }, +}; +#endif + int last_stage_init(void) { +#if defined(CONFIG_KMVECT1) + struct km_bec_fpga __iomem *base = + (struct km_bec_fpga __iomem *)CONFIG_SYS_KMBEC_FPGA_BASE; + u8 tmp_reg; + + /* Release mv88e6122 from reset */ + tmp_reg = in_8(&base->res1[0]) | 0x10; /* DIRECT3 register */ + out_8(&base->res1[0], tmp_reg); /* GP28 as output */ + tmp_reg = in_8(&base->gprt3) | 0x10; /* GP28 to high */ + out_8(&base->gprt3, tmp_reg); + + /* configure MV88E6122 switch */ + char *name = "UEC2"; + + if (miiphy_set_current_dev(name)) + return 0; + + mv88e_sw_program(name, CONFIG_KM_MVEXTSW_ADDR, extsw_conf, + ARRAY_SIZE(extsw_conf)); + + mv88e_sw_reset(name, CONFIG_KM_MVEXTSW_ADDR); + + if (piggy_present()) { + setenv("ethact", "UEC2"); + setenv("netdev", "eth1"); + puts("using PIGGY for network boot\n"); + } else { + setenv("netdev", "eth0"); + puts("using frontport for network boot\n"); + } +#endif + #if defined(CONFIG_KMCOGE5NE) struct bfticu_iomap *base = (struct bfticu_iomap *)CONFIG_SYS_BFTIC3_BASE; -- cgit v1.2.3 From d42a3b74980e65e72185a07f9f556e00587e7349 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 21 Jan 2013 03:55:21 +0000 Subject: km/scripts: replace hardcoded uImage Replace uImage with ${uimage}. If uimage is not set, default it to uImage. Signed-off-by: Andreas Huber Signed-off-by: Holger Brunck --- board/keymile/scripts/develop-common.txt | 5 +++-- board/keymile/scripts/ramfs-common.txt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/scripts/develop-common.txt b/board/keymile/scripts/develop-common.txt index aa3d6595278..a6bb1b1d4a9 100644 --- a/board/keymile/scripts/develop-common.txt +++ b/board/keymile/scripts/develop-common.txt @@ -1,8 +1,9 @@ altbootcmd=run ${subbootcmds} bootcmd=run ${subbootcmds} -configure=km_setboardid && saveenv && reset +configure=run set_uimage; km_setboardid && saveenv && reset subbootcmds=tftpfdt tftpkernel nfsargs add_default boot nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${toolchain}/${arch} -tftpkernel=tftpboot ${load_addr_r} ${hostname}/uImage +tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} toolchain=/opt/eldk rootfssize=0 +set_uimage=printenv uimage || setenv uimage uImage diff --git a/board/keymile/scripts/ramfs-common.txt b/board/keymile/scripts/ramfs-common.txt index c1b45ab029a..8a8d2875587 100644 --- a/board/keymile/scripts/ramfs-common.txt +++ b/board/keymile/scripts/ramfs-common.txt @@ -4,8 +4,9 @@ altbootcmd=run ${subbootcmds} bootcmd=run ${subbootcmds} subbootcmds=tftpfdt tftpkernel setrootfsaddr tftpramfs flashargs add_default addpanic addramfs boot nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} -configure=km_setboardid && saveenv && reset +configure=run set_uimage; km_setboardid && saveenv && reset rootfsfile=${hostname}/rootfsImage setrootfsaddr=setexpr value ${pnvramaddr} - ${rootfssize} && setenv rootfsaddr 0x${value} -tftpkernel=tftpboot ${load_addr_r} ${hostname}/uImage +tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage +set_uimage=printenv uimage || setenv uimage uImage -- cgit v1.2.3 From 411190cb16b63e39345a608b68b3d1be5168117a Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 21 Jan 2013 03:55:28 +0000 Subject: powerpc/83xx/km: drop uneeded dtt_bus environment var There is no need for a environment variable to configure the dtt bus. Signed-off-by: Holger Brunck --- board/keymile/km83xx/km83xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 1e8e2cc360d..faaa39bc201 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -98,17 +98,13 @@ const qe_iop_conf_t qe_iop_conf_tab[] = { static int board_init_i2c_busses(void) { I2C_MUX_DEVICE *dev = NULL; - uchar *buf; + uchar *dtt_bus = (uchar *)"pca9547:70:a"; /* Set up the Bus for the DTTs */ - buf = (unsigned char *) getenv("dtt_bus"); - if (buf != NULL) - dev = i2c_mux_ident_muxstring(buf); - if (dev == NULL) { + dev = i2c_mux_ident_muxstring(dtt_bus); + if (dev == NULL) printf("Error couldn't add Bus for DTT\n"); - printf("please setup dtt_bus to where your\n"); - printf("DTT is found.\n"); - } + return 0; } -- cgit v1.2.3