Skip to contentSkip to conversation

83xx: mpc8315erdb: add support for switching between ULPI/UTMI USB PHYs

PATCH New Anton Vorontsov 2 participants 3 messages Jul 8, 2008 – Jul 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 83xx: mpc8315erdb: add support for switching between ULPI/UTMI USB PHYs

Freescale ships MPC8315E-RDB boards either with TSEC1 and USB UTMI support, or without TSEC1 but with USB ULPI PHY support in addition. With this patch user can specify desired USB PHY.

Also, it seems that we can't distinguish the two boards in software, so user have to set mpc8315erdb' environment variable to either 'tsec1' (TSEC1 enabled) or ulpi' (board with ULPI PHY, TSEC1 disabled), so that Linux will not probe for TSEC1.

---
 board/freescale/mpc8315erdb/mpc8315erdb.c |   38 +++++++++++++++++++++++++++-
 include/configs/MPC8315ERDB.h             |    2 +
 2 files changed, 38 insertions(+), 2 deletions(-)
board/freescale/mpc8315erdb/mpc8315erdb.c +36 -2
index 7af36dd..7555ffb 100644
@@ -25,9 +25,8 @@
 
 #include <common.h>
 #include <i2c.h>
-#if defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
-#endif
+#include <fdt_support.h>
 #include <pci.h>
 #include <mpc83xx.h>
 
@@ -122,11 +121,46 @@ void pci_init_board(void)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
+void fdt_tsec1_fixup(void *fdt, bd_t *bd)
+{
+	char *mpc8315erdb = getenv("mpc8315erdb");
+	const char disabled[] = "disabled";
+	const char *path;
+	int ret;
+
+	if (!mpc8315erdb) {
+		if (!strcmp(mpc8315erdb, "tsec1")) {
+			return;
+		} else if (strcmp(mpc8315erdb, "ulpi")) {
+			printf("WARNING: wrong `mpc8315erdb' environment "
+			       "variable specified: `%s'. Should be `ulpi' "
+			       "or `tsec1'.\n", mpc8315erdb);
+			return;
+		}
+	}
+
+	ret = fdt_path_offset(fdt, "/aliases");
+	if (ret < 0) {
+		printf("WARNING: can't find /aliases node\n");
+		return;
+	}
+
+	path = fdt_getprop(fdt, ret, "ethernet0", NULL);
+	if (!path) {
+		printf("WARNING: can't find ethernet0 alias\n");
+		return;
+	}
+
+	do_fixup_by_path(fdt, path, "status", disabled, sizeof(disabled), 1);
+}
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
 	ft_cpu_setup(blob, bd);
 #ifdef CONFIG_PCI
 	ft_pci_setup(blob, bd);
 #endif
+	fdt_fixup_dr_usb(blob, bd);
+	fdt_tsec1_fixup(blob, bd);
 }
 #endif
include/configs/MPC8315ERDB.h +2 -0
index 095f665..6b019f8 100644
@@ -321,6 +321,8 @@
 #define CONFIG_NET_MULTI	1
 #endif
 
+#define CONFIG_HAS_FSL_DR_USB
+
 /*
  * TSEC
  */
Signature · 1 line
1.5.5.4
#1 lore raw

PATCH 1/1 83xx: mpc8315erdb: fix silly thinko in fdt_tsec1_fixup

The thinko was quite silly indeed, I messed with !ptr. Normally this would trigger some fault, but in U-Boot NULL pointer is equal to phys 0, so the code was working still, just didn't actually test mpc8315erdb environment variable value. Heh.

---

Kim, sorry for this inconvenience.

 board/freescale/mpc8315erdb/mpc8315erdb.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
board/freescale/mpc8315erdb/mpc8315erdb.c +10 -9
index 7555ffb..3eecee2 100644
@@ -128,15 +128,16 @@ void fdt_tsec1_fixup(void *fdt, bd_t *bd)
 	const char *path;
 	int ret;
 
-	if (!mpc8315erdb) {
-		if (!strcmp(mpc8315erdb, "tsec1")) {
-			return;
-		} else if (strcmp(mpc8315erdb, "ulpi")) {
-			printf("WARNING: wrong `mpc8315erdb' environment "
-			       "variable specified: `%s'. Should be `ulpi' "
-			       "or `tsec1'.\n", mpc8315erdb);
-			return;
-		}
+	if (!mpc8315erdb)
+		return;
+
+	if (!strcmp(mpc8315erdb, "tsec1")) {
+		return;
+	} else if (strcmp(mpc8315erdb, "ulpi")) {
+		printf("WARNING: wrong `mpc8315erdb' environment "
+		       "variable specified: `%s'. Should be `ulpi' "
+		       "or `tsec1'.\n", mpc8315erdb);
+		return;
 	}
 
 	ret = fdt_path_offset(fdt, "/aliases");
Signature · 1 line
1.5.5.4
#2 lore raw

PATCH 1/1 83xx: mpc8315erdb: fix silly thinko in fdt_tsec1_fixup

Quoted 7 lines · On Thu, 10 Jul 2008 17:20:51 +0400 Anton Vorontsov <[email protected]>…

The thinko was quite silly indeed, I messed with !ptr. Normally this would trigger some fault, but in U-Boot NULL pointer is equal to phys 0, so the code was working still, just didn't actually test mpc8315erdb environment variable value. Heh.

---

applied to u-boot-mpc83xx.git#next.

Thanks Anton,

Kim