From patchwork Sat Jan 24 20:28:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Semen Protsenko X-Patchwork-Id: 5700261 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96C8AC058D for ; Sat, 24 Jan 2015 20:36:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B379B201EF for ; Sat, 24 Jan 2015 20:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8BFA201D3 for ; Sat, 24 Jan 2015 20:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751299AbbAXUgq (ORCPT ); Sat, 24 Jan 2015 15:36:46 -0500 Received: from exprod5og123.obsmtp.com ([64.18.0.198]:42663 "EHLO exprod5og123.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbbAXUgp (ORCPT ); Sat, 24 Jan 2015 15:36:45 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]) (using TLSv1) by exprod5ob123.postini.com ([64.18.4.12]) with SMTP ID DSNKVMQCXaJoRNVuqdG5IlfOnW6xEcNybL1j@postini.com; Sat, 24 Jan 2015 12:36:45 PST Received: by mail-wi0-f179.google.com with SMTP id l15so3280040wiw.0 for ; Sat, 24 Jan 2015 12:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=globallogic.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tuu+/rArHut8rEWWMetVqzrbfF5Txx5f8b4gehm+mtU=; b=hVcswNfn93U8mfyHBJAAULeaigfJKS8uG+AqQP5FK2BbV1CRyhQoRX2mH/kzSC3HXd RitAosQgION3OTrnCUfX88Q0OJoR2JMhkhfIoeDno2LqFMoOC6CbgmfJSqvDgwlQIHxH iQOBD6nRlavdqua3JaGyMFFrRd5SXSVtjZmkI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tuu+/rArHut8rEWWMetVqzrbfF5Txx5f8b4gehm+mtU=; b=AelqU7FgLfc9SuhYw43Lbaog9Viobcpx3HKvqtSMu9T0jc0ZuhFcGcgurHjXP1y1yN QWO/5/0ldThGZMk7+vY92Yk0lYxRCi5Pk7yZkgLQjpgwcg2znvHXLQQm/q0MgueTAoxj H2DPhvRAhXMo9XktJjRvdkONS/FcMOoeTvM+XdaS6TAsjl5nLz+2RIDOHvVeI8oSUw9M dC7mPD3U8gIW9nl60spNhkpNAxmKj1rJ3D9TD5tf+LYaVKU3EtGyrsXNGalv/BI41ZbH MUfIVgnha01NJA7Kk17Bb20ndppYF7KVpKnU2qr6C89ZgBnBxShAKpfjI95/WWo3LPw6 9cqQ== X-Received: by 10.194.120.40 with SMTP id kz8mr27512497wjb.21.1422131361142; Sat, 24 Jan 2015 12:29:21 -0800 (PST) X-Gm-Message-State: ALoCoQnMsYJrplLT9NEGZSUqbUs5pmqeuwCtjSMeV/4ZhnoAtUpuo1XNPtMZ2oQe/fJYH4JeYhOyuiVo0EjXCecnQDVXPDhQprc6cCbTiwNPn3CIXeJQGp2Z8Qk1WfNbyA8v94NMyHUcNGz3UYoON1JxrkQfaHrWCw== X-Received: by 10.194.120.40 with SMTP id kz8mr27512481wjb.21.1422131361021; Sat, 24 Jan 2015 12:29:21 -0800 (PST) Received: from localhost ([195.238.92.132]) by mx.google.com with ESMTPSA id bo3sm7494799wjb.44.2015.01.24.12.29.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 24 Jan 2015 12:29:20 -0800 (PST) From: Semen Protsenko To: Roger Quadros , Tony Lindgren Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] ARM: OMAP2+: gpmc: Do not modify LIMITEDADDRESS on new architectures Date: Sat, 24 Jan 2015 22:28:40 +0200 Message-Id: <1422131320-1018-3-git-send-email-semen.protsenko@globallogic.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1422131320-1018-1-git-send-email-semen.protsenko@globallogic.com> References: <1422131320-1018-1-git-send-email-semen.protsenko@globallogic.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New OMAP-based architectures (like OMAP5, DRA7XX, AM572X) don't have LIMITEDADDRESS bit in GPMC_CONFIG register (this bit marked as RESERVED). Seems like these SoCs have new revision of GPMC IP-core (despite of same GPMC_REVISION value as for earlier SoCs). According to OMAP5 TRM: "Nonmultiplexed NOR flash devices are supported by the GPMC, but their use is highly limited. Because only 10 address pins are available on the GPMC interface, the maximum device size supported is 2KiB." From [1]: - OMAP4 GPMC_CONFIG has LIMITEDADDRESS bit, hence supports both limited and full address mode. - OMAP5 GPMC_CONFIG doesn't have LIMITEDDADDRESS bit. OMAP5 supports only limited address mode for nonmultiplexed flashes In this mode only A1-A10 lines are being modified by GPMC, which leaves us (on flash devices with 1 word = 2 bytes) only 2^10 * 2 = 2KiB memory that we can access. - DRA7XX GPMC_CONFIG doesn't have LIMITEDADDRESS bit. DRA7XX supports only full address mode for nonmultiplexed flashes (current TRM says contrary, but according to [1] it's typo and gonna be fixed in new DRA7XX TRMs). In full address mode all A1-A26 lines are modified by GPMC, so one can address up to 128 MiB. This patch ensures that GPMC driver doesn't try to modify LIMITEDADDRESS bit on new OMAP-based devices, because such an action could possibly lead to undefined behavior in GPMC state-machine (this bit is marked as RESERVED now). [1] http://e2e.ti.com/support/omap/f/885/t/396939 Signed-off-by: Semen Protsenko --- drivers/memory/omap-gpmc.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index db77adb..477d0ba 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -108,6 +108,7 @@ #define GPMC_HAS_WR_ACCESS 0x1 #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 #define GPMC_HAS_MUX_AAD 0x4 +#define GPMC_HAS_LIMITEDADDRESS 0x8 #define GPMC_NR_WAITPINS 4 @@ -1709,6 +1710,18 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, } #endif +static void gpmc_disable_limited(void) +{ + if (gpmc_capability & GPMC_HAS_LIMITEDADDRESS) { + u32 val; + + /* Clear limited address i.e. enable A26-A11 */ + val = gpmc_read_reg(GPMC_CONFIG); + val &= ~GPMC_CONFIG_LIMITEDADDRESS; + gpmc_write_reg(GPMC_CONFIG, val); + } +} + /** * gpmc_probe_generic_child - configures the gpmc for a child device * @pdev: pointer to gpmc platform device @@ -1726,7 +1739,6 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, unsigned long base; const char *name; int ret, cs; - u32 val; if (of_property_read_u32(child, "reg", &cs) < 0) { dev_err(&pdev->dev, "%s has no 'reg' property\n", @@ -1805,10 +1817,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, goto err; } - /* Clear limited address i.e. enable A26-A11 */ - val = gpmc_read_reg(GPMC_CONFIG); - val &= ~GPMC_CONFIG_LIMITEDADDRESS; - gpmc_write_reg(GPMC_CONFIG, val); + gpmc_disable_limited(); /* Enable CS region */ gpmc_cs_enable_mem(cs); @@ -1935,14 +1944,21 @@ static int gpmc_probe(struct platform_device *pdev) * devices support the addr-addr-data multiplex protocol. * * GPMC IP revisions: - * - OMAP24xx = 2.0 - * - OMAP3xxx = 5.0 - * - OMAP44xx/54xx/AM335x = 6.0 + * - OMAP24xx = 2.0 + * - OMAP3xxx = 5.0 + * - OMAP44xx/54xx/AM335x/DRA7XX = 6.0 */ if (GPMC_REVISION_MAJOR(l) > 0x4) gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; if (GPMC_REVISION_MAJOR(l) > 0x5) gpmc_capability |= GPMC_HAS_MUX_AAD; + if (GPMC_REVISION_MAJOR(l) < 0x6) + gpmc_capability |= GPMC_HAS_LIMITEDADDRESS; +#if !defined(CONFIG_SOC_OMAP5) && !defined(CONFIG_SOC_DRA7XX) + if (GPMC_REVISION_MAJOR(l) == 0x6) + gpmc_capability |= GPMC_HAS_LIMITEDADDRESS; +#endif + dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), GPMC_REVISION_MINOR(l));