Skip to content

Commit

Permalink
drivers: usb: add support for USB OTG FS on STM32F7
Browse files Browse the repository at this point in the history
The STM32F7 uses the same USB OTG FS controller than the STM32F4 series.
It is therefore trivial to add support for it, by adding the DT fixup
and pinmux macros, and the DT entries in stm32f7.dtsi. Keep it disabled,
it should be enabled at the board level.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
  • Loading branch information
aurel32 authored and galak committed Jul 11, 2018
1 parent f6bf897 commit 9107e3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions arch/arm/soc/st_stm32/stm32f7/dts.fixup
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@
#define CONFIG_UART_STM32_USART_8_NAME ST_STM32_USART_40007800_LABEL
#define USART_8_IRQ ST_STM32_USART_40007C00_IRQ_0

#define CONFIG_USB_BASE_ADDRESS ST_STM32_OTGFS_50000000_BASE_ADDRESS
#define CONFIG_USB_IRQ ST_STM32_OTGFS_50000000_IRQ_OTGFS
#define CONFIG_USB_IRQ_PRI ST_STM32_OTGFS_50000000_IRQ_OTGFS_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS ST_STM32_OTGFS_50000000_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_RAM_SIZE ST_STM32_OTGFS_50000000_RAM_SIZE

/* End of SoC Level DTS fixup file */
4 changes: 4 additions & 0 deletions drivers/pinmux/stm32/pinmux_stm32f7.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@

#define STM32F7_PINMUX_FUNC_PA11_USART1_CTS \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F7_PINMUX_FUNC_PA11_OTG_FS_DM \
(STM32_PINMUX_ALT_FUNC_10 | STM32_PUSHPULL_NOPULL)

#define STM32F7_PINMUX_FUNC_PA12_USART1_RTS \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F7_PINMUX_FUNC_PA12_OTG_FS_DP \
(STM32_PINMUX_ALT_FUNC_10 | STM32_PUSHPULL_NOPULL)

#define STM32F7_PINMUX_FUNC_PA15_USART4_RTS \
(STM32_PINMUX_ALT_FUNC_8 | STM32_PUSHPULL_PULLUP)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/device/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ config USB_DC_STM32
select USE_STM32_HAL_PCD_EX
select HAS_DTS_USB
help
Enable USB support on the STM32 F0, F1, F3, F4, L0 and L4 family of
Enable USB support on the STM32 F0, F1, F3, F4, F7, L0 and L4 family of
processors.

config USB_DC_SAM0
Expand Down
11 changes: 11 additions & 0 deletions dts/arm/st/stm32f7.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@
status = "disabled";
label = "UART_8";
};

usbotg_fs: usb@50000000 {
compatible = "st,stm32-otgfs";
reg = <0x50000000 0x40000>;
interrupts = <67 0>;
interrupt-names = "otgfs";
num-bidir-endpoints = <6>;
ram-size = <1280>;
status = "disabled";
label = "OTGFS";
};
};
};

Expand Down

0 comments on commit 9107e3d

Please sign in to comment.