All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison
@ 2020-12-03 17:45 Andy Shevchenko
  2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andy Shevchenko @ 2020-12-03 17:45 UTC (permalink / raw)
  To: u-boot

Use generic Synopsys DesignWare 3 driver on Intel Edison.
For now it's just a stub which allows future refactoring.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 arch/x86/cpu/tangier/Kconfig    | 3 +++
 arch/x86/dts/edison.dts         | 4 ++++
 drivers/usb/dwc3/dwc3-generic.c | 1 +
 3 files changed, 8 insertions(+)

diff --git a/arch/x86/cpu/tangier/Kconfig b/arch/x86/cpu/tangier/Kconfig
index d2b7edecd604..94d9d74a325c 100644
--- a/arch/x86/cpu/tangier/Kconfig
+++ b/arch/x86/cpu/tangier/Kconfig
@@ -10,8 +10,11 @@ config INTEL_TANGIER
 	imply MMC_SDHCI
 	imply MMC_SDHCI_SDMA
 	imply MMC_SDHCI_TANGIER
+	imply MISC
 	imply USB
+	imply USB_XHCI_HCD
 	imply USB_DWC3
+	imply USB_DWC3_GENERIC
 
 if INTEL_TANGIER
 
diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts
index 97cc6ec386c2..600d6d256246 100644
--- a/arch/x86/dts/edison.dts
+++ b/arch/x86/dts/edison.dts
@@ -105,6 +105,10 @@
 		reg = <0xff009000 0x1000>;
 	};
 
+	usb: usb at f9100000 {
+		compatible = "intel,tangier-dwc3";
+	};
+
 	watchdog: wdt at 0 {
 		compatible = "intel,tangier-wdt";
 	};
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index a936f71d2e5d..222358d39593 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -449,6 +449,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "rockchip,rk3328-dwc3" },
 	{ .compatible = "rockchip,rk3399-dwc3" },
 	{ .compatible = "qcom,dwc3" },
+	{ .compatible = "intel,tangier-dwc3" },
 	{ }
 };
 
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET
  2020-12-03 17:45 [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Andy Shevchenko
@ 2020-12-03 17:45 ` Andy Shevchenko
  2020-12-12 15:39   ` Simon Glass
  2020-12-16  3:40   ` Bin Meng
  2020-12-12 15:39 ` [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Simon Glass
  2020-12-16  3:39 ` Bin Meng
  2 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2020-12-03 17:45 UTC (permalink / raw)
  To: u-boot

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>
---
v2: cleaned up arch/x86/cpu/tangier/Kconfig as well

 arch/x86/cpu/tangier/Kconfig |  4 ----
 arch/x86/dts/edison.dts      |  8 ++++++++
 board/intel/edison/edison.c  | 35 -----------------------------------
 configs/edison_defconfig     |  1 +
 4 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/arch/x86/cpu/tangier/Kconfig b/arch/x86/cpu/tangier/Kconfig
index 94d9d74a325c..19aaf165d6a3 100644
--- a/arch/x86/cpu/tangier/Kconfig
+++ b/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
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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison
  2020-12-03 17:45 [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Andy Shevchenko
  2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
@ 2020-12-12 15:39 ` Simon Glass
  2020-12-16  3:39 ` Bin Meng
  2 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-12-12 15:39 UTC (permalink / raw)
  To: u-boot

On Thu, 3 Dec 2020 at 10:45, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Use generic Synopsys DesignWare 3 driver on Intel Edison.
> For now it's just a stub which allows future refactoring.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: no changes
>  arch/x86/cpu/tangier/Kconfig    | 3 +++
>  arch/x86/dts/edison.dts         | 4 ++++
>  drivers/usb/dwc3/dwc3-generic.c | 1 +
>  3 files changed, 8 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET
  2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
@ 2020-12-12 15:39   ` Simon Glass
  2020-12-16  3:40   ` Bin Meng
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-12-12 15:39 UTC (permalink / raw)
  To: u-boot

On Thu, 3 Dec 2020 at 10:45, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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>
> ---
> v2: cleaned up arch/x86/cpu/tangier/Kconfig as well
>
>  arch/x86/cpu/tangier/Kconfig |  4 ----
>  arch/x86/dts/edison.dts      |  8 ++++++++
>  board/intel/edison/edison.c  | 35 -----------------------------------
>  configs/edison_defconfig     |  1 +
>  4 files changed, 9 insertions(+), 39 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison
  2020-12-03 17:45 [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Andy Shevchenko
  2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
  2020-12-12 15:39 ` [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Simon Glass
@ 2020-12-16  3:39 ` Bin Meng
  2020-12-16  5:52   ` Bin Meng
  2 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2020-12-16  3:39 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 4, 2020 at 1:45 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Use generic Synopsys DesignWare 3 driver on Intel Edison.
> For now it's just a stub which allows future refactoring.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: no changes
>  arch/x86/cpu/tangier/Kconfig    | 3 +++
>  arch/x86/dts/edison.dts         | 4 ++++
>  drivers/usb/dwc3/dwc3-generic.c | 1 +
>  3 files changed, 8 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET
  2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
  2020-12-12 15:39   ` Simon Glass
@ 2020-12-16  3:40   ` Bin Meng
  2020-12-16  5:52     ` Bin Meng
  1 sibling, 1 reply; 8+ messages in thread
From: Bin Meng @ 2020-12-16  3:40 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 4, 2020 at 1:45 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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>
> ---
> v2: cleaned up arch/x86/cpu/tangier/Kconfig as well
>
>  arch/x86/cpu/tangier/Kconfig |  4 ----
>  arch/x86/dts/edison.dts      |  8 ++++++++
>  board/intel/edison/edison.c  | 35 -----------------------------------
>  configs/edison_defconfig     |  1 +
>  4 files changed, 9 insertions(+), 39 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison
  2020-12-16  3:39 ` Bin Meng
@ 2020-12-16  5:52   ` Bin Meng
  0 siblings, 0 replies; 8+ messages in thread
From: Bin Meng @ 2020-12-16  5:52 UTC (permalink / raw)
  To: u-boot

On Wed, Dec 16, 2020 at 11:39 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Fri, Dec 4, 2020 at 1:45 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > Use generic Synopsys DesignWare 3 driver on Intel Edison.
> > For now it's just a stub which allows future refactoring.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > v2: no changes
> >  arch/x86/cpu/tangier/Kconfig    | 3 +++
> >  arch/x86/dts/edison.dts         | 4 ++++
> >  drivers/usb/dwc3/dwc3-generic.c | 1 +
> >  3 files changed, 8 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET
  2020-12-16  3:40   ` Bin Meng
@ 2020-12-16  5:52     ` Bin Meng
  0 siblings, 0 replies; 8+ messages in thread
From: Bin Meng @ 2020-12-16  5:52 UTC (permalink / raw)
  To: u-boot

On Wed, Dec 16, 2020 at 11:40 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Fri, Dec 4, 2020 at 1:45 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > 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>
> > ---
> > v2: cleaned up arch/x86/cpu/tangier/Kconfig as well
> >
> >  arch/x86/cpu/tangier/Kconfig |  4 ----
> >  arch/x86/dts/edison.dts      |  8 ++++++++
> >  board/intel/edison/edison.c  | 35 -----------------------------------
> >  configs/edison_defconfig     |  1 +
> >  4 files changed, 9 insertions(+), 39 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-16  5:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 17:45 [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Andy Shevchenko
2020-12-03 17:45 ` [PATCH v2 2/2] x86: edison: Switch to DM_USB_GADGET Andy Shevchenko
2020-12-12 15:39   ` Simon Glass
2020-12-16  3:40   ` Bin Meng
2020-12-16  5:52     ` Bin Meng
2020-12-12 15:39 ` [PATCH v2 1/2] x86: edison: Use dwc3-generic driver for Intel Edison Simon Glass
2020-12-16  3:39 ` Bin Meng
2020-12-16  5:52   ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.