Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp994053ybt; Fri, 19 Jun 2020 20:55:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZzCpKG/0v3eacusmmQgNqfrugxA83MH+2VljxcZJKCsOKRqlNP0JQMIGu9hyB19hGDllG X-Received: by 2002:a17:906:4ec1:: with SMTP id i1mr6348881ejv.152.1592625354494; Fri, 19 Jun 2020 20:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625354; cv=none; d=google.com; s=arc-20160816; b=fxSXthPLwINXQySFO/s4lIyDYRS1joSnI8YfYvmz1NayhVXCke4wXdPTIWa/Flmr97 ia1/l17xJOKP3xTJAa9WvuR+g8C5boTz8SWKYcAmqWXIoDduC+VYef6c61CYkdh/czjV fHqavM+jPV9YaE1E6LoRud5v/QMBSv+UEdtBUOmIrHGkSLNCPSydExWOtQd81nvfhHHi IbwH5Y8wabZoWHvbuVw6XlgJDJfZ7h7zXJBZ6RUPLJVpE2i89R7kvZoEMCv4HsDaqjbc icv1GzmTdfhnAg95x7bvUCxhhv4rC9W1Rr6GvbLZRiR/a1SNqUJ3vHY/pH2/YGkEjyjo U0zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tf/NH8xI10rzkDz9K5Xqg1DAuMuufekePMlLQTWtsJ8=; b=bn61AyC3IKFZPe3DKjEZQZBNptN7AfC7ppKBhAXg6/wU4WhkYHV2usqflSeWDAepl5 vz3P5lW+ff2hEJJDOvfMkMUxMGwslvFJaYI/ACGWQmVjbqB06QHXPPO9s0R3O1ntPiLp 08BF6Q6Z/aJGgAQOtc4v7pZqUCtanppLnFM6dW2bvhwQSPZ7qxIA0RSXVcpLKg5DWUXO v47zyrJeGQ+ieNEc23QSBvFxc8LC1C/EKpMVaG56PFi8NPu/tUOJtkyfcBUOrEAkiui2 XdEzPBg+RqXNKiF9Cqvhtn+AeU7I1CzFIXOcYzfdFoVk7lB1cCMDVvk5SfHVsRxwJMTp T9pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OVUe8v5N; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do5si6941185ejc.105.2020.06.19.20.55.32; Fri, 19 Jun 2020 20:55:54 -0700 (PDT) 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=@kernel.org header.s=default header.b=OVUe8v5N; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394954AbgFSQ2a (ORCPT + 99 others); Fri, 19 Jun 2020 12:28:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389914AbgFSOzA (ORCPT ); Fri, 19 Jun 2020 10:55:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 ED29021556; Fri, 19 Jun 2020 14:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578499; bh=fuyKSyBHG60r/Gua4nx3314Yf7DDC7u+SL1aJLP5Sec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OVUe8v5NSJZMxvs6ghbZN6C3MQi2Avsl281M/hwJaAoZksECxNonqT0y73hCMEX0m 83ofC8EL88eLfspLYEj1RbyLvcM1oxVsj7eBvVh0J6QAhtextAJbGx6T8Y/WgZOkmi q12lG168n6fcgYUGUGw0c8JMmVO62uxf6LNjZaNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Chen , Kamal Dasu , Mark Brown Subject: [PATCH 4.19 045/267] spi: bcm-qspi: when tx/rx buffer is NULL set to 0 Date: Fri, 19 Jun 2020 16:30:30 +0200 Message-Id: <20200619141651.057496542@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Justin Chen commit 4df3bea7f9d2ddd9ac2c29ba945c7c4db2def29c upstream. 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 Signed-off-by: Kamal Dasu Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200420190853.45614-6-kdasu.kdev@gmail.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-bcm-qspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- 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 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] : 0x0); } else { u16 *buf = tp.trans->rx_buf; @@ -689,7 +689,7 @@ static void read_from_hw(struct bcm_qspi 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 / 2] : 0x0); } update_qspi_trans_byte_count(qspi, &tp, @@ -744,13 +744,13 @@ static int write_to_hw(struct bcm_qspi * 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);