From patchwork Thu May 11 23:13:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boerge Struempfel X-Patchwork-Id: 682326 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E26EC7EE22 for ; Thu, 11 May 2023 23:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239426AbjEKXO1 (ORCPT ); Thu, 11 May 2023 19:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239385AbjEKXO0 (ORCPT ); Thu, 11 May 2023 19:14:26 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A87D65BA5; Thu, 11 May 2023 16:14:18 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-959a3e2dd27so1649526966b.3; Thu, 11 May 2023 16:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683846857; x=1686438857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k1YaV1mLf8ta46NqCsJ+gUT1ajmBoG4/m5hmiu17DFk=; b=JW7oR2OyYZ62rFL5P9pzdR5DWFAgrbpzmJmlxoUBxtWRZOwPmOahMp5o43VaHDUlC4 pv2mkhlpxKEz7e0vvrVa5PICdu0vXUQVH4KIGVX/R10DkUsGhjESdrSlH4USgc2TADYZ 9SKUEboWvCPdVXNIsUzgiP8/Ks8xAvdEJLJGcXqpF2OYsNNwcPNWhdEFrpOQ9n8dtq8+ JE7sUgrjFL4lTvfjuWGtP8DGIOv1vO3GdXUl+qdOaUbcKJzPQkKieF4ub8t6tv8TP61Y dmpg5Uq6l3Il/z6HPcMxu3R4R0lGRY8s6X9Qm2ZTAOiuSn3I/ta9ZMuR2y9gcmBUmuVY Pitg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683846857; x=1686438857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k1YaV1mLf8ta46NqCsJ+gUT1ajmBoG4/m5hmiu17DFk=; b=XDH7+pCLGDjjacJv20rR7rCyI/H3RJvKF1hNsXZDzkd8E9wb0clJK9v3u0kMlpkOvb /pgxbjQzkQoCDy0Jm1Uv3FmOKbIMPH43EyvGd4TzVkzaDOx1vQKre9pEnqeGYGM1XjV2 xmQmXO904efQjRWqGqs4cQuTspetSTCGVBC7G/q2aeKE1voarCfabQ1mfhUOja36091Z GWJ7SiM5r6gr831XPctibl3cED6RKJRqzqsoDRiQzPABilWUtLkS8AerT9RU22tC1WHM 2oFWT/U+bPKa2eiDWKfGBXzUrmHSkg18C+SYGn+Lgpy6haEtLPu32trCizd6gataoq/v 2tsw== X-Gm-Message-State: AC+VfDzb2hAiAHwcRmh/Bv1W3q6pp6Likf24V9J1n0X48BtQNW9LaoEH fr53agzCeBeB+mSBvAVjSuw= X-Google-Smtp-Source: ACHHUZ4zTQ5dUIsmJG0DHK5HLv1IgcRBZF+6ZtK7r+B79fL4gxSiCG5zBaSBtGGy5N4YjlOXhR8GzQ== X-Received: by 2002:a17:907:a407:b0:96a:928c:d382 with SMTP id sg7-20020a170907a40700b0096a928cd382mr986215ejc.48.1683846856728; Thu, 11 May 2023 16:14:16 -0700 (PDT) Received: from wslxew193.fritz.box (p200300c7874f2f0049cdad3080524d03.dip0.t-ipconnect.de. [2003:c7:874f:2f00:49cd:ad30:8052:4d03]) by smtp.gmail.com with ESMTPSA id hx8-20020a170906846800b00965e839f56bsm4543023ejc.182.2023.05.11.16.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 16:14:16 -0700 (PDT) From: Boerge Struempfel X-Google-Original-From: Boerge Struempfel Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de, andy.shevchenko@gmail.com, Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] spi: dt-bindings: Introduce spi-mosi-idle-low flag Date: Fri, 12 May 2023 01:13:14 +0200 Message-Id: <20230511231317.158214-2-bstruempfel@ultratronik.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230511231317.158214-1-bstruempfel@ultratronik.de> References: <20230511135632.78344-1-bstruempfel@ultratronik.de> <20230511231317.158214-1-bstruempfel@ultratronik.de> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Some spi controller switch the mosi line to high, whenever they are idle. This may not be desired in all use cases. For example neopixel leds can get confused and flicker due to misinterpreting the idle state. Therefore, we introduce a new spi-mode bit, with which the idle behaviour can be overwritten on a per device basis. Signed-off-by: Boerge Struempfel --- .../devicetree/bindings/spi/spi-peripheral-props.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml index 782a014b63a76..46d5acc1fc232 100644 --- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml +++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml @@ -34,6 +34,12 @@ properties: description: The device requires the chip select active high. + spi-mosi-idle-low: + $ref: /schemas/types.yaml#/definitions/flag + description: + The device requires the mosi line to be low when idle and the + chip select is asserted. + spi-lsb-first: $ref: /schemas/types.yaml#/definitions/flag description: From patchwork Thu May 11 23:13:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boerge Struempfel X-Patchwork-Id: 681123 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89A7CC7EE25 for ; Thu, 11 May 2023 23:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239466AbjEKXO2 (ORCPT ); Thu, 11 May 2023 19:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239420AbjEKXO0 (ORCPT ); Thu, 11 May 2023 19:14:26 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8C059DC; Thu, 11 May 2023 16:14:20 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-965ab8ed1c0so1524186066b.2; Thu, 11 May 2023 16:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683846858; x=1686438858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=udZm9qn498R0QUgsicv7hzCtWJWxnPlcjDTKukuQ0jk=; b=KfGSMne2sEcVDFYwErj0jDzCKsz9TXKKJ164bQeaYd+FDzQ7iMPeK57IyWfgy/6mhr MibE3cZ9M1E992ODcvCyTI4XFgNAe6kZtdb/jB/TstA0gORlrhfWZxjJrvAXMhasKeOb i5wa7Aht/K+56NSJzrUwVEwKh3Gxx8x+VSDqeD9ZuHdhNjHTasUTYQe5YZ8uht4uUqfn SWKgjLr0/4xJC34u6UvPkBFzTyDK8mmpJnUKYXLnBC7d23NdZq+rr8bmejjfTTsroSjX T0+0ydAQRFJq5I5JmEHvkDOzAhi3Sb1ZUCu60Nd9k4lM2lDDoHDv2fMYUHleRF/gmOwr C9XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683846858; x=1686438858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=udZm9qn498R0QUgsicv7hzCtWJWxnPlcjDTKukuQ0jk=; b=aI0MwHi19jWDngRhY4h1O0gk/wxMGl3FNd9nCegZTC4rvYYmGpVAeWxr5W/APtO4Td BKuMkY1tF3C7G91f9W1NhtCxkqM1jZJLC1+PQ3o7OKlXdo9zADoIgNztqynJpz7QxFb7 jjjY6RVH9W+Q7bJZPyFiREr4Z++9aptn7X/UmJT4ieSQVOM/xUxawTngnCCTSFdDX6QY XyTEHn/gubmTrqkJxvNSY/hTVKBYRCa9LnTUJfF5FT5P2/HICOSxcst/Vdrx5Se1b83c F/YFdV4pw5/GTx7y/9OWNNtjNADcjvwrhhRqnDzTAgSd3DcRHevLIwaEQmpbg6LcJzZA xsEA== X-Gm-Message-State: AC+VfDzAJVjpw9Ypl8+3vHv0OJJUnzLxBFspUxaSi6ju37YKD8z9CM1T RXBDQctVkru+AWWCKCcGqvw= X-Google-Smtp-Source: ACHHUZ6iAlnfrRSk7IuQeZS4b2xJfCvQTlVbacLS+oD75KUuTXUpj3la1tjGEOnfgWLl7OJOEH22xA== X-Received: by 2002:a17:906:eec5:b0:953:4775:baa7 with SMTP id wu5-20020a170906eec500b009534775baa7mr22383355ejb.52.1683846858377; Thu, 11 May 2023 16:14:18 -0700 (PDT) Received: from wslxew193.fritz.box (p200300c7874f2f0049cdad3080524d03.dip0.t-ipconnect.de. [2003:c7:874f:2f00:49cd:ad30:8052:4d03]) by smtp.gmail.com with ESMTPSA id hx8-20020a170906846800b00965e839f56bsm4543023ejc.182.2023.05.11.16.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 16:14:17 -0700 (PDT) From: Boerge Struempfel X-Google-Original-From: Boerge Struempfel Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de, andy.shevchenko@gmail.com, Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] spi: add SPI_MOSI_IDLE_LOW mode bit Date: Fri, 12 May 2023 01:13:15 +0200 Message-Id: <20230511231317.158214-3-bstruempfel@ultratronik.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230511231317.158214-1-bstruempfel@ultratronik.de> References: <20230511135632.78344-1-bstruempfel@ultratronik.de> <20230511231317.158214-1-bstruempfel@ultratronik.de> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Some spi controller switch the mosi line to high, whenever they are idle. This may not be desired in all use cases. For example neopixel leds can get confused and flicker due to misinterpreting the idle state. Therefore, we introduce a new spi-mode bit, with which the idle behaviour can be overwritten on a per device basis. Signed-off-by: Boerge Struempfel --- drivers/spi/spi.c | 2 ++ include/uapi/linux/spi/spi.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9291b2a0e8871..3ad538b317a84 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2260,6 +2260,8 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, spi->mode |= SPI_LSB_FIRST; if (of_property_read_bool(nc, "spi-cs-high")) spi->mode |= SPI_CS_HIGH; + if (of_property_read_bool(nc, "spi-mosi-idle-low")) + spi->mode |= SPI_MOSI_IDLE_LOW; /* Device DUAL/QUAD mode */ if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) { diff --git a/include/uapi/linux/spi/spi.h b/include/uapi/linux/spi/spi.h index 9d5f580597039..ca56e477d1619 100644 --- a/include/uapi/linux/spi/spi.h +++ b/include/uapi/linux/spi/spi.h @@ -28,6 +28,7 @@ #define SPI_RX_OCTAL _BITUL(14) /* receive with 8 wires */ #define SPI_3WIRE_HIZ _BITUL(15) /* high impedance turnaround */ #define SPI_RX_CPHA_FLIP _BITUL(16) /* flip CPHA on Rx only xfer */ +#define SPI_MOSI_IDLE_LOW _BITUL(17) /* leave mosi line low when idle */ /* * All the bits defined above should be covered by SPI_MODE_USER_MASK. @@ -37,6 +38,6 @@ * These bits must not overlap. A static assert check should make sure of that. * If adding extra bits, make sure to increase the bit index below as well. */ -#define SPI_MODE_USER_MASK (_BITUL(17) - 1) +#define SPI_MODE_USER_MASK (_BITUL(18) - 1) #endif /* _UAPI_SPI_H */ From patchwork Thu May 11 23:13:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boerge Struempfel X-Patchwork-Id: 681122 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A32BFC7EE2E for ; Thu, 11 May 2023 23:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239329AbjEKXO3 (ORCPT ); Thu, 11 May 2023 19:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239256AbjEKXO1 (ORCPT ); Thu, 11 May 2023 19:14:27 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C824D5B8C; Thu, 11 May 2023 16:14:21 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-50bc1612940so16698031a12.2; Thu, 11 May 2023 16:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683846860; x=1686438860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b2VsN8atgMi+3hxkQqcD7Uds4tmy7HqZMS9gPdrmsb4=; b=pkuQKYnnCEdft/G+uiYZJ8uWi/2kTtLl0j2agga0xhMKI/ziSUNGiFld/hG/AgBZNZ BrtnO3GlFynmbRq/MkB1WyaYbe3/UAMmYb24ub6pp4SoxNtLs3bucSN5tdGxMFsrrloe QR0HzL7A60P6DHpR8rU53MTdtwbJJWMuATbIPgrMdwvxWSPDMzhaSn2TVhkqmuoR64Sc 4wv+4YD9oV6RzyFf5YjeJMOBmOR/ZZKRvEyYeXkjB4do9tkvFw8Tt4ymc00m8MAyULT9 CxrUWDTUDlQYlUa4Eq+G/afe+sNlpvUhFqvWWP78/zDbqPbM3d9AzfzuJxbU3/nS3tIz 1thw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683846860; x=1686438860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b2VsN8atgMi+3hxkQqcD7Uds4tmy7HqZMS9gPdrmsb4=; b=JkzvjXf2HowaTFlDH0Bro6D8FNNdoqBcSi9Hdr9wutIvJ/MIOut+ij/nnwHNTO7l0F rFUxouJZhIJcQ/9J9fdrSmh2kjP57TE7ILjyUbANUeUtzdh0j0l79JK0nQ8Jcw9gzx2T YiomCJWyYIyMXV7U8nNLvXyooYt6u80/YHATKXxAFCvLFktVMgZdnaSWR/GceOif9Bl0 3xfNbuGRTf42+f0u8JmfO1LRaiZmFRI/TGt4qVx/2WiD2vog/zoF8datYZvPCo5HmiBv ZTa1W9Yx1alTwxUDAd6A5hKAWbdT0TrKE+1pgDZvf5yMkf7GMGgE7COqaoR6zO3TtEdY A5OA== X-Gm-Message-State: AC+VfDy6n6W/xrK0d44wMkmkDDVJi5pUA78K/D3C5NNr8+S6pj0zzmdm ffc7/ZPKxFYR4GoA7EZP7COZExfBLF3uTQT5 X-Google-Smtp-Source: ACHHUZ77bHdjVSfvFyyDQR4vgqCTNKD6gRFnm6VieLTdykuJJ5rYhLVSHX8aHqbXliTmbb99aS9ZdQ== X-Received: by 2002:a17:907:31c9:b0:94f:6627:22b5 with SMTP id xf9-20020a17090731c900b0094f662722b5mr19742819ejb.47.1683846859987; Thu, 11 May 2023 16:14:19 -0700 (PDT) Received: from wslxew193.fritz.box (p200300c7874f2f0049cdad3080524d03.dip0.t-ipconnect.de. [2003:c7:874f:2f00:49cd:ad30:8052:4d03]) by smtp.gmail.com with ESMTPSA id hx8-20020a170906846800b00965e839f56bsm4543023ejc.182.2023.05.11.16.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 16:14:19 -0700 (PDT) From: Boerge Struempfel X-Google-Original-From: Boerge Struempfel Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de, andy.shevchenko@gmail.com, Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] spi: spi-imx: add support for SPI_MOSI_IDLE_LOW mode bit Date: Fri, 12 May 2023 01:13:16 +0200 Message-Id: <20230511231317.158214-4-bstruempfel@ultratronik.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230511231317.158214-1-bstruempfel@ultratronik.de> References: <20230511135632.78344-1-bstruempfel@ultratronik.de> <20230511231317.158214-1-bstruempfel@ultratronik.de> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org By default, the spi-imx controller pulls the mosi line high, whenever it is idle. This behaviour can be inverted per CS by setting the corresponding DATA_CTL bit in the config register of the controller. Also, since the controller mode-bits have to be touched anyways, the SPI_CPOL and SPI_CPHA are replaced by the combined SPI_MODE_X_MASK flag. Signed-off-by: Boerge Struempfel --- drivers/spi/spi-imx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 34e5f81ec431e..cb6c088706b21 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -281,6 +281,7 @@ static bool spi_imx_can_dma(struct spi_controller *controller, struct spi_device #define MX51_ECSPI_CONFIG_SCLKPOL(cs) (1 << ((cs & 3) + 4)) #define MX51_ECSPI_CONFIG_SBBCTRL(cs) (1 << ((cs & 3) + 8)) #define MX51_ECSPI_CONFIG_SSBPOL(cs) (1 << ((cs & 3) + 12)) +#define MX51_ECSPI_CONFIG_DATACTL(cs) (1 << ((cs & 3) + 16)) #define MX51_ECSPI_CONFIG_SCLKCTL(cs) (1 << ((cs & 3) + 20)) #define MX51_ECSPI_INT 0x10 @@ -573,6 +574,11 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, cfg &= ~MX51_ECSPI_CONFIG_SCLKCTL(spi_get_chipselect(spi, 0)); } + if (spi->mode & SPI_MOSI_IDLE_LOW) + cfg |= MX51_ECSPI_CONFIG_DATACTL(spi->chip_select); + else + cfg &= ~MX51_ECSPI_CONFIG_DATACTL(spi->chip_select); + if (spi->mode & SPI_CS_HIGH) cfg |= MX51_ECSPI_CONFIG_SSBPOL(spi_get_chipselect(spi, 0)); else @@ -1743,7 +1749,8 @@ static int spi_imx_probe(struct platform_device *pdev) spi_imx->controller->prepare_message = spi_imx_prepare_message; spi_imx->controller->unprepare_message = spi_imx_unprepare_message; spi_imx->controller->slave_abort = spi_imx_slave_abort; - spi_imx->controller->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_NO_CS; + spi_imx->controller->mode_bits = SPI_MODE_X_MASK | SPI_CS_HIGH | SPI_NO_CS | + SPI_MOSI_IDLE_LOW; if (is_imx35_cspi(spi_imx) || is_imx51_ecspi(spi_imx) || is_imx53_ecspi(spi_imx)) From patchwork Thu May 11 23:13:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boerge Struempfel X-Patchwork-Id: 682325 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E655DC7EE24 for ; Thu, 11 May 2023 23:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239510AbjEKXOb (ORCPT ); Thu, 11 May 2023 19:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239506AbjEKXOa (ORCPT ); Thu, 11 May 2023 19:14:30 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458285B8B; Thu, 11 May 2023 16:14:23 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-969f90d71d4so643798266b.3; Thu, 11 May 2023 16:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683846861; x=1686438861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yVrYFiNzfnwEDWJqbz4i6UUhL6F/Njhh8b514wrHy84=; b=bPFE9oQ/v0Bi8HM083WisiVBY7+f0/sS0Zk/5LDwGQhWm99N/KSo36J6pQk4I3pWfZ C7UXARg6DwSbNVlEYfz183Xv9EyR2OHGQCkFLVkq3xuTEdmAKakB7BT+x8JwtiPDLoGG TBPk9msq2VwvsqhIitvVy8F7LXO54gWHwZsTECWiWDq88Cf028vseSVN839GbRxlUcJX SszHwJefkuACQxXotuP1gAl07KPyyXfOqjtbxLirP+95UYpsMAi/0ZWYREWhUJMDpyuY 5eLNRzI2cKcEjtFZFqhu545t9u/DwxawjCzagxBCCs1Zv9FCnE+8qTK48t1MfObGPCbP PkSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683846861; x=1686438861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yVrYFiNzfnwEDWJqbz4i6UUhL6F/Njhh8b514wrHy84=; b=S2RCa+1srdZR8EXVr0rjJqWQSQoMmxzll3IHJm7b4vFe1pZF2b3lzW2V3OpG2vrEH8 eOuMcXrvgdbgKS5rdcCKuSoa1E4RFFpUzWGJISsRr6+W6tYu7XwyozvGqsX26WnwXH5u p3VwtWk7zzt4Nw80bFW7goBwh+8U+gbMTNNvSlgseybV/bemN2spemaH3D7FGtTXIdd+ R08tPtJv0z4a6I4M0M5Lbg+Oeezo42FV5aSAE5roj4u17azzInohpKHHkNIe8ZA4q5HB kVnZ/1foud8RhJbkR3+IaAY0JEnskL8c8HVGg5X9IpVvcUzcSslmURKfDO9YrzRN+Bve 8obw== X-Gm-Message-State: AC+VfDxvC60KgKyicvyyp9lpgKcMWeuW33p0uzdvvt5kQsih1SCUFdKg hdePqIoUaReTfhtgp0Ifqfs= X-Google-Smtp-Source: ACHHUZ7Xiv4uI35j1SY9WriiO/V2ApkipDWS3Xqc4RSksozkyAf90JPpXCmfsp01aS4F1JO3r9CObA== X-Received: by 2002:a17:907:2d1f:b0:968:db2f:383 with SMTP id gs31-20020a1709072d1f00b00968db2f0383mr14109865ejc.53.1683846861470; Thu, 11 May 2023 16:14:21 -0700 (PDT) Received: from wslxew193.fritz.box (p200300c7874f2f0049cdad3080524d03.dip0.t-ipconnect.de. [2003:c7:874f:2f00:49cd:ad30:8052:4d03]) by smtp.gmail.com with ESMTPSA id hx8-20020a170906846800b00965e839f56bsm4543023ejc.182.2023.05.11.16.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 16:14:21 -0700 (PDT) From: Boerge Struempfel X-Google-Original-From: Boerge Struempfel Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de, andy.shevchenko@gmail.com, Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] spi: spidev: add SPI_MOSI_IDLE_LOW mode bit Date: Fri, 12 May 2023 01:13:17 +0200 Message-Id: <20230511231317.158214-5-bstruempfel@ultratronik.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230511231317.158214-1-bstruempfel@ultratronik.de> References: <20230511135632.78344-1-bstruempfel@ultratronik.de> <20230511231317.158214-1-bstruempfel@ultratronik.de> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Allow userspace to set SPI_MOSI_IDLE_LOW mode bit using the SPI_IOC_WR_MODE32 ioctl. Signed-off-by: Boerge Struempfel --- drivers/spi/spidev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 39d94c8508390..e50da54468ec6 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -64,7 +64,7 @@ static_assert(N_SPI_MINORS > 0 && N_SPI_MINORS <= 256); | SPI_NO_CS | SPI_READY | SPI_TX_DUAL \ | SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL \ | SPI_RX_QUAD | SPI_RX_OCTAL \ - | SPI_RX_CPHA_FLIP) + | SPI_RX_CPHA_FLIP | SPI_MOSI_IDLE_LOW) struct spidev_data { dev_t devt;