From: Igor Opaniuk <igor.opaniuk@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/6] colibri_imx6: migrate to DM_ETH
Date: Mon, 4 Nov 2019 11:12:00 +0100 [thread overview]
Message-ID: <20191104101204.17917-3-igor.opaniuk@gmail.com> (raw)
In-Reply-To: <20191104101204.17917-1-igor.opaniuk@gmail.com>
From: Igor Opaniuk <igor.opaniuk@toradex.com>
Migrate to DM_ETH and remove hardcoded pinmux configuration.
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
board/toradex/colibri_imx6/colibri_imx6.c | 59 ++---------------------
configs/colibri_imx6_defconfig | 3 ++
include/configs/colibri_imx6.h | 8 ---
3 files changed, 7 insertions(+), 63 deletions(-)
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index ad40b589c1..64295a42e5 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -51,9 +51,6 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
PAD_CTL_SRE_FAST | PAD_CTL_HYS)
-#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
- PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
-
#define WEAK_PULLUP (PAD_CTL_PUS_100K_UP | \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
PAD_CTL_SRE_SLOW)
@@ -112,24 +109,6 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
};
#endif /* CONFIG_FSL_ESDHC_IMX & CONFIG_SPL_BUILD */
-iomux_v3_cfg_t const enet_pads[] = {
- MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_RXD0__ENET_RX_DATA0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_RXD1__ENET_RX_DATA1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_RX_ER__ENET_RX_ER | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_TX_EN__ENET_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_TXD0__ENET_TX_DATA0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_TXD1__ENET_TX_DATA1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_ENET_CRS_DV__ENET_RX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
- MX6_PAD_GPIO_16__ENET_REF_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),
-};
-
-static void setup_iomux_enet(void)
-{
- imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
-}
-
/* mux auxiliary pins to GPIO, so they can be used from the U-Boot cmdline */
iomux_v3_cfg_t const gpio_pads[] = {
/* ADDRESS[17:18] [25] used as GPIO */
@@ -371,12 +350,8 @@ int board_phy_config(struct phy_device *phydev)
return 0;
}
-int board_eth_init(bd_t *bis)
+int setup_fec(void)
{
- struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
- uint32_t base = IMX_FEC_BASE;
- struct mii_dev *bus = NULL;
- struct phy_device *phydev = NULL;
int ret;
/* provide the PHY clock from the i.MX 6 */
@@ -384,34 +359,6 @@ int board_eth_init(bd_t *bis)
if (ret)
return ret;
- /* set gpr1[ENET_CLK_SEL] */
- setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
-
- setup_iomux_enet();
-
-#ifdef CONFIG_FEC_MXC
- bus = fec_get_miibus(base, -1);
- if (!bus)
- return 0;
-
- /* scan PHY 1..7 */
- phydev = phy_find_by_mask(bus, 0xff, PHY_INTERFACE_MODE_RMII);
- if (!phydev) {
- free(bus);
- puts("no PHY found\n");
- return 0;
- }
-
- phy_reset(phydev);
- printf("using PHY at %d\n", phydev->addr);
- ret = fec_probe(bis, -1, base, bus, phydev);
- if (ret) {
- printf("FEC MXC: %s:failed\n", __func__);
- free(phydev);
- free(bus);
- }
-#endif /* CONFIG_FEC_MXC */
-
return 0;
}
@@ -633,7 +580,9 @@ int board_init(void)
{
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
-
+#if defined(CONFIG_FEC_MXC)
+ setup_fec();
+#endif
#if defined(CONFIG_VIDEO_IPUV3)
setup_display();
#endif
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 4f7ca7b91d..647564a03a 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -62,6 +62,9 @@ CONFIG_FSL_USDHC=y
CONFIG_PHYLIB=y
CONFIG_PHY_MICREL=y
CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
CONFIG_MII=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_IMX6=y
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 1f2b89e722..390052362b 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -43,14 +43,6 @@
#define CONFIG_SYS_FSL_ESDHC_ADDR 0
#define CONFIG_SYS_FSL_USDHC_NUM 2
-/* Network */
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE RMII
-#define CONFIG_ETHPRIME "FEC"
-#define CONFIG_FEC_MXC_PHYADDR 1
-#define CONFIG_TFTP_TSIZE
-
/* USB Configs */
/* Host */
#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
--
2.17.1
next prev parent reply other threads:[~2019-11-04 10:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 10:11 [U-Boot] [PATCH v1 0/6] imx: colibri imx6/imx7: apalis imx6: migrate to DM_ETH Igor Opaniuk
2019-11-04 10:11 ` [U-Boot] [PATCH v1 1/6] ARM: dts: imx6_colibri: introduce fec node Igor Opaniuk
2019-12-03 14:45 ` Oleksandr Suvorov
2019-12-29 10:28 ` sbabic at denx.de
2019-11-04 10:12 ` Igor Opaniuk [this message]
2019-12-03 14:46 ` [U-Boot] [PATCH v1 2/6] colibri_imx6: migrate to DM_ETH Oleksandr Suvorov
2019-12-29 10:26 ` sbabic at denx.de
2019-11-04 10:12 ` [U-Boot] [PATCH v1 3/6] ARM: dts: imx6_apalis: introduce fec node Igor Opaniuk
2019-12-03 14:42 ` Oleksandr Suvorov
2019-12-29 10:25 ` sbabic at denx.de
2019-11-04 10:12 ` [U-Boot] [PATCH v1 4/6] apalis_imx6: migrate to DM_ETH Igor Opaniuk
2019-12-03 14:47 ` Oleksandr Suvorov
2019-12-29 10:26 ` sbabic at denx.de
2019-11-04 10:12 ` [U-Boot] [PATCH v1 5/6] ARM: dts: imx7: imx7_colibri: introduce fec node Igor Opaniuk
2019-12-03 14:48 ` Oleksandr Suvorov
2019-12-29 10:25 ` sbabic at denx.de
2019-11-04 10:12 ` [U-Boot] [PATCH v1 6/6] colibri_imx7: migrate to DM_ETH Igor Opaniuk
2019-12-03 14:44 ` Oleksandr Suvorov
2019-12-29 10:28 ` sbabic at denx.de
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191104101204.17917-3-igor.opaniuk@gmail.com \
--to=igor.opaniuk@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox