Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp260051ybg; Mon, 1 Jun 2020 00:08:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6Ik3Wn635NZbSBIZztwY/IinPvMWGBoKFq3GniDKdaUKUw0pXOQw8k5/XLSv0pA9Dd9p0 X-Received: by 2002:a50:9ee4:: with SMTP id a91mr21081442edf.172.1590995299464; Mon, 01 Jun 2020 00:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590995299; cv=none; d=google.com; s=arc-20160816; b=vjFSHv5llWYW9+CwN6DFqKNbhq8DLEKQvU6sA2Q+7DCyBF58uH96S6GvfLc4s8eBT9 sAZ2IhlLP10bVWiO0QRXL5VFRT/Sec8rF9EpBJ8atVj+wQY88sVaMNtRStOiMfHJtZu9 o8MVFv3soe9GtIV2EyZrWRT1bbRQZsfMoBfz+qvK3OElhMom37eJO0BJ0g/I/maJfldr w7pf2zgeQJGnrFViXbgDOyDEV3rG4zu06GZV5iNxZWjRWtSRYLxteyFVY+F44FiN4ztU /u/Ph0Fz8Y0udkzZmCOL5QL3qTXqGLQ2iTQb34l7QQVzGG671CcAp8RIvS9gwYYBi/LI NKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mt1kdoa7fHLmkzx9wmI6sD1FM6R0LnUj+bGd05YN3tY=; b=vf2iNlaSpI4F9c4rMT8di0G64gbSl8PIN05VdpyT6ZeRqw92b7a0pybcAyQKGfGUvR gFe1+/IKQHBv+mkY1TpNNAGry1W1/PxQkfGzO+3yJT273o0MaMy9qGh+ABVa7SOzJxrh LH7WwEeK4t7zz4ibJhWvdRmaJ5bBPFrJQZY9IYWxSiiy+8j2H6Gw1GDJ+VLrps0n0pxi JeieB4iWg+QSDCmFWLN4fh7HIIgtcMG61gXZbycpkquJUVy3XD2ubXoq12v3gLBrp47m D5z2OD4jZfhYn3va+m6fy/GO+lKMRzSgBEp2hXyzxFx7RDVQH4OyTZVByI2op36HyPu5 i6cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="XHbPpC/n"; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si11057899edl.566.2020.06.01.00.07.57; Mon, 01 Jun 2020 00:08:19 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="XHbPpC/n"; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728133AbgFAHFw (ORCPT + 99 others); Mon, 1 Jun 2020 03:05:52 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:55090 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgFAHFv (ORCPT ); Mon, 1 Jun 2020 03:05:51 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05175edp075847; Mon, 1 Jun 2020 02:05:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1590995140; bh=mt1kdoa7fHLmkzx9wmI6sD1FM6R0LnUj+bGd05YN3tY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XHbPpC/n6bjp3rTfMP2jsjFFqs0L7f4NLL7LoKyWFDdEywPNmxCOuzamf5+wP+KXD UN1DHyQ3IzZn+eh/kNF0LIkOglb+8HAWnyh3+/MbjUiJQlbBj6JgsTeMZQCLSi99IJ dAVrU3VjsMOyzq9jcJ8FaRRR73xy5ViO+/uOz0XU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05175elk016936 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Jun 2020 02:05:40 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 1 Jun 2020 02:05:40 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 1 Jun 2020 02:05:40 -0500 Received: from ula0132425.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 051758s7016257; Mon, 1 Jun 2020 02:05:33 -0500 From: Vignesh Raghavendra To: Tudor Ambarus , Mark Brown CC: Vignesh Raghavendra , Boris Brezillon , Ramuthevar Vadivel Murugan , , , , , , Subject: [RESEND PATCH v3 5/8] mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel Date: Mon, 1 Jun 2020 12:34:41 +0530 Message-ID: <20200601070444.16923-6-vigneshr@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601070444.16923-1-vigneshr@ti.com> References: <20200601070444.16923-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dma_request_chan_by_mask() can throw EPROBE_DEFER if DMA provider is not yet probed. Currently driver just falls back to using PIO mode (which is less efficient) in this case. Instead return probe deferral error as is so that driver will be re probed once DMA provider is available. Signed-off-by: Vignesh Raghavendra Reviewed-by: Tudor Ambarus --- .../mtd/spi-nor/controllers/cadence-quadspi.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c index 608ca657ff7f5..0570ebca135a9 100644 --- a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c @@ -1169,7 +1169,7 @@ static void cqspi_controller_init(struct cqspi_st *cqspi) cqspi_controller_enable(cqspi, 1); } -static void cqspi_request_mmap_dma(struct cqspi_st *cqspi) +static int cqspi_request_mmap_dma(struct cqspi_st *cqspi) { dma_cap_mask_t mask; @@ -1178,11 +1178,16 @@ static void cqspi_request_mmap_dma(struct cqspi_st *cqspi) cqspi->rx_chan = dma_request_chan_by_mask(&mask); if (IS_ERR(cqspi->rx_chan)) { - dev_err(&cqspi->pdev->dev, "No Rx DMA available\n"); + int ret = PTR_ERR(cqspi->rx_chan); + + if (ret != -EPROBE_DEFER) + dev_err(&cqspi->pdev->dev, "No Rx DMA available\n"); cqspi->rx_chan = NULL; - return; + return ret; } init_completion(&cqspi->rx_dma_complete); + + return 0; } static const struct spi_nor_controller_ops cqspi_controller_ops = { @@ -1269,8 +1274,11 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np) dev_dbg(nor->dev, "using direct mode for %s\n", mtd->name); - if (!cqspi->rx_chan) - cqspi_request_mmap_dma(cqspi); + if (!cqspi->rx_chan) { + ret = cqspi_request_mmap_dma(cqspi); + if (ret == -EPROBE_DEFER) + goto err; + } } } -- 2.26.2