diff mbox

[U-Boot,v3,5/5] i.mx6q: mx6qsabrelite: Update the network configuration

Message ID 1328145288-23406-5-git-send-email-troy.kisky@boundarydevices.com
State Accepted
Headers show

Commit Message

Troy Kisky Feb. 2, 2012, 1:14 a.m. UTC
Define CONFIG_PHY_MICREL, and
minimize the tx clock delay.

There is an issue with 1000 baseTx mode on early revs
of the SabreLite boards. The center tap pin 9 of the mag RJ45
USB combo was connected to the 3.3 filtered supply. Letting
this pin float solved the problem. Symptoms of the problem
were packets with many extra zeroes tacked on the end, and random
bit flips causing a high rate of CRC errors. 10/100 baseTx worked
fine on all revs. To disable 1000 baseTx for these boards, simply
define the environment variable disable_giga. ie.

setenv disable_giga 1

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Acked-by: Dirk Behme <dirk.behme@de.bosch.com>
---
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   46 +++++--------------------
 include/configs/mx6qsabrelite.h               |    2 +
 2 files changed, 11 insertions(+), 37 deletions(-)

Comments

Troy Kisky Feb. 2, 2012, 1:37 a.m. UTC | #1
On 2/1/2012 6:14 PM, Troy Kisky wrote:
> +	ksz9021_phy_write(phydev, 0, 0x105, 0x0);	/* min rx data delay */
> +	ksz9021_phy_write(phydev, 0, 0x106, 0x0);	/* min tx data delay */
> +	/* max rx/tx clock delay, min rx/tx control */
> +	ksz9021_phy_write(phydev, 0, 0x104, 0xf0f0);
> +	if (phydev->drv->config)
> +		phydev->drv->config(phydev);
>
I didn't notice this warning before

mx6qsabrelite.c:244: warning: implicit declaration of function 
'ksz9021_phy_write'

Can I add this definition to mx6qsabrelite.c?

checkpatch says it should be in a .h file.


I'll resend just 5/5 if nobody spots other issues.

Troy
Jason Liu Feb. 2, 2012, 2:41 a.m. UTC | #2
Troy,

On Thu, Feb 2, 2012 at 9:37 AM, Troy Kisky
<troy.kisky@boundarydevices.com> wrote:
> On 2/1/2012 6:14 PM, Troy Kisky wrote:
>>
>> +       ksz9021_phy_write(phydev, 0, 0x105, 0x0);       /* min rx data
>> delay */
>> +       ksz9021_phy_write(phydev, 0, 0x106, 0x0);       /* min tx data
>> delay */
>> +       /* max rx/tx clock delay, min rx/tx control */
>> +       ksz9021_phy_write(phydev, 0, 0x104, 0xf0f0);
>> +       if (phydev->drv->config)
>> +               phydev->drv->config(phydev);
>>
> I didn't notice this warning before
>
> mx6qsabrelite.c:244: warning: implicit declaration of function
> 'ksz9021_phy_write'
>
> Can I add this definition to mx6qsabrelite.c?

Definition or declaration? If the function only used by sabrelite board,
you can move the definition to mx6qsabrelite.c. If it has more users,
you need add it to one head file and include this head file in mx6qsabrelite.c.

I searched u-boot and find only sabrelite board use ksz9021_phy_write, so
you can move the definition here.

>
> checkpatch says it should be in a .h file.
>
>
> I'll resend just 5/5 if nobody spots other issues.

Please had better re-post the whole patch-set to facilitate the
user(at least me) to apply the patch and test.
And please make sure you don't break i.mx6qarm2 board. Thanks,

>
> Troy
>
diff mbox

Patch

diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index a53b01f..6c11660 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -193,53 +193,25 @@  int board_mmc_init(bd_t *bis)
 }
 #endif
 
-#define MII_1000BASET_CTRL		0x9
-#define MII_EXTENDED_CTRL		0xb
-#define MII_EXTENDED_DATAW		0xc
-
-int fecmxc_mii_postcall(int phy)
+int board_phy_config(struct phy_device *phydev)
 {
-	/* prefer master mode */
-	miiphy_write("FEC", phy, MII_1000BASET_CTRL, 0x0f00);
-
-	/* min rx data delay */
-	miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x8105);
-	miiphy_write("FEC", phy, MII_EXTENDED_DATAW, 0x0000);
-
-	/* max rx/tx clock delay, min rx/tx control delay */
-	miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x8104);
-	miiphy_write("FEC", phy, MII_EXTENDED_DATAW, 0xf0f0);
-	miiphy_write("FEC", phy, MII_EXTENDED_CTRL, 0x104);
-
+	ksz9021_phy_write(phydev, 0, 0x105, 0x0);	/* min rx data delay */
+	ksz9021_phy_write(phydev, 0, 0x106, 0x0);	/* min tx data delay */
+	/* max rx/tx clock delay, min rx/tx control */
+	ksz9021_phy_write(phydev, 0, 0x104, 0xf0f0);
+	if (phydev->drv->config)
+		phydev->drv->config(phydev);
 	return 0;
 }
 
 int board_eth_init(bd_t *bis)
 {
-	struct eth_device *dev;
 	int ret;
-
 	setup_iomux_enet();
-
 	ret = cpu_eth_init(bis);
-	if (ret) {
+	if (ret)
 		printf("FEC MXC: %s:failed\n", __func__);
-		return ret;
-	}
-
-	dev = eth_get_dev_by_name("FEC");
-	if (!dev) {
-		printf("FEC MXC: Unable to get FEC device entry\n");
-		return -EINVAL;
-	}
-
-	ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
-	if (ret) {
-		printf("FEC MXC: Unable to register FEC mii postcall\n");
-		return ret;
-	}
-
-	return 0;
+	return ret;
 }
 
 int board_early_init_f(void)
diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 2e9775a..47a1832 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -67,6 +67,8 @@ 
 #define	CONFIG_FEC_XCV_TYPE		RGMII
 #define CONFIG_ETHPRIME			"FEC"
 #define CONFIG_FEC_MXC_PHYADDR		6
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_MICREL
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE