Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1046943ybz; Thu, 16 Apr 2020 01:38:25 -0700 (PDT) X-Google-Smtp-Source: APiQypIAZNxeTAFEHzaBxAs9hEU0PbQhw8ddxA6CdkOiqrpf1Hk9fgdkTfneofKTY/wWGsiGBn0M X-Received: by 2002:a17:906:7b53:: with SMTP id n19mr6124859ejo.244.1587026305029; Thu, 16 Apr 2020 01:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587026305; cv=none; d=google.com; s=arc-20160816; b=gP5Lk4t2nf7NjuGgMMXzo2z5RTJO++g2mhzlFD+KCcALGD9HgzO+zdCAMtIRkDNmgF aZHVsUNQn0P2kM6vFuWaC5ccM3bLBa8/BIKFfOH/fIEHC6tFxGf4VmibV7pMYYt1dwgs 1Lzaow5hVxnQ9ZxuF0Hh8csQPVwp4zCKu1eb/eAtD1MPSVLHcZtEILMIMp6l4pbqLggq /kQwednjDAt2FwlX4z4NO6uj5eTLPyXq7Gf5mBMh/9/+6IgsVXnykKtH8BdOzs42i5Aa QtSF5PhBTe6INNqY7azulOTvpRWn59TPKCMx+1L1oapaslSjwVtucHP9RAmbrL7mYkNX pS7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8wzfkBNtFmPcegPFMfVNNdWL/FBtXJnokHXTaRjBIEI=; b=pkz1lMfzs/NSbpYme/am1az32bVkspYd1WlOC2Bx00lQzy10eUvrTeOX4IUEQ+f9qf gqaMgjPZyptUBeoLg1PohoJgZKeWh5fREMJWYreCuyMjW1pmkltnMBQ84TcD3YITfAoG oaTbnmFiENnaRUZqZYEgiHvrU1W5q8tlqls7Hq8IUKIrGpo/QU45CAOuaJ0NBbNOazrH g3dRqrd4kB0KMWNd1T/8XYXtfWHwCtrGvkkAc29IjOkkhypiUYAGldMxf7BQzgV5lVXd RMeLPTo2ucGII7wGXqiReHpB0b7ulP2ZMQQeTRgr7RedXDP8INtk3N25YNhnrrjGFuDm /tVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si13312942edr.598.2020.04.16.01.38.02; Thu, 16 Apr 2020 01:38:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501984AbgDPIgy (ORCPT + 99 others); Thu, 16 Apr 2020 04:36:54 -0400 Received: from inva021.nxp.com ([92.121.34.21]:50600 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502388AbgDPId7 (ORCPT ); Thu, 16 Apr 2020 04:33:59 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F2744200C15; Thu, 16 Apr 2020 10:33:17 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7EFA9200C00; Thu, 16 Apr 2020 10:33:14 +0200 (CEST) Received: from lsv03124.swis.in-blr01.nxp.com (lsv03124.swis.in-blr01.nxp.com [92.120.146.121]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 2A0E740307; Thu, 16 Apr 2020 16:33:10 +0800 (SGT) From: Ashish Kumar To: broonie@kernel.org, boris.brezillon@collabora.com, frieder.schrempf@kontron.de Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Ashish Kumar , Kuldeep Singh , Ashish Kumar Subject: [PATCH] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size Date: Thu, 16 Apr 2020 14:03:04 +0530 Message-Id: <1587025984-5696-1-git-send-email-Ashish.Kumar@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reduce devm_ioremap size to (4 * AHB_BUFER_SIZE) rather than mapping complete QSPI-Memmory as driver is now independent of flash size. Flash of any size can be accessed. Issue was reported on platform where devm_ioremap failure is observed with size > 256M. Error log on LS1021ATWR : fsl-quadspi 1550000.spi: ioremap failed for resource [mem 0x40000000-0x7fffffff] fsl-quadspi 1550000.spi: Freescale QuadSPI probe failed fsl-quadspi: probe of 1550000.spi failed with error -12 This change was also suggested previously: https://patchwork.kernel.org/patch/10508753/#22166385 Signed-off-by: Kuldeep Singh Signed-off-by: Ashish Kumar --- drivers/spi/spi-fsl-qspi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c index 63c9f7e..a41ce81 100644 --- a/drivers/spi/spi-fsl-qspi.c +++ b/drivers/spi/spi-fsl-qspi.c @@ -859,14 +859,15 @@ static int fsl_qspi_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "QuadSPI-memory"); - q->ahb_addr = devm_ioremap_resource(dev, res); + q->memmap_phy = res->start; + /* Since there are 4 CS max MAP required is 4 time ahb_buf_size */ + q->ahb_addr = devm_ioremap(dev, q->memmap_phy, + (q->devtype_data->ahb_buf_size * 4)); if (IS_ERR(q->ahb_addr)) { ret = PTR_ERR(q->ahb_addr); goto err_put_ctrl; } - q->memmap_phy = res->start; - /* find the clocks */ q->clk_en = devm_clk_get(dev, "qspi_en"); if (IS_ERR(q->clk_en)) { @@ -939,6 +940,9 @@ static int fsl_qspi_remove(struct platform_device *pdev) mutex_destroy(&q->lock); + if (q->ahb_addr) + devm_iounmap(q->dev, q->ahb_addr); + return 0; } -- 2.7.4