From efc6f447c1b940d1650c4b854c5598a595ddc3da Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 10 Jan 2008 17:59:07 +0100 Subject: Add support for the TK885D baseboard from TELE-DATA The TK885D board uses a TQM885D module from TQ, this port adds an own configuration file and adds a last_stage_init() method to configure the two PHYs, depending on the phy_auto_nego environment variable. Signed-off-by: Guennadi Liakhovetski --- board/tqm8xx/tqm8xx.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'board/tqm8xx') diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c index fcd941e0d2..18bf2a8302 100644 --- a/board/tqm8xx/tqm8xx.c +++ b/board/tqm8xx/tqm8xx.c @@ -504,4 +504,51 @@ int misc_init_r (void) } #endif /* CONFIG_NSCU */ +/* ---------------------------------------------------------------------------- */ +/* TK885D specific initializaion */ +/* ---------------------------------------------------------------------------- */ +#ifdef CONFIG_TK885D +#include +int last_stage_init(void) +{ + const unsigned char phy[] = {CONFIG_FEC1_PHY, CONFIG_FEC2_PHY}; + unsigned short reg; + int ret, i = 100; + char *s; + + mii_init(); + /* Without this delay 0xff is read from the UART buffer later in + * abortboot() and autoboot is aborted */ + udelay(10000); + while (tstc() && i--) + (void)getc(); + + /* Check if auto-negotiation is prohibited */ + s = getenv("phy_auto_nego"); + + if (!s || !strcmp(s, "on")) + /* Nothing to do - autonegotiation by default */ + return 0; + + for (i = 0; i < 2; i++) { + ret = miiphy_read("FEC ETHERNET", phy[i], PHY_BMCR, ®); + if (ret) { + printf("Cannot read BMCR on PHY %d\n", phy[i]); + return 0; + } + /* Auto-negotiation off, hard set full duplex, 100Mbps */ + ret = miiphy_write("FEC ETHERNET", phy[i], + PHY_BMCR, (reg | PHY_BMCR_100MB | + PHY_BMCR_DPLX) & ~PHY_BMCR_AUTON); + if (ret) { + printf("Cannot write BMCR on PHY %d\n", phy[i]); + return 0; + } + } + + return 0; +} + +#endif + /* ------------------------------------------------------------------------- */ -- cgit v1.2.3