From nobody Tue Feb 10 19:08:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) client-ip=209.85.218.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1610476595; cv=none; d=zohomail.com; s=zohoarc; b=EaWF7vfWYiXueLfIxt8yaAkpgUv/NfkAWTcFkYl70uhcH1CMLoxLCGhgFcsEPE4uSWKol8pLY5z1SNCq1p5sZ9cmdacwP6JF8vrQ6BCNLgNIiqJ7RRvBCs3lkoGiBJdMi9cIyqx/th4Olx8kEBSYHEtpq49kjzTFcRikJ8nzaSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610476595; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=URPw2976JZr7XRKyhMiAKOdcNTBQU8VnrnQ2GFeuE/U=; b=U7DIHvNgTGVXhE20rHk41KHvodOFHAwaXdnKS5gi/Qlvmpbb47yrieM+gMKbvwQ7hBfEW294XJAH5Jwhdr2d4Z5vUPTiCfSZSjp7I3QmoG6RSZsqvzSDKHwmkLHS85SyCCPPNB7dbNHEkiPCtuFyF5YG1fZVIamWwLZ9JDpBWa8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by mx.zohomail.com with SMTPS id 161047659587824.922185286575882; Tue, 12 Jan 2021 10:36:35 -0800 (PST) Received: by mail-ej1-f49.google.com with SMTP id lt17so4963148ejb.3 for ; Tue, 12 Jan 2021 10:36:35 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (190.red-83-57-173.dynamicip.rima-tde.net. [83.57.173.190]) by smtp.gmail.com with ESMTPSA id k2sm1516490ejp.6.2021.01.12.10.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 10:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=URPw2976JZr7XRKyhMiAKOdcNTBQU8VnrnQ2GFeuE/U=; b=l20l7gwWIKPn32PIaaF39Dntbr9gVgUYcerX5b/rTYZA7TyEvIP8nd7HeayFeQK3ut uSpCBts9Krux9jifdRQf1QkakzQnlPS+kaCnIXyJD1M8islpFIJquKX+FaJzEbU13TrO WXb6rNpWZikweRuVb0O9R7GP2Sh5XUn98RmcBMHk8tpygi5E63ytZelumOVZsrCLx4F7 qR471FnxLEEhKy1b8mFjbll+c7yfIay1OmnLuxN8mQ9g5bJbOY7Yee06O1/3qonWxTIU YF053G4+farbNVdkrGKWKpatA1keGPDKMgZAC6GfkocEVaXfIKjdAAhgOtC6K4G2Tww1 2rZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=URPw2976JZr7XRKyhMiAKOdcNTBQU8VnrnQ2GFeuE/U=; b=fHRQ6xC+WMDZofMPdiO/tlBYEIEH0qyOYvFkAZiPMx9iDiJcH+6gSm9g3QDxXHLE97 CV4B2VcmUc2SemMG/zMKFudizyMgdKxV6trR4kuCcf/nLpYiXKeUg775gY9LIMLX6V8Z gbtfXsPUe5p0PPJPK2dG6Ja3JB4RxMgPOeMVUQdmHHBhOBJpK8mXb6dpYYzdVVN2Pqkq omnSyWw+gTSqDJvVTbxaMsiY4FRr4p2cZHj53pLu7gqx5UGnh6YdljqvCFphtmTMQYCy pAmQq/6XdCsl/bcD4Pj8iyQLi0bKx6MovXFWLK/frEmw/fAsWrpPEw0s8sVwGGLqyjjt fsUA== X-Gm-Message-State: AOAM530UR7iV4MvLqdH4sZsBSp/qdvTscsCjS25ANeTXYY8+tXWpwmnO 0fLDFwyfRQ7ZKFW4UJTBPt4= X-Google-Smtp-Source: ABdhPJxVs7D+TeVRgmikig04ysNfEvpjXa9GxFu9bq1Fp9EL34h+nql5Lmf/X1Qb7jol/+mc9emwkg== X-Received: by 2002:a17:906:d8a1:: with SMTP id qc1mr125349ejb.294.1610476594097; Tue, 12 Jan 2021 10:36:34 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Bin Meng , qemu-devel@nongnu.org, Bin Meng Cc: qemu-arm@nongnu.org, Jean-Christophe Dubois , Peter Maydell , Alistair Francis , Peter Chubb , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH v6 09/11] hw/ssi: imx_spi: Round up the burst length to be multiple of 8 Date: Tue, 12 Jan 2021 19:35:27 +0100 Message-Id: <20210112183529.2011863-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210112183529.2011863-1-f4bug@amsat.org> References: <20210112183529.2011863-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Bin Meng Current implementation of the imx spi controller expects the burst length to be multiple of 8, which is the most common use case. In case the burst length is not what we expect, log it to give user a chance to notice it, and round it up to be multiple of 8. Signed-off-by: Bin Meng Message-Id: <20210112145526.31095-5-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ssi/imx_spi.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index 2f9e800dd3a..638959daa08 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -129,7 +129,20 @@ static uint8_t imx_spi_selected_channel(IMXSPIState *s) =20 static uint32_t imx_spi_burst_length(IMXSPIState *s) { - return EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1; + uint32_t burst; + + burst =3D EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + = 1; + if (burst % 8) { + qemu_log_mask(LOG_UNIMP, + "[%s]%s: burst length (%d) not multiple of 8!\n", + TYPE_IMX_SPI, __func__, burst); + burst =3D ROUND_UP(burst, 8); + qemu_log_mask(LOG_UNIMP, + "[%s]%s: burst length rounded up to %d; this may not= work.\n", + TYPE_IMX_SPI, __func__, burst); + } + + return burst; } =20 static bool imx_spi_is_enabled(IMXSPIState *s) --=20 2.26.2