<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 08/10/2010 02:28 PM, Alexander Clouter wrote:
<blockquote cite="mid:20100810085821.GF21175@chipmunk" type="cite">
  <pre wrap="">Hi,

Just a quick amendment;

* Alexander Clouter <a class="moz-txt-link-rfc2396E" href="mailto:alex@digriz.org.uk">&lt;alex@digriz.org.uk&gt;</a> [2010-08-10 09:56:43+0100]:
  </pre>
  <blockquote type="cite">
    <pre wrap="">
* Tanmay Upadhyay <a class="moz-txt-link-rfc2396E" href="mailto:tanmay.upadhyay@einfochips.com">&lt;tanmay.upadhyay@einfochips.com&gt;</a> [2010-08-10 13:59:33+0530]:
    </pre>
    <blockquote type="cite">
      <pre wrap="">
This patch enables user to use serial port 1 of the OpenRD device for SDIO
or UART(RS232/RS485). The selection can be done through kernel parameter.

By default the port would be used for SDIO. To select RS232 or RS485 mode,
pass string "uart=232" or "uart=485" respectively in the kernel parameters.
"uart=485" is ignored on OpenRD-Base as it doesn't have RS485 port.

Signed-off-by: Tanmay Upadhyay <a class="moz-txt-link-rfc2396E" href="mailto:tanmay.upadhyay@einfochips.com">&lt;tanmay.upadhyay@einfochips.com&gt;</a>
---
 arch/arm/mach-kirkwood/openrd-setup.c |   92 ++++++++++++++++++++++++++++++++-
 1 files changed, 91 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index fd06be6..cd061ab 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -19,6 +19,7 @@
 #include &lt;asm/mach-types.h&gt;
 #include &lt;asm/mach/arch.h&gt;
 #include &lt;mach/kirkwood.h&gt;
+#include &lt;mach/gpio.h&gt;
 #include &lt;plat/mvsdio.h&gt;
 #include "common.h"
 #include "mpp.h"
@@ -57,7 +58,15 @@ static struct mvsdio_platform_data openrd_mvsdio_data = {
 };
 
 static unsigned int openrd_mpp_config[] __initdata = {
+        MPP12_SD_CLK,
+        MPP13_SD_CMD,
+        MPP14_SD_D0,
+        MPP15_SD_D1,
+        MPP16_SD_D2,
+        MPP17_SD_D3,
+        MPP28_GPIO,
         MPP29_GPIO,
+        MPP34_GPIO,
         0
 };
 
@@ -67,6 +76,71 @@ static struct i2c_board_info i2c_board_info[] __initdata = {
         },
 };
 
+static int __initdata uart1;
      </pre>
    </blockquote>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap="">static int __initdata uart1 = -EINVAL;

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">+
+static int __init sd_uart_selection(char *str)
+{
+        /* Default is SD. Change if required, for UART */
+        if (!str)
+                return 0;
+
+        if (!strncmp(str, "232", 3)) {
+                uart1 = 232;
+        } else if (!strncmp(str, "485", 3)) {
+                /* OpenRD-Base doesn't have RS485. Treat is as an
+                 * unknown argument &amp; just have default setting -
+                 * which is SD */
+                if (machine_is_openrd_base())
+                        return 1;
+

      </pre>
    </blockquote>
    <pre wrap="">uart1 = -ENODEV;
return 1;

    </pre>
    <blockquote type="cite">
      <pre wrap="">+                uart1 = 485;
+        }
+        return 1;

      </pre>
    </blockquote>
    <pre wrap="">uart1 = -EINVAL;
return 1;

    </pre>
  </blockquote>
  <pre wrap="">Drop this suggested amendment.

Cheers

  </pre>
</blockquote>
<small><font face="Courier New, Courier, monospace">Intention here is
to provide SD support by default. It will be switched to UART mode only
if someone asks to do so via kernel parameter. If someone doesn't give
OR gives improper kernel parameter, he/she won't get UART1. It will
simply fall-back to the default setting - which is SD support.<br>
<br>
Does this make sense? Please suggest.<br>
<br>
Thanks,<br>
<br>
Tanmay<br>
</font></small>
</body>
</html>