From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 C572F28F528 for ; Fri, 9 May 2025 11:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788820; cv=none; b=Zxipon7R4Lcgq+nZxWUg29CzSXYK6xpvktmwKaqoZgQA+5NWrxGPezvFq83XUrEer6zuUgH0vhqBH+S5Si+gHQyFzqBEn3Nzhf1EtPsP+1UQzLUlVrqPwm/sfg9FALey6ZN9FTlIqT/t8RyDZZccNSbhqzT2teAX7OvdCkzF6po= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788820; c=relaxed/simple; bh=2Me3n9aaBCtjK+qaTkwH9V1pF/7QGlCrjR9j27nmWwE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tpnIc09OPqQUGDHPl4PPVnEdz9BrRI8HWVN8b3+AYEAxJJ+wbhCwbVMm9DeCxi+ercvXHyMgw5Nyth5u0lR3wfnQleow+NF1Hiy+Y9iu0iT+2NbhpEa6PNfS7pXy78+GGpRk9WLc18KEz9QoXXEzcqxTlKK+WJWLKTjeY+EMuiU= 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=tFa3SB56; arc=none smtp.client-ip=209.85.221.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tFa3SB56" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a1d8c0966fso847203f8f.1 for ; Fri, 09 May 2025 04:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788816; x=1747393616; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SUoeaJOnz98LhxzrB2OQnuTIO89rQsZt/lwrASJetuQ=; b=tFa3SB56OlxIm4M6PvsOZ+b8+1wTH1hlihXXvrJoob9Din6ZUUTPyC1WbCXXdeR76t 6DcfLgHbcvsstA1fyD0x7y7mLwUjlvBHtFFmisRlMU2LUyS7MDszZsbtJZ8e9iamRUGy rpqJtTPv2txKtLKDNiJi5hqy1orGtVbRGCZFcuTj5F53DCrRiKWTQXd98a+riZocPcWW Pg498khWnvIc92fKyTCXza2wDUtGpbdW1AxKCQCcuPgHwqUd9diaVJWU3ae37R8lnf64 da40gC7wZVzZcE+iDdLw2VUnlDz+tlMNgospItPEAVzyNKxGKW0F3VGqL7UFl+JCPMrn Wlkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788816; x=1747393616; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SUoeaJOnz98LhxzrB2OQnuTIO89rQsZt/lwrASJetuQ=; b=QvGJN+LWDtWB5sJKf9Qic9x37ph6lbCpvs6+L9a+8MrgmKVJowH4qmnkiX9FeAlE8t uRpjwZ05t7StJgNvgM3OKOAzjFAdbej4kbyGpKa2yDcVXKnIYKtPtNBH7tGJCGzNoOdR tYiIMpXPV38fSjOUUMsJoqk0wuIaVvmB6pzlMTex7L32r1zQSaUriytVzRUcA+SjlVZa qTCtxMuXAKPrDz+R86DveOhF8bncHKC46rTHnisM6szFSuQoOZApFGlDPcdRkp709BZ4 wTR70DplvRpmTylYON6QqyPG3rzymoKb1g0zHKEVaECKyQZZPzaoPPTbY4gy/ST+ZPC1 bvuQ== X-Forwarded-Encrypted: i=1; AJvYcCWUvZ5rgi39Q4/6uNF+r9bq4TbTsdjTD/6tKYd55YVgAt1MLEZpr9F6Xl/HHZxg4Urmm6yI6v3bL2zahIg=@vger.kernel.org X-Gm-Message-State: AOJu0YzgKdQ7aMEg7kBj6tOVe/kHMKByDJx4aiYsohCXt4wCa11hKXp+ usTuBN3+fECvmc8JEpFNAIbNlvuzQpw2MZK6i1ESWSjXJV/GCIiMMFTaEklWpq8= X-Gm-Gg: ASbGncsaUuxuJOxN7C5+R6fL6kKtbsPfc1tAnkyFZka2dFDs+USYYsB+woO4WlR1hp2 rGSZd+TH7AZmrRRSixE7imFfFE1vFITYRpFy0792r/stSDTsjDm66Kq8FPl2+tMDw25QaSEI0PS 2Xpuhs3FPW/g9ST2OEZFvEmrfB/cQo/cEMINUTs8zJcP3mVuCnlcG7Xf9GoGrnrgazc5OWze849 VAkU1SiOS27XUkiIcBH3PSWAoQ+a0jSvXaXgsyERqUqZC71JZyoB1qgOIhk4B9vyQ2Yk/V17aKs +hKBsZDBIrYTUIWj1kFZM76/AmekTyawRBtq0zkFz6sh0uM= X-Google-Smtp-Source: AGHT+IFJQRyVMr2U93vokfpSUulnWLDfNfE0bAch8J9y68HcjUDSO608e30Saz1ZNqv66Dvdty+TYw== X-Received: by 2002:a05:6000:2ab:b0:39f:c05:c220 with SMTP id ffacd0b85a97d-3a0b9941e27mr6449970f8f.22.1746788815916; Fri, 09 May 2025 04:06:55 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:06:55 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:48 +0100 Subject: [PATCH 01/14] spi: spi-fsl-dspi: Define regmaps per device Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-1-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 Refactor the regmaps so they can be defined per device rather than programmatically. This will allow us to add two new regmaps for S32G in a later commit. No functional changes. Signed-off-by: James Clark Reviewed-by: Vladimir Oltean --- drivers/spi/spi-fsl-dspi.c | 121 ++++++++++++++++++++++++-----------------= ---- 1 file changed, 66 insertions(+), 55 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 067c954cb6ea..31ea8ce81e98 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -121,6 +121,7 @@ struct fsl_dspi_devtype_data { enum dspi_trans_mode trans_mode; u8 max_clock_factor; int fifo_size; + const struct regmap_config *regmap; }; =20 enum { @@ -136,60 +137,123 @@ enum { VF610, }; =20 +static const struct regmap_range dspi_volatile_ranges[] =3D { + regmap_reg_range(SPI_MCR, SPI_TCR), + regmap_reg_range(SPI_SR, SPI_SR), + regmap_reg_range(SPI_PUSHR, SPI_RXFR3), +}; + +static const struct regmap_access_table dspi_volatile_table =3D { + .yes_ranges =3D dspi_volatile_ranges, + .n_yes_ranges =3D ARRAY_SIZE(dspi_volatile_ranges), +}; + +static const struct regmap_range dspi_xspi_volatile_ranges[] =3D { + regmap_reg_range(SPI_MCR, SPI_TCR), + regmap_reg_range(SPI_SR, SPI_SR), + regmap_reg_range(SPI_PUSHR, SPI_RXFR3), + regmap_reg_range(SPI_SREX, SPI_SREX), +}; + +static const struct regmap_access_table dspi_xspi_volatile_table =3D { + .yes_ranges =3D dspi_xspi_volatile_ranges, + .n_yes_ranges =3D ARRAY_SIZE(dspi_xspi_volatile_ranges), +}; + +enum { + DSPI_REGMAP, + DSPI_XSPI_REGMAP, + DSPI_PUSHR +}; + +static const struct regmap_config dspi_regmap_config[] =3D { + [DSPI_REGMAP] =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .max_register =3D 0x88, + .volatile_table =3D &dspi_volatile_table + }, + [DSPI_XSPI_REGMAP] =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .max_register =3D 0x13c, + .volatile_table =3D &dspi_xspi_volatile_table + }, + [DSPI_PUSHR] =3D { + .name =3D "pushr", + .reg_bits =3D 16, + .val_bits =3D 16, + .reg_stride =3D 2, + .max_register =3D 0x2 + } +}; + static const struct fsl_dspi_devtype_data devtype_data[] =3D { [VF610] =3D { .trans_mode =3D DSPI_DMA_MODE, .max_clock_factor =3D 2, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_REGMAP] }, [LS1021A] =3D { /* Has A-011218 DMA erratum */ .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS1012A] =3D { /* Has A-011218 DMA erratum */ .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 16, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS1028A] =3D { .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS1043A] =3D { /* Has A-011218 DMA erratum */ .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 16, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS1046A] =3D { /* Has A-011218 DMA erratum */ .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 16, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS2080A] =3D { .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LS2085A] =3D { .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [LX2160A] =3D { .trans_mode =3D DSPI_XSPI_MODE, .max_clock_factor =3D 8, .fifo_size =3D 4, + .regmap =3D &dspi_regmap_config[DSPI_XSPI_REGMAP] }, [MCF5441X] =3D { .trans_mode =3D DSPI_DMA_MODE, .max_clock_factor =3D 8, .fifo_size =3D 16, + .regmap =3D &dspi_regmap_config[DSPI_REGMAP] }, }; =20 @@ -1167,54 +1231,6 @@ static int dspi_resume(struct device *dev) =20 static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); =20 -static const struct regmap_range dspi_volatile_ranges[] =3D { - regmap_reg_range(SPI_MCR, SPI_TCR), - regmap_reg_range(SPI_SR, SPI_SR), - regmap_reg_range(SPI_PUSHR, SPI_RXFR3), -}; - -static const struct regmap_access_table dspi_volatile_table =3D { - .yes_ranges =3D dspi_volatile_ranges, - .n_yes_ranges =3D ARRAY_SIZE(dspi_volatile_ranges), -}; - -static const struct regmap_config dspi_regmap_config =3D { - .reg_bits =3D 32, - .val_bits =3D 32, - .reg_stride =3D 4, - .max_register =3D 0x88, - .volatile_table =3D &dspi_volatile_table, -}; - -static const struct regmap_range dspi_xspi_volatile_ranges[] =3D { - regmap_reg_range(SPI_MCR, SPI_TCR), - regmap_reg_range(SPI_SR, SPI_SR), - regmap_reg_range(SPI_PUSHR, SPI_RXFR3), - regmap_reg_range(SPI_SREX, SPI_SREX), -}; - -static const struct regmap_access_table dspi_xspi_volatile_table =3D { - .yes_ranges =3D dspi_xspi_volatile_ranges, - .n_yes_ranges =3D ARRAY_SIZE(dspi_xspi_volatile_ranges), -}; - -static const struct regmap_config dspi_xspi_regmap_config[] =3D { - { - .reg_bits =3D 32, - .val_bits =3D 32, - .reg_stride =3D 4, - .max_register =3D 0x13c, - .volatile_table =3D &dspi_xspi_volatile_table, - }, - { - .name =3D "pushr", - .reg_bits =3D 16, - .val_bits =3D 16, - .reg_stride =3D 2, - .max_register =3D 0x2, - }, -}; - static int dspi_init(struct fsl_dspi *dspi) { unsigned int mcr; @@ -1272,7 +1288,6 @@ static int dspi_target_abort(struct spi_controller *h= ost) static int dspi_probe(struct platform_device *pdev) { struct device_node *np =3D pdev->dev.of_node; - const struct regmap_config *regmap_config; struct fsl_dspi_platform_data *pdata; struct spi_controller *ctlr; int ret, cs_num, bus_num =3D -1; @@ -1355,11 +1370,7 @@ static int dspi_probe(struct platform_device *pdev) goto out_ctlr_put; } =20 - if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) - regmap_config =3D &dspi_xspi_regmap_config[0]; - else - regmap_config =3D &dspi_regmap_config; - dspi->regmap =3D devm_regmap_init_mmio(&pdev->dev, base, regmap_config); + dspi->regmap =3D devm_regmap_init_mmio(&pdev->dev, base, dspi->devtype_da= ta->regmap); if (IS_ERR(dspi->regmap)) { dev_err(&pdev->dev, "failed to init regmap: %ld\n", PTR_ERR(dspi->regmap)); @@ -1370,7 +1381,7 @@ static int dspi_probe(struct platform_device *pdev) if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) { dspi->regmap_pushr =3D devm_regmap_init_mmio( &pdev->dev, base + SPI_PUSHR, - &dspi_xspi_regmap_config[1]); + &dspi_regmap_config[DSPI_PUSHR]); if (IS_ERR(dspi->regmap_pushr)) { dev_err(&pdev->dev, "failed to init pushr regmap: %ld\n", --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 EB57A28F932 for ; Fri, 9 May 2025 11:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788820; cv=none; b=rck4BHOQtILdRhwRQk+RwKnV+cLh/5PJmimmpp1uDapSlS3aOQAzGaSHbXQG9C4Zq8F2XAtNKLXXlk1wablHzfySqZ3s9bt9jL3MMJ+NdCw3hbQPrXQ9Yoy8qJ03elfsNgcMhnVrPcm/TGTLpEDKvSLE3nhxJmQxUFPmfNADnvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788820; c=relaxed/simple; bh=lNzAOm2fsnFGf82dcqxl1YBX/mz6uR9h5/TJgWh82NI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kSgqgBde2vwpZFdOjccS9ihMjU7NDdRI0ZN7pKPhWajSntSj2wEZF17YqBGfz2X7SCBs3M6ydokG1431HhVe4lwqNxQKYutDvWSAkeNehiuLpfLi8EY1uM/5uPiFkQDCQGGndSivifWHJkneFKJAkIrJ4PdQ8bMADhsnyY8/v2g= 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=bA2PtdQe; arc=none smtp.client-ip=209.85.221.47 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bA2PtdQe" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a0b9625662so1448080f8f.3 for ; Fri, 09 May 2025 04:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788817; x=1747393617; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A+3jb/fX+IugayjdNWEytVWeF5yooMmRjS6ouVsYvEU=; b=bA2PtdQeVxJdFWl6Ek4y4qB9rQ8yAYJTIWzbu6cUYgSQ+dQDGP58p6R+9nQRusPq7m +MnGkujJLu45OkTrpWF2vkWnZhHdGk+gLGdzJtnbVXOmHnU9jAaVwUwdbaoJT7g9L5R3 xykWYQPvEr1l4TRBIvazL+EGgNS3cbFNMNGh9b6q2ZuPU1WHcCL29fKG37V19n+oWDJh o5f36b1A4lrcr6vvc5tC6U7BZrNNd/LbmdwuTUSoC6EmrV4047cLnsYpP4F5w4B2MPau rCqCVgxBjXF5eiMj2/tQ1V/r6uejsJLQdbgWeKs5tGZNhK3BgSsVL2kBkr/EEfua760u 5zpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788817; x=1747393617; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A+3jb/fX+IugayjdNWEytVWeF5yooMmRjS6ouVsYvEU=; b=cUPwIYLyf8AH9245TofjrhS4XIF5mDNrgpJqvklgIJiK1fnnz/ua8UQ4I3lITzUp4B l3A/1vckUc30pW0YR144UW86Z7eANplQG8gUOxC1ofkps4TBnBMbfLzvaPG5JBMkTkhb lMWokza3Mr0QaGerJzm2VtGSUr3xHJuRwb5wwnFDz8TQ8tyEdlAgTkLIn4XuaheTffxB qvC6SWYzIl+FJpkbniIG0Yi1vzMMgcHygT6Mn9SbHTs9MqNuAAoFiJbhxxsGD4g1bNMy LJtMqcR1PVvMOdTQNZDFnjSnfZmQ1ki4c9ZOp3WyjLH59WEwi105OYosI32KJwyMbLiE aJ9g== X-Forwarded-Encrypted: i=1; AJvYcCVWQdc3zM+kO9WQaC7COYL4chP01pdIJVn3oKUDvlf38f8nb2MHBzC+lXmHoq9jp5OcIVpHvvFZJ38lT5E=@vger.kernel.org X-Gm-Message-State: AOJu0YxQf07mbS4VoLR13AIpvWO9r2SewdzuxgrejGYf7wiN4r+9qYsB pJj2T9lxNcd2noqo4Ix1pnM/IogtLUR43W02Ot3gTM3x2QPa53telzBxiiUbNec= X-Gm-Gg: ASbGnct8QCGXCIu1Hueko8eUGeyZSfeQKUT5NP/+98hiKw7UguoJXAPXtcOWYdyd1fQ rBmCsvgQgga6GQPfCJzHf1ErabKkkeVWzOaFqMb94XBW1KVNPuqz1GqFvLPNfXVHsEB9QvIi7IW IYjDPLog5g0SA8Na3KTocxngtiiBdP/u9aygZB6iDHziszVHZQ/NFq/duY94OML4pBLHYgP+NFQ XJrQWdnRWYtZb1muUzj+dUgoL8Eg4xN7/8VeKT0qQLZGhxzS0SU9t/ya5CaNHhyJGQdio2OG6Dg JlfBuyJn+8idDd2gIc+H5bIdHfjajtET36seAIviGbl9KRHSR8g0/J1rgw== X-Google-Smtp-Source: AGHT+IFC6m07o95wlBL8z66ZHFQZFey0yAwlkLMNz025uhOiNU0gJ9upByEMU9FvrvfyyVzrnKIsgw== X-Received: by 2002:a05:6000:4287:b0:3a0:8c45:d41b with SMTP id ffacd0b85a97d-3a1f6457726mr2691256f8f.20.1746788817253; Fri, 09 May 2025 04:06:57 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:06:56 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:49 +0100 Subject: [PATCH 02/14] spi: spi-fsl-dspi: Re-use one volatile regmap for both device types Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-2-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 max_register overrides anything in the volatile ranges, so we can get away with sharing the same one for both types. In a later commit we'll add more devices and also read/write ranges which also override volatile ranges so this avoids adding even more duplication. No functional changes. Signed-off-by: James Clark Reviewed-by: Vladimir Oltean --- drivers/spi/spi-fsl-dspi.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 31ea8ce81e98..cb0e55a49eea 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -141,6 +141,7 @@ static const struct regmap_range dspi_volatile_ranges[]= =3D { regmap_reg_range(SPI_MCR, SPI_TCR), regmap_reg_range(SPI_SR, SPI_SR), regmap_reg_range(SPI_PUSHR, SPI_RXFR3), + regmap_reg_range(SPI_SREX, SPI_SREX) }; =20 static const struct regmap_access_table dspi_volatile_table =3D { @@ -148,18 +149,6 @@ static const struct regmap_access_table dspi_volatile_= table =3D { .n_yes_ranges =3D ARRAY_SIZE(dspi_volatile_ranges), }; =20 -static const struct regmap_range dspi_xspi_volatile_ranges[] =3D { - regmap_reg_range(SPI_MCR, SPI_TCR), - regmap_reg_range(SPI_SR, SPI_SR), - regmap_reg_range(SPI_PUSHR, SPI_RXFR3), - regmap_reg_range(SPI_SREX, SPI_SREX), -}; - -static const struct regmap_access_table dspi_xspi_volatile_table =3D { - .yes_ranges =3D dspi_xspi_volatile_ranges, - .n_yes_ranges =3D ARRAY_SIZE(dspi_xspi_volatile_ranges), -}; - enum { DSPI_REGMAP, DSPI_XSPI_REGMAP, @@ -179,7 +168,7 @@ static const struct regmap_config dspi_regmap_config[] = =3D { .val_bits =3D 32, .reg_stride =3D 4, .max_register =3D 0x13c, - .volatile_table =3D &dspi_xspi_volatile_table + .volatile_table =3D &dspi_volatile_table }, [DSPI_PUSHR] =3D { .name =3D "pushr", --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 6AEF728F95D for ; Fri, 9 May 2025 11:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788822; cv=none; b=ff9m6+kdIbYc6I52NQFRg0qyJf6MbS3BNVpZ/BBvCgDnqx7AufKJ9ac6qFpzexq1eVTfodisUzaSsUGiKqtY3rVmeEqVYBcR60dvYyLzMqf9D9tQyXAeYedd3a4sd7WZjPBlzUXddwdiK0iUypTFcDsMpJYlRwn5g09UEZTZObI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788822; c=relaxed/simple; bh=eEjcZlIDJmLV5/jyvCAjQjBuHpvBbYFjopscg3ocaAU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hHKC6tlbV33M14dSnNzzLFBx7JTaa2g9xnoV/oTsf+Tz0aqgmg9BUzGO1fZ3QEUn6+SI50sLsHXns7JFBifvnqvIyd71tkM5A9sh+rUHHdDIghXLdMmg/CybE27/PTM2qOhu9IAu5ouY9N2y1vC4+q7LfbqzG2J9Jf9PwdrXGOE= 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=AmS/r9Y5; arc=none smtp.client-ip=209.85.221.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AmS/r9Y5" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a1f5d2d91eso612566f8f.1 for ; Fri, 09 May 2025 04:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788819; x=1747393619; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XZ/3VdJhYRpNseu5U9lSFH9HxUE77S8ESF2tbbWAri0=; b=AmS/r9Y5uW7x4VbumhhDXBgwmqEk9OiGrr5gsv9+yhNaM6GKvS4L2f7pz2A9vyNVfd +Jo7dwcmAyU4jQ3l/iTN3w54QIjQ1Y0hRljRrE+rIOkheHYooYuwoTCf6PndC5yJRmfm JXAgvfw9w/GWPesyiiqVT6jg8MihR8PTXYTvw9n+V9oEoVEZdjRhr5rT+6No43r9YUy2 0qC2yAl+xwxjfHB+fuJGDLf9A6Pu8bTLqsAeIM1KA9ubHIrjmOLwuilJDQb01N0P4lJs Zm246RiTTi8YaDAzD2NorjuS11zvYnwmdUGhKeXIL3wAWYrhcGqooupHDg6BJO7rJqPS 9ESg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788819; x=1747393619; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XZ/3VdJhYRpNseu5U9lSFH9HxUE77S8ESF2tbbWAri0=; b=uQh9vtQ7m+zSS+H6ZW9lPPDpqDKCOtvy8T17vmXHkmDwIN+Y7yoYzJrwVoRciUmG0k WMv0o+dFY6Uqwz74yp/tR4G2btTlDB/jx5DyDRSngBkV6iZhm5pxxKyz0N8/Ug5hVvU5 NVNpQdupL0Jhpbnh0oN+QMHGKh/fFD8UPhj9GkIyQBHy9GI7tf9AAhSxjn/GJiPrp8or Xd2mrOJFYJN2KkKOfXhznOn2gYX5eH2dr6chuaCHxNzUpcTu+IVZof5T5s+yPjUZe/R5 rTZ0SiUPfWboJyRZss1GueObfkqMno0pQQUORIrE17Kc4Ch2ZTejaUYvHCyHiLmvLaaC 0Qkw== X-Forwarded-Encrypted: i=1; AJvYcCU5FcTBukfR1zsgOghJGcxdUqCWoOWG6RB8o5XfneepYlVPisF9KJnNaKJDdc/yHa+euHiUVbo6Wa7sSHs=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3bFd8tTAPhuTVyE2scaUp8JLsVp0bhszfcasXeLW06GDyDzMy J5IPmRqQIeyTd+PNe5/y1oAzzmDJkSmmiHSCmaUcxF8/bTWcNFXC/m2ahuIA5Lk= X-Gm-Gg: ASbGncuf+kMNsk0m5N0L35fFZJRkdN/RGy1OU+TpGT5J+yMmoedvvF/I0FemnsHbeFd r7lvsAT1kD6/5HxTpN0yw4qfec7VD5FfvH1p3tM3D/bk07BDfXvX14fVptK2dqelYpe4l21VYeM 3u6hT2FTYKoFmJanu/q5E2PNWD1Vh7s82cTkJqc5C4gKAR+sKr4KA835BcDUJK6zTbFlYif+Fb4 eIr4nXUvhNTqWYYZzq5STQywC7PlYZFnGUO2yt/qZSLJYkOyb7/eXvBGuP8wqXA8S37n8QtYLcu erzK07eTGHqiu5fPyhNJ9q9ryFnyTfqDBfZPS+4zUK0lUOQ= X-Google-Smtp-Source: AGHT+IFbRxA53PsQ6WEpfLOqgfTczthdryRGHNyvPGYt33prnCWmvz5n1DMnzXDap0L0ElCdAiEfKQ== X-Received: by 2002:a05:6000:2905:b0:3a0:b9a8:b94c with SMTP id ffacd0b85a97d-3a1f64b5c83mr2393167f8f.50.1746788818691; Fri, 09 May 2025 04:06:58 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:06:58 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:50 +0100 Subject: [PATCH 03/14] spi: spi-fsl-dspi: restrict register range for regmap access Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-3-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Xulin Sun , James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore DSPI registers are NOT continuous, some registers are reserved and accessing them from userspace will trigger external abort, add regmap register access table to avoid below abort: Internal error: synchronous external abort: 96000210 1 PREEMPT SMP Modules linked in: fuse dummy tun hse sch_fq_codel openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 CPU: 2 PID: 18231 Comm: read_all Not tainted 5.2.33-yocto-standard #1 Hardware name: Freescale S32G275 (DT) pstate: 20000085 (nzCv daIf -PAN -UAO) pc : regmap_mmio_read32le+0x24/0x48 lr : regmap_mmio_read+0x48/0x70 sp : ffffff801123bb70 x29: ffffff801123bb70 x28: ffffffc873b5c000 x27: ffffff8010b408f0 x26: 0000000000000001 x25: 000000000000013c x24: ffffff801123be40 x23: 00000000000003ff x22: ffffff801123bcfc x21: ffffff801123bcfc x20: ffffffc873a9e500 x19: 0000000000000024 x18: 0000000000000020 x17: 0000000000000000 x16: 0000000000000000 x15: ffffffc876189160 x14: 0000000000000003 x13: ffffffc873bf73ff x12: ffffffc873bf707e x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffffffc83fca4e00 x7 : 000000000000000f x6 : ffffffc873bf7083 x5 : 00000000fffffff9 x4 : 0000000000000002 x3 : ffffff801061f058 x2 : ffffff801061ee18 x1 : 0000000000000024 x0 : ffffff8011490024 Call trace: regmap_mmio_read32le+0x24/0x48 regmap_mmio_read+0x48/0x70 _regmap_bus_reg_read+0x38/0x48 _regmap_read+0x68/0x1b0 regmap_read+0x50/0x78 regmap_read_debugfs+0x120/0x338 regmap_map_read_file+0x44/0x58 full_proxy_read+0x68/0x98 __vfs_read+0x48/0x90 vfs_read+0xb0/0x130 ksys_read+0x7c/0x108 __arm64_sys_read+0x24/0x30 el0_svc_common.constprop.0+0x74/0x168 el0_svc_handler+0x70/0x90 el0_svc+0x8/0xc Co-developed-by: Xulin Sun Signed-off-by: Xulin Sun Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index cb0e55a49eea..701cf56d28e7 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ // // Copyright 2013 Freescale Semiconductor, Inc. -// Copyright 2020 NXP +// Copyright 2020-2025 NXP // // Freescale DSPI driver // This file contains a driver for the Freescale DSPI @@ -137,6 +137,20 @@ enum { VF610, }; =20 +static const struct regmap_range dspi_yes_ranges[] =3D { + regmap_reg_range(SPI_MCR, SPI_MCR), + regmap_reg_range(SPI_TCR, SPI_CTAR(3)), + regmap_reg_range(SPI_SR, SPI_TXFR3), + regmap_reg_range(SPI_RXFR0, SPI_RXFR3), + regmap_reg_range(SPI_CTARE(0), SPI_CTARE(3)), + regmap_reg_range(SPI_SREX, SPI_SREX), +}; + +static const struct regmap_access_table dspi_access_table =3D { + .yes_ranges =3D dspi_yes_ranges, + .n_yes_ranges =3D ARRAY_SIZE(dspi_yes_ranges), +}; + static const struct regmap_range dspi_volatile_ranges[] =3D { regmap_reg_range(SPI_MCR, SPI_TCR), regmap_reg_range(SPI_SR, SPI_SR), @@ -161,14 +175,18 @@ static const struct regmap_config dspi_regmap_config[= ] =3D { .val_bits =3D 32, .reg_stride =3D 4, .max_register =3D 0x88, - .volatile_table =3D &dspi_volatile_table + .volatile_table =3D &dspi_volatile_table, + .wr_table =3D &dspi_access_table, + .rd_table =3D &dspi_access_table }, [DSPI_XSPI_REGMAP] =3D { .reg_bits =3D 32, .val_bits =3D 32, .reg_stride =3D 4, .max_register =3D 0x13c, - .volatile_table =3D &dspi_volatile_table + .volatile_table =3D &dspi_volatile_table, + .wr_table =3D &dspi_access_table, + .rd_table =3D &dspi_access_table }, [DSPI_PUSHR] =3D { .name =3D "pushr", --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 D4B0328FAB3 for ; Fri, 9 May 2025 11:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788824; cv=none; b=cZs90Kqel9i9g1crDs1eez5eChH55KxGRIzDtZU7WeTTuZk5tFAeMPJ+hbWyID8h8NkXB6Mud4/I8Kslx+Sla/YrS05Kz0H+c9wmVUvahk99s1eiWJjrQGkywI95e8thx5spSWYuqcVy0j4y9Nwta8PfI9JD/wDzgbC8LI5QH3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788824; c=relaxed/simple; bh=uxItPjqCvg33dWDIcD9DK2czP0Ojdua2Kzevid/t8oQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=chP3uZfPxvj/qWmcwtbK8SXsQZwEno2LVkvwCBTuMNSdvVMSSadQ62+ikISoVGlW7C8rfz8hbpqWx3gynLCNL4nzZrRp99OARXpKFoJ/9wQruklZVRwCOFPHFvO0ZNpNVAg8DPg3uGFp8L3at4x/Hr7V3quvGPiiUtUtTHUXXag= 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=yLxOoJY0; arc=none smtp.client-ip=209.85.221.52 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yLxOoJY0" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-3a1d8c09674so670484f8f.1 for ; Fri, 09 May 2025 04:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788820; x=1747393620; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kS0UyNciGcvIX/4wvXI4EYR5mKVhADe3ICPtGq7iTLM=; b=yLxOoJY0kakGFf3Tbqab7ebI0WTY+HLH/HJfDcEI+TUUek4mMVsh/jSJGN9PFUEUUF s3kOQw6iyoFhfOJ5kYeR2aexcrTUlrT0w0HbUDmddkM/7eTgUApSJZjbPf5RR2orypnF kAmK+TfB5ube3MzOpc2zzE4xpHtWAuSSCVqwDkC/fomn5vrc0bidfP1UOZPmqSll3drq r4awOK9xjSD2qafyIgdL6gpTP8UZRHUdFbGa7RbotI6SogX+GleKVPjX9DOBzpBdXQzf qLARsBDmdHgBOPVktv3/+gxVupORUevQHsIrLZwqG70RKBhXSsEgVI545hSfsobYJ5cY Cs9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788820; x=1747393620; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kS0UyNciGcvIX/4wvXI4EYR5mKVhADe3ICPtGq7iTLM=; b=dYaPK04mf+kktlRxP659Zt9e65VdEcCRmxKDEd/6u1vehYWkMq7BlSYjLmiHwieuvk Mc2nE0dnhdEt+5PuB3YAHQH5nOY1kZ+G50BL+7vkSdpRyoxKtLqGZYiVEz4/FD7507pL Hbv/iYxhnC47sSYpC0M+67zSQFwdzTjtsauxAUVLlE979hfEfQt/HrXyg4UH0vy4AHJK J10Q8qr4y4L/or0xVRPVgAlamZEHpvbx2oSCGJrNeIr6xk1g4lGhlwHSvcmifopQ9Px0 qJkYmxaoeKqvs7hxqpcyJkBanz/08iSwvJZm/FQDGt81p+2W31X50++/fAuUMoFcBSW/ cRvQ== X-Forwarded-Encrypted: i=1; AJvYcCULM1ZmP0qOMc4qAt0jHi9SATYDsMK/iDj0U7d9j5p1R7bWGp5pYef50SZTXrS8JNawUJ78BNoBZsV1drQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/rhbQftmFWYmmL4CH/Sbbpkcd9FqsTdZqNrNrLzfLmGNFXwk6 eWPII3/efDgqBU9w9o7XW3UIU1lA1QAYVNx1zA6e4R79afAEhK/66wxoSqIJmbA= X-Gm-Gg: ASbGncs0hJ1rIsPDEs/rKoyNr4oSzotFRajU3uEWewNwIXrTS+wUuEvmOAOlzEri3y9 ovWEJgsGuvNhl/4NVXPGkS1t80hsmyesg1+bbMNcwm2XaSm0GrlvRAMY8icsABFLdHWLvEAVIUi 7sWuxtTxeii05lxNJ7vUuSvHmubMRQIb8+uzp+6R2aJpKyrvD+8oJn8u8NDN/zLU4HoQ+BiKzT+ +YP4Gr/6QOH8UrOrAXTl6zdL/uoE7VHPb3EyEYw0bjFYWNfJZzNjbmEHaZ6vU+NkA4XOZr+PKuI 7XDZyiaqJ/ZQNTiSJqq3wldKjYWpYpCmiykDU6NYSkaEwKBF1fK4dt5msg== X-Google-Smtp-Source: AGHT+IEjLExiBo/pTRwIXb6nfVt9VVnMblJ/vXH80y5StmUX3A8QBF3za9FzG7eNZqTpd9SVfNtr1w== X-Received: by 2002:a05:6000:2dc4:b0:39c:dfa:c3de with SMTP id ffacd0b85a97d-3a1f64a383dmr2369977f8f.47.1746788820116; Fri, 09 May 2025 04:07:00 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:06:59 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:51 +0100 Subject: [PATCH 04/14] spi: spi-fsl-dspi: Add config and regmaps for S32G platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-4-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore S32G adds SPI_{T,R}XFR4 and extends SPI_CTAR registers to 5. Add the new regmaps, configs and bits. dspi_volatile_ranges gets SPI_{T,R}XFR4 added which affects all platforms, however they are further limited by dspi_yes_ranges. Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 701cf56d28e7..df6f85122bfe 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -35,7 +35,7 @@ #define SPI_TCR 0x08 #define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16) =20 -#define SPI_CTAR(x) (0x0c + (((x) & GENMASK(1, 0)) * 4)) +#define SPI_CTAR(x) (0x0c + (((x) & GENMASK(2, 0)) * 4)) #define SPI_CTAR_FMSZ(x) (((x) << 27) & GENMASK(30, 27)) #define SPI_CTAR_CPOL BIT(26) #define SPI_CTAR_CPHA BIT(25) @@ -92,12 +92,14 @@ #define SPI_TXFR1 0x40 #define SPI_TXFR2 0x44 #define SPI_TXFR3 0x48 +#define SPI_TXFR4 0x4C #define SPI_RXFR0 0x7c #define SPI_RXFR1 0x80 #define SPI_RXFR2 0x84 #define SPI_RXFR3 0x88 +#define SPI_RXFR4 0x8C =20 -#define SPI_CTARE(x) (0x11c + (((x) & GENMASK(1, 0)) * 4)) +#define SPI_CTARE(x) (0x11c + (((x) & GENMASK(2, 0)) * 4)) #define SPI_CTARE_FMSZE(x) (((x) & 0x1) << 16) #define SPI_CTARE_DTCP(x) ((x) & 0x7ff) =20 @@ -135,6 +137,7 @@ enum { LX2160A, MCF5441X, VF610, + S32G }; =20 static const struct regmap_range dspi_yes_ranges[] =3D { @@ -146,15 +149,29 @@ static const struct regmap_range dspi_yes_ranges[] = =3D { regmap_reg_range(SPI_SREX, SPI_SREX), }; =20 +static const struct regmap_range s32g_dspi_yes_ranges[] =3D { + regmap_reg_range(SPI_MCR, SPI_MCR), + regmap_reg_range(SPI_TCR, SPI_CTAR(5)), + regmap_reg_range(SPI_SR, SPI_TXFR4), + regmap_reg_range(SPI_RXFR0, SPI_RXFR4), + regmap_reg_range(SPI_CTARE(0), SPI_CTARE(5)), + regmap_reg_range(SPI_SREX, SPI_SREX), +}; + static const struct regmap_access_table dspi_access_table =3D { .yes_ranges =3D dspi_yes_ranges, .n_yes_ranges =3D ARRAY_SIZE(dspi_yes_ranges), }; =20 +static const struct regmap_access_table s32g_dspi_access_table =3D { + .yes_ranges =3D s32g_dspi_yes_ranges, + .n_yes_ranges =3D ARRAY_SIZE(s32g_dspi_yes_ranges), +}; + static const struct regmap_range dspi_volatile_ranges[] =3D { regmap_reg_range(SPI_MCR, SPI_TCR), regmap_reg_range(SPI_SR, SPI_SR), - regmap_reg_range(SPI_PUSHR, SPI_RXFR3), + regmap_reg_range(SPI_PUSHR, SPI_RXFR4), regmap_reg_range(SPI_SREX, SPI_SREX) }; =20 @@ -166,6 +183,7 @@ static const struct regmap_access_table dspi_volatile_t= able =3D { enum { DSPI_REGMAP, DSPI_XSPI_REGMAP, + S32G_DSPI_XSPI_REGMAP, DSPI_PUSHR }; =20 @@ -188,6 +206,15 @@ static const struct regmap_config dspi_regmap_config[]= =3D { .wr_table =3D &dspi_access_table, .rd_table =3D &dspi_access_table }, + [S32G_DSPI_XSPI_REGMAP] =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .max_register =3D 0x13c, + .volatile_table =3D &dspi_volatile_table, + .wr_table =3D &s32g_dspi_access_table, + .rd_table =3D &s32g_dspi_access_table, + }, [DSPI_PUSHR] =3D { .name =3D "pushr", .reg_bits =3D 16, @@ -262,6 +289,12 @@ static const struct fsl_dspi_devtype_data devtype_data= [] =3D { .fifo_size =3D 16, .regmap =3D &dspi_regmap_config[DSPI_REGMAP] }, + [S32G] =3D { + .trans_mode =3D DSPI_XSPI_MODE, + .max_clock_factor =3D 1, + .fifo_size =3D 5, + .regmap =3D &dspi_regmap_config[S32G_DSPI_XSPI_REGMAP] + } }; =20 struct fsl_dspi_dma { --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 66D2728FFF0 for ; Fri, 9 May 2025 11:07:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788825; cv=none; b=pw44MYmdXZspCQtScDC0CcOl9t/hLX0trvYmrNpso7pd/hNwJw+wTHBoNw6VovA3ERkOcP9kvInlhiFIhnhPX9Y0d8GSVzZU8ZaoNCFV797EaenM+RQLE59bdCDaNV10jBLTRHVc7wCiCvmqqrj4hCVkVGYtjZx4WmjNCO1gpB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788825; c=relaxed/simple; bh=D+fL2YJhn78smRy/FVA67pJck8oxKruZt+xjNMzmkhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QSXC8WpDWzhuf5z77HNpxiznk8r57IBu5eV9XWwLr6mAFjVn4abkxgxfCH5QSIwnehlSRHIHVL/d8/vrQfZ4dNaIuBURpl9xnYY8WR+Skrt2VlJvslOSutOABXIgucREpPZJueofnck2qnNeyPkcUDXZC1LIMjbYS6nN3m3Utfs= 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=BaJbqu2w; arc=none smtp.client-ip=209.85.221.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BaJbqu2w" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3a0b6aa08e5so1820265f8f.1 for ; Fri, 09 May 2025 04:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788821; x=1747393621; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=82buFIB+rtX6lyncKzfqQ1BjFEonYyuZcyA3lmRU5C8=; b=BaJbqu2wieti/Q0iXiU+KNwCmkqfsm46IRcDT0Ic90dMo041YTrb3WmtPFulT0II0e L+yMYlMpzk0s7RWVxkjun3Yov7fspRHi8yldOAvdwqU9uXRzDNDmCqTalhdMqSkXVON9 7B3Q2fxNae95yl5+xosoUTK15kaGYO31ca3SYoA2txh1cm8I5NaniZ4NemfEI94GyD1L 17ANwzPmnIHbkL6ps4zGKecybSfSlV4Z5yTdloKCkEzsioap3E4GsvCe+6AH2Sh+UQBQ a1NHtQK3mjpP5NefEP0FX3uLP2FZDqmruTce93z7ga8x+sabKe+oCO+1eTOjuf+lgAm6 Qndw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788821; x=1747393621; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=82buFIB+rtX6lyncKzfqQ1BjFEonYyuZcyA3lmRU5C8=; b=to1nt4APMCibPoukeGhx7xyCer+UqMENC9DUVmW7JqiGKxQSwIlI9nM4zlo9HT3Rvb oQVsM3T3c+3IRHnNfdHmpB/SDYpNONHYtEe/z3QpujVG7TyuyJLdAuBVdMlaE9CfOtC0 9VldrpmJ1oucQUXlW69EZchBZhHrbbkFD7/ItNbPd8GOZD7h02qEa2wsTDsd3tIy9R13 nxGD6eqYsyrnHhrR6cp4DQ1XBR6B6BbImcFva50BjMJCUBqkLuKw8u7UwT+FzdhFWHW1 8EQNx8eKPeXhFOpCFEQcYcp4eUpAlUSVuwTGadg8ZjHbivN/oosse3lDCRxXb34u068/ y2DA== X-Forwarded-Encrypted: i=1; AJvYcCXxRDGMkIGwGQC5Z0Ld2mhVMVftnibpHREbtE5haYlngCRy7zLGFJN+mBLbkxmAqQPH9tnQFKzcBzlHarI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3j/tZkXvq3La/HBXPnFs5n6b9JBDgdvqx+/OepNeWMnj2iWQm d10UhoJyq9BXAfeQRSANspjN6dQHhvD3laka8VFyCB/CEy7oOw66+kSJW3tPxnY= X-Gm-Gg: ASbGncul7BdeyLUQi57PMICQ+wAx8CnHM5AmkXF4jzxnilFkpZX29J91m41sxReTql0 y4kj/fQldp0MF+PyJ79EPxff6xrB2Pwfknzlwtp4gQWJwO+F8aqF31mMWxUOPVabAjH0cNSx3Hg tB23WsCAwU06JBQPff+dHDNtGjyjDLBEQ9nuu+mbDxNGNZDetFSL7ScSlhf80gBUjWk4QKVTh6C tGsppuGl/3jm7n4AwslEVKsqlGkd3QJ2xbn4uYSNdJHKDd43uxX6Y0QCf39RaCIFuJp4XIYVOe+ 4p+xAypVsJhJ/hKO8wdij7jM+Gbc1kijkoY1yBENRpJKhk0= X-Google-Smtp-Source: AGHT+IEE94+EF9/8yZCVzM9YnUpAQNsIoaIC6oYQfj4cjZjT31gCTBuncCPpzbHVyG2nFW+mquupKA== X-Received: by 2002:a05:6000:220c:b0:3a1:f5d7:b041 with SMTP id ffacd0b85a97d-3a1f5d7b0d7mr3035935f8f.25.1746788821614; Fri, 09 May 2025 04:07:01 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:01 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:52 +0100 Subject: [PATCH 05/14] spi: spi-fsl-dspi: Use spi_alloc_target for target Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-5-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marius Trifu , James Clark X-Mailer: b4 0.14.0 From: Marius Trifu spi_alloc_target should be used for target devices. This also sets ctlr->target automatically so delete that line. Signed-off-by: Marius Trifu Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index df6f85122bfe..f7f9425a19e1 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1340,7 +1340,10 @@ static int dspi_probe(struct platform_device *pdev) if (!dspi) return -ENOMEM; =20 - ctlr =3D spi_alloc_host(&pdev->dev, 0); + if (of_property_read_bool(np, "spi-slave")) + ctlr =3D spi_alloc_target(&pdev->dev, 0); + else + ctlr =3D spi_alloc_host(&pdev->dev, 0); if (!ctlr) return -ENOMEM; =20 @@ -1379,9 +1382,6 @@ static int dspi_probe(struct platform_device *pdev) of_property_read_u32(np, "bus-num", &bus_num); ctlr->bus_num =3D bus_num; =20 - if (of_property_read_bool(np, "spi-slave")) - ctlr->target =3D true; - dspi->devtype_data =3D of_device_get_match_data(&pdev->dev); if (!dspi->devtype_data) { dev_err(&pdev->dev, "can't get devtype_data\n"); --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 DCB8028F932 for ; Fri, 9 May 2025 11:07:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788826; cv=none; b=XdDwXL6goc/klCmfMfTCH5qYn83dXML32mHIkkULqLmsKFyETay3tai9syS4W1+g2woEN/hWiNV7Xb36toiEOI+Ped0Oq0cbJy3J/Cz9xKqHHC8UkiBKDGZIov4Rc0ZlJEC7DZJEf2tlymT2dSurNA9VAPAGJc9m4chWQdOhiZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788826; c=relaxed/simple; bh=/FAuRPFC8ORDoN/VXflFQ2NEMxezE2lgdO50IWKPdAg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qPvMMNCKHHz25OkqTZJzirIYpCMFV/sUkcCoFpc+UP98l8k0yb24w5g4TuqvCALZ15Q/yoQYxx/to9TwzjK8aa3Yk53MTI4lvbgDORUzFZBnu9s8ns+srTevZgLm6IGA1Yjy11c57tlIuq8gIqfTYm4i1u8oIU7GQJFV3EFPy8k= 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=cR58UcSU; arc=none smtp.client-ip=209.85.221.47 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cR58UcSU" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3995ff6b066so1099057f8f.3 for ; Fri, 09 May 2025 04:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788823; x=1747393623; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Z83P5zYL5aiqJ4xhC2aD1SNehmR83/wjYJwbnC4UTJU=; b=cR58UcSUp/4wAZsyJLhDxagPmAE4OvsGkoqXjnMSbinDq8D4c8pZmsgQu6aGouYWmY myOi28F6hyfSnjK8d+CLNeq1ndhgujIW57ZUfUm5nCWd3VC/FKEp+8b6MTXl7ea9S45t 491OHUVYWn4h+qAFHZ+042p7OAszCPpuamaWjgb1GPztv0u+YcU09dk1CteHnFkxq53/ qeb4T76lMakZpwpw+Ivundd8J1mbxs4f/o+FB/t5OQAYd+P7cZL6n3u3jl1rgGw2jyCr RW9YRy65kxmBLVK4YofjVT8RP2gD6rQZufo5a8a8V2qDFiwugzjONC3ydvmZBLb9k8Z/ m0dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788823; x=1747393623; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z83P5zYL5aiqJ4xhC2aD1SNehmR83/wjYJwbnC4UTJU=; b=QSyOMQIFT+GosjiT4vs+b+A0IbEv+JC1Oqws/6auuvh4qkTTl0ZCCvDsU5ZULqDt2O ouF/x6o9Zvoy7fuCtDHArgP7nZboLzs4RWA1xnbuGsDPW8GHhPpxgsFBEG8JndAuV9MA U3jAT/cuFjZC4Zkpz21cgRC9WDeFhzaJ9LDlHKklTLRE50KesItUq2nEh2mUShLmjUoU u4hebflAj5PuzDXFYBJMbsm5aY2WGYuwdzX57IKBeCFbNw+5Zy9rHrvxYGNQsu7uVEom YCnb4YmllnPxsu/6QAK4n62vZ5W+dvhtaY591l2ZM4x+RZ2zBEo4WL8I/nB+d8Ze950x bZ1A== X-Forwarded-Encrypted: i=1; AJvYcCW/pLFRG8wMf6Wq53qjgDmLSzlKnb6F3sSAUMca0mmOJ41QQL4YRLnycoZDFGuGa+G5zLdCUIVZZQFrcbA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywn6ySmuXv84jxiU7AaU8XTPWodKGIye9wG7Ut0MVu3W35e+YrV ao0kepyBVgxIhS/c1n2l7s9JJhHM2K+kk17euAJxAYKwpv8J6TBdQ6rT6Gj1+oVNhw/TWhWZhTC gjuU= X-Gm-Gg: ASbGncuWIgxjxBt1zvhAdT65JYgTxT1er+1Kb8rEmBUcpFA76CsrU+LU+0hBBRUronp Z3Ei957BCG7akHXRVLRtzGErtSzSE0z1nSs43rnByqaVHubUz6gi0VmF2MjiCiTmaCvg8MaNISO XSYKzSHScoWyi9Fv50QP57qWTaGOTBmAAI7fCrsjiVl69nC0Ojn6Rydc/dfQM7CJvqI8iPJEaQr 2U2/ok/EKe/gcclSwsHU2iVh0LhoFdOf+W5pplvxWzf68WVi14bXk8zhefI+oubcYTCnrqQMI11 Ku8O9FrLlMVpFjd4DevnftrI08KdWI2OKqnToegPVl6+y1I= X-Google-Smtp-Source: AGHT+IEzZyvVmE0isCL1qd+GE70rpX9DLtjU5jOZ0ngvIzyhV3E/BibSqbyphaSiycReT9JsLKLk1g== X-Received: by 2002:a05:6000:2cb:b0:3a0:b8b9:6b2e with SMTP id ffacd0b85a97d-3a1f64a430cmr2498885f8f.34.1746788822979; Fri, 09 May 2025 04:07:02 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:02 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:53 +0100 Subject: [PATCH 06/14] spi: spi-fsl-dspi: Avoid setup_accel logic for DMA transfers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-6-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore DMA can't repack the buffer like the CPU can, so skip the accel path which may change the word size and break DMA assumptions. Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index f7f9425a19e1..902bf23d276a 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -849,8 +849,8 @@ static void dspi_setup_accel(struct fsl_dspi *dspi) struct spi_transfer *xfer =3D dspi->cur_transfer; bool odd =3D !!(dspi->len & 1); =20 - /* No accel for frames not multiple of 8 bits at the moment */ - if (xfer->bits_per_word % 8) + /* No accel for DMA transfers or frames not multiples of 8 bits at the mo= ment */ + if (dspi->devtype_data->trans_mode =3D=3D DSPI_DMA_MODE || xfer->bits_per= _word % 8) goto no_accel; =20 if (!odd && dspi->len <=3D dspi->devtype_data->fifo_size * 2) { @@ -859,10 +859,7 @@ static void dspi_setup_accel(struct fsl_dspi *dspi) dspi->oper_bits_per_word =3D 8; } else { /* Start off with maximum supported by hardware */ - if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) - dspi->oper_bits_per_word =3D 32; - else - dspi->oper_bits_per_word =3D 16; + dspi->oper_bits_per_word =3D 32; =20 /* * And go down only if the buffer can't be sent with --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 06CAE290BB7 for ; Fri, 9 May 2025 11:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788828; cv=none; b=aTKXEzWS4T0nj+sV6Oxu+XhZraBEbX+7Imsf977chVD6khLUIoSfcZdm4hGMzdc0owml3bqhKf21jeeTV8KZZWhaPKZty/OHzU0lBH/67qM5Fz5pTPJHJj91HXpEhsAbFQ73Y9/aGwDMX3kAO7oFeFVyhQg5ZKHpChDdLLrUvNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788828; c=relaxed/simple; bh=xranPDn1OkC/NMUiO3u7jz/wgKrHQyAzstGTneAYvJY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TvD6//FFec6Heuyojey6BIkpJfbhXXOVeXDACIzyaYni0fsMmEcSSfhpGEICXCX2Bp65gxiVOPl0p23rqBnO/tijhJzCfCg23lo5AiVGhC8xYW+ykKbRUhhoylPfF7sz6L9xIrinkxFNR0SpSiHJCd46eLgq+VKxPI6jqvLDixk= 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=tADtBuj2; arc=none smtp.client-ip=209.85.221.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tADtBuj2" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3a108684f90so1015391f8f.1 for ; Fri, 09 May 2025 04:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788824; x=1747393624; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0/ugUs7fJj63IN/MNSKX5UMLi4/fRK7xsOMmgdlrCl8=; b=tADtBuj2ACcYtc6anYQGg1c1PTCpJPHv+zQuWM0YaC3aJDyaMSSbzAwz0MjpQDW4Lx CVIg79ZG72kmS+b0LmZhliIymGi9jhEHq0oPv0cI7omaxYTPGPkeXzxQKP/yPIPcsoZV RJ07pX4bYCtJX8Htkn2DVX74I7g8azDwY35sC0Ry5tAT/2NuihUa6GTeKyzdvX4eRGDW RogW5TR93r+QsAqDKO6YdO+xN6L/AoQNX5Rht8i2mrWzD1Rm7J3UKheazNQ0nyWZAZ8S gmXDKQs3sIeo3vr4/IkN07UgONRZuDMf4xyW2tlo5Hx2K/EQS7crC08TAQQxMI7gR/C5 moQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788824; x=1747393624; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0/ugUs7fJj63IN/MNSKX5UMLi4/fRK7xsOMmgdlrCl8=; b=tMVuus7OeCZg3SqXbGLOwURgw0sqb9Zc3J+W/jeDLWrD3mNPxqDPy6bbOi3j9M3t3G wHeyCKrKk/DHeQFX6b7HWUjvQCJvpGv10EDyQSJez53K/uEGQek4yncmpxzOPAuAzyOn m79Qn7/JxF+CQIxZORGadUzarIBHaxE44vSFP3SrKScqYMREGs4VTdNf0KyBz3oBeqvq G7oh1l/mDXN4vPKMkSjMuwp2dmg7RhxhGbpLAottuZp8JNuMxvVtWqnplW138zTPd6+r w+xPgSMoT73aQpRhFftSnv9ukF0b85LYrwLsUn4yln8RqThysdTKjcrt28S1gxqWPj56 AExw== X-Forwarded-Encrypted: i=1; AJvYcCUR7yu7lhmq+u4gfYmwFdGaEZoNbXJVYKnaf5JLLYHE2SdBxjvEivadQryX1jM6Y5q2oA/ZHtO6/db9TAQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwE3AQvK39hre2gJaAruwcWmI1e06vgkMRkIZp5hYaLGDaw9nA7 WqqT0WIYjNiz8N6NikfW+cbowCWMiCxqG+lHCzZXsP9NLrhuxT4Oluwgf99LtDg= X-Gm-Gg: ASbGncukkwRdK9k5+LhIc6qho+K8bbcYEQUn30JV2zCb41gPiVO2jf8DbRWwoLbLXwl qAxhWnLS2ty3ChrC6ojm+7cM09F0WJM69aZjAwsOXeVbxCUrxqU8rzn0FRNbi+HLB1f3Ga8v4Sx 0XqLoxTPBNUkE+EEVwL6LAKAkbCxjsOhdOpDyqrA5zpCF+VsPdCNpGgPA+YFjiOXc4aBCGeNw+1 4x72gOv3/x0YlUMJWWMdCuPxsjp+gswetF/Hhw1RYlTSoa1kVH5a1eO6h8WL01uHwBQ7klwwIo8 +8l6D7fxxiShLcRJnf/GnnE5KawF8sw/E8OHg4GFvqNJj4I= X-Google-Smtp-Source: AGHT+IGt4VaJbNHq9FNQxWvc/835NhTOA2iiwAH7rDv6mlJrY9Iqd6PFdsksfuN5qOW+kOzhHmEEPA== X-Received: by 2002:a05:6000:2404:b0:39c:c64e:cf58 with SMTP id ffacd0b85a97d-3a1f64ab930mr2978779f8f.55.1746788824315; Fri, 09 May 2025 04:07:04 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:03 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:54 +0100 Subject: [PATCH 07/14] spi: spi-fsl-dspi: Reset SR flags before sending a new message Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-7-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore If, in a previous transfer, the controller sends more data than expected by the DSPI target, SR.RFDF (RX FIFO is not empty) will remain asserted. When flushing the FIFOs at the beginning of a new transfer (writing 1 into MCR.CLR_TXF and MCR.CLR_RXF), SR.RFDF should also be cleared. Otherwise, when running in target mode with DMA, if SR.RFDF remains asserted, the DMA callback will be fired before the controller sends any data. Take this opportunity to reset all Status Register fields. This is required for enabling target mode for S32G in a later commit. Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 902bf23d276a..b7363cfc649d 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1063,6 +1063,8 @@ static int dspi_transfer_one_message(struct spi_contr= oller *ctlr, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); =20 + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); + spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer, dspi->progress, !dspi->irq); =20 --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 6F9A1290D8C for ; Fri, 9 May 2025 11:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788829; cv=none; b=duia9dlq8OVmjJnalB1EZa0VDG3h/FwV1skJRxkirNPICxYygk6lKpK7qnmVR4aVYWON9cQHs3il5DFPpcUWi8kFVsZXGhWlO3NYW9rWS/NQ36Zrrthr4FUsfEqYycbVS6+TLCOazSfVpNka+ZX7TQY53IsbZnKdYV92dpXgEzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788829; c=relaxed/simple; bh=Wzbi1SX9mtAF2E7Mjcw8XjP0xTVKnkUioAGI/9ufBe8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f5ImUw+L92EtBtq4UYwHdcN/6XOUEvcuq+fuOdHRJsP7CvJBsYfSfLiUP8T2FoS9RPg/zD+cW5G7daVgYKBxzoxoQ7z7CoSx+TdOCDc/yIpPgrHALv3CtrEmQefaq1pFo0FZ1ycaSAEecdPmYrWOPNCsoxpGntIO2KgnAnf/NvQ= 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=gGLnv/Tl; arc=none smtp.client-ip=209.85.221.41 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gGLnv/Tl" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3a1c85e77d7so799078f8f.0 for ; Fri, 09 May 2025 04:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788826; x=1747393626; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=X9YN8+8rnHDsp/b09Y/xOR9H3TlYqB2jpDQsHdPnIdk=; b=gGLnv/Tl8Sm21KyMwuvCdXbd/QsLcu66maSgRkpo7Zjrz41eM6Ml3NXnPwDdguOBmG yk7DlIZHnti3+8ZO+ATC171E9QAeblcJk8IuII7C33S8y8yHFobCehDUvDXFLyG3klEY G2o1ggip1ye+gdIRxc5L6+biWMJpkd+LuJWXjHYCU+WeNriNDbBiaA3SVfmBAucptSKk u7NMYImjM3YTkLZo3WgIAXhgOqqtNAM232Cl+J7xwLZwXT9ro9HEPq0VZTIYT75WaOYT sSLIpiR2GKXhs2ACMBuTh/DY0nBLPbzOqJ826zjR3GBZ6sLwfIttmmkONeR4ZQe64DDT 9/qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788826; x=1747393626; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X9YN8+8rnHDsp/b09Y/xOR9H3TlYqB2jpDQsHdPnIdk=; b=QC843jhcm0g0B2UPwVe+6zmL7rhZ8BWZvV5aPmWo8KypIXs4EuDYnfm4Fhje16v9EH LuOLRmDZlWw9SWMZv5ANzRs71unL9Ggg8pr+yZWxZfbq11qqx3C9Rg4EmJh1P/a9y8OT w1pLvc7uLQ7BhsBwwv+bXigmF00u1iyOOWVxrtexi+XHpsnh0QJlx08bj90ZnlqptErl NhMp/qCWNVOsIK0dcoveOfAOoa0CpwWv1EhGp2MYlfJmVzCr3kwYuyy7RIHY++XM5ojE NzpIZc+7BhZZKCART6wFqlfTpSq7QrFk1UK+CV4av4ji5vgaKjmxrYvgNqLtdcVUE8l6 GsqA== X-Forwarded-Encrypted: i=1; AJvYcCX8yNiNj2dUAfB4ujR/jIryV5vK/FxwnWYnzwjUtRPpIXBsHaVP9NOlX3ld8N1uRo3yH1Lz878wkaNLFZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YyHWv4XnH348enDmLIh1QCHM/uaHWjTocRDFtgoTdAReJeMa70X AUDCkaZYLIL6RNSP1l/dwDoZTnqJBrcuELzoYpBopogidhOCZcYeIupEIMTzC6M= X-Gm-Gg: ASbGncsXVPENS67xXZsNBdnpKzzHP0frgKTNOARM9SaylJI2/AQCD3UHH/fY1IR8KD5 rn3JnVdI3BZaDeAyoP93aASiN8+uYcO8XVL9hG2NNPfq+RqVNmGRGZKDFQ2b6xJPiUHOx70M1Tl XXChN9lF4IwAYjovXjGvvYOz8Bn3IpGMqtNTSJYZC2pgNfJ5ZVBEnxcIFpA3cnJCj4ogblzBO4H aSSL/Yh1Cw9wTsEGe7ECH+OXSe7dVNcp+Lo+WVCPVoMWUFJNeVn8fsTkADUSb/i1s+SA7Q/KG8I PDVLuL8ULBjby2ygTdfKHmjgrtx5jvOZYpT/Viq8OBrdQEY= X-Google-Smtp-Source: AGHT+IGTcDbYuLQC5gOTqBLxhDeYoC8oTLnNT0OALiU2xxGu34CRv1e+8uSkOAx/4GXBO/mVq1Dayg== X-Received: by 2002:a5d:584b:0:b0:3a1:f635:1136 with SMTP id ffacd0b85a97d-3a1f6487d80mr2603233f8f.28.1746788825706; Fri, 09 May 2025 04:07:05 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:05 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:55 +0100 Subject: [PATCH 08/14] spi: spi-fsl-dspi: Use DMA for S32G controller in target mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-8-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ciprian Marian Costea , James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore Switch to DMA for target mode otherwise the controller is too slow to feed TX FIFO and UNDERFLOW occurs frequently. DMA can work only with 8 and 16 bits per word. 32bits per word is not supported, this is a hardware limitation, so we keep the controller mode in TCFQ mode. Signed-off-by: Larisa Grigore Signed-off-by: Ciprian Marian Costea Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index b7363cfc649d..50cec3b94322 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -137,7 +137,8 @@ enum { LX2160A, MCF5441X, VF610, - S32G + S32G, + S32G_TARGET }; =20 static const struct regmap_range dspi_yes_ranges[] =3D { @@ -182,6 +183,7 @@ static const struct regmap_access_table dspi_volatile_t= able =3D { =20 enum { DSPI_REGMAP, + S32G_DSPI_REGMAP, DSPI_XSPI_REGMAP, S32G_DSPI_XSPI_REGMAP, DSPI_PUSHR @@ -197,6 +199,15 @@ static const struct regmap_config dspi_regmap_config[]= =3D { .wr_table =3D &dspi_access_table, .rd_table =3D &dspi_access_table }, + [S32G_DSPI_REGMAP] =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .max_register =3D 0x8C, + .volatile_table =3D &dspi_volatile_table, + .wr_table =3D &s32g_dspi_access_table, + .rd_table =3D &s32g_dspi_access_table, + }, [DSPI_XSPI_REGMAP] =3D { .reg_bits =3D 32, .val_bits =3D 32, @@ -294,6 +305,12 @@ static const struct fsl_dspi_devtype_data devtype_data= [] =3D { .max_clock_factor =3D 1, .fifo_size =3D 5, .regmap =3D &dspi_regmap_config[S32G_DSPI_XSPI_REGMAP] + }, + [S32G_TARGET] =3D { + .trans_mode =3D DSPI_DMA_MODE, + .max_clock_factor =3D 1, + .fifo_size =3D 5, + .regmap =3D &dspi_regmap_config[S32G_DSPI_REGMAP] } }; =20 @@ -350,6 +367,12 @@ struct fsl_dspi { void (*dev_to_host)(struct fsl_dspi *dspi, u32 rxdata); }; =20 +static bool is_s32g_dspi(struct fsl_dspi *data) +{ + return data->devtype_data =3D=3D &devtype_data[S32G] || + data->devtype_data =3D=3D &devtype_data[S32G_TARGET]; +} + static void dspi_native_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) { switch (dspi->oper_word_size) { @@ -1398,6 +1421,9 @@ static int dspi_probe(struct platform_device *pdev) dspi->pushr_tx =3D 0; } =20 + if (spi_controller_is_target(ctlr) && is_s32g_dspi(dspi)) + dspi->devtype_data =3D &devtype_data[S32G_TARGET]; + if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) ctlr->bits_per_word_mask =3D SPI_BPW_RANGE_MASK(4, 32); else --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 ED2C6291154 for ; Fri, 9 May 2025 11:07:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788830; cv=none; b=r550pruvxkoGx1oJztZjhzFhqirrV3XhBUSwljmOULEom3e9O+BSzYPlT4R9YtwqUc5BZdwSLdJEj6QWoLt82YAfMLYrld2gHduqRIwGTbcjsU/XFYOTmnIqMzrKw1oQuYCpHmImSDB1e/jD86PbHX+PiB4huXBnBpBhlDBgQn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788830; c=relaxed/simple; bh=S/bLVRCZo0bzcqIxKXf/hzh5QW5OR0CMl07vRP4K15U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BVjXED4SDoczFiac5QXHiv/tpFYPWS5mSt/80P35GvOv7KKauIYGtmuTqb7zTCjmSEWcpDF4SIaybI1xoTm4geqxAlnw49fdyGSj4gZF4s4Lqe2W6EQWc3++WBp6ibEZxgRsj3mHk/rDyvzQ3ChO+wEv49GJvGX7N4HLIjBd/B0= 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=fcmkc4NY; arc=none smtp.client-ip=209.85.221.48 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fcmkc4NY" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a0b9af89f2so1154851f8f.3 for ; Fri, 09 May 2025 04:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788827; x=1747393627; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fEyehrM+Fx4o61r/yR0u4BgsTY9lmtx/SKx/NBJ8aCc=; b=fcmkc4NY3e06M3r35eJcaaQJvrglBrg2+8r5I4v18Qq1gGy52ko2ucK/R26ePMG9dU vq1sWhdRdgnILOA2bcPC6tONNH8hsZu0Xw5WOZhKbZK0KJES76T4Cv+R/MXPd52SXh8G zjhVE1s83JZfCXIEnAYo33slZ6GMqnjsk8YInsjZJEcvNVmWCrT1uklRkEuzmsvn1F5M t+aYIAGgDTBOeU62TTcF1ebW9NNm0owXqioMS91rO2FlldYXsGitBj3YCJFQ6lB27SXR Zsf3scFjYvik8nIu9PQndeNVMJQMc18QJFT5LSsPSmEgwWF9L0t7tZDbsboakbNYtuIm wnPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788827; x=1747393627; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fEyehrM+Fx4o61r/yR0u4BgsTY9lmtx/SKx/NBJ8aCc=; b=D7ls7Xr6NzCgYyUUiecJfOYyz48Ooux49aweyVafydfPSFn1pMac5v3io8OvJK08cK KnGscASMr/B/wzaPkyNWg3VvXPtV9XctlCX3Z6nHyyegtOQNpcrVLxoUlFmLqKR/Chqx FTDw50+Btsqu/Jl18KHnr8JAORT2iV/yPp3AfOnNKX7awPgp+RzXOWwMCHvUZvetDZCb WO+noHJfq9BmNMrJ5ukQ5YfZgP5Vth6/MA4ugZUasZHyVGl98oGNSIs3wvTOFnCRF9Ka kFhqIt7tRA1hXUWDe3PuPpBl4itu7DRc8VDmFXZplPHY+rWyThWWwSWmPcpgQytccZNm spsA== X-Forwarded-Encrypted: i=1; AJvYcCWt51tiuw7JIVSV3njcAiOWEaLMeo1V0YGXi805S5NluJXqRDEgtlAanij7MfzDC03x3H7MLSHNSuhHEoM=@vger.kernel.org X-Gm-Message-State: AOJu0Yxyjccb86WqQZB+aqBwMFOBWx+VT05Bjd/+YzXGyPEVcHsEzDfS QSz5S/TtRW+FYduz5FoYGYr3E1eg7ruBRPaUtuj29d5wWMwhiLirkTlvjhHWpTI= X-Gm-Gg: ASbGncvIbteYgPuaGXFZK3ICEbz06nfnZR+lJRBUoCTMCIvP5Lu+j1AdmLOT/FsinTE 5FCAZJTIDh2Gfn/9hALLzRa0VJfpbmLSVKZ1xIR0EMGoZk1ks7xF5TDzMOWyN13p55dn2jbhNsc wdsiQwd6YgsTTs/dxP2EDdTEhXxh5c4UTj9yTZnJ1UU2wi0Gb//8hZ8SLFXqtLvdGQGKx2OXFSX Z0yP/Y+Iq3snu1bNiCf/DCUwaw+msPTIGHPA5NAmPtcIJSZ99ZkXsccvrEwJWIgkCFuwfFbDGWC N+ETUARg/W3c3K2wCV2dLU66gxGKPV7pZmQfcb0WRVJ1yKc= X-Google-Smtp-Source: AGHT+IEQntKAHHe5FBbl7TvKgw8FWGCOZDWYXdtRsViQGulRTo3e/GMO/aV0MJn1nNmDeMFHI32nUQ== X-Received: by 2002:a05:6000:2506:b0:3a0:a0e5:d28b with SMTP id ffacd0b85a97d-3a1f6421ecemr2453655f8f.3.1746788827070; Fri, 09 May 2025 04:07:07 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:06 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:56 +0100 Subject: [PATCH 09/14] spi: spi-fsl-dspi: Reinitialize DSPI regs after resuming for S32G Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-9-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore After resuming, DSPI registers (MCR and SR) need to be reinitialized for S32G platforms. Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 73 +++++++++++++++++++++++++-----------------= ---- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 50cec3b94322..0613642d769d 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1258,6 +1258,39 @@ static const struct of_device_id fsl_dspi_dt_ids[] = =3D { }; MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); =20 +static int dspi_init(struct fsl_dspi *dspi) +{ + unsigned int mcr; + + /* Set idle states for all chip select signals to high */ + mcr =3D SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0)); + + if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) + mcr |=3D SPI_MCR_XSPI; + if (!spi_controller_is_target(dspi->ctlr)) + mcr |=3D SPI_MCR_HOST; + + regmap_write(dspi->regmap, SPI_MCR, mcr); + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); + + switch (dspi->devtype_data->trans_mode) { + case DSPI_XSPI_MODE: + regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); + break; + case DSPI_DMA_MODE: + regmap_write(dspi->regmap, SPI_RSER, + SPI_RSER_TFFFE | SPI_RSER_TFFFD | + SPI_RSER_RFDFE | SPI_RSER_RFDFD); + break; + default: + dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", + dspi->devtype_data->trans_mode); + return -EINVAL; + } + + return 0; +} + #ifdef CONFIG_PM_SLEEP static int dspi_suspend(struct device *dev) { @@ -1284,6 +1317,13 @@ static int dspi_resume(struct device *dev) if (ret) return ret; spi_controller_resume(dspi->ctlr); + + ret =3D dspi_init(dspi); + if (ret) { + dev_err(dev, "failed to initialize dspi during resume\n"); + return ret; + } + if (dspi->irq) enable_irq(dspi->irq); =20 @@ -1293,39 +1333,6 @@ static int dspi_resume(struct device *dev) =20 static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); =20 -static int dspi_init(struct fsl_dspi *dspi) -{ - unsigned int mcr; - - /* Set idle states for all chip select signals to high */ - mcr =3D SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0)); - - if (dspi->devtype_data->trans_mode =3D=3D DSPI_XSPI_MODE) - mcr |=3D SPI_MCR_XSPI; - if (!spi_controller_is_target(dspi->ctlr)) - mcr |=3D SPI_MCR_HOST; - - regmap_write(dspi->regmap, SPI_MCR, mcr); - regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); - - switch (dspi->devtype_data->trans_mode) { - case DSPI_XSPI_MODE: - regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); - break; - case DSPI_DMA_MODE: - regmap_write(dspi->regmap, SPI_RSER, - SPI_RSER_TFFFE | SPI_RSER_TFFFD | - SPI_RSER_RFDFE | SPI_RSER_RFDFD); - break; - default: - dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", - dspi->devtype_data->trans_mode); - return -EINVAL; - } - - return 0; -} - static int dspi_target_abort(struct spi_controller *host) { struct fsl_dspi *dspi =3D spi_controller_get_devdata(host); --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 9AF8C291868 for ; Fri, 9 May 2025 11:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788832; cv=none; b=YjLqmZYnRjk3Lv8zVZ6lbgxTUHZrOUm9r2fEIUtZ+4T+cKj9ZxqWRMc/hgnEcH/30c9ILyf8az37Whp0mJzKThUqALkjcCJR1ZKsZyzQ28Q4qP3/JfT4MjmXNRBoWSGLJMM8ShiMhIX0l0pOPED/IZ8ur1wG6R+VkJ7V9qrPdU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788832; c=relaxed/simple; bh=ENxx1z1sql8wM5uppwdV1BWLNPS2y3yHteg1vsYEf18=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PKMwHD/zAd27tIGP4nxln1g6MPoWLt/TDV0KsXcqREFSgtO7TBJmXF1rbDUllHDSWHqiwdoxbCeXIEZUOvAxhBBzEkQVrYmtzso2bDi4wAyeteP03UIvfnm4nYDRQZLzNrlzjrSBCJHu9YLg6YVwsffjjF45fVmovOaSa12JI7k= 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=VB1fY+Be; arc=none smtp.client-ip=209.85.128.41 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VB1fY+Be" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43edecbfb46so14579745e9.0 for ; Fri, 09 May 2025 04:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788829; x=1747393629; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qkUQ+DSZxqBk+Ct1g7deBrSh7xiTRYDOYQ8ekYGl/Lc=; b=VB1fY+BeVeZTf3wkFDtFnDR18aP2N1B3xlhx2cq/NEH5DpxdZ95xcsuBCblQTMqwqq 2XeArt+yOVQnMIZj/U8wD7twLFky6pmNJ/R2dIzvOG/RLCVpp+P6qj7HRsxHBgStq/M9 yL9ACnegF7HuzBaUJVVgnOTHP2NmeKxcHMYcpWQrTLoQ59bD4ou7NlwYRs2T7yvjqmzX pPwax9MEHih4SDE0w+ZRBjOZrP1snIgK48yDDk7TNRvjjj8MBgmcA2qfMPYeoNf5+Om4 X983pWtW9at4rV4X0u252LFVQEb+uN2gl6pQ5cB+K7BKBFr+JcOmwb6YwWnbidJGmmdH lwcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788829; x=1747393629; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qkUQ+DSZxqBk+Ct1g7deBrSh7xiTRYDOYQ8ekYGl/Lc=; b=vkRvdok7+pAbf4PfXjr4shdD9OjgXtK7tjnHuLHyUvhclu1MCUVdZAKdJU6MnjjKJd 7ivjGf91fNk7wA6QR7FzKRs7rsNZEyKsv46HxU5EDIaiA6cdh0LI3fnS1XwE7VN7khSm DMjOHBWE2V8Uf0bdIhVT/4ujAX8/YfHiDu7FEKL/xjrncdQcsKe1gTceSAyqRCHaPP+g ruAW622V34NCknixQ44kHZ8bm42iPOe2SUrXKe/UbTuSymjUFtIiRPoAoYap9UB0BbCU UUUepVnU/o0D9No4E/svAK9xjAVU5fQDgol2kQiwBd7XflT666d5oa8610ql3dkeUYMQ uYKw== X-Forwarded-Encrypted: i=1; AJvYcCU/ggZvZBJ+V8EYXunfL6Y6evaxwRuwwRJMRXgBvk+j+ZN/KeDUaKkKhoJUY2qLX8wkjfSa5yxBF5eZT/0=@vger.kernel.org X-Gm-Message-State: AOJu0YyL5bNIWrNKIvBWUunqqPSg0jnvrBDmZKQg184CRbruAxAVeFVG j+NoybZvAdF3Hl/BYyGsB03/i2c+06/3sKtYQWrHajjuUF09AS3zuf/wMWWkHvo= X-Gm-Gg: ASbGncuqwCKuxTaQmVWaMYSvAabEq1gD+tfK2nR9ixlVJwUFD6pyHhzJDorAoy+ZGJd 4lIkgc9Z4EPE9K2qNTXukOpN+GdCEEjZACPfpwKKzvktGgav2W6X6BazMoaiQhkdqmy8J4Jgmu3 8ATV96MoFROmjURzaFWK23J0ObJz3K35mG7WcWeCP7TrC14Q2Oba/uJAV/BuXcQk6s0x0Skp5YF G64mzsTrAcT+cQQkEAvzhUYn7t9rdUlZaiCaXgc9BG2RlFJlk+M+IN0sazPN3W/L1cHhEFxX723 ZhfDdoOyARaOAGedTA6Civgi+vbgfLcnC7DNmcj2uLov1YTgfaQAXpcnWQ== X-Google-Smtp-Source: AGHT+IHMGiWT8oT8oip5II6TERPV8HSSBR3AVz0wr78GflY0E9YVDL5RBtpoaYK37Au/6LAl5XIwnA== X-Received: by 2002:a5d:64cd:0:b0:3a0:b5ec:f076 with SMTP id ffacd0b85a97d-3a1f643106amr2707885f8f.18.1746788828530; Fri, 09 May 2025 04:07:08 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:08 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:57 +0100 Subject: [PATCH 10/14] spi: spi-fsl-dspi: Enable modified transfer protocol Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-10-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andra-Teodora Ilie , Bogdan-Gabriel Roman , James Clark X-Mailer: b4 0.14.0 From: Andra-Teodora Ilie Set MTFE bit in MCR register for frequencies higher than 25MHz. Signed-off-by: Andra-Teodora Ilie Signed-off-by: Bogdan-Gabriel Roman Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 44 +++++++++++++++++++++++++++++++++++++++++-= -- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 0613642d769d..31521dac1580 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -24,6 +24,7 @@ =20 #define SPI_MCR 0x00 #define SPI_MCR_HOST BIT(31) +#define SPI_MCR_MTFE BIT(26) #define SPI_MCR_PCSIS(x) ((x) << 16) #define SPI_MCR_CLR_TXF BIT(11) #define SPI_MCR_CLR_RXF BIT(10) @@ -37,6 +38,7 @@ =20 #define SPI_CTAR(x) (0x0c + (((x) & GENMASK(2, 0)) * 4)) #define SPI_CTAR_FMSZ(x) (((x) << 27) & GENMASK(30, 27)) +#define SPI_CTAR_DBR BIT(31) #define SPI_CTAR_CPOL BIT(26) #define SPI_CTAR_CPHA BIT(25) #define SPI_CTAR_LSBFE BIT(24) @@ -110,6 +112,8 @@ =20 #define DMA_COMPLETION_TIMEOUT msecs_to_jiffies(3000) =20 +#define SPI_25MHZ 25000000 + struct chip_data { u32 ctar_val; }; @@ -345,6 +349,7 @@ struct fsl_dspi { const void *tx; void *rx; u16 tx_cmd; + bool mtf_enabled; const struct fsl_dspi_devtype_data *devtype_data; =20 struct completion xfer_done; @@ -721,7 +726,7 @@ static void dspi_release_dma(struct fsl_dspi *dspi) } =20 static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, - unsigned long clkrate) + unsigned long clkrate, bool mtf_enabled) { /* Valid baud rate pre-scaler values */ int pbr_tbl[4] =3D {2, 3, 5, 7}; @@ -738,7 +743,13 @@ static void hz_to_spi_baud(char *pbr, char *br, int sp= eed_hz, =20 for (i =3D 0; i < ARRAY_SIZE(brs); i++) for (j =3D 0; j < ARRAY_SIZE(pbr_tbl); j++) { - scale =3D brs[i] * pbr_tbl[j]; + if (mtf_enabled) { + /* In MTF mode DBR=3D1 so frequency is doubled */ + scale =3D (brs[i] * pbr_tbl[j]) / 2; + } else { + scale =3D brs[i] * pbr_tbl[j]; + } + if (scale >=3D scale_needed) { if (scale < minscale) { minscale =3D scale; @@ -1120,6 +1131,20 @@ static int dspi_transfer_one_message(struct spi_cont= roller *ctlr, return status; } =20 +static int dspi_set_mtf(struct fsl_dspi *dspi) +{ + if (spi_controller_is_target(dspi->ctlr)) + return 0; + + if (dspi->mtf_enabled) + regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_MTFE, + SPI_MCR_MTFE); + else + regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_MTFE, 0); + + return 0; +} + static int dspi_setup(struct spi_device *spi) { struct fsl_dspi *dspi =3D spi_controller_get_devdata(spi->controller); @@ -1178,7 +1203,15 @@ static int dspi_setup(struct spi_device *spi) cs_sck_delay, sck_cs_delay); =20 clkrate =3D clk_get_rate(dspi->clk); - hz_to_spi_baud(&pbr, &br, spi->max_speed_hz, clkrate); + + if (is_s32g_dspi(dspi) && spi->max_speed_hz > SPI_25MHZ) + dspi->mtf_enabled =3D true; + else + dspi->mtf_enabled =3D false; + + dspi_set_mtf(dspi); + + hz_to_spi_baud(&pbr, &br, spi->max_speed_hz, clkrate, dspi->mtf_enabled); =20 /* Set PCS to SCK delay scale values */ ns_delay_scale(&pcssck, &cssck, cs_sck_delay, clkrate); @@ -1200,6 +1233,9 @@ static int dspi_setup(struct spi_device *spi) SPI_CTAR_PBR(pbr) | SPI_CTAR_BR(br); =20 + if (dspi->mtf_enabled) + chip->ctar_val |=3D SPI_CTAR_DBR; + if (spi->mode & SPI_LSB_FIRST) chip->ctar_val |=3D SPI_CTAR_LSBFE; } @@ -1324,6 +1360,8 @@ static int dspi_resume(struct device *dev) return ret; } =20 + dspi_set_mtf(dspi); + if (dspi->irq) enable_irq(dspi->irq); =20 --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 A3E3A291889 for ; Fri, 9 May 2025 11:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788833; cv=none; b=Smy+DfSygwZS20WTnhMJWBPeYXINM5yJke8AI2TZfWzxZmQlSDczL1qLLPtqX/CrJrJkyWV6/I3smeWMJCq4HpeNYM8/VbVyy4hhU56J+xsOxnoGdsL5hXFy8LVfrdJp/yD/qgfWsjT2Oy7ekK+FhDonCYs8W2RCH9lTXw7t0xE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788833; c=relaxed/simple; bh=gdl/1A2tWVRhxiGr8HNdkp2uLbfVXUsZjNQ28NMiOx8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t+fidWUENLguqUajODcz3g/DfC3D39bM86qO/pF4d3+Op8LhNxKnbUqO+Tq6u3KJZrcC/kgZfEXM0vXrsl999nU9NEu6hWNlHiziooe75LcQH182UDrqppp61WjBGXMJ5h+5oEVGR3hdQYK9IAMgy1DCAXgKMx4OzKgdBLM92Yo= 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=Pmaxi3bZ; arc=none smtp.client-ip=209.85.221.52 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Pmaxi3bZ" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-3a0ba0b6b76so1285082f8f.1 for ; Fri, 09 May 2025 04:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788830; x=1747393630; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vT4KOWN4uTm3QxGCYySEGWVVZs5ryN1meRZIg3C7iIY=; b=Pmaxi3bZofSKwLRoCUCzIEbE5/Lu5kjLWEk9PtGeOrnuvCIUz+A7JgaBJQL/w70EoP 0l58zf0jvEdr/sB3fNm9hsClKKh4/otudy/e6EYhN+kMGJMoy0dP2dybces2FX8mXNpM 2LRMVNIAHKxNwWCEA7rRXhTYk8t40MJpWj5mhM2o7hUkVdEK+DT+41Heu7OgEGWr3xpR T65kWL29NgfavXiuNKPum31SsjQpY/dyLXfCYiyIvmlWxfai5RgDQTJU5BX3luxOKxNM D+Q4BWtAPM7fjOv8SCVoZHJEh+PpsDkZOPjI7IZaLZzlYv967F+9jbHlZZ4xlRFP/bs4 O/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788830; x=1747393630; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vT4KOWN4uTm3QxGCYySEGWVVZs5ryN1meRZIg3C7iIY=; b=pkE3bY7Cpy8ajoPexCU0wbM79uMamwNWIeYhvNAjNKZdES6pxzpisNQIEmtDU4eSU6 OYBk211FKyzFHOwDm4gBHuqwrTHpZC8dW188+jzLC+6VknwYvtelbtSNCRFwLHVAOBu1 qKNkDNOYIFNTzONNS47IGiDgI2ejogX6l089KRttQGrEcCVqiE2wr3cwx5ahHFuT2Jqn /gitBQSFS4MLbTFOOIi6+VQCB5IyYcHyYAvN9ZyWau/FpHlHZe/8Mh06p8li92+2coxr SIG1g7gcHksUfQ8/D6YYYhwPgb/vtmtOwyy2LkkoNpa1K/2YDX5OOP/dhpBAzkpBUJFQ ySSQ== X-Forwarded-Encrypted: i=1; AJvYcCUA9LJlqBR6ShA/Kfzg5gZgg6SjATBp1r8JRYWWSLjwnYCMBmJ+7ldt7S5SaBZXUw5JtIso8KbPc94WRBw=@vger.kernel.org X-Gm-Message-State: AOJu0YwKDFlzwZOVNam/DY6oIXk2kFCISvp1mjB+iwq+qtoBrf24NjaH xhvnpqorA0Tj+h5EvxZttAZoC//uEvx4pczZVQbcmP7+kpctEphR2drQVBVqU5Y= X-Gm-Gg: ASbGncsw/SmmRSFSANo8QNkS0KoBqvX7iSyT9XUThDFqHw+ba4VKGtlwQkIYXYotDpC q4Lxkr8rdKmQCVy/s5xO5M+lxRohbU4FqSXDKFthqlwt99hfad1gXyS12LlEyi6JQjNFTWjvRc4 cS73pdRIBilTWJOButfsGvVRQlL6bFZIuCKJHVbCLCEjW2/+wrHEbwh+et8btz8B4Aa5ROshk7j FqhXGdc5TK2flG2FejMyeYHokrDCG3dsTQFBKn5KP/TZMnyhGjziau1KPTf/+NtbD5UHV9rG9Rh Xes2WmI/BcBbHKUgnbObc31IJ+uRK04r7+nE5pXO1lmOeiQ= X-Google-Smtp-Source: AGHT+IGGXkJ58sLQbmi3wU/ta+YdLpsygJwEMpejLEliNzR91iBPwbbisuUDIlnG+jy75pghXWkjdg== X-Received: by 2002:a05:6000:1ac5:b0:39a:cb5b:78fe with SMTP id ffacd0b85a97d-3a1f647a5b5mr2514501f8f.34.1746788829944; Fri, 09 May 2025 04:07:09 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:09 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:58 +0100 Subject: [PATCH 11/14] spi: spi-fsl-dspi: Halt the module after a new message transfer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-11-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bogdan-Gabriel Roman , James Clark X-Mailer: b4 0.14.0 From: Bogdan-Gabriel Roman The XSPI mode implementation in this driver still uses the EOQ flag to signal the last word in a transmission and deassert the PCS signal. However, at speeds lower than ~200kHZ, the PCS signal seems to remain asserted even when SR[EOQF] =3D 1 indicates the end of a transmission. This is a problem for target devices which require the deassertation of the PCS signal between transfers. Hence, this commit 'forces' the deassertation of the PCS by stopping the module through MCR[HALT] after completing a new transfer. According to the reference manual, the module stops or transitions from the Running state to the Stopped state after the current frame, when any one of the following conditions exist: - The value of SR[EOQF] =3D 1. - The chip is in Debug mode and the value of MCR[FRZ] =3D 1. - The value of MCR[HALT] =3D 1. This shouldn't be done if the last transfer in the message has cs_change set. Signed-off-by: Bogdan-Gabriel Roman Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- drivers/spi/spi-fsl-dspi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 31521dac1580..db921ee6305f 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -64,6 +64,7 @@ #define SPI_SR_TFIWF BIT(18) #define SPI_SR_RFDF BIT(17) #define SPI_SR_CMDFFF BIT(16) +#define SPI_SR_TXRXS BIT(30) #define SPI_SR_CLEAR (SPI_SR_TCFQF | \ SPI_SR_TFUF | SPI_SR_TFFF | \ SPI_SR_CMDTCF | SPI_SR_SPEF | \ @@ -1056,9 +1057,20 @@ static int dspi_transfer_one_message(struct spi_cont= roller *ctlr, struct spi_transfer *transfer; bool cs =3D false; int status =3D 0; + u32 val =3D 0; + bool cs_change =3D false; =20 message->actual_length =3D 0; =20 + /* Put DSPI in running mode if halted. */ + regmap_read(dspi->regmap, SPI_MCR, &val); + if (val & SPI_MCR_HALT) { + regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, 0); + while (regmap_read(dspi->regmap, SPI_SR, &val) >=3D 0 && + !(val & SPI_SR_TXRXS)) + ; + } + list_for_each_entry(transfer, &message->transfers, transfer_list) { dspi->cur_transfer =3D transfer; dspi->cur_msg =3D message; @@ -1088,6 +1100,7 @@ static int dspi_transfer_one_message(struct spi_contr= oller *ctlr, dspi->tx_cmd |=3D SPI_PUSHR_CMD_CONT; } =20 + cs_change =3D transfer->cs_change; dspi->tx =3D transfer->tx_buf; dspi->rx =3D transfer->rx_buf; dspi->len =3D transfer->len; @@ -1125,6 +1138,15 @@ static int dspi_transfer_one_message(struct spi_cont= roller *ctlr, dspi_deassert_cs(spi, &cs); } =20 + if (status || !cs_change) { + /* Put DSPI in stop mode */ + regmap_update_bits(dspi->regmap, SPI_MCR, + SPI_MCR_HALT, SPI_MCR_HALT); + while (regmap_read(dspi->regmap, SPI_SR, &val) >=3D 0 && + val & SPI_SR_TXRXS) + ; + } + message->status =3D status; spi_finalize_current_message(ctlr); =20 @@ -1306,6 +1328,8 @@ static int dspi_init(struct fsl_dspi *dspi) if (!spi_controller_is_target(dspi->ctlr)) mcr |=3D SPI_MCR_HOST; =20 + mcr |=3D SPI_MCR_HALT; + regmap_write(dspi->regmap, SPI_MCR, mcr); regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); =20 --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 0C8652918C1 for ; Fri, 9 May 2025 11:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788836; cv=none; b=SSPhLghkNwqS+9lB5Gk8dsQjdjhiN6zmLWTMKx9mGkusWjSDUAZV8ZANOagMGAz1NX2qlMLRBQALVzXqga397cw41DvuLfqZyhBEeZU2SFmV9Db3lY01ZNZKPfdp4rst4XWuQYZZP6V/DKGaX+sXou80yUQh8SsK+1do5hxP4h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788836; c=relaxed/simple; bh=mx5u03b5TB/f2q1YQ3KCyV5h99vYZyaZPDhhfpjU5fc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UzVCGWjxsmsClWUxZ9qVOXybznvxgUJTlDfDjA3r7xFAO/NQJJjneaFMJnGtCrb2LRq14ueiM0QPL3rI5/s5xT7cHOOf6WABgHaXgcZrFPPCQcZiX8Li93vCjKHZbNvABumg3fLN4KE5G8dcMmyGCfo0FoxEYCLmolySyQPeyXY= 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=fHcu4fmR; arc=none smtp.client-ip=209.85.221.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fHcu4fmR" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3a1d8c0966fso847405f8f.1 for ; Fri, 09 May 2025 04:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788831; x=1747393631; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OjvkkMIUxErk/9CbtL8I8hETKTjq9Ni1Xdc4V8HrKQc=; b=fHcu4fmRqgAt/OAAqTExKWu9HZrsj8DvarkWF/BhT6M97ZW0V1BX7D69JGD7/I1nkl RNVL6qzK3ED43OHgytRW7mbMOSUjBgvY0Ire5N0kizQ1Bq2By9wZ6dHAamnNaS7wSPZe XuvemSQoz9jBqV16l3eLeMJznHtNwqxsormH0GC4qKnuC5E3AwBDefN9btpsIapYq2rW v+7DWGqrAzhIWaJkxYKQ6so4qjSgDrKNvlpV6LcCFxzCVkOs3DfNaUM5hAYuBrQc6UNF Z/EItATDoxhPLF+D/3EZbA+Pu8MWaU7cBHVZFmf8bLUuJ0kQVV84fH2LrRVW7gtS07Kh WHHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788831; x=1747393631; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OjvkkMIUxErk/9CbtL8I8hETKTjq9Ni1Xdc4V8HrKQc=; b=qQruIEZvd0J5FatmoBxjPF1fhrllo9MEQb1OXIRODwyFqpx3G14Pt76cXOVi1ln7Fr LmJ2TzSB3uAiPo71EHXAx19PL+hl0VgXGfnNKsmAAZl781VZOtjN+TvineESlknoNpCD BRnd9YKEHjIe2tIOyP9yGuSxQpVyhdbSOVS0B1Twjr+OLIZM5Ic01zBJjVXdz+VD6rlb uJOWEu2o9Qv4As5+JekErOi3DblqXrvgWFQdyOr3QuII5OiL9mWh+PnWvYtf7XZp6Fvo HLMxcBfrxe6DJDuwfSUygTJ8Rirkdr3rtj3N1vFZ0SZeO8jfbYlWjEEsTQwk3GbDP6YW eOKg== X-Forwarded-Encrypted: i=1; AJvYcCU44b7LES1i0BFz1jT1VvQnnx+eAxkoT5cceYz3b0BIzC50czmdTKOCo8JN6k0YhVtMt0+8BCk2jtQce/8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3jNd+O9sNl6t6/3dQ5Ic7ui0SK0eOHHoU2PEfzYLrC4g4HbHZ c5UfI4qObhGv6HCNHQ7imzej+BAv2X6nfhec4K+wEA671OyCQOoBXtX47dV6wcE= X-Gm-Gg: ASbGncthKRhWwQsW+ietoferp2HABz6mE//K92/xRfwOZxkf3bVent3afMrZfZfr18j CBhOrPJKE7pPa2YVqocOtzPIPM/dVIXG6kDY5hpZvh966rvlr2wotZVdgAtbhE4w14ps/e1rHGY vLd7HpJaqqri8VKvQcdKuq2sPqHpiWJlZud3ow8uW/p4/fC868V2Q1wjpHcRb7FpDVpRUZX23aK QQcFr/tXUZ0vb5KJvN/+8MHY/dfLrDDu1Ue+SevUn30NSrtw3oWrN3G+sT7yYdosqr4XquNCdyd vCTuhb5YUVxlhD6YWpzqv5B7MTw6NEBFs/2IWZpDi+UaYLM= X-Google-Smtp-Source: AGHT+IGJvDt+LaY1QQLl2SlTRe/DojIZ4tpeJAXa/uWwNzG6xIzfPYcQgejyyHruKfc7448qtaeZfA== X-Received: by 2002:a05:6000:228a:b0:3a0:b8ba:849f with SMTP id ffacd0b85a97d-3a1f6a0fc42mr2727736f8f.4.1746788831370; Fri, 09 May 2025 04:07:11 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:11 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:05:59 +0100 Subject: [PATCH 12/14] dt-bindings: spi: dspi: Add S32G support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-12-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ciprian Marian Costea , James Clark X-Mailer: b4 0.14.0 From: Ciprian Marian Costea Document S32G compatible strings. 's32g2' and 's32g3' use the same driver so 's32g2' must follow 's32g3'. The SPI controller node in dts can define both host and target pinctrl. The selection between them will be done based on pinctrl-names. The default pinctrl will be loaded first and will be used by the host. If the controller is configured as target (spi-slave property is added in the dts node), the driver will look for the "slave" pinctrl and apply it if found. Signed-off-by: Ciprian Marian Costea Signed-off-by: Larisa Grigore Signed-off-by: James Clark Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/spi/fsl,dspi.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/fsl,dspi.yaml b/Document= ation/devicetree/bindings/spi/fsl,dspi.yaml index 7ca8fceda717..b5fac0bb142a 100644 --- a/Documentation/devicetree/bindings/spi/fsl,dspi.yaml +++ b/Documentation/devicetree/bindings/spi/fsl,dspi.yaml @@ -23,6 +23,7 @@ properties: - fsl,ls2080a-dspi - fsl,ls2085a-dspi - fsl,lx2160a-dspi + - nxp,s32g2-dspi - items: - enum: - fsl,ls1012a-dspi @@ -37,6 +38,9 @@ properties: - items: - const: fsl,lx2160a-dspi - const: fsl,ls2085a-dspi + - items: + - const: nxp,s32g3-dspi + - const: nxp,s32g2-dspi =20 reg: maxItems: 1 @@ -114,3 +118,17 @@ examples: spi-cs-hold-delay-ns =3D <50>; }; }; + # S32G3 in target mode + - | + spi0: spi@401d4000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x401d4000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <8>; + bus-num =3D <0>; + dmas =3D <&edma0 0 7>, <&edma0 0 8>; + dma-names =3D "tx", "rx"; + spi-slave; + }; --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 BB73129188F for ; Fri, 9 May 2025 11:07:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788836; cv=none; b=V0MR5bTZawh2vNQMSQk3DA4WQIe+d/WOyg8WFDOXb5Xig1+rXK0rJnRI+jZvMc6TgoZMkSNJD9gABnfRfFaNGvMJxBB88JeZ74tlORugzjjTA5XyfXXf5cKVNzlRpel6O/6TKIAPxYSiXdqk6b+plrngvdOm3OsyU56zIXh2aNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788836; c=relaxed/simple; bh=/1WgmjiUPsgAyXKXEEwEXpR87Eos0KeMZvFNpmziqFU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WHJ5x5ur1hM58Vv7jzihhTykb6zJZd35Ho0mw51sQOvqrzBu0JYdv5cncLAQeHcY1EAuU2i5Cag9zzwPycQSObr9RzhffDUUms9QLWA+DCrF86H6jpS20SA79GllJzMm4p8uxW8x/bkqv9eiHBXQQoQtf/kNkxSPUUtde+lr7xo= 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=HEQ49tpH; arc=none smtp.client-ip=209.85.221.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HEQ49tpH" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3a108684f90so1015491f8f.1 for ; Fri, 09 May 2025 04:07:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788833; x=1747393633; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RMuvm3u0FO0tHSMEJjZ+2DIuKHjMVjXj0UsWrbU1Pz0=; b=HEQ49tpHF/8MWJJvzi7xzrZVF1gUvVVz/Nc1uMt7YwNgI6rZV4HvgzzdvJfm8QwpKc ISYkH/NazjU9KtE4ZSEnRSoGhzkKyceM09XjdHQFDopwbTWPIAeNDysqPw7zrX99ntrQ U4+r/aehnPNg6rXyPXtB4WjZbITPoOR3x8qFTDeK4ba0eLoszsSlkjwjgDyUFlJuskMf awRNwOmRgbQDaU/peWwEUD4WAy7Jo7us8MuIiV3iKGtTN84UzQaOyOH7kcPQTf+nGAWE pysvi3kZRHsgbhL2GxeAGM3uo0mtPVJVO6ltBEk3Av9JibJ7ODV28h9rNbCAnj7d4g3E aN8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788833; x=1747393633; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RMuvm3u0FO0tHSMEJjZ+2DIuKHjMVjXj0UsWrbU1Pz0=; b=bg/VTY7dBpKkUkWb31End7k6s9LvzXGwC7bS76W145nPjWMh0wEBRD6juisNMD7RA0 +Zhe3ZZTSGTy1H7aNseNmZCYMANttBx5nV82sTQbIfrDYqjABEqA7sHuTViqmBdDdqYH MqekqYm2u1yR3bzdoSaVO0ht+YBRs/AeY7yqiW1DYgjm4/WTS0RGKfRiEpADnKzeBJ/H qGE/dQkOaWiMcmN4oXIQOtwV124FKFuULUaADJWTGP3tIUub1iNuawDAaKxpl0h0grAt hZcmnONtrPGPlF01NloFHEKtVAU2mQFsLlI0ocVHgXq1PoS5Mznmv9XpgjRu3R6LpP7u zEng== X-Forwarded-Encrypted: i=1; AJvYcCXSORd+7H/nDS5+gQoQ/mEOw1FFe6xT6RzrmkIPew2lHm+Fqwcn8t1VkQrr2D0770mvFPXtGDf3U6FVDA0=@vger.kernel.org X-Gm-Message-State: AOJu0YzuHekcZskrwQrmIHdbD6jryHbMr44wpGkSpqaEk7bsAJ+rQhQW Loc/aEardWvFOf4dtUlNcqCXEWAU4D6TWFYYJmHM9VBSRxZXQfEx7qrH09TsI0Y= X-Gm-Gg: ASbGncs4BZ49edFyhB/EeoVcMCqxTBiWBc2yhK+ITsD+aK9if6c/wapqyVAIZ7w0K3D PkUhFr3YZqGaHUUkKM+Sb3sYHhbHgewAapY3INCwQJim+yHJH5//ZRATGQ2W5/7fE3B0nM8a2Ty 5s9z/+Z//2UfvB3C7KDb3BXl44FYrnJZs4ojuUd1nkvejaREXv4zbiguBuVSQJZoDRcCI2MPfhY xFxuoyFbkYjzwaR2tHJhDTIFWDvjJscIZXWHAO/cWRGiyuG9igx9I8OpI9hS1Z6PV7AibGC02sx RoHfWniroYw2nz55gLvH1zyZZhl70EOxFAjnU5iVZb4gM5MveZAx+M8wTw== X-Google-Smtp-Source: AGHT+IEI/21cAkCpKqtXo/RJBX5fMArAhVFuko7+5QHt2vTuixWOjpsB6oyJPSHitDVLWZA2KHt5xA== X-Received: by 2002:a5d:64ce:0:b0:3a0:b8b0:441a with SMTP id ffacd0b85a97d-3a1f643ba6bmr2415644f8f.25.1746788832870; Fri, 09 May 2025 04:07:12 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:12 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:06:00 +0100 Subject: [PATCH 13/14] spi: spi-fsl-dspi: Enable support for S32G platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-13-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ciprian Marian Costea , Stoica Cosmin-Stefan , Dan Nica , Larisa Grigore , Stefan-Gabriel Mirea , James Clark X-Mailer: b4 0.14.0 From: Ciprian Marian Costea Add compatible for S32G platforms, allowing DSPI to be used. Add a depends for ARCH_NXP which can replace LAYERSCAPE and also includes the new ARCH_S32 for S32G. Similarly, ARCH_MXC can replace SOC_VF610 || SOC_LS1021A which should avoid updating this for every new sub-platform in the future. Signed-off-by: Ciprian Marian Costea Signed-off-by: Stoica Cosmin-Stefan Signed-off-by: Dan Nica Signed-off-by: Larisa Grigore Signed-off-by: Stefan-Gabriel Mirea Signed-off-by: James Clark --- drivers/spi/Kconfig | 4 ++-- drivers/spi/spi-fsl-dspi.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index ed38f6d41f47..ff26be07226b 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -647,10 +647,10 @@ config SPI_FSL_SPI config SPI_FSL_DSPI tristate "Freescale DSPI controller" select REGMAP_MMIO - depends on SOC_VF610 || SOC_LS1021A || ARCH_LAYERSCAPE || M5441x || COMPI= LE_TEST + depends on ARCH_MXC || ARCH_NXP || M54541x || COMPILE_TEST help This enables support for the Freescale DSPI controller in master - mode. VF610, LS1021A and ColdFire platforms uses the controller. + mode. S32, VF610, LS1021A and ColdFire platforms uses the controller. =20 config SPI_FSL_ESPI tristate "Freescale eSPI controller" diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index db921ee6305f..0982f27a9b2a 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1311,6 +1311,9 @@ static const struct of_device_id fsl_dspi_dt_ids[] = =3D { }, { .compatible =3D "fsl,lx2160a-dspi", .data =3D &devtype_data[LX2160A], + }, { + .compatible =3D "nxp,s32g2-dspi", + .data =3D &devtype_data[S32G], }, { /* sentinel */ } }; --=20 2.34.1 From nobody Wed Dec 17 08:52:19 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 4D1A129208A for ; Fri, 9 May 2025 11:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788839; cv=none; b=uoJ8TkXKuPdeYFHefC8raxlndQJqtYj6JQ3A7lUSJqPfBFzAYImdU9rFs18992nj/h3o24y33uEttstcpmQMnDovN4XV6UkHZzxVjxUCUdUrebuQXsFRXwAMwlpjLWFm2iabEeNS2f7JqW8D0TWlfFkyQPf9wkM04sNqSbctwhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746788839; c=relaxed/simple; bh=P6hkWNIB9LIlNth1/4VZQEEC7u2gPfD4GAPBE8iKT9s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SYnk2N3+U18P8FbcUjOoaSXVr/+R2q3QvqWgywM/8AlZpb4ZG0Ol0dtqv0uZSkx8flS02CRSOgZIJ83iGpmu9dma6j5yFkPmVtatyyC3/a3XyZxazNe9i9V7JUCL/AgTB6SKuRrzogkKX2KLVxuwh3/YaUvy/8fsE0rqoaWMVCE= 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=KfmUwLzB; arc=none smtp.client-ip=209.85.221.48 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KfmUwLzB" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a1f8c85562so362619f8f.1 for ; Fri, 09 May 2025 04:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746788834; x=1747393634; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NfDBCe28zl/SAg4VVune9XblDhv/fAFglHkb6WzJx6s=; b=KfmUwLzBjHPC5pi0gyAJTSo2qDdDWUEh84r/rIc+89q53TycDQVZ9aMPy7kah64Lp5 tHV0sz30+TDyc6nMLwio20CITy81jWuiqI+eOf2QLTOI3jszwpkt8f++AQqUTBl7wJqb qPSAVl+lblsQhrqVGFY9LxWe68VKr9rA7OeWZo+7LSBiNALivryQNj5aH+K4W0+vkS1z Hao1fvljukhjns1z8XTCbqdLd1I0EjVa6IZfyT51cT7JSgN34252CjwGGPPX86IIkOo7 nKC713yeHvMmIiwd58vxpw2b0NKqebzDBQ6FDRziGtjS8vVm6xdWdY8bw+TvCOa35QsK spLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746788834; x=1747393634; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NfDBCe28zl/SAg4VVune9XblDhv/fAFglHkb6WzJx6s=; b=eIXR9tBTHmkT0DmYFD+9DjgSkbinVA/EzNyUDsG4thA/qTih8OZcF9Dj3/rIomEKAE nzwmxE5TIfC+icAulyC9KMS4ReKF/KEUIe4MHFHfGflXSXmzdhcybJP02DLg8jW8xFIs 2zD2svPFzWQrwRFSI3uwqK0xUn8WVzMAiwQdCAKF5W03bTP3qSB/de9O55liBQOb9cp5 j3UPWo98uFLkF9ew5XONq5h8JMoQe/AgzW3BHTrjRM6nABSpBoQBBXIDx1NNbHTZy9cz IXt97uknHUtnACvk4slOwRZsCVQEHNVwLxQ8dL92blOpq/sH8hKH7RuS5H7DD5vN0gvQ Z0bw== X-Forwarded-Encrypted: i=1; AJvYcCVjl6hzjIH6x81wjbGX/w4/coyvre1DmkrZi/WA8VJ6atZOtZ14fNb+lzkjglW68CjDSYCAo3c/Csl5dy0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6kiXuOMcgI7F0IlU6DeA+e5D4tDDz4cc9IphbIhWIo+xtjKDv tWpfVb7VEsnOWhfjeEeXmsRAHpe0l5SHcEyaX3M9BCfx+jsZciRXVce2u5l4z3U= X-Gm-Gg: ASbGnct9QxiC8PkSiIgMXC/kLxnMgvNboQC532j07h6YiBnPrV91b423oF1TE74gar0 +zOEF324aUHgtaTBN2wScAwGlilhpwOe+VmDXr+z2WZ+qLrck2Q/ErQDWq8T7beHwUBdwSc9AC4 hf4Axr1QN3/6SoxFHcZmJOyeOKxKe2pYk7TaGbKbvyXccz3C09ghUuy+pPSrAS92pfbf9FHJ2gO RSzSeO/seJfuJ8bwCn9D4aHfrRbr1Ds64/nb3aoXP1RNUioaO4u73OpuHqf1Odm0KMzyJhSVhFh lerr62cwVBKhiFum2MGFnNI0j1nChQLUtkmDIjBOFmnYmXc= X-Google-Smtp-Source: AGHT+IEp3NLHKI4dsaZ2CvQTR4HmXAVodEDvfdIyQ8so2a8K6UPoMQBnrE+k8vgABY+2kwMQFLPTVA== X-Received: by 2002:a05:6000:4304:b0:3a0:b294:ccf2 with SMTP id ffacd0b85a97d-3a1f649cc02mr2743451f8f.52.1746788834336; Fri, 09 May 2025 04:07:14 -0700 (PDT) Received: from ho-tower-lan.lan ([77.81.75.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f58ecadfsm2914797f8f.22.2025.05.09.04.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 04:07:13 -0700 (PDT) From: James Clark Date: Fri, 09 May 2025 12:06:01 +0100 Subject: [PATCH 14/14] arm64: dts: Add DSPI entries for S32G platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250509-james-nxp-spi-v1-14-32bfcd2fea11@linaro.org> References: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , larisa.grigore@nxp.com, arnd@linaro.org, andrei.stefanescu@nxp.com, dan.carpenter@linaro.org Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "Radu Pirea (NXP OSS)" , Larisa Grigore , James Clark X-Mailer: b4 0.14.0 From: Larisa Grigore S32G3 and S32G2 have the same 6 SPI devices, add the DT entries. Devices are all the same except spi0 has 8 chip selects instead of 5. Clock settings for the chip rely on ATF Firmware [1]. [1]: https://github.com/nxp-auto-linux/arm-trusted-firmware Co-developed-by: Radu Pirea (NXP OSS) Signed-off-by: Radu Pirea (NXP OSS) Signed-off-by: Larisa Grigore Signed-off-by: James Clark --- arch/arm64/boot/dts/freescale/s32g2.dtsi | 78 ++++++++++++++++++++++ arch/arm64/boot/dts/freescale/s32g3.dtsi | 78 ++++++++++++++++++++++ arch/arm64/boot/dts/freescale/s32gxxxa-evb.dtsi | 87 +++++++++++++++++++++= ++++ arch/arm64/boot/dts/freescale/s32gxxxa-rdb.dtsi | 77 ++++++++++++++++++++++ 4 files changed, 320 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/s32g2.dtsi b/arch/arm64/boot/dts= /freescale/s32g2.dtsi index ea1456d361a3..68848575bf81 100644 --- a/arch/arm64/boot/dts/freescale/s32g2.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g2.dtsi @@ -376,6 +376,45 @@ uart1: serial@401cc000 { status =3D "disabled"; }; =20 + spi0: spi@401d4000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x401d4000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <8>; + bus-num =3D <0>; + dmas =3D <&edma0 0 7>, <&edma0 0 8>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi1: spi@401d8000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x401d8000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <1>; + dmas =3D <&edma0 0 10>, <&edma0 0 11>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi2: spi@401dc000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x401dc000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <2>; + dmas =3D <&edma0 0 13>, <&edma0 0 14>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + i2c0: i2c@401e4000 { compatible =3D "nxp,s32g2-i2c"; reg =3D <0x401e4000 0x1000>; @@ -460,6 +499,45 @@ uart2: serial@402bc000 { status =3D "disabled"; }; =20 + spi3: spi@402c8000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x402c8000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <3>; + dmas =3D <&edma0 1 7>, <&edma0 1 8>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi4: spi@402cc000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x402cc000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <4>; + dmas =3D <&edma0 1 10>, <&edma0 1 11>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi5: spi@402d0000 { + compatible =3D "nxp,s32g2-dspi"; + reg =3D <0x402d0000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <5>; + dmas =3D <&edma0 1 13>, <&edma0 1 14>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + i2c3: i2c@402d8000 { compatible =3D "nxp,s32g2-i2c"; reg =3D <0x402d8000 0x1000>; diff --git a/arch/arm64/boot/dts/freescale/s32g3.dtsi b/arch/arm64/boot/dts= /freescale/s32g3.dtsi index 991dbfbfa203..4f883b1a50ad 100644 --- a/arch/arm64/boot/dts/freescale/s32g3.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g3.dtsi @@ -435,6 +435,45 @@ uart1: serial@401cc000 { status =3D "disabled"; }; =20 + spi0: spi@401d4000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x401d4000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <8>; + bus-num =3D <0>; + dmas =3D <&edma0 0 7>, <&edma0 0 8>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi1: spi@401d8000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x401d8000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <1>; + dmas =3D <&edma0 0 10>, <&edma0 0 11>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi2: spi@401dc000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x401dc000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <2>; + dmas =3D <&edma0 0 13>, <&edma0 0 14>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + i2c0: i2c@401e4000 { compatible =3D "nxp,s32g3-i2c", "nxp,s32g2-i2c"; @@ -524,6 +563,45 @@ uart2: serial@402bc000 { status =3D "disabled"; }; =20 + spi3: spi@402c8000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x402c8000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <3>; + dmas =3D <&edma0 1 7>, <&edma0 1 8>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi4: spi@402cc000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x402cc000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <4>; + dmas =3D <&edma0 1 10>, <&edma0 1 11>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + + spi5: spi@402d0000 { + compatible =3D "nxp,s32g3-dspi", "nxp,s32g2-dspi"; + reg =3D <0x402d0000 0x1000>; + interrupts =3D ; + clocks =3D <&clks 26>; + clock-names =3D "dspi"; + spi-num-chipselects =3D <5>; + bus-num =3D <5>; + dmas =3D <&edma0 1 13>, <&edma0 1 14>; + dma-names =3D "tx", "rx"; + status =3D "disabled"; + }; + i2c3: i2c@402d8000 { compatible =3D "nxp,s32g3-i2c", "nxp,s32g2-i2c"; diff --git a/arch/arm64/boot/dts/freescale/s32gxxxa-evb.dtsi b/arch/arm64/b= oot/dts/freescale/s32gxxxa-evb.dtsi index d26af0fb8be7..812b37b0098b 100644 --- a/arch/arm64/boot/dts/freescale/s32gxxxa-evb.dtsi +++ b/arch/arm64/boot/dts/freescale/s32gxxxa-evb.dtsi @@ -173,6 +173,77 @@ i2c4-gpio-grp1 { pinmux =3D <0x2d40>, <0x2d30>; }; }; + + dspi1_pins: dspi1_pins { + dspi1_grp0 { + pinmux =3D <0x72>; + output-enable; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi1_grp1 { + pinmux =3D <0x62>; + output-enable; + slew-rate =3D <150>; + }; + + dspi1_grp2 { + pinmux =3D <0x83>; + output-enable; + input-enable; + slew-rate =3D <150>; + }; + + dspi1_grp3 { + pinmux =3D <0x5F0>; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi1_grp4 { + pinmux =3D <0x3D92>, + <0x3DA2>, + <0x3DB2>; + }; + }; + + dspi5_pins: dspi5_pins { + dspi5_grp0 { + pinmux =3D <0x93>; + output-enable; + input-enable; + slew-rate =3D <150>; + }; + + dspi5_grp1 { + pinmux =3D <0xA0>; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi5_grp2 { + pinmux =3D <0x3ED2>, + <0x3EE2>, + <0x3EF2>; + }; + + dspi5_grp3 { + pinmux =3D <0xB3>; + output-enable; + slew-rate =3D <150>; + }; + dspi5_grp4 { + pinmux =3D <0xC3>; + output-enable; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + }; }; =20 &can0 { @@ -220,3 +291,19 @@ &i2c4 { pinctrl-1 =3D <&i2c4_gpio_pins>; status =3D "okay"; }; + +&spi1 { + pinctrl-0 =3D <&dspi1_pins>; + pinctrl-names =3D "default"; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "okay"; + + spidev0: spidev@0 { + compatible =3D "rohm,dh2228fv"; + spi-max-frequency =3D <4000000>; + reg =3D <0>; + fsl,spi-cs-sck-delay =3D <100>; + fsl,spi-sck-cs-delay =3D <100>; + }; +}; diff --git a/arch/arm64/boot/dts/freescale/s32gxxxa-rdb.dtsi b/arch/arm64/b= oot/dts/freescale/s32gxxxa-rdb.dtsi index ba53ec622f0b..798b58fa9536 100644 --- a/arch/arm64/boot/dts/freescale/s32gxxxa-rdb.dtsi +++ b/arch/arm64/boot/dts/freescale/s32gxxxa-rdb.dtsi @@ -127,6 +127,77 @@ i2c4-gpio-grp1 { pinmux =3D <0x2d40>, <0x2d30>; }; }; + + dspi1_pins: dspi1_pins { + dspi1_grp0 { + pinmux =3D <0x62>; + output-enable; + slew-rate =3D <150>; + }; + + dspi1_grp1 { + pinmux =3D <0x72>; + output-enable; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi1_grp2 { + pinmux =3D <0x83>; + output-enable; + input-enable; + slew-rate =3D <150>; + }; + + dspi1_grp3 { + pinmux =3D <0x5F0>; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi1_grp4 { + pinmux =3D <0x3D92>, + <0x3DA2>, + <0x3DB2>; + }; + }; + + dspi5_pins: dspi5_pins { + dspi5_grp0 { + pinmux =3D <0x93>; + output-enable; + input-enable; + slew-rate =3D <150>; + }; + + dspi5_grp1 { + pinmux =3D <0xA0>; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + + dspi5_grp2 { + pinmux =3D <0x3ED2>, + <0x3EE2>, + <0x3EF2>; + }; + + dspi5_grp3 { + pinmux =3D <0xB3>; + output-enable; + slew-rate =3D <150>; + }; + dspi5_grp4 { + pinmux =3D <0xC3>; + output-enable; + input-enable; + slew-rate =3D <150>; + bias-pull-up; + }; + }; }; =20 &can0 { @@ -155,6 +226,12 @@ pcal6524: gpio-expander@22 { }; }; =20 +&spi1 { + pinctrl-0 =3D <&dspi1_pins>; + pinctrl-names =3D "default"; + status =3D "okay"; +}; + &i2c2 { pinctrl-names =3D "default", "gpio"; pinctrl-0 =3D <&i2c2_pins>; --=20 2.34.1