linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] spi: realtek-rtl: two small improvements
@ 2022-07-31 20:21 Martin Blumenstingl
  2022-07-31 20:21 ` [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support Martin Blumenstingl
  2022-07-31 20:21 ` [PATCH v3 2/2] spi: realtek-rtl: Improve readability when clearing the size mask Martin Blumenstingl
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2022-07-31 20:21 UTC (permalink / raw)
  To: linux-spi; +Cc: linux-kernel, bert, sander, mail, Martin Blumenstingl

This is a successor to my single patch [0] "spi: realtek-rtl: Fix
clearing some register bits"

Changes since v2 at [1]:
- Added Sander's Tested-by to the second patch (thank you!)
- Dropped HAS_IOMEM dependency as this is already implied by CONFIG_SPI
  (thanks Sander for spotting this!)
- Extended Kconfig help text with the module name to make the Realtek
  driver consistent with others. Thanks to Sander for the suggestion!

Changes since v1 at [0]:
- Added new patch to enable compile testing for the spi-realtek-rtl
  driver. This makes it easier to verify coding style changes (such as
  patch #2 in this series) where the binary result is not supposed to
  change.
- Updated the original patch to drop the RTL_SPI_SFCSR_CS change as
  it's not fully clear why that code is written as-is (and due to
  lack of hardware I am unable to runtime test the changes). Also
  move the ~ operator from the RTL_SPI_SFCSR_LEN_MASK definition to
  the place where it's used. Thanks to Sander for spotting the mistake
  in my initial patch!


[0] https://lore.kernel.org/lkml/78673dc7438a03bf9ed0103a935abf0172f146ce.camel@svanheule.net/T/
[1] https://lore.kernel.org/linux-spi/20220728152118.1429161-1-martin.blumenstingl@googlemail.com/T/


Martin Blumenstingl (2):
  spi: realtek-rtl: Add compile testing support
  spi: realtek-rtl: Improve readability when clearing the size mask

 drivers/spi/Kconfig           | 11 +++++++++++
 drivers/spi/Makefile          |  2 +-
 drivers/spi/spi-realtek-rtl.c |  4 ++--
 3 files changed, 14 insertions(+), 3 deletions(-)

-- 
2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support
  2022-07-31 20:21 [PATCH v3 0/2] spi: realtek-rtl: two small improvements Martin Blumenstingl
@ 2022-07-31 20:21 ` Martin Blumenstingl
  2022-08-16 19:55   ` Sander Vanheule
  2022-07-31 20:21 ` [PATCH v3 2/2] spi: realtek-rtl: Improve readability when clearing the size mask Martin Blumenstingl
  1 sibling, 1 reply; 4+ messages in thread
From: Martin Blumenstingl @ 2022-07-31 20:21 UTC (permalink / raw)
  To: linux-spi; +Cc: linux-kernel, bert, sander, mail, Martin Blumenstingl

Add support for compile testing the spi-realtek-rtl driver to increase
build testing coverage.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/spi/Kconfig  | 11 +++++++++++
 drivers/spi/Makefile |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 8e550269d488..4b84f27fae2b 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -969,6 +969,17 @@ config SPI_MXS
 	help
 	  SPI driver for Freescale MXS devices.
 
+config SPI_REALTEK_RTL
+	tristate "Realtek RTL SPI controller"
+	depends on MACH_REALTEK_RTL || COMPILE_TEST
+	default MACH_REALTEK_RTL
+	help
+	  SPI driver for the hardware found on Realtek RLTL8380, RTL8382,
+	  RTL8391, RTL8392 and RTL8393 SoCs.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called spi-realtek-rtl.
+
 config SPI_TEGRA210_QUAD
 	tristate "NVIDIA Tegra QSPI Controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 18bf3d8c6df7..9fe4a2aa0fd7 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -105,7 +105,7 @@ obj-$(CONFIG_SPI_QUP)			+= spi-qup.o
 obj-$(CONFIG_SPI_ROCKCHIP)		+= spi-rockchip.o
 obj-$(CONFIG_SPI_ROCKCHIP_SFC)		+= spi-rockchip-sfc.o
 obj-$(CONFIG_SPI_RB4XX)			+= spi-rb4xx.o
-obj-$(CONFIG_MACH_REALTEK_RTL)		+= spi-realtek-rtl.o
+obj-$(CONFIG_SPI_REALTEK_RTL)		+= spi-realtek-rtl.o
 obj-$(CONFIG_SPI_RPCIF)			+= spi-rpc-if.o
 obj-$(CONFIG_SPI_RSPI)			+= spi-rspi.o
 obj-$(CONFIG_SPI_S3C24XX)		+= spi-s3c24xx-hw.o
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] spi: realtek-rtl: Improve readability when clearing the size mask
  2022-07-31 20:21 [PATCH v3 0/2] spi: realtek-rtl: two small improvements Martin Blumenstingl
  2022-07-31 20:21 ` [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support Martin Blumenstingl
@ 2022-07-31 20:21 ` Martin Blumenstingl
  1 sibling, 0 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2022-07-31 20:21 UTC (permalink / raw)
  To: linux-spi; +Cc: linux-kernel, bert, sander, mail, Martin Blumenstingl

Define the bitmask RTL_SPI_SFCSR_LEN_MASK so it only sets the bits of
this specific part of the register instead of setting all bits except
the relevant ones. This makes it consistent with single bit macros in
the spi-realtek-rtl driver as well as with the approach that many other
drivers use.

Suggested-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/spi/spi-realtek-rtl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-realtek-rtl.c b/drivers/spi/spi-realtek-rtl.c
index 866b0477dbd7..0371d44cbfbd 100644
--- a/drivers/spi/spi-realtek-rtl.c
+++ b/drivers/spi/spi-realtek-rtl.c
@@ -20,7 +20,7 @@ struct rtspi {
 #define RTL_SPI_SFCSR_CSB1		BIT(30)
 #define RTL_SPI_SFCSR_RDY		BIT(27)
 #define RTL_SPI_SFCSR_CS		BIT(24)
-#define RTL_SPI_SFCSR_LEN_MASK		~(0x03 << 28)
+#define RTL_SPI_SFCSR_LEN_MASK		(0x03 << 28)
 #define RTL_SPI_SFCSR_LEN1		(0x00 << 28)
 #define RTL_SPI_SFCSR_LEN4		(0x03 << 28)
 
@@ -49,7 +49,7 @@ static void set_size(struct rtspi *rtspi, int size)
 	u32 value;
 
 	value = readl(REG(RTL_SPI_SFCSR));
-	value &= RTL_SPI_SFCSR_LEN_MASK;
+	value &= ~RTL_SPI_SFCSR_LEN_MASK;
 	if (size == 4)
 		value |= RTL_SPI_SFCSR_LEN4;
 	else if (size == 1)
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support
  2022-07-31 20:21 ` [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support Martin Blumenstingl
@ 2022-08-16 19:55   ` Sander Vanheule
  0 siblings, 0 replies; 4+ messages in thread
From: Sander Vanheule @ 2022-08-16 19:55 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-spi; +Cc: linux-kernel, bert, mail

On Sun, 2022-07-31 at 22:21 +0200, Martin Blumenstingl wrote:
> Add support for compile testing the spi-realtek-rtl driver to increase
> build testing coverage.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Sorry this took some time, but

Reviewed-by: Sander Vanheule <sander@svanheule.net>

Thanks!
Sander

> ---
>  drivers/spi/Kconfig  | 11 +++++++++++
>  drivers/spi/Makefile |  2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 8e550269d488..4b84f27fae2b 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -969,6 +969,17 @@ config SPI_MXS
>         help
>           SPI driver for Freescale MXS devices.
>  
> +config SPI_REALTEK_RTL
> +       tristate "Realtek RTL SPI controller"
> +       depends on MACH_REALTEK_RTL || COMPILE_TEST
> +       default MACH_REALTEK_RTL
> +       help
> +         SPI driver for the hardware found on Realtek RLTL8380, RTL8382,
> +         RTL8391, RTL8392 and RTL8393 SoCs.
> +
> +         This driver can also be built as a module. If so, the module
> +         will be called spi-realtek-rtl.
> +
>  config SPI_TEGRA210_QUAD
>         tristate "NVIDIA Tegra QSPI Controller"
>         depends on ARCH_TEGRA || COMPILE_TEST
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index 18bf3d8c6df7..9fe4a2aa0fd7 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -105,7 +105,7 @@ obj-$(CONFIG_SPI_QUP)                       += spi-qup.o
>  obj-$(CONFIG_SPI_ROCKCHIP)             += spi-rockchip.o
>  obj-$(CONFIG_SPI_ROCKCHIP_SFC)         += spi-rockchip-sfc.o
>  obj-$(CONFIG_SPI_RB4XX)                        += spi-rb4xx.o
> -obj-$(CONFIG_MACH_REALTEK_RTL)         += spi-realtek-rtl.o
> +obj-$(CONFIG_SPI_REALTEK_RTL)          += spi-realtek-rtl.o
>  obj-$(CONFIG_SPI_RPCIF)                        += spi-rpc-if.o
>  obj-$(CONFIG_SPI_RSPI)                 += spi-rspi.o
>  obj-$(CONFIG_SPI_S3C24XX)              += spi-s3c24xx-hw.o


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-16 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 20:21 [PATCH v3 0/2] spi: realtek-rtl: two small improvements Martin Blumenstingl
2022-07-31 20:21 ` [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support Martin Blumenstingl
2022-08-16 19:55   ` Sander Vanheule
2022-07-31 20:21 ` [PATCH v3 2/2] spi: realtek-rtl: Improve readability when clearing the size mask Martin Blumenstingl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).