From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [PATCH v1 2/2] x86: edison: Switch to DM_USB_GADGET
Date: Thu, 3 Dec 2020 18:25:43 +0200 [thread overview]
Message-ID: <20201203162543.3054-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20201203162543.3054-1-andriy.shevchenko@linux.intel.com>
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>
---
arch/x86/dts/edison.dts | 8 ++++++++
board/intel/edison/edison.c | 35 -----------------------------------
configs/edison_defconfig | 1 +
3 files changed, 9 insertions(+), 35 deletions(-)
diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts
index 600d6d256246..8d245bffc2f3 100644
--- a/arch/x86/dts/edison.dts
+++ b/arch/x86/dts/edison.dts
@@ -107,6 +107,14 @@
usb: usb at 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 at 0 {
diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c
index 652f9755155f..11e7f74e47cc 100644
--- a/board/intel/edison/edison.c
+++ b/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);
diff --git a/configs/edison_defconfig b/configs/edison_defconfig
index ab2811eca9dc..304a172a1b9f 100644
--- a/configs/edison_defconfig
+++ b/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
--
2.29.2
next prev parent reply other threads:[~2020-12-03 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 16:25 [PATCH v1 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Andy Shevchenko
2020-12-03 16:25 ` Andy Shevchenko [this message]
2020-12-03 17:32 ` [PATCH v1 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201203162543.3054-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox