public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] fsl_dr_usb: Fixup disabled USB controllers nodes in	device tree
Date: Thu, 19 Feb 2009 18:45:47 +0300	[thread overview]
Message-ID: <20090219154547.GC26618@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090219154414.GA22391@oksana.dev.rtsoft.ru>

We should add status = "disabled" property when USB controller can't
be used (for example when USB pins muxed away to another device).

Also convert whole fdt_fixup_dr_usb() to use more compact routines
from fdt_support.h.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/usb/fsl_dr_usb.c |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/fsl_dr_usb.c b/drivers/usb/fsl_dr_usb.c
index af9797f..a646846 100644
--- a/drivers/usb/fsl_dr_usb.c
+++ b/drivers/usb/fsl_dr_usb.c
@@ -10,43 +10,33 @@
  */
 
 #include <common.h>
-#include <libfdt.h>
+#include <fsl_can_use.h>
+#include <fdt_support.h>
 
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 {
+	const char *compat = "fsl-usb2-dr";
 	char *mode;
 	char *type;
-	const char *compat = "fsl-usb2-dr";
-	const char *prop_mode = "dr_mode";
-	const char *prop_type = "phy_type";
-	int node_offset;
-	int err;
+
+	if (!fsl_can_use_dr_usb()) {
+		const char *reason = "disabled";
+
+		do_fixup_by_compat(blob, compat, "status", reason,
+				   strlen(reason) + 1, 1);
+		return;
+	}
 
 	mode = getenv("usb_dr_mode");
 	type = getenv("usb_phy_type");
 	if (!mode && !type)
 		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));
-		return;
-	}
+	if (mode)
+		do_fixup_by_compat(blob, compat, "dr_mode", mode,
+				   strlen(mode) + 1, 1);
 
-	if (mode) {
-		err = fdt_setprop(blob, node_offset, prop_mode, mode,
-				  strlen(mode) + 1);
-		if (err < 0)
-			printf("WARNING: could not set %s for %s: %s.\n",
-			       prop_mode, compat, fdt_strerror(err));
-	}
-
-	if (type) {
-		err = fdt_setprop(blob, node_offset, prop_type, type,
-				  strlen(type) + 1);
-		if (err < 0)
-			printf("WARNING: could not set %s for %s: %s.\n",
-			       prop_type, compat, fdt_strerror(err));
-	}
+	if (type)
+		do_fixup_by_compat(blob, compat, "type", type,
+				   strlen(type) + 1, 1);
 }
-- 
1.5.6.5

  parent reply	other threads:[~2009-02-19 15:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 15:44 [U-Boot] [PATCH 0/6] eSDHC/DR USB switching on MPC837X boards Anton Vorontsov
2009-02-19 15:45 ` [U-Boot] [PATCH 1/6] fdt_support, usb: Move fdt_fixup_dr_usb() routine to drivers/usb/ Anton Vorontsov
2009-02-20 11:24   ` Jerry Van Baren
2009-02-19 15:45 ` [U-Boot] [PATCH 2/6] Add FSL "Can use" framework Anton Vorontsov
2009-02-19 19:56   ` Wolfgang Denk
2009-02-23 21:50     ` Kim Phillips
2009-02-19 15:45 ` Anton Vorontsov [this message]
2009-02-19 15:45 ` [U-Boot] [PATCH 4/6] fsl_esdhc: Add device tree fixups Anton Vorontsov
2009-03-07  1:25   ` Andy Fleming
2009-04-29 21:20     ` Anton Vorontsov
2009-04-30 17:57       ` Scott Wood
2009-04-30 18:59         ` Anton Vorontsov
2009-04-30 19:28           ` Kim Phillips
2009-04-30 19:35             ` Anton Vorontsov
2009-04-30 19:39               ` Anton Vorontsov
2009-04-30 20:00                 ` Kim Phillips
2009-04-30 19:59               ` Kim Phillips
2009-04-30 20:20                 ` Anton Vorontsov
2009-05-01 15:59                   ` Scott Wood
2009-05-01 16:49                     ` Scott Wood
2009-05-02  0:32       ` Andy Fleming
2009-05-02  0:34         ` Anton Vorontsov
2009-02-19 15:45 ` [U-Boot] [PATCH 5/6] mpc83xx: MPC837XERDB: Add support for FSL eSDHC Anton Vorontsov
2009-02-19 15:45 ` [U-Boot] [PATCH 6/6] mpc83xx: MPC837XEMDS: Fixup eSDHC nodes in device tree Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090219154547.GC26618@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox