From patchwork Fri Feb 16 07:05:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13559619 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 094DAC48BEF for ; Fri, 16 Feb 2024 07:06:42 +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=g4q5CInl6SXHjnnoTEQ6UPTy5W6qhhKnfXOO06VDKew=; b=mkkirlKYbft/Hw JOZB7vB+cosN90Y09xNUFvEs+Tieat11+ABvTGkgW+oHzxUeC4spA1PccI0acDU5uS/XAd+8KXna6 J5cILFzsT9cmCj0JtF5A6MVzjBoNGsRssfAzoxMhAdbLVNpKNRSGvuK++yzGFd0XdFc+pSER6wks9 PdvTxr3oG3IGFexNJXbdFvtQATfwR3OaFnbozgir5bEyfr6Uc9hR4dhl05vMl6W7qpZpmb2X5de1I fEbMlJ0HwFQzr8nSJwW6Arndb2riazFkRmEiBkJQ6Q+klyNHRpnKnQeNbLQJYcGd2lRsFqZ1vfn8I ioRSu4hSVxKcq6GWbDfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rasIj-00000001JKu-0W67; Fri, 16 Feb 2024 07:06:25 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rasIT-00000001JAF-0IYd for linux-arm-kernel@lists.infradead.org; Fri, 16 Feb 2024 07:06:11 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d0d95e8133so20564581fa.1 for ; Thu, 15 Feb 2024 23:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708067167; x=1708671967; 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=hp4R5FqMMv454plXIhV7qJWhdTsbC/ksc+0K6w+UCm0=; b=dfssPjXdaPa7z2XaPe1d8Gmca2efR0g9k4oQ//kj9kMVFfhsM7IOx/tTznyMDNZsyq OcapjB9nYW3hJInWJWUjP57CvMcn0tz7DoT+77skrNDhXwD0R2MMQL9OFuqCNQqjN3RX eaQ584/SWkGHnmxOhp2NFtuPcLpTAHU0tJw36iNwDBT4dzAFKZWhz5in6Jo0mfS4vw0h ND/1lkE4Qdrt7bgk3uwVRkdymWErtFwOORkOWE+3eBJo5a7S9mCe3M3CByMlh9oA7J0A 5jIMmsZV7rO79UwtYPnwj6o0zGdZTiNXMs/vNTUDdbqaZgoTB+v5mcWi5RF4lxQMHgyZ ZZXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708067167; x=1708671967; 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=hp4R5FqMMv454plXIhV7qJWhdTsbC/ksc+0K6w+UCm0=; b=LgTmpc2s/9KJsvFZqBs8aJdmiYKCTrnClDBZVye6n/xdQ/qsHP3jwMKY1LKMy+g9/T CXSZ+FJ2Sk6HfQKqg5c9kv3H3jTMnt8c9pEtTMSJOTnhAqVhoBpDt7DhB6J8MB4v/jMr MRDQIUe8WuxvMTcVfyDLarlYkvkJFdO9yuTjFG6AzByyvYLzXNqJz4OAikgzmIIH+fh4 MCS9ggZePPuVNkrcEuPyrDhiu4xCd+JtF4aBCEvWPOXJtbwh+Iv/cpzbCr66XWyapJO8 AbmmbeSzhpWjan87Ti6vvz3zj5OQxIJPWIW8yDl/yOPEiD+6ARoClRkNo52UluqkTf3y IjCw== X-Forwarded-Encrypted: i=1; AJvYcCUVegcMTd6L009ZlO8wn7+Xl1jJ41rkf1FKRQ6CyL/jcLkqoAqdAv9XWgiGq1w7etwEpaS5EsJQheIkBXOsPzyN3J8S7wH3dbB/bqszo51DIb5mehk= X-Gm-Message-State: AOJu0YycogVd2aU37Nn6M4XXsal6CT5q1ozBpr84N4qLuU87bk01oNV/ AhAs3fJxJ6cbpVTwAjCpkPDukZaijcUcjwTzsVY3UrQSG2pstc6IBRun+0J3Tg0= X-Google-Smtp-Source: AGHT+IEIfJLwnjTBPzZlAN6MdmD15Q2SiURRcXeLTvWrYKudV8i77tM6zGBzeDiBhkG+NoQXNoJ5AA== X-Received: by 2002:a2e:889a:0:b0:2d2:ccc:ac28 with SMTP id k26-20020a2e889a000000b002d20cccac28mr2399275lji.38.1708067166715; Thu, 15 Feb 2024 23:06:06 -0800 (PST) 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 k18-20020a5d66d2000000b0033940016d6esm1298839wrw.93.2024.02.15.23.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 23:06:05 -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, Tudor Ambarus Subject: [PATCH v3 06/12] spi: s3c64xx: allow FIFO depth to be determined from the compatible Date: Fri, 16 Feb 2024 07:05:49 +0000 Message-ID: <20240216070555.2483977-7-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240216070555.2483977-1-tudor.ambarus@linaro.org> References: <20240216070555.2483977-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-20240215_230609_188451_5D74AFB8 X-CRM114-Status: GOOD ( 15.32 ) 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);