Subject: [PATCH v2] OpenRD: Enable SD/UART selection for serial port 1

From: [email-masked] (Alexander Clouter)
Date: Tue, 10 Aug 2010 09:58:21 +0100

Hi,

Just a quick amendment;

* Alexander Clouter <[email-masked]> [2010-08-10 09:56:43+0100]:
>
> * Tanmay Upadhyay <[email-masked]> [2010-08-10 13:59:33+0530]:
> >
> > 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 <[email-masked]>
> > ---
> >  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 <asm/mach-types.h>
> >  #include <asm/mach/arch.h>
> >  #include <mach/kirkwood.h>
> > +#include <mach/gpio.h>
> >  #include <plat/mvsdio.h>
> >  #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;
>
static int __initdata uart1 = -EINVAL;

> > +
> > +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 & just have default setting -
> > +		 * which is SD */
> > +		if (machine_is_openrd_base())
> > +			return 1;
> > +
> >
> uart1 = -ENODEV;
> return 1;
> 
> > +		uart1 = 485;
> > +	}
> > +	return 1;
> >
> uart1 = -EINVAL;
> return 1;
> 
Drop this suggested amendment.

Cheers

-- 
Alexander Clouter
.sigmonster says: What I need is a MATURE RELATIONSHIP with a FLOPPY DISK ...