Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp934057rdb; Fri, 9 Feb 2024 05:46:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoW0wGcgQp4FSZUxpSGqabKSnA86jnHZ5KQaCj2HIBqD58pcz5vP/6B4QqXIDEc4qowXgL X-Received: by 2002:a05:6871:588:b0:218:4a2e:2952 with SMTP id u8-20020a056871058800b002184a2e2952mr1577968oan.33.1707486414323; Fri, 09 Feb 2024 05:46:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707486414; cv=pass; d=google.com; s=arc-20160816; b=ugXKpbaThTqCyyJdEB9OKG/vPU2n5OdeNAOC/Z/da0yNrAVvDhXVULyLpyadsl9oTV di1dOUafUZ2Tqgj4j4WBZR95rHvLgoEpDqNpUmBjnoUOxQbGoO+7HzODXQsuLh+QN3bB jxidOKTYgOkUJRMtKQ5GvZFxRMepjIvTC/1UbLHU2aiCohrDI+QeXPg5wdRdR0Q7b1Dv dEe8sbw5q6zMeMJQUF3Q7eb/em0vDsNIW/2XYTE/yXTMX/LgAQH7CinqlW8G0Jvn99OP gm6y7UHeAOuTMQ9Nc4oQP6/EMvnfKqEwhfwEulM6oTuls3KPv+IAcC5haTkXrWdGiIIa hQzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=TEFUds+rZrQHnppzDuzVbdDoYn+ud5dF52AFwoFYbLI=; fh=1G8CbrgVRWO87j3Kf2K3hw/nwpmmct8tdl0h/rjnHaM=; b=C/mNcUc2w+MsR1cpjD3iwAJD4NtghhZ/gyB2k9NHYVbo0m194Bj5/bpHDlm2j7OKbH n/fBTlbVjUej+0vcinKN6fPk1Qp8C5Qe9qT4cO8lCfOsPRDR4Z39lMrXCc+zlXk2zooo VIA4wJBpAWlRQLSApws0ITEnRD0biLQd7ZStDcqhfrqUwP89wHK2bgLI2R5HtRVC4ZL0 aP1ii3gAMLSSLpo96irX4DT3mwvsc4Uuc/QkEs/d2pEzrgkG52msWIM6yduneQDcJAmt QqR9KTrG+c/CHB84wgFu4zaef6u29eK0SLW8FxXYZybVxQ466avTiGMYgQ5c+olO+sbZ tdog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PzCGfNxf; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-59384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCV7DYukcv4ZgcP0XTsVUjXpbg+sjHRbLBoSzPOOiH3+TcTpIp0Qmt3PZ3G5CpYdjmouwSpkUzmIsbpbZ2NZuiBEzv8yZJHubxCtNyjgmg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 9-20020a0562140d0900b0068c7c407d21si1978284qvh.172.2024.02.09.05.46.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:46:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PzCGfNxf; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-59384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BE841C21A05 for ; Fri, 9 Feb 2024 13:46:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0AC94596F; Fri, 9 Feb 2024 13:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="PzCGfNxf" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 316AD3CF69; Fri, 9 Feb 2024 13:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486359; cv=none; b=rOemVSM/AaaMPjJBwrVkbIxYcjwjzqI5gCOi98I1IU01ztCfmxnYUIKfzoYOOMRxECtXPGYEwJDNsr5g5QfHog0lN/demUdd/EMQqsqLvuJWzLzBhmIJoLlfBC/gsr2BYIlahzxmEEpAZhXBJSTe+p/WUkpbq9w64AUAdEP1yu4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486359; c=relaxed/simple; bh=8g0h2Rpw/9qFXCPzfQOZOoSloJvsAQxCz0t/+7F6CHQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MeGDB8Y2/4BYsAsSwaXHRgEutOb3SUc+0AI98Db3Q/l1vkx8yIDWTCjYTVPYldBVcNDoJKpnBG6UQq+jIQnncS4CkuTkVCv4LGI7AWMnIvzAe2ofsr016rjx4O+VpBIjftINnd1vOgAxyWygWDfLdVBlXUMhECJt/n2/wuFYglQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=PzCGfNxf; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 7A77EE0009; Fri, 9 Feb 2024 13:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707486355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TEFUds+rZrQHnppzDuzVbdDoYn+ud5dF52AFwoFYbLI=; b=PzCGfNxfVkN8VxxqWWz5mDuH2H7UiDyNGJVIPmYXu9G58ZFf/GdY3rAmTUbIzAim9Qkca8 eHkA94i6LKT+YYX+cCHL0OKo6gxGqmvfjblnT3kGCotarsE3aJ+X7IG35KI70Wo7AQRZgv d24ppidtfc7jXS/z29/NYgXW3WpYqihXmRPKo7utVwyzrvdo8RIwypV0/br5CWRL7nNn7u /0mjSJfoY0pZDsHKgsIXNvlJMZFLwkYKPELIXCpOIrI/g5CW0/GPvDSmiNIT6uX9hj5khV 6cVjbRLNLYr99GNeBb6MkG7FKTrfE+nZ/dwubR60nGLnv0IfriXlEVnz+VD5Mg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 09 Feb 2024 14:45:32 +0100 Subject: [PATCH 3/4] spi: cadence-qspi: report correct number of chip-select Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240209-cdns-qspi-cs-v1-3-a4f9dfed9ab4@bootlin.com> References: <20240209-cdns-qspi-cs-v1-0-a4f9dfed9ab4@bootlin.com> In-Reply-To: <20240209-cdns-qspi-cs-v1-0-a4f9dfed9ab4@bootlin.com> To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Dhruva Gole , Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.4 X-GND-Sasl: theo.lebrun@bootlin.com Set the ->num_chipselect field in struct cqspi_st and struct spi_controller to the current number of chip-select. The value is dependent on declared flashes in devicetree. Previously, the num-cs property from devicetree or the maximum value was being reported. Signed-off-by: Théo Lebrun --- drivers/spi/spi-cadence-quadspi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index e9e3abd2142c..895c950e7fd6 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1621,6 +1621,7 @@ static const struct spi_controller_mem_caps cqspi_mem_caps = { static int cqspi_setup_flash(struct cqspi_st *cqspi) { + unsigned int max_cs = cqspi->num_chipselect - 1; struct platform_device *pdev = cqspi->pdev; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -1641,6 +1642,8 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi) dev_err(dev, "Chip select %d out of range.\n", cs); of_node_put(np); return -EINVAL; + } else if (cs < max_cs) { + max_cs = cs; } f_pdata = &cqspi->f_pdata[cs]; @@ -1654,6 +1657,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi) } } + cqspi->num_chipselect = max_cs + 1; return 0; } @@ -1865,14 +1869,14 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->current_cs = -1; cqspi->sclk = 0; - host->num_chipselect = cqspi->num_chipselect; - ret = cqspi_setup_flash(cqspi); if (ret) { dev_err(dev, "failed to setup flash parameters %d\n", ret); goto probe_setup_failed; } + host->num_chipselect = cqspi->num_chipselect; + if (cqspi->use_direct_mode) { ret = cqspi_request_mmap_dma(cqspi); if (ret == -EPROBE_DEFER) -- 2.43.0