From 2609b0dff3d67c555a966beacf1d7da1386bbaf1 Mon Sep 17 00:00:00 2001 From: Jason Harris Date: Tue, 23 Apr 2019 11:11:11 -0600 Subject: [PATCH] drivers/usbhost/usbhost_storage.c: Correct typo "const const" to "const". arch/arm/src/stm32/stm32_i2s.c: In debug assertions, it on a sample rate of 0, but based on other code comments this value implies disabling the i2s master clock. arch/arm/src/stm32/stm32_usbhost.h and arch/arm/src/stm32/Kconfig: Allow vbus monitoring for the OTG_HS host driver. --- arch/arm/src/stm32/Kconfig | 8 ++++++++ arch/arm/src/stm32/stm32_i2s.c | 6 +++--- arch/arm/src/stm32/stm32_usbhost.h | 2 +- drivers/usbhost/usbhost_storage.c | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index b1076db796..096c932f5c 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -9403,6 +9403,14 @@ config STM32_OTGHS_SOFINTR ---help--- Enable SOF interrupts. Why would you ever want to do that? +config STM32_OTGHS_VBUS_CONTROL + bool "Enable VBus Control" + default y + ---help--- + Enable VBus control. Used when the board has VBus sensing and + a power switch for the OTG HS USB port. Disable this config + if the board lacks this USB VBus control circuitry. + endmenu menu "USB Host Debug Configuration" diff --git a/arch/arm/src/stm32/stm32_i2s.c b/arch/arm/src/stm32/stm32_i2s.c index 1b26a5545a..a99b8927a3 100644 --- a/arch/arm/src/stm32/stm32_i2s.c +++ b/arch/arm/src/stm32/stm32_i2s.c @@ -1785,7 +1785,7 @@ static uint32_t stm32_i2s_rxsamplerate(struct i2s_dev_s *dev, uint32_t rate) { #if defined(I2S_HAVE_RX) && defined(I2S_HAVE_MCK) struct stm32_i2s_s *priv = (struct stm32_i2s_s *)dev; - DEBUGASSERT(priv && priv->samplerate > 0 && rate > 0); + DEBUGASSERT(priv && priv->samplerate >= 0 && rate > 0); /* Check if the receiver is driven by the MCK */ @@ -1985,7 +1985,7 @@ static uint32_t stm32_i2s_txsamplerate(struct i2s_dev_s *dev, uint32_t rate) #if defined(I2S_HAVE_TX) && defined(I2S_HAVE_MCK) struct stm32_i2s_s *priv = (struct stm32_i2s_s *)dev; - DEBUGASSERT(priv && priv->samplerate > 0 && rate > 0); + DEBUGASSERT(priv && priv->samplerate >= 0 && rate > 0); /* Check if the receiver is driven by the MCK/2 */ @@ -2182,7 +2182,7 @@ static uint32_t i2s_mckdivider(struct stm32_i2s_s *priv) uint16_t pllr = 5, plln = 256, div = 12, odd = 1; - DEBUGASSERT(priv && priv->samplerate > 0 && priv->datalen > 0); + DEBUGASSERT(priv && priv->samplerate >= 0 && priv->datalen > 0); /* A zero sample rate means to disable the MCK/2 clock */ diff --git a/arch/arm/src/stm32/stm32_usbhost.h b/arch/arm/src/stm32/stm32_usbhost.h index e4aab465f8..2c16ad1f09 100644 --- a/arch/arm/src/stm32/stm32_usbhost.h +++ b/arch/arm/src/stm32/stm32_usbhost.h @@ -280,7 +280,7 @@ extern "C" * ***********************************************************************************/ -#ifdef CONFIG_STM32_OTGFS_VBUS_CONTROL +#if defined(CONFIG_STM32_OTGFS_VBUS_CONTROL) || defined(CONFIG_STM32_OTGHS_VBUS_CONTROL) void stm32_usbhost_vbusdrive(int iface, bool enable); #endif diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c index 58dd6bd439..d2691f9f63 100644 --- a/drivers/usbhost/usbhost_storage.c +++ b/drivers/usbhost/usbhost_storage.c @@ -261,7 +261,7 @@ static int usbhost_ioctl(FAR struct inode *inode, int cmd, * device. */ -static const const struct usbhost_id_s g_id = +static const struct usbhost_id_s g_id = { USB_CLASS_MASS_STORAGE, /* base */ USBMSC_SUBCLASS_SCSI, /* subclass */