Re: [PATCH 2/2] USB: misc: Add driver for the WCH CH341 in I2C/GPIO mode

From: Randy Dunlap
Date: Mon Apr 19 2021 - 22:33:15 EST


Hi--

On 4/19/21 7:25 PM, Frank Zago wrote:
> From: frank zago <frank@xxxxxxxx>
>

>
> Signed-off-by: Frank Zago <frank@xxxxxxxx>
> Signed-off-by: frank zago <frank@xxxxxxxx>

Don't think you need both of those.

> ---
> MAINTAINERS | 6 +
> drivers/usb/misc/Kconfig | 18 ++
> drivers/usb/misc/Makefile | 1 +
> drivers/usb/misc/ch341/Kconfig | 0
> drivers/usb/misc/ch341/Makefile | 3 +
> drivers/usb/misc/ch341/ch341-core.c | 87 +++++++++
> drivers/usb/misc/ch341/ch341-gpio.c | 249 ++++++++++++++++++++++++++
> drivers/usb/misc/ch341/ch341-i2c.c | 267 ++++++++++++++++++++++++++++
> drivers/usb/misc/ch341/ch341.h | 50 ++++++
> 9 files changed, 681 insertions(+)
> create mode 100644 drivers/usb/misc/ch341/Kconfig
> create mode 100644 drivers/usb/misc/ch341/Makefile
> create mode 100644 drivers/usb/misc/ch341/ch341-core.c
> create mode 100644 drivers/usb/misc/ch341/ch341-gpio.c
> create mode 100644 drivers/usb/misc/ch341/ch341-i2c.c
> create mode 100644 drivers/usb/misc/ch341/ch341.h
>

> diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> index 8f1144359012..2d4db92f0de4 100644
> --- a/drivers/usb/misc/Kconfig
> +++ b/drivers/usb/misc/Kconfig
> @@ -284,3 +284,21 @@ config BRCM_USB_PINMAP
> This option enables support for remapping some USB external
> signals, which are typically on dedicated pins on the chip,
> to any gpio.
> +
> +config USB_CH341_CORE
> + tristate "USB WinChipHead CH341 in I2C/SPI/GPIO mode"
> + depends on USB && GPIOLIB && I2C && SPI
> + help
> +
> + If you say yes to this option, support for the CH341 chips,
> + running in I2C/SPI/GPIO mode will be included. Some versions
> + of the chip do not support all the functionnalities but
> + there is no way to differentiate them. For instance the
> + CH341A and CH341B support everything while the CH341T can
> + only do I2C.
> +
> + The serial mode is not supported by this driver. Use the
> + CH341 USB serial driver.
> +
> + This driver can also be built as a module. If so, the
> + module will be called ch341-buses.

Above should be in drivers/usb/misc/ch341/Kconfig file instead?

> diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
> index 5f4e598573ab..95c0ca15b8c9 100644
> --- a/drivers/usb/misc/Makefile
> +++ b/drivers/usb/misc/Makefile
> @@ -32,3 +32,4 @@ obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o
> obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/
> obj-$(CONFIG_USB_LINK_LAYER_TEST) += lvstest.o
> obj-$(CONFIG_BRCM_USB_PINMAP) += brcmstb-usb-pinmap.o
> +obj-$(CONFIG_USB_CH341_CORE) += ch341/
> diff --git a/drivers/usb/misc/ch341/Kconfig b/drivers/usb/misc/ch341/Kconfig
> new file mode 100644
> index 000000000000..e69de29bb2d1

Is that file (above) empty on purpose?

> diff --git a/drivers/usb/misc/ch341/Makefile b/drivers/usb/misc/ch341/Makefile
> new file mode 100644
> index 000000000000..7c6429e7a46e
> --- /dev/null
> +++ b/drivers/usb/misc/ch341/Makefile
> @@ -0,0 +1,3 @@
> +obj-$(CONFIG_USB_CH341_CORE) := ch341-buses.o
> +
> +ch341-buses-objs := ch341-core.o ch341-i2c.o ch341-gpio.o


--
~Randy