Ethernet support on all three LS1012A platforms(FRDM, QDS and RDB) is
enabled with this patch.
eth.c files for all 3 platforms contain board ethernet initialization
function and also function to reset phy.
Signed-off-by: Calvin Johnson
Signed-off-by: Anjaneyulu Jagarlmudi
---
board/freescale/ls1012afrdm/Makefile | 1 +
board/freescale/ls1012afrdm/eth.c | 86 +
board/freescale/ls1012afrdm/ls1012afrdm.c | 5 -
board/freescale/ls1012aqds/Makefile | 1 +
board/freescale/ls1012aqds/eth.c | 263 ++
board/freescale/ls1012aqds/ls1012aqds.c | 97 +-
board/freescale/ls1012aqds/ls1012aqds_pfe.h | 48 +
board/freescale/ls1012aqds/ls1012aqds_qixis.h | 2 +-
board/freescale/ls1012ardb/Makefile | 1 +
board/freescale/ls1012ardb/eth.c | 70 +++
board/freescale/ls1012ardb/ls1012ardb.c | 4 -
include/configs/ls1012ardb.h | 5 +
12 files changed, 568 insertions(+), 15 deletions(-)
create mode 100644 board/freescale/ls1012afrdm/eth.c
create mode 100644 board/freescale/ls1012aqds/eth.c
create mode 100644 board/freescale/ls1012aqds/ls1012aqds_pfe.h
create mode 100644 board/freescale/ls1012ardb/eth.c
diff --git a/board/freescale/ls1012afrdm/Makefile
b/board/freescale/ls1012afrdm/Makefile
index dbfa2ce..1364f22 100644
--- a/board/freescale/ls1012afrdm/Makefile
+++ b/board/freescale/ls1012afrdm/Makefile
@@ -5,3 +5,4 @@
#
obj-y += ls1012afrdm.o
+obj-y += eth.o
diff --git a/board/freescale/ls1012afrdm/eth.c
b/board/freescale/ls1012afrdm/eth.c
new file mode 100644
index 000..d9583ce
--- /dev/null
+++ b/board/freescale/ls1012afrdm/eth.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#define DEFAULT_PFE_MDIO_NAME "PFE_MDIO"
+#define DEFAULT_PFE_MDIO1_NAME "PFE_MDIO1"
+
+#define MASK_ETH_PHY_RST 0x0100
+
+void reset_phy(void)
+{
+ unsigned int val;
+ struct ccsr_gpio *pgpio = (void *)(GPIO1_BASE_ADDR);
+
+ setbits_be32(>gpdir, MASK_ETH_PHY_RST);
+
+ val = in_be32(>gpdat);
+ setbits_be32(>gpdat, val & ~MASK_ETH_PHY_RST);
+ mdelay(10);
+
+ val = in_be32(>gpdat);
+ setbits_be32(>gpdat, val | MASK_ETH_PHY_RST);
+ mdelay(50);
+}
+
+int board_eth_init(bd_t *bis)
+{
+#ifdef CONFIG_FSL_PFE
+ struct mii_dev *bus;
+ struct mdio_info mac1_mdio_info;
+
+ reset_phy();
+
+ init_pfe_scfg_dcfg_regs();
+
+ mac1_mdio_info.reg_base = (void *)EMAC1_BASE_ADDR;
+ mac1_mdio_info.name = DEFAULT_PFE_MDIO_NAME;
+
+ bus = ls1012a_mdio_init(_mdio_info);
+ if (!bus) {
+ printf("Failed to register mdio\n");
+ return -1;
+ }
+
+ /* We don't really need this MDIO bus,
+* this is called just to initialize EMAC2 MDIO interface */
+ mac1_mdio_info.reg_base = (void *)0x0422; /*EMAC2_BASE_ADDR*/
+ mac1_mdio_info.name = DEFAULT_PFE_MDIO1_NAME;
+
+ bus = ls1012a_mdio_init(_mdio_info);
+ if (!bus) {
+ printf("Failed to register mdio\n");
+ return -1;
+ }
+
+ /* MAC1 */
+ ls1012a_set_mdio(0, miiphy_get_dev_by_name(DEFAULT_PFE_MDIO_NAME));
+ ls1012a_set_phy_address_mode(0, EMAC1_PHY_ADDR,
+PHY_INTERFACE_MODE_SGMII);
+
+ /* MAC2 */
+ ls1012a_set_mdio(1, miiphy_get_dev_by_name(DEFAULT_PFE_MDIO_NAME));
+ ls1012a_set_phy_address_mode(1, EMAC2_PHY_ADDR,
+PHY_INTERFACE_MODE_SGMII);
+
+
+ return cpu_eth_init(bis);
+#endif
+}
diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c
b/board/freescale/ls1012afrdm/ls1012afrdm.c
index 9afd1c4..0145886 100644
--- a/board/freescale/ls1012afrdm/ls1012afrdm.c
+++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
@@ -57,11 +57,6 @@ int dram_init(void)
return 0;
}
-int board_eth_init(bd_t *bis)
-{
- return pci_eth_init(bis);
-}
-
int board_early_init_f(void)
{
fsl_lsch2_early_init_f();
diff --git a/board/freescale/ls1012aqds/Makefile
b/board/freescale/ls1012aqds/Makefile
index 0b813f9..b18494a 100644
--- a/board/freescale/ls1012aqds/Makefile
+++ b/board/freescale/ls1012aqds/Makefile
@@ -5,3 +5,4 @@
#
obj-y += ls1012aqds.o
+obj-y += eth.o
diff --git a/board/freescale/ls1012aqds/eth.c b/board/freescale/ls1012aqds/eth.c
new file mode 100644
index 000..bf916f3
--- /dev/null
+++ b/board/freescale/ls1012aqds/eth.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include
+#include
+#include
+#include
+#include