Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1285609imm; Wed, 26 Sep 2018 15:09:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jT/DK4TdJCIvI8TBINbid1hvbTZLs0yi/1/2KUY09aHaqRxbDrdVKkwpO9BiunGiaMQjO X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr7193801pgh.369.1537999759994; Wed, 26 Sep 2018 15:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537999759; cv=none; d=google.com; s=arc-20160816; b=klC6Hgr0FFiVtQwk3OKN5X2IMvLFAU9XVLeg9TJodlQmR6CSaEb6kGEJWbRK8ytjeY 3Uw2mQzQzNcJl5Scm1xyHod70co0lDfjlVbmENsV8tEpdKZIyDEhGE/WPguwMNt96e1p d8zp/tWrpe7w2rSL4WNV9IEq2Uz6n997HfifmeXriDmGhRPU0ekDnPhxI/B+uwSv0tN8 l8zxCjTdfHGV4XAeqo9RHoGykM8DKw9YFolfR24UJ2BEtU5s6t0uuly0cWczm2pj5gGU gokj87IiKd+ktPlrscTjvRvPXdsrrsMiKLKK3BNmlqXALl6dlaIK8wVYyTFpRmQFJnb9 Wf6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=i4H+J9pnFFNkR2LFezOs9jGSRzg8Pi/C7ISYCMEv4hU=; b=QMw9oC7uzLJ4M/S6Npuhw7BEt20RFEnjjN6uG06iX85PuC+rQjH362/FF3V/czQybT Pq1snb1VtVpYCUltzsXzU7ls3tSFqU7f4ZeLUtrtbhGhkM1E6w+FKIEW0/KRuOtT0J1R vYsAcaNoLzJZpf56mevkAnIgyTkDpsAflQ+6tg2iwRUUB1wZXUHjajutFl/hTQqlZ6MW azCmA6irF8BQZUEhfqjimYgpQUmznW5Imk2A9tiUWXhG0GOKhmjAZ3f+HGxbpjXhGteg Bbirk26Oe+Frzb+mLX/57/MTaOKt0G3j1RgqITzXvvSpt1LOGiJDK+mXar7IUFxyLqqj L27A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190-v6si214126pfb.144.2018.09.26.15.09.05; Wed, 26 Sep 2018 15:09:19 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbeI0EXO (ORCPT + 99 others); Thu, 27 Sep 2018 00:23:14 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:59627 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbeI0EXN (ORCPT ); Thu, 27 Sep 2018 00:23:13 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBs42lZWz1qtP7; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBs41Dskz1qqkx; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id tOchIFRPIMRU; Thu, 27 Sep 2018 00:08:06 +0200 (CEST) X-Auth-Info: Wxfm2S9qmloT8Vy+aKMyypntjCdysvVnKakzALTAo+U= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:06 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Cc: linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, yogeshnarayan.gaur@nxp.com, richard@nod.at, Stefan Agner , Fabio Estevam , Fabio Estevam , prabhakar.kushwaha@nxp.com, han.xu@nxp.com, broonie@kernel.org, david.wolfe@nxp.com, computersforpeace@gmail.com, dwmw2@infradead.org, albert.aribaud@3adev.fr, Lukasz Majewski Subject: [RFC/RFT PATCH v1 4/9] mtd: spi: Modify the HW capability mask according to supported RX lanes Date: Thu, 27 Sep 2018 00:07:34 +0200 Message-Id: <20180926220739.620-5-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It may happen that we got two identical SPI devices connected to the QSPI controller with asymmetrical number of RX lanes. Due to PCB constraints, one can work as DUAL and second as QUAD. For such scenario we do need support for setting different read commands. Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index ad951a46a628..4f0c78ba6fcb 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -977,7 +977,7 @@ static void fsl_qspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops) static int fsl_qspi_probe(struct platform_device *pdev) { - const struct spi_nor_hwcaps hwcaps = { + struct spi_nor_hwcaps hwcaps = { .mask = SNOR_HWCAPS_READ_1_1_4 | SNOR_HWCAPS_PP, }; @@ -987,7 +987,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) struct resource *res; struct spi_nor *nor; struct mtd_info *mtd; - int ret, i = 0; + int ret, i = 0, width; q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL); if (!q) @@ -1104,6 +1104,14 @@ static int fsl_qspi_probe(struct platform_device *pdev) if (ret < 0) goto mutex_failed; + if (!of_property_read_u32(np, "spi-rx-bus-width", &width)) { + if (width == 2) { + hwcaps.mask &= ~SNOR_HWCAPS_READ_QUAD; + hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; + } else if (width != 4) + return -EINVAL; + } + /* set the chip address for READID */ fsl_qspi_set_base_addr(q, nor); -- 2.11.0