diff mbox

ARM: OMAP: Clear GPMC bits when applying new setting

Message ID 51126586.9030308@mimc.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Jackson Feb. 6, 2013, 2:15 p.m. UTC
When setting the GPMC device type, make sure any previous
bits are cleared down, before applying the new setting.

Signed-off-by: Mark Jackson <mpfj@newflow.co.uk>
---
 arch/arm/mach-omap2/gpmc.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Felipe Balbi Feb. 6, 2013, 2:32 p.m. UTC | #1
On Wed, Feb 06, 2013 at 02:15:34PM +0000, Mark Jackson wrote:
> When setting the GPMC device type, make sure any previous
> bits are cleared down, before applying the new setting.
> 
> Signed-off-by: Mark Jackson <mpfj@newflow.co.uk>

looks alright:

Reviewed-of-by: Felipe Balbi <balbi@ti.com>
Hunter, Jon Feb. 6, 2013, 2:39 p.m. UTC | #2
On 02/06/2013 08:15 AM, Mark Jackson wrote:
> When setting the GPMC device type, make sure any previous
> bits are cleared down, before applying the new setting.
> 
> Signed-off-by: Mark Jackson <mpfj@newflow.co.uk>
> ---
>  arch/arm/mach-omap2/gpmc.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index 1adb2d4..026e786 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -613,6 +613,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
> 
>  	case GPMC_CONFIG_DEV_TYPE:
>  		regval  = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
> +		/* clear 3 target bits */
> +		regval &= ~(GPMC_CONFIG1_DEVICETYPE(3) |
> +			    GPMC_CONFIG1_MUXADDDATA);

MUXADDDATA is actually a 2-bit field on current devices (OMAP4+ and
AM335x). For OMAP2/3 devices it was only a one bit field. So it may be
worth clearing both bits for all devices. For OMAP2 devices bit 8 is
reserved but the TRM says to writes a 0, so clearing bit 8 on OMAP2/3
devices should not be a problem. In fact bit 8 should read as 0 on OMAP2/3.

> +		/* set the proper value */
>  		regval |= GPMC_CONFIG1_DEVICETYPE(wval);
>  		if (wval == GPMC_DEVICETYPE_NOR)
>  			regval |= GPMC_CONFIG1_MUXADDDATA;
> 

Otherwise ...

Acked-by: Jon Hunter <jon-hunter@ti.com>

Cheers
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren March 4, 2013, 5:37 p.m. UTC | #3
* Jon Hunter <jon-hunter@ti.com> [130206 06:43]:
> 
> On 02/06/2013 08:15 AM, Mark Jackson wrote:
> > When setting the GPMC device type, make sure any previous
> > bits are cleared down, before applying the new setting.
> > 
> > Signed-off-by: Mark Jackson <mpfj@newflow.co.uk>
> > ---
> >  arch/arm/mach-omap2/gpmc.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> > index 1adb2d4..026e786 100644
> > --- a/arch/arm/mach-omap2/gpmc.c
> > +++ b/arch/arm/mach-omap2/gpmc.c
> > @@ -613,6 +613,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
> > 
> >  	case GPMC_CONFIG_DEV_TYPE:
> >  		regval  = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
> > +		/* clear 3 target bits */
> > +		regval &= ~(GPMC_CONFIG1_DEVICETYPE(3) |
> > +			    GPMC_CONFIG1_MUXADDDATA);
> 
> MUXADDDATA is actually a 2-bit field on current devices (OMAP4+ and
> AM335x). For OMAP2/3 devices it was only a one bit field. So it may be
> worth clearing both bits for all devices. For OMAP2 devices bit 8 is
> reserved but the TRM says to writes a 0, so clearing bit 8 on OMAP2/3
> devices should not be a problem. In fact bit 8 should read as 0 on OMAP2/3.
> 
> > +		/* set the proper value */
> >  		regval |= GPMC_CONFIG1_DEVICETYPE(wval);
> >  		if (wval == GPMC_DEVICETYPE_NOR)
> >  			regval |= GPMC_CONFIG1_MUXADDDATA;
> > 
> 
> Otherwise ...
> 
> Acked-by: Jon Hunter <jon-hunter@ti.com>

Mark, can you please repost this patch with Jon's comment addressed?

Thanks,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 1adb2d4..026e786 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -613,6 +613,10 @@  int gpmc_cs_configure(int cs, int cmd, int wval)

 	case GPMC_CONFIG_DEV_TYPE:
 		regval  = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+		/* clear 3 target bits */
+		regval &= ~(GPMC_CONFIG1_DEVICETYPE(3) |
+			    GPMC_CONFIG1_MUXADDDATA);
+		/* set the proper value */
 		regval |= GPMC_CONFIG1_DEVICETYPE(wval);
 		if (wval == GPMC_DEVICETYPE_NOR)
 			regval |= GPMC_CONFIG1_MUXADDDATA;