Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts: Add initial support of USB PHYs #10359

Merged
merged 4 commits into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions drivers/usb/device/usb_dc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ static int usb_dc_stm32_clock_enable(void)
#ifdef DT_USB_HS_BASE_ADDRESS


#ifdef USB_HS_PHYC
#ifdef DT_COMPAT_ST_STM32_USBPHYC
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_OTGHSULPI);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_OTGPHYC);
#else
/* Disable ULPI interface (for external high-speed PHY) clock */
LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_OTGHSULPI);
LL_AHB1_GRP1_DisableClockLowPower(LL_AHB1_GRP1_PERIPH_OTGHSULPI);
#endif /* USB_HS_PHYC */
#endif /* DT_COMPAT_ST_STM32_USBPHYC */

#endif /* DT_USB_HS_BASE_ADDRESS */

Expand All @@ -279,22 +279,22 @@ static u32_t usb_dc_stm32_get_maximum_speed(void)
* If max-speed is not passed via DT, set it to USB controller's
* maximum hardware capability.
*/
#if defined(USB_HS_PHYC) && defined(DT_USB_HS_BASE_ADDRESS)
#if defined(DT_COMPAT_ST_STM32_USBPHYC) && defined(DT_USB_HS_BASE_ADDRESS)
u32_t speed = USB_OTG_SPEED_HIGH;
#else
u32_t speed = USB_OTG_SPEED_FULL;
#endif /* USB_HS_PHYC && DT_USB_HS_BASE_ADDRESS */
#endif /* DT_COMPAT_ST_STM32_USBPHYC && DT_USB_HS_BASE_ADDRESS */

#ifdef DT_USB_MAXIMUM_SPEED

if (!strncmp(DT_USB_MAXIMUM_SPEED, "high-speed", 10)) {
speed = USB_OTG_SPEED_HIGH;
} else if (!strncmp(DT_USB_MAXIMUM_SPEED, "full-speed", 10)) {
#if defined(USB_HS_PHYC) && defined(DT_USB_HS_BASE_ADDRESS)
#if defined(DT_COMPAT_ST_STM32_USBPHYC) && defined(DT_USB_HS_BASE_ADDRESS)
speed = USB_OTG_SPEED_HIGH_IN_FULL;
#else
speed = USB_OTG_SPEED_FULL;
#endif /* USB_HS_PHYC && DT_USB_HS_BASE_ADDRESS */
#endif /* DT_COMPAT_ST_STM32_USBPHYC && DT_USB_HS_BASE_ADDRESS */
} else if (!strncmp(DT_USB_MAXIMUM_SPEED, "low-speed", 9)) {
speed = USB_OTG_SPEED_LOW;
} else {
Expand Down Expand Up @@ -328,11 +328,11 @@ static int usb_dc_stm32_init(void)
#endif
usb_dc_stm32_state.pcd.Init.dev_endpoints = DT_USB_NUM_BIDIR_ENDPOINTS;
usb_dc_stm32_state.pcd.Init.speed = usb_dc_stm32_get_maximum_speed();
#if defined(USB_HS_PHYC) && defined(DT_USB_HS_BASE_ADDRESS)
#if defined(DT_COMPAT_ST_STM32_USBPHYC) && defined(DT_USB_HS_BASE_ADDRESS)
usb_dc_stm32_state.pcd.Init.phy_itface = USB_OTG_HS_EMBEDDED_PHY;
#else
usb_dc_stm32_state.pcd.Init.phy_itface = PCD_PHY_EMBEDDED;
#endif /* USB_HS_PHYC */
#endif /* DT_COMPAT_ST_STM32_USBPHYC */
usb_dc_stm32_state.pcd.Init.ep0_mps = USB_OTG_MAX_EP0_SIZE;
usb_dc_stm32_state.pcd.Init.vbus_sensing_enable = DISABLE;

Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f0/stm32f070.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@
label = "SPI_2";
};

usb_fs_phy: usbphy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "USB_FS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <31 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <1024>;
phys = <&usb_fs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f0/stm32f072.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@
label = "SPI_2";
};

usb_fs_phy: usbphy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "USB_FS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <31 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <1024>;
phys = <&usb_fs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f1/stm32f103X8.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
label = "SPI_2";
};

usb_fs_phy: usbphy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "USB_FS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
Expand All @@ -39,6 +45,7 @@
num-bidir-endpoints = <8>;
ram-size = <512>;
status = "disabled";
phys = <&usb_fs_phy>;
label= "USB";
};
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f1/stm32f103Xb.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@
label = "SPI_2";
};

usb_fs_phy: usbphy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "USB_FS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <20 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <512>;
phys = <&usb_fs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f2/stm32f2.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@
label = "UART_5";
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usbotg_fs: usb@50000000 {
compatible = "st,stm32-otgfs";
reg = <0x50000000 0x40000>;
Expand All @@ -202,6 +208,7 @@
num-bidir-endpoints = <4>;
ram-size = <1280>;
maximum-speed = "full-speed";
phys = <&otgfs_phy>;
status = "disabled";
label = "OTGFS";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f3/stm32f3.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,20 @@
label = "SPI_1";
};

usb_fs_phy: usbphy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "USB_FS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <20 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <512>;
phys = <&usb_fs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f4/stm32f4.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@
label = "I2S_1";
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usbotg_fs: usb@50000000 {
compatible = "st,stm32-otgfs";
reg = <0x50000000 0x40000>;
Expand All @@ -209,6 +215,7 @@
num-bidir-endpoints = <4>;
ram-size = <1280>;
maximum-speed = "full-speed";
phys = <&otgfs_phy>;
status = "disabled";
label= "OTGFS";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f4/stm32f405.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@
};
};

otghs_fs_phy: otghs_fs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGHS_FS_PHY";
};

usbotg_hs: usb@40040000 {
compatible = "st,stm32-otghs", "st,stm32-otgfs";
reg = <0x40040000 0x40000>;
Expand All @@ -171,6 +177,7 @@
num-bidir-endpoints = <6>;
ram-size = <4096>;
maximum-speed = "full-speed";
phys = <&otghs_fs_phy>;
status = "disabled";
label= "OTGHS";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/f4/stm32f446.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
num-bidir-endpoints = <6>;
};

otghs_fs_phy: otghs_fs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGHS_FS_PHY";
};

usbotg_hs: usb@40040000 {
compatible = "st,stm32-otghs", "st,stm32-otgfs";
reg = <0x40040000 0x40000>;
Expand All @@ -20,6 +26,7 @@
num-bidir-endpoints = <9>;
ram-size = <4096>;
maximum-speed = "full-speed";
phys = <&otghs_fs_phy>;
status = "disabled";
label= "OTGHS";
};
Expand Down
14 changes: 14 additions & 0 deletions dts/arm/st/f7/stm32f7.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@
};
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usbotg_fs: usb@50000000 {
compatible = "st,stm32-otgfs";
reg = <0x50000000 0x40000>;
Expand All @@ -539,10 +545,17 @@
num-bidir-endpoints = <6>;
ram-size = <1280>;
maximum-speed = "full-speed";
phys = <&otgfs_phy>;
status = "disabled";
label = "OTGFS";
};

otghs_fs_phy: otghs_fs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGHS_FS_PHY";
};

usbotg_hs: usb@40040000 {
compatible = "st,stm32-otghs", "st,stm32-otgfs";
reg = <0x40040000 0x40000>;
Expand All @@ -551,6 +564,7 @@
num-bidir-endpoints = <9>;
ram-size = <4096>;
maximum-speed = "full-speed";
phys = <&otghs_fs_phy>;
status = "disabled";
label= "OTGHS";
};
Expand Down
11 changes: 11 additions & 0 deletions dts/arm/st/f7/stm32f723.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@

/ {
soc {
usbphyc: usbphyc@40017c00 {
compatible = "st,stm32-usbphyc";
reg = <0x40017c00 0x400>;
#phy-cells = <0>;
label = "USBPHYC";
};

usbotg_hs: usb@40040000 {
phys = <&usbphyc>;
maximum-speed = "high-speed";
};
};

};

/delete-node/ &otghs_fs_phy;
7 changes: 7 additions & 0 deletions dts/arm/st/l0/stm32l072.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@
label = "SPI_2";
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <31 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <1024>;
phys = <&otgfs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/l0/stm32l073.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,20 @@
label = "SPI_2";
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <31 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <1024>;
phys = <&otgfs_phy>;
status = "disabled";
label= "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/l4/stm32l432.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@

/ {
soc {
otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usb: usb@40006800 {
compatible = "st,stm32-usb";
reg = <0x40006800 0x40000>;
interrupts = <67 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <1024>;
phys = <&otgfs_phy>;
status = "disabled";
label = "USB";
};
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/st/l4/stm32l475.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
label = "SPI_3";
};

otgfs_phy: otgfs_phy {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
label = "OTGFS_PHY";
};

usbotg_fs: otgfs@50000000 {
compatible = "st,stm32-otgfs";
reg = <0x50000000 0x40000>;
Expand All @@ -97,6 +103,7 @@
num-bidir-endpoints = <6>;
ram-size = <1280>;
maximum-speed = "full-speed";
phys = <&otgfs_phy>;
status = "disabled";
label= "OTGFS";
};
Expand Down
Loading