From: Michael Srba <[email protected]>

This function is currently only really needed on db410c,
move it to the board-specific .c file ahead of introducing
board_spl.c to simplify things. If db410c is to ever be
converted to not use board-spefific funtions, the generic
solution replacing this function should probably not be
Qualcomm-specific anyway.

Signed-off-by: Michael Srba <[email protected]>
---
 arch/arm/mach-snapdragon/board.c                 | 45 +-----------------------
 board/qualcomm/dragonboard410c/dragonboard410c.c | 41 +++++++++++++++++++++
 2 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index 63055a60af4..b55d73e0e52 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -10,14 +10,10 @@
 #define pr_fmt(fmt) "QCOM: " fmt
 
 #include <asm/armv8/mmu.h>
-#include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/psci.h>
 #include <asm/system.h>
-#include <dm/device.h>
-#include <dm/pinctrl.h>
-#include <dm/uclass-internal.h>
-#include <dm/read.h>
+#include <dm/ofnode.h>
 #include <power/regulator.h>
 #include <env.h>
 #include <fdt_support.h>
@@ -29,7 +25,6 @@
 #include <lmb.h>
 #include <malloc.h>
 #include <fdt_support.h>
-#include <usb.h>
 #include <soc/qcom/smem.h>
 #include <sort.h>
 #include <soc/qcom/smem.h>
@@ -151,44 +146,6 @@ int board_fdt_blob_setup(void **fdtp)
        return ret;
 }
 
-/*
- * Some Qualcomm boards require GPIO configuration when switching USB modes.
- * Support setting this configuration via pinctrl state.
- */
-int board_usb_init(int index, enum usb_init_type init)
-{
-       struct udevice *usb;
-       int ret = 0;
-
-       /* USB device */
-       ret = uclass_find_device_by_seq(UCLASS_USB, index, &usb);
-       if (ret) {
-               printf("Cannot find USB device\n");
-               return ret;
-       }
-
-       ret = dev_read_stringlist_search(usb, "pinctrl-names",
-                                        "device");
-       /* No "device" pinctrl state, so just bail */
-       if (ret < 0)
-               return 0;
-
-       /* Select "default" or "device" pinctrl */
-       switch (init) {
-       case USB_INIT_HOST:
-               pinctrl_select_state(usb, "default");
-               break;
-       case USB_INIT_DEVICE:
-               pinctrl_select_state(usb, "device");
-               break;
-       default:
-               debug("Unknown usb_init_type %d\n", init);
-               break;
-       }
-
-       return 0;
-}
-
 /*
  * Some boards still need board specific init code, they can implement that by
  * overriding this function.
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c 
b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 36e4d49046e..3c0d1cbb2d8 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -8,7 +8,10 @@
 #include <button.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <dm/device.h>
 #include <dm/pinctrl.h>
+#include <dm/read.h>
+#include <dm/uclass-internal.h>
 #include <env.h>
 #include <init.h>
 #include <mmc.h>
@@ -19,6 +22,44 @@
 #include <fdt_support.h>
 #include <linux/delay.h>
 
+/*
+ * db410c requires GPIO configuration when switching USB modes.
+ * Support setting this configuration via pinctrl state.
+ */
+int board_usb_init(int index, enum usb_init_type init)
+{
+       struct udevice *usb;
+       int ret = 0;
+
+       /* USB device */
+       ret = uclass_find_device_by_seq(UCLASS_USB, index, &usb);
+       if (ret) {
+               printf("Cannot find USB device\n");
+               return ret;
+       }
+
+       ret = dev_read_stringlist_search(usb, "pinctrl-names",
+                                        "device");
+       /* No "device" pinctrl state, so just bail */
+       if (ret < 0)
+               return 0;
+
+       /* Select "default" or "device" pinctrl */
+       switch (init) {
+       case USB_INIT_HOST:
+               pinctrl_select_state(usb, "default");
+               break;
+       case USB_INIT_DEVICE:
+               pinctrl_select_state(usb, "device");
+               break;
+       default:
+               debug("Unknown usb_init_type %d\n", init);
+               break;
+       }
+
+       return 0;
+}
+
 static u32 msm_board_serial(void)
 {
        struct mmc *mmc_dev;

-- 
2.54.0

Reply via email to