Commit Graph

97 Commits

Author SHA1 Message Date
yangsong8 09030b5d67 cdcacm: config to enable or disable interrupt endpoint
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 20:32:47 +08:00
yangsong8 6161b1ea84 cdcacm: use DMA to rx and tx
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
dongjiuzhu1 1a69d3c6ee cdcacm: Add cdcacm bulkout request buffer config
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-16 10:33:01 +08:00
dongjiuzhu1 881cd3f7db driver/usbdev: support userspace to access ep0
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-11 22:00:26 +08:00
yangsong8 fa1c094e65 usbdev: add usb3.0 ep companion struct and descriptor
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8 07aa8a5c57 usbdev: modify usb device support USB3.0 MaxPacketSize
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8 0788e68285 usbdev: usb device descriptor support USB3.0
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
zhanghongyu 5b24917bb9 usb_cdcmbim: add mbim device driver
./build.sh sim:usbdev -j12
sudo gdb nuttx/nuttx -ex "source nuttx/tools/gdb/__init__.py"

below command to create mbim NIC on host
nsh> conn 3

NuttX's MBIM device implementation adds an additional MBIM network
card to the NuttX system, which can debug the data communication with
the host, but this network card is unnecessary and needs to be removed
when the business actually uses this driver, And the cdcncm_receive
method needs to be re-implemented.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu 7aa3e2ebd6 cdcncm: switch net driver to netdev_lowerhalf
optimize the interaction flow associated with network drivers to reduce
the amount of code and improve compatibility

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu 4e79741e7d usbdev: add ncm driver
The compilation and verification commands are shown below:
./tools/configure.sh sim:usbdev
make -j
sudo ./nuttx
nsh> conn 2
nsh> dhcpd_start eth1

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
dongjiuzhu1 c093514cea drivers/usbdev: Register the device after successful set configuration
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1 2b571e1d11 drivers/usbdev: support config usb req buffer alignment bytes
we need to alloc req buffer in cacheline size units, othersize the
data may by incorrect.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
Petteri Aimonen 99a8c00807 usbdev: Add callback for CONFIG_USBDEV_SOFINTERRUPT
Previously CONFIG_USBDEV_SOFINTERRUPT existed in many platform
drivers but did nothing. This commit adds a callback function
usbdev_sof_irq() that can be used to take action on this interrupt.
2023-12-08 21:27:36 -03:00
dongjiuzhu1 68fc3adeff drivers/usbdev: config USBDEV_TRACE_INITIALIDSET when disbale USBDEV_TRACE
usbtrace is valid when enable USBDEV_TRACE or DEBUG_FEATURE && DEBUG_USB,

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 16:32:18 +08:00
dongjiuzhu1 8ababfc310 usbdev/mtp: support mtp class driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-16 14:40:08 +08:00
simbit18 b3973496cd Fix Kconfig style
Remove spaces from Kconfig
Add comments
2023-09-13 21:39:49 +08:00
zhangyuan21 fb7c36978f usbdev: support usb adb fastboot
Enable CONFIG_USBFASTBOOT to support fastboot driver.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-12 16:27:49 +08:00
zhangyuan21 59f7fe11a3 usbdev: adb use fs device for ep process
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-09 15:52:08 +08:00
zhangyuan21 1f6d9bbd17 usbdev: add usbdev fs device for usb char device
Add usb_fs driver so that userspace can directly transfer USB packets
through the EP node. ADB, Fastboot, MTP will use usb_fs, these class
driver only need to provide the descriptors and register the usb_fs device.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-09 15:52:08 +08:00
zhangyuan21 06d9356d12 usbdev: Use BOARD_USBDEV_SERIALSTR config directly
A usbdev has only one serial string, so use a unique macro to control it.

For boards that enable board serial string using COMPOSITE_BOARD_SERIALSTR,
PL2303_BOARD_SERIALSTR, CDCACM_BOARD_SERIALSTR, USBADB_BOARD_SERIALSTR,
USBMSC_BOARD_SERIALSTR, and RNDIS_BOARD_SERIALSTR, they need to be replaced
with BOARD_USBDEV_SERIALSTR.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-01 19:29:12 +08:00
Xiang Xiao 90f8315432 arch: Remove up_netinitialize
since this api change to xxx_netinitialize

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-20 14:33:17 +03:00
zhangyuan21 5af40a6fa4 composite: add COMPOSITE_DEVICES config for composite device
Add COMPOSITE_DEVICES configuration so that external composite
devices can also know the maximum number of supported classes.
The default COMPOSITE_DEVICES number is 8.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-08 19:25:57 +08:00
simbit18 f0a74eb492 Fix Kconfig style
Remove spaces from Kconfig files
2023-06-22 11:46:09 +09:00
raiden00pl 58e817db76 rndis: do not configure endpoints from Kconfig when composite enabled
This should be done from a board specific logic, as for other composite devices
2023-03-31 08:17:01 +09:00
zhangyuan21 8f4cb0fec3 rndis: add endpoint configure
ep3 is not avaliable in dummy hcd, so need to
make the endpoint number configurable.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-02-12 16:38:11 +08:00
Xiang Xiao 7322eafba7 drivers/usb: Fix the typo error in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-25 01:01:26 +02:00
Eero Nurkkala 5a45130d5c usbdev/usbmsc: introduce USBMSC_WRMULTIPLE for faster writes
This patch introduces a configuration option USBMSC_WRMULTIPLE,
which is used to store multiple blocks into a larger chunk that
then gets written via the mmcsd_writemultiple() (in case mmcsd
is used).

The bottleneck with the current implementation is the poor
performance due to short block writes.  USBMSC_DRVR_WRITE()
always writes only one sector (with eMMC that's usually 512 bytes).
eMMC devices usually erase much larger regions with near constant
time (see Jedec JESD84-B51, Extended CSD register byte [225],
SUPER_PAGE_SIZE): 'This register defines one or multiple of
programmable boundary unit that is programmed at the same time.'

If USBMSC_WRMULTIPLE is defined, then USBMSC_NWRREQS is used to
allocate the write buffer size.  We don't want this to be the
default behavior yet as this may reveal unseen bugs in usb drivers
due to the faster overall performance.

Sample configurations with measured performance:

  - Without USBMSC_WRMULTIPLE: 470 Kb/s
  - With USBMSC_WRMULTIPLE, CONFIG_USBMSC_NWRREQS=4: 1.1 Mb/s
    (dd with bs=2k)
  - With USBMSC_WRMULTIPLE, CONFIG_USBMSC_NWRREQS=16: 5.2 Mb/s
    (dd with bs=8k)

No doubt, this feature alone may make the mass storage work 10
times faster than before with eMMC cards.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-07-12 18:36:34 +08:00
Eero Nurkkala 9f9fb17d64 usbdev/Kconfig: allow CONFIG_USBMSC_IFNOBASE configuration
usbmsc.h uses the CONFIG_USBMSC_IFNOBASE configuration option,
but it cannot be set anywhere. Provide means to configure this
option which is useful when it's other than the default zero.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-06-09 20:44:40 +08:00
SPRESENSE 021a58d71a usbdev: Add board unique serial string support
iSerialNumber field in the device descriptor can be used to determining the
board when multiple boards connected to the same host. So add feature to change
serial string by board unique ID dynamically.
To use this feature, user must be implement the board_usbdev_serialstr() logic.

refs #13909
2022-01-19 09:25:48 +01:00
Petro Karashchenko 67d8a82393 Kconfig: fix non-string default values uniformity
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-20 00:10:57 +01:00
Yuichi Nakamura 8d722709cd usbmsc: Add USBMSC_NOT_STALL_BULKEP for RP2040 workaround
The new configuration CONFIG_USBMSC_NOT_STALL_BULKEP avoids to go into
stall state when :
- Receiving SCSI_CMD_INQUIRY with flags or pagecode != 0
- Receiving SCSI_CMD_MODESENSE6 and return the result data shorter than
  the requested data size.
Instead of stall, it just ignores the error condition.

Originally the usb driver goes into the stall under the conditions
mentioned above to inform to the USB host that the requested SCSI feature
is not supported, or the result data is shorter than the requested data
size.
But, at this moment, RP2040 USB device driver cannot handle entering and
leaving stall state of the bulk endpoints well.  Once stalls, the host -
device communication stops and cannot be resumed.

I have investigated to solve the issue and found that the existing
RP2040 USB device driver implementation, TinyUSB
(https://github.com/hathach/tinyusb) mass-storage class driver doesn't
enter the stall state like the treatment of this patch.

So, I introduce this new configuration as the RP2040 workaround.
In the future, when the RP2040 USB device driver is fixed and can handle
the bulk endpoint stall correctly, this patch should be reverted.
2021-06-14 09:05:19 -03:00
Simon Piriou b405722276 usbdev: add Android Debug Bridge driver 2020-10-26 08:28:48 -03:00
Masayuki Ishikawa 3b76666a1e drivers: usbdev: Fix default value for RNDIS_NWRREQS
Summary:
- Change default value for RNDIS_NWRREQS based on NET_TCP_WRITE_BUFFERS

Impact:
- This commit affects RNDIS use cases

Testing:
- spresense:rndis with CONFIG_NET_TCP_WRITE_BUFFERS=y

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-08 05:36:07 -05:00
Xiang Xiao 6ad91aeb05 Kconfig: change the stack size default to DEFAULT_TASK_STACKSIZE
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-18 07:17:38 -06:00
Gregory Nutt 431286532c drivers/: Remove support for CONFIG_FS_READABLE 2020-03-22 08:24:07 -05:00
Gregory Nutt 66ab039b89 drivers/: Remove support for CONFIG_FS_WRITABLE 2020-03-22 08:24:07 -05:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Gregory Nutt 21aef0dd68 drivers/*/Kconfig: Consolidate driver Kconfig Files.
This commit does two things:

1. First, it reorganizes the driver Kconfig files so that each is self contained.  Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig.  Now, all of the driver configuration is consolitated in the latter.

2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files.  This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.

The nature of the introduced error was basically this:

- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.

This error was easy to make because the driver Kconfig files were not well modularized.  Making them fully self-contained should eliminate this kind of error in the future.
2020-02-15 15:19:11 +01:00
Xiang Xiao 3cb259daa6 drivers/Kconfig: Move if/endif to subfolder Kconfig
Move if/endif to subfolder Kconfig and make ARCH_HAVE_XXX option always selectable by moving out of if/endif
2020-02-08 08:04:05 -06:00
Anthony Merlino 1e3a60155e Merged in antmerlino/nuttx/rndis (pull request #980)
drivers/usbdev/rndis: Expose option to change number of write requests that can be in flight.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-10 17:52:19 +00:00
Ramtin Amin 7d2bd2371f arch/arm/src/stm32f7: USB High speed for STM32F7 series 2019-04-07 19:05:06 -06:00
raiden00pl 2caf135d05 Merged in raiden00/nuttx_h7 (pull request #837)
Initial OTG support for STM32H7 and some minor improvements

arch/arm/src/stm32h7/stm32h7x3xx_rcc.c: add support for HSI48 clock

configs/nucleo-f207zg: add support for USB and initialize CDCACM if configured

configs/nucleo-h743zi: add support for USB and initialize CDCACM if configured

drivers/usbdev/Kconfig: fix type for USBDEV_TRACE_INITIALIDSET

configs/teensy-3.x/usbnsh/defconfig: update config according to change in USBDEV_TRACE_INITIALIDSET

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-03-10 13:24:58 +00:00
Gregory Nutt 2b6b3724fb drivers/usbdev/Kconfig: Fix misplaced endif. 2018-11-09 10:26:33 -06:00
Gregory Nutt 2fad9b86d1 Merged in paimonen/nuttx/pullreq_DFU_interface (pull request #754) 2018-11-09 07:07:29 -06:00
Petteri Aimonen 99adc36352 Merged in paimonen/nuttx/pullreq_RNDIS_composite_support (pull request #753)
RNDIS composite support

* NuttX usb/composite.h: Forward-declare composite_devdesc_s.

    This avoids "error: conflicting types for 'composite_initialize'"
    on some versions of GCC. Because of the cross-inclusion between
    usbdev.h and composite.h, the full declaration is not always
    available.

* NuttX: USB Composite driver: Fix strid comparison

    The last string ID used by composite driver is 4, and
    the number of IDs used is 5 (0..4). The comparison
    strid <= COMPOSITE_NSTRIDS caused composite driver to
    reply with -EINVAL for id 5, even though it should be
    available for subdevices to use.

* NuttX: RNDIS USB driver: Add support for composite configuration.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-11-09 12:56:58 +00:00
Petteri Aimonen a37c0c4cba NuttX: USB Composite and DFU drivers: Add support for Microsoft OS descriptors.
These Microsoft-only descriptors help in loading the correct driver on Windows.
They are especially helpful to give libusb access to a custom device without
having to manually configure/install WinUSB driver.

With this change DFU interface works automatically on
Windows 10 with dfu-util 0.9 and libusb 1.0.22. On Windows 7
it still appears to need driver installation.
2018-11-09 14:12:29 +02:00
Petteri Aimonen 1f8bd33a5d NuttX: Add DFU Runtime driver for activating bootloader through USB command. 2018-11-09 14:11:31 +02:00
Gregory Nutt b49fe431b7 drivers/usbdev/Kconfig: Correct an error found in build testing. The type of CONFIG_RNDIS_SERIALSTR must be a string, not hex. 2018-10-30 16:40:32 -06:00
Sakari Kapanen dafa180d8d nuttx/drivers/usbdev/rndis.c: Account for CONFIG_NET_GUARDSIZE in allocation of packet buffer
nuttx/drivers/usbdev/rndis.c:  Make USB device parameters configurable
2018-10-24 09:06:09 -06:00