diff mbox series

[2/4] rockchip: board: Prepare for use of DM_USB_GADGET with DWC2_OTG

Message ID 20240226230822.2430391-3-jonas@kwiboo.se
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: Migrate to use DM_USB_GADGET on RK3328 | expand

Commit Message

Jonas Karlman Feb. 26, 2024, 11:08 p.m. UTC
The board_usb_init() and board_usb_cleanup() functions is always
included when USB_GADGET and USB_GADGET_DWC2_OTG is enabled.

Prepare for a change to use DM_USB_GADGET with DWC2_OTG by adding an
extra ifdef condition. The extra separate ifdef for USB_GADGET prepare
for next patch that adds a g_dnl_bind_fixup() function.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 arch/arm/mach-rockchip/board.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Kever Yang March 8, 2024, 9:25 a.m. UTC | #1
On 2024/2/27 07:08, Jonas Karlman wrote:
> The board_usb_init() and board_usb_cleanup() functions is always
> included when USB_GADGET and USB_GADGET_DWC2_OTG is enabled.
>
> Prepare for a change to use DM_USB_GADGET with DWC2_OTG by adding an
> extra ifdef condition. The extra separate ifdef for USB_GADGET prepare
> for next patch that adds a g_dnl_bind_fixup() function.
>
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/board.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> index dea5805c4665..f84ff542aea9 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -220,7 +220,8 @@ void enable_caches(void)
>   }
>   #endif
>   
> -#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
> +#if IS_ENABLED(CONFIG_USB_GADGET)
> +#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
>   #include <usb.h>
>   #include <linux/usb/otg.h>
>   #include <usb/dwc2_udc.h>
> @@ -296,6 +297,7 @@ int board_usb_cleanup(int index, enum usb_init_type init)
>   	return 0;
>   }
>   #endif /* CONFIG_USB_GADGET_DWC2_OTG */
> +#endif /* CONFIG_USB_GADGET */
>   
>   #if IS_ENABLED(CONFIG_FASTBOOT)
>   int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index dea5805c4665..f84ff542aea9 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -220,7 +220,8 @@  void enable_caches(void)
 }
 #endif
 
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
+#if IS_ENABLED(CONFIG_USB_GADGET)
+#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
 #include <usb.h>
 #include <linux/usb/otg.h>
 #include <usb/dwc2_udc.h>
@@ -296,6 +297,7 @@  int board_usb_cleanup(int index, enum usb_init_type init)
 	return 0;
 }
 #endif /* CONFIG_USB_GADGET_DWC2_OTG */
+#endif /* CONFIG_USB_GADGET */
 
 #if IS_ENABLED(CONFIG_FASTBOOT)
 int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)