diff --git a/f4/include/stm32f4xx_hal_pcd.h b/f4/include/stm32f4xx_hal_pcd.h
index 5fdc7a3871f799779d34c230be95e4c99de1a87e..4aafc75aa8d11d416441285ffe23206669265187 100644
--- a/f4/include/stm32f4xx_hal_pcd.h
+++ b/f4/include/stm32f4xx_hal_pcd.h
@@ -203,8 +203,10 @@ typedef struct
 #define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) \
   *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= ~(USB_OTG_PCGCCTL_STOPCLK)
 
-#define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) \
-  *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
+#ifndef __HAL_PCD_GATE_PHYCLOCK
+  #define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) \
+    *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
+#endif
 
 #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) \
   ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE)) & 0x10U)