瀏覽代碼

x86: edison: Switch to DM_USB_GADGET

DM is the modern default approach for the drivers in U-Boot.
It also allows to configure code via Device Tree.

Move Intel Edison to use DM_USB_GADGET and drop hard coded values.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Andy Shevchenko 3 年之前
父節點
當前提交
f89e8acbc8
共有 4 個文件被更改,包括 9 次插入39 次删除
  1. 0 4
      arch/x86/cpu/tangier/Kconfig
  2. 8 0
      arch/x86/dts/edison.dts
  3. 0 35
      board/intel/edison/edison.c
  4. 1 0
      configs/edison_defconfig

+ 0 - 4
arch/x86/cpu/tangier/Kconfig

@@ -29,8 +29,4 @@ config SYS_CAR_SIZE
 	  Space in bytes in eSRAM used as Cache-As-RAM (CAR).
 	  Note this size must not exceed eSRAM's total size.
 
-config SYS_USB_OTG_BASE
-	hex
-	default 0xf9100000
-
 endif

+ 8 - 0
arch/x86/dts/edison.dts

@@ -107,6 +107,14 @@
 
 	usb: usb@f9100000 {
 		compatible = "intel,tangier-dwc3";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		dwc3: dwc3 {
+			reg = <0xf9100000 0x100000>;
+			maximum-speed = "high-speed";
+			dr_mode = "peripheral";
+		};
 	};
 
 	watchdog: wdt@0 {

+ 0 - 35
board/intel/edison/edison.c

@@ -3,15 +3,10 @@
  * Copyright (c) 2017 Intel Corporation
  */
 #include <common.h>
-#include <dwc3-uboot.h>
 #include <env.h>
 #include <init.h>
 #include <mmc.h>
 #include <u-boot/md5.h>
-#include <usb.h>
-#include <watchdog.h>
-
-#include <linux/usb/gadget.h>
 
 #include <asm/cache.h>
 #include <asm/pmu.h>
@@ -27,36 +22,6 @@ int board_early_init_r(void)
 	return 0;
 }
 
-static struct dwc3_device dwc3_device_data = {
-	.maximum_speed = USB_SPEED_HIGH,
-	.base = CONFIG_SYS_USB_OTG_BASE,
-	.dr_mode = USB_DR_MODE_PERIPHERAL,
-	.index = 0,
-};
-
-int usb_gadget_handle_interrupts(int controller_index)
-{
-	dwc3_uboot_handle_interrupt(controller_index);
-	WATCHDOG_RESET();
-	return 0;
-}
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-	if (index == 0 && init == USB_INIT_DEVICE)
-		return dwc3_uboot_init(&dwc3_device_data);
-	return -EINVAL;
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-	if (index == 0 && init == USB_INIT_DEVICE) {
-		dwc3_uboot_exit(index);
-		return 0;
-	}
-	return -EINVAL;
-}
-
 static void assign_serial(void)
 {
 	struct mmc *mmc = find_mmc_device(0);

+ 1 - 0
configs/edison_defconfig

@@ -37,6 +37,7 @@ CONFIG_DFU_TIMEOUT=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_DM_USB_GADGET=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Intel"
 CONFIG_USB_GADGET_VENDOR_NUM=0x8087