most_usb.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * usb.c - Hardware dependent module for USB
  4. *
  5. * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
  6. */
  7. #include <linux/module.h>
  8. #include <linux/fs.h>
  9. #include <linux/usb.h>
  10. #include <linux/slab.h>
  11. #include <linux/init.h>
  12. #include <linux/cdev.h>
  13. #include <linux/device.h>
  14. #include <linux/list.h>
  15. #include <linux/completion.h>
  16. #include <linux/mutex.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/workqueue.h>
  20. #include <linux/sysfs.h>
  21. #include <linux/dma-mapping.h>
  22. #include <linux/etherdevice.h>
  23. #include <linux/uaccess.h>
  24. #include <linux/most.h>
  25. #define USB_MTU 512
  26. #define NO_ISOCHRONOUS_URB 0
  27. #define AV_PACKETS_PER_XACT 2
  28. #define BUF_CHAIN_SIZE 0xFFFF
  29. #define MAX_NUM_ENDPOINTS 30
  30. #define MAX_SUFFIX_LEN 10
  31. #define MAX_STRING_LEN 80
  32. #define MAX_BUF_SIZE 0xFFFF
  33. #define USB_VENDOR_ID_SMSC 0x0424 /* VID: SMSC */
  34. #define USB_DEV_ID_BRDG 0xC001 /* PID: USB Bridge */
  35. #define USB_DEV_ID_OS81118 0xCF18 /* PID: USB OS81118 */
  36. #define USB_DEV_ID_OS81119 0xCF19 /* PID: USB OS81119 */
  37. #define USB_DEV_ID_OS81210 0xCF30 /* PID: USB OS81210 */
  38. /* DRCI Addresses */
  39. #define DRCI_REG_NI_STATE 0x0100
  40. #define DRCI_REG_PACKET_BW 0x0101
  41. #define DRCI_REG_NODE_ADDR 0x0102
  42. #define DRCI_REG_NODE_POS 0x0103
  43. #define DRCI_REG_MEP_FILTER 0x0140
  44. #define DRCI_REG_HASH_TBL0 0x0141
  45. #define DRCI_REG_HASH_TBL1 0x0142
  46. #define DRCI_REG_HASH_TBL2 0x0143
  47. #define DRCI_REG_HASH_TBL3 0x0144
  48. #define DRCI_REG_HW_ADDR_HI 0x0145
  49. #define DRCI_REG_HW_ADDR_MI 0x0146
  50. #define DRCI_REG_HW_ADDR_LO 0x0147
  51. #define DRCI_REG_BASE 0x1100
  52. #define DRCI_COMMAND 0x02
  53. #define DRCI_READ_REQ 0xA0
  54. #define DRCI_WRITE_REQ 0xA1
  55. /**
  56. * struct most_dci_obj - Direct Communication Interface
  57. * @kobj:position in sysfs
  58. * @usb_device: pointer to the usb device
  59. * @reg_addr: register address for arbitrary DCI access
  60. */
  61. struct most_dci_obj {
  62. struct device dev;
  63. struct usb_device *usb_device;
  64. u16 reg_addr;
  65. };
  66. #define to_dci_obj(p) container_of(p, struct most_dci_obj, dev)
  67. struct most_dev;
  68. struct clear_hold_work {
  69. struct work_struct ws;
  70. struct most_dev *mdev;
  71. unsigned int channel;
  72. int pipe;
  73. };
  74. #define to_clear_hold_work(w) container_of(w, struct clear_hold_work, ws)
  75. /**
  76. * struct most_dev - holds all usb interface specific stuff
  77. * @usb_device: pointer to usb device
  78. * @iface: hardware interface
  79. * @cap: channel capabilities
  80. * @conf: channel configuration
  81. * @dci: direct communication interface of hardware
  82. * @ep_address: endpoint address table
  83. * @description: device description
  84. * @suffix: suffix for channel name
  85. * @channel_lock: synchronize channel access
  86. * @padding_active: indicates channel uses padding
  87. * @is_channel_healthy: health status table of each channel
  88. * @busy_urbs: list of anchored items
  89. * @io_mutex: synchronize I/O with disconnect
  90. * @link_stat_timer: timer for link status reports
  91. * @poll_work_obj: work for polling link status
  92. */
  93. struct most_dev {
  94. struct device dev;
  95. struct usb_device *usb_device;
  96. struct most_interface iface;
  97. struct most_channel_capability *cap;
  98. struct most_channel_config *conf;
  99. struct most_dci_obj *dci;
  100. u8 *ep_address;
  101. char description[MAX_STRING_LEN];
  102. char suffix[MAX_NUM_ENDPOINTS][MAX_SUFFIX_LEN];
  103. spinlock_t channel_lock[MAX_NUM_ENDPOINTS]; /* sync channel access */
  104. bool padding_active[MAX_NUM_ENDPOINTS];
  105. bool is_channel_healthy[MAX_NUM_ENDPOINTS];
  106. struct clear_hold_work clear_work[MAX_NUM_ENDPOINTS];
  107. struct usb_anchor *busy_urbs;
  108. struct mutex io_mutex;
  109. struct timer_list link_stat_timer;
  110. struct work_struct poll_work_obj;
  111. void (*on_netinfo)(struct most_interface *most_iface,
  112. unsigned char link_state, unsigned char *addrs);
  113. };
  114. #define to_mdev(d) container_of(d, struct most_dev, iface)
  115. #define to_mdev_from_dev(d) container_of(d, struct most_dev, dev)
  116. #define to_mdev_from_work(w) container_of(w, struct most_dev, poll_work_obj)
  117. static void wq_clear_halt(struct work_struct *wq_obj);
  118. static void wq_netinfo(struct work_struct *wq_obj);
  119. /**
  120. * drci_rd_reg - read a DCI register
  121. * @dev: usb device
  122. * @reg: register address
  123. * @buf: buffer to store data
  124. *
  125. * This is reads data from INIC's direct register communication interface
  126. */
  127. static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
  128. {
  129. int retval;
  130. __le16 *dma_buf;
  131. u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
  132. dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL);
  133. if (!dma_buf)
  134. return -ENOMEM;
  135. retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
  136. DRCI_READ_REQ, req_type,
  137. 0x0000,
  138. reg, dma_buf, sizeof(*dma_buf),
  139. USB_CTRL_GET_TIMEOUT);
  140. *buf = le16_to_cpu(*dma_buf);
  141. kfree(dma_buf);
  142. if (retval < 0)
  143. return retval;
  144. return 0;
  145. }
  146. /**
  147. * drci_wr_reg - write a DCI register
  148. * @dev: usb device
  149. * @reg: register address
  150. * @data: data to write
  151. *
  152. * This is writes data to INIC's direct register communication interface
  153. */
  154. static inline int drci_wr_reg(struct usb_device *dev, u16 reg, u16 data)
  155. {
  156. return usb_control_msg(dev,
  157. usb_sndctrlpipe(dev, 0),
  158. DRCI_WRITE_REQ,
  159. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  160. data,
  161. reg,
  162. NULL,
  163. 0,
  164. USB_CTRL_SET_TIMEOUT);
  165. }
  166. static inline int start_sync_ep(struct usb_device *usb_dev, u16 ep)
  167. {
  168. return drci_wr_reg(usb_dev, DRCI_REG_BASE + DRCI_COMMAND + ep * 16, 1);
  169. }
  170. /**
  171. * get_stream_frame_size - calculate frame size of current configuration
  172. * @dev: device structure
  173. * @cfg: channel configuration
  174. */
  175. static unsigned int get_stream_frame_size(struct device *dev,
  176. struct most_channel_config *cfg)
  177. {
  178. unsigned int frame_size;
  179. unsigned int sub_size = cfg->subbuffer_size;
  180. if (!sub_size) {
  181. dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
  182. return 0;
  183. }
  184. switch (cfg->data_type) {
  185. case MOST_CH_ISOC:
  186. frame_size = AV_PACKETS_PER_XACT * sub_size;
  187. break;
  188. case MOST_CH_SYNC:
  189. if (cfg->packets_per_xact == 0) {
  190. dev_warn(dev, "Misconfig: Packets per XACT zero\n");
  191. frame_size = 0;
  192. } else if (cfg->packets_per_xact == 0xFF) {
  193. frame_size = (USB_MTU / sub_size) * sub_size;
  194. } else {
  195. frame_size = cfg->packets_per_xact * sub_size;
  196. }
  197. break;
  198. default:
  199. dev_warn(dev, "Query frame size of non-streaming channel\n");
  200. frame_size = 0;
  201. break;
  202. }
  203. return frame_size;
  204. }
  205. /**
  206. * hdm_poison_channel - mark buffers of this channel as invalid
  207. * @iface: pointer to the interface
  208. * @channel: channel ID
  209. *
  210. * This unlinks all URBs submitted to the HCD,
  211. * calls the associated completion function of the core and removes
  212. * them from the list.
  213. *
  214. * Returns 0 on success or error code otherwise.
  215. */
  216. static int hdm_poison_channel(struct most_interface *iface, int channel)
  217. {
  218. struct most_dev *mdev = to_mdev(iface);
  219. unsigned long flags;
  220. spinlock_t *lock; /* temp. lock */
  221. if (channel < 0 || channel >= iface->num_channels) {
  222. dev_warn(&mdev->usb_device->dev, "Channel ID out of range.\n");
  223. return -ECHRNG;
  224. }
  225. lock = mdev->channel_lock + channel;
  226. spin_lock_irqsave(lock, flags);
  227. mdev->is_channel_healthy[channel] = false;
  228. spin_unlock_irqrestore(lock, flags);
  229. cancel_work_sync(&mdev->clear_work[channel].ws);
  230. mutex_lock(&mdev->io_mutex);
  231. usb_kill_anchored_urbs(&mdev->busy_urbs[channel]);
  232. if (mdev->padding_active[channel])
  233. mdev->padding_active[channel] = false;
  234. if (mdev->conf[channel].data_type == MOST_CH_ASYNC) {
  235. del_timer_sync(&mdev->link_stat_timer);
  236. cancel_work_sync(&mdev->poll_work_obj);
  237. }
  238. mutex_unlock(&mdev->io_mutex);
  239. return 0;
  240. }
  241. /**
  242. * hdm_add_padding - add padding bytes
  243. * @mdev: most device
  244. * @channel: channel ID
  245. * @mbo: buffer object
  246. *
  247. * This inserts the INIC hardware specific padding bytes into a streaming
  248. * channel's buffer
  249. */
  250. static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
  251. {
  252. struct most_channel_config *conf = &mdev->conf[channel];
  253. unsigned int frame_size = get_stream_frame_size(&mdev->dev, conf);
  254. unsigned int j, num_frames;
  255. if (!frame_size)
  256. return -EINVAL;
  257. num_frames = mbo->buffer_length / frame_size;
  258. if (num_frames < 1) {
  259. dev_err(&mdev->usb_device->dev,
  260. "Missed minimal transfer unit.\n");
  261. return -EINVAL;
  262. }
  263. for (j = num_frames - 1; j > 0; j--)
  264. memmove(mbo->virt_address + j * USB_MTU,
  265. mbo->virt_address + j * frame_size,
  266. frame_size);
  267. mbo->buffer_length = num_frames * USB_MTU;
  268. return 0;
  269. }
  270. /**
  271. * hdm_remove_padding - remove padding bytes
  272. * @mdev: most device
  273. * @channel: channel ID
  274. * @mbo: buffer object
  275. *
  276. * This takes the INIC hardware specific padding bytes off a streaming
  277. * channel's buffer.
  278. */
  279. static int hdm_remove_padding(struct most_dev *mdev, int channel,
  280. struct mbo *mbo)
  281. {
  282. struct most_channel_config *const conf = &mdev->conf[channel];
  283. unsigned int frame_size = get_stream_frame_size(&mdev->dev, conf);
  284. unsigned int j, num_frames;
  285. if (!frame_size)
  286. return -EINVAL;
  287. num_frames = mbo->processed_length / USB_MTU;
  288. for (j = 1; j < num_frames; j++)
  289. memmove(mbo->virt_address + frame_size * j,
  290. mbo->virt_address + USB_MTU * j,
  291. frame_size);
  292. mbo->processed_length = frame_size * num_frames;
  293. return 0;
  294. }
  295. /**
  296. * hdm_write_completion - completion function for submitted Tx URBs
  297. * @urb: the URB that has been completed
  298. *
  299. * This checks the status of the completed URB. In case the URB has been
  300. * unlinked before, it is immediately freed. On any other error the MBO
  301. * transfer flag is set. On success it frees allocated resources and calls
  302. * the completion function.
  303. *
  304. * Context: interrupt!
  305. */
  306. static void hdm_write_completion(struct urb *urb)
  307. {
  308. struct mbo *mbo = urb->context;
  309. struct most_dev *mdev = to_mdev(mbo->ifp);
  310. unsigned int channel = mbo->hdm_channel_id;
  311. spinlock_t *lock = mdev->channel_lock + channel;
  312. unsigned long flags;
  313. spin_lock_irqsave(lock, flags);
  314. mbo->processed_length = 0;
  315. mbo->status = MBO_E_INVAL;
  316. if (likely(mdev->is_channel_healthy[channel])) {
  317. switch (urb->status) {
  318. case 0:
  319. case -ESHUTDOWN:
  320. mbo->processed_length = urb->actual_length;
  321. mbo->status = MBO_SUCCESS;
  322. break;
  323. case -EPIPE:
  324. dev_warn(&mdev->usb_device->dev,
  325. "Broken pipe on ep%02x\n",
  326. mdev->ep_address[channel]);
  327. mdev->is_channel_healthy[channel] = false;
  328. mdev->clear_work[channel].pipe = urb->pipe;
  329. schedule_work(&mdev->clear_work[channel].ws);
  330. break;
  331. case -ENODEV:
  332. case -EPROTO:
  333. mbo->status = MBO_E_CLOSE;
  334. break;
  335. }
  336. }
  337. spin_unlock_irqrestore(lock, flags);
  338. if (likely(mbo->complete))
  339. mbo->complete(mbo);
  340. usb_free_urb(urb);
  341. }
  342. /**
  343. * hdm_read_completion - completion function for submitted Rx URBs
  344. * @urb: the URB that has been completed
  345. *
  346. * This checks the status of the completed URB. In case the URB has been
  347. * unlinked before it is immediately freed. On any other error the MBO transfer
  348. * flag is set. On success it frees allocated resources, removes
  349. * padding bytes -if necessary- and calls the completion function.
  350. *
  351. * Context: interrupt!
  352. */
  353. static void hdm_read_completion(struct urb *urb)
  354. {
  355. struct mbo *mbo = urb->context;
  356. struct most_dev *mdev = to_mdev(mbo->ifp);
  357. unsigned int channel = mbo->hdm_channel_id;
  358. struct device *dev = &mdev->usb_device->dev;
  359. spinlock_t *lock = mdev->channel_lock + channel;
  360. unsigned long flags;
  361. spin_lock_irqsave(lock, flags);
  362. mbo->processed_length = 0;
  363. mbo->status = MBO_E_INVAL;
  364. if (likely(mdev->is_channel_healthy[channel])) {
  365. switch (urb->status) {
  366. case 0:
  367. case -ESHUTDOWN:
  368. mbo->processed_length = urb->actual_length;
  369. mbo->status = MBO_SUCCESS;
  370. if (mdev->padding_active[channel] &&
  371. hdm_remove_padding(mdev, channel, mbo)) {
  372. mbo->processed_length = 0;
  373. mbo->status = MBO_E_INVAL;
  374. }
  375. break;
  376. case -EPIPE:
  377. dev_warn(dev, "Broken pipe on ep%02x\n",
  378. mdev->ep_address[channel]);
  379. mdev->is_channel_healthy[channel] = false;
  380. mdev->clear_work[channel].pipe = urb->pipe;
  381. schedule_work(&mdev->clear_work[channel].ws);
  382. break;
  383. case -ENODEV:
  384. case -EPROTO:
  385. mbo->status = MBO_E_CLOSE;
  386. break;
  387. case -EOVERFLOW:
  388. dev_warn(dev, "Babble on ep%02x\n",
  389. mdev->ep_address[channel]);
  390. break;
  391. }
  392. }
  393. spin_unlock_irqrestore(lock, flags);
  394. if (likely(mbo->complete))
  395. mbo->complete(mbo);
  396. usb_free_urb(urb);
  397. }
  398. /**
  399. * hdm_enqueue - receive a buffer to be used for data transfer
  400. * @iface: interface to enqueue to
  401. * @channel: ID of the channel
  402. * @mbo: pointer to the buffer object
  403. *
  404. * This allocates a new URB and fills it according to the channel
  405. * that is being used for transmission of data. Before the URB is
  406. * submitted it is stored in the private anchor list.
  407. *
  408. * Returns 0 on success. On any error the URB is freed and a error code
  409. * is returned.
  410. *
  411. * Context: Could in _some_ cases be interrupt!
  412. */
  413. static int hdm_enqueue(struct most_interface *iface, int channel,
  414. struct mbo *mbo)
  415. {
  416. struct most_dev *mdev = to_mdev(iface);
  417. struct most_channel_config *conf;
  418. int retval = 0;
  419. struct urb *urb;
  420. unsigned long length;
  421. void *virt_address;
  422. if (!mbo)
  423. return -EINVAL;
  424. if (iface->num_channels <= channel || channel < 0)
  425. return -ECHRNG;
  426. urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_KERNEL);
  427. if (!urb)
  428. return -ENOMEM;
  429. conf = &mdev->conf[channel];
  430. mutex_lock(&mdev->io_mutex);
  431. if (!mdev->usb_device) {
  432. retval = -ENODEV;
  433. goto err_free_urb;
  434. }
  435. if ((conf->direction & MOST_CH_TX) && mdev->padding_active[channel] &&
  436. hdm_add_padding(mdev, channel, mbo)) {
  437. retval = -EINVAL;
  438. goto err_free_urb;
  439. }
  440. urb->transfer_dma = mbo->bus_address;
  441. virt_address = mbo->virt_address;
  442. length = mbo->buffer_length;
  443. if (conf->direction & MOST_CH_TX) {
  444. usb_fill_bulk_urb(urb, mdev->usb_device,
  445. usb_sndbulkpipe(mdev->usb_device,
  446. mdev->ep_address[channel]),
  447. virt_address,
  448. length,
  449. hdm_write_completion,
  450. mbo);
  451. if (conf->data_type != MOST_CH_ISOC &&
  452. conf->data_type != MOST_CH_SYNC)
  453. urb->transfer_flags |= URB_ZERO_PACKET;
  454. } else {
  455. usb_fill_bulk_urb(urb, mdev->usb_device,
  456. usb_rcvbulkpipe(mdev->usb_device,
  457. mdev->ep_address[channel]),
  458. virt_address,
  459. length + conf->extra_len,
  460. hdm_read_completion,
  461. mbo);
  462. }
  463. urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
  464. usb_anchor_urb(urb, &mdev->busy_urbs[channel]);
  465. retval = usb_submit_urb(urb, GFP_KERNEL);
  466. if (retval) {
  467. dev_err(&mdev->usb_device->dev,
  468. "URB submit failed with error %d.\n", retval);
  469. goto err_unanchor_urb;
  470. }
  471. mutex_unlock(&mdev->io_mutex);
  472. return 0;
  473. err_unanchor_urb:
  474. usb_unanchor_urb(urb);
  475. err_free_urb:
  476. usb_free_urb(urb);
  477. mutex_unlock(&mdev->io_mutex);
  478. return retval;
  479. }
  480. static void *hdm_dma_alloc(struct mbo *mbo, u32 size)
  481. {
  482. struct most_dev *mdev = to_mdev(mbo->ifp);
  483. return usb_alloc_coherent(mdev->usb_device, size, GFP_KERNEL,
  484. &mbo->bus_address);
  485. }
  486. static void hdm_dma_free(struct mbo *mbo, u32 size)
  487. {
  488. struct most_dev *mdev = to_mdev(mbo->ifp);
  489. usb_free_coherent(mdev->usb_device, size, mbo->virt_address,
  490. mbo->bus_address);
  491. }
  492. /**
  493. * hdm_configure_channel - receive channel configuration from core
  494. * @iface: interface
  495. * @channel: channel ID
  496. * @conf: structure that holds the configuration information
  497. *
  498. * The attached network interface controller (NIC) supports a padding mode
  499. * to avoid short packets on USB, hence increasing the performance due to a
  500. * lower interrupt load. This mode is default for synchronous data and can
  501. * be switched on for isochronous data. In case padding is active the
  502. * driver needs to know the frame size of the payload in order to calculate
  503. * the number of bytes it needs to pad when transmitting or to cut off when
  504. * receiving data.
  505. *
  506. */
  507. static int hdm_configure_channel(struct most_interface *iface, int channel,
  508. struct most_channel_config *conf)
  509. {
  510. unsigned int num_frames;
  511. unsigned int frame_size;
  512. struct most_dev *mdev = to_mdev(iface);
  513. struct device *dev = &mdev->usb_device->dev;
  514. if (!conf) {
  515. dev_err(dev, "Bad config pointer.\n");
  516. return -EINVAL;
  517. }
  518. if (channel < 0 || channel >= iface->num_channels) {
  519. dev_err(dev, "Channel ID out of range.\n");
  520. return -EINVAL;
  521. }
  522. mdev->is_channel_healthy[channel] = true;
  523. mdev->clear_work[channel].channel = channel;
  524. mdev->clear_work[channel].mdev = mdev;
  525. INIT_WORK(&mdev->clear_work[channel].ws, wq_clear_halt);
  526. if (!conf->num_buffers || !conf->buffer_size) {
  527. dev_err(dev, "Misconfig: buffer size or #buffers zero.\n");
  528. return -EINVAL;
  529. }
  530. if (conf->data_type != MOST_CH_SYNC &&
  531. !(conf->data_type == MOST_CH_ISOC &&
  532. conf->packets_per_xact != 0xFF)) {
  533. mdev->padding_active[channel] = false;
  534. /*
  535. * Since the NIC's padding mode is not going to be
  536. * used, we can skip the frame size calculations and
  537. * move directly on to exit.
  538. */
  539. goto exit;
  540. }
  541. mdev->padding_active[channel] = true;
  542. frame_size = get_stream_frame_size(&mdev->dev, conf);
  543. if (frame_size == 0 || frame_size > USB_MTU) {
  544. dev_warn(dev, "Misconfig: frame size wrong\n");
  545. return -EINVAL;
  546. }
  547. num_frames = conf->buffer_size / frame_size;
  548. if (conf->buffer_size % frame_size) {
  549. u16 old_size = conf->buffer_size;
  550. conf->buffer_size = num_frames * frame_size;
  551. dev_warn(dev, "%s: fixed buffer size (%d -> %d)\n",
  552. mdev->suffix[channel], old_size, conf->buffer_size);
  553. }
  554. /* calculate extra length to comply w/ HW padding */
  555. conf->extra_len = num_frames * (USB_MTU - frame_size);
  556. exit:
  557. mdev->conf[channel] = *conf;
  558. if (conf->data_type == MOST_CH_ASYNC) {
  559. u16 ep = mdev->ep_address[channel];
  560. if (start_sync_ep(mdev->usb_device, ep) < 0)
  561. dev_warn(dev, "sync for ep%02x failed", ep);
  562. }
  563. return 0;
  564. }
  565. /**
  566. * hdm_request_netinfo - request network information
  567. * @iface: pointer to interface
  568. * @channel: channel ID
  569. *
  570. * This is used as trigger to set up the link status timer that
  571. * polls for the NI state of the INIC every 2 seconds.
  572. *
  573. */
  574. static void hdm_request_netinfo(struct most_interface *iface, int channel,
  575. void (*on_netinfo)(struct most_interface *,
  576. unsigned char,
  577. unsigned char *))
  578. {
  579. struct most_dev *mdev = to_mdev(iface);
  580. mdev->on_netinfo = on_netinfo;
  581. if (!on_netinfo)
  582. return;
  583. mdev->link_stat_timer.expires = jiffies + HZ;
  584. mod_timer(&mdev->link_stat_timer, mdev->link_stat_timer.expires);
  585. }
  586. /**
  587. * link_stat_timer_handler - schedule work obtaining mac address and link status
  588. * @data: pointer to USB device instance
  589. *
  590. * The handler runs in interrupt context. That's why we need to defer the
  591. * tasks to a work queue.
  592. */
  593. static void link_stat_timer_handler(struct timer_list *t)
  594. {
  595. struct most_dev *mdev = from_timer(mdev, t, link_stat_timer);
  596. schedule_work(&mdev->poll_work_obj);
  597. mdev->link_stat_timer.expires = jiffies + (2 * HZ);
  598. add_timer(&mdev->link_stat_timer);
  599. }
  600. /**
  601. * wq_netinfo - work queue function to deliver latest networking information
  602. * @wq_obj: object that holds data for our deferred work to do
  603. *
  604. * This retrieves the network interface status of the USB INIC
  605. */
  606. static void wq_netinfo(struct work_struct *wq_obj)
  607. {
  608. struct most_dev *mdev = to_mdev_from_work(wq_obj);
  609. struct usb_device *usb_device = mdev->usb_device;
  610. struct device *dev = &usb_device->dev;
  611. u16 hi, mi, lo, link;
  612. u8 hw_addr[6];
  613. if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_HI, &hi)) {
  614. dev_err(dev, "Vendor request 'hw_addr_hi' failed\n");
  615. return;
  616. }
  617. if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi)) {
  618. dev_err(dev, "Vendor request 'hw_addr_mid' failed\n");
  619. return;
  620. }
  621. if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo)) {
  622. dev_err(dev, "Vendor request 'hw_addr_low' failed\n");
  623. return;
  624. }
  625. if (drci_rd_reg(usb_device, DRCI_REG_NI_STATE, &link)) {
  626. dev_err(dev, "Vendor request 'link status' failed\n");
  627. return;
  628. }
  629. hw_addr[0] = hi >> 8;
  630. hw_addr[1] = hi;
  631. hw_addr[2] = mi >> 8;
  632. hw_addr[3] = mi;
  633. hw_addr[4] = lo >> 8;
  634. hw_addr[5] = lo;
  635. if (mdev->on_netinfo)
  636. mdev->on_netinfo(&mdev->iface, link, hw_addr);
  637. }
  638. /**
  639. * wq_clear_halt - work queue function
  640. * @wq_obj: work_struct object to execute
  641. *
  642. * This sends a clear_halt to the given USB pipe.
  643. */
  644. static void wq_clear_halt(struct work_struct *wq_obj)
  645. {
  646. struct clear_hold_work *clear_work = to_clear_hold_work(wq_obj);
  647. struct most_dev *mdev = clear_work->mdev;
  648. unsigned int channel = clear_work->channel;
  649. int pipe = clear_work->pipe;
  650. int snd_pipe;
  651. int peer;
  652. mutex_lock(&mdev->io_mutex);
  653. most_stop_enqueue(&mdev->iface, channel);
  654. usb_kill_anchored_urbs(&mdev->busy_urbs[channel]);
  655. if (usb_clear_halt(mdev->usb_device, pipe))
  656. dev_warn(&mdev->usb_device->dev, "Failed to reset endpoint.\n");
  657. /* If the functional Stall condition has been set on an
  658. * asynchronous rx channel, we need to clear the tx channel
  659. * too, since the hardware runs its clean-up sequence on both
  660. * channels, as they are physically one on the network.
  661. *
  662. * The USB interface that exposes the asynchronous channels
  663. * contains always two endpoints, and two only.
  664. */
  665. if (mdev->conf[channel].data_type == MOST_CH_ASYNC &&
  666. mdev->conf[channel].direction == MOST_CH_RX) {
  667. if (channel == 0)
  668. peer = 1;
  669. else
  670. peer = 0;
  671. snd_pipe = usb_sndbulkpipe(mdev->usb_device,
  672. mdev->ep_address[peer]);
  673. usb_clear_halt(mdev->usb_device, snd_pipe);
  674. }
  675. mdev->is_channel_healthy[channel] = true;
  676. most_resume_enqueue(&mdev->iface, channel);
  677. mutex_unlock(&mdev->io_mutex);
  678. }
  679. /**
  680. * hdm_usb_fops - file operation table for USB driver
  681. */
  682. static const struct file_operations hdm_usb_fops = {
  683. .owner = THIS_MODULE,
  684. };
  685. /**
  686. * usb_device_id - ID table for HCD device probing
  687. */
  688. static const struct usb_device_id usbid[] = {
  689. { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_BRDG), },
  690. { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_OS81118), },
  691. { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_OS81119), },
  692. { USB_DEVICE(USB_VENDOR_ID_SMSC, USB_DEV_ID_OS81210), },
  693. { } /* Terminating entry */
  694. };
  695. struct regs {
  696. const char *name;
  697. u16 reg;
  698. };
  699. static const struct regs ro_regs[] = {
  700. { "ni_state", DRCI_REG_NI_STATE },
  701. { "packet_bandwidth", DRCI_REG_PACKET_BW },
  702. { "node_address", DRCI_REG_NODE_ADDR },
  703. { "node_position", DRCI_REG_NODE_POS },
  704. };
  705. static const struct regs rw_regs[] = {
  706. { "mep_filter", DRCI_REG_MEP_FILTER },
  707. { "mep_hash0", DRCI_REG_HASH_TBL0 },
  708. { "mep_hash1", DRCI_REG_HASH_TBL1 },
  709. { "mep_hash2", DRCI_REG_HASH_TBL2 },
  710. { "mep_hash3", DRCI_REG_HASH_TBL3 },
  711. { "mep_eui48_hi", DRCI_REG_HW_ADDR_HI },
  712. { "mep_eui48_mi", DRCI_REG_HW_ADDR_MI },
  713. { "mep_eui48_lo", DRCI_REG_HW_ADDR_LO },
  714. };
  715. static int get_stat_reg_addr(const struct regs *regs, int size,
  716. const char *name, u16 *reg_addr)
  717. {
  718. int i;
  719. for (i = 0; i < size; i++) {
  720. if (sysfs_streq(name, regs[i].name)) {
  721. *reg_addr = regs[i].reg;
  722. return 0;
  723. }
  724. }
  725. return -EINVAL;
  726. }
  727. #define get_static_reg_addr(regs, name, reg_addr) \
  728. get_stat_reg_addr(regs, ARRAY_SIZE(regs), name, reg_addr)
  729. static ssize_t value_show(struct device *dev, struct device_attribute *attr,
  730. char *buf)
  731. {
  732. const char *name = attr->attr.name;
  733. struct most_dci_obj *dci_obj = to_dci_obj(dev);
  734. u16 val;
  735. u16 reg_addr;
  736. int err;
  737. if (sysfs_streq(name, "arb_address"))
  738. return snprintf(buf, PAGE_SIZE, "%04x\n", dci_obj->reg_addr);
  739. if (sysfs_streq(name, "arb_value"))
  740. reg_addr = dci_obj->reg_addr;
  741. else if (get_static_reg_addr(ro_regs, name, &reg_addr) &&
  742. get_static_reg_addr(rw_regs, name, &reg_addr))
  743. return -EINVAL;
  744. err = drci_rd_reg(dci_obj->usb_device, reg_addr, &val);
  745. if (err < 0)
  746. return err;
  747. return snprintf(buf, PAGE_SIZE, "%04x\n", val);
  748. }
  749. static ssize_t value_store(struct device *dev, struct device_attribute *attr,
  750. const char *buf, size_t count)
  751. {
  752. u16 val;
  753. u16 reg_addr;
  754. const char *name = attr->attr.name;
  755. struct most_dci_obj *dci_obj = to_dci_obj(dev);
  756. struct usb_device *usb_dev = dci_obj->usb_device;
  757. int err;
  758. err = kstrtou16(buf, 16, &val);
  759. if (err)
  760. return err;
  761. if (sysfs_streq(name, "arb_address")) {
  762. dci_obj->reg_addr = val;
  763. return count;
  764. }
  765. if (sysfs_streq(name, "arb_value"))
  766. err = drci_wr_reg(usb_dev, dci_obj->reg_addr, val);
  767. else if (sysfs_streq(name, "sync_ep"))
  768. err = start_sync_ep(usb_dev, val);
  769. else if (!get_static_reg_addr(rw_regs, name, &reg_addr))
  770. err = drci_wr_reg(usb_dev, reg_addr, val);
  771. else
  772. return -EINVAL;
  773. if (err < 0)
  774. return err;
  775. return count;
  776. }
  777. static DEVICE_ATTR(ni_state, 0444, value_show, NULL);
  778. static DEVICE_ATTR(packet_bandwidth, 0444, value_show, NULL);
  779. static DEVICE_ATTR(node_address, 0444, value_show, NULL);
  780. static DEVICE_ATTR(node_position, 0444, value_show, NULL);
  781. static DEVICE_ATTR(sync_ep, 0200, NULL, value_store);
  782. static DEVICE_ATTR(mep_filter, 0644, value_show, value_store);
  783. static DEVICE_ATTR(mep_hash0, 0644, value_show, value_store);
  784. static DEVICE_ATTR(mep_hash1, 0644, value_show, value_store);
  785. static DEVICE_ATTR(mep_hash2, 0644, value_show, value_store);
  786. static DEVICE_ATTR(mep_hash3, 0644, value_show, value_store);
  787. static DEVICE_ATTR(mep_eui48_hi, 0644, value_show, value_store);
  788. static DEVICE_ATTR(mep_eui48_mi, 0644, value_show, value_store);
  789. static DEVICE_ATTR(mep_eui48_lo, 0644, value_show, value_store);
  790. static DEVICE_ATTR(arb_address, 0644, value_show, value_store);
  791. static DEVICE_ATTR(arb_value, 0644, value_show, value_store);
  792. static struct attribute *dci_attrs[] = {
  793. &dev_attr_ni_state.attr,
  794. &dev_attr_packet_bandwidth.attr,
  795. &dev_attr_node_address.attr,
  796. &dev_attr_node_position.attr,
  797. &dev_attr_sync_ep.attr,
  798. &dev_attr_mep_filter.attr,
  799. &dev_attr_mep_hash0.attr,
  800. &dev_attr_mep_hash1.attr,
  801. &dev_attr_mep_hash2.attr,
  802. &dev_attr_mep_hash3.attr,
  803. &dev_attr_mep_eui48_hi.attr,
  804. &dev_attr_mep_eui48_mi.attr,
  805. &dev_attr_mep_eui48_lo.attr,
  806. &dev_attr_arb_address.attr,
  807. &dev_attr_arb_value.attr,
  808. NULL,
  809. };
  810. ATTRIBUTE_GROUPS(dci);
  811. static void release_dci(struct device *dev)
  812. {
  813. struct most_dci_obj *dci = to_dci_obj(dev);
  814. put_device(dev->parent);
  815. kfree(dci);
  816. }
  817. static void release_mdev(struct device *dev)
  818. {
  819. struct most_dev *mdev = to_mdev_from_dev(dev);
  820. kfree(mdev);
  821. }
  822. /**
  823. * hdm_probe - probe function of USB device driver
  824. * @interface: Interface of the attached USB device
  825. * @id: Pointer to the USB ID table.
  826. *
  827. * This allocates and initializes the device instance, adds the new
  828. * entry to the internal list, scans the USB descriptors and registers
  829. * the interface with the core.
  830. * Additionally, the DCI objects are created and the hardware is sync'd.
  831. *
  832. * Return 0 on success. In case of an error a negative number is returned.
  833. */
  834. static int
  835. hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
  836. {
  837. struct usb_host_interface *usb_iface_desc = interface->cur_altsetting;
  838. struct usb_device *usb_dev = interface_to_usbdev(interface);
  839. struct device *dev = &usb_dev->dev;
  840. struct most_dev *mdev;
  841. unsigned int i;
  842. unsigned int num_endpoints;
  843. struct most_channel_capability *tmp_cap;
  844. struct usb_endpoint_descriptor *ep_desc;
  845. int ret = -ENOMEM;
  846. mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
  847. if (!mdev)
  848. return -ENOMEM;
  849. usb_set_intfdata(interface, mdev);
  850. num_endpoints = usb_iface_desc->desc.bNumEndpoints;
  851. if (num_endpoints > MAX_NUM_ENDPOINTS) {
  852. kfree(mdev);
  853. return -EINVAL;
  854. }
  855. mutex_init(&mdev->io_mutex);
  856. INIT_WORK(&mdev->poll_work_obj, wq_netinfo);
  857. timer_setup(&mdev->link_stat_timer, link_stat_timer_handler, 0);
  858. mdev->usb_device = usb_dev;
  859. mdev->link_stat_timer.expires = jiffies + (2 * HZ);
  860. mdev->iface.mod = hdm_usb_fops.owner;
  861. mdev->iface.dev = &mdev->dev;
  862. mdev->iface.driver_dev = &interface->dev;
  863. mdev->iface.interface = ITYPE_USB;
  864. mdev->iface.configure = hdm_configure_channel;
  865. mdev->iface.request_netinfo = hdm_request_netinfo;
  866. mdev->iface.enqueue = hdm_enqueue;
  867. mdev->iface.poison_channel = hdm_poison_channel;
  868. mdev->iface.dma_alloc = hdm_dma_alloc;
  869. mdev->iface.dma_free = hdm_dma_free;
  870. mdev->iface.description = mdev->description;
  871. mdev->iface.num_channels = num_endpoints;
  872. snprintf(mdev->description, sizeof(mdev->description),
  873. "%d-%s:%d.%d",
  874. usb_dev->bus->busnum,
  875. usb_dev->devpath,
  876. usb_dev->config->desc.bConfigurationValue,
  877. usb_iface_desc->desc.bInterfaceNumber);
  878. mdev->dev.init_name = mdev->description;
  879. mdev->dev.parent = &interface->dev;
  880. mdev->dev.release = release_mdev;
  881. mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL);
  882. if (!mdev->conf)
  883. goto err_free_mdev;
  884. mdev->cap = kcalloc(num_endpoints, sizeof(*mdev->cap), GFP_KERNEL);
  885. if (!mdev->cap)
  886. goto err_free_conf;
  887. mdev->iface.channel_vector = mdev->cap;
  888. mdev->ep_address =
  889. kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL);
  890. if (!mdev->ep_address)
  891. goto err_free_cap;
  892. mdev->busy_urbs =
  893. kcalloc(num_endpoints, sizeof(*mdev->busy_urbs), GFP_KERNEL);
  894. if (!mdev->busy_urbs)
  895. goto err_free_ep_address;
  896. tmp_cap = mdev->cap;
  897. for (i = 0; i < num_endpoints; i++) {
  898. ep_desc = &usb_iface_desc->endpoint[i].desc;
  899. mdev->ep_address[i] = ep_desc->bEndpointAddress;
  900. mdev->padding_active[i] = false;
  901. mdev->is_channel_healthy[i] = true;
  902. snprintf(&mdev->suffix[i][0], MAX_SUFFIX_LEN, "ep%02x",
  903. mdev->ep_address[i]);
  904. tmp_cap->name_suffix = &mdev->suffix[i][0];
  905. tmp_cap->buffer_size_packet = MAX_BUF_SIZE;
  906. tmp_cap->buffer_size_streaming = MAX_BUF_SIZE;
  907. tmp_cap->num_buffers_packet = BUF_CHAIN_SIZE;
  908. tmp_cap->num_buffers_streaming = BUF_CHAIN_SIZE;
  909. tmp_cap->data_type = MOST_CH_CONTROL | MOST_CH_ASYNC |
  910. MOST_CH_ISOC | MOST_CH_SYNC;
  911. if (usb_endpoint_dir_in(ep_desc))
  912. tmp_cap->direction = MOST_CH_RX;
  913. else
  914. tmp_cap->direction = MOST_CH_TX;
  915. tmp_cap++;
  916. init_usb_anchor(&mdev->busy_urbs[i]);
  917. spin_lock_init(&mdev->channel_lock[i]);
  918. }
  919. dev_dbg(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n",
  920. le16_to_cpu(usb_dev->descriptor.idVendor),
  921. le16_to_cpu(usb_dev->descriptor.idProduct),
  922. usb_dev->bus->busnum,
  923. usb_dev->devnum);
  924. dev_dbg(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
  925. usb_dev->bus->busnum,
  926. usb_dev->devpath,
  927. usb_dev->config->desc.bConfigurationValue,
  928. usb_iface_desc->desc.bInterfaceNumber);
  929. ret = most_register_interface(&mdev->iface);
  930. if (ret)
  931. goto err_free_busy_urbs;
  932. mutex_lock(&mdev->io_mutex);
  933. if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81118 ||
  934. le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81119 ||
  935. le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81210) {
  936. mdev->dci = kzalloc(sizeof(*mdev->dci), GFP_KERNEL);
  937. if (!mdev->dci) {
  938. mutex_unlock(&mdev->io_mutex);
  939. most_deregister_interface(&mdev->iface);
  940. ret = -ENOMEM;
  941. goto err_free_busy_urbs;
  942. }
  943. mdev->dci->dev.init_name = "dci";
  944. mdev->dci->dev.parent = get_device(mdev->iface.dev);
  945. mdev->dci->dev.groups = dci_groups;
  946. mdev->dci->dev.release = release_dci;
  947. if (device_register(&mdev->dci->dev)) {
  948. mutex_unlock(&mdev->io_mutex);
  949. most_deregister_interface(&mdev->iface);
  950. ret = -ENOMEM;
  951. goto err_free_dci;
  952. }
  953. mdev->dci->usb_device = mdev->usb_device;
  954. }
  955. mutex_unlock(&mdev->io_mutex);
  956. return 0;
  957. err_free_dci:
  958. put_device(&mdev->dci->dev);
  959. err_free_busy_urbs:
  960. kfree(mdev->busy_urbs);
  961. err_free_ep_address:
  962. kfree(mdev->ep_address);
  963. err_free_cap:
  964. kfree(mdev->cap);
  965. err_free_conf:
  966. kfree(mdev->conf);
  967. err_free_mdev:
  968. put_device(&mdev->dev);
  969. return ret;
  970. }
  971. /**
  972. * hdm_disconnect - disconnect function of USB device driver
  973. * @interface: Interface of the attached USB device
  974. *
  975. * This deregisters the interface with the core, removes the kernel timer
  976. * and frees resources.
  977. *
  978. * Context: hub kernel thread
  979. */
  980. static void hdm_disconnect(struct usb_interface *interface)
  981. {
  982. struct most_dev *mdev = usb_get_intfdata(interface);
  983. mutex_lock(&mdev->io_mutex);
  984. usb_set_intfdata(interface, NULL);
  985. mdev->usb_device = NULL;
  986. mutex_unlock(&mdev->io_mutex);
  987. del_timer_sync(&mdev->link_stat_timer);
  988. cancel_work_sync(&mdev->poll_work_obj);
  989. if (mdev->dci)
  990. device_unregister(&mdev->dci->dev);
  991. most_deregister_interface(&mdev->iface);
  992. kfree(mdev->busy_urbs);
  993. kfree(mdev->cap);
  994. kfree(mdev->conf);
  995. kfree(mdev->ep_address);
  996. put_device(&mdev->dci->dev);
  997. put_device(&mdev->dev);
  998. }
  999. static int hdm_suspend(struct usb_interface *interface, pm_message_t message)
  1000. {
  1001. struct most_dev *mdev = usb_get_intfdata(interface);
  1002. int i;
  1003. mutex_lock(&mdev->io_mutex);
  1004. for (i = 0; i < mdev->iface.num_channels; i++) {
  1005. most_stop_enqueue(&mdev->iface, i);
  1006. usb_kill_anchored_urbs(&mdev->busy_urbs[i]);
  1007. }
  1008. mutex_unlock(&mdev->io_mutex);
  1009. return 0;
  1010. }
  1011. static int hdm_resume(struct usb_interface *interface)
  1012. {
  1013. struct most_dev *mdev = usb_get_intfdata(interface);
  1014. int i;
  1015. mutex_lock(&mdev->io_mutex);
  1016. for (i = 0; i < mdev->iface.num_channels; i++)
  1017. most_resume_enqueue(&mdev->iface, i);
  1018. mutex_unlock(&mdev->io_mutex);
  1019. return 0;
  1020. }
  1021. static struct usb_driver hdm_usb = {
  1022. .name = "hdm_usb",
  1023. .id_table = usbid,
  1024. .probe = hdm_probe,
  1025. .disconnect = hdm_disconnect,
  1026. .resume = hdm_resume,
  1027. .suspend = hdm_suspend,
  1028. };
  1029. module_usb_driver(hdm_usb);
  1030. MODULE_LICENSE("GPL");
  1031. MODULE_AUTHOR("Christian Gromm <christian.gromm@microchip.com>");
  1032. MODULE_DESCRIPTION("HDM_4_USB");