This patch adds the USB driver source file most_usb.c and
modifies the Makefile and Kconfig accordingly.
Signed-off-by: Christian Gromm
---
v2:
Reported-by: Greg Kroah-Hartman
- don't remove usb driver from staging area
- don't touch staging/most/Kconfig
- remove subdirectory for USB driver and put source file into
drivers/most
v3:
- submitted fixes found during code audit to staging version
first to be able to resend single patch that adds the driver
v4:
Reported-by: Dan Carpenter
submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:
- use function sysfs_streq
- add missing put_device calls
- use correct error codes
- replace code to calculate array index
- don't use error path to exit function on success
- move allocation of URB out of critical section
- return 0 instead of variable
- change return value of function drci_rd_reg
- don't use expressions that might fail in a declaration
- change order of function parameters
v5:
Reported-by: Dan Carpenter
submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:
- init return value in default path of switch/case expression
v6:
Reported-by: Randy Dunlap
remove dependency to NET in Kconfig file
drivers/most/Kconfig | 11 +
drivers/most/Makefile |2 +
drivers/most/most_usb.c | 1170 +
drivers/staging/most/Kconfig |2 -
drivers/staging/most/usb/Kconfig | 13 -
drivers/staging/most/usb/Makefile |4 -
drivers/staging/most/usb/usb.c| 1170 -
7 files changed, 1183 insertions(+), 1189 deletions(-)
create mode 100644 drivers/most/most_usb.c
delete mode 100644 drivers/staging/most/usb/Kconfig
delete mode 100644 drivers/staging/most/usb/Makefile
delete mode 100644 drivers/staging/most/usb/usb.c
diff --git a/drivers/most/Kconfig b/drivers/most/Kconfig
index 58d7999..60fc082 100644
--- a/drivers/most/Kconfig
+++ b/drivers/most/Kconfig
@@ -13,3 +13,14 @@ menuconfig MOST
module will be called most_core.
If in doubt, say N here.
+
+if MOST
+config MOST_USB_HDM
+ tristate "USB"
+ depends on USB
+ help
+ Say Y here if you want to connect via USB to network transceiver.
+
+ To compile this driver as a module, choose M here: the
+ module will be called most_usb.
+endif
diff --git a/drivers/most/Makefile b/drivers/most/Makefile
index e810cd3..6a3cb90 100644
--- a/drivers/most/Makefile
+++ b/drivers/most/Makefile
@@ -2,3 +2,5 @@
obj-$(CONFIG_MOST) += most_core.o
most_core-y := core.o \
configfs.o
+
+obj-$(CONFIG_MOST_USB_HDM) += most_usb.o
diff --git a/drivers/most/most_usb.c b/drivers/most/most_usb.c
new file mode 100644
index 000..2640c5b
--- /dev/null
+++ b/drivers/most/most_usb.c
@@ -0,0 +1,1170 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * usb.c - Hardware dependent module for USB
+ *
+ * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define USB_MTU512
+#define NO_ISOCHRONOUS_URB 0
+#define AV_PACKETS_PER_XACT2
+#define BUF_CHAIN_SIZE 0x
+#define MAX_NUM_ENDPOINTS 30
+#define MAX_SUFFIX_LEN 10
+#define MAX_STRING_LEN 80
+#define MAX_BUF_SIZE 0x
+
+#define USB_VENDOR_ID_SMSC 0x0424 /* VID: SMSC */
+#define USB_DEV_ID_BRDG0xC001 /* PID: USB Bridge */
+#define USB_DEV_ID_OS81118 0xCF18 /* PID: USB OS81118 */
+#define USB_DEV_ID_OS81119 0xCF19 /* PID: USB OS81119 */
+#define USB_DEV_ID_OS81210 0xCF30 /* PID: USB OS81210 */
+/* DRCI Addresses */
+#define DRCI_REG_NI_STATE 0x0100
+#define DRCI_REG_PACKET_BW 0x0101
+#define DRCI_REG_NODE_ADDR 0x0102
+#define DRCI_REG_NODE_POS 0x0103
+#define DRCI_REG_MEP_FILTER0x0140
+#define DRCI_REG_HASH_TBL0 0x0141
+#define DRCI_REG_HASH_TBL1 0x0142
+#define DRCI_REG_HASH_TBL2 0x0143
+#define DRCI_REG_HASH_TBL3 0x0144
+#define DRCI_REG_HW_ADDR_HI0x0145
+#define DRCI_REG_HW_ADDR_MI0x0146
+#define DRCI_REG_HW_ADDR_LO0x0147
+#define DRCI_REG_BASE 0x1100
+#define DRCI_COMMAND 0x02
+#define DRCI_READ_REQ 0xA0
+#define DRCI_WRITE_REQ 0xA1
+
+/**
+ * struct most_dci_obj - Direct Communication Interface
+ * @kobj:position in sysfs
+ * @usb_device: pointer to the usb device
+