Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9398884pxu; Mon, 28 Dec 2020 15:12:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXe8LiLKq5Y5THHSAuYE/QGE59Y03n0ec9MWftD7Te/n0J9VmCqWHgamomurFelNfgTcMa X-Received: by 2002:a17:906:ce3c:: with SMTP id sd28mr43133240ejb.485.1609197152636; Mon, 28 Dec 2020 15:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609197152; cv=none; d=google.com; s=arc-20160816; b=NnMau9jhH3FQvxqUiPhq7+BPAferiGPGLFciZz58f3xlxE+ngh+Wcd4G9YflEESifP s4KAXRlMQniYCFPZZSRfr3SXVeEh76MSifZGg2cwyg7nqN/WnwUZb2/cMTGp8E0ijL+t 5HwQ/fEUYguxkVfqWx3/0dG539ILohVgml6s1bWP40ziGhhvFXxRFwzHOQ3S6LW+/3cs CEJPbdmEgdFyk1rHD+XPxCaZngOtZzfVUzl5LYWAvd0k3jRirHkXYkNWziI1m1sgWU7E CGqPnpiiZd2RBwys/i26UfuCPkXWInpIoqtiChU2WCZtDYjvTgvkZIvjBS2ndiaapV3i 2PHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5NKjY4bmKfBSIv1nNk93Xp2HVZq7W3aluFme2BwsOqU=; b=MQgI+mGR3oApIXHoy89uzWy2mt/0y5gwyMuPa7WoZSnc0nQmZ4s1sSMY6NwZblTb8I 9a7p1McKXsFwjNG6VyIzO5A/PURapWPUIrq4ovUWg3eJcekBCf4JCKtDIiY6SzFyOvQ4 ZngXAdXpvr/gcpUUM1QPRn9iTulJ79FQATawdgCFxpmuD0C9MnHL7S/9Vie0PBXQBLru 07XgIDnCJFSTp5l9HONpP0cWchZ+SN4rdzXn30r65cUPkcb9OEGTyLL3Y82rQYtsFSeK vPeOor9ngaN1NG1ok6iieQqROu2Nv5T6ny+RevACW8KZSevi83DgBBgMAbuEuPO8VGXL UIOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1XIC5Npv; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c23si17283025eds.525.2020.12.28.15.12.10; Mon, 28 Dec 2020 15:12:32 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=1XIC5Npv; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439957AbgL1OMs (ORCPT + 99 others); Mon, 28 Dec 2020 09:12:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:46838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439892AbgL1OMe (ORCPT ); Mon, 28 Dec 2020 09:12:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3098720791; Mon, 28 Dec 2020 14:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164738; bh=gSS2vlDOAi6OYsuXe17tLsbwFm5CEC6ChWEJjmiHSAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XIC5NpvN9xPmNdklhIFdsREE97rksNsHs/OZC85nMvZM9mDf7xTv2Y7NONvXwpGn pAFSfUnqOL51BdN6knBu0SCuvb0K6BBnQBwmv2rX+z2WnMS+DGSvii7k8oS80pyPPs A4qDfmnjw+Z1FUwPZExBmOJKO7WEo/jCn+FLO5Ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Kochetkov , Mark Brown , Sasha Levin Subject: [PATCH 5.10 249/717] spi: spi-fsl-dspi: Use max_native_cs instead of num_chipselect to set SPI_MCR Date: Mon, 28 Dec 2020 13:44:07 +0100 Message-Id: <20201228125032.916685247@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kochetkov [ Upstream commit 2c2b3ad2c4c801bab1eec7264ea6991b1e4e8f2c ] If cs-gpios property is used in devicetree then ctlr->num_chipselect value may be changed by spi_get_gpio_descs(). So use ctlr->max_native_cs instead of ctlr->num_chipselect to set SPI_MCR Fixes: 4fcc7c2292de (spi: spi-fsl-dspi: Don't access reserved fields in SPI_MCR) Signed-off-by: Maxim Kochetkov Link: https://lore.kernel.org/r/20201201085916.63543-1-fido_max@inbox.ru Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-fsl-dspi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 1a08c1d584abe..0287366874882 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1165,7 +1165,7 @@ static int dspi_init(struct fsl_dspi *dspi) unsigned int mcr; /* Set idle states for all chip select signals to high */ - mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->num_chipselect - 1, 0)); + mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0)); if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) mcr |= SPI_MCR_XSPI; @@ -1250,7 +1250,7 @@ static int dspi_probe(struct platform_device *pdev) pdata = dev_get_platdata(&pdev->dev); if (pdata) { - ctlr->num_chipselect = pdata->cs_num; + ctlr->num_chipselect = ctlr->max_native_cs = pdata->cs_num; ctlr->bus_num = pdata->bus_num; /* Only Coldfire uses platform data */ @@ -1263,7 +1263,7 @@ static int dspi_probe(struct platform_device *pdev) dev_err(&pdev->dev, "can't get spi-num-chipselects\n"); goto out_ctlr_put; } - ctlr->num_chipselect = cs_num; + ctlr->num_chipselect = ctlr->max_native_cs = cs_num; of_property_read_u32(np, "bus-num", &bus_num); ctlr->bus_num = bus_num; -- 2.27.0