From nobody Sun Nov 2 11:45:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509272490140657.0556267941676; Sun, 29 Oct 2017 03:21:30 -0700 (PDT) Received: from localhost ([::1]:35485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8kia-0003jE-8x for importer@patchew.org; Sun, 29 Oct 2017 06:21:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8kbO-0006XT-Sg for qemu-devel@nongnu.org; Sun, 29 Oct 2017 06:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8kbN-0007ry-U9 for qemu-devel@nongnu.org; Sun, 29 Oct 2017 06:13:58 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:44384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e8kbN-0007rd-M0 for qemu-devel@nongnu.org; Sun, 29 Oct 2017 06:13:57 -0400 Received: by mail-lf0-x241.google.com with SMTP id 75so11678810lfx.1 for ; Sun, 29 Oct 2017 03:13:57 -0700 (PDT) Received: from localhost.localdomain (c83-254-152-225.bredband.comhem.se. [83.254.152.225]) by smtp.gmail.com with ESMTPSA id v62sm2819800lje.39.2017.10.29.03.13.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 03:13:55 -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=fRqYF8CFDz/pK31LLU9qzJCPi/b3TKwG8qgezqp+k/0=; b=PZeF/5116ajbi1IQ70/0Upkk6BfcUFNVtYBc9dj3iOWBR0td7SPd5I3xucvq7awhbG Ef15uU82+lgnRXPWgA+CerZGPsYHE3TP1gvGXytdiHs4NIbk6lXJ5WUqTzyTtUU21Pox d//NHQUtYgtuGd5fYIhOhBDM13a8BPyLwPNfb8TKXg0oSiNkH1fEsOoEzuh3NuHoukNr vzvTO+Qalcx1G73992wAIMQ7xEyTzOfJy5iKYjgpB6FQyVn7/I/7a82oSyeigLlsWZYG qpV1cSq5RSlvOG4lFDTQibO3LEcul47OZU+sSO4+Kgre0/VbLOOql/fklhbPto+S0M/I Fxhg== 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=fRqYF8CFDz/pK31LLU9qzJCPi/b3TKwG8qgezqp+k/0=; b=ZmgyftLa0MxbmtbBntMNUK9MjopGhJTmbIMyaGklSr7P//QGCNHpFQ37wW0XvZPpJu RgYfDXWROVK2Uszqwxa0JtE6yFmrf/2uWjkYAgr6n7fCyK3Oa8ECkX9yLC5a07ZP7gO2 p/y2if8/MbE8MmIRqKobbHI17xKX3kr7bF2pPT5Yx36PMUL7B1cjTCFPom4Ae8Hmod10 zn+bjpvU6S7G9oZ4vtwJdB1gOGN3xGpAcggws83cIfOHsm7F+YkiSJZiAkaQSODbqvPw l3LpPotooS4Mvg6e+WB9zvAVT5Dwn+VoCeM26aIf+vPD41gpongzFJwgCoeYTFK4BDHv d8Nw== X-Gm-Message-State: AMCzsaVM/E2CRU/93qpI28Lr5K/x2rxSCjf9uyn9Np7XvmkTay8jBMQF hWq8P2enM8IdA1hdEP8RfMX57Q== X-Google-Smtp-Source: ABhQp+Sw9jIs7XnBN5xOuTtfRijuoTULP1VgkM5lf4tz5GuKYKvaHBSc7WmqzNXqC3W/B1nd6NCMbA== X-Received: by 10.25.87.143 with SMTP id l137mr1719958lfb.193.1509272036130; Sun, 29 Oct 2017 03:13:56 -0700 (PDT) From: Francisco Iglesias To: qemu-devel@nongnu.org Date: Sun, 29 Oct 2017 11:13:36 +0100 Message-Id: <20171029101343.15544-7-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171029101343.15544-1-frasse.iglesias@gmail.com> References: <20171029101343.15544-1-frasse.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v5 06/13] xilinx_spips: Update striping to be big-endian bit order X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgari@xilinx.com, alistai@xilinx.com, francisco.iglesias@feimtech.se, mar.krzeminski@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update striping functionality to be big-endian bit order and output even bits into flash memory connected to the lower QSPI bus and odd bits into the flash memory connected to the upper QSPI bus. Signed-off-by: Francisco Iglesias --- hw/ssi/xilinx_spips.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c index 559fa79..7accf5d 100644 --- a/hw/ssi/xilinx_spips.c +++ b/hw/ssi/xilinx_spips.c @@ -208,14 +208,14 @@ static void xilinx_spips_reset(DeviceState *d) xilinx_spips_update_cs_lines(s); } =20 -/* N way (num) in place bit striper. Lay out row wise bits (LSB to MSB) +/* N way (num) in place bit striper. Lay out row wise bits (MSB to LSB) * column wise (from element 0 to N-1). num is the length of x, and dir * reverses the direction of the transform. Best illustrated by example: * Each digit in the below array is a single bit (num =3D=3D 3): * - * {{ 76543210, } ----- stripe (dir =3D=3D false) -----> {{ FCheb630, } - * { hgfedcba, } { GDAfc741, } - * { HGFEDCBA, }} <---- upstripe (dir =3D=3D true) ----- { HEBgda52, }} + * {{ 76543210, } ----- stripe (dir =3D=3D false) -----> {{ 741gdaFC, } + * { hgfedcba, } { 630fcHEB, } + * { HGFEDCBA, }} <---- upstripe (dir =3D=3D true) ----- { 52hebGDA, }} */ =20 static inline void stripe8(uint8_t *x, int num, bool dir) @@ -223,15 +223,15 @@ static inline void stripe8(uint8_t *x, int num, bool = dir) uint8_t r[num]; memset(r, 0, sizeof(uint8_t) * num); int idx[2] =3D {0, 0}; - int bit[2] =3D {0, 0}; + int bit[2] =3D {0, 7}; int d =3D dir; =20 for (idx[0] =3D 0; idx[0] < num; ++idx[0]) { - for (bit[0] =3D 0; bit[0] < 8; ++bit[0]) { - r[idx[d]] |=3D x[idx[!d]] & 1 << bit[!d] ? 1 << bit[d] : 0; + for (bit[0] =3D 7; bit[0] !=3D -1; bit[0] +=3D -1) { + r[idx[!d]] |=3D x[idx[d]] & 1 << bit[d] ? 1 << bit[!d] : 0; idx[1] =3D (idx[1] + 1) % num; if (!idx[1]) { - bit[1]++; + bit[1] +=3D -1; } } } @@ -266,8 +266,9 @@ static void xilinx_spips_flush_txfifo(XilinxSPIPS *s) } =20 for (i =3D 0; i < num_effective_busses(s); ++i) { + int bus =3D num_effective_busses(s) - 1 - i; DB_PRINT_L(debug_level, "tx =3D %02x\n", tx_rx[i]); - tx_rx[i] =3D ssi_transfer(s->spi[i], (uint32_t)tx_rx[i]); + tx_rx[i] =3D ssi_transfer(s->spi[bus], (uint32_t)tx_rx[i]); DB_PRINT_L(debug_level, "rx =3D %02x\n", tx_rx[i]); } =20 --=20 2.9.3