From patchwork Tue May 17 08:41:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 573443 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp200253mab; Tue, 17 May 2022 01:41:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtoXhqMN79Eg8WJoBJJOf5NeKmDwLK1ac2ZLSRWw0+pAb+aYUhf8ED+ib4XJV9IPRU4t5V X-Received: by 2002:a17:907:16a9:b0:6f4:f0f6:3f35 with SMTP id hc41-20020a17090716a900b006f4f0f63f35mr19082111ejc.683.1652776910800; Tue, 17 May 2022 01:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652776910; cv=none; d=google.com; s=arc-20160816; b=X8Cl70H4/Y5XQuVwww8v9UTB+oMyQACL6B612c5vhWElkZn3/GNPeQ0azGtBpN6bUa KybLxHgIp7cu1ur6vg4PVqpNOEEpobumRiaY4x0SbiF7X4zVn4pS5tj00WizpfoeR00q zOQh6AaskJ5sm9hqpJGQ73kpsyIFsskaq01Sl+/5+rw6xD+p9tzq9WS4Ir7k4fm03Kz9 t3uYE8H1UDuX1C1vjl0nPBnXCximGEpCTGAPCvG+KlzQG1TWIzUDRV6To5nT0cqdUsV4 9RheFRolHEtVcuPP02zJxKF/xADBlqQxYSMqVxiDln9RvBZCwP8kfoTtW23QGd4B0U3X wn0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=pJfx7e+okUIDSW8hZDJ586IQ1VGzh18BIIdwmE6tJmU=; b=o1CJkNdChivJUwkjcT760zMWFaZZTua9U+/DUkNuCdm/p/fqgmCfKXOCUQzwpbrjnW vRLQzRlIZzzaybIsXhsOobUroZTqnInM7fQVOGQPWlqd23m4r0cL+jQWamA0xIYyZ6Gr f5xcLKmdukNY2NWezITe2K2w2A8sr1h11G9jlJ2YkRpYwbcVU6ZL2XlSVymbIB9tVimN UO2T5kvjDJv174iK0LmBuUWWcKkHeTcwXnroaRSzkX6y9P5No1T7fnTjqWh94O50nn4j dLzRWpJlLEtkeoszjavSb5h/oaRVjDTqYemY5B/x7B4w980GNVU5KCpGb7woA5DVAvR9 FCZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rxBBlHSD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id sb2-20020a1709076d8200b006e840aa94e9si2220734ejc.305.2022.05.17.01.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rxBBlHSD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7FE4584262; Tue, 17 May 2022 10:41:42 +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="rxBBlHSD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31BFE8421D; Tue, 17 May 2022 10:41:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 4088383B1E for ; Tue, 17 May 2022 10:41:30 +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-pj1-x1029.google.com with SMTP id f10so4838699pjs.3 for ; Tue, 17 May 2022 01:41:30 -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=pJfx7e+okUIDSW8hZDJ586IQ1VGzh18BIIdwmE6tJmU=; b=rxBBlHSDWXTy2rhIH3vxYqHjAey6BcvL8RHQuZePtx/214CgY44ci9Cy0C/cck8gpc EFby9ceEzjhKN8ao/2HlG3fjO2vnIEkLwioLGjCOfqeEl4BaGXd/DN+nTivQsI/e25IT YevMiVhgihUcdwvcOTnSYuHmbj9x3mykxN8jtHpaKzfSy9Y45HL3lelm47JYDOvC65Ge jiZ9TimOo1p2bWiluRWzmURUHESf1Wi0AhTQiYT/V8Rf1rP0qudHUZW82tkpZJNJaiNv L/ge3ptPuWi+TKOnp9CnN9Np4LhO444RAFMz4TUc2Dn5qFNehA8zLW19n8zun7MVchGC trAQ== 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=pJfx7e+okUIDSW8hZDJ586IQ1VGzh18BIIdwmE6tJmU=; b=HQw+r6VYWhVTKwV5JkPXGPPm9siedMoQ+PMvz051WwbE5IbZcq2hAMJOHo1k9RCPRM UmYlmsieNIGHrnSrpXRRa5QsJtFXwY7gDUt7roIkB7+TOTjhfsYg2V8AelrMsz97VMJw gJcMSCsCoX5HYMr4zo54/sQG+Giq4neKxMy16aaAe9RKiqp7saaXTWqjHDWhyOhm2Yq/ KL7AvAf0ytqvw0yC/ONxFB80xkT1RLfte9whgKQ5vGc8l9u7ahyPHyK23T5aBGT/O29b IMo6Hqx3uP3QikNIKypRal6dIRKDpJyIMRUIjHoD1Ezq5zu+rEOnRUzKDal5zaeGLLRE l7Ng== X-Gm-Message-State: AOAM5327FOj1E0pwxD7PuPpy9Jnvwg9//n7bz/vtYm2kzYXkBzD+6+j1 mQEeKANjkdjb7kIfqJTiT9RR+8QjV4603A== X-Received: by 2002:a17:903:2cf:b0:151:a932:f1f0 with SMTP id s15-20020a17090302cf00b00151a932f1f0mr21568499plk.130.1652776888586; Tue, 17 May 2022 01:41:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:28 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Jassi Brar , Satoru Okamoto , Masahisa Kojima , Jagan Teki Subject: [PATCH 1/4] spi: synquacer: busy variable must be initialized before use Date: Tue, 17 May 2022 17:41:36 +0900 Message-Id: <20220517084139.6986-2-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 "busy" variable is ORed without being initialized, must be zeroed before use. Signed-off-by: Masahisa Kojima Signed-off-by: Satoru Okamoto Acked-by: Jassi Brar --- drivers/spi/spi-synquacer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index ce558c4bc0..62f85f0335 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -275,7 +275,7 @@ static int synquacer_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev->parent; struct synquacer_spi_priv *priv = dev_get_priv(bus); - u32 val, words, busy; + u32 val, words, busy = 0; val = readl(priv->base + FIFOCFG); val |= (1 << RX_FLUSH); From patchwork Tue May 17 08:41:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 573444 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp200355mab; Tue, 17 May 2022 01:42:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHJwDYQcW4tpQHdulZn1ThBXBYNPzzXIdRZJGgfcEqxT9AEVa8/PAFh5xrXumq86cOkP+6 X-Received: by 2002:a17:907:c2a:b0:6f4:4b49:9cfb with SMTP id ga42-20020a1709070c2a00b006f44b499cfbmr18253739ejc.697.1652776920886; Tue, 17 May 2022 01:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652776920; cv=none; d=google.com; s=arc-20160816; b=qY7xntDVynjHStSVnyOBtmTzw57Bq/wYte9/85poOHR+GVnYwDoloV4s7WxaYa9+t3 sprPXiW+GNuagFeOKPUKmx27Lwh/jSPtzHt6bQiodk6D3UsuqMhS5CGU+IL9QjcIgSjF puThxpNFtdyUFH4xUkyZBYq5jz8oFS6aV7iQI/eX5Z5e1CVM/a8x0hc8HJRaAWbU4SnV dGiDeIFKK3q7z7Qusl0+v+rukjDkPBSLVs6MWlgkzT67E5AaEpxZ2LBnPqxvyRw8rCEH QvgFz59kzAMhsPIsrVOLmK+Yk8B0rWt8Z7kI+jPuOL0tYpGs8cGfnqlgAQ9bCwECw9Rr HnLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ftRS6sABEF18umKxouEcDVZmKQT8KqlcdX0YAWKIioo=; b=mijMWPg4bFOxXJ1MNdg/yycTtfHesTwR0pkNqArzxcUapq4hR91hF2UoOY/l9BnyVC 8s6MnvxsoKSQ9P1Q3fjUSVfjOVgsLuBjVpcgc1ayk+uaq5Ed5I9/gHa5OWGekbiQ8o1K iKCAOyDtApPeZXJ8NOsGymPUesgrPxBRdJEZKgVrH/J2NQWrvGfRSmzLzJMaqF/t7D0P EDysMObfU7MmCPTiLaB/bnBTQuILzbS53ZSjnffqigJdE2jAz7toeAzU2gsMrrUBEfEH xSwfI9Nfvtbx+QFU+LNlF2lHVExHud8mMn8AARw98KWZZTcc2oP1Z2m1/inT7SrXH3+6 16Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y9gNtb93; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id pw11-20020a17090720ab00b006df76385bf9si1733479ejb.153.2022.05.17.01.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:42:00 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y9gNtb93; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 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-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 Acked-by: Jassi Brar --- 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))) + ; } } From patchwork Tue May 17 08:41:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 573445 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp200512mab; Tue, 17 May 2022 01:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc0Do+3YflFPmBcj8XX1wAuGFHCOXRxv89Z3o7+4O8Jx7qwA/3gEit9pJfCtCSkFRmQUlk X-Received: by 2002:a17:906:4fd1:b0:6f3:be23:7ad5 with SMTP id i17-20020a1709064fd100b006f3be237ad5mr19003212ejw.264.1652776933419; Tue, 17 May 2022 01:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652776933; cv=none; d=google.com; s=arc-20160816; b=C2QgwlCLPKXtekIqA/dnYu7QGTvKSuBqIOAlVMbfxYo3WxBlC7KIsuIwzBBYXnW4lL MDxcc8sECYOLlxeoiXKEfDLsnbVvdkUzhNqDAC/JrayhKsTL64dAMR6GPENrdzmUaDYx up6BGjxbyeyxlBBf/UeBeEojWD2M6c1T8ztBJL6NDIFpbgvQFIbEuChDxN8R3ntcE8gT X1nCzMFWIPP1BGR042eW463LLkcVcnH6O3lUDQ79DwrUHNbw8B5HdZrfNPolGGN385Aj EpFCav4rredCA40JV/uCb5OxPvCLx0OAQp3CmbaZXaIL5H7YuzWhmQvpVcKGwD5z+DoK atSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+VJkz3r+HT0aPk4dOt6gTTKx498b4iUa89FhychMvAE=; b=RgmTkCi8J/OlEnI5id+KUyNsFeV0ZYxsQNhzTW3BxmbB4h/8x/WMwhHVk6iSVVUXJG Pcw2LK/MqykhwdtcBW5YVUBfZ76FAsOk4uYV0pWoZQ3j7RVqs4/PL5/+34sFXUr4cPXI RQtRv4+DQJgMNNJ5zmQ7PP/I/fn3DdgEbmX4s6gfhzX5kjp9ENzLYfXN/eUst3XC8zSK 7yIY0M0W6DefIg4fwmnMRLrGRkUMLguUvbocry1pNIR8P6oVF2weunTllmxHvf43nUXl hXQarOF3kfwUf3xM9oLLFu01C9WMNB7nZfIzac6MMbumEtTj6yrkig1F2WVAyC+LMNKp V9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMcIXeRk; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f13-20020a0564021e8d00b00427db9c8ee3si14907984edf.283.2022.05.17.01.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMcIXeRk; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D2A258426A; Tue, 17 May 2022 10:41:54 +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="PMcIXeRk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26D1F803C8; Tue, 17 May 2022 10:41:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 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 296448421F for ; Tue, 17 May 2022 10:41:33 +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:33 -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=+VJkz3r+HT0aPk4dOt6gTTKx498b4iUa89FhychMvAE=; b=PMcIXeRkpNWnlYa/LsJFvU2QdinGUdJ3Bcr+IaVWG1zQdw1zyhrVYgkpVxHo+6VXC2 gwpX8bLJWXi+hR9ucDb6FmMEsd98EvyJJwlsxXVtdAJypyVb1uFms62Wk/e+ToeoiX/6 V76/cQsZ5eZBluS42LPHzhXkwqgvGMVfwvVTOWE6z+KEAQ8vK0gNl2Qbv9/y/HDMAkRP uEruylMRXQxsUllh6G6NZB2sEneuR+bbACTTOkdHrK0FVssdpRc2k1Lx1AoL5wewarZl BbiVBtgMxr83Of2sXydC+PxxevAQgVh40KibCOSmby7WkPJd9ST5QZvOGJyOZhKlmWGy j+Rg== 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=+VJkz3r+HT0aPk4dOt6gTTKx498b4iUa89FhychMvAE=; b=vgRCnNQ43MQ9ruYKtN48iDsLCYler+y+pnQPNxt9ayehOhMfDJ7kRhF5Ie8WBjTNLt fdwrBOVQC244t/opi/ik6+gBIhxsZWPo6dJZaHvWwWSIjejah8mFV++8dg5ZscztF11Z br9fBWI1qQKVYMKc5QfZ0LL81X5CzWV1R3y0LPUnEYFWUuGBZGVs39ytNjgEJz2rsUVa MtAfQaQIskqMR815FzNoq3aqDj1feDokvBVbUosE/k47KO3U2TwiWVonzQ7MpT7eMceR AC5BLl5PjhBSQJotS6MbeQoaz2ZgUj9iSgzOelZ0KuoMjTcX0K9U4xFqPF2hk+eRSknS Pj/w== X-Gm-Message-State: AOAM533/PA6gNEc+xCPnjxxYhzyCwXAZN3vbhoMu4fmvnqwFNqEHyPgJ V/3b62Nvb9sAop2EsRp116GZNx6u0jP9Lw== X-Received: by 2002:a63:1b62:0:b0:3f2:5438:e553 with SMTP id b34-20020a631b62000000b003f25438e553mr11083613pgm.4.1652776892467; Tue, 17 May 2022 01:41:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:32 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Jassi Brar , Satoru Okamoto , Masahisa Kojima , Jagan Teki Subject: [PATCH 3/4] spi: synquacer: DMSTART bit must not be set while transferring Date: Tue, 17 May 2022 17:41:38 +0900 Message-Id: <20220517084139.6986-4-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 DMSTART bit must not be set while there is active transfer. This commit sets the DMSTART bit only when the transfer begins. Signed-off-by: Masahisa Kojima Signed-off-by: Satoru Okamoto Acked-by: Jassi Brar --- drivers/spi/spi-synquacer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index f1422cf893..5e1b3aedc7 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -330,9 +330,11 @@ static int synquacer_spi_xfer(struct udevice *dev, unsigned int bitlen, writel(~0, priv->base + RXC); /* Trigger */ - val = readl(priv->base + DMSTART); - val |= BIT(TRIGGER); - writel(val, priv->base + DMSTART); + if (flags & SPI_XFER_BEGIN) { + val = readl(priv->base + DMSTART); + val |= BIT(TRIGGER); + writel(val, priv->base + DMSTART); + } while (busy & (BIT(RXBIT) | BIT(TXBIT))) { if (priv->rx_words) From patchwork Tue May 17 08:41:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 573446 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp200587mab; Tue, 17 May 2022 01:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWD6BJEWGNUeWGc7/wkca9C62umTXCn4tqDU2tHU2LdnqQOlg+sEy02fdC79GyV4YqlogI X-Received: by 2002:a05:6402:27cc:b0:427:b593:62ef with SMTP id c12-20020a05640227cc00b00427b59362efmr17497709ede.409.1652776944935; Tue, 17 May 2022 01:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652776944; cv=none; d=google.com; s=arc-20160816; b=WVb4xYmu2aC6dvY0hF/+CvBYjhh41yTuzVYR8vBfbmjcn3d7udmKCPFBXx+79fJBwC 2WK6wIKIaitxUCGTa8J3gglXHJCFJTFgJ6mLL3wM+jmBWrw+mBfNiWFybJ/t0LnTtcQE +w1Sv39ETUSVKiKpf90Z8DdkeUcZsm56EATKJwEicisiYZ2qPMxWRsap1y+sKSuPG/mP d3iqIMFPHZUKq6hjyogvXSVqcZNAl7YYjTRbtLPbsRLvDvURzkaGO9+EWhedf1z2+U/u LPY/v/rkeVGV1oikY7LJePhtdYDcjOnemoMrMHEITaAs5COn8it8MtDGO2byCx+RIQtw 4Vtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=q8ng/+QK76kvHk5r053qufQUfxO3HvugE1YbHgk2wUSUDgxAAHPIVS6mSJcoulJa4v K30T82Dw0xyFGKc2ege7E2xkCOK+EYX4RA9b9WU6ZKg2xl956xuSHMZdolZyTYiD7+7+ 7BpdiXdaWnHeIKuTxbYrPJsNXQZbHJFFt32/uXF0CAXuZ9U2Z2E0VvNaKePR28rZY8WQ ASzAFMoyMY9E0xZIiMZCpx43PoLgi0Thq0kCYIT0F1uUpQK4+VPJZMWlnmvxqLF0715t o9pCfKbHBSWWtTrEHYVMweOTzn2NFL/VbEIKBQOoDtTkNBui0BoiLQKqdsfXKlHNBMel gx6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+KYQHWv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id bx23-20020a170906a1d700b006ec0acfe30esi2065971ejb.877.2022.05.17.01.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+KYQHWv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D6D284278; Tue, 17 May 2022 10:41:59 +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="P+KYQHWv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ACA398425C; Tue, 17 May 2022 10:41:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (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 178048424F for ; Tue, 17 May 2022 10:41:36 +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-pg1-x52b.google.com with SMTP id 202so16337725pgc.9 for ; Tue, 17 May 2022 01:41:35 -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=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=P+KYQHWvD11p+Bc9Bt2VlmUIAzrFuRd1Fk1bEj0rVM+cQFT+xdTGATSykk+AqhyyqW bfOrCHLFuj4cFqfkrNWgLMsc9kjPwd2rLEK6915WHZ/xWa9MgnWFuvPnArJ6UP7Qos9J ZD9h3J0x2dyMG6XunsUZA0/SGPAw3pM24QSvyPQ62E+j6exWWmqtebqEmcQbabNGZzJ+ cjXYFtXfxyIhE6od1NKibqI32QTxRofoOSI05Fd6rkgrr1V7U0LNTCV8k/X3xfk952In Zsh2FelbRUk36MKkcCQ7lIQpMd+u+nwK8ZZ0DcVnjbr9vNJl7RvpgvpL3jb0cY/o4jjH cmlQ== 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=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=0IhnB9l8TQ/Cmrt4tVNoAcgDJFfNQqscAoM+GTeJwYLh/4DQCYHnbstUrllay8L7wK edMTe+BJO09nKf+eyNpj2uu1ZU/Ec4ut30iEUPzbTIYwakViYdCpLsNjtMcut9JBWjkO MuZtMvmCM14Rz4BUFDAWbCUPjDAt8zET4HvMT9Ht3X6ZLHbIka3CBgW7UwiuV5ct5vMI gjaxPDJwwyVHjz8MavbZvlFYZB/4P7X9IUQ6UjRP/6tLKObuMpeEeqLKQfkFg17eVCum s+OdI+zPO9yU2YFo4DzVqCwAs4npWsAnsi4/gPzf4R+w54tSfjzmkA7nuuv0KZaKpgEO jH0g== X-Gm-Message-State: AOAM532oqGQnF5w7YytCVLdTXYuMOOUKBiTt77tRuCsL5sziPvzCpM9U ltb170TPN+u7CxtrL/iPLNi0PP/yo2zHhg== X-Received: by 2002:a65:4685:0:b0:3da:eb4e:61ed with SMTP id h5-20020a654685000000b003daeb4e61edmr18216203pgr.591.1652776894358; Tue, 17 May 2022 01:41:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:34 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Jassi Brar , Satoru Okamoto , Masahisa Kojima , Jagan Teki Subject: [PATCH 4/4] spi: synquacer: simplify tx completion checking Date: Tue, 17 May 2022 17:41:39 +0900 Message-Id: <20220517084139.6986-5-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 There is a TX-FIFO and Shift Register empty(TFES) status bit in spi controller. This commit checks the TFES bit to wait the TX transfer completes. Signed-off-by: Masahisa Kojima Signed-off-by: Satoru Okamoto Acked-by: Jassi Brar --- drivers/spi/spi-synquacer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index 5e1b3aedc7..0cae3dfc77 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -45,6 +45,7 @@ #define RXF 0x20 #define RXE 0x24 #define RXC 0x28 +#define TFES 1 #define TFLETE 4 #define TSSRS 6 #define RFMTE 5 @@ -345,13 +346,10 @@ static int synquacer_spi_xfer(struct udevice *dev, unsigned int bitlen, if (priv->tx_words) { write_fifo(priv); } else { - u32 len; - - do { /* wait for shifter to empty out */ + /* wait for shifter to empty out */ + while (!(readl(priv->base + TXF) & BIT(TFES))) cpu_relax(); - len = readl(priv->base + DMSTATUS); - len = (len >> TX_DATA_SHIFT) & TX_DATA_MASK; - } while (tx_buf && len); + busy &= ~BIT(TXBIT); } }