summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-02-18 09:57:06 -0500
committerTom Rini <trini@ti.com>2013-02-18 09:57:06 -0500
commit1671ba7c0d5dd59c84cb3ae5dc586242d65cbf5f (patch)
tree65493c2c97adc37be6a60fc0a2fb81d214257fb1 /board
parentea6bd08b7717bf0d3f69ad9f016bf3b03b3eaf16 (diff)
parent411190cb16b63e39345a608b68b3d1be5168117a (diff)
downloadu-boot-imx-1671ba7c0d5dd59c84cb3ae5dc586242d65cbf5f.zip
u-boot-imx-1671ba7c0d5dd59c84cb3ae5dc586242d65cbf5f.tar.gz
u-boot-imx-1671ba7c0d5dd59c84cb3ae5dc586242d65cbf5f.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-mpc83xx
Diffstat (limited to 'board')
-rw-r--r--board/keymile/common/common.c13
-rw-r--r--board/keymile/common/ivm.c48
-rw-r--r--board/keymile/km82xx/km82xx.c8
-rw-r--r--board/keymile/km83xx/km83xx.c103
-rw-r--r--board/keymile/scripts/develop-common.txt5
-rw-r--r--board/keymile/scripts/ramfs-common.txt5
6 files changed, 132 insertions, 50 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 6f407b7..ef93ed3 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 <i2c.h>
-#endif
#if !defined(CONFIG_MPC83xx)
static void i2c_write_start_seq(void);
@@ -185,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/common/ivm.c b/board/keymile/common/ivm.c
index eaa924f..22d5256 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,24 +226,20 @@ 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
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) +
@@ -312,27 +324,15 @@ 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;
}
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();
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 67b69f6..defc885 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 83a8753..faaa39b 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;
}
@@ -133,6 +129,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 =
@@ -193,8 +211,75 @@ int misc_init_r(void)
return 0;
}
+#if defined(CONFIG_KMVECT1)
+#include <mv88e6352.h>
+/* 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;
@@ -280,7 +365,7 @@ int checkboard(void)
{
puts("Board: Keymile " CONFIG_KM_BOARD_NAME);
- if (ethernet_present())
+ if (piggy_present())
puts(" with PIGGY.");
puts("\n");
return 0;
diff --git a/board/keymile/scripts/develop-common.txt b/board/keymile/scripts/develop-common.txt
index aa3d659..a6bb1b1 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 c1b45ab..8a8d287 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