From patchwork Thu Feb 8 13:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 198421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp179487dyd; Thu, 8 Feb 2024 05:53:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcTYUaC2MBFOvKqi323kmytpWRJ6kBwtKcTTZq+hvOCPCdZ74yR/TOUd8Fb3sdKFuoxcJm X-Received: by 2002:a05:6a00:1d03:b0:6e0:8057:b2aa with SMTP id a3-20020a056a001d0300b006e08057b2aamr167096pfx.28.1707400398823; Thu, 08 Feb 2024 05:53:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707400398; cv=pass; d=google.com; s=arc-20160816; b=drbEQpEAiEYUd7ArcFT+p5wAgfdE8gvrD1/w8kl2av6IM2wJwwPRDB6ritRdlvMKCI se9mPFNSAR7lA1I5RBCyVtZ7fR26QTkT5fMvkgy8VismEDMfduDzGVRW/IX66R7aSWV1 Jvfgs37XfNESRdvLKJlnHf6RgruModE+c/uQeDO3oBZ/CfAtjsLl+m6bWP3+eEsmg2Kz wFV+zevqrAsw4elfM6D66haCRZcDXXWKeq/8x3MintTGx4kX9/m7DluX4XylQvgw/h8N I10wXjbD9naJ7TwZue82m8Yxn2ItydaSxHxhnFc+qiBV1oSfsHdh+cXqDzpl7g2WOdqP +I1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NGH79biiaV6ew1Z0cXAg/aqisf4dNxuTnwEmj4C4qiQ=; fh=DfbVPRnzE4Gf6hKZu8yqKhO1c51U8xRVKHuHZO+ua48=; b=BvkeWCWYHBfZROVH+4tTLM/fdk/IEy8ywLyBk0tkXVIikfQdDfkGgZPAJIxkhSCcQd ZmgIm5GH1UOpKfHE6lPAPztT/xYiqhZvu9BsvI+/xH+OOGqjle7fDMI+Gg8VkwYesVbk IIoF3b/G0UYCoryb2Mu3M2ZG2zrgX+u1Juddf8s79OvOGbuMS45+NkbTbYmQVG9axWVe hTIkpcftlmUmqagLxn75FyxaCvnDhpx5Ja9CGiQQA+gOXxZM/7pNFPZ5201miKepAJ7Q PwuXZhfxqsi0asGRrn505nonIwoIbRZ41+byaKXRniibkFbOIR9Rk4Qz98oxGt1Zdo/A 7u9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lh8ZzVZv; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58179-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCWIN4wZwDeCvNM1nlY/+mWKi6QsBLvCbqJIpPZ6s5yf7MOJp6RnnvmsRCLcj4WqYkzFSPhG9hN/WDAfW9KssGlL8EKoMg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x185-20020a6363c2000000b005d8e3490d49si3972958pgb.407.2024.02.08.05.53.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 05:53:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lh8ZzVZv; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58179-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B457289B08 for ; Thu, 8 Feb 2024 13:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 543697E57E; Thu, 8 Feb 2024 13:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lh8ZzVZv" Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F382C78B52 for ; Thu, 8 Feb 2024 13:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707400260; cv=none; b=sJaL2/xTNvz6bLddeEiuJWv/gR1a7BrvITt07yRKoRHhjIvs6ucje2W+oR5dbWPymLcVRPjiotFHWeqSTd7R9gb6qZWze2d6RItR2iehauqUhEWAP5DF3wEcRjC11Jhh/oXM/L2HsvfyMjzPVBm2FuQvdEcXlP7fPWxP365jesY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707400260; c=relaxed/simple; bh=wV5NZg/LKpnZaM6Kml6m0dcZlcM1lNaxnWFeDUSittQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aNuhA5F+dbxJyvFQ9r05RhtqBzDQFdRU7wiluYGFeVDKgQXfnoQEdLWYOj+KtAfqJFegqBpFK7UJyMhqCyN00YB03jkxFyS91SjAOsJd4IYSuJYWgpUz9JCbKz3/Agm9LXIMW8jQtKsNzGfoWCN4mwr4YLVFVnJPYd3hK45hnTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lh8ZzVZv; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-33b5e649dd1so23477f8f.1 for ; Thu, 08 Feb 2024 05:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707400256; x=1708005056; darn=vger.kernel.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=lh8ZzVZvTLUicTIVxQ4qPFomzDuXc46exihFevdT2J4VLyxdDZ9hC8I0xFLnnpiqpp k+5joDPqCNsN8S6lR+u21Wda88ZYXz2fQ/QIVG7l+zrc9NXB7i1HboNabf43zKfLA0kK 01xB4DAAgoR7YTayfZVZyOdXdcuy7o+1nnR0IAjCYNqV9Bo87V5I4cy0jETp1W1/MwY4 9aFR9woMLTvLnz7u1IOqpleqI/2XpUeGaOEtd6XJ2VOj9kjL6wUFI9Y6VExPv7egu+7+ R8uyXCqaVwMTv0lpQWYimIgiVTTZrsWYpF58L2iXRNtwHcSZR0ZqlQPjk3KgmzMXBet2 gmCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707400256; x=1708005056; 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=LxZbN3gmCTxZSMXMjSfasG93+ZWAxmX+pDwB+wIRC6aZwMv0lwd7EnNGhXPvFyl8ZW /vEs7P96Dx/LhYGAl4jaf1jX9OXyXqEJt02ZPU5bVRy+E99YOKX0XoT01nSP0l5XkuQu J9s4lp5IUVP0RtE0wCiospk9BtpKCGYgUtkjeezbEU7Ld+Ry/Scf1W+BdSdSj1szeQGe AX+r1G9HFQQXxD3uR7wusoiznXKhGO9A2qfiNSTUwstqz9ZLdRIs1bgXsebszY4S9kj5 aOHt/+7L6WHwRigZ/DU8PawymtkriSY6zXCOvFWZB4MSMPua5NqbPKH0VW2jOiFEI9IG CgQQ== X-Gm-Message-State: AOJu0YzkHZlckrd8cjH8nm7jUnt8Jck2RzCng5FMT00yrqlEluw2B9/O z7wueCwjO0O/CKVf29UycENiSpVGE5FSWr1X36sUMN2ggnxTLUq4v+ig54la7h0= X-Received: by 2002:a5d:6809:0:b0:33b:5c3a:2c71 with SMTP id w9-20020a5d6809000000b0033b5c3a2c71mr612698wru.15.1707400256008; Thu, 08 Feb 2024 05:50:56 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUMD9c+ZKNRw1bpfKaCZARYguKHw8BadMkOq4V5z3HThBaDt5JOI6/oj3XVAMmHYF8Lh0cooGdvyTzhZNZs34ixuXHtW3u8QE3vwicjXaHvrhTvatv3pwTcirPmplWGrGI317sNhtfaAZR7zf6FGM4M15ocPb03H34UnkYowZpveNenBfYbhOvDusXqQMMpdPRBFm1i/QAMYELsFLt3y5hq2CRY5uae6k2MR4A16WUguhyJszHLQ6s+wBdHI9b4mAh/+jrYXPD86L/pj7g7vcp0UA6Io9N4t541YBKs1Hu0xOpF5dCOv/ebObv0Ic2Sbs+gxqZLK3saBpbpRGJ9KFALikUEv3Rlcgp8MddiBIEn7bTPcaoFIwiFpqQbA2pq76RXzaH1pUjKkmmrnlk1K9RcsNSU4amV9pWW3MNVzqRV1/Ok4jUdEyy39XbpfLQFOSXC/uQwDxssWVpnTejBnabfCjFV2+UDdlrRC59tvWHxKMkVqFzJR7d+mjE4yxiOHSp/kh45Qu0v8hhr60VbLYwkW/9jiFZSd6IRBZBOJVq/LuyYo/M9SM1jmX7SPYib7/HRTsB5A7Sz+4hwSqd62XJXullmfoolB1KTpUlIaA== 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 m20-20020a056000181400b0033b43a5f53csm3618820wrh.103.2024.02.08.05.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 05:50:55 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, semen.protsenko@linaro.org Cc: krzysztof.kozlowski@linaro.org, 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, conor+dt@kernel.org, devicetree@vger.kernel.org, arnd@arndb.de, Tudor Ambarus Subject: [PATCH 04/12] spi: s3c64xx: determine the fifo depth only once Date: Thu, 8 Feb 2024 13:50:37 +0000 Message-ID: <20240208135045.3728927-5-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240208135045.3728927-1-tudor.ambarus@linaro.org> References: <20240208135045.3728927-1-tudor.ambarus@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790339080588282257 X-GMAIL-MSGID: 1790339080588282257 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);