Skip to contentSkip to conversation

spi: Collected fixes

PATCH In review Alexander Dahl 2 participants 4 messages Jan 15, 2025 – Jan 22, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover spi: Collected fixes

Hello,

two patches for header issues I came across when working on (Q)SPI drivers for atmel boards.

Greets
Alex

v1:
- implicit, not a series but a single patch no one reacted to
- Link: https://lore.kernel.org/u-boot/[email protected]/

v2:
- resend patch 1/2
- add new patch 2/2

Cc Tom Rini <[email protected]>
Cc Jagan Teki <[email protected]>

Alexander Dahl (2):
spi: atmel: Really drop atmel_spi.h
Revert "mem: spi-mem: add declaration for spi_mem_default_supports_op"

 drivers/spi/atmel_spi.h | 86 -----------------------------------------
 include/spi-mem.h       |  3 --
 2 files changed, 89 deletions(-)
 delete mode 100644 drivers/spi/atmel_spi.h

base-commit: e26a9ac4c6900cac2fa043ac50a3a3c038f4505d

Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/2 spi: atmel: Really drop atmel_spi.h

First try dropping this was with commit 37434db29be4 ("spi: atmel: Drop atmel_spi.h") back in 2018 which was reverted not much later with commit 5270df283676 ("Revert "spi: atmel: Drop atmel_spi.h"").

Second try dropping this was in 2020 with commit beeb34ac0cc6 ("spi:
atmel: Drop atmel_spi.h"), but that only moved all the definitions into the source file and did not remove the header file.

Currently all of the definitions in the header file are (still) contained in the source file, and the header file is include nowhere.

Fixes beeb34ac0cc6 ("spi: atmel: Drop atmel_spi.h")

---

Notes:
Build tested for all upstream atmel boards. This is no complete build coverage, but should be safe to remove, because it is not included anywhere.

 drivers/spi/atmel_spi.h | 86 -----------------------------------------
 1 file changed, 86 deletions(-)
 delete mode 100644 drivers/spi/atmel_spi.h
drivers/spi/atmel_spi.h deleted +0 -86
deleted file mode 100644
index 9663cca5e66..00000000000
@@ -1,86 +0,0 @@
-/*
- * Register definitions for the Atmel AT32/AT91 SPI Controller
- */
-
-/* Register offsets */
-#include <linux/bitops.h>
-#define ATMEL_SPI_CR			0x0000
-#define ATMEL_SPI_MR			0x0004
-#define ATMEL_SPI_RDR			0x0008
-#define ATMEL_SPI_TDR			0x000c
-#define ATMEL_SPI_SR			0x0010
-#define ATMEL_SPI_IER			0x0014
-#define ATMEL_SPI_IDR			0x0018
-#define ATMEL_SPI_IMR			0x001c
-#define ATMEL_SPI_CSR(x)		(0x0030 + 4 * (x))
-#define ATMEL_SPI_VERSION		0x00fc
-
-/* Bits in CR */
-#define ATMEL_SPI_CR_SPIEN		BIT(0)
-#define ATMEL_SPI_CR_SPIDIS		BIT(1)
-#define ATMEL_SPI_CR_SWRST		BIT(7)
-#define ATMEL_SPI_CR_LASTXFER		BIT(24)
-
-/* Bits in MR */
-#define ATMEL_SPI_MR_MSTR		BIT(0)
-#define ATMEL_SPI_MR_PS			BIT(1)
-#define ATMEL_SPI_MR_PCSDEC		BIT(2)
-#define ATMEL_SPI_MR_FDIV		BIT(3)
-#define ATMEL_SPI_MR_MODFDIS		BIT(4)
-#define ATMEL_SPI_MR_WDRBT		BIT(5)
-#define ATMEL_SPI_MR_LLB		BIT(7)
-#define ATMEL_SPI_MR_PCS(x)		(((x) & 15) << 16)
-#define ATMEL_SPI_MR_DLYBCS(x)		((x) << 24)
-
-/* Bits in RDR */
-#define ATMEL_SPI_RDR_RD(x)		(x)
-#define ATMEL_SPI_RDR_PCS(x)		((x) << 16)
-
-/* Bits in TDR */
-#define ATMEL_SPI_TDR_TD(x)		(x)
-#define ATMEL_SPI_TDR_PCS(x)		((x) << 16)
-#define ATMEL_SPI_TDR_LASTXFER		BIT(24)
-
-/* Bits in SR/IER/IDR/IMR */
-#define ATMEL_SPI_SR_RDRF		BIT(0)
-#define ATMEL_SPI_SR_TDRE		BIT(1)
-#define ATMEL_SPI_SR_MODF		BIT(2)
-#define ATMEL_SPI_SR_OVRES		BIT(3)
-#define ATMEL_SPI_SR_ENDRX		BIT(4)
-#define ATMEL_SPI_SR_ENDTX		BIT(5)
-#define ATMEL_SPI_SR_RXBUFF		BIT(6)
-#define ATMEL_SPI_SR_TXBUFE		BIT(7)
-#define ATMEL_SPI_SR_NSSR		BIT(8)
-#define ATMEL_SPI_SR_TXEMPTY		BIT(9)
-#define ATMEL_SPI_SR_SPIENS		BIT(16)
-
-/* Bits in CSRx */
-#define ATMEL_SPI_CSRx_CPOL		BIT(0)
-#define ATMEL_SPI_CSRx_NCPHA		BIT(1)
-#define ATMEL_SPI_CSRx_CSAAT		BIT(3)
-#define ATMEL_SPI_CSRx_BITS(x)		((x) << 4)
-#define ATMEL_SPI_CSRx_SCBR(x)		((x) << 8)
-#define ATMEL_SPI_CSRx_SCBR_MAX		GENMASK(7, 0)
-#define ATMEL_SPI_CSRx_DLYBS(x)		((x) << 16)
-#define ATMEL_SPI_CSRx_DLYBCT(x)	((x) << 24)
-
-/* Bits in VERSION */
-#define ATMEL_SPI_VERSION_REV(x)	((x) & 0xfff)
-#define ATMEL_SPI_VERSION_MFN(x)	((x) << 16)
-
-/* Constants for CSRx:BITS */
-#define ATMEL_SPI_BITS_8		0
-#define ATMEL_SPI_BITS_9		1
-#define ATMEL_SPI_BITS_10		2
-#define ATMEL_SPI_BITS_11		3
-#define ATMEL_SPI_BITS_12		4
-#define ATMEL_SPI_BITS_13		5
-#define ATMEL_SPI_BITS_14		6
-#define ATMEL_SPI_BITS_15		7
-#define ATMEL_SPI_BITS_16		8
-
-/* Register access macros */
-#define spi_readl(as, reg)					\
-	readl(as->regs + ATMEL_SPI_##reg)
-#define spi_writel(as, reg, value)				\
-	writel(value, as->regs + ATMEL_SPI_##reg)
Signature · 1 line
2.39.5
#2 lore raw

PATCH v2 2/2 Revert "mem: spi-mem: add declaration for spi_mem_default_supports_op"

In reply to Alexander Dahl

We have a duplicate declaration of spi_mem_default_supports_op() which was added twice, first with commit af6266c1c27a ("mem: spi-mem: add declaration for spi_mem_default_supports_op") for v2021.04, and again with commit 2299076e34f8 ("spi: spi-mem: export spi_mem_default_supports_op()") for v2021.07.

The first commit is reverted here, because the second better matches the definition and has a better place in the declaration order.

Note: Linux declares this in a different section of spi-mem.h which is disabled in U-Boot through #ifndef __UBOOT__.

This reverts commit af6266c1c27add8beac7f3365c00b3525a9012c4.

---

Cc Mathew McBride <[email protected]>
Cc Pratyush Yadav <[email protected]>
Cc Priyanka Jain <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Jagan Teki <[email protected]>
 include/spi-mem.h | 3 ---
 1 file changed, 3 deletions(-)
include/spi-mem.h +0 -3
index 3c8e95b6f53..2eb05a2e5bc 100644
@@ -329,9 +329,6 @@ bool spi_mem_default_supports_op(struct spi_slave *slave,
 
 int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op);
 
-bool spi_mem_default_supports_op(struct spi_slave *mem,
-				 const struct spi_mem_op *op);
-
 struct spi_mem_dirmap_desc *
 spi_mem_dirmap_create(struct spi_slave *mem,
 		      const struct spi_mem_dirmap_info *info);
Signature · 1 line
2.39.5