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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60C9EC433EF for ; Tue, 17 May 2022 08:42:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D38D684251; Tue, 17 May 2022 10:41:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="y9gNtb93"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1400684251; Tue, 17 May 2022 10:41:37 +0200 (CEST) Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4D73B803C8 for ; Tue, 17 May 2022 10:41:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pf1-x436.google.com with SMTP id a11so16305526pff.1 for ; Tue, 17 May 2022 01:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ftRS6sABEF18umKxouEcDVZmKQT8KqlcdX0YAWKIioo=; b=y9gNtb93YTf+xwb3duHUVtQv59q1BbgmM49gC9yv/huA4349FxNJ7WCvEXfPWrQfah kNJN/XTpl1wzmDoW5ZdlLKIpyDrDNRXE01KzYlsLOuJOAuF1ift7YMXmaio2vOjcyykt yeHJw+7btNdNRZc7dKKvTnSlK2uQ/hF361qqRHa49KdV40XBIgbDx+x6uVOxH6QfivS7 A2lb47bNMqkjIXqagcC+cBz8v1QnKShnfMOU9hWVrdb3fbRWcL+H89Geb7a7J8rBfohy /NSidRmGGEtHu3M0S7SRxhjDV0+owfVs90ZH1P6iNZaUI5wOhCkOgSTp5NUXg8GEsU7m cQpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ftRS6sABEF18umKxouEcDVZmKQT8KqlcdX0YAWKIioo=; b=h1GddLz+6IB5XdNC/y6j9SZqIDrrghlMwcjxwEsFWoCNSZsd+vUk29EmjHbT+eu+1L PAlWxQBmxk2vsr0AekzSMoDd25skQf4O1lrkjBJoPFgF75JMH8lJRjIf/DE5b8MhXFG6 EYexpiQz7JJ94GvIr9OsLPvmGDbPYDFJA1/QShpHqOV8IrpccfB4xKTD4RaUADJtwk5Q FYBmmbsI/9fGH9Vo2p7ATR1wKTUA7D6h6gybzgtVvlilYxVgrzHk22K2FAsWB6VN+5t5 +WHjQ0D+hanpVxLSnNhII73Ln/3ErfgOj4k2R803opKMxGpYL5qlh6Oq7YyYa/6gRWG1 CqfQ== X-Gm-Message-State: AOAM531Mt8wfeiK5vrpEl9IVsahk046cBqaWtBxiBNc3hXN/wKn2uaWV 2jK98y4VcIP507di9rpEjyg9narPkAfjJw== X-Google-Smtp-Source: ABdhPJwBJJENvmbvIjUVJpj84/a3Qru/J+JCPD6vBbc9zLF+FgoLyiC+vlfrNIiEW1qEuPfc1N/aUA== X-Received: by 2002:a05:6a00:10d0:b0:4f7:5af4:47b6 with SMTP id d16-20020a056a0010d000b004f75af447b6mr21453162pfu.6.1652776890559; Tue, 17 May 2022 01:41:30 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id s200-20020a632cd1000000b003f5912ba179sm741569pgs.58.2022.05.17.01.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:30 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Jassi Brar , Satoru Okamoto , Masahisa Kojima , Jagan Teki Subject: [PATCH 2/4] spi: synquacer: wait until slave is deselected Date: Tue, 17 May 2022 17:41:37 +0900 Message-Id: <20220517084139.6986-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517084139.6986-1-masahisa.kojima@linaro.org> References: <20220517084139.6986-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean synquacer_cs_set() function does not wait the chip select is deasserted when the driver sets the DMSTOP to deselect the slave. This commit checks the Slave Select Released(SRS) bit to wait until the slave is deselected. Signed-off-by: Masahisa Kojima Signed-off-by: Satoru Okamoto --- drivers/spi/spi-synquacer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index 62f85f0335..f1422cf893 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -46,7 +46,9 @@ #define RXE 0x24 #define RXC 0x28 #define TFLETE 4 +#define TSSRS 6 #define RFMTE 5 +#define RSSRS 6 #define FAULTF 0x2c #define FAULTC 0x30 @@ -170,6 +172,11 @@ static void synquacer_cs_set(struct synquacer_spi_priv *priv, bool active) priv->rx_words = 16; read_fifo(priv); } + + /* wait until slave is deselected */ + while (!(readl(priv->base + TXF) & BIT(TSSRS)) || + !(readl(priv->base + RXF) & BIT(RSSRS))) + ; } } -- 2.17.1