From patchwork Wed Feb 7 11:15:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13548330 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 BE17AC4829A for ; Wed, 7 Feb 2024 11:15:43 +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=r7K6wg5vvbOsTk9FgrTlOPg+W7rNNDEdOQHpZmZP8Eg=; b=SjDcUC92Z3o47s 9e/x9l4sM0MBnKCkHtIrt+LiKAs85FzFKdNN4pXnwAeIzg4+S1WOUjIpsHfx7YdHdzRO06i838DoQ rqj6odIu1b69ctRMBr9TmkFx+S6hvc5EetndzJVmMTu1Og/t4zZPEXLS75NCi6k1ShrfKmHoEG5I8 2H7ud6CUYzNg6x5x6h7j4M5bF2Etq81Z6OMLIbAZqFEstKULeU/aRfmgG1E7JbzwUjzvE7x6jYrih lK0NZezvq4FOGpSg5nqofUI90QjHxY27YW5glu8vrwiP+UCTu7GkhII4KfiNRN/VJnd3o9cMp9NbL 62JmSxrn4pSP9sho/6jQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXftp-0000000ASOL-3Vf4; Wed, 07 Feb 2024 11:15:29 +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 1rXftk-0000000ASIp-03Mo for linux-arm-kernel@lists.infradead.org; Wed, 07 Feb 2024 11:15:26 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40fd280421aso4044065e9.3 for ; Wed, 07 Feb 2024 03:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707304520; x=1707909320; 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=7t39Yf75iI8Zz7Da0gHWY0hS9D040rpkcEYE36N/CE8=; b=VBprzimDvCDgYLn8P7gwDKpoPDYEBLlrgL0OHVUZU1P+jz/6/kLBp0Rpa/3eZq4qCo rzMCAOZgLsDbzvS+W96+5TLi48NqnZvagiTl+AiLwFdcUHRKFDQcmNU15cLUiG7eTDgF VNbtqvcoHDoBAAsnsjRROfZTQlpRt1UfZfdw1hY1mhTCh3ItnTEI4Zf+F2WJWFLwGIfr Si3IBiNpLz+oKQzUqxkXoZUsuqE9VK6DONls4Eo54YpjGUbWrxrwnMZxRiJVwIgOHT++ 1wo7ydXdAZreSujRzOu7COgVC7kCKXqtWN4VpHwkQ34rH3z1Fi41jI3uhL9EnXXPxWKV aLIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707304520; x=1707909320; 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=7t39Yf75iI8Zz7Da0gHWY0hS9D040rpkcEYE36N/CE8=; b=gXbCU68c1vnSzJOs0Sk3E49khtrSmCuPs67rb8sb/1fdo9ABMNJ5nugwslYY6dGCPi Mi6e6E78D/yTF0u00VmLjmw/iMqGrYpn5eu9R5iacsjAp1z3asQKZKe5EkMSiuZM8HxH adOYSqWMnM4EG1l/EEsMrJSaJb8ddTl+BeOtqrQdbR+r91t968QEjuIzSja6wS07gO4v e5Xgjp1ZHN8kZQz0FHfiDgKiOfoiy/WpOZTdKst3Z+H1nfj1fEpkiO0aRwcvoBiXTJ3R g3fyhJjotHl+jrU1TsGUOvmcSBGHgt6uJgEOeoAXy0p8rCmcETKkZjEst3P+dfMyXoFF WVFQ== X-Gm-Message-State: AOJu0YxCibNMT9IAewvbfO0lII3j8JeJk0txD8GXdSEmLJ2jKWNouJU7 rsgcfGqJhCoBnga0x1I8+wxEl12N4JTH2y/82qbNQOVJBRnYzWXRR9fC00RWHps= X-Google-Smtp-Source: AGHT+IHvAN2LW4qtSL8E+o3i2POjFFbt9vh5tmGZpdfqBeC6vAEw3I415//fMzQ/3R97wixlqTimVA== X-Received: by 2002:a05:600c:3d9a:b0:40f:c5df:7e5c with SMTP id bi26-20020a05600c3d9a00b0040fc5df7e5cmr4251545wmb.34.1707304520651; Wed, 07 Feb 2024 03:15:20 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVa6m/5UU4O3g2wSaheso82eopRSx0SOovklPjqwHn1OclD1i4QeUHsvCEcCbasWkfbomqzX7gfE33GvIZdrLomXmgrtJ5O3vmzareY8CuRNEl9z4yrGKCtxYbNfhR+LsA3Ku3BzSJPSRvGa1NBSc2WP0rb1dU1Zm3NM4FPlzyvVw5c0Q924iQdidfcx7y1fNHUXqO6lYhVXczjSj/PqmSdsacFr1a8qj0oDNgXNa4T4v5dB6VMq7n0HqhNA89YNY+V2F0EGsMBF7sUl8cL8191xOvla8mRkrRik74VCYxDAThrMN15IDZpIdCcqhsKS9dEZXVg+F2nrJF41oljl383p3/Lumncw7gOmKDN3Y9CqV1fndYVdqHryCEdmwyx34ZIxigyG/8zZckGCFuwSo931BOoaJWWkh/I9TVxUC4xu/BUzbqlr0YVsXtU8Sdd6Q0wE/iK4Ok0TsHF4qIoMHYQVeb69+3CdIyAhRTvE2fEPPpdqSoGmt+txY6LLUWlnGThSgVa00zL1SMOXtC1xrI96XUzyu3l+6hKC3LtSN6euSuiUn/gctCJ4hXQN/EZIh/aw6nx4W8eojEKW/aJHKLSrw== 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 l14-20020a05600c4f0e00b0040ec8330c8asm4983260wmq.39.2024.02.07.03.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 03:15:20 -0800 (PST) From: Tudor Ambarus To: broonie@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, robh+dt@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org, Tudor Ambarus Subject: [PATCH v2 2/4] spi: s3c64xx: prepare for a different flavor of iowrite rep Date: Wed, 7 Feb 2024 11:15:14 +0000 Message-ID: <20240207111516.2563218-3-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240207111516.2563218-1-tudor.ambarus@linaro.org> References: <20240207111516.2563218-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-20240207_031524_409530_96136D18 X-CRM114-Status: GOOD ( 11.62 ) 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 (gs101) that allow only 32 bit register accesses. As the requirement is rare enough, for those SoCs we'll open code in the driver some s3c64xx_iowrite{8,16}_32_rep() accessors. Prepare for such addition. Suggested-by: Sam Protsenko Signed-off-by: Tudor Ambarus Reviewed-by: Sam Protsenko --- drivers/spi/spi-s3c64xx.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 7f7eb8f742e4..eb79c6e4f509 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -414,6 +414,26 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host, } +static void s3c64xx_iowrite_rep(const struct s3c64xx_spi_driver_data *sdd, + struct spi_transfer *xfer) +{ + void __iomem *addr = sdd->regs + S3C64XX_SPI_TX_DATA; + const void *buf = xfer->tx_buf; + unsigned int len = xfer->len; + + switch (sdd->cur_bpw) { + case 32: + iowrite32_rep(addr, buf, len / 4); + break; + case 16: + iowrite16_rep(addr, buf, len / 2); + break; + default: + iowrite8_rep(addr, buf, len); + break; + } +} + static int s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, struct spi_transfer *xfer, int dma_mode) { @@ -447,20 +467,7 @@ static int s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, modecfg |= S3C64XX_SPI_MODE_TXDMA_ON; ret = prepare_dma(&sdd->tx_dma, &xfer->tx_sg); } else { - switch (sdd->cur_bpw) { - case 32: - iowrite32_rep(regs + S3C64XX_SPI_TX_DATA, - xfer->tx_buf, xfer->len / 4); - break; - case 16: - iowrite16_rep(regs + S3C64XX_SPI_TX_DATA, - xfer->tx_buf, xfer->len / 2); - break; - default: - iowrite8_rep(regs + S3C64XX_SPI_TX_DATA, - xfer->tx_buf, xfer->len); - break; - } + s3c64xx_iowrite_rep(sdd, xfer); } }