public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Larry Johnson <lrj@acm.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc4xx: Add variable "korat_usbcf" for Korat board
Date: Wed, 28 Jan 2009 15:30:02 -0500	[thread overview]
Message-ID: <4980C04A.9070301@acm.org> (raw)

The new environment variable "korat_usbcf" selects the USB
port used by the Korat board's CompactFlash controller.

Signed-off-by: Larry Johnson <lrj@acm.org>
---
 board/korat/korat.c |   23 ++++++++++++++++++++++-
 doc/README.korat    |   14 ++++++++++++++
 2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/board/korat/korat.c b/board/korat/korat.c
index 5ad75f7..8328ba3 100644
--- a/board/korat/korat.c
+++ b/board/korat/korat.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2008
+ * (C) Copyright 2007-2009
  * Larry Johnson, lrj at acm.org
  *
  * (C) Copyright 2006-2007
@@ -351,6 +351,7 @@ int misc_init_r(void)
 	unsigned long sdr0_pfc1;
 	uint32_t const flash1_size = gd->bd->bi_flashsize - CONFIG_SYS_FLASH0_SIZE;
 	char const *const act = getenv("usbact");
+	char const *const usbcf = getenv("korat_usbcf");

 	/*
 	 * Re-do FLASH1 sizing and adjust flash start and offset.
@@ -405,6 +406,26 @@ int misc_init_r(void)
 	/*
 	 * USB suff...
 	 */
+	/*
+	 * Select the USB controller on the 440EPx ("ppc") or on the PCI bus
+	 * ("pci") for the CompactFlash.
+	 */
+	if (usbcf != NULL && (strcmp(usbcf, "ppc") == 0)) {
+		/*
+		 * If environment variable "usbcf" is defined and set to "ppc",
+		 * then connect the CompactFlash controller to the PowerPC USB
+		 * port.
+		 */
+		printf("Attaching CompactFalsh controller to PPC USB\n");
+		out_8((u8 *) CONFIG_SYS_CPLD_BASE + 0x02,
+		      in_8((u8 *) CONFIG_SYS_CPLD_BASE + 0x02) | 0x10);
+	} else {
+		if (usbcf != NULL && (strcmp(usbcf, "pci") != 0))
+			printf("Warning: \"korat_usbcf\" is not set to a legal "
+			       "value (\"ppc\" or \"pci\")\n");
+
+		printf("Attaching CompactFalsh controller to PCI USB\n");
+	}
 	if (act == NULL || strcmp(act, "hostdev") == 0) {
 		/* SDR Setting */
 		mfsdr(SDR0_PFC1, sdr0_pfc1);
diff --git a/doc/README.korat b/doc/README.korat
index 0a59f40..49cd102 100644
--- a/doc/README.korat
+++ b/doc/README.korat
@@ -49,3 +49,17 @@ creates the upgradable U-Boot but selecting loader file "u-boot-F7FC.lds" and
 leaving preprocessor symbol "CONFIG_KORAT_PERMANENT" undefined.

 2008-02-22, Larry Johnson <lrj@acm.org>
+
+
+
+The CompactFlash(R) controller on the Korat board provides a hi-speed USB
+interface.  This may be connected to either a dedicated port on the on-board
+USB controller, or to a USB port on the PowerPC 440EPx processor.  The U-Boot
+environment variable "korat_usbcf" can be used to specify which of these two
+USB host ports is used for CompactFlash.  The valid setting for the variable are
+the strings "pci" and "ppc".  If the variable defined and set to "ppc", then the
+PowerPC USB port is used.  In all other cases the on-board USB controller is
+used, but if "korat_usbcf" is defined but is set to a string other than the two
+valid options, a warning is also issued.
+
+2009-01-28, Larry Johnson <lrj@acm.org>

             reply	other threads:[~2009-01-28 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 20:30 Larry Johnson [this message]
2009-01-29  9:57 ` [U-Boot] [PATCH] ppc4xx: Add variable "korat_usbcf" for Korat board Stefan Roese

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=4980C04A.9070301@acm.org \
    --to=lrj@acm.org \
    --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