Skip to contentSkip to conversation

spi: add ch341a usb2spi driver

PATCH In review Johannes Thumshirn 2 participants 2 messages Jul 8, 2024 SPI

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 spi: add ch341a usb2spi driver

Add a driver for the QiHeng Electronics ch341a USB-to-SPI adapter.

This driver is loosely based on the ch341a module from the flashrom project.

---
Changes to v1:
- Change C style to C++ style comments in header
- Sort Kconfig snippet alphabetically
- Don't cast away usb_bulk_msg() return value
- Call spi_unregister_device() on remove
- Don't pass constant speed to ch341_config_stream() Link to v1:
https://lore.kernel.org/linux-spi/[email protected]

Changes to v2:
- Sorted Makefile part alphabetically as well
- Link to v2: https://lore.kernel.org/r/[email protected]

---
 drivers/spi/Kconfig     |   6 ++
 drivers/spi/Makefile    |   1 +
 drivers/spi/spi-ch341.c | 241 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+)
drivers/spi/Kconfig +6 -0
index a2c99ff33e0a..ec1550c698d5 100644
@@ -277,6 +277,12 @@ config SPI_CADENCE_XSPI
 	  device with a Cadence XSPI controller and want to access the
 	  Flash as an MTD device.
 
+config SPI_CH341
+	tristate "CH341 USB2SPI adapter"
+	depends on SPI_MASTER && USB
+	help
+	  Enables the SPI controller on the CH341a USB to serial chip
+
 config SPI_CLPS711X
 	tristate "CLPS711X host SPI controller"
 	depends on ARCH_CLPS711X || COMPILE_TEST
drivers/spi/Makefile +1 -0
index e694254dec04..e697d5fd8611 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_SPI_BUTTERFLY)		+= spi-butterfly.o
 obj-$(CONFIG_SPI_CADENCE)		+= spi-cadence.o
 obj-$(CONFIG_SPI_CADENCE_QUADSPI)	+= spi-cadence-quadspi.o
 obj-$(CONFIG_SPI_CADENCE_XSPI)		+= spi-cadence-xspi.o
+obj-$(CONFIG_SPI_CH341)			+= spi-ch341.o
 obj-$(CONFIG_SPI_CLPS711X)		+= spi-clps711x.o
 obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= spi-coldfire-qspi.o
 obj-$(CONFIG_SPI_CS42L43)		+= spi-cs42l43.o
drivers/spi/spi-ch341.c new file +241 -0

241 lines not on this page · raw message

---
base-commit: e9d22f7a6655941fc8b2b942ed354ec780936b3e
change-id: 20240708-spi-ch341a-79bae1d045b5

Best regards,

Signature · 1 line
Johannes Thumshirn <[email protected]>
maintainer
#1 lore raw
Quoted 5 lines · Johannes Thumshirn

Add a driver for the QiHeng Electronics ch341a USB-to-SPI adapter.

This driver is loosely based on the ch341a module from the flashrom project.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: add ch341a usb2spi driver

      commit: 8846739f52afa07e63395c80227dc544f54bd7b1

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark