Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9099261pxu; Mon, 28 Dec 2020 06:37:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPfNvZxjn8uzl/FG3PF10+b8RkVh/x2qvHgjENI4JPN2uIuui38SrCRP7i99KcLUM8qMJt X-Received: by 2002:a17:906:13da:: with SMTP id g26mr40991716ejc.285.1609166233485; Mon, 28 Dec 2020 06:37:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166233; cv=none; d=google.com; s=arc-20160816; b=f8fYx7QLUgw3EHgZARejlduCvcnuLzovp583dqpuACDR8qcKW5JnXUotZp1MWqkcSj BWZUqsa2QPm0jeWac801PtgUQNmOOfQu2jll++4hWKE4NgidpzHOFxM+2u8mmm80zzLI TnsQqSshc0qCqeBbBCOYydL5ziloA26OTFcwEqtlLygo8dbsZ/P1S2sLBN4i+juuG7u1 dd9vzKkrHL+Wxdpy3JOpO4dAIs7YNtXfUOu/ol1Sats44Wb43ciNe9pDwWxDK6IvRhcK Zmt6DVPQzYwCD5YRYxMTXzdLGlSTmutyB0LemZhV8LeKsNvxglPHUvzuTk5vljS9UxVM vOJQ== 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=ZMoTpqYzQSN3KSFMwfdReCNezBTZNoecZpFT3fQ8wJc=; b=W2pwQDKTgjqH+g/QQ0l7S4tP4dvBBYtgI7Co4UC7znZHHxuYMxsg7HfzUwYEDaom8L eYJpyjgo3HYTk30mwLC0six4m6a5f8WenLPNrvvE0DP0m4vI1hYh0Le31rhmlbqvr7i5 Kf3LfmGvnloYRfocbRQ8/HxxH57EsSoGwSgUhVYEK8G8qocB4JVJ5+rBJy4I4d0NevSV b7mpk9TXySlMZzHPSv0Ht4/+cyrsvY9DuRvvaxosuZjxPVZudSmqE8wZRvzGfe8ZkIlb Uinkvzrq1s+EmuA4cZZFxpS2nKkLSNQeG4LDQmo3BiN382SqYPKomeS1jqfJhLUApD4Z zfAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KIklA1ht; 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 b24si18289921eje.504.2020.12.28.06.36.50; Mon, 28 Dec 2020 06:37:13 -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=KIklA1ht; 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 S2505046AbgL1Odf (ORCPT + 99 others); Mon, 28 Dec 2020 09:33:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:39864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504541AbgL1Obg (ORCPT ); Mon, 28 Dec 2020 09:31:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C545B22CBB; Mon, 28 Dec 2020 14:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165855; bh=hTgKd8eqcaSpYFPoLXo4UUr75XvZusgjY1FtHNvlaSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KIklA1htqVpJgNuaLtvKnULNAQJIFaC7LB6bqzpHXWmdgE7c8QRbtvxZC51Hrri2/ d3TyHezIu+010YNLNhikQ5UDUv2cRCYGYQlKJnZjtVYkopdlkOqv5MZh+WjxyiTTjf q+tSc7cZ7jel3NMv3K8La+gKeTy4zqqY9VI3Rgy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Linus Walleij , Rasmus Villemoes , Mark Brown Subject: [PATCH 5.10 647/717] spi: fsl: fix use of spisel_boot signal on MPC8309 Date: Mon, 28 Dec 2020 13:50:45 +0100 Message-Id: <20201228125051.940773646@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: Rasmus Villemoes commit 122541f2b10897b08f7f7e6db5f1eb693e51f0a1 upstream. Commit 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") broke the use of the SPISEL_BOOT signal as a chip select on the MPC8309. pdata->max_chipselect, which becomes master->num_chipselect, must be initialized to take into account the possibility that there's one more chip select in use than the number of GPIO chip selects. Cc: stable@vger.kernel.org # v5.4+ Cc: Christophe Leroy Cc: Linus Walleij Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") Signed-off-by: Rasmus Villemoes Link: https://lore.kernel.org/r/20201127152947.376-1-rasmus.villemoes@prevas.dk Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-fsl-spi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -716,10 +716,11 @@ static int of_fsl_spi_probe(struct platf type = fsl_spi_get_type(&ofdev->dev); if (type == TYPE_FSL) { struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); + bool spisel_boot = false; #if IS_ENABLED(CONFIG_FSL_SOC) struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); - bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); + spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); if (spisel_boot) { pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); if (!pinfo->immr_spi_cs) @@ -734,10 +735,14 @@ static int of_fsl_spi_probe(struct platf * supported on the GRLIB variant. */ ret = gpiod_count(dev, "cs"); - if (ret <= 0) + if (ret < 0) + ret = 0; + if (ret == 0 && !spisel_boot) { pdata->max_chipselect = 1; - else + } else { + pdata->max_chipselect = ret + spisel_boot; pdata->cs_control = fsl_spi_cs_control; + } } ret = of_address_to_resource(np, 0, &mem);