[U-Boot] several problems with ethernet on MCF5445x
Wolfgang Wegner
wolfgang at leila.ping.de
Fri Mar 26 17:19:12 CET 2010
Hi all,
the problems boiled down to two things:
- full MII and non-shared MII-management interface is not
currently supported for MCF5445x
- when a PHY returns id 0x0, matching for this ID results in
a lock-up in mcfmii.c
considering PHY ID 0x0 as broken anyways, I could get my board
to run with both ethernet interfaces with the patch below. As this
is not yet thoroughly tested and my tree is too much out of sync
at the moment, I do not provide a proper patch for now, but maybe
this already helps somebody else in case he runs into the same
problems.
Regards,
Wolfgang
diff --git a/cpu/mcf5445x/cpu_init.c b/cpu/mcf5445x/cpu_init.c
index 48b37df..8b86d6d 100644
--- a/cpu/mcf5445x/cpu_init.c
+++ b/cpu/mcf5445x/cpu_init.c
@@ -152,13 +152,32 @@ int fecpin_setclear(struct eth_device *dev, int setclear)
struct fec_info_s *info = (struct fec_info_s *)dev->priv;
if (setclear) {
+#ifdef CONFIG_SYS_FEC_NO_SHARED_MII
+ if (info->iobase == CONFIG_SYS_FEC0_IOBASE)
+ gpio->par_feci2c |=
+ (GPIO_PAR_FECI2C_MDC0_MDC0 |
+ GPIO_PAR_FECI2C_MDIO0_MDIO0);
+ else
+ gpio->par_feci2c |=
+ (GPIO_PAR_FECI2C_MDC1_MDC1 |
+ GPIO_PAR_FECI2C_MDIO1_MDIO1);
+#else
gpio->par_feci2c |=
(GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);
+#endif
if (info->iobase == CONFIG_SYS_FEC0_IOBASE)
+#ifdef CONFIG_SYS_FEC_FULL_MII
+ gpio->par_fec |= GPIO_PAR_FEC_FEC0_MII;
+#else
gpio->par_fec |= GPIO_PAR_FEC_FEC0_RMII_GPIO;
+#endif
else
+#ifdef CONFIG_SYS_FEC_FULL_MII
+ gpio->par_fec |= GPIO_PAR_FEC_FEC1_MII;
+#else
gpio->par_fec |= GPIO_PAR_FEC_FEC1_RMII_ATA;
+#endif
} else {
gpio->par_feci2c &=
~(GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index 4acc29e..e83bb07 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -185,7 +185,10 @@ int mii_discover_phy(struct eth_device *dev)
printf("PHY @ 0x%x pass %d\n", phyno, pass);
#endif
- for (i = 0; i < (sizeof(phyinfo) / sizeof(phy_info_t)); i++) {
+ for (i = 0;
+ (i < (sizeof(phyinfo) / sizeof(phy_info_t)))
+ && (phyinfo[i].phyid != 0);
+ i++) {
if (phyinfo[i].phyid == phytype) {
#ifdef ET_DEBUG
printf("phyid %x - %s\n",
More information about the U-Boot
mailing list