linux/drivers/spi/spi-ch341.c

// SPDX-License-Identifier: GPL-2.0
//
// QiHeng Electronics ch341a USB-to-SPI adapter driver
//
// Copyright (C) 2024 Johannes Thumshirn <[email protected]>
//
// Based on ch341a_spi.c from the flashrom project.

#include <linux/module.h>
#include <linux/usb.h>
#include <linux/spi/spi.h>

#define CH341_PACKET_LENGTH
#define CH341_DEFAULT_TIMEOUT

#define CH341A_CMD_UIO_STREAM

#define CH341A_CMD_UIO_STM_END
#define CH341A_CMD_UIO_STM_DIR
#define CH341A_CMD_UIO_STM_OUT

#define CH341A_CMD_I2C_STREAM
#define CH341A_CMD_I2C_STM_SET
#define CH341A_CMD_I2C_STM_END

#define CH341A_CMD_SPI_STREAM

#define CH341A_STM_I2C_100K

struct ch341_spi_dev {};

static void ch341_set_cs(struct spi_device *spi, bool is_high)
{}

static int ch341_transfer_one(struct spi_controller *host,
			      struct spi_device *spi,
			      struct spi_transfer *trans)
{}

static void ch341_recv(struct urb *urb)
{}

static int ch341_config_stream(struct ch341_spi_dev *ch341)
{}

static int ch341_enable_pins(struct ch341_spi_dev *ch341, bool enable)
{}

static struct spi_board_info chip =;

static int ch341_probe(struct usb_interface *intf,
		       const struct usb_device_id *id)
{}

static void ch341_disconnect(struct usb_interface *intf)
{}

static const struct usb_device_id ch341_id_table[] =;
MODULE_DEVICE_TABLE(usb, ch341_id_table);

static struct usb_driver ch341a_usb_driver =;
module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();