Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp807924imm; Mon, 21 May 2018 14:53:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrfjnWRTZVhDezQ354iK+FttWPpfE4vBFpzJzNgzOQ7FjM3NISS2VbWLD31btFI3h6tKpfX X-Received: by 2002:a63:8c11:: with SMTP id m17-v6mr7601898pgd.364.1526939612316; Mon, 21 May 2018 14:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526939612; cv=none; d=google.com; s=arc-20160816; b=nuKKyQL5s3SA5NP1jRPt/CA3xQiORPrr2olYb4tZBVMH4c6Fv2YW92ughPPkYAMMqE oV8FR2WKz7VnVytVICOt0l3GguVhC99Uui9e0HY7QEoZlWHn9twvDZEeRj26DJbkiEWO a5cTsE+7GuWcv/0jNPa7MHdJi3X2FAj40jKM310FcUsqmzf4vY+LAuOQkxsVFOZFd76+ 7TLnJvRZqFzMW/oHaOgLz1UN1e1RqGgoYWqHQTr1+UbV85zfnTpTB3ShtjIf2uA/OkjM PHsbxRktVI8qRxp0OSECxHLb8mqRjfTjbYNs3XIpXLVxaM79ydRGEEV8J+580JvBXOTL SEPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UxkGFBCtVAfJ6ERlcZHtRVMomhazm4oLyo+enk2pbXQ=; b=h8Ra4L1nvt8AwYfvxPVAuNSf6cQeSIPsy6jBG8wofVupA66q7L1eVYlQOHRhJyc2an aBR5Q7cf58BD3gsBEwXeLkoN2ky7Gpr4oOHHpad8x+o7THRlm70gAFIF0OuKZsvVEYbG 2vlcXtznehbKWpd0ul5ygFBstox/2ast7hkzBuQtc18bbI6FBfp9RlaYPz0H+gazvqkb cnEy0M7vq9DIP5flHPjypbWgsE04XMxmlilrZwt4vhT846IS0/GeepDK1+Gta9m5V6Ci Sn8/4Eu8fMXuYwTjrCSdS0qknFkjWZ9B70G50F+TkyKnYyzzGtUC0c0tMpVFyFv0fgX/ BK9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HPyRQL6P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si14619786ple.222.2018.05.21.14.53.17; Mon, 21 May 2018 14:53:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HPyRQL6P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754251AbeEUVWf (ORCPT + 99 others); Mon, 21 May 2018 17:22:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:37420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754222AbeEUVW3 (ORCPT ); Mon, 21 May 2018 17:22:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C648520872; Mon, 21 May 2018 21:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937749; bh=h88hYr40Gx05W6wcdjHeUj0930waq4nfrI8AzZpPXNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPyRQL6Px+3VNFDuflti3a8HPIxd5v8GIFYZ7YmwD9auPCcVmLhAfYARVkigZAl3X YW184WT9aqppwVD1WX1Xs4k2UUz86z5+XGdNVDTJ9+ZA84kKFU4upjwYUyF+9vgcva eFEfiLLZ57MURA7pMib2sH3TOr1g3vX+Uktierps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Dasu , Mark Brown Subject: [PATCH 4.16 012/110] spi: bcm-qspi: Avoid setting MSPI_CDRAM_PCS for spi-nor master Date: Mon, 21 May 2018 23:11:09 +0200 Message-Id: <20180521210505.045230642@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kamal Dasu commit 5eb9a07a4ae1008b67d8bcd47bddb3dae97456b7 upstream. Added fix for probing of spi-nor device non-zero chip selects. Set MSPI_CDRAM_PCS (peripheral chip select) with spi master for MSPI controller and not for MSPI/BSPI spi-nor master controller. Ensure setting of cs bit in chip select register on chip select change. Fixes: fa236a7ef24048 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Kamal Dasu Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-bcm-qspi.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c @@ -519,16 +519,19 @@ static void bcm_qspi_disable_bspi(struct static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) { - u32 data = 0; + u32 rd = 0; + u32 wr = 0; - if (qspi->curr_cs == cs) - return; if (qspi->base[CHIP_SELECT]) { - data = bcm_qspi_read(qspi, CHIP_SELECT, 0); - data = (data & ~0xff) | (1 << cs); - bcm_qspi_write(qspi, CHIP_SELECT, 0, data); + rd = bcm_qspi_read(qspi, CHIP_SELECT, 0); + wr = (rd & ~0xff) | (1 << cs); + if (rd == wr) + return; + bcm_qspi_write(qspi, CHIP_SELECT, 0, wr); usleep_range(10, 20); } + + dev_dbg(&qspi->pdev->dev, "using cs:%d\n", cs); qspi->curr_cs = cs; } @@ -755,8 +758,13 @@ static int write_to_hw(struct bcm_qspi * dev_dbg(&qspi->pdev->dev, "WR %04x\n", val); } mspi_cdram = MSPI_CDRAM_CONT_BIT; - mspi_cdram |= (~(1 << spi->chip_select) & - MSPI_CDRAM_PCS); + + if (has_bspi(qspi)) + mspi_cdram &= ~1; + else + mspi_cdram |= (~(1 << spi->chip_select) & + MSPI_CDRAM_PCS); + mspi_cdram |= ((tp.trans->bits_per_word <= 8) ? 0 : MSPI_CDRAM_BITSE_BIT);