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 1/6] fdt_support, usb: Move fdt_fixup_dr_usb() routine to	drivers/usb/
Date: Thu, 19 Feb 2009 18:45:43 +0300	[thread overview]
Message-ID: <20090219154543.GA26618@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090219154414.GA22391@oksana.dev.rtsoft.ru>

In subsequent patches we'll use FSL-specific functions in
fdt_fixup_dr_usb(), so let's move the routine to a more appropriate
place.

So far fsl_dr_usb.c isn't actually an USB driver, but eventually it
will turn into one, let's hope. ;-)

Also rename CONFIG_HAS_FSL_DR_USB to CONFIG_USB_FSL_DR to be
consistent with other USB drivers.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 board/freescale/mpc8315erdb/mpc8315erdb.c |    1 +
 board/freescale/mpc837xemds/mpc837xemds.c |    1 +
 board/freescale/mpc837xerdb/mpc837xerdb.c |    1 +
 common/fdt_support.c                      |   41 ----------------------
 drivers/usb/Makefile                      |    1 +
 drivers/usb/fsl_dr_usb.c                  |   52 +++++++++++++++++++++++++++++
 include/configs/MPC8315ERDB.h             |    2 +-
 include/configs/MPC837XEMDS.h             |    2 +-
 include/configs/MPC837XERDB.h             |    2 +-
 include/fdt_support.h                     |    6 ---
 include/fsl_dr_usb.h                      |   21 +++++++++++
 11 files changed, 80 insertions(+), 50 deletions(-)
 create mode 100644 drivers/usb/fsl_dr_usb.c
 create mode 100644 include/fsl_dr_usb.h

diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c
index f80b0ba..9d6896d 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -30,6 +30,7 @@
 #include <pci.h>
 #include <mpc83xx.h>
 #include <netdev.h>
+#include <fsl_dr_usb.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index 062d762..376b7f2 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -18,6 +18,7 @@
 #include <tsec.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <fsl_dr_usb.h>
 #include "pci.h"
 #include "../common/pq-mds-pib.h"
 
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 318a3dc..8cbac14 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -19,6 +19,7 @@
 #include <fdt_support.h>
 #include <spd_sdram.h>
 #include <vsc7385.h>
+#include <fsl_dr_usb.h>
 
 #if defined(CONFIG_SYS_DRAM_TEST)
 int
diff --git a/common/fdt_support.c b/common/fdt_support.c
index b54f886..ec6cff1 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -454,47 +454,6 @@ void fdt_fixup_ethernet(void *fdt)
 	}
 }
 
-#ifdef CONFIG_HAS_FSL_DR_USB
-void fdt_fixup_dr_usb(void *blob, bd_t *bd)
-{
-	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;
-
-	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) {
-		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));
-	}
-}
-#endif /* CONFIG_HAS_FSL_DR_USB */
-
 #if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx)
 /*
  * update crypto node properties to a specified revision of the SEC
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index b306a65..bb71a26 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
 COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
 COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
+COBJS-$(CONFIG_USB_FSL_DR) += fsl_dr_usb.o
 
 # device
 ifdef CONFIG_USB_DEVICE
diff --git a/drivers/usb/fsl_dr_usb.c b/drivers/usb/fsl_dr_usb.c
new file mode 100644
index 0000000..af9797f
--- /dev/null
+++ b/drivers/usb/fsl_dr_usb.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2008-2009 MontaVista Software, Inc.
+ *
+ * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include <common.h>
+#include <libfdt.h>
+
+void fdt_fixup_dr_usb(void *blob, bd_t *bd)
+{
+	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;
+
+	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) {
+		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));
+	}
+}
diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h
index 9fa91f4..e3dcf96 100644
--- a/include/configs/MPC8315ERDB.h
+++ b/include/configs/MPC8315ERDB.h
@@ -344,7 +344,7 @@
 #define CONFIG_NET_MULTI	1
 #endif
 
-#define CONFIG_HAS_FSL_DR_USB
+#define CONFIG_USB_FSL_DR	1
 
 /*
  * TSEC
diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h
index a62d805..68e0239 100644
--- a/include/configs/MPC837XEMDS.h
+++ b/include/configs/MPC837XEMDS.h
@@ -384,7 +384,7 @@ extern int board_pci_host_broken(void);
 #define CONFIG_83XX_GENERIC_PCIE	1
 #define CONFIG_PQ_MDS_PIB	1 /* PQ MDS Platform IO Board */
 
-#define CONFIG_HAS_FSL_DR_USB	1 /* fixup device tree for the DR USB */
+#define CONFIG_USB_FSL_DR	1 /* fixup device tree for the DR USB */
 
 #define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP		/* do pci plug-and-play */
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 8d0c93b..df7e746 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -638,7 +638,7 @@
 #define CONFIG_ETH1ADDR		00:04:9f:ef:04:02
 #endif
 
-#define CONFIG_HAS_FSL_DR_USB
+#define CONFIG_USB_FSL_DR	1
 
 #define CONFIG_IPADDR		10.0.0.2
 #define CONFIG_SERVERIP		10.0.0.1
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 6062df9..7ee29ef 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -53,12 +53,6 @@ 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 */
-
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC83XX)
 void fdt_fixup_crypto_node(void *blob, int sec_rev);
 #else
diff --git a/include/fsl_dr_usb.h b/include/fsl_dr_usb.h
new file mode 100644
index 0000000..c14d9ba
--- /dev/null
+++ b/include/fsl_dr_usb.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2008-2009 MontaVista Software, Inc.
+ *
+ * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef __DR_USB_H
+#define __DR_USB_H
+
+#ifdef CONFIG_USB_FSL_DR
+void fdt_fixup_dr_usb(void *blob, bd_t *bd);
+#else
+static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {}
+#endif
+
+#endif /* __DR_USB_H */
-- 
1.5.6.5

  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 ` Anton Vorontsov [this message]
2009-02-20 11:24   ` [U-Boot] [PATCH 1/6] fdt_support, usb: Move fdt_fixup_dr_usb() routine to drivers/usb/ 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 ` [U-Boot] [PATCH 3/6] fsl_dr_usb: Fixup disabled USB controllers nodes in device tree Anton Vorontsov
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=20090219154543.GA26618@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