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 2/6] Add FSL "Can use" framework
Date: Thu, 19 Feb 2009 18:45:45 +0300	[thread overview]
Message-ID: <20090219154545.GB26618@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090219154414.GA22391@oksana.dev.rtsoft.ru>

So far it's used for specifying whether we want to use FSL DR USB or
FSL eSDHC devices on MPC837X processors.

There are two more candidates for future use:
1. USB ULPI PHY vs. TSEC1 on MPC8315E-RDB boards;
2. Marvell vs. Vitesse PHYs on MPC8313E-RDB boards.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 board/freescale/common/Makefile      |    1 +
 board/freescale/common/fsl_can_use.c |   30 ++++++++++++++++++++++++++++++
 include/fsl_can_use.h                |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/common/fsl_can_use.c
 create mode 100644 include/fsl_can_use.h

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 02a824d..d4e2009 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -29,6 +29,7 @@ endif
 
 LIB	= $(obj)lib$(VENDOR).a
 
+COBJS-y				+= fsl_can_use.o
 COBJS-${CONFIG_FSL_CADMUS}	+= cadmus.o
 COBJS-${CONFIG_FSL_VIA}		+= cds_via.o
 COBJS-${CONFIG_FSL_DIU_FB}	+= fsl_diu_fb.o fsl_logo_bmp.o
diff --git a/board/freescale/common/fsl_can_use.c b/board/freescale/common/fsl_can_use.c
new file mode 100644
index 0000000..17cc20f
--- /dev/null
+++ b/board/freescale/common/fsl_can_use.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 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>
+
+#if defined(CONFIG_MPC837X) && defined(CONFIG_USB_FSL_DR) && \
+		defined(CONFIG_FSL_ESDHC)
+int __fsl_can_use_dr_usb(void)
+{
+	const char *usb_or_esdhc = getenv("usb_or_esdhc");
+
+	if (!usb_or_esdhc || !strcmp(usb_or_esdhc, "usb"))
+		return 1;
+
+	if (!strcmp(usb_or_esdhc, "esdhc"))
+		return 0;
+
+	printf("WARNING: Wrong value for `usb_or_esdhc' environment variable: "
+	       "`%s', should be `usb' (default) or `esdhc'\n", usb_or_esdhc);
+	return 1;
+}
+#endif
diff --git a/include/fsl_can_use.h b/include/fsl_can_use.h
new file mode 100644
index 0000000..932bbc1
--- /dev/null
+++ b/include/fsl_can_use.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 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 __FSL_CAN_USE_H
+#define __FSL_CAN_USE_H
+
+#if defined(CONFIG_MPC837X) && defined(CONFIG_USB_FSL_DR) && \
+		defined(CONFIG_FSL_ESDHC)
+extern int __fsl_can_use_dr_usb(void);
+#define fsl_can_use_dr_usb __fsl_can_use_dr_usb
+
+static inline int __fsl_can_use_esdhc(void) { return !fsl_can_use_dr_usb(); }
+#define fsl_can_use_esdhc __fsl_can_use_esdhc
+#endif /* CONFIG_MPC837X && CONFIG_USB_FSL_DR && CONFIG_FSL_ESDHC */
+
+#ifndef fsl_can_use_dr_usb
+#define fsl_can_use_dr_usb() 1
+#endif
+
+#ifndef fsl_can_use_esdhc
+#define fsl_can_use_esdhc() 1
+#endif
+
+#endif /* __FSL_CAN_USE_H */
-- 
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 ` Anton Vorontsov [this message]
2009-02-19 19:56   ` [U-Boot] [PATCH 2/6] Add FSL "Can use" framework 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=20090219154545.GB26618@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