Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp845281imj; Thu, 7 Feb 2019 12:48:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IYKL/djidmCXE4zmz4EZbi9umQ8dJd+GJGzyrFGR0qWpX09vmL1Livrh2ET2sjmK4NwohIQ X-Received: by 2002:a65:63d3:: with SMTP id n19mr16946798pgv.179.1549572523216; Thu, 07 Feb 2019 12:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549572523; cv=none; d=google.com; s=arc-20160816; b=NSY/JFHGoj9PYxatyUDgCB5U0QSiDKU0qrCO/DSnE5JegTTpT8wJo++Lp6/N0I//ay v8XmvghnEjF4Qw+i4Nw68Std7fPTLcclRBAGTuxrsawc6nlxzRey29TICeHxPMXsPfdO eIWlqLYmG3MuKYG0DTb1Od/EY34FPHDmex0UYIr77EEIKAM8LUm4FgPImHzdhqs1QbSv XgaLTooc3N60pw9vIgfN/cBjPwPsRGx8mgyY1kUnGZguVnpbaGHAIIrTvAYuSR62Tone 3RQJ9H4LYPdn1YJDS8i6TpLKqC35pZxzNg6baTNJfIUBDy3psjxj9QtXiUCcRmNlUMPV Iy4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=TzOv1OwL+fDBuJoMldO4HA+F1NQTq3lwgboU8Xanfl0=; b=su++GW7P4mnunGLB6aA9Tn2zLoVo+fM8bgCYWUZOqBBYhctM7N6KmTO/9a8NjZugRg K+7VuI7RTU418UGWjn8TtBKsHWivaLjTkegl7A4G0WI0BkR6/A6HMN/bf7gl+AxJ/71H 5uVSDkMz0LtiLjmB8Fr++AgRG3yt3rsTnMnGwOTqpf4q6aT/NhkCljDHHpGaGDx1yXUg jxhiqohXFuzvd3KHYu9QEu9SL4wixLuU0yyPIXeHcZQeSfo+r1Yx6u+WObnEc9zP0BJN N/lVBtnepFMu4oqfoV3yqI+qWlPr1FyPnKiO3RWhPpAzTYP5e0scIX4PrRP806i5ek6G fSAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b="NEb/U4w4"; 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=fail (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 h10si24155pgp.4.2019.02.07.12.48.27; Thu, 07 Feb 2019 12:48:43 -0800 (PST) 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=@broadcom.com header.s=dkimrelay header.b="NEb/U4w4"; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfBGUrm (ORCPT + 99 others); Thu, 7 Feb 2019 15:47:42 -0500 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:34110 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfBGUrm (ORCPT ); Thu, 7 Feb 2019 15:47:42 -0500 Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id BF5F830C162; Thu, 7 Feb 2019 12:47:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com BF5F830C162 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1549572460; bh=l1LgYC/dzFHpWQxyL3nce/dgcerG3QvKq/LXHJdYimo=; h=From:To:Cc:Subject:Date:From; b=NEb/U4w4X4KNcVap7pwz+neQb8hFllsCoZm1QfLxHpklPtAmvPFMFdcNKBVR5xE58 zWOyH+xjFRniG1XqpQoHRq1N98pYOk/OD7P2g5Bo0EGGY2uhYbRmB7ETsI9rSQGRE3 BKpR6pKEzRN9nve5U8EEn39h+ySS1cUDe/X1dTrM= Received: from stbirv-lnx-2.igp.broadcom.net (stbirv-lnx-2.igp.broadcom.net [10.67.48.34]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id B5413AC0788; Thu, 7 Feb 2019 12:47:40 -0800 (PST) Received: by stbirv-lnx-2.igp.broadcom.net (Postfix, from userid 47169) id A6DA227ECE7; Thu, 7 Feb 2019 12:47:40 -0800 (PST) From: justinpopo6@gmail.com To: linux-spi@vger.kernel.org Cc: kdasu.kdev@gmail.com, bcm-kernel-feedback-list@broadcom.com, broonie@kernel.org, linux-kernel@vger.kernel.org, f.fainelli@gmail.com, Justin Chen Subject: [PATCH] spi: bcm-qspi: when tx/rx buffer is NULL set to 0 Date: Thu, 7 Feb 2019 12:47:27 -0800 Message-Id: <1549572447-45456-1-git-send-email-justinpopo6@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Justin Chen Currently we set the tx/rx buffer to 0xff when NULL. This causes problems with some spi slaves where 0xff is a valid command. Looking at other drivers, the tx/rx buffer is usually set to 0x00 when NULL. Following this convention solves the issue. Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Justin Chen --- drivers/spi/spi-bcm-qspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 584bcb0..79456aa 100644 --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c @@ -681,7 +681,7 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots) if (buf) buf[tp.byte] = read_rxram_slot_u8(qspi, slot); dev_dbg(&qspi->pdev->dev, "RD %02x\n", - buf ? buf[tp.byte] : 0xff); + buf ? buf[tp.byte] : 0x00); } else { u16 *buf = tp.trans->rx_buf; @@ -689,7 +689,7 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots) buf[tp.byte / 2] = read_rxram_slot_u16(qspi, slot); dev_dbg(&qspi->pdev->dev, "RD %04x\n", - buf ? buf[tp.byte] : 0xffff); + buf ? buf[tp.byte] : 0x0000); } update_qspi_trans_byte_count(qspi, &tp, @@ -744,13 +744,13 @@ static int write_to_hw(struct bcm_qspi *qspi, struct spi_device *spi) while (!tstatus && slot < MSPI_NUM_CDRAM) { if (tp.trans->bits_per_word <= 8) { const u8 *buf = tp.trans->tx_buf; - u8 val = buf ? buf[tp.byte] : 0xff; + u8 val = buf ? buf[tp.byte] : 0x00; write_txram_slot_u8(qspi, slot, val); dev_dbg(&qspi->pdev->dev, "WR %02x\n", val); } else { const u16 *buf = tp.trans->tx_buf; - u16 val = buf ? buf[tp.byte / 2] : 0xffff; + u16 val = buf ? buf[tp.byte / 2] : 0x0000; write_txram_slot_u16(qspi, slot, val); dev_dbg(&qspi->pdev->dev, "WR %04x\n", val); -- 2.7.4