From patchwork Tue Jul 31 20:10:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)\" via" X-Patchwork-Id: 10551341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EF4813BF for ; Tue, 31 Jul 2018 20:13:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E5FF286F5 for ; Tue, 31 Jul 2018 20:13:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 820E528736; Tue, 31 Jul 2018 20:13:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51FB1286F5 for ; Tue, 31 Jul 2018 20:13:07 +0000 (UTC) Received: from localhost ([::1]:60551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkb10-0007yu-4D for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jul 2018 16:13:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkb0D-0007cZ-6A for qemu-devel@nongnu.org; Tue, 31 Jul 2018 16:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkb0C-0000EO-6z for qemu-devel@nongnu.org; Tue, 31 Jul 2018 16:12:17 -0400 Received: from mail-co1nam05on0731.outbound.protection.outlook.com ([2a01:111:f400:fe50::731]:20000 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fkb07-00008X-Eb; Tue, 31 Jul 2018 16:12:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xJ5xRNxdsX/6cBKMWdsKZ6KS35jqtvR5/+wiDXBuE2o=; b=jJFesQigURGa5Yg7nPT14QaM4dfiAbp72LHt/Z/uLQmq/h3XlGn6JhceEtaxcqnQYZvjhPAcN8HAFKuCKgUjr/2UBK4NparyvsadLS6T7VZqlVPicrFU102QRR1lyel7thwkZNSPea2dvsZWCuOkrqo1A+9SZcs0Qk4u1FemvPU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.207.205.253) by SN4PR0601MB3711.namprd06.prod.outlook.com (2603:10b6:803:4b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Tue, 31 Jul 2018 20:11:50 +0000 To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 31 Jul 2018 13:10:56 -0700 Message-ID: <20180731201056.29257-1-tpiepho@impinj.com> X-Mailer: git-send-email 2.14.4 MIME-Version: 1.0 X-Originating-IP: [216.207.205.253] X-ClientProxiedBy: DM5PR16CA0047.namprd16.prod.outlook.com (2603:10b6:4:15::33) To SN4PR0601MB3711.namprd06.prod.outlook.com (2603:10b6:803:4b::33) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79729a86-47ca-4007-20e0-08d5f721da68 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:SN4PR0601MB3711; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0601MB3711; 3:ivPvbWxc4/I83XvFTvvQqUS7JNuYOwNt4I0ijtGD4pu2KAtTxpDAv3qf6jBEUGrQWcSK/EONL1tqCxAkOFl9MfY58xircn74Pnevvjw91CbUaVDO2xhCP7Xl4M/UHzaFIF5KdUFStt0NGB/LCYanU0xtn+L3aFWoxkCReCgifIi0NhwaTFfqBYaITEl2c2frxuWeX6SNzZivoWRK6Xl2DcOo/OJVZGMU57hHaf+UWoW/tLIm040heUJ+eSNrfFpU; 25:SGu7e/RakdaKOdB+apMYZ5+NQb7yzis8x6DoiVrKZdmGvoYPlT9aoIVLr1bFrYg8pNAcGXH6+Ka61R0R9O632H7cSH7BruQZ0igc2Seywa8GRcgbzq13y+4zyW/n3lZXufUGftnrDNNPh59cpmE/q2yabaTqUYfPK68woZgc27HxhTubWt+vgW77JgU3YoKL/gRoPgA30h4qM0BxEw0K4OnJts3h2vlWIzDSwfrunNub30CNwgvyz3YRmWevmZOsSvZ5PUTiBpQKr6NPDvyTFE8yOPn5MtutIotBBVCjOyK739kJhxEZfFAzhMXqN1oK/VDaX7LHBmdPMwCP2C4XSg==; 31:znIVFHGcDtONunFgSI7utWXrRmGUiikCfObrviEtXuz0zk4LQeVdmbnubtL0v0qFpDWOteFFFru6ag0iNFvYDNI3wqBOgeSVtStHQRVOqZHQEROfbO53andbjKN+MOEYQDy4rdFRKYncF1TBE6j2Vwpg5+N+ZxoLoX3OTlzGjXh/6J8FjmU2ILUJxRCDTSCcttZHZjyfjA8hMRfPxPT5PvqH75J6IURmTelulWQuvM0= X-MS-TrafficTypeDiagnostic: SN4PR0601MB3711: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0601MB3711; 20:BOhWEAtU4qsIDqCaf1jgKtm/tDYeQgMouqW6o4nPmDDdb7I+e8ueWFN6qgi1a2UUXq8D+xu22gxFh0d+IUp0GXEjXuLzv0WE+a/KTK+SfT+STNVv/eqoVQXZB2MBamf08Apra6mmnxm2czbHf4cEMRQGFw3QkbyLEYgmqO9E3XV8Kf6D7DuEZrJ4NzmfYq6r8NyxniwP2JMizSj0wxjjvVvYrynWJgoHavqs9hMsAY8SezU+S/Xyodur0Pu8JC23WN413cEl3MjFKhQW/7FEIK10IbCU3Bez7NvkpHd1Hjz2Vg+hZeVp/zwWqDMIxN6LvluuVXODv/cZu5vwyKua/pTFCX1wZzz9FF5wL+C9HSGV8WSUwvvINqqP75f4OTL/fzFkzSD5+LCbujSLESYOE7IT60Nw6yHCKtPu3Fd2hjcde4OWy6CsbgYM+h+Kp3vp2Be+Y8OT/ZFx5liOqR+7+1rhVKdQdg4o5jzWKdj+7IlackxG+uovfyJbrQFYaDPM; 4:y8FzNnfm2cwlR/uVVyDI2tXyGcccP3eCk4YBYP8V8IiSGyFDZ3ltVEo3B8IAhb7AZM+k7Jfqsl0LgD3r8NaIAI3AYCw3u4Dw+ybOfoiKZ3dRlaJheBbVhyVpm6hzyQYdKHlLg1qGR8O2i2oe31Dr1XpRIxA9bp7ZgyEyR7cMfM5wv15yYeTjivUeI0H2SP1YIRW/ZVVAKNGKaIyVtnIKEPTrvAnALuWrYpAVMeEXi1lmHYOs/1dlQRzdUCM40yI2Uej/qvetZSjKaXLq5HU4OQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN4PR0601MB3711; BCL:0; PCL:0; RULEID:; SRVR:SN4PR0601MB3711; X-Forefront-PRVS: 0750463DC9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(346002)(39850400004)(396003)(376002)(366004)(199004)(189003)(8936002)(486006)(68736007)(97736004)(5660300001)(3846002)(6116002)(25786009)(386003)(66066001)(47776003)(1857600001)(8676002)(7736002)(86362001)(305945005)(81166006)(53936002)(81156014)(36756003)(105586002)(26005)(478600001)(21086003)(16526019)(2906002)(106356001)(2870700001)(50226002)(7696005)(23676004)(186003)(107886003)(4326008)(1076002)(52116002)(50466002)(55016002)(476003)(316002)(54906003)(2616005)(956004)(69596002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN4PR0601MB3711; H:impinj.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0601MB3711; 23:XruqDCf6DXtxuwiO4SHTUI1vNGOb5l6s/28tPBK?= uokYkPzVPYKBkXxi87LyzYdhRMmtDRfasfg/3Vu5T/JHvJIGEqcI+gM4pdIq1VCrLAov3m4TOaKaKGPRi8N8U0c5a+744NfWw42Ubvj3u9s0nl/JBh1jr5yf/OgVQqvz/54ysCIlQfVPb+cpiQcJyKAGqkmeUkhLmRm0kuN19wBO22oPk0M31YlwPdSySh4n+7ruzFk04mY7IiRV16yie2J764Po8m3tBnuWKFU1l/gnZ4EEmM/9c5rnU/tEcKkA8Jf+oFGawaa9rfH7dLObkyhW8e+G9U6EFh7I3mf6yREnKe8GRPDp+tZTan9jwfpV/1wqM6t5Duu4ojJPL4YCCMfc3jzVnBtLofQI6uE9rK9FWdTIQJige+btTd2cfONJtwUJtBBmRtEAzaQpB4Zk4EpN4HwAn402IwCwujOByXI7b3UtWK/Fh+Ti8laiHvhKiyIDAL6Md22U6WwhetfngVg8AObqLaZQ7LtHuX408LLfwXpEjBT0kXfWi5mI3d63GIfWgy3EnOkAlm/c0S/h4sL5AB8WsSFxXivFT9kuL5Un2SDOg1XQqUpy1nFmv0jyv8maAxclEACaXkd3YTBYk5ujZ+ij6oPvkS30zKFELVALOBwABqsMPKyfelPr1+QWwouMyiy5n6cwD1F7UcO9PZaLeLCmYCHj76OI8QHWODki4SoUbJ3Av0qZuEJ5XvCg1Mp5OP9cL079kT4M/Q2l2VaiZgzRCP2DtXmTSnSUjEiDdPu6/s4Loo1vX8n5HvQqNdjG/3E8S5LYM1N0g453Rf5Chxj/bRG9OoJguqOuzhBontFwIu3mAYWIuT8makte/ybpbBGvUbLtdnDOi9UxQy4x2sXe1fMmTsjjsKHcL8L7lvVxpGORQOab2STUrXOlt7i+bH3d82YfsZEsh2ShfKVDHxTonHcwzdgab37ozY9DVHWxmFccxk9o7vUKLA7Flj4ipUCfn1ZPNHQe0qZr9D6dpAW+Fzu4TMqEI+b7nN2CQ4LPjbgXI30Th7UEjefJiNp3aETptWQWCpKNPMKp5bkB0CpIEkkKJFZVeWjXep+faGR5A5EfSIfzcbOB+OnISQMN/McPTpRgJU2agsPjIE+a2MT8BPsxWz5o0USDGzQOKiw== X-Microsoft-Antispam-Message-Info: mP3qYEA5mS51QYiScEUlM5JgxJPeMIMedqO1ppR3hldDle92sadhkBBdL3+gmXnpmSjGVyWOtHxuH6Vd2/n/qDZQElnOTR1kx7j8iEvI87r+jArrkLG5j1/HNH1+LAODWLBEuPg/u3j8qg2S4awbKIZB1s1U+GMdlzz3Tcwt2oPRuNl34wfikOGdBBiSvfLRgQ5FONj0rrj7tW7emlFJYAdHR98qZKrlH/WRHRKnotiJeD3oeCAmCCtlhSrC2cS9y/l6G8NnviSE1PT27BdAgPR07ai770396yozdl86kAMHjdHVTOQURO6GC+zklx74CO/K55XIaKdghQ6YIRNePlLsgx5d5/25gTcb8asATks= X-Microsoft-Exchange-Diagnostics: 1; SN4PR0601MB3711; 6:6J2EzpfHKyWONBR7wDg0t/9H7puv1lTrHE9QNiYV8+L7CW9rzXUoimI7akxa6fl1euPgqqIKg1/6ixRDUlNogjUnrJv1/mQTHQZh9Nc4gC6FkspNRv0SQp9B5ibWtQn2VACKzFNLevb+zKwodVltPZo6WHfugUuZhxhRFhTOCs14SjoltATFEi8YXpHYG43yuhvIJ5e5QRaIHvRTgXiu/oyS+NApRTvafeR2MVQ2+I68DU+pG7bboF79zh9CF3m78Pg46Wo7ulhTef+U8GGRlyYW7AypO81mZQwSaMwK/BAu4G99dvAA7zSJGsMfD8apiWCvCcV0SGuCWf7oPbLcMvIolQx12cCjeDrk4aPAiIaib15Y1jDsp7fjusA0edqLGT7v8RWKnB0EcZwn/fPZvlnpL4EP1NuAux+D5QVHtvNnEQjXMDvA6OG1/yKwK6AJ9l7c4h0iu+n1q3smY52EkA==; 5:xqiHSK3pDFMZg/nh+aAY3Aylgx02xsZh5oHWto9BJOZ+pylL+KIhz/982c9YkkdiF+CpDqCUuMKLyDneLHhm6nGQwqoBpGcgc7yJyI3kmh0j3Ybsg/1i56fvySoJpdBrGb/NOCNqYO3e0G2q/b6D2y5hAq8oI1DJtR2ftsw1ISM=; 7:X1PUoVlmk92D5ZxvUI60//OapBBE290QnC5QzcM2NUccx2i8AwnM+uxSQPmPrd9799Oufmg+1hn4LQWYYmbbyhQ/15j2vGtw00TzbFlZ0nTFP08vGbOZHKzD4J4Y1pX/OHVj9fX0nbjSFDmuj+gfmFFyGsURE0k3INGnvYG7dU24e95Vci6moGZr9WwHbwCHk2sEKo2Zf24dx5+Ocrvv/mnry7q3+KCYu3vX/KutL7W6frBdu52uO1gDAnYyPYqt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2018 20:11:50.8375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79729a86-47ca-4007-20e0-08d5f721da68 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0601MB3711 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::731 Subject: [Qemu-devel] [PATCH] imx_spi: Unset XCH when TX FIFO becomes empty 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: , X-Patchwork-Original-From: Trent Piepho via Qemu-devel From: "Zhijian Li (Fujitsu)\" via" Reply-To: Trent Piepho Cc: Peter Chubb , Trent Piepho Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current emulation will clear the XCH bit when a burst finishes. This is not quite correct. According to the i.MX7d referemce manual, Rev 0.1, ยง10.1.7.3: This bit [XCH] is cleared automatically when all data in the TXFIFO and the shift register has been shifted out. So XCH should be cleared when the FIFO empties, not on completion of a burst. The FIFO is 64 x 32 bits = 2048 bits, while the max burst size is larger at 4096 bits. So it's possible that the burst is not finished after the TXFIFO empties. Sending a large block (> 2048 bits) with the Linux driver will use a burst that is larger than the TXFIFO. After the TXFIFO has emptied XCH does not become unset, as the burst is not yet finished. What should happen after the TXFIFO empties is the driver will refill it and set XCH. The rising edge of XCH will trigger another transfer to begin. However, since the emulation does not set XCH to 0, there is no rising edge and the next trasfer never begins. Signed-off-by: Trent Piepho --- hw/ssi/imx_spi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index b66505ca49..02c38c9e47 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -208,8 +208,6 @@ static void imx_spi_flush_txfifo(IMXSPIState *s) } if (s->burst_length <= 0) { - s->regs[ECSPI_CONREG] &= ~ECSPI_CONREG_XCH; - if (!imx_spi_is_multiple_master_burst(s)) { s->regs[ECSPI_STATREG] |= ECSPI_STATREG_TC; break; @@ -219,6 +217,7 @@ static void imx_spi_flush_txfifo(IMXSPIState *s) if (fifo32_is_empty(&s->tx_fifo)) { s->regs[ECSPI_STATREG] |= ECSPI_STATREG_TC; + s->regs[ECSPI_CONREG] &= ~ECSPI_CONREG_XCH; } /* TODO: We should also use TDR and RDR bits */