From nobody Mon Feb 9 17:05:13 2026 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 150952119575478.82077969801776; Wed, 1 Nov 2017 00:26:35 -0700 (PDT) Received: from localhost ([::1]:48735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9nPx-0004x8-UZ for importer@patchew.org; Wed, 01 Nov 2017 03:26:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9nGt-00069U-2n for qemu-devel@nongnu.org; Wed, 01 Nov 2017 03:17:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9nGs-0001TR-2W for qemu-devel@nongnu.org; Wed, 01 Nov 2017 03:17:07 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:53031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e9nGr-0001S0-Qr for qemu-devel@nongnu.org; Wed, 01 Nov 2017 03:17:05 -0400 Received: by mail-lf0-x244.google.com with SMTP id b190so1468633lfg.9 for ; Wed, 01 Nov 2017 00:17:05 -0700 (PDT) Received: from localhost.localdomain (c83-254-152-225.bredband.comhem.se. [83.254.152.225]) by smtp.gmail.com with ESMTPSA id c132sm562371lfe.37.2017.11.01.00.17.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Nov 2017 00:17:03 -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=g28/VxI+Kg3Svfb39x2djiyH/8fi6IifKHaPcH4wdiU=; b=UYz8rAlxP+Y8HurRAHtQbSlEX+TI8HBMPu+OvNRc8EjS2ci8/JqXtdu3z3PloIMSmC 5to0BvdJ3dHat9XqdkjRV+sM6UyXd5FKziSUdxkGrL6JpqyAwXLeU48LZ0x8xK78yHtZ ZT39GUej3Ar/KHTsKqR4yQE+kllRDTic1uU9+ZfNBEUEoi6g6CB5G4ltHZgBENd1IG7f 8vAj12CgF+3x/EvWnXM7LBpmOzj5KePWv/1MHOVbufo7x+KQu9LlVIeqYgltjBWVwYMe rbEmHY98SVIK8CprKEFsydvPX7QeQ658C3T2+YX4Eq3c0/hYeobNUk81Veh8LdWGVvIb qZFg== 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=g28/VxI+Kg3Svfb39x2djiyH/8fi6IifKHaPcH4wdiU=; b=lGiUFsLlVmzkMjDY9gs1sqHpRfwOW+9JJ8K5/MDfHKDADyUFSXLgsxpBPOvbbXqruW NKm/TYqV0wZwGgfrmJ2bVb3wsK/ZaTf9MpSyPjzOOqsFOTFrjApUuaptftqNcDC7R5Tq 5Au2q13oU69GDuqhUvipUcKGvcdyJ4lvuW4veRavenUH1ONRFOq1s1WJenkmUiaZetYy hY36YeE+jIphKo/MqSrWTnheyx/zKFM71B47qsZIGByCJ7OYRYUkUMDP+laz7uAf3f8e 9gT+fnOb3eZu3LlQFcgt0hnOjILC9N2ZDDhlrHDoTmIdK6wjl6VVxDFjmjDfqwNeOMcC NRjw== X-Gm-Message-State: AMCzsaW57fxMU2sHMUebEioO0KPSW61lmp6nwyce4VzqPvKq2x/UKmBl 4UEp5FHCBOk4SYnlSJHfvY7xEA== X-Google-Smtp-Source: ABhQp+S6cnGFgPL3AvSb+r/HBWhxD8X5dyORTI5gXNIKqUnE51PXpbyqaF2GcJ/qTcy+hOCo9bda0g== X-Received: by 10.46.91.138 with SMTP id m10mr2128603lje.95.1509520624055; Wed, 01 Nov 2017 00:17:04 -0700 (PDT) From: Francisco Iglesias To: qemu-devel@nongnu.org Date: Wed, 1 Nov 2017 08:16:45 +0100 Message-Id: <20171101071652.19375-7-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171101071652.19375-1-frasse.iglesias@gmail.com> References: <20171101071652.19375-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::244 Subject: [Qemu-devel] [PATCH v6 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 (as according to the Zynq-7000 Technical Reference Manual). Output thereafter the even bits into the flash memory connected to the lower QSPI bus and the 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