diff --git a/pcie-wb/Makefile b/pcie-wb/Makefile index 927c8b3ee5ef3c4f61e36dc75127fffd52ee7823..ddb676a818bd0c080f997198d17360a47f9f6832 100644 --- a/pcie-wb/Makefile +++ b/pcie-wb/Makefile @@ -17,7 +17,7 @@ KERNELVER ?= `uname -r` KERNELDIR ?= /lib/modules/$(KERNELVER)/build ifneq ($(KERNELRELEASE),) - obj-m := pcie_wb.o wishbone.o spec_wb.o + obj-m := pcie_wb.o wishbone.o spec_wb.o usb_wb.o else KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) diff --git a/pcie-wb/usb_wb.c b/pcie-wb/usb_wb.c new file mode 100644 index 0000000000000000000000000000000000000000..bf51ee1bb54bd9915d7279d3e834a8ee50a0a808 --- /dev/null +++ b/pcie-wb/usb_wb.c @@ -0,0 +1,65 @@ +/* + * USB-WB adapter driver + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/tty.h> +#include <linux/module.h> +#include <linux/usb.h> +#include <linux/usb/serial.h> +#include <linux/uaccess.h> + +static const struct usb_device_id id_table[] = { + { USB_DEVICE_AND_INTERFACE_INFO(0x1D50, 0x6062, 0xFF, 0xFF, 0xFF) }, + { }, +}; +MODULE_DEVICE_TABLE(usb, id_table); + +static struct usb_driver usb_wb_driver = { + .name = "usb_wb", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, + .no_dynamic_id = 1, +}; + +static struct usb_serial_driver usb_wb_device = { + .driver = { + .owner = THIS_MODULE, + .name = "usb_wb", + }, + .id_table = id_table, + .usb_driver = &usb_wb_driver, + .num_ports = 1, +}; + +static int __init usb_wb_init(void) +{ + int retval; + + retval = usb_serial_register(&usb_wb_device); + if (retval) + return retval; + retval = usb_register(&usb_wb_driver); + if (retval) + usb_serial_deregister(&usb_wb_device); + return retval; +} + +static void __exit usb_wb_exit(void) +{ + usb_deregister(&usb_wb_driver); + usb_serial_deregister(&usb_wb_device); +} + +MODULE_AUTHOR("Wesley W. Terpstra <w.terpstra@gsi.de>"); +MODULE_DESCRIPTION("Wishbone-USB adapter"); +MODULE_LICENSE("GPL"); + +module_init(usb_wb_init); +module_exit(usb_wb_exit);