From patchwork Mon Feb 12 14:03:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553309 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FBD3C4829B for ; Mon, 12 Feb 2024 14:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DgucUBNMZc+Fs+LHhV86Z7SFxIB2wOjZpPn4e20C5/s=; b=ZUI4U6gQzPF5u8 cNyY6DGSjw5UuTwECyXiQp1zFFTDx7HHT1nedRrKnnxR2dKUhbopqkefJ+r5oQKDt9izTKpP0YHDT Ekbj3AbOSrjYYzEw0JmA8LZ8mi9SD67uZgNfQauo52Msawj0yOMyV1PD2O6ekoJ9eX/VX0vr60Qor wg29v7WT5v5jLNDDMY9Ou9vDYbcglceverjdTEVUqH00tQ1serOnVr4iljPNg468RsXDsnlD0fgls qEqzvxXKt4FZgoESjjUYL2EUi7bfpIa26L7k2sj2cypqZVoWekq1/6qMwBwjFM5a2ehSex1u3ztwr HyHBUeCeosN99mVTF74A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuS-00000005gj1-1Atw; Mon, 12 Feb 2024 14:03:48 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuP-00000005ghA-0v6b for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:03:46 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33aeb088324so2107095f8f.2 for ; Mon, 12 Feb 2024 06:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746622; x=1708351422; darn=lists.infradead.org; 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=eQjx1BYq38FUSUDdH+R5TkxMe5lYPMpuxbAcZUZM76E=; b=mFF6IaXEwqn8GpkkzSyOiogtd+eIUcZ9oKBAcmB6yS+KDivE5nex7dWBDBpt0CMHfG 7bZMWoxJ9soyOOJPhlAAyqa3waMarruB97iBEdlNV1Hx/y/gCW87fJ74H2V636vjNOBo iJGvEECRHq0Cf2uMxPb6jNhWcozOMlvcd5KVr+hNlzcpQqyEeyvqJOPTtVjNaODzxJIC uY0NpA8+qinf0M+qU89kH7cxQuzAosannOApsvbrf1/xpTF1Vl5UuL6XSjbfG4CQ/E4c Q7dF/cddjXmqaCld4qsJ0r4DFOy+2221XyBXUTl6U5S/xLf4P5e/lt3InN80R91fwYhs iKaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746622; x=1708351422; 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=eQjx1BYq38FUSUDdH+R5TkxMe5lYPMpuxbAcZUZM76E=; b=upk1kWnLaD21/qQvQKv98noHRYh18v7QruSHrCPf7P1y86e13uYTOYPZHQgtt52IOK QmtEoagNbt2g40JeVbHXvr7DeC/uSG2+2W6B77QQmtRf2A/UXiLwvRxSKvh1ca8OsIIC mzH/PdoxlkYESefjSDcjdtcqs2PeCyaD3fE1IKh/iHLWBdz7ughH3vPLG8jvfL0K66ln EjhCKpQeH9OfVgIOqTHVvfA6xCi2N4WlGYIxO8YOxNb4po+zPnvMAeTUSzQak+bhxWrb Pel26C7Qdcn1kSMH440u9fAiBoINvtlrztOcGebL+E/3lcv6/LhKs7WeiTuVqWEyL7eX CqAA== X-Forwarded-Encrypted: i=1; AJvYcCWQKBEkPM76j93S8BLlLDHIiEq8fnVgwOlA7gV8MbAOQzVECVMXB4GPfZm6vfemM61+xLmJNMcQQXnITdwZ+tEBLrfC7Le9kSP1YOVlauWRaJgLlfs= X-Gm-Message-State: AOJu0Yw/Tc12AUAaCW6Gl2OKAdQUjyIxUj2s0CWH1N3cpGHDLgOOXGZw uI8fuXhAmjaW7RzFOa7hjLp2qmwZwk6hmBFWlq1CbzU8w8mAQ7u9/kN97fP6TcGFzm4OK4pSsvG 3s5E= X-Google-Smtp-Source: AGHT+IGs6G2Dbixj4ct++RiAZaNlcAeFF+x9n4s/dYsr3NslItE/eDQWdXtV2mgcSiooqR1ukZaFbg== X-Received: by 2002:adf:fb48:0:b0:33b:1823:284a with SMTP id c8-20020adffb48000000b0033b1823284amr5807851wrs.14.1707746622602; Mon, 12 Feb 2024 06:03:42 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX0s1LuCBYrQfPi8TpB7Zi643w8nhk9MWn8/7690ls8R429+G8WviCV2mw8rEEOPiRXLeb6KBSVYdmxtEk0ZM5JR75szSXHuOfyOalc2rXUjEJGAjoKeRSu73I+xkiL7utx1bXJT1lpYp5pPZbhRltaLKksxN3uBwcmOCuoPEobd8b78gFVdXFh274nBi49hMoKa+rxCCyBl5a417sv4lTCBwRqpc8QyODjEYExQqE2NN3c/lmVAfXORcAEKUgs9JoGbN36vFGqY1Zxd7W3ukTFp6GR9mislxOyXZ0hDZZfz+i7eGuMVKt8owbrT9jyFUvMsuXJSYrh862UNEMJs8GtNaZsMY1qsJB73VdSOnL9qI31TTxN9kBARrr2/7gWaVVbG5WdfdIG8ax5h6qRlFK36XOwWh9Q5UapDCB3T4iu3Zr41DBaIT16H4UBjwmwaTKa8ulXn622/1aCGE8Sm2/MmhDqGhk/3tfpYbiUuKs0NDozV44B32u+rcKNvzjldLiYiNIQD/vskN4nX+ZGIY+jLUqXqJw9gxokfkgbRRo9JuVV5onr2uyAdjrBreLuAkAFKLT9cToxyJRvZ/bQ5dKiZ6VbLbLKqGfLD5F/0Hoo42w9yyc= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:37 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 01/12] spi: dt-bindings: introduce FIFO depth properties Date: Mon, 12 Feb 2024 14:03:20 +0000 Message-ID: <20240212140331.915498-2-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060345_284866_5E1C5D11 X-CRM114-Status: GOOD ( 11.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are SPI IPs that can be configured by the integrator with a specific FIFO depth depending on the system's capabilities. For example, the samsung USI SPI IP can be configured by the integrator with a TX/RX FIFO from 8 byte to 256 bytes. Introduce the ``fifo-depth`` property for such instances of IPs where the same FIFO depth is used for both RX and TX. Introduce ``rx-fifo-depth`` and ``tx-fifo-depth`` properties for cases where the RX FIFO depth is different from the TX FIFO depth. Make the dedicated RX/TX properties dependent on each other and mutual exclusive with the other. Signed-off-by: Tudor Ambarus Reviewed-by: Rob Herring --- .../bindings/spi/spi-controller.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml index 524f6fe8c27b..add39884d226 100644 --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml @@ -69,6 +69,21 @@ properties: Should be generally avoided and be replaced by spi-cs-high + ACTIVE_HIGH. + fifo-depth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Size of the RX and TX data FIFOs in bytes. + + rx-fifo-depth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Size of the RX data FIFO in bytes. + + tx-fifo-depth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Size of the TX data FIFO in bytes. + num-cs: $ref: /schemas/types.yaml#/definitions/uint32 description: @@ -116,6 +131,10 @@ patternProperties: - compatible - reg +dependencies: + rx-fifo-depth: [ tx-fifo-depth ] + tx-fifo-depth: [ rx-fifo-depth ] + allOf: - if: not: @@ -129,6 +148,14 @@ allOf: properties: "#address-cells": const: 0 + - not: + required: + - fifo-depth + - rx-fifo-depth + - not: + required: + - fifo-depth + - tx-fifo-depth additionalProperties: true From patchwork Mon Feb 12 14:03:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553310 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E12C4C4829B for ; Mon, 12 Feb 2024 14:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f1Mw5/OS7hUZIKHu22Frzv8pb1bE9jgTG4IUZ1YiYhw=; b=lJ/kVL+MovzqQE Mews4kmn/7If3ZN3Bz+8GnzcXMRA18Wcm953A8Mh2boegSouOAGwCad3z2FL/fs/AfhSKmuOBVY8Y JCBBxOp3WcgR1EOkbStwJYO6PmG6WFuo7/ZKpMWGn/+oznzK8Gy66dEvBXpvcCmOYeFiRsMMLxsw9 f08YHMfABC9+iOxK6rvoE+RVdSNSMlC+33SxJO/iNV7Nqo39TMJQgvTFxZCyg1Ys8JzBPp6lEzd+l T3IN/oOfYSSg2wXbNTaFjfaeeEUlf6XpAREgIQlwouNn/2X8oW9UdLeeMJ3+9Mj8Vg9Cw0Flgjz06 55VCVevyrS90ChOOr37g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuW-00000005gkU-0iQg; Mon, 12 Feb 2024 14:03:52 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuR-00000005giL-14E4 for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:03:48 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33b2960ff60so2394400f8f.1 for ; Mon, 12 Feb 2024 06:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746626; x=1708351426; darn=lists.infradead.org; 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=/YEBZ5QgPmZi1uvEzjonJi8xfKR7wdfW/zkTSEaERIc=; b=fnYg2D8fllC8912oQKGJsQHrFCwvo7KQV6E6h0aLq/lTLkBydENOP9YdXKO3mFAUip nkgmHa5mZUc7uRTTV+fWtlH5N5bru5cwBF73UPzzpwU8GOPHzjDRiNxyxXO4QQ5RIdTV klKtmMg/B9PeLSxGkzCVLwbV3QN4Zg3VpWac95ZA2Qd48XvHVqlTdpwRy0IEkPDmhjWk dcYoDfM4yy3gnTYRJMR9B/tst13I4IlbAlMQIwsnS6X4eEcMjWcfMxo9A9iihDazF1y8 7lA5bjW9SQi/SAMX0eWUwpydx4auzpvNcePozPUvAyvgrzv8OQkQHHJnTS666TBe9TPu 8EQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746626; x=1708351426; 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=/YEBZ5QgPmZi1uvEzjonJi8xfKR7wdfW/zkTSEaERIc=; b=ufVPP9gBo9/Gr/BZIeInyTRM9Feojlf7x5oZZ62b/WHtN36yF9dDVsqdYSRAZchIJT YDwCIFy7zeunJb0JvDuoh3q7zXP7oURbWwtNLJ6CGskpG8J209rWA4rmD2YQQmqcbkyk Pz88vFS+ipAaN3mdJagkHIyNKNt9ExdDFPxlpfNg0lvVRjYB4aP+CzGyh+iqg4scVp9+ /vgh4ygsJ/I+xeyl+v0WKadFCWZjTsCjOh3p4lzcZzvPkFvcx68Ckj5rBuC60+Vv4iW+ EkDDXKyk0erx9FCkgRLLH7zuhO9hCLQQMPtQYCTV6o2uWLme2uBa45CLgkplwL8Kjd3z Q9UQ== X-Gm-Message-State: AOJu0YyHyNSzdnrZMahEyh5pkVNLVNUEVgmMdqA0bgnIyMn6wgEmZkho y6yvCAzFFhP6aJP402gcDqRTbJKGehjQTzU/PULU35hUVs4EeyUftP5dxtReIU4= X-Google-Smtp-Source: AGHT+IEMUn/Ujlv8/99OYN9W93mnczYnQYRRrEaW3In2VMr/6ZWLFAs8f8nYbCIs3nWugXOejnzsxA== X-Received: by 2002:a5d:6388:0:b0:33b:8604:5068 with SMTP id p8-20020a5d6388000000b0033b86045068mr1747857wru.14.1707746625898; Mon, 12 Feb 2024 06:03:45 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU+avd8wL8iuEOUD3YPGF+15CK03P0cMjdZum0FGwAAFhBEXXM8bcsjtPURQ+6z2liFzq4eodzK1auoo5Q3JYv/PdEKLDtyJzaOjX5EZOUxC3hUcXyz5J6AJBEeVbrRKek2MaBBETDKc0GPmJSG3fdAUpvmsSIgmOlIBpComLX4JWaCLaNU3GIhjR2nmPqwY6hp3wpaiotOLOQFA7ymTcaZtYpqt5wfnJDkhhnjsPYgNDgo6ebbf0VThnJs+83vsKZBe1gIyB9bzhivHNCUFQKotEI/rqlAZrhyHeJPL1NVNoIdgJ17Cyd+jj7SHtE7VBU6x7VPFkAruymYIKUVoUlgax0uWFtAFFVtD5Q5AgwVfcMkR/IRpujPBRn27Xkd8Abb61qxvfZOfe+wxHciX9o9MxXHM6cgGAFQ+A6OdUFhWGLbt9n0cLXZ2aLW2xzn60WEBJznrlbSY96JSrm0s7pGz2xLqAlcLRQDBQHufKZWANCRNcbw5+MsxpWsrKcLIGyrPCmmv0+F187ecNSQeOhLD1e+frqyOzQH1q084u+IKoy2fNRUL/cF8VXbPr4KRr2F3S4nBraBQGjgbOpMJHx0RRGQjrYnj/jZU6CVt6eaSe/BVxE= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:43 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 02/12] spi: s3c64xx: define a magic value Date: Mon, 12 Feb 2024 14:03:21 +0000 Message-ID: <20240212140331.915498-3-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060347_302365_3A5D2E1C X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define a magic value, it will be used in the next patch as well. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 6f29dca68491..6ff3b25b6feb 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -78,6 +78,7 @@ #define S3C64XX_SPI_INT_RX_FIFORDY_EN (1<<1) #define S3C64XX_SPI_INT_TX_FIFORDY_EN (1<<0) +#define S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT 6 #define S3C64XX_SPI_ST_RX_OVERRUN_ERR (1<<5) #define S3C64XX_SPI_ST_RX_UNDERRUN_ERR (1<<4) #define S3C64XX_SPI_ST_TX_OVERRUN_ERR (1<<3) @@ -108,7 +109,8 @@ #define FIFO_LVL_MASK(i) ((i)->port_conf->fifo_lvl_mask[i->port_id]) #define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & \ (1 << (i)->port_conf->tx_st_done)) ? 1 : 0) -#define TX_FIFO_LVL(v, i) (((v) >> 6) & FIFO_LVL_MASK(i)) +#define TX_FIFO_LVL(v, i) (((v) >> S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT) & \ + FIFO_LVL_MASK(i)) #define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \ FIFO_LVL_MASK(i)) #define FIFO_DEPTH(i) ((FIFO_LVL_MASK(i) >> 1) + 1) From patchwork Mon Feb 12 14:03:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553312 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A900C48297 for ; Mon, 12 Feb 2024 14:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XCB+4mhgW/91MPJXNOQshRxTCAhbquzDeL9vju1g+PM=; b=MJdt5aOBz5czH1 /SyV2bozhjFfdUPpd+RHeaxjXpi55kFpwbYLK8VZ5Tvj4qFC8henibL2ysiAInMZ5UqgPUJ3szJOe Qtt1Whne5tGKRg/fFSbELpcPX4OamP7CKrr0ZwVSgZ6u5p0e3Wc5wvcx3d5kqiG3JOIqYbvUyVGBA 6BY7fIc15QlBfjTMNDv7b8kE8Qv+JpjMBiIf/9b/lDH5wPu/9GMPNz8d9W9WCM13EnchEpbla/XNF jW1ZYBRhq3Lm2/z1KRFXIjZ+JESlQGVGjjBKZNmCRKTw/q/g1L7do/QFlsibjqyUwxEPlv6VwhCIl I5g2y6ZqnjEEwSLAjb6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuc-00000005gom-2dxG; Mon, 12 Feb 2024 14:03:58 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuT-00000005gjN-3fjb for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:03:51 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-410cb93185dso8025265e9.3 for ; Mon, 12 Feb 2024 06:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746628; x=1708351428; darn=lists.infradead.org; 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=3UCCMmhJgpPZWbOVTAspr0xjn11XvYuA37qXyTRrUkA=; b=Eaqsy0XxXX3eLanJnoZ+t+n0JftKBGbV654LAJG8ylh+JvizE1BGOYKE4DhnN/XzwN qiuwq6AyjPYHNfccw3xoGKMxKPplYDAhRtIDOjFs39tENtxjfeRoX5f8VbHw9FKfiKMF Bp119/7JYeJizoRr30MHMCOYLXgwW7lspM/hQdVHpGF9UOhZwFmgwmJYp2aY5nIb3Des bfITsfsb760Aa47qlkala+za9gQoTmV1j8kMmYj+gN2ZzQnGnK19YYNhMB3cQJjxt9yu 4Fgmtj5lkbOZAg6a9W3p9/+eFKh44FB0OSztwc+X6+UuCdWEu+0blrVCLKlEXWLg9ALD uj6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746628; x=1708351428; 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=3UCCMmhJgpPZWbOVTAspr0xjn11XvYuA37qXyTRrUkA=; b=aUn8rh+3+x3n2aTKCloqQAzvc0g6ivPKumpF7buVujXVHJjXx3cJm54TERx24I/PtT z90WzQ70nxxJV+0Uv5smalPAc84hR1WtLWU8PQFwXrr1Weqmdw1swjVVH33FfSmP20G/ w/7mN2XEEZvoNR5JNAvPpzuwt6av9B0UZuBNbUIb1n7qzONY869D7jVe1/gbiBhZUuPw rsn2h9tvnXC5lBbV3ruovSlS3tN2tNfOxO9gzX/RUDwTIK4lczkTBpzAw8P/cxOcdwvf 7KjW5MbFVqVHxOGsliHuHqodpJXywSkNQwvmbVNJRSsoF1+kLbnXN88oaFH06bjMOnyr oLoQ== X-Gm-Message-State: AOJu0YyEtiN38M3GwVRKteNaOmiN1TiVbuuWiHGCWI4uSyxBXmNE8qMT ijWKkVQGcYRrLBgmHpGK+IqV6wdnV342a+rewLIZTWN9iDLn0eWzsKRvZHw9sBY= X-Google-Smtp-Source: AGHT+IEbgvEBoNsAAurtTPnlKh4JR2ymVdbJyrcqUbYPKpD5rJLJU2A7G18SpNCuqft7xJ2hDbxuJA== X-Received: by 2002:adf:f310:0:b0:33b:61fe:a82c with SMTP id i16-20020adff310000000b0033b61fea82cmr4826795wro.22.1707746628063; Mon, 12 Feb 2024 06:03:48 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXuLucAHTrEw+q2t/r1JV8J5Ne2rVDTnTBWpBXSM//xeorclRlGyHik+CjdLQ+lA/2E90iDoAoJtwXTNht5wZa91kkgVUs5LNT747vZh5T8qUfBN3OUekLf2XaKSBHI9hXl1P/gLPf5rSIuKHE/fR1lJW+mKdVzo5nYN829ZClryn2TdsgC41oZzGqk7lH8+Qgu4z2FlMt5nK1AfEjLSyTg/DGlahPpE0EJAv3p2WaP8yrfHRzQ77PuloAZlz8ezS+PK5qiLWQm9PMz0pp2ju9Om0uE1HoHhvze2DpJPUFpeokYF88baooKjlYYHJkvIEpF66Pcejr8jx87p/gn0ch52PgF4w1TW8o8iN6XCnhScyPuIePsT/bUyh6hIqa+1UrUzlDB2okQlmi46s8H680dio62m8zm/QAUuj5ykx28LYrNm0jfrVUQFjS3isaCBqzybb+z+W159gszHEUoKTBQeNG0WUgAYaUXnOkZkAULTvUeD9mta29b3jKus30pw+QqkKGq4cI83YIwkr5i5/mSkE5DdZ+KF/dJLt/3CjXX1dWZKQTtkrbAfl22/tmgUNrlcjv2u43PGCEoqa50HM4L8DlSROR06m5Vr56xNmez+puEJqA= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:47 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 03/12] spi: s3c64xx: allow full FIFO masks Date: Mon, 12 Feb 2024 14:03:22 +0000 Message-ID: <20240212140331.915498-4-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060349_968893_557D1ABC X-CRM114-Status: GOOD ( 18.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver is wrong because is using partial register field masks for the SPI_STATUS.{RX, TX}_FIFO_LVL register fields. We see s3c64xx_spi_port_config.fifo_lvl_mask with different values for different instances of the same IP. Take s5pv210_spi_port_config for example, it defines: .fifo_lvl_mask = { 0x1ff, 0x7F }, fifo_lvl_mask is used to determine the FIFO depth of the instance of the IP. In this case, the integrator uses a 256 bytes FIFO for the first SPI instance of the IP, and a 64 bytes FIFO for the second instance. While the first mask reflects the SPI_STATUS.{RX, TX}_FIFO_LVL register fields, the second one is two bits short. Using partial field masks is misleading and can hide problems of the driver's logic. Allow platforms to specify the full FIFO mask, regardless of the FIFO depth. Introduce {rx, tx}_fifomask to represent the SPI_STATUS.{RX, TX}_FIFO_LVL register fields. It's a shifted mask defining the field's length and position. We'll be able to deprecate the use of @rx_lvl_offset, as the shift value can be determined from the mask. The existing compatibles shall start using {rx, tx}_fifomask so that they use the full field mask and to avoid shifting the mask to position, and then shifting it back to zero in the {TX, RX}_FIFO_LVL macros. @rx_lvl_offset will be deprecated in a further patch, after we have the infrastructure to deprecate @fifo_lvl_mask as well. No functional change intended. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 40 +++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 6ff3b25b6feb..338ca3f03ea5 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -3,6 +3,7 @@ // Copyright (c) 2009 Samsung Electronics Co., Ltd. // Jaswinder Singh +#include #include #include #include @@ -109,10 +110,10 @@ #define FIFO_LVL_MASK(i) ((i)->port_conf->fifo_lvl_mask[i->port_id]) #define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & \ (1 << (i)->port_conf->tx_st_done)) ? 1 : 0) -#define TX_FIFO_LVL(v, i) (((v) >> S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT) & \ - FIFO_LVL_MASK(i)) -#define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \ - FIFO_LVL_MASK(i)) +#define TX_FIFO_LVL(v, sdd) (((v) & (sdd)->tx_fifomask) >> \ + __ffs((sdd)->tx_fifomask)) +#define RX_FIFO_LVL(v, sdd) (((v) & (sdd)->rx_fifomask) >> \ + __ffs((sdd)->rx_fifomask)) #define FIFO_DEPTH(i) ((FIFO_LVL_MASK(i) >> 1) + 1) #define S3C64XX_SPI_MAX_TRAILCNT 0x3ff @@ -136,6 +137,10 @@ struct s3c64xx_spi_dma_data { * struct s3c64xx_spi_port_config - SPI Controller hardware info * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. + * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's + * length and position. + * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's + * length and position. * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter. * @clk_div: Internal clock divider * @quirks: Bitmask of known quirks @@ -154,6 +159,8 @@ struct s3c64xx_spi_dma_data { struct s3c64xx_spi_port_config { int fifo_lvl_mask[MAX_SPI_PORTS]; int rx_lvl_offset; + u32 rx_fifomask; + u32 tx_fifomask; int tx_st_done; int quirks; int clk_div; @@ -184,6 +191,10 @@ struct s3c64xx_spi_port_config { * @tx_dma: Local transmit DMA data (e.g. chan and direction) * @port_conf: Local SPI port configuration data * @port_id: Port identification number + * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's + * length and position. + * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's + * length and position. */ struct s3c64xx_spi_driver_data { void __iomem *regs; @@ -203,6 +214,8 @@ struct s3c64xx_spi_driver_data { struct s3c64xx_spi_dma_data tx_dma; const struct s3c64xx_spi_port_config *port_conf; unsigned int port_id; + u32 rx_fifomask; + u32 tx_fifomask; }; static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd) @@ -1183,6 +1196,23 @@ static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data; } +static void s3c64xx_spi_set_fifomask(struct s3c64xx_spi_driver_data *sdd) +{ + const struct s3c64xx_spi_port_config *port_conf = sdd->port_conf; + + if (port_conf->rx_fifomask) + sdd->rx_fifomask = port_conf->rx_fifomask; + else + sdd->rx_fifomask = FIFO_LVL_MASK(sdd) << + port_conf->rx_lvl_offset; + + if (port_conf->tx_fifomask) + sdd->tx_fifomask = port_conf->tx_fifomask; + else + sdd->tx_fifomask = FIFO_LVL_MASK(sdd) << + S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT; +} + static int s3c64xx_spi_probe(struct platform_device *pdev) { struct resource *mem_res; @@ -1231,6 +1261,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } + s3c64xx_spi_set_fifomask(sdd); + sdd->cur_bpw = 8; sdd->tx_dma.direction = DMA_MEM_TO_DEV; From patchwork Mon Feb 12 14:03:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553311 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AF2BC4829B for ; Mon, 12 Feb 2024 14:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rW3Nm2pxAMWTmRfMjt1FNbgHNqaUAIqhwsL6rYo7XrI=; b=O1oso8mrGCIFt6 5lIHNQdZnrd+2jgYpu9N2j/jDPlDLyBQ38jTXT71kWpWt4pg+ywFXxgQENzTy1VRlu0mxSXuZhtD0 Wc8YpeKRwJ6MjrHblsI486B572KHYXt4sh8OfQ2BudhCIeVQ14x+791kng6wDWHcpCGxouEgG3PWL QPLEpy9ON54aKqoKRtT3jGEsS1UB1AMb+D89bZ8V6YS60h5r17HW0ICZ5HcO1gu2arMX42n6MdU0J ggRXbDsTksLgPBaa5wik9YoVHnelRWyDYH1bbjjdxcV2unsdTxr0XtKj7GfcB/ATcuv4hbWLW6MID yWU3awzjHN3nGDh/9IHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuf-00000005grO-0ypp; Mon, 12 Feb 2024 14:04:01 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuW-00000005gkM-3d5y for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:03:54 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33b86bc8974so386695f8f.2 for ; Mon, 12 Feb 2024 06:03:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746631; x=1708351431; darn=lists.infradead.org; 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=NGH79biiaV6ew1Z0cXAg/aqisf4dNxuTnwEmj4C4qiQ=; b=ISs+alK7UkK/9+ilEDvzmxN5QtOKS89Pz7U5jBUDBmeXZG6vACZ89JJ0m/43yGBGMd RzqXCsyBwg8WjJLkD7KtNe2vqA4xeBR3FHb5pBa64YjyIkUnv3O935d+c77rBugyJBLx H/keL9QwNifMBR3VFwJAN4BYbhuSwrvcmgaMeQoMBl54mgog5Q09tlOxkIvNuM7pTyyn I/cKYZCVq9w+ge2KJbAqX/XrpyltGa3vM9iCGTCmbqAKjE3cDK5DSl+5PnyDDHkzHXlU iILrAI26/TeR7zETAUm8sJH8WKtS1npEg87uOsB+ECMgav3fxpLKOLDQ8gxtPjgqu5Od DV+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746631; x=1708351431; 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=NGH79biiaV6ew1Z0cXAg/aqisf4dNxuTnwEmj4C4qiQ=; b=uhXawO4qD37cSDZyaAybgV06lrkokwKtqn2Wmd3cdyvJn8bndyOKZ/zXw9X2I8HfAv 8kt7MlRckNXV3uA+cuhQiCcCLSRAuSiCWX1EqeacG54malANbeiQAVJFLjwMpL2nhz62 HlC+vHYRe7+jLbzGbNtFqv+1mDXJuMNgNRVFCJmoGo3nbHVf60J/thb1XkTQUH3LTA+H 1sep++P0BGabZZwMoW/uQh0GhR5set+Lw04XuY6wfKKQ4swoNFFjHG1PeQ3ZYczR4aGa O414OLwkzLblN3JxpxqzAvVaec4nCwpvEjBztAj4RokGr5JylpYPxtGn3lhzLnuCRH/h u76A== X-Gm-Message-State: AOJu0Yynu7X5JVW4ZtIVh8FCRxwrP4dbicgiLEJlpzoyHktsP9dZMAyf 5GExJFqlhP3g84VSkwiHvD7pd9OLw16QhVPaVs9qO7QRxHuB7t3yJ5qpVGGS1Mc= X-Google-Smtp-Source: AGHT+IGS3x5tiHx478cOA6vfdXTCG/2IAIZ3b65y6QIldC8Q++sdM3K9tTaV3NK0VcHRSwJS0LeAfQ== X-Received: by 2002:a5d:69ce:0:b0:33b:7134:a3b0 with SMTP id s14-20020a5d69ce000000b0033b7134a3b0mr4147636wrw.13.1707746631158; Mon, 12 Feb 2024 06:03:51 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUI6uye0RmUlRtKE0WXT1AxzVO/ZKsIQdCH3OhrvSUvnL9NTDlyOA2bFRJbVln8Wsk7RuZVKvUMHB9eohQcZOZn0Ulln+lUAMB2GykP1WI/4H3OjIpG7TR69c54P9LJz4l1LDDNw6xaQz5hLF5Jt71K2QodArP9ulEGr4tldJStGYL3OEKfSSG1ZYOsG1GZcqA6KRleB31t3V1XqEtUcZbxErI9DPWjSiTjA7Au8D6eSWQyZXw6JMcf4j60Nc+k0L6/wDHqo1IOkHWLnd6nBsgfpJibPicMJAeD/7VW6SeGJkrIdb+hFBJcHR29TBZQixp6xe8bvwzA8LghYFtGmUrUeU+xMlIHTfHBJBSHQxh7ueCVh2a3FLzscOQ23aNzAdS5Rmre/+1nstIpdLFfPa4hDq11HxEqy50qe459gmhOdOjFqk8lmbxjwE1SZ29Dut/TW4AlGyncnjsOzpWdcupVthNAzs4sQrl33tXB/FFuDfAAw4Y8SEFzlxElh+qBCKHrCsV+bFJBCRa/TY8BteGCFxF1Hv0YbEZYGnvppY3BbwnulzXeLQCN2Ri8mxRogl+fk3M3ble0oJSbmpbeUbS60o7W4qZDmMs/bKDFshGZ98Cvbjc= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:49 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 04/12] spi: s3c64xx: determine the fifo depth only once Date: Mon, 12 Feb 2024 14:03:23 +0000 Message-ID: <20240212140331.915498-5-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060352_969936_7529EDCC X-CRM114-Status: GOOD ( 14.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Determine the FIFO depth only once, at probe time. ``sdd->fifo_depth`` can be set later on with the FIFO depth specified in the device tree. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 338ca3f03ea5..72572e23cde5 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -191,6 +191,7 @@ struct s3c64xx_spi_port_config { * @tx_dma: Local transmit DMA data (e.g. chan and direction) * @port_conf: Local SPI port configuration data * @port_id: Port identification number + * @fifo_depth: depth of the FIFO. * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's * length and position. * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's @@ -214,6 +215,7 @@ struct s3c64xx_spi_driver_data { struct s3c64xx_spi_dma_data tx_dma; const struct s3c64xx_spi_port_config *port_conf; unsigned int port_id; + unsigned int fifo_depth; u32 rx_fifomask; u32 tx_fifomask; }; @@ -424,7 +426,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host, struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host); if (sdd->rx_dma.ch && sdd->tx_dma.ch) - return xfer->len > FIFO_DEPTH(sdd); + return xfer->len > sdd->fifo_depth; return false; } @@ -548,7 +550,7 @@ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd, void __iomem *regs = sdd->regs; unsigned long val = 1; u32 status; - u32 max_fifo = FIFO_DEPTH(sdd); + u32 max_fifo = sdd->fifo_depth; if (timeout_ms) val = msecs_to_loops(timeout_ms); @@ -655,7 +657,7 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, * For any size less than the fifo size the below code is * executed atleast once. */ - loops = xfer->len / FIFO_DEPTH(sdd); + loops = xfer->len / sdd->fifo_depth; buf = xfer->rx_buf; do { /* wait for data to be received in the fifo */ @@ -792,7 +794,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host, struct spi_transfer *xfer) { struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host); - const unsigned int fifo_len = FIFO_DEPTH(sdd); + const unsigned int fifo_len = sdd->fifo_depth; const void *tx_buf = NULL; void *rx_buf = NULL; int target_len = 0, origin_len = 0; @@ -1261,6 +1263,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } + sdd->fifo_depth = FIFO_DEPTH(sdd); + s3c64xx_spi_set_fifomask(sdd); sdd->cur_bpw = 8; @@ -1352,7 +1356,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Targets attached\n", sdd->port_id, host->num_chipselect); dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\n", - mem_res, FIFO_DEPTH(sdd)); + mem_res, sdd->fifo_depth); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); From patchwork Mon Feb 12 14:03:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553314 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D508C48297 for ; Mon, 12 Feb 2024 14:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UQBCfHLUO5qufDqKexfAn1kw2CrBU05rogGLYTcW6bw=; b=hBD5QPCEBuYs8E Slain0kAd14JGEdP7BaEZn3a6a6k/dQhVPz5Ls4fgJWZMzQnGaoV56ogy5dnEzPr6De2U3//W4qv/ iG2pWLKZgyGH6mNeM58a0u+j9rUJrMnIAVWTDO4SpRlqXcw7BvNt6X7XpoR7HCOJsyOSctJV1Rp24 q1IJFHvBPFLL7RZozx75e2gxC0IxdBONkxfn6tXV7flouC9Htx+A445xk8iWlNhRtW+BWekpg71sg A84HMjr5Ae+TTEQ4kIU1sO5YlPYbbYmuQsfiG/LXYC+KX/T2Mlqj9ae+L9Od5+cuBsSCMBaXP87co YgUm0+w/fO2iMDEfsHkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWup-00000005gzQ-3ID4; Mon, 12 Feb 2024 14:04:11 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuZ-00000005gln-38rB for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:03:57 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-410e7b08252so4836085e9.0 for ; Mon, 12 Feb 2024 06:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746634; x=1708351434; darn=lists.infradead.org; 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=VwdchoB+O7sv0WsEEn/4CtktSHX1kT968ZrMEmEikx8=; b=pLveA+gDARm4Vnlx8hJnNHjmi70V9BAE/xAwCCS6UzOGnpspKgQ2mrOYJfBDs6La+U 3NAFFriWYvm80/uEqZGkEwbOOwqsy7cvknCCbrjANF7Zt2vg7I5tLAnROX26mDFi2oaI vup/JBRrG02ix0qRSk70LFLWbhX80b1Ocg1ZSE92at+V3XgnT70b1mK9Vn7rQJUcvWtG /dFAQgrmEohQGZwPECWgEfy55AXaa83paVfQpYBMB3YKRc7Q9ejtWwOCqcZLXlu6EevF VAd0u3th/V6KI2yYNYkOc/XbuD/rByu3TpspzmM2JQbHyfmt1gGFxcQSXUA1Y0VyyQje hFIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746634; x=1708351434; 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=VwdchoB+O7sv0WsEEn/4CtktSHX1kT968ZrMEmEikx8=; b=DC3Mm4DrTKwlezOed/uoWc7YDin/xfIv410v2El+obQtQMpqilWuynY6YkDg/oiVU5 gjgSxwYBm7Wd4lOOGDU0Fx3TS26Itsuwgn/JwVx8nQyISABS2xUFL2Q+EOJlGwydfTpU o4eOCYq//mBh0o8f0FAQQPqrE7BsByaKCgY6SKyor7zwbsYsWjmVL/Qqy3q4kJJKyVin C8sve1c6Rugqy0viQknIWrUsxStoV67JHDx3vXt39I+hW3bYebhPTPEPFoYlm+iEzZoC v/4nCgoY3qM/CDJyMbWMNa+IwyMTlH3HLxzjopGoW96f7/tMkgHqhaDxKSlgqm3O2aYf vLSw== X-Forwarded-Encrypted: i=1; AJvYcCX+GLXP6RkWsh3D+JEPu8njViIjMnsCPXzuWNJDvKe2Mmkf22ageqF8Q+vt2mdUmCJIkndF/n6HvOK0Z6oLyb+SnDrRh1I2zL6Ams6LkmKdo+IKsM4= X-Gm-Message-State: AOJu0Yy0wZG7Lk/x23aP4Sm1KRb5sxCMOOXsL7sVqqfeyimKH1Z8KebV pwaf+u+IL8dYM2Uh13Cj3Z30d5m8WEk4lzyE58GYh8e4vEX8Fw/P0WpJF6Bg900= X-Google-Smtp-Source: AGHT+IHwIfxoiv08pfQ+i4+RbhOsVo0yv8+VlGvPXUawS4yf0N3DLdABRSWs1wE4F5B5L8arnUsAKw== X-Received: by 2002:adf:f6c7:0:b0:33b:81fa:ed8 with SMTP id y7-20020adff6c7000000b0033b81fa0ed8mr1852749wrp.0.1707746634081; Mon, 12 Feb 2024 06:03:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWsi5WaSfqWUOKZuQ8/DidxAGev3Z1GrHFRfy160EH3quKTiQOAjdKKIYPfP8D+yKm9Q1pQQ99vu0HH4Ito4Uzixp02M3marATcsrBiDwwN1D1A34dAB0gNM6X/hFbfhxagI5fk5smjLdVPyf496wYAfEN9QJSS1qLSCxa65Xi2pniuOJuVjGYXCEbb1LQH3E4Fl/kQ3yAP75XPXskXR6YWxlmdnmVV/KvB4C9QX25sun5SChLlO+ISybzk3xTURv0G2iJM3jzHhhwk4pCYvmnfpR+Xhj+HEj7kfKFmhvjyeKtVl/0pNtKOhhIDC1hIsOMupRu9FUf9i9MzlBAtMAjpjEz2P7t8Qnnyf8E0wtRqmYD7wbiJZUctZ4Qtd9f3SQFuZ7cz9sjQxCZXSqaNZkCxEQWu32XrtsVanHERDVPQcAuO26kapN8JKfADKCuhsuxrkJUwVS0l9NEF/3DvuVT5l9nH2+EiXx9Wz9jL9Lz812K3RpJRcYXvY5m2hf0wRVXGD6oEWdWOfAIICVIDINy1yHJZrf4nl9E36TmJv+Yfkbif3LmcADLGZw1qOvElbiFV4ouiBFtv2/BQQep878TKXghEkKopd/rVoe4KE00AEJ/90v0= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:52 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 05/12] spi: s3c64xx: retrieve the FIFO depth from the device tree Date: Mon, 12 Feb 2024 14:03:24 +0000 Message-ID: <20240212140331.915498-6-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060355_807120_162F59EF X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are SoCs that configure different FIFO depths for their instances of the SPI IP. See the fifo_lvl_mask defined for exynos4_spi_port_config for example: .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, The first instance of the IP is configured with 256 bytes FIFOs, whereas the last two are configured with 64 bytes FIFOs. Instead of mangling with the .fifo_lvl_mask and its dependency of the DT alias ID, allow such SoCs to determine the FIFO depth via the ``fifo-depth`` DT property. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 72572e23cde5..b1c63f75021d 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1263,7 +1263,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } - sdd->fifo_depth = FIFO_DEPTH(sdd); + if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", + &sdd->fifo_depth)) + sdd->fifo_depth = FIFO_DEPTH(sdd); s3c64xx_spi_set_fifomask(sdd); From patchwork Mon Feb 12 14:03:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553313 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 769ABC4829B for ; Mon, 12 Feb 2024 14:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K/mE2f6FZ9mD2fL75D5De72ObplTNJkrK94cqqR4GKY=; b=uU9JpnKqDO2kyy bU65YYlDzj/xpU/avMcHFCECjC40d5zcsf9Os3UlnQkbciDmHAWj2Boa0VPrc4hukd8vE0b+WkY23 MHaFB7Jp2j0t51SilLSdRatHX88JHKW5cpfJHTcyfKGI4xKRDo0GL40KRRZZDRg1bFSFkE47Vui4k jtIiWtch0pTJLISbrA/GWbqLcX3Ut6ipOo+ZYvSEsto94PhL1e80nsnFrJYi9uhq9X9YbuFP+7asy nYSutFY877D+aH5JnzGEizhcULpj1wXZViqnwr3XzPgDPil1yTWaZcE6rcKqGuC5tX8KXZKHkuDNf G7n55XGpJHtLbYHeLCQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWur-00000005h0U-1ALu; Mon, 12 Feb 2024 14:04:13 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWub-00000005gm8-13gF for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:00 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2d0e2adfeefso30720921fa.2 for ; Mon, 12 Feb 2024 06:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746635; x=1708351435; darn=lists.infradead.org; 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=BwyqOxCBKuWUKHqwJM3+S1e7+XETwlW6DJMJjNuYLS0=; b=Ae0HJfnOqDCubfgfk8tTig3VMjDjIT1NKuMv+gAUwzb4xXpRmtfolL+NRIjeAtYO1B W2MFtWRej1ptMP9lYu4U+5PW8Q0T6EqX65IyqUbzlxASpZk4SHhVirjexrclN4fcHB2h R/vBMUoN36bzbFocjk3TPEhIOx9MQ+fcWExqvbJ8XICc6dDGvaiIPAcMHa/rOKJWu8/C utTnTOGdvEA9LAEF5C6u+1LdKaPWGsv8qD8ZK856WKrG6x2xQfPtBh4h9j6t2KR4uyHg /qITgqafRB7Sf6/pxbxPPh6nijTd/+cYhLw+mo5WSlDWjSML4woxPKjuMpuHzZ5QWGlN hbOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746635; x=1708351435; 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=BwyqOxCBKuWUKHqwJM3+S1e7+XETwlW6DJMJjNuYLS0=; b=aN5aRkgdzyrBCTGCby6Z86Ss+NQPvdxqS30ZdN4mkWFaHPoEeKsZ8TT34ALGtxOZrh Hy/ZpJKm2L72LXLWRXIWgn2ASen10qAD7z0Tuq5qalkXjf6vvUeFzfM9TQ0B/Ba2CkSn whZY/d9VoqZK8LZWuLpI1K35mSxhJaj0vWaKguL50HicoDhhbyFDyIDEjGKKNn09xcL4 SgeqWYtuSgJXHI5xSGeoMNz8SRgCXlbTpO/dM9GRAjZJTaG2LiZ2JDjzG410FyScHukn S400+eVghCmbuXoR1u1Bt0SiNXni3ouuvt/vICMj0PpiSjOoXUurKWyhF+uihXW0DhOB MRYA== X-Forwarded-Encrypted: i=1; AJvYcCUucunjsZQ4g3Pwv62meB+e6lCOeKx/K33nm94xinIQyrYCCgXtNJ4k9g3UaGYeMIa/ICF9xNVxyEFd5VCGGh7U6p3zySuIzByv2V6a2IY6a5zossQ= X-Gm-Message-State: AOJu0YwQnkzF/eHcEW5b0qlhwcaRxN9FNLTDUUoQG/jXr+i0E4ufwK8s pN+9IlEN4iIhpC3A0GtmBnSmb5Tzh30IbgcK4j7viLclJqV+iOz+Ko5limWu8yc= X-Google-Smtp-Source: AGHT+IFg3qLWNvNwUnn8P/BhJ5Ietz8B1yvexMNQAGrgiWUo0KCF6uBK6Sl80tvi0CllLESKTMuoaA== X-Received: by 2002:a05:6512:47c:b0:511:8c4b:8f49 with SMTP id x28-20020a056512047c00b005118c4b8f49mr2517416lfd.25.1707746635085; Mon, 12 Feb 2024 06:03:55 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUZE3PZkuKNAn2tR9aGo/I3vn3MVfSpp0JHsjBEZGcqPndunlQiZ8aegoxwuwC4jHefmlXyK02+DbV1HsXe+NnjulQIIx+vPoyuFOuDByU7sbr5Lb1oirG7j/LpWtOKn5nyYsscuflY7jQVf6iFmkkOCV5HqaybQWIwT9scB4ok11j2S1V06vgx8M1eu/V/2AvalKNEUwqko+NajGDMV/qcWF1RtwQ28cvCgqKg/5HUd1Rj2Y9zaxl1Yo9mrd41Su/ETC/2Il2poJ9360qNqvbLHQ9iWTvrdZEVwwII/F9jpuObPz5zcmJDDpZ8+k//jJMyLw8AYwW0oe8wNHFhR7FQnFZyscudTJNSsA6Oy2FA+30nnZ6opVKyU4yQOU9BE+5wbKOKLTnhcT3KIQtOneprgFBM2p7TDaCwbwkOO2/CtoezA4XVGC3qM0BRd/lXyrMIOLcrWdNIEp7jnhKJQMDeJ58snE1PM+xlRQRVJJepzG/bSul105iq7ZdqVZa6rVCvMRuG8sDSurqjtt5vTU+3uTKuTaGxh9ROkI79hj5T6XE3Tl1Ff8oQc5tXsL3HQbEMx5gmMQ5lFjM2K7N2v++SHsyq7OyIi0ABiqadyhEl/8vcreY= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:54 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 06/12] spi: s3c64xx: allow FIFO depth to be determined from the compatible Date: Mon, 12 Feb 2024 14:03:25 +0000 Message-ID: <20240212140331.915498-7-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060357_462830_4461C187 X-CRM114-Status: GOOD ( 15.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are SoCs that use the same FIFO depth for all the instances of the SPI IP. See the fifo_lvl_mask defined for gs101 for example: .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, Instead of specifying the FIFO depth with the same value for all 16 nodes in this case, allow such SoCs to infer the FIFO depth from the compatible. There are other SoCs than can benefit of this, see: {gs101, fsd, exynos850, s3c641, s3c2443}_spi_port_config. The FIFO depth inferred from the compatible has a higher precedence than the one that might be specified via device tree, the driver shall know better. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b1c63f75021d..68f95c04d092 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -137,6 +137,7 @@ struct s3c64xx_spi_dma_data { * struct s3c64xx_spi_port_config - SPI Controller hardware info * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. + * @fifo_depth: depth of the FIFO. * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's * length and position. * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's @@ -159,6 +160,7 @@ struct s3c64xx_spi_dma_data { struct s3c64xx_spi_port_config { int fifo_lvl_mask[MAX_SPI_PORTS]; int rx_lvl_offset; + unsigned int fifo_depth; u32 rx_fifomask; u32 tx_fifomask; int tx_st_done; @@ -1263,8 +1265,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } - if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", - &sdd->fifo_depth)) + if (sdd->port_conf->fifo_depth) + sdd->fifo_depth = sdd->port_conf->fifo_depth; + else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", + &sdd->fifo_depth)) sdd->fifo_depth = FIFO_DEPTH(sdd); s3c64xx_spi_set_fifomask(sdd); From patchwork Mon Feb 12 14:03:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553316 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59C9EC4829F for ; Mon, 12 Feb 2024 14:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mFy/KBZ2Cb8iElfEdiTbMlmtTMU83LpSmQiQnZLz740=; b=ZqiWk805cXMmP8 DZQM05Cgxn+0PB5wqDL6OyUGV3InxHAjssGPzxlo7phVl0Rp72mx09TgutibtoEAhZ90ce6iPX9OW 3utMdF0ppt4qujMXkFfTxTsWtxEQmT8t/IO5q/wsIxYB+5XBbqNHsdW8mz5k3ghcz6TysQVB0tLL8 i2vVkl3wpCYWl4Rch22VRhpWeF0YKZgBPqMoHicYWPb8O/jR/nmMlBpPz+fImQYyN1+9ICTnxzl4d wB8b1u2qjqYX3mgeRD34bZIcShomo6dtAVszSrQtOOZc6ofgro3VNsN7v/i7duSfptjy0JNLdb6X3 pXO0zFSwkdCp986RV7Zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWus-00000005h1i-1YJl; Mon, 12 Feb 2024 14:04:14 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWud-00000005goP-1OL7 for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:01 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-411a6dee71fso970305e9.0 for ; Mon, 12 Feb 2024 06:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746637; x=1708351437; darn=lists.infradead.org; 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=TbvKAanWHb5NHCc78DYWj3IudYbRJBQeeD4twXOiMjs=; b=qSsNpau9UAXmbUW1lsKPitiTCBUSsx17f5zfZ51mKxPQUyLYKSe1O5s9tLUi1IUv3r sRhBSVaF26DgvVjtIBKSuIEOL9lThd6oTP6doQYU7fFGNZQ531lyiSkrZh1aT+6dbDL/ twqpLWnyuA8h5HhP99zeeHlM4Jq3BxPW0H1Ot3LmbOsMZvLa/KWfeLn1rKNT+GvRFRuk +67+Q0HMVlq/JLCuAWyYewwUMiSimJNC0uBBSwcMn0zAPH+u4s/2NWCiQgUvcQj0/Pnx epZhDIxthoLanN5oFT4CbOnDkAGflZGuKuhUPwc0ZDoH+D+1pZMQoCBHC8w0io3SiRyE zHmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746637; x=1708351437; 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=TbvKAanWHb5NHCc78DYWj3IudYbRJBQeeD4twXOiMjs=; b=QYdBiZhvA3BW5rkSjT1WkCKgYous3LxKwTXT6THq4+12gFPlV0lCv155OwgMooaGVn noqRaExL+dkrlv5zSRO1sI5ZyVz5HBVdzgQahzDyQSBl3wetMbwZkNzjGh7G68yXjg8F ap5vf9BYBjweWbsBdqJPUG0XYFUxy/aWZO3R5NWnJe5Y97eHE/5C7Ux35ryyEOgIBIMg bWXCvSFM3VwRa+cwcv9K0SEyqEsPL9ofzRc8sg8S5Sq+klfv6uS7E5yPZlnoN6NGrEfV Jp6o2H/YGoyJ1e70D4O0V1Jj33O3Qpk+QWS8ZhESEqwB9SQrM37kKKPWw4ZoWHEdq4eJ zcug== X-Gm-Message-State: AOJu0Yyp+nIrdx6ojvW8mgpIRpdq53sxIawfUxeIMyk81rB8qTL5VUbX 2g3jQ2o/S/pMiQSFMjKwPbfKMYz00R/uH1zZPCYJV9zl2vgrfq+wWRCmejh9pPo= X-Google-Smtp-Source: AGHT+IEif4Fg7pSF6wN8emTX0pwbAdYoKZjFc03ubpGOGgiV2E/6mDETDnx3EoITL8YannPLkhJeQw== X-Received: by 2002:a05:600c:602a:b0:410:9b48:9272 with SMTP id az42-20020a05600c602a00b004109b489272mr5049483wmb.8.1707746637405; Mon, 12 Feb 2024 06:03:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX+EDbaisOa+6yIrGqWWJq40OpsatdFleMrj0aGtjiVtvx/JwCZfrfa1FjMCYZVt5AX0x7cAHzHT2sXjTjmA8F76rUdDvpoxl6vwfzYL9ytEofC5FsJksrbvTEChnZAjfUAyZ/A0quDuPRPwy/oJjkewzO5TBFmfdCoApBdCVS+tgqGlECF2Fy0/fheMtV/+WJMk5Ri68RYI3Jhp7NzOwM1TwtltB9NkXYLt7l2tRFd3MhrPsvsxa0UENb6w9qMwUdXDOChwP7wVOkWMbMnXh86vI95zN5uAkPpGVBi/HNfRElHDTCMLrohDEr0Zoxh4OuUAwMgBYTqW/ATCf96ZTbzFYrjLtA3DhE8vRKuwgL+gG5DCc3biGuMBoM4TGpvUOcXYFOwvRuSUkC6bc0KmeWdEDTJuvqHO8kKzW915R8ZtfKFZ1CctnwWPlGQz2VWvygY5M2EWvbWKxwE9sGY04c0umwYOjQRMMuW/NDN9RTr70AdmRnWDwSp7bLAdx8HPuybGXreVnzbvxDgIgzYJIBmJX2SoyOPZ3eAGViiU/h695HMB1A8HgH8MBdmJYfOnxa8i6DgnqytHWiktBqwNkUcX0tr9Vz/QkIlL2cdBXOCXxwpSRM= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:56 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 07/12] spi: s3c64xx: let the SPI core determine the bus number Date: Mon, 12 Feb 2024 14:03:26 +0000 Message-ID: <20240212140331.915498-8-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060359_709666_86E106F4 X-CRM114-Status: GOOD ( 13.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Let the core determine the bus number, either by getting the alias ID (as the driver forces now), or by allocating a dynamic bus number when the alias is absent. Prepare the driver to allow dt aliases to be absent. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 68f95c04d092..ac47755beb02 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1279,7 +1279,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->rx_dma.direction = DMA_DEV_TO_MEM; host->dev.of_node = pdev->dev.of_node; - host->bus_num = sdd->port_id; + host->bus_num = -1; host->setup = s3c64xx_spi_setup; host->cleanup = s3c64xx_spi_cleanup; host->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; @@ -1360,7 +1360,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) } dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Targets attached\n", - sdd->port_id, host->num_chipselect); + host->bus_num, host->num_chipselect); dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\n", mem_res, sdd->fifo_depth); From patchwork Mon Feb 12 14:03:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553315 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1ACE4C4829B for ; Mon, 12 Feb 2024 14:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mufy2oILR9xi5VIcYpeZ5dp5NCgW4IEeFLN9nz++7wU=; b=xJ7BoDnAwfBXCF +snlZODMktcVS7sumh9VYCjOgmDVo9NNlqJ5hnQ/cyvpLPSNju8UHvosNcWLalo8+uCnLZW1DPNKq lvdgXAK9FpOQQXJEsPTdxZ4QtfPxoqXdNYSJ2LNDqoWztPlOetls470T44bWPKnAVrhvZ688evwTs Qm3Fw70TuKlmKY6WW0xbXb1sG0U+Tr4d+d3KoVfqFJ8tpZPxUkSflcGP9AEWQvEJUSSFJHa05G4yX KrxOuTlqBQqba7kd+2yS2JSBcKPdp+9fX4J2hCdnIRtxB8hHpC7XeNwEby4t0C+gdjTPuHo5UjI26 K5+w8ragdSyUMXRLo/JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWut-00000005h2V-3Hmu; Mon, 12 Feb 2024 14:04:15 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuf-00000005gqF-0njY for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:03 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33b65b2e43eso2301052f8f.1 for ; Mon, 12 Feb 2024 06:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746639; x=1708351439; darn=lists.infradead.org; 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=OTrzZqM2Ss1d3JLf/TDWyYpLJTs2h0kZukw/0ZYCnhU=; b=gRtkwRU+xxJquSLgqnsUssUoJ8CKHzbP6yVmkqzl5X+wzebtg1alED+l0WngNRQTlW oJgBmg6oCHDmEGO3YLF1flsgwbTjfwm45aGVAI7o7leZ4caTYvjovScjh9yVr7a7Av9y SwOdYjbGrNBo+Uzbp0LA71+SxeN9WjnoKd0fbZwAPHfPaZRAbgONqHeBGNLomxtG/qgx /pYZXKUC/ofQFGrR0AAknnCRqkd5ekuqic9MpCkhIloaayLmIqHaU38I15JdoGbhu0Gv t3Ww+OIUlymMHLp0s8qkP+JaD+O8dgEnyXigimB5s1/MtWkMQOGHdVvju0Gxh1tulZIM HfjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746639; x=1708351439; 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=OTrzZqM2Ss1d3JLf/TDWyYpLJTs2h0kZukw/0ZYCnhU=; b=c1dKmyotlYrQzVvg0PounJF2Sgy/QFmGMpypAPmmh1wEav2kXqGm20JAJ3gT0r/gB7 kCAP0b/NV8H8hxFrdIYMBPZp/cFS4TkXSnKpGFQ2oWjZ6fdBttQb9LBiUAmkUNwD61hV c5DxRfLwXD4kYLyihuBJjAM1bYF2iQojPcxPar6spGE7qJ0wiPzU7yob48Gvz5uhrxBx M7hV6IYJVG74xTZcjO1Hc/VJds9N+oJlfnjyk+uIhcQgWmgCcELYr5ZhDP3MvdzraoK2 YbTxvGyk9O1bW39H2kE68Af6kMptlfa2vFflzWqfgk+FZO8ghkkAOiUurtn1lOgilqCU jIDw== X-Forwarded-Encrypted: i=1; AJvYcCX5ge2CfQfGiycvDsuDkk2SgP7sZX0al+5v8caaEGJ8e5W1JSf5kR7UN+Ba0QZgVpo3fsGKQjAbw62yLgfUq5Acco80OWcmThHTehDsaHHdLJuv5aM= X-Gm-Message-State: AOJu0Yx7obR0eUUVOaB6BhBowb3Os4PwMLRYvlcqQ0cy2BwGPkFdgfch c/bejdrrDnJFBdECAFxtef8RmOjnUv4xfn6fr4W/Wumm+KRTtR2yFDYWmb/Yalc= X-Google-Smtp-Source: AGHT+IHe8AP9Dw8wolP7N78fXQjkB4Fn/h8j7Uc6WIIgess7pG3SedXldeeOTzKTSsK/F0AG9gZq9Q== X-Received: by 2002:a5d:65cf:0:b0:33b:1bcc:3be5 with SMTP id e15-20020a5d65cf000000b0033b1bcc3be5mr4450299wrw.71.1707746639324; Mon, 12 Feb 2024 06:03:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVlANfbZ8m+T1LP+cim+3GEYRHtlP15t/9gHZXViQTDofn14kjIknDINvOVYOR6vmxFlfUStZTWdOG6zC940DM9gEdcSYpAJat7dHZV1/GhpmuH2mkIFZeX/wzm256H3ItmSWgzRA5gXTwu09J9l9sECJz9CR1926Hrn2JUfE0uTHRJOcTAHOxgv6FxIYNQkujb9XEvvdGgF8ZT6lZ0XjYBjXbcdWooyZLKfQluQM8C3Eu4gnkkJmKAhZOmA+mmxxFqSl1YdQvWSFVDvN9p64Nfbp0V2rNMTsgDWac83u06lQNq5awYi0RPtLwaBE2tptRRDl0ZU1z3//WjnDK8IzkJewItN/RaANod2YfTjR8k1bza188Af6A6/ni+T4Fag2MouhZVapoYhCyDyH6sMOSs0hxNJWIbVKfDdojj3E9Rk+idLKFA+Ac4w41gIWPCYInt4i+o0ufV89VDDcCb+fggUhvaCsLIuBn4B/C+b4Xj2oM8FgzoEQ/NHC5Cgc1w17cgxld0qWhJbGMRutqJXlX2gTRHfgXkVlS002uP42NwWWea56Ocq9/zrvG3T3MW6P9aHSvF731DoqYzxFpCPF6j0CxIWVp9TcljJdlXquuBfwTEQh8= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:03:58 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 08/12] spi: s3c64xx: introduce s3c64xx_spi_set_port_id() Date: Mon, 12 Feb 2024 14:03:27 +0000 Message-ID: <20240212140331.915498-9-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060401_405373_311517D4 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Prepare driver to get rid of the of alias ID dependency. Split the port_id logic into a dedicated method. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index ac47755beb02..40de325bd094 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1200,6 +1200,27 @@ static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data; } +static int s3c64xx_spi_set_port_id(struct platform_device *pdev, + struct s3c64xx_spi_driver_data *sdd) +{ + int ret; + + if (pdev->dev.of_node) { + ret = of_alias_get_id(pdev->dev.of_node, "spi"); + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "Failed to get alias id\n"); + sdd->port_id = ret; + } else { + if (pdev->id < 0) + return dev_err_probe(&pdev->dev, -EINVAL, + "Negative platform ID is not allowed\n"); + sdd->port_id = pdev->id; + } + + return 0; +} + static void s3c64xx_spi_set_fifomask(struct s3c64xx_spi_driver_data *sdd) { const struct s3c64xx_spi_port_config *port_conf = sdd->port_conf; @@ -1252,18 +1273,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->host = host; sdd->cntrlr_info = sci; sdd->pdev = pdev; - if (pdev->dev.of_node) { - ret = of_alias_get_id(pdev->dev.of_node, "spi"); - if (ret < 0) - return dev_err_probe(&pdev->dev, ret, - "Failed to get alias id\n"); - sdd->port_id = ret; - } else { - if (pdev->id < 0) - return dev_err_probe(&pdev->dev, -EINVAL, - "Negative platform ID is not allowed\n"); - sdd->port_id = pdev->id; - } + + ret = s3c64xx_spi_set_port_id(pdev, sdd); + if (ret) + return ret; if (sdd->port_conf->fifo_depth) sdd->fifo_depth = sdd->port_conf->fifo_depth; From patchwork Mon Feb 12 14:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553318 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AF0CC4829B for ; Mon, 12 Feb 2024 14:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kbxLs3ig8Uebw0Iqx/CxobOJCLWmrf7Mijenv9ITFww=; b=jnDawls7mPpwiq MyVg4/IzGt8yWTanJE/72reZP5QjNPqblQ5PArawhuE23zcKKM6Wd2GawhZfnH2w3F8SKtF7gNaK7 TpjHzZZNy3n2yxkIT7a6HRk90CtC93jhfrzxty6BwYMkD4TijibaSnkteG/KW3aEv3cGISYApbRWq pCWagxokDLKieLDQRh6AaJy7ODDJfjvxKXbBK0UGMMGuzZterBCAzXMB/QjaXepAcaft4N6UBgY4t T7Y69KuhthvvIWZHZF/AEOu4O/VQtgOpYqswcYKdMcLDzZF2yWjiyZBJDGbQezEkIMCKWy060zqTj NvlMOxAnaxKCOoVQNaYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuv-00000005h43-2Ve4; Mon, 12 Feb 2024 14:04:17 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWug-00000005gsA-3brx for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:04 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-410e7b08252so4838285e9.0 for ; Mon, 12 Feb 2024 06:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746641; x=1708351441; darn=lists.infradead.org; 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=mLhU5Fpjpt+G1J97uCF7eZiB9eQQAYSw34EErx851iQ=; b=xzj49XkeRZjwhZK7a/lgL334F00fNL1trMx61ymQOQ2DWg/ZNW7PX8QrRPe40qzdmM D1l/fTQX89PvKxC+fsVaiUQYWH7AKXphq48lL7a2Fmh+SZkTs8zvowlOOLNSeE8LLWuy 4wt7FZY1IrHUA0rpWmVycBFQ05N0+Ahwf/oKY5Z6+RQVoymRNCHa4V2wBodllhXJokmg 4i4WGQMHI8t3GF3V6cji3o/eiomjOPTwD2wyuMl/4tUXW7GZ4BbFSxrt+nZw55hov5V0 bwe6ySF2D9FeQ1n3TZazWFvrKSa+18mOJEqPi8z4XhsIC2pH6iva15i9M2VdED/UopAo zPNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746641; x=1708351441; 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=mLhU5Fpjpt+G1J97uCF7eZiB9eQQAYSw34EErx851iQ=; b=pW0aEw+p85883sGrXbC69a3ivbTs1hCp5EEdbm3h6oUgaaLbCDHbboD55VinIRNI0s A55rBFheH9bmK6bnYUyC+tdaDGj4HFWKZ6vKsbKNj9wpDLTtpE3Y7PiUBbuxdDollw9Y 6EdX/w+Qrh7mW/b7kDoyRF0ZcF3EtPIV7vmzrGq3vjNhJ0DT6wWHl5sOqPXaJnG4P6Fh E/BkB6FTNEod6ThOJEVhcVvpkepR1IIbMw49QjvQNXlobE5VlkNUS9ROEhqCklt3PJus ayxd7fUps4ZsteBSARUN4lht0mV74ZkLAKEtna/Eg/S/PqAaCHZakIAuf1Vt3g9O0ExL LoiQ== X-Gm-Message-State: AOJu0Yw/hdpW7RKBufHwTjZ5mPa8N0E3VzAv5JL0Tvis3dcc/9erblfY 1/gQig7lOAwedFAqQKA4DO2oHLSiyqiRbfQuKsJf0XqanwYiEgLryb9I3MQJjFA= X-Google-Smtp-Source: AGHT+IF/I723HEKivTWirm3wyE2xeXsOblRKelpXELYMdzvVNFfyRkU9wYHLuZqgHwIuGGr1Jyru9A== X-Received: by 2002:adf:d1ee:0:b0:33b:649a:1a12 with SMTP id g14-20020adfd1ee000000b0033b649a1a12mr6445402wrd.55.1707746641214; Mon, 12 Feb 2024 06:04:01 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWKfTIxuJNqeqR/0k79+N4mN8gU3DXXgyJK4cNRl7jc6UrPjOB03vSpehxjuCkSsz6/jiG7FClGbwtsjghFuNXQwQ9jn5Bzhh10HYoH+LR+iNk6rL+mkwWyVZC4tqZ7n4pH97ux2mhKRVNYLCuAs2pYCBzoxpPcb+Jg9jb9NSAOGY74ZqPLkz/sqrRPbBv9wt11ITpBvwqnJw1JGZCP/O3Es7J29u92JTs8NgUbXXt6i6nab3Qw5bes/PZRwIfV6Cqr0yD+Ct/7QXjG+cxeSpOxSxAwAoz9pnsl7zMGtVfecnl1MCsPQHBxZwj+2+l0TtGxx46UzXkMU+P2QhNduIeEPMqyteM6AsnisKqNDB7flvOJNoeLJOnB2GsuXnZM6DXxFY9CzWEXu1kHGm8qpy9NYoaRJstzXEVvZxPaWGfSHECTPVVK3eu17bkCd2cIoNyi+W3sy+QGOChsvnoO547YoF8j3d5eZx4PR0NSOI8TzCT6Rp1H/fNzG0f65rTc1S7Y6jFXWI6BrG0tpsagVTm46rbq30t2LGVeU5jUtYFgWq7Ifn3ug6m3dHpEUUO7vceZa3Auzygr3yeYeKcZnWF+GxbEKH0h78rK608lkQ910F0CMi0= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:04:00 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 09/12] spi: s3c64xx: get rid of the OF alias ID dependency Date: Mon, 12 Feb 2024 14:03:28 +0000 Message-ID: <20240212140331.915498-10-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060403_052344_63CF20FB X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Compatibles that set ``port_conf->{rx, tx}_fifomask`` are now safe to get rid of the OF alias ID dependency. Let the driver probe even without the alias for these. With this we also protect the FIFO_LVL_MASK calls from s3c64xx_spi_set_fifomask(). Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 40de325bd094..d2d1c9767145 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1203,8 +1203,12 @@ static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( static int s3c64xx_spi_set_port_id(struct platform_device *pdev, struct s3c64xx_spi_driver_data *sdd) { + const struct s3c64xx_spi_port_config *port_conf = sdd->port_conf; int ret; + if (port_conf->rx_fifomask && port_conf->tx_fifomask) + return 0; + if (pdev->dev.of_node) { ret = of_alias_get_id(pdev->dev.of_node, "spi"); if (ret < 0) From patchwork Mon Feb 12 14:03:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553317 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1270BC48297 for ; Mon, 12 Feb 2024 14:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bA0t0GS1TmdXuyXO8dRHd0j1Mz+9Is2Y4Vgc7co7++E=; b=2qzjPyqxIOK7jn saOzL/BIfrt39S/E7Q+HfTQCt8DkEi8xzJFjOyB63fVyW3Tb8yM2S11hobCwH1KgEssQx9Oe9ekWE Af/EZXXHJOgYK/62ETX8/ZFhF/gXALRwJpoFfYmzOue11ARpBg2oZfXvsogw07QLBopzzagiGSqb/ F8z4BHkg4/9+5HfT+U1qNzkUtVV8FypvnvRQ+oy7YM1ajhNgs5JSECLiL4dmsUjY1GZxrUp4sldQA SU/PevUcWhUBhAbd0hD3Gi1eQ8hFnEnHaSrAp4NmDuD7cAVy5F85GQdA8ypyDqQLONlEWRhu85jB6 uD5OmMdBdetZ3RPLOViQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWux-00000005h5c-376T; Mon, 12 Feb 2024 14:04:19 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWui-00000005gtO-1cLH for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:06 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2d0a0873404so40234071fa.2 for ; Mon, 12 Feb 2024 06:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746642; x=1708351442; darn=lists.infradead.org; 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=fm5OjWDCnevgUex+kbg78oFWzlDeXhj9v/6Ap/z4iAc=; b=P6g7/5S716U8U0mxOKqEWpvmHDJyVWqgIUusC3Y2gRvL5d3Lw8OuRmNxjLDk90RX2b SATkSuUZrk8viWekygXfdtph6nHwnX57vET6iHoOOQ9BkiIA2jQOUVyta1XSubKtBNK+ FOZcBOmQye8R2aIJLEvaNmTCa01z6GBitDqT193aBKkX5UKzoAkmPQC9Baff6D9oDjIA bf7bRVHGVWlkB/8NcQ+hcRNWPvVqJuUh2oyxezdyEgNXO37aBxI7j82bXlRGMUQTozBI aeKuyYWSxKSSq+n6IgsrfK39jZl7VhTk3oS9WK2JSZwn2v06uPV84UGjyRTmTgqLzJHC ltIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746642; x=1708351442; 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=fm5OjWDCnevgUex+kbg78oFWzlDeXhj9v/6Ap/z4iAc=; b=OM1OcUUjHKgn2nKKj5tsHS/jCK3MQRgQiMDW00iwxa701lh9/08dCAyYchswclpax/ w6w2pGAjHn2AW5jfs9NQK6AxGDa/KILFmtvqrw/mBoJvJGl0JDibwr3vEA1FIOHaCfzh eh42AuhK6EhNVVunIa/+CpxNpEulCY8+vrk1Iqk62GH0sEXLid4y0U+J3oHZCkA4Y1QZ SYecjG9pLBbolMYjN8jRXElMiJZcTLUS+h0sjGIPRCXOrnk15FoOP83ZATKc2TRoTK+x tT1wt0y1i5zmiuEHHtUUvcqcQsq1Q/IJmbb1x8gQCbQ7JixKnktmp6Mr1kGXKTKm2eY0 FSSQ== X-Gm-Message-State: AOJu0YyXYovDs3LkFA0NYdRXYc/bKZnJwLGLZLpK3QLv4wOWd1D4n5fV +5Lp1bdYeM1HzrnSK3Ql+MDHSA7RE1RwtnoANRqjIPkODRsAQVfU2Qf3+XYrVbk= X-Google-Smtp-Source: AGHT+IGUIOvKRBRsfjSEIyB8DOQhE2eTT1a774d0nKCIqNflUbLuzYQJzNDyMoOhnfr+PcoGd/Rrvw== X-Received: by 2002:a05:6512:124a:b0:511:75b8:43d with SMTP id fb10-20020a056512124a00b0051175b8043dmr5341182lfb.51.1707746642294; Mon, 12 Feb 2024 06:04:02 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWx7j10LZCHyERDVGFgry/bMvmTXoQG0iad6IA1WhP3EPiq2hNoFJ55VUGWl3Jhb3RmWvsMC5iALJfrTdzlWzu4QszLM0aAYJbmET0+LYZyHQHnhPkj7H9+cp9P4V3xu7UJbz7BjaWqXAZOv4vhN4s+A54CYbx+lruTavNVW60QaeMulJqFyukDVg+2BKOosYKyrC6vSnjxfZ3EGw5Fl6q9OQvfEJ1f4PwQXXWLLHRL8Z8gToZ0zCPJZ+TWvUcLW/MC9vdr/ygipoxUSiAUntCy4BdNkIi3pJplxCC9+wcO60t4zhT/i9TWcdUS901ZnTxDR1d4YM6ZkT2IZPi59pH58dqQy7u7WfrlGWpVMVMAPzMg6nRkRmcaxYf6n78yfyNNeGeuKAILXOWyCBbnFf04NgM4+RK2hsvdX1le9bNfgfi9YmYAWLc7UQ/gIbRI8nEOn3S73iNkCvIshhRNQWlaV61A9NxoEwOdOWBzo+dfTqHUBvrzsOtD3z6EKLGIBrK+H0s0dt0IK6doooglzqgwXt68nlCgSDArWEdtyewzk9rPj2woRRC+sVme9uR6ky6jvo6g/Er45i7JTr0xxgUGTzIV1wKpGddX4ZI/Ot9kRzL3Ks0= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:04:01 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 10/12] spi: s3c64xx: deprecate fifo_lvl_mask, rx_lvl_offset and port_id Date: Mon, 12 Feb 2024 14:03:29 +0000 Message-ID: <20240212140331.915498-11-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060404_522616_7CE42738 X-CRM114-Status: GOOD ( 10.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Deprecate fifo_lvl_mask, rx_lvl_offset and port_id. One shall use {rx, tx}_fifomask instead. Add messages to each port configuration. Suggested-by: Sam Protsenko Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index d2d1c9767145..128f4a7c4bd9 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -135,8 +135,8 @@ struct s3c64xx_spi_dma_data { /** * struct s3c64xx_spi_port_config - SPI Controller hardware info - * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. - * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. + * @fifo_lvl_mask: [DEPRECATED] use @{rx, tx}_fifomask instead. + * @rx_lvl_offset: [DEPRECATED] use @{rx,tx}_fifomask instead. * @fifo_depth: depth of the FIFO. * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's * length and position. @@ -192,7 +192,7 @@ struct s3c64xx_spi_port_config { * @rx_dma: Local receive DMA data (e.g. chan and direction) * @tx_dma: Local transmit DMA data (e.g. chan and direction) * @port_conf: Local SPI port configuration data - * @port_id: Port identification number + * @port_id: [DEPRECATED] use @{rx,tx}_fifomask instead. * @fifo_depth: depth of the FIFO. * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's * length and position. @@ -1508,7 +1508,9 @@ static const struct dev_pm_ops s3c64xx_spi_pm = { }; static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x7f }, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 13, .tx_st_done = 21, .clk_div = 2, @@ -1516,14 +1518,18 @@ static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = { }; static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x7f, 0x7F }, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 13, .tx_st_done = 21, .clk_div = 2, }; static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x1ff, 0x7F }, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 2, @@ -1531,7 +1537,9 @@ static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynos4_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 2, @@ -1541,7 +1549,9 @@ static const struct s3c64xx_spi_port_config exynos4_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynos7_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff}, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 2, @@ -1551,7 +1561,9 @@ static const struct s3c64xx_spi_port_config exynos7_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff}, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 2, @@ -1562,7 +1574,9 @@ static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f }, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 4, @@ -1573,8 +1587,10 @@ static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynosautov9_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x1ff, 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 4, @@ -1586,7 +1602,9 @@ static const struct s3c64xx_spi_port_config exynosautov9_spi_port_config = { }; static const struct s3c64xx_spi_port_config fsd_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 2, @@ -1597,8 +1615,10 @@ static const struct s3c64xx_spi_port_config fsd_spi_port_config = { }; static const struct s3c64xx_spi_port_config gs101_spi_port_config = { + /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, + /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ .rx_lvl_offset = 15, .tx_st_done = 25, .clk_div = 4, From patchwork Mon Feb 12 14:03:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553398 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CA8BC4829B for ; Mon, 12 Feb 2024 15:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bNHtmJtwKssUC5vR4XUbR4SvGZIr1IonTYOHMP+84I0=; b=U5ZtBPwQvoPfe/ oM/bwSyqS0L0L/rpn7E11Cu7J9D+rOq+gKLHhn/eEndaRbQHJ95nW58GLRkYKWz5U9cQ1PsXOs78z CM2fH/E63Jpehe9gcAlLJxW9T0MZq7kr7RY9TciBnIe58i7TXux8bBAG7C7E0YrpUxC3N279Sk5Pe ZGdDnnHJXo/hWXv+CbzCYBg7k6y4YZ8SSbMIw1wZ7miyDzuXVxS2X48+qRYfgikJzcCYSQ7ohU0T4 B1FmJoP6TVnIjBmHJTO3sOkpOOaP6+8oPkEkwbulO5f2VqBg1SpZiFBtVZDwxf2KF5M5fkMrdkON7 1RiA9Q+kac7JlqYJ7M7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZY1h-00000005vJq-0JaO; Mon, 12 Feb 2024 15:15:21 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWui-00000005guB-45Jl for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:06 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-410e676c6bbso5053485e9.1 for ; Mon, 12 Feb 2024 06:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746643; x=1708351443; darn=lists.infradead.org; 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=udqvUgYDVsS9rVyQP0088IyPNE/Fw+GtB3VqDzBbwLA=; b=tMwnkcJscTqSC08rG6p21iXR0Nu+N4cc4OjdbWEBoz3xEo/MKhfWWXmxgK/AQ0Trv6 yJdZgYsSq/3w5CYCubQMv6XefCaB+Iy9npNebz8UtmKGG1w9RhLoF/pbkOo0lpNQm8wq +7eFqMO4layYLFNUI1/1qNac/9uf9ZsaVn0+EOY0i9+whxjpfWt1MCiiqKc2Wc+7u8Di 8AEgvqAg4mdqXfbeQBfTCh9EOjfyDiqUIvi0iizKq9qV9JbPNyfbK5bGzZQfKgn6P34C 3zRkYzDKqrMLt5H3x3RppZJW08jnAiI7QNL0dXz5G8lUuh6eyPTRQves0wBS9brmRU/p L1qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746643; x=1708351443; 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=udqvUgYDVsS9rVyQP0088IyPNE/Fw+GtB3VqDzBbwLA=; b=AYjFMMElRl0cCKw8f/DOtgUVIlWp1LfQZo9CNXNl1UviVCB9MuSwp0c2ZQTp+U9Lw3 OCqsgvhA1/+ld0rG5e2BfKkrvLjKnwYw8r6pK/ASfvpBP55brtM5rB0uh5ysdcDnXECo 6cRNOp3FD8WplcnvJcyP+dZmqTo6/KhZQmtGmUI71LtkUT5T077JmmMGL+PegrXVicgE xnVBa80jiETPdmseLMGKNtt4onzHrkJpxdVYHFPYIBJz/lnvfoTt4RpKcuEDVo2Rx+Fk pzknGsMkdgpIJ97kZflESbS3IT0OP0aCfVjPJDwbMSzp/NbiylqU1feuxbP4jcNdXUZc pWKg== X-Forwarded-Encrypted: i=1; AJvYcCXkYJFq+jf+IieskbRSAglewl8uyopDpgX5qs0zVu7u64n2n6/fJZTO5IzziLtrE4uqYUm/ScihpxedXuccC8jb9dJri51FvmlCHAZ7e+YjHaAUrQY= X-Gm-Message-State: AOJu0YxLidWtl+hm3M1MmTG/WFPcVtZU44Fss9eN8OSmaOgHQkfhkDQ4 WkeagISHk2R4Cg/uEV5YGz6041DixE9OpU4+QALVLzGfgl5jHuyePevjzc6jeqE= X-Google-Smtp-Source: AGHT+IEMMXdQKxatWK2R327HKNfL/Cp2DJjyblrjh7fUvinXXRtyMqvzQzj5/zw2ViY7B2zXs0pB9Q== X-Received: by 2002:a5d:6292:0:b0:33b:4d13:3e91 with SMTP id k18-20020a5d6292000000b0033b4d133e91mr5115418wru.45.1707746643714; Mon, 12 Feb 2024 06:04:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU2FhREuqbwRuKYJtya56ItSOC6CnVut+FGmVLLbrqotPpbXmQHGTs5li1wMy72vy87GpOFDt/vM4h/0TG3lOnc7SphXQnclCfqwX80p7gYrVyCZ9Xan+uONbq7HmMJnZILbB5EXb1FVo8CPDM/LBURBIySit05Fd4mtcRa+L6W5Uglc1Wr5r0bimOQGsLjLD7wkwNnbPcC4ILqKyAAPpJRkrJvpeH0V8xl38NIeJ3Gaz/iV3K4NdLbG+Z5pgA2aNH4c4GoE1+ieHikc1xIEss66dx7xn1hX5fWrHXT6Hoga6C+VDtSnG+yWEBwD1dxyEBLZ9dVLgjAN+Iyjl6Z81NTigF3gJUjjfcsdkVmSXpixgkORDZadXuPX9V8I67s8XL8zE3flMSasYWl7BIaMlxmd10j49UfBtUjDLu2DvL1wR4qRwAnTNvEGlpR8S7L3mHzC4AE+ofPHLSLx02qo1GuO737X20uG1S87fDbC6TeBw4f292opM/mwG7g3FHxR/qT/O2udQLk0TMBkMHAfPX2Jor9ig8+MHRh5kGkupMNltjn15zOJhk9e4nJJv+809lN1gPAdVhzR06krkILexHpjwrc8/Shm5XElDF+vkLAAnSg0ys= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:04:02 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 11/12] spi: s3c64xx: switch gs101 to new port config data Date: Mon, 12 Feb 2024 14:03:30 +0000 Message-ID: <20240212140331.915498-12-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060405_113832_865C032C X-CRM114-Status: GOOD ( 13.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop the fifo_lvl_mask and rx_lvl_offset and switch to the new port config data. Advantages of the change: - drop dependency on the OF alias ID. - FIFO depth is inferred from the compatible. GS101 integrates 16 SPI IPs, all with 64 bytes FIFO depths. - use full mask for SPI_STATUS.{RX, TX}_FIFO_LVL fields. Using partial masks is misleading and can hide problems of the driver logic. S3C64XX_SPI_ST_TX_FIFO_RDY_V2 was defined based on the USI's SPI_VERSION.USI_IP_VERSION register field, which has value 2 at reset. MAX_SPI_PORTS is updated to reflect the maximum number of ports for the rest of the compatibles. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 128f4a7c4bd9..784786407d2e 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -20,7 +20,7 @@ #include #include -#define MAX_SPI_PORTS 16 +#define MAX_SPI_PORTS 12 #define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1) #define AUTOSUSPEND_TIMEOUT 2000 @@ -79,6 +79,8 @@ #define S3C64XX_SPI_INT_RX_FIFORDY_EN (1<<1) #define S3C64XX_SPI_INT_TX_FIFORDY_EN (1<<0) +#define S3C64XX_SPI_ST_RX_FIFO_RDY_V2 GENMASK(23, 15) +#define S3C64XX_SPI_ST_TX_FIFO_RDY_V2 GENMASK(14, 6) #define S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT 6 #define S3C64XX_SPI_ST_RX_OVERRUN_ERR (1<<5) #define S3C64XX_SPI_ST_RX_UNDERRUN_ERR (1<<4) @@ -1615,11 +1617,9 @@ static const struct s3c64xx_spi_port_config fsd_spi_port_config = { }; static const struct s3c64xx_spi_port_config gs101_spi_port_config = { - /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ - .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, - 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, - /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ - .rx_lvl_offset = 15, + .fifo_depth = 64, + .rx_fifomask = S3C64XX_SPI_ST_RX_FIFO_RDY_V2, + .tx_fifomask = S3C64XX_SPI_ST_TX_FIFO_RDY_V2, .tx_st_done = 25, .clk_div = 4, .high_speed = true, From patchwork Mon Feb 12 14:03:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13553399 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6993AC48297 for ; Mon, 12 Feb 2024 15:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZnlfsAUZboNhBXWL6Rtr9tVJm8VTMQiUED/dE5Ts2w8=; b=lhi3e8cf6pBeKJ oSHJsok84lwigMENUDZFIxOUlLT4jVE/A0gSh/k4r4g7TrL4pq5xrsprBwuEkMEPBIFkQ4nob88UK j20tZAwG0OQvNRaqdtbRs/eT6uVyv/7RopYPqppTURg2KSj8z7jsDo3nBTsmDy5gI1lq7Of/m3kvr zkHE3xel9Co1m4tOGYX0czkQ5hTul+gVTmNEbPIWFOnX1kNZMGa25RZi2v4csLDDyMjgNX5f4ikFS CKrBsB0BiH2up3/XyvmbbYi3E2xtauXLSM/GBkdV5EbRQxNBCVDNok4XCOob+uGLTy79d17vYL2Vg 0kSc+IyjJJUOJmARkT5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZY1h-00000005vJy-2qFg; Mon, 12 Feb 2024 15:15:21 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZWuk-00000005gvY-3usC for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 14:04:08 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33b815b182fso685390f8f.3 for ; Mon, 12 Feb 2024 06:04:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707746645; x=1708351445; darn=lists.infradead.org; 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=dzqxKaIV5lycuIt7a1okhuIIh6nU9oeZCJpLQ+HKFAg=; b=X0D+p4o5evl1fe7owZpSXsHNJFE6dHFBy/2jVwP1sqG7DspMdP8t6Wkxxg1Hpxx/iM A0vZIbSk3d3rZx3M04pBzCjTCIKFGzbbrfOqd1Y1HRbFGeY6Sp1m/vva6GZeik1xCzQc oWD2B19d1VxS3smKAqM0mS/fwW56Wngo8zcsSnO6q404s+XrBrCXkZpNKZK0fe93rgdL HBHDS3ws6YoEjX9BOl7Ju5l/jdzsdhAt4YPY5YctoOP6BthPTRWrSyTPGAv6tohIULYD lyh5GJxyvssH2MlLzu0s5Zes/tCpaiNCXc7egJuRU/yICT4f6UrMuJPUb6apfhQhppch CCEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707746645; x=1708351445; 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=dzqxKaIV5lycuIt7a1okhuIIh6nU9oeZCJpLQ+HKFAg=; b=WTRy3I/1cmjqYNib6PSCy82EDhwHrOtdzY4IbkB9IQtaBtMHHFHPmTimHLTk0x//Qf vfitKzUgZl7NMzGgV1Xjc8c7IEY5SjkKgobcuINNPEGOf07HWg97XoiSTI/Za06/sIgp p1WsTsEwga+NoR3mDcZvRj3hC5vQnucYxz44D2zB8iivZWkl6kHi2GVfMbX7nMRaY54/ bfcNPdsT+4ejJmZB99TKzU6pOLHLFFfoADVcpxF1CvmbumY7mcZXa5pmmAViwe6f/sbg 8EpM5HhAT3zRKcKawh2JHV7W55DAIxwLmlbeha94++ZlXqSusJ5qp1ji0gPUVBgh4CmG 3mPg== X-Forwarded-Encrypted: i=1; AJvYcCU1KmVUp757xOtfEFSBCVWL5zht4f3rhrVDpEdIQUZ1eZGIwCOanCgLy00ZdjWJlCZnOLtJmbM42EA0LiQn37sYU2XG3Xu9fM4My5ca94AZIxRTJ/c= X-Gm-Message-State: AOJu0Yw/46T9jqUIaMzJ8a5nUNoStqeA9TVMDF46OHWtNLmVx3CbdYmx K3qDA1NhYXntoe3o316BudtAZlGV9azaKIzl42YLXtx04coMAcdM59hA47Pjq2I= X-Google-Smtp-Source: AGHT+IFy6aDhjr2oJ130HcAfkLOXkvU+O+ob16/LkBpNY5N4HcWxyaK6sZ3E8EGV969nAunN59KVVg== X-Received: by 2002:adf:eac9:0:b0:33b:7947:d22 with SMTP id o9-20020adfeac9000000b0033b79470d22mr2896136wrn.57.1707746645615; Mon, 12 Feb 2024 06:04:05 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVoAQdPDjEx05yUQKNJ5YW19Z+nEZfGE5BKVBETz8rQvifVDgKkiVcO2vhxCGv7I3abloAAQMUTrSt3HZUu1hnKRQmjgYWEdx3Fx417AKeLfYRrdURrCKf4u8fvJAe9X7N3swQHP6jLMIjBj+8WOHIMkkdBzWRKTvKoZbcKRxdNLc0ZI2Rw5uIUmtM+GGw8bid4nqe5Fh37dNlKfvZ/nlCDHIS8xr/6X1Z01RvFMZShuEoyxy0MGsUTpCHdLqJIFywsuWJTRiRWWhdFfATqmkIxEdofDlg5oqd9yJXDCAWhTEXahk9yFIK9T45xAWj1hcYX/WhdX4IMO2Gxl4F+VTObdCr+2qnUSjaxjCZxAZAj4ZxpNrteSsVEX/ErAfECV2CzTZWl2fzgQuIF245xuPavSmSrbyjpYlgFquvUeFtcRHqloQftpPqSxgbNGv20faz67RIPgKmiUoL+tT++3P/zr7X1KxetLFSF3QG7H2oPKBtk66Da+ISCcfq1f1171mbUEcMyJqwWdSAx2seFVEBe8+SV2QmKn5X1Zxs3VGwTkol4yU0hzrw7XppoOsX2GyE/kKwEIcEswoxvkqdETEZzv7Djj3EyuUGEaZLE9B/7v2ILTvA= Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm2135356wrq.51.2024.02.12.06.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:04:04 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH v2 12/12] spi: s3c64xx: switch exynos850 to new port config data Date: Mon, 12 Feb 2024 14:03:31 +0000 Message-ID: <20240212140331.915498-13-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240212140331.915498-1-tudor.ambarus@linaro.org> References: <20240212140331.915498-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_060407_061212_3BBA15BA X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Exynos850 has the same version of USI SPI (v2.1) as GS101. Drop the fifo_lvl_mask and rx_lvl_offset and switch to the new port config data. Backward compatibility with DT is not broken because when alises are set: - the SPI core will set the bus number according to the alias ID - the FIFO depth is always the same size for exynos850 (64 bytes) no matter the alias ID number. Advantages of the change: - drop dependency on the OF alias ID. - FIFO depth is inferred from the compatible. Exynos850 integrates 3 SPI IPs, all with 64 bytes FIFO depths. - use full mask for SPI_STATUS.{RX, TX}_FIFO_LVL fields. Using partial masks is misleading and can hide problems of the driver logic. Just compiled tested. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 784786407d2e..9fcbe040cb2f 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1576,10 +1576,9 @@ static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { }; static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { - /* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ - .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f }, - /* rx_lvl_offset is deprecated. Use {rx, tx}_fifomask instead. */ - .rx_lvl_offset = 15, + .fifo_depth = 64, + .rx_fifomask = S3C64XX_SPI_ST_RX_FIFO_RDY_V2, + .tx_fifomask = S3C64XX_SPI_ST_TX_FIFO_RDY_V2, .tx_st_done = 25, .clk_div = 4, .high_speed = true,