From nobody Tue Nov 18 15:28:28 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1611061613; cv=none; d=zohomail.com; s=zohoarc; b=UpEVgAfcSQH/HRGFhLfrjLXcdQ6KQA0wNg5Vog5MZ7Gujz8HRqw5lAvKFI/kfkUNRNpE7velWxl7P1YSBlALeASDFw4PGKqBOM+rwslUR3WskvVzqb1gGpVVlugs3bNY4mJ/WrInUh+ovTaZxZF+XEDtGlf0BcWqt99AKIL3Wyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611061613; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nBfQdnHsV8Wq5vizPIPoPSOpWjRk29x+48yhgI+v53U=; b=nA+iw8J7TOuR3R6x4OOfTIx3CYavdsZksboRlAU2tlL1NaGsZqs5K1vMHqSDZhmWU94UBHg3VABNB+vhEC32ak0knGqMQHWJ2h51yIHyxg/0PcEdfg36D1bQfh+We+ga4eyz/aal0/Tt1hfVjvE1gwk+mQefBv35DTBVOjDTmhM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611061613808556.2925273824145; Tue, 19 Jan 2021 05:06:53 -0800 (PST) Received: from localhost ([::1]:52602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1qii-0001YH-Qd for importer@patchew.org; Tue, 19 Jan 2021 08:06:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1qe9-0006S7-3k for qemu-devel@nongnu.org; Tue, 19 Jan 2021 08:02:09 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:46530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1qe4-0005vP-0L for qemu-devel@nongnu.org; Tue, 19 Jan 2021 08:02:08 -0500 Received: by mail-lj1-x22e.google.com with SMTP id u11so21757197ljo.13 for ; Tue, 19 Jan 2021 05:01:59 -0800 (PST) Received: from localhost.localdomain (31-208-27-151.cust.bredband2.com. [31.208.27.151]) by smtp.gmail.com with ESMTPSA id e25sm2356745lfc.40.2021.01.19.05.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 05:01:57 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=nBfQdnHsV8Wq5vizPIPoPSOpWjRk29x+48yhgI+v53U=; b=Smtge64XARU4FTT8xy+y8pOgxiXZS+tRx4NFa7AIcTNFRBTmerY5lxD0ffrwyYRq0z mdJgyGBhAG73Au8zm4u63mEaJY0/pFe4h91+E2tUkGEgXUHDYNYotxN96fqeoafw3yM9 0ARA5c/fiXWkBXug53PGDcslu49Y495dQNoeyVAahRxqRUWVBpnTfBopbn5LLxnLlmxD GThQPvN3LJMg1R93NicjYFkHghv6n8Ud3rRdxvarTPEwz5sg63f6u6s7dGrEv6u2bvsN 0yrdmP134miK+h4zuQYfwbwE9C22bpsbA5TBMwxFwbF658fJ5lwdhRG74AY9ad6zJ6wd PiCQ== 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:mime-version:content-transfer-encoding; bh=nBfQdnHsV8Wq5vizPIPoPSOpWjRk29x+48yhgI+v53U=; b=HK9YyA9IWaxrYpIozGVzDOCO3C6PDrr07E1FwBS9omDNJiANlk0Ez7i+LNfoAU1KG1 dTU8JpInM2hHh1yyIEdbwjN1WwbYNT5XQ620NFqUmRCo6WkjLCyVtIbX9L45LT89BIXf LJBKtWEpaQB1nfTJ9YhMYX2AzVySz37cZLX2/JwSYi6i8hVRcuUDrBB9wvuyMW9XJU2G jXFKF75gOCvn4lM6J/7qf6y38437ceIeMddrgA6ovmGmdXe1ehOfZNLO7grXJxPvXQ56 owLqfPxY3JQlS0X7Y7H8hBtx56uG0+GpGHemewuDakXNsYR4v/vnl797A7YNVwforJoJ XHOQ== X-Gm-Message-State: AOAM533VyQ0/A68qQ3LnMLn7X1tjBFGDB9z3ckuM8VgU9UKyTo3pM9kE tFO75ThEWjJLB/vXqoFQfvBOdFJXyMXLeg== X-Google-Smtp-Source: ABdhPJycHhG3ZEMo421Jaj7Vewsc7/+Iiamyn+MuthQWfi8J38cZVFm1Z+i5v0B4pHNNCT9/49gJsA== X-Received: by 2002:a2e:740d:: with SMTP id p13mr1950333ljc.288.1611061317926; Tue, 19 Jan 2021 05:01:57 -0800 (PST) From: Francisco Iglesias To: qemu-devel@nongnu.org, frasse.iglesias@gmail.com Subject: [RFC PATCH v1 1/3] hw: ssi: Introduce ssi_txfifo_transfer Date: Tue, 19 Jan 2021 14:01:53 +0100 Message-Id: <20210119130155.30194-2-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210119130155.30194-1-frasse.iglesias@gmail.com> References: <20210119130155.30194-1-frasse.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=frasse.iglesias@gmail.com; helo=mail-lj1-x22e.google.com X-Spam_score_int: -1020 X-Spam_score: -102.1 X-Spam_bar: --------------------------------------------------- X-Spam_report: (-102.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_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_WELCOMELIST=-0.01, USER_IN_WHITELIST=-100 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, alistair@alistair23.me, bin.meng@windriver.com, mreitz@redhat.com, alistair23@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This patch introduces ssi_txfifo_transfer aimed to be used by SPI controllers transfering through a txfifo. When interacting with a SPI flash (m25p80), ssi_txfifo_transfer will toggle the accuracy from dummy clock cycles to dummy bytes and by doing this above mentioned SPI controllers will obtain support for the commands requiring those. Signed-off-by: Francisco Iglesias --- hw/ssi/ssi.c | 22 ++++++++++++++++++++++ include/hw/ssi/ssi.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c index e5d7ce9523..b87628ea0c 100644 --- a/hw/ssi/ssi.c +++ b/hw/ssi/ssi.c @@ -127,6 +127,28 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) return r; } =20 +uint32_t ssi_txfifo_transfer(SSIBus *bus, uint32_t val) +{ + BusState *b =3D BUS(bus); + BusChild *kid; + SSIPeripheralClass *ssc; + uint32_t r =3D 0; + + QTAILQ_FOREACH(kid, &b->children, sibling) { + SSIPeripheral *peripheral =3D SSI_PERIPHERAL(kid->child); + ssc =3D SSI_PERIPHERAL_GET_CLASS(peripheral); + if (ssc->set_dummy_byte_accuracy) { + ssc->set_dummy_byte_accuracy(peripheral, true); + } + r |=3D ssc->transfer_raw(peripheral, val); + if (ssc->set_dummy_byte_accuracy) { + ssc->set_dummy_byte_accuracy(peripheral, false); + } + } + + return r; +} + const VMStateDescription vmstate_ssi_peripheral =3D { .name =3D "SSISlave", .version_id =3D 1, diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h index f411858ab0..39bf00ec96 100644 --- a/include/hw/ssi/ssi.h +++ b/include/hw/ssi/ssi.h @@ -54,6 +54,8 @@ struct SSIPeripheralClass { * always be called for the device for every txrx access to the parent= bus */ uint32_t (*transfer_raw)(SSIPeripheral *dev, uint32_t val); + + void (*set_dummy_byte_accuracy)(SSIPeripheral *dev, bool val); }; =20 struct SSIPeripheral { @@ -105,5 +107,6 @@ bool ssi_realize_and_unref(DeviceState *dev, SSIBus *bu= s, Error **errp); SSIBus *ssi_create_bus(DeviceState *parent, const char *name); =20 uint32_t ssi_transfer(SSIBus *bus, uint32_t val); +uint32_t ssi_txfifo_transfer(SSIBus *bus, uint32_t val); =20 #endif --=20 2.20.1