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: 197858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2154453dyb; Wed, 7 Feb 2024 03:17:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3iD9kXwISjQp879BI6fVoLgwBA7xSU3y81shsoj049cfcvmZJhXgX2Gq9qwnQkB5dAyx/ X-Received: by 2002:a17:906:314a:b0:a38:35c5:76f0 with SMTP id e10-20020a170906314a00b00a3835c576f0mr3253366eje.11.1707304650992; Wed, 07 Feb 2024 03:17:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707304650; cv=pass; d=google.com; s=arc-20160816; b=aY5MIRSMRoLWE5Ry6p7y4k1pYOSMDpXlsaU5IQ4szo52Uun0VaiHymdP5CHvvcaXPK 1dB5hk/H+zNYIZ9wPU0ujYxJqsobMoYz+lwyEBpOmAtAP3iycdRgznT3FTffnzVJ4Tyc sA4Bwe+7lQzkRHg/iHYpO6ht49OUBDmma0JS/4+qwwldw61Li+Q50c8+6MlBrJkv3S2W RWDGlZc1egSUV31fQHkHCdW4kuJ3BCR2nDDJ/C2B2laOV7gwvy0Tdk6UxUQgklINJVJG wRy8CWX5xpOAtAJZoCsiw8sBR7y1SF/c7e2BlIlgx61MmTdf35kcmshS9x7zevhgloUg KYZA== 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=7t39Yf75iI8Zz7Da0gHWY0hS9D040rpkcEYE36N/CE8=; fh=MZtFA2qdN7MFC9PCItDbcFi8u18s7Xfw8vt9WXEBDVU=; b=IbFH6JRRSlUfod8bnJoSrRQ0VPD6zb2ejIRM2XGP9msbxV1WpvbE91FuCAhaHqKkp/ TZGXkkOLU2Z9HXQFuDDl8ozVUGQN/L4hkjjJzwTVZGvelquTOY+nD8q20zAtahpwuijM 1MwL3xfNsyAnq3s7+AzDl9FrsPqebgZ1chL8z1ysc/F2UaHvtBAFV+zHLNGXwTgwgh41 SKxBY1I7RUUImLDBwPrUofaewtcy3UagXM2vOLMurYS5naDUeQq4YWo/2A1tSv1z9NlX mkKbuN8wRm6jsDq1JHDZq1N/YQIpqV72Nf1g05WyUYkC+btO97W09re0PqJRumiLMXSk Zl5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltc5FP+e; 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-56374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56374-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCUrW8/VsmPvA+t8uBNfbee+35oToMq2JrdoKpybJPqN+QaPVQ6ETB636uxuZBgZDNvnc3icWRAXRuZKfV9w615UGyoFYA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lf27-20020a170907175b00b00a35dce64af7si821841ejc.211.2024.02.07.03.17.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 03:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ltc5FP+e; 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-56374-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56374-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 41CB71F2824F for ; Wed, 7 Feb 2024 11:17:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B15542C6AA; Wed, 7 Feb 2024 11:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ltc5FP+e" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 8CB6624B5B for ; Wed, 7 Feb 2024 11:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304525; cv=none; b=n+RVt2c8JogEUHdQdl9ORmxkc0JyMXiQtw1BlqlbLS+fBC+MFKKKoTOIP595AvZpqV67D4Z0oHPO7po4xnAMsX0F/joRqlCwkSuoVx0SwpBCPoVX6PV77YhtQn+pfSoVi5UzTVKyWv6FwAkdiUpI9VMlmFEneNiqAmmcR3ZSff8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304525; c=relaxed/simple; bh=KCJu1OSZJfaNdmlYOfIpiQLu+o/4Z0AQSx7dLWp+QPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iuVAxNqvgs3ypuBYMD4jvTxdbTc5oTb4mlsxKfhKeQBQc7INr+SuHEiyy2tWdhwKLecJ/POMW8auq5tvrphIhQcQdp05qpQQcP2FdndkGyw/QFyjpyb0zpISUXYpDN0SHyGI0DQouhakxsuEHPlxWPZFuL7lk1/8V4ZQiZ2b12g= 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=ltc5FP+e; arc=none smtp.client-ip=209.85.128.42 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-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40fe79f1aaaso4153785e9.0 for ; Wed, 07 Feb 2024 03:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707304520; x=1707909320; 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=7t39Yf75iI8Zz7Da0gHWY0hS9D040rpkcEYE36N/CE8=; b=ltc5FP+e3a35xPn/yRH0cWT4kE2WH59/YrFgbPM4RPzXO/4EO5rEwt4Jrb2vCiZUFa u6XYcY5w4SWY0d7uAWhH4GiuJ9OHwS9TOBr4lY8FUzx0kmgU6AfbwQcPj83mnxKA+etp PPIuwSe7UdqOgihotQMAxtGVopscxs3m66WiE3A/O7XevntIyKgA3uUU4hj6rQY8xBFy rqyhX4CwKp+Y2A4184tumKBXoooVBS1niRjsLxWJBh737sIIRbjotVeod6bwKnSdnlBU Skxrlbjx4lgT6j3dCE8/Si94+FoMhqGg+LdnzeyDQzWMojx18exbXfKA/2m0exi9PSCG G4MA== 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=Xu+hR7/01L0GkcVMBR/aXzB/gtq2R0hIYljiCgtH9tiYI1nQD74OKXQTv7jD6kAFXf +Vbpr7ApBNmnfbvXRRKr8mR0eZ5LA2vZsGoORR7BbYWEARX87XfAxozd3CuFHPU0vR4h jOPNCR51ODWoOgrU41CbRV1mmoozF9acQm2NfgnzeBjXK34xFpAl6TL40O0+jGdXXRZJ aB4rBrtojlIBMoBhhAOmxBVHqpQpacxBInQXJ9zr2tsenV3pZZOxKMctHIv6RdmWCNjC fHTLTIWqhFF8cYyZokIxsXm0tj5XBPUpFuKohY3aIeVApiWvZE1n+HZwvDhRfdh7zJKN 5aww== X-Gm-Message-State: AOJu0YxBaeMKsWaeyoyGgpSHgPbxkOE+hMACFqOmfJRHpQk04YTK9xpz eIkrUzRuGOJHVRGymOcQ4g/JdFQcslrw0JU2KY4cMisAp0Bwymy5747Q+xqR16w= 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> 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: 1790238681984572032 X-GMAIL-MSGID: 1790238681984572032 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); } }