[PATCH 0/5] board: mediatek: pumpkin: add fastboot support

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/5] board: mediatek: pumpkin: add fastboot support

Fabien Parent
This series adds USB/Fastboot support on MT8516 Pumpkin board.

Fabien Parent (5):
  arm: dts: mt8516: add support for USB
  arm: dts: mt8516-pumpkin: enable usb port
  board: mediatek: pumpkin: initialize usb device
  configs: pumpkin: enable USB gadget
  configs: pumpkin: enable fastboot

 arch/arm/dts/mt8516-pumpkin.dts  | 10 ++++++++++
 arch/arm/dts/mt8516.dtsi         | 14 ++++++++++++++
 board/mediatek/pumpkin/pumpkin.c | 17 +++++++++++++++++
 configs/pumpkin_defconfig        | 15 ++++++++++++++-
 4 files changed, 55 insertions(+), 1 deletion(-)

--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/5] arm: dts: mt8516: add support for USB

Fabien Parent
Add support for USB on mt8516 based SoC.

Signed-off-by: Fabien Parent <[hidden email]>
---
 arch/arm/dts/mt8516.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/dts/mt8516.dtsi b/arch/arm/dts/mt8516.dtsi
index 1c3358208614..c4577ceea386 100644
--- a/arch/arm/dts/mt8516.dtsi
+++ b/arch/arm/dts/mt8516.dtsi
@@ -123,6 +123,20 @@
  status = "disabled";
  };
 
+ usb0: usb@11100000 {
+ compatible = "mediatek,mt8516-musb",
+     "mediatek,mt8518-musb";
+ reg = <0x11100000 0x1000>;
+ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "mc";
+ clocks = <&topckgen CLK_TOP_USB_PHY48M>,
+ <&topckgen_cg CLK_TOP_USBIF>,
+ <&topckgen_cg CLK_TOP_USB>,
+ <&topckgen_cg CLK_TOP_USB_1P>;
+ clock-names = "usbpll", "usbmcu", "usb", "icusb";
+ status = "disabled";
+ };
+
  uart0: serial@11005000 {
  compatible = "mediatek,hsuart";
  reg = <0x11005000 0x1000>;
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/5] arm: dts: mt8516-pumpkin: enable usb port

Fabien Parent
In reply to this post by Fabien Parent
Enable the USB port for MT8516 Pumpkin Board.

Signed-off-by: Fabien Parent <[hidden email]>
---
 arch/arm/dts/mt8516-pumpkin.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/dts/mt8516-pumpkin.dts b/arch/arm/dts/mt8516-pumpkin.dts
index cd43c1f5e32c..292b00f0ffb1 100644
--- a/arch/arm/dts/mt8516-pumpkin.dts
+++ b/arch/arm/dts/mt8516-pumpkin.dts
@@ -108,3 +108,13 @@
 &watchdog {
  status = "okay";
 };
+
+&usb0 {
+ status = "okay";
+ dr_mode = "peripheral";
+
+ usb_con_c: connector {
+ compatible = "usb-c-connector";
+ label = "USB-C";
+ };
+};
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 3/5] board: mediatek: pumpkin: initialize usb device

Fabien Parent
In reply to this post by Fabien Parent
Initialize USB device on pumpkin if it is enabled in the config.

Signed-off-by: Fabien Parent <[hidden email]>
---
 board/mediatek/pumpkin/pumpkin.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/board/mediatek/pumpkin/pumpkin.c b/board/mediatek/pumpkin/pumpkin.c
index 666e4d6a26fe..37daf1c51b92 100644
--- a/board/mediatek/pumpkin/pumpkin.c
+++ b/board/mediatek/pumpkin/pumpkin.c
@@ -4,8 +4,25 @@
  */
 
 #include <common.h>
+#include <dm.h>
 
 int board_init(void)
 {
  return 0;
 }
+
+int board_late_init(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ if (CONFIG_IS_ENABLED(USB_GADGET)) {
+ ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev);
+ if (ret) {
+ pr_err("%s: Cannot find USB device\n", __func__);
+ return ret;
+ }
+ }
+
+ return 0;
+}
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 4/5] configs: pumpkin: enable USB gadget

Fabien Parent
In reply to this post by Fabien Parent
Enable USB gadget on pumpkin. This requires to also enable
BOARD_LATE_INIT since the init is done in board_late_init function.

Signed-off-by: Fabien Parent <[hidden email]>
---
 configs/pumpkin_defconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/configs/pumpkin_defconfig b/configs/pumpkin_defconfig
index 3d6af03d2209..94831adfa354 100644
--- a/configs/pumpkin_defconfig
+++ b/configs/pumpkin_defconfig
@@ -17,6 +17,7 @@ CONFIG_FIT=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_DEFAULT_FDT_FILE="mt8516-pumpkin"
 # CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_CONSOLE is not set
@@ -59,6 +60,13 @@ CONFIG_BAUDRATE=921600
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_MTK_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_MUSB_MT85XX=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x0e8d
+CONFIG_USB_GADGET_PRODUCT_NUM=0x201c
 CONFIG_WDT=y
 CONFIG_WDT_MTK=y
 # CONFIG_EFI_LOADER is not set
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 5/5] configs: pumpkin: enable fastboot

Fabien Parent
In reply to this post by Fabien Parent
Enable fastboot commands for mt8516 pumpkin board.

Signed-off-by: Fabien Parent <[hidden email]>
---
 configs/pumpkin_defconfig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configs/pumpkin_defconfig b/configs/pumpkin_defconfig
index 94831adfa354..3f2cc6d023c1 100644
--- a/configs/pumpkin_defconfig
+++ b/configs/pumpkin_defconfig
@@ -46,8 +46,13 @@ CONFIG_CMD_PART=y
 # CONFIG_CMD_MISC is not set
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
-# CONFIG_NET is not set
 CONFIG_CLK=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x4d000000
+CONFIG_FASTBOOT_BUF_SIZE=0x4000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT=y
 # CONFIG_INPUT is not set
 CONFIG_DM_MMC=y
 # CONFIG_MMC_QUIRKS is not set
--
2.28.0