From patchwork Fri Sep 18 14:53:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 53900 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 33D5B218E3 for ; Fri, 18 Sep 2015 14:56:14 +0000 (UTC) Received: by lanb10 with SMTP id b10sf19800620lan.3 for ; Fri, 18 Sep 2015 07:56:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=JpjaBCWS+bfCRvHZUCt1j14+yG5buleDtKaIXdR74Eo=; b=CjaXIbu5PesiwPczK+L+D11VChclfiZXMVb7TAcS7hXJf14fc1YQ9FyVY47dsAJDWv 0YvCbojWdWOwquiw9WQ6AlMMKitfXrcJD1QKlRHC99IbHMKC/QWux9e472Op1SwHTW5d BR36tDsZ03jFYAr0t0gLw3+/UpLeP0OFZ6SKPD1vt3GiMXDKCH9McIF7C3qEYZYJ46jo q8ExVhVP5K5mV12hF5WzekWHHis7IxcFd3x8XXXEDc36CU5BR6Vlsmre3gYCXodhBV5+ wLgQfv6BTxtCsBnu42lNrC8h4MZMPn5o5D3I+4qSV6lz7mokIUTTbwJh7wTfdDeGQUYq OJQg== X-Gm-Message-State: ALoCoQmiljsb6OeF9b6g/12DAi6z9znT1DScOAeHauD7dzgaQZl5J/pSSPgUwtWBHJWk07NEBo2S X-Received: by 10.112.55.69 with SMTP id q5mr965249lbp.24.1442588173205; Fri, 18 Sep 2015 07:56:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.101 with SMTP id dv5ls204760lac.94.gmail; Fri, 18 Sep 2015 07:56:12 -0700 (PDT) X-Received: by 10.112.159.72 with SMTP id xa8mr3248088lbb.118.1442588172916; Fri, 18 Sep 2015 07:56:12 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id xh2si6232957lbb.130.2015.09.18.07.56.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 07:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lagj9 with SMTP id j9so32474903lag.2 for ; Fri, 18 Sep 2015 07:56:12 -0700 (PDT) X-Received: by 10.152.21.196 with SMTP id x4mr3385585lae.86.1442588172793; Fri, 18 Sep 2015 07:56:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp344530lbq; Fri, 18 Sep 2015 07:56:11 -0700 (PDT) X-Received: by 10.107.160.194 with SMTP id j185mr13652604ioe.37.1442588171584; Fri, 18 Sep 2015 07:56:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i4si7116019igv.44.2015.09.18.07.56.11; Fri, 18 Sep 2015 07:56:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754648AbbIROz4 (ORCPT + 30 others); Fri, 18 Sep 2015 10:55:56 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42161 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752205AbbIROzx (ORCPT ); Fri, 18 Sep 2015 10:55:53 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8IEtPBl001244; Fri, 18 Sep 2015 09:55:25 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8IEtP4Y020473; Fri, 18 Sep 2015 09:55:25 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Sep 2015 09:55:25 -0500 Received: from rockdesk.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8IEseAT002598; Fri, 18 Sep 2015 09:55:23 -0500 From: Roger Quadros To: CC: , , , , , , , , , , Roger Quadros Subject: [PATCH v3 13/27] memory: omap-gpmc: Prevent mapping into 1st 16MB Date: Fri, 18 Sep 2015 17:53:35 +0300 Message-ID: <1442588029-13769-14-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442588029-13769-1-git-send-email-rogerq@ti.com> References: <1442588029-13769-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We have been preventing mapping GPMC children in the first 1MB but really it has to be the first 16MB as the minimum GPMC partition size is 16MB. Also print an error message if CS mapping fails due to DT requesting address outside the GPMC map. Signed-off-by: Roger Quadros --- drivers/memory/omap-gpmc.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index b09e1bc..bcf4b05 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -93,6 +93,14 @@ #define GPMC_CS_SIZE 0x30 #define GPMC_BCH_SIZE 0x10 +/* + * The first 1MB of GPMC address space is typically mapped to + * the internal ROM. Never allocate the first page, to + * facilitate bug detection; even if we didn't boot from ROM. + * As GPMC minimum partition size is 16MB we can only start from + * there. + */ +#define GPMC_MEM_START 0x1000000 #define GPMC_MEM_END 0x3FFFFFFF #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ @@ -1171,12 +1179,7 @@ static void gpmc_mem_init(void) { int cs; - /* - * The first 1MB of GPMC address space is typically mapped to - * the internal ROM. Never allocate the first page, to - * facilitate bug detection; even if we didn't boot from ROM. - */ - gpmc_mem_root.start = SZ_1M; + gpmc_mem_root.start = GPMC_MEM_START; gpmc_mem_root.end = GPMC_MEM_END; /* Reserve all regions that has been set up by bootloader */ @@ -1830,6 +1833,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, if (ret < 0) { dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n", cs, &res.start); + if (res.start < GPMC_MEM_START) { + dev_info(&pdev->dev, + "GPMC CS %d start cannot be lesser than 0x%x\n", + cs, GPMC_MEM_START); + } else if (res.end > GPMC_MEM_END) { + dev_info(&pdev->dev, + "GPMC CS %d end cannot be greater than 0x%x\n", + cs, GPMC_MEM_END); + } goto err; }