Received: by 2002:a19:ee01:0:0:0:0:0 with SMTP id g1csp636946lfb; Wed, 20 May 2020 07:33:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyOjN2WqxlmYbF0aZRHHmZ76W+pOPOQKfZKVJbio0i8Ge/W/esZ6T3IrBGF2IIKJKMuO/d X-Received: by 2002:a05:620a:1524:: with SMTP id n4mr5076733qkk.490.1589985203891; Wed, 20 May 2020 07:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589985203; cv=none; d=google.com; s=arc-20160816; b=p6XIkwgH0BCXDW82tDtH0T9fKvksq+rNdYaP+LBbB5aQG6tqaNNbHdgWffyKESo63l 6CMxWMYiSFl/32SKVOBJd7IblBI80nLvvCQRshUWwHCgROomAgY2zIDFsytitcz9CHUF zArWdiU24ZtLMbSwj3FR2T5l64sSryZ2Od/mu9vRuFE78xVUiWGwwphlr63HtVQyTSED glSVu4v4IH1yGi8S7yTV/ZwA7PKhZC2ZG3jBvKDA8cAiFL3aEeHoQ8+cE0ae92LtMpWv 25gauRcQ7Am9JJWFFp8gJzV8peDdtPBtfMTumz7rTT0nVWnAMimjG8WNJfDNF15pFhI1 w7Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=PXxBZetuYeBOwMYKyQFovUtIjAoxzqAocsmZ8HOO5i8=; b=sR8wZX/XB/4jhfgbI/WJSil5U8vCG6kNQ4wqtyfZCbc1Aty1QRMxn4LLYXPA374FF5 8ZckU+sg70Fr1cDIFWzlcfqp6hxH8joPf7hb/dGwNNdESQuwRTSRg1wD635paWnfFDag Rw91l01mqEffRA7pDPBBiGuuzBMumFK/iW8GNj/RmDY2wFPbYhmDY0Z0U1nDIjqTB9vq 6F4/sLXHNDbxy+K8gFNMGvmvyvfsM2fGXnaHqDUmNvzTjpkM/iGa9vECOrhomKQnLRmo qcFrqwAWx9gBvg6SOMt96REBCB+DEYgfaUb/b/mYsJNgH4ymUpbzzeVl901T2sNXn1td mGBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uiEUvca4; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w144si1883107qkb.18.2020.05.20.07.33.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 May 2020 07:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uiEUvca4; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1]:41194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbPmc-0002TO-93 for alex.bennee@linaro.org; Wed, 20 May 2020 10:33:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPmU-0002Rf-67; Wed, 20 May 2020 10:33:14 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbPmT-0008Pl-Dk; Wed, 20 May 2020 10:33:13 -0400 Received: by mail-wm1-x343.google.com with SMTP id z72so3115383wmc.2; Wed, 20 May 2020 07:33:12 -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; bh=PXxBZetuYeBOwMYKyQFovUtIjAoxzqAocsmZ8HOO5i8=; b=uiEUvca4nZ5Oqzkf8wtGDcHrGU9jK9S5S3JHLngZBQJhNJ/kjcXVcWw2Q41l9RGTU+ vn8fe9A6MzL9Q7w4Dhq+IQfJSRAqIGSysD7dRDkZzaEUxJKJcrjAKNNivH6XAV8X3bVi JL0WjNJI89M25S6S4pm6HQyvFr5G7p1QQXseQnklj9KdLsI9nWRZuLTP90kT65WTUz9R qSX4IIxr2lkPsvEs3p49Xc3f2DixbVbm+yuMYUVvzTGZ7DPTbCMABHDIJNOQuDHhvzWJ DIyQm9ik4T51I0Tz++H8OIyVBJtv8etu8Cxc5cNhtKCJ2QRG05h7mP1HV5qCCuC1yayZ dS0w== 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; bh=PXxBZetuYeBOwMYKyQFovUtIjAoxzqAocsmZ8HOO5i8=; b=NhWqu2l1ETeU3UXBhoWgzWcG6rCDHxvOFsFDE4EN1Rk71aYHlNoobaVsOxwjaflc33 hClg9RHAcWtT8tblMhRr+8NQF5/Oh1ktV8tr54mUgHLT4pYik+Jzo+cJ1V8ZgPpqKg/Y E92Y0ZARAluW68E6GZOzonNoNa4DPUld/NLpC/ZK+hSrEGalEFFO5q4CttIn3Q33UaeC RvC8kJ31Gn8+KdycSA7CTCZC2qcnvaRgn5SlPrS5YeK+pWfN3LEWCvVKBLaXzyE0H5Z7 W7zLNEd7G9ECJytj3Qg6gyTBSh3RV0hZ7oZSvw355n2NVxbHIjI7Go1XpD6k0ZrHR1mj a/VQ== X-Gm-Message-State: AOAM532lMt4Z3/KlLnN8CLYiQbeiYuq3grJz4caao3S4zttA6VqPS65E iJkQFJufQtmPZ3C4eP599MdUU4PSu5pxiQ== X-Received: by 2002:a7b:c0d1:: with SMTP id s17mr4689213wmh.157.1589985190334; Wed, 20 May 2020 07:33:10 -0700 (PDT) Received: from eden-linux.lan (bzq-109-66-59-205.red.bezeqint.net. [109.66.59.205]) by smtp.gmail.com with ESMTPSA id l18sm3180072wmj.22.2020.05.20.07.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 07:33:09 -0700 (PDT) From: Eden Mikitas To: qemu-devel@nongnu.org Subject: [PATCH] ssi/imx_spi: Removed unnecessary cast and fixed condition in while statement Date: Wed, 20 May 2020 17:32:55 +0300 Message-Id: <20200520143255.27235-1-e.mikitas@gmail.com> X-Mailer: git-send-email 2.17.1 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=e.mikitas@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-trivial@nongnu.org, Alistair Francis , Jean-Christophe Dubois , "open list:i.MX31 kzm" , Peter Chubb , Eden Mikitas Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: JvX1qR0ELYjD When inserting the value retrieved (rx) from the spi slave, rx is pushed to rx_fifo after being cast to uint8_t. rx_fifo is a fifo32, and the rx register the driver uses is also 32 bit. This zeroes the 24 most significant bits of rx. This proved problematic with devices that expect to use the whole 32 bits of the rx register. I tested this change by running `make check` and by booting linux on sabrelite (which uses an spi flash device). Signed-off-by: Eden Mikitas --- hw/ssi/imx_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index 2dd9a631e1..43b2f14dd2 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -182,7 +182,7 @@ static void imx_spi_flush_txfifo(IMXSPIState *s) rx = 0; - while (tx_burst) { + while (tx_burst > 0) { uint8_t byte = tx & 0xff; DPRINTF("writing 0x%02x\n", (uint32_t)byte); @@ -206,7 +206,7 @@ static void imx_spi_flush_txfifo(IMXSPIState *s) if (fifo32_is_full(&s->rx_fifo)) { s->regs[ECSPI_STATREG] |= ECSPI_STATREG_RO; } else { - fifo32_push(&s->rx_fifo, (uint8_t)rx); + fifo32_push(&s->rx_fifo, rx); } if (s->burst_length <= 0) { -- 2.17.1