Received: by 10.192.165.148 with SMTP id m20csp2485944imm; Thu, 26 Apr 2018 11:49:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/C28cKFHATQu93/1L2+hJ56qv6mODJivQTJjlntx7dbDkzoV2pKRD0+vCnDsRDszkFU93n X-Received: by 10.99.125.19 with SMTP id y19mr28456256pgc.160.1524768597870; Thu, 26 Apr 2018 11:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524768597; cv=none; d=google.com; s=arc-20160816; b=C5AafpxLFNHf3LTxDqgui2zTM7a+XuVl9id6NM7VgjFLzWy6pHyNLPohZFDsm0m8LA D0ymaf4knXQZ3zHAFO2QSODcS9UuNZAoi1gffOm9PSCnBQECOEqX0iC3/BpJxDDtzG9P 1XehQEKTogrKPTannIHl1p05s4rjnnFXIsJQ4m+mnSyLhDsQ/mRB080EwvwrWcciiDsl mNhlZNQxXZ46ey7V8Vn1zy11562YHdqr33CjGRyr/6l9qEtOvZbleE0ME7iTJRLCl12e zTO2qp3pedtZk+N8S4UIzmpk4HNclXgxE+PEEHFxj2djO0i8gAEuKoskiG7kd97qDlqt QJaQ== 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=gHyQ5b97I/YU6oZFdIQ/NWwKv5tMMfAaNN3XyDN5D4w=; b=HT2dsMRGgB9jtVjy2pUVgctboA8/3D0WTZv9UVMxT9j3DGUfebXAxOdzYuza8x/PGo E2c4YgaEIxtNtq1JHP5VhM5PkOu5TAUAC8BIxCiRoUIzTWpE0ATyH5pyzZlDIso1yDcH wfwUCRFFEJbX3aTCS5Qpuw9xkV6LiBQL16ag1yvdwUk41in9c3sr2ZYQUDEJ6M1yS1sT irBKtqfWC8nd6V2KG00qgO+mmnyBvsANQbOurpvlD+98hWAwIRV8N/xV2LVT7rULAEK2 DaKGhHsviraCn5rzz2YB+q1WdPd1DSX3T5iiUb/o7y3BdpaNBwnNkus3OVwoua5g7GoI T1mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hgOUmHSZ; 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 n2si16523009pgs.500.2018.04.26.11.49.43; Thu, 26 Apr 2018 11:49:57 -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=hgOUmHSZ; 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 S1755750AbeDZSs3 (ORCPT + 99 others); Thu, 26 Apr 2018 14:48:29 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:37209 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbeDZSsZ (ORCPT ); Thu, 26 Apr 2018 14:48:25 -0400 Received: by mail-qk0-f194.google.com with SMTP id d74so26442669qkg.4; Thu, 26 Apr 2018 11:48:25 -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=gHyQ5b97I/YU6oZFdIQ/NWwKv5tMMfAaNN3XyDN5D4w=; b=hgOUmHSZS9QEu+RMnIOaWqhZDVpLuVvr44FaZrKluDuuv23527/83cGbVpSX9Sczxb cVNeC98QmoRu1b8k3ikKoqcMj8v+N+f3GzYfH3CLjpFLdW7snCbpDvDFpEGnb072h+PU BFOy0bP5y/UCh7AE7gvbcbPof/mvW44nWEfe5S3Wr6ZfzuAgWJtes3u5DRsK0+BCfqCW /hrFXTFSSUUdxgkZJsGZCP+Z1sZzOVHxK0s4OXYnCZ1yrhg2RbCQswfcrObONc1m6k5l YN+gqDjoCFoHT/DZiqzykHdoGgS6UGtCMtoAyg7o6Rb6vXPLHl8J8MyymvBVy1/t4D5B hPHA== 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=gHyQ5b97I/YU6oZFdIQ/NWwKv5tMMfAaNN3XyDN5D4w=; b=p1E9NzdEHYq3OsOo8brUHmXb4Eq7KB45C4jClIEuxl25Eb5z/LCw99DaWKS2KxwmJo EgapwLu9FUMWqYSy4wk0pLZTiRlmCPRZN4Nj7cN2nxkTik1DqoBtOdbZFvAjjOCotxx7 FdLTxPNA+fzm0ycPsd1WgdOj1U+viHojZNIxelZJFU0SG+YmYytBAVMDpPqHGF0i84ux 5VCJZ3NCQ7mHJdEL6SvBcqMMHpm2UuKUB6fvQvz0RN/qbJxYaBzvgJ8vCgHZbtQfbER0 oUsaS3yjLiCnQxqXdNLUS/K+qp2X6ZhbsDxwkOzdZ6AW2WAjJb8V23KvvgFrcURd7S+Z Lpag== X-Gm-Message-State: ALQs6tDbz05Z8/JbgQA4xk4groiGqFqG1SyqKdLLtCD+qkbsocB6lr8g Y4lKbRoTSrqr6lJjVBXXscc= X-Received: by 10.55.132.130 with SMTP id g124mr37386525qkd.226.1524768504496; Thu, 26 Apr 2018 11:48:24 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id k43-v6sm17970058qtc.5.2018.04.26.11.48.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Apr 2018 11:48:23 -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 v2 1/2] spi: bcm-qspi: Avoid setting MSPI_CDRAM_PCS for spi-nor master Date: Thu, 26 Apr 2018 14:48:00 -0400 Message-Id: <1524768481-16347-2-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524768481-16347-1-git-send-email-kdasu.kdev@gmail.com> References: <1524768481-16347-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. Fixes: fa236a7ef24048 ("spi: bcm-qspi: Add Broadcom MSPI driver") 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