From patchwork Fri Feb 9 13:45:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 198872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp860932dyd; Fri, 9 Feb 2024 05:47:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMKPCVlrMhgiPb4VMxDBuiQyRyOv2bFUfExSxYQJFaItE/Fu/9Nl95u7t8GeI60dUkwWHJ X-Received: by 2002:a17:906:2b49:b0:a3b:eb55:858e with SMTP id b9-20020a1709062b4900b00a3beb55858emr1032403ejg.21.1707486446478; Fri, 09 Feb 2024 05:47:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707486446; cv=pass; d=google.com; s=arc-20160816; b=Gb8gRSPTHWj4n8c9c20D1E2cZyKls3Qa8veOhUQxvQTXty6vy4AF9BGbGNx5eh5VGx iW8BkzYZsWKwGhUt2oeIaL5iAvVX1B9BWQ92g6xF92lEYdOCulryuBeWYib5jllwSWWu WJkj5WpAysw3OkYjuhQ1h559HKxnzU5he4PUUDQKjkluKfpkxxnz1CV8/C01JSsaxDkR 3o+XakNjQ4/TTiAlrx5Rfc41EiVn3RgfcrutjnyCs6s9cqGKmOsmKaBuce5Qgu1niKMw qvzfZiZANakuIhtf2hsj5LuAyw4uxKts4tULsqliSYESYz/9sGOqruFUU23SYFh5DvUn /pHw== 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=hqkRG/wIeZzw3pr6uyTLq+TUn6PB5LNepXwhQ1Eo1Rs=; b=tVtVur4TFjVJM96eD9SasIji/7nFeojPXIYmf+RMvEhTJ+nP9EHaiMYWjEyKAuytma /D16TmMZztxy4nZNmxGWf0qIdffQNXg+i2qnriO0aaJbmsMeYixyDr9FMo/glRvP65MZ bt0gHNdWaxvGGF/LYthfcmKtGH6P/o1zgwF8qMWaJSuUOZr7MTqLJdJMkBKgNJSc07aD TtefoDh+N13G+ta2VwnsjvZ+QjWy5v6y0ClJUssrCbREQralnG0AUsRFdQh+GS43hRWa cBdwyq5f6hNxh2rMFG19IL+lSocilb6LMp4Y5f1UJ9y6Am5CRT/iJDtMGNURjo26UTHq mOqw==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59384-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCUEo+E8qhujGo+YwpVKVeZCWyEcOtAg7lh8zNfnaLi19jBrlkjkDYUXI3xu+JiwshhZo1Uf8UDVeZLO0T7q8t6O3ftN/Q== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o16-20020a17090611d000b00a3bda9ba6d6si829621eja.175.2024.02.09.05.47.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:47:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59384-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59384-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 97AA61F23425 for ; Fri, 9 Feb 2024 13:47:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C41254C610; Fri, 9 Feb 2024 13:46:01 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790429308163709965 X-GMAIL-MSGID: 1790429308163709965 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)