Received: by 10.192.165.148 with SMTP id m20csp1035224imm; Wed, 25 Apr 2018 11:30:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx48djgqb6+0YxRvAh17zDSgmyD4N3FivqS2jXZkSfZRCxW3F2AP7LvHxSkLYXl2ZQsHosKGK X-Received: by 2002:a17:902:4483:: with SMTP id l3-v6mr30517884pld.282.1524681007190; Wed, 25 Apr 2018 11:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524681007; cv=none; d=google.com; s=arc-20160816; b=XEm+8mVYiqDG38d58ynLfsiaHdUGJ9fQTq57zBb966t5Hw3rZCqfcfYrNF0y/sG2Qz I6RqzxyBH+Y4SOJQFPIi9qgwNZam485gOPxpVkJDjKH3Mq+l3aSSTmCCYxRAUfvomKkQ JUYebL++don35w0Tx5Pm2IF25+LTArfWW0LUzYTeUX/OdH1wqin6NacHAdlDkTxQbzM7 Sdg+HcedEVGktZVKQ1oaQ+izfRbDXU7hraOPOzUpt1WDK9K/4yRKtCPZzYQhYuVZt/6c WDeC6Mi3HmtoisJofIRoGAiY8IOTdfMmflOw/aCm8CtbSwSXw3HJhlO8k1i7ntirzM8s EJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Y7GEtu5kc/50aolN6ZOCcOUiBI/W46g8ey5ac7RGqO8=; b=ti1ZV4CEwkhTU6M+AcryXElUkIu4eh8mHNCXcW9SIScSn1f/L6R37uYowc+InoyaiQ WEFnIp9exECPA9Ef+4mq1TzQ9J8FieIZkP1r7QcjWnP1DMQKRJpDxq1PsG0CJXPpKW6Q 3Du5MDwAawOfwzrgQPIAmCUqp05W1F2c8enJnWKC2hxqWBfEA24Zz2TOrHkC7KNREx3b 4Mxho+Y1KB5BHIXVXaUwR3eQxejkut2p53plmntc+mN8ZbTc2h2Ykmio6mTRcZhnzuTN 6mC/hQisO5D+1X10TTeJ+iJlp1eeyIx64wjfhALTpGYm9fbR4InEc92FMOrQ1lgDZ7q6 UBAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bb1b6hAR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si2983264pfo.338.2018.04.25.11.29.52; Wed, 25 Apr 2018 11:30:07 -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=@gmail.com header.s=20161025 header.b=Bb1b6hAR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756547AbeDYS2n (ORCPT + 99 others); Wed, 25 Apr 2018 14:28:43 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:40817 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756307AbeDYS2Q (ORCPT ); Wed, 25 Apr 2018 14:28:16 -0400 Received: by mail-qk0-f195.google.com with SMTP id o64so23413559qkl.7; Wed, 25 Apr 2018 11:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y7GEtu5kc/50aolN6ZOCcOUiBI/W46g8ey5ac7RGqO8=; b=Bb1b6hAROR4yEsdxZz56pBSzLomYXcgcJw2HdUMlkjggAii28ZV+vH4MAvj7vfGCz1 gldIXkWu68ludCmxBhka/ooVFSFkarlxcRDoJIe4wwsAZs/uMGUWSnGKvlqwy8BN17ue MuWRlf42dwlAfSK+cJF4sNwiDnszgWpdksHQlQ0jIy+lLYCPO2L8j+yS2rgl/FPRM2sl zlvh7BfLbxIfnlkaBNRd+i4MJw4CvIZ+xXEy63rfDeI4+HFCZydDlUrxUXBQE9o49Aez LUeInnz0nBdIhpzxXc+t944STV5WLJg+qQetb1puhx38OPViPksKcQ34Ma/dJlEGKPli jB6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y7GEtu5kc/50aolN6ZOCcOUiBI/W46g8ey5ac7RGqO8=; b=M6tDfutelWMiJHHSogfxcAIijFd32RhUD0Z0FvtTQXPTi/vnwoM/bXTnWLJ3OvZh+S wQd1w2trNuDtTp1HLrjWqWswZe2/bl3YdhgA5fag6VjrIVOiRBvnwQ4VMxSYAyA4JTAK bfIIX81VdbkLty/Sll2hsJQPdVG5GBhTkmph60H9TDe6lWpt5aYXm7hY6H+/NGVC7Qly +dmg0DFrUYxi3pwISHrDek8ENqgQLv0pL5+eAcxlpAZCB06qbGBrFG0oAIag2s/Zq2/S VIo+LYLUBadLaxAWqE6VAlvhtsM73aaM8xvTHeBrtFN1sextlEnlzB4zNDhuKePkKKFO 6FRQ== X-Gm-Message-State: ALQs6tBkgveUwvYgFTxaLMqJOxPADmW8Joe6FxvXCgfmGQiAmYM/86xx T/UHChaKejKEHrxnmCc0AJ9K2w== X-Received: by 10.55.119.196 with SMTP id s187mr31177677qkc.171.1524680895927; Wed, 25 Apr 2018 11:28:15 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id x28-v6sm1980695qtx.95.2018.04.25.11.28.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 11:28:15 -0700 (PDT) From: Kamal Dasu To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, jon.mason@broadcom.com, yendapally.reddy@broadcom.com, Kamal Dasu Subject: [PATCH v1 1/2] spi: bcm-qspi: Avoid setting MSPI_CDRAM_PCS for spi-nor master Date: Wed, 25 Apr 2018 14:28:04 -0400 Message-Id: <1524680885-4600-2-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524680885-4600-1-git-send-email-kdasu.kdev@gmail.com> References: <1524680885-4600-1-git-send-email-kdasu.kdev@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Kamal Dasu --- drivers/spi/spi-bcm-qspi.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 1596d35..2946989 100644 --- 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 bcm_qspi *qspi) 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 *qspi, struct spi_device *spi) 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); -- 2.7.4