Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp215852imn; Mon, 25 Jul 2022 14:22:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t+CzNW88Mr13omk3hFcX2rngcpcLsbij/5qz4rRV9HS0jtjguTCDiiU3HwrJZyYvF6QSqv X-Received: by 2002:a63:88c1:0:b0:419:9526:680 with SMTP id l184-20020a6388c1000000b0041995260680mr12971452pgd.130.1658784127027; Mon, 25 Jul 2022 14:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658784127; cv=none; d=google.com; s=arc-20160816; b=00nUsaJuGVVqNxW3QqRH7eY7xFFgdhpEjF/F9BjogH9Opo22gsb07KPkfrr8MZwjNN pNT8ABbpnnVcgXFoTBCWMo6fSHIh7p7oOdxqme0EomBZNMydxlTHSLYYr1QOrx0JmhE5 833yjrJYVTIW5XsHnddQyeohTSCUodsEdP9SfP+0NZ3vvEj6vGgtSj/O+At2TRrieQjy HYAWiYL2rTpL2GoIOdPYitH6bKvEW8HeJ6Y+7Ph3XTSxHy65/iO0/nMPDW/xJQ8HMcVN Tbv/x8hBMqb2gYMZ7+YGOLCvhH2SHR1mnIQ9rIp9AhUh7YJb+xxSXZNMXyijgVFTfXsa VROg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QqvdsUpFd0FhiEl1L7Kv/+kLkTRYSDXFR4lNBP9X1B4=; b=BH7JEXTiu1gVnJrzM/KabD9YC5oM2nfYvGSoILSa7mwfpSuzT5mDVVuL0ybS9cXQ7x P91/fbJoi5aLBCvKayMrwUmAqiMWS8pBT+nGu5pd/WKK2LgaOAPC+T9rc/7GX1Wkeh4T LoQQQp1ofA/Mmmzts8+H3Ey/QZdLoj40Hku/qv6sX8q31FysPXy2xtxm0hBHaGuGe7X8 t730VP5pA580/P7C+DFn8R2tXcIrU3pQP3cfKyzo8Z1xRh9zrn7mv9Er5US/+MhnAzfx KPTbxuypnXAE8Eu3pqO/HaZcKnum/2W4U5LaxVtshnCCOzHXLPqVtrBWzwJHNxTZ6Nfc iBKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm5-20020a17090b3ec500b001f06f142d0fsi20012754pjb.101.2022.07.25.14.21.52; Mon, 25 Jul 2022 14:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236716AbiGYVTx (ORCPT + 99 others); Mon, 25 Jul 2022 17:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiGYVTu (ORCPT ); Mon, 25 Jul 2022 17:19:50 -0400 X-Greylist: delayed 1800 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 25 Jul 2022 14:19:49 PDT Received: from wp175.webpack.hosteurope.de (wp175.webpack.hosteurope.de [IPv6:2a01:488:42:1000:50ed:84b6::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7412F23BCD for ; Mon, 25 Jul 2022 14:19:49 -0700 (PDT) Received: from p54bc6cd6.dip0.t-ipconnect.de ([84.188.108.214] helo=[192.168.1.245]); authenticated by wp175.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1oG4YN-0007hQ-Nw; Mon, 25 Jul 2022 22:19:47 +0200 Message-ID: Date: Mon, 25 Jul 2022 22:19:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH RFC v1] spi: realtek-rtl: Fix clearing some register bits Content-Language: en-US To: Martin Blumenstingl , linux-spi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bert@biot.com, sander@svanheule.net References: <20220725193547.1038414-1-martin.blumenstingl@googlemail.com> From: Birger Koblitz In-Reply-To: <20220725193547.1038414-1-martin.blumenstingl@googlemail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;mail@birger-koblitz.de;1658783989;bbd56df9; X-HE-SMSGID: 1oG4YN-0007hQ-Nw X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Martin, On 25/07/2022 21:35, Martin Blumenstingl wrote: > The code seemingly tries to clear RTL_SPI_SFCSR_LEN_MASK (before then > setting either RTL_SPI_SFCSR_LEN1 or RTL_SPI_SFCSR_LEN4) and > RTL_SPI_SFCSR_CS. What it actually does is only keeping these bits and > clearing all other bits, even the ones which were just set before. Fix > the operation to clear the bits in the selected mask and keep all other > ones. > > Fixes: a8af5cc2ff1e80 ("spi: realtek-rtl: Add support for Realtek RTL838x/RTL839x SPI controllers") > Signed-off-by: Martin Blumenstingl > --- > I stumbled across this while reading the driver. This patch is untested > because I don't have any hardware with this controller. I believe your fix is correct. In the meantime, more information has been learned about this hardware, in particular, newer SoC versions and the possibility to have parallel IO and hardware which uses different chip selects. I came up with the following patch for supporting this, and it achieves what you also propose: https://github.com/bkobl/openwrt/blob/rtl8214qf_merge/target/linux/realtek/patches-5.10/317-spi-cs-support-for-spi-realtek-rtl.patch It is still is a bit rough, reading it I immediately saw 2 things that would need to be fixed, but it also improves e.g. that RTL_SPI_SFCSR is now configured independently of what u-boot did to it. Cheers, Birger