public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 6/7] 83xx/fdt_support: let user specifiy FSL USB Dual-Role controller role
@ 2008-03-14 20:20 Anton Vorontsov
  2008-03-20  1:35 ` Kim Phillips
  2008-03-26  0:27 ` Kim Phillips
  0 siblings, 2 replies; 11+ messages in thread
From: Anton Vorontsov @ 2008-03-14 20:20 UTC (permalink / raw)
  To: u-boot

Linux understands "host" (default), "peripheral" and "otg" (broken).
Though, U-Boot doesn't restrict dr_mode variable to these values (think
of renames in future).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 board/freescale/mpc837xerdb/mpc837xerdb.c |    1 +
 common/fdt_support.c                      |   25 +++++++++++++++++++++++++
 include/configs/MPC837XERDB.h             |    1 +
 include/fdt_support.h                     |    6 ++++++
 4 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 992c9cf..0ccac7b 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -148,5 +148,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 	ft_pci_setup(blob, bd);
 #endif
 	ft_cpu_setup(blob, bd);
+	fdt_fixup_dr_usb(blob, bd);
 }
 #endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 69eb667..10b66fc 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -615,3 +615,28 @@ void fdt_fixup_ethernet(void *fdt, bd_t *bd)
 	}
 }
 #endif
+
+#ifdef CONFIG_HAS_FSL_DR_USB
+void fdt_fixup_dr_usb(void *blob, bd_t *bd)
+{
+	char *mode;
+	const char *compat = "fsl-usb2-dr";
+	const char *prop = "dr_mode";
+	int node_offset;
+	int err;
+
+	mode = getenv("usb_dr_mode");
+	if (!mode)
+		return;
+
+	node_offset = fdt_node_offset_by_compatible(blob, 0, compat);
+	if (node_offset < 0)
+		printf("WARNING: could not find compatible node %s: %s.\n",
+			compat, fdt_strerror(node_offset));
+
+	err = fdt_setprop(blob, node_offset, prop, mode, strlen(mode) + 1);
+	if (err < 0)
+		printf("WARNING: could not set %s for %s: %s.\n",
+		       prop, compat, fdt_strerror(err));
+}
+#endif /* CONFIG_HAS_FSL_DR_USB */
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 033a5fb..2287fbc 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -576,6 +576,7 @@
  */
 #define CONFIG_ENV_OVERWRITE
 
+#define CONFIG_HAS_FSL_DR_USB
 #define CONFIG_HAS_ETH0				/* add support for "ethaddr" */
 #define CONFIG_ETHADDR	00:04:9f:ef:04:01
 #define CONFIG_HAS_ETH1				/* add support for "eth1addr" */
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 7836f28..c10de8a 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -50,6 +50,12 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 			 const void *val, int len, int create);
 void fdt_fixup_qe_firmware(void *fdt);
 
+#ifdef CONFIG_HAS_FSL_DR_USB
+void fdt_fixup_dr_usb(void *blob, bd_t *bd);
+#else
+static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {}
+#endif /* CONFIG_HAS_FSL_DR_USB */
+
 #ifdef CONFIG_OF_HAS_UBOOT_ENV
 int fdt_env(void *fdt);
 #endif
-- 
1.5.2.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-03-26  0:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 20:20 [U-Boot-Users] [PATCH 6/7] 83xx/fdt_support: let user specifiy FSL USB Dual-Role controller role Anton Vorontsov
2008-03-20  1:35 ` Kim Phillips
2008-03-24 14:44   ` Anton Vorontsov
2008-03-24 23:00     ` Kim Phillips
2008-03-25 13:48       ` Anton Vorontsov
2008-03-25 15:42         ` Kim Phillips
2008-03-25 16:06           ` Anton Vorontsov
2008-03-25 16:32             ` Jerry Van Baren
2008-03-25 16:33             ` Kim Phillips
2008-03-25 16:35               ` Jerry Van Baren
2008-03-26  0:27 ` Kim Phillips

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox