From patchwork Tue Mar 5 10:13:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Jackson X-Patchwork-Id: 2218541 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0CFE8DF24C for ; Tue, 5 Mar 2013 10:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751126Ab3CEKNn (ORCPT ); Tue, 5 Mar 2013 05:13:43 -0500 Received: from mercuryimc.plus.com ([80.229.200.144]:35265 "EHLO centos1.newflow.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750906Ab3CEKNm (ORCPT ); Tue, 5 Mar 2013 05:13:42 -0500 Received: from [10.0.0.103] (unknown [10.0.0.103]) by centos1.newflow.co.uk (Postfix) with ESMTP id A440126B803C; Tue, 5 Mar 2013 10:13:40 +0000 (GMT) Message-ID: <5135C554.5090502@mimc.co.uk> Date: Tue, 05 Mar 2013 10:13:40 +0000 From: Mark Jackson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: linux-omap@vger.kernel.org CC: Tony Lindgren , Jon Hunter Subject: [PATCH v2] ARM: OMAP: Clear GPMC bits when applying new setting. Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org When setting the GPMC device type, make sure any previous bits are cleared down, before applying the new setting. Signed-off-by: Mark Jackson --- Changes in v2: - Change mux type to 2 bits - Add extra mux types in gpmc.h arch/arm/mach-omap2/gpmc.c | 4 ++++ arch/arm/mach-omap2/gpmc.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 410e1ba..479369c 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 4 target bits */ + regval &= ~(GPMC_CONFIG1_DEVICETYPE(3) | + GPMC_CONFIG1_MUXTYPE(3)); + /* set the proper value */ regval |= GPMC_CONFIG1_DEVICETYPE(wval); if (wval == GPMC_DEVICETYPE_NOR) regval |= GPMC_CONFIG1_MUXADDDATA; diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h index fe0a844..f79cbde 100644 --- a/arch/arm/mach-omap2/gpmc.h +++ b/arch/arm/mach-omap2/gpmc.h @@ -58,7 +58,10 @@ #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) -#define GPMC_CONFIG1_MUXADDDATA (1 << 9) +#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8) +#define GPMC_CONFIG1_MUXNONMUX GPMC_CONFIG1_MUXTYPE(0) +#define GPMC_CONFIG1_MUXAAD GPMC_CONFIG1_MUXTYPE(1) +#define GPMC_CONFIG1_MUXADDDATA GPMC_CONFIG1_MUXTYPE(2) #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))