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/km83xx/km83xx.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'board/keymile/km83xx/km83xx.c') 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 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/km83xx/km83xx.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'board/keymile/km83xx/km83xx.c') 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 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/km83xx/km83xx.c') 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