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 <lg@denx.de>
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c
index fcd941e..18bf2a8 100644
--- a/board/tqm8xx/tqm8xx.c
+++ b/board/tqm8xx/tqm8xx.c
@@ -504,4 +504,51 @@
}
#endif /* CONFIG_NSCU */
+/* ---------------------------------------------------------------------------- */
+/* TK885D specific initializaion */
+/* ---------------------------------------------------------------------------- */
+#ifdef CONFIG_TK885D
+#include <miiphy.h>
+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
+
/* ------------------------------------------------------------------------- */