Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4023655ybz; Tue, 28 Apr 2020 04:32:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKvx01N3PAqw6ZblRd/FjD3SazDIs0tlPOTdSG4WwKxIsyOQO9iL3OqZ/TRks+xuxVLcqMo X-Received: by 2002:a17:906:130e:: with SMTP id w14mr24493593ejb.155.1588073562144; Tue, 28 Apr 2020 04:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588073562; cv=none; d=google.com; s=arc-20160816; b=BWHzZYN1S9NeHkJRAor6IXA2KHxTag4ciYz/2/NjFZI/rHhuePGyp37cvrIChNfXaO cL3bVzCiTfhhHwKrYvUPqMWYEzpzIyDXglCluIpYAwvrCG6N8upvhf7AhHPZmec7ZJzb rUfXIgAMun6SJjFsM8ljAe/oPfdbdZMwRVe+sWWtj3HuVmy7o5CdHP7mia/MN5t6Urjl CfhK+rD/C6i/BTDBlMYnhRkBsVC8yl4ddcp4gqxQJSHzGNYqCPeEUxZPL675+2wl0bPz rN8c/VAdWyqUQmXcT0iC0Abs2SVCOgv1s0nl5QClwmDO6YBRn1TXPFek92fPCPQg65sA KMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:autocrypt :from:references:cc:to:subject; bh=FznsFEWrA0O3V6YQbsMufEfwiOXmx6Bblz/Z6FwJbTI=; b=nWR3/SJ5rf1KxROHzNLiySgp38Gq/4p3LOrtr+8PTsrJuV1XXTcDnVSTcR9iWXaK5Z OJwMVHd6y4JlLOHXWFShzNWwYzBOzXxbZfIyaPPgSqFnhSAuxVx3qqJEu1yfB9rFanNv bNIvyb5IfVb0ZNIRKFgHw5yNq/Qqhh6MVnLHbsjrBiIojRV/wSeN5DcewTBatxutzYzk UUj3jLVDBQlUU+zlDlPl+/+BsQPqZPNc3UtkgkDjrH3iBcP4hu5uRuZw7awPkcK7UG0D huzafEh8VPqj4HLej6Fl+cOcBpAgvF/7AKlkHbxZTCjRjqbe6z+qJp5/ztqQrb4x4dKz e66w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo2si1478202edb.438.2020.04.28.04.32.18; Tue, 28 Apr 2020 04:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726641AbgD1Lai (ORCPT + 99 others); Tue, 28 Apr 2020 07:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbgD1Lag (ORCPT ); Tue, 28 Apr 2020 07:30:36 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8605FC03C1A9; Tue, 28 Apr 2020 04:30:36 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 49BKFj5QXHzQl8k; Tue, 28 Apr 2020 13:30:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id Rtzl5PNe1z8p; Tue, 28 Apr 2020 13:30:27 +0200 (CEST) Subject: Re: [PATCH 1/4] spi: lantiq: Synchronize interrupt handlers and transfers To: Daniel Schwierzeck , Dilip Kota , broonie@kernel.org, robh@kernel.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, andriy.shevchenko@intel.com, cheol.yong.kim@intel.com, chuanhua.lei@linux.intel.com, qi-ming.wu@intel.com References: <3bf88d24b9cad9f3df1da8ed65bf55c05693b0f2.1587702428.git.eswara.kota@linux.intel.com> <310ca761-e7ae-1192-99fd-a1960697806b@gmail.com> From: Hauke Mehrtens Autocrypt: addr=hauke@hauke-m.de; keydata= mQINBFtLdKcBEADFOTNUys8TnhpEdE5e1wO1vC+a62dPtuZgxYG83+9iVpsAyaSrCGGz5tmu BgkEMZVK9YogfMyVHFEcy0RqfO7gIYBYvFp0z32btJhjkjBm9hZ6eonjFnG9XmqDKg/aZI+u d9KGUh0DeaHT9FY96qdUsxIsdCodowf1eTNTJn+hdCudjLWjDf9FlBV0XKTN+ETY3pbPL2yi h8Uem7tC3pmU7oN7Z0OpKev5E2hLhhx+Lpcro4ikeclxdAg7g3XZWQLqfvKsjiOJsCWNXpy7 hhru9PQE8oNFgSNzzx2tMouhmXIlzEX4xFnJghprn+8EA/sCaczhdna+LVjICHxTO36ytOv7 L3q6xDxIkdF6vyeEtVm1OfRzfGSgKdrvxc+FRJjp3TIRPFqvYUADDPh5Az7xa1LRy3YcvKYx psDDKpJ8nCxNaYs6hqTbz4loHpv1hQLrPXFVpoFUApfvH/q7bb+eXVjRW1m2Ahvp7QipLEAK GbiV7uvALuIjnlVtfBZSxI+Xg7SBETxgK1YHxV7PhlzMdTIKY9GL0Rtl6CMir/zMFJkxTMeO 1P8wzt+WOvpxF9TixOhUtmfv0X7ay93HWOdddAzov7eCKp4Ju1ZQj8QqROqsc/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WMykP+HZSoqUKybsFlrX7q93ykkWNZKck7U7GFe/x CiaxvxyPg7vAuMLDOykqNZ1wJYzoQka1kJi6RmBFpDQUg7+/PS6lCFoEppWp7eUSSNPm8VFb jwa1D3MgS3+VSKOMmFWGRCY99bWnl2Zd2jfdETmBFNXA94mg2N2vI/THju79u1dR9gzpjH7R 3jmPvpEc2WCU5uJfaVoAEqh9kI2D7NlQCG80UkXDHGmcoHBnsiEZGjzm5zYOYinjTUeoy3F0 8aTZ+e/sj+r4VTOUB/b0jy+JPnxn23FktGIYnQ+lLsAkmcbcDwCop4V59weR2eqwBqedNRUX 5OTP93lUIhrRIy3cZT/A5nNcUeCYRS8bCRFKrQKEn92RFg== Message-ID: <262f2739-494a-a59b-f1e9-80a95ea465b1@hauke-m.de> Date: Tue, 28 Apr 2020 13:30:25 +0200 MIME-Version: 1.0 In-Reply-To: <310ca761-e7ae-1192-99fd-a1960697806b@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 983A3175F X-Rspamd-Score: -4.71 / 15.00 / 15.00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/28/20 1:10 PM, Daniel Schwierzeck wrote: > > > Am 24.04.20 um 12:42 schrieb Dilip Kota: >> Synchronize tx, rx and error interrupts by registering to the >> same interrupt handler. Interrupt handler will recognize and process >> the appropriate interrupt on the basis of interrupt status register. >> Also, establish synchronization between the interrupt handler and >> transfer operation by taking the locks and registering the interrupt >> handler as thread IRQ which avoids the bottom half. > > actually there is no real bottom half. Reading or writing the FIFOs is > fast and is therefore be done in hard IRQ context. But as the comment > for lantiq_ssc_bussy_work() state, the driver needs some busy-waiting > after the last interrupt. I don't think it's worth to replace this with > threaded interrupts which add more runtime overhead and likely decrease > the maximum transfer speed. > >> Fixes the wrongly populated interrupt register offsets too. >> >> Fixes: 17f84b793c01 ("spi: lantiq-ssc: add support for Lantiq SSC SPI controller") >> Fixes: ad2fca0721d1 ("spi: lantiq-ssc: add LTQ_ prefix to defines") >> Signed-off-by: Dilip Kota >> --- >> drivers/spi/spi-lantiq-ssc.c | 89 ++++++++++++++++++++++---------------------- >> 1 file changed, 45 insertions(+), 44 deletions(-) >> >> diff --git a/drivers/spi/spi-lantiq-ssc.c b/drivers/spi/spi-lantiq-ssc.c >> index 1fd7ee53d451..b67f5925bcb0 100644 >> --- a/drivers/spi/spi-lantiq-ssc.c >> +++ b/drivers/spi/spi-lantiq-ssc.c >> @@ -6,6 +6,7 @@ >> >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -13,7 +14,6 @@ >> #include >> #include >> #include >> -#include >> #include >> #include >> #include >> @@ -50,8 +50,8 @@ >> #define LTQ_SPI_RXCNT 0x84 >> #define LTQ_SPI_DMACON 0xec >> #define LTQ_SPI_IRNEN 0xf4 >> -#define LTQ_SPI_IRNICR 0xf8 >> -#define LTQ_SPI_IRNCR 0xfc >> +#define LTQ_SPI_IRNCR 0xf8 >> +#define LTQ_SPI_IRNICR 0xfc > > the values are matching the datasheets for Danube and VRX200 family. > AFAICS the registers have been swapped for some newer SoCs like GRX330 > or GRX550. It didn't matter until now because those registers were > unused by the driver. So if you want to use those registers, you have to > deal somehow with the register offset swap in struct lantiq_ssc_hwcfg. Hi, The Interrupt controller found on Danube till xrx300 which is probably from Infineon like this SPI controller IP acknowledges the interrupts also inside this SPI controller IP automatically, this has to be done manually on the xrx500 and probably also LGM as they use a different interrupt controller. I prepared patches for this internally 2.5 years ago but did not send them upstream because of internal processes. I would suggest to only do this ack on the newer platforms starting with the xrx500 and not on the older. On SMP systems a lock is needed in lantiq_ssc_xmit_interrupt() to protect against an other thread reading from the RX buffer or writing to the TX buffer in parallel. @Dilip. Did you try the patches I send you one months ago on the LGM? I would be helpful to split this patch into multiple like already suggest to make it easier to find the bugs. Hauke