From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49072C433EF for ; Sun, 26 Sep 2021 02:51:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1FE460F93 for ; Sun, 26 Sep 2021 02:51:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E1FE460F93 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUKGZ-0003Pk-4t for qemu-devel@archiver.kernel.org; Sat, 25 Sep 2021 22:51:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUKEy-00022a-FQ; Sat, 25 Sep 2021 22:50:08 -0400 Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]:38454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUKEw-0003yj-Lu; Sat, 25 Sep 2021 22:50:08 -0400 Received: by mail-yb1-xb34.google.com with SMTP id m70so15154068ybm.5; Sat, 25 Sep 2021 19:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gLJzSmcBrxzcvSFv1Wv+eRpGhPdjDxJGqGXgezXLuBw=; b=CuzXqnAPxhzOZlsNv46HaiD2mSaM4Tjw8dPqHOeYZCzAbyQIyHG+niwgoipopri5a2 RgASbkCUXpRo7Ch8WtT9HVlhfUX0geZxb3JNlkROMRcavBkpg2mBq8ETRye5juE+R7bb 4P6bW/PzSupxon6mUcM3MafLvBcr4wtPd8giwW1oQkEHPaWGOPqMvYPGkl4xcQgRaCRV 5LICfw9ANBDwK5oHBxjbT2RRCfonEDn4uRWTJqy5Ri8cZuu8DqU9BJBkYOFKuktK8dFt iC39bR5g+z4pPUl5bHVDZ4cQ4ISG3vfjAJOsvKty94ZoUZQRy7gAQ3LxivdmnC95XArg odtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gLJzSmcBrxzcvSFv1Wv+eRpGhPdjDxJGqGXgezXLuBw=; b=hQx//Ojsgh0we7loVMvFf/uilsCcxWFhl2rRL6u9JXhbTCKhFnQTJzgGKuHzW6Xo86 o3LdyQYhyiAyrMf0H/sy+aFP2shPMXAdnJG3cRCugA3/AmqmNIdphHWlb6j4N+N6pS08 PGehDnRI0dBD7Wv8yDnUYfOqfusN02Zyu9J2kKcxxeZVm2xp/oI3pqgesdgdQF0jXvi+ 800zHSVEvnOMHXPApAhjcFOksrejL2ftsigQck42lRwoKDGsu8mJojwdRVSR6DpGZbqh BUhxi9bKTrFfT56ggzoS0Fm4F0p9LXbAQ357ueGm4VX5jLsZUV78LYxn+snpPPOnrxVi rkDg== X-Gm-Message-State: AOAM530CDYLzR1XkkOpKI45cP63aR3B5JTgCABwBtJaOOaz/VC0FjKBB RArzm4c4kuSEhbr0VjKljB5Kj0rCNKb56svCik0RRr8QhzM= X-Google-Smtp-Source: ABdhPJy9yM2Pm4C+GSdiXtx7Lzfl1cOaBs00e6bMP5y4GVcfNKY19lj846VG87qrPugw+PC4jYOKs+nvQGfdXahLUf4= X-Received: by 2002:a25:ad52:: with SMTP id l18mr20191653ybe.453.1632624604686; Sat, 25 Sep 2021 19:50:04 -0700 (PDT) MIME-Version: 1.0 References: <8b86d434-a2e6-8122-0a88-dc9a15fbfe87@roeck-us.net> <20210916142140.GA252836@roeck-us.net> <2cd83a88-952c-6f86-74b2-8c0da3ce4394@roeck-us.net> In-Reply-To: <2cd83a88-952c-6f86-74b2-8c0da3ce4394@roeck-us.net> From: Bin Meng Date: Sun, 26 Sep 2021 10:49:53 +0800 Message-ID: Subject: Re: [PATCH] hw/ssi: imx_spi: Improve chip select handling To: Guenter Roeck Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::b34; envelope-from=bmeng.cn@gmail.com; helo=mail-yb1-xb34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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 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: Peter Maydell , "Cheng, Xuzhou" , Alistair Francis , QEMU Developers , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= , qemu-arm , Jean-Christophe Dubois Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Sat, Sep 18, 2021 at 12:19 PM Guenter Roeck wrote: > > On 9/17/21 8:09 PM, Cheng, Xuzhou wrote: > >>> I got some free time in the past days to investigate this issue. Guenter is right, the Linux imx-spi driver does not work on QEMU. > >>> > >>> The reason is that the state of m25p80 machine loops in STATE_READING_DATA state after receiving RDSR command, the new command is ignored. Before sending a new command, the CS line should be pulled to high, this make the state of m25p80 back to IDLE. > >>> > >>> I have same point with Guenter, it's that set CS to 1 when burst is zero. But i don't think it is necessary to set CS to 0 in imx_spi_flush_txfifo(). I will send a new patch to fix this issue. > >>> > >> > >> Thanks a lot for looking into this. If you have a better solution than mine, by all means, please go for it. As I mentioned in my patch, I didn't really like it, but I was unable to find a better solution. > > I am doing some experiment to verify that the new patch is reasonable, so the new patch will be delayed few days. > > > > No problem. Note that I'll be traveling for the next 2-3 weeks, and I won't be able > to test any patches during that time. > I have some updates to share, as I have been working with Xuzhou internally on this issue for the past days: Current mods using BURST_LEN to determine the timing to pull up the CS line in the SPI controller codes is a workaround. Hardware does not do this. To understand what real hardware behavior is, Xuzhou used an oscilloscope to verify our guess. It turns out the root cause is elsewhere, and a proper fix will be sent out soon. Regards, Bin