summaryrefslogtreecommitdiff
path: root/board/scalys/simc-t10xx/eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/scalys/simc-t10xx/eth.c')
-rw-r--r--board/scalys/simc-t10xx/eth.c101
1 files changed, 70 insertions, 31 deletions
diff --git a/board/scalys/simc-t10xx/eth.c b/board/scalys/simc-t10xx/eth.c
index 2f5c401..2b548f1 100644
--- a/board/scalys/simc-t10xx/eth.c
+++ b/board/scalys/simc-t10xx/eth.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* SPDX-License-Identifier: GPL-2.0+
@@ -7,17 +7,6 @@
#include <common.h>
#include <netdev.h>
-#include <asm/immap_85xx.h>
-#include <fm_eth.h>
-#include <fsl_mdio.h>
-#include <malloc.h>
-#include <i2c.h>
-
-
-
-
-#include <common.h>
-#include <netdev.h>
#include <asm/fsl_serdes.h>
#include <asm/immap_85xx.h>
#include <fm_eth.h>
@@ -25,11 +14,7 @@
#include <malloc.h>
#include <fsl_dtsec.h>
#include <vsc9953.h>
-
-//#include "../common/fman.h"
-//#include "../common/qixis.h"
-
-
+#include <i2c.h>
#include "../../freescale/common/fman.h"
@@ -53,16 +38,24 @@ int board_eth_init(bd_t *bis)
int phy_addr = 0;
#ifdef CONFIG_VSC9953
- int lane;
- phy_interface_t phy_int;
- struct mii_dev *bus;
+ /*phy_interface_t phy_int;*/
+ /*struct mii_dev *bus;*/
struct ccsr_scfg *scfg;
#endif
uint32_t *gpio2_gpdir = (uint32_t *) 0xffe131000;
uint32_t *gpio2_gpdat = (uint32_t *) 0xffe131008;
+ uint32_t *gpio4_gpdir = (uint32_t *) 0xffe133000;
+ uint32_t *gpio4_gpdat = (uint32_t *) 0xffe133008;
uint32_t regval;
+ /* Try to read a byte from te carrier eeprom te determine if were on the correct carrier */
+ ret = i2c_read(0x54, 0, 2, &i2c_data, 1 );
+ if (ret != 0) {
+ printf("No dragonfruit carrier detected\n");
+ return 0;
+ }
+
printf("Initializing Fman\n");
memac_mdio_info.regs =
@@ -72,11 +65,24 @@ int board_eth_init(bd_t *bis)
/* Register the real 1G MDIO bus */
fm_memac_mdio_init(bis, &memac_mdio_info);
- /* Remove reset from Ethernet PHY's
- * IFC_PERR_B : GPIO2_15 : eth1_reset
- * IFC_CS_N2 : GPIO2_11 : eth2_reset */
-// gpio_set_value(2, 0);
-
+ /* Marvell 88E1111 Setup
+ *
+ * Remove reset from Ethernet PHY's
+ *
+ * Carrier board v1.x:
+ * IFC_PERR_B : GPIO2_15 : eth1_reset
+ * IFC_CS_N2 : GPIO2_11 : eth2_reset
+ *
+ * Carrier board v2.x:
+ * IFC_PERR_B : GPIO2_15 : eth1_reset
+ * IFC_CS_N2 : GPIO4_09 : eth2_reset
+ *
+ * Note: make sure gpio pins are configured as gpio in RCW!
+ */
+
+#if 0
+ /* TODO: use EEPROM data to chose carrier board version */
+ /* Carrier board v1.x */
/* Clear outputs to activate reset */
regval = in_be32(gpio2_gpdat);
regval &= ~((0x80000000 >> 11 ) | (0x80000000 >> 15));
@@ -94,11 +100,44 @@ int board_eth_init(bd_t *bis)
regval = in_be32(gpio2_gpdat);
regval |= ((0x80000000 >> 11 ) | (0x80000000 >> 15));
out_be32(gpio2_gpdat, regval);
-
+#else
+ /* Carrier board v2.x */
+ /* Clear outputs to activate reset */
+ regval = in_be32(gpio2_gpdat);
+ regval &= ~(0x80000000 >> 15);
+ out_be32(gpio2_gpdat, regval);
+ regval = in_be32(gpio4_gpdat);
+ regval &= ~(0x80000000 >> 9);
+ out_be32(gpio4_gpdat, regval);
+
+ /* Set outputs to output mode */
+ regval = in_be32(gpio2_gpdir);
+ regval |= (0x80000000 >> 15);
+ out_be32(gpio2_gpdir, regval);
+ regval = in_be32(gpio4_gpdir);
+ regval |= (0x80000000 >> 9);
+ out_be32(gpio4_gpdir, regval);
+
+ /* Wait for 10 ms to to meet reset timing */
+ mdelay(10);
+
+ /* Set outputs to de-activate reset */
+ regval = in_be32(gpio2_gpdat);
+ regval |= (0x80000000 >> 15);
+ out_be32(gpio2_gpdat, regval);
+ regval = in_be32(gpio4_gpdat);
+ regval |= (0x80000000 >> 9);
+ out_be32(gpio4_gpdat, regval);
+#endif
+
+ /* Write 0x4111 to reg 0x18 on both PHYs to change LEDs usage */
+ miiphy_write("FSL_MDIO0",0,0x18,0x4111);
+ miiphy_write("FSL_MDIO0",1,0x18,0x4111);
/* Remove SFP TX_disable */
i2c_set_bus_num(0);
- i2c_data = 0x3b;
+ ret = i2c_read(0x22, 0x0E, 1, &i2c_data, 1);
+ i2c_data &= ~0x04;
ret = i2c_write(0x22, 0x0E, 1, &i2c_data, 1);
mdelay(100);
@@ -163,9 +202,9 @@ int board_eth_init(bd_t *bis)
#ifdef CONFIG_VSC9953
for (i = 0; i < VSC9953_MAX_PORTS; i++) {
- int lane = -1;
- int phy_addr = 0;
- int phy_int = PHY_INTERFACE_MODE_NONE;
+ /*int lane = -1;*/
+ /*int phy_addr = 0;*/
+ /*int phy_int = PHY_INTERFACE_MODE_NONE;*/
switch (i) {
case 0:
case 1:
@@ -193,7 +232,7 @@ int board_eth_init(bd_t *bis)
vsc9953_port_enable(i);
break;
}
- bus = lane;
+ /*bus = lane;*/
}
#endif