Skip to contentSkip to conversation

J721e: Add USB support

PATCH Superseded Vignesh Raghavendra 3 participants 9 messages Nov 18, 2019 – Jan 20, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover J721e: Add USB support

Add USB support for J721e SoC.
First patch fixes a compile issue with Cadence USB driver. Rest of the patches add env, DT and configs related to USB.

Vignesh Raghavendra (4):
usb: cdns3: Fix include file path
environment: ti: Add DFU environment variables k3_dfu.h
arm: dts: k3-j721e: Add DT nodes for USB
configs: j721e_evm_a72_defconfig: Enable USB related configs

 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++
 arch/arm/dts/k3-j721e-common-proc-board.dts   | 37 ++++++++++
 arch/arm/dts/k3-j721e-main.dtsi               | 70 +++++++++++++++++++
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |  7 ++
 configs/j721e_evm_a72_defconfig               | 28 ++++++++
 drivers/usb/cdns3/core.c                      |  2 +-
 drivers/usb/cdns3/host.c                      |  2 +-
 include/configs/j721e_evm.h                   | 10 +++
 include/environment/ti/k3_dfu.h               | 46 ++++++++++++
 9 files changed, 214 insertions(+), 2 deletions(-)
 create mode 100644 include/environment/ti/k3_dfu.h
Signature · 1 line
2.24.0
#1 lore raw

PATCH 1/4 usb: cdns3: Fix include file path

xhci.h has now been moved to include/usb/ folder. Therefore, update the path in the Cadence USB drivers.

---
 drivers/usb/cdns3/core.c | 2 +-
 drivers/usb/cdns3/host.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/cdns3/core.c +1 -1
index f1e4bb627815..8c8e02169e81 100644
@@ -18,7 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <usb.h>
-#include "../host/xhci.h"
+#include <usb/xhci.h>
 
 #include "core.h"
 #include "host-export.h"
drivers/usb/cdns3/host.c +1 -1
index 79be63001d44..425d9d053ddb 100644
@@ -11,7 +11,7 @@
 #include <dm.h>
 #include <linux/compat.h>
 #include <usb.h>
-#include "../host/xhci.h"
+#include <usb/xhci.h>
 
 #include "core.h"
 #include "drd.h"
Signature · 1 line
2.24.0
#2 lore raw

PATCH 1/4 usb: cdns3: Fix include file path

Quoted 1 line · Vignesh Raghavendra

xhci.h has now been moved to include/usb/ folder. Therefore, update the

s/folder/directory/ ; I can update it while applying.

Quoted 1 line

path in the Cadence USB drivers.

[...]

#3 lore raw

PATCH 1/4 usb: cdns3: Fix include file path

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Vignesh Raghavendra

xhci.h has now been moved to include/usb/ folder. Therefore, update the

s/folder/directory/ ; I can update it while applying.

Agree, Thanks!

Quoted 5 lines
Quoted 2 lines

path in the Cadence USB drivers.

[...]

Signature · 2 lines
Regards
Vignesh
#5 lore raw

PATCH 2/4 environment: ti: Add DFU environment variables k3_dfu.h

In reply to Vignesh Raghavendra

Setup env variables for updating firmwares on eMMC/OSPI/MMC via DFU

---
 include/configs/j721e_evm.h     | 10 +++++++
 include/environment/ti/k3_dfu.h | 46 +++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 include/environment/ti/k3_dfu.h
include/configs/j721e_evm.h +10 -0
index 639d87a4e578..b21eabc873f7 100644
@@ -14,6 +14,7 @@
 #include <environment/ti/mmc.h>
 #include <environment/ti/k3_rproc.h>
 #include <environment/ti/ufs.h>
+#include <environment/ti/k3_dfu.h>
 
 #define CONFIG_ENV_SIZE			(128 << 10)
 
@@ -102,12 +103,21 @@
 		"7 /lib/firmware/j7-c66_1-fw "				\
 		"8 /lib/firmware/j7-c71_0-fw "
 
+/* set default dfu_bufsiz to 128KB (sector size of OSPI) */
+#define EXTRA_ENV_DFUARGS \
+	"dfu_bufsiz=0x20000\0" \
+	DFU_ALT_INFO_MMC \
+	DFU_ALT_INFO_EMMC \
+	DFU_ALT_INFO_RAM \
+	DFU_ALT_INFO_OSPI
+
 /* Incorporate settings into the U-Boot environment */
 #define CONFIG_EXTRA_ENV_SETTINGS					\
 	DEFAULT_MMC_TI_ARGS						\
 	EXTRA_ENV_J721E_BOARD_SETTINGS					\
 	EXTRA_ENV_J721E_BOARD_SETTINGS_MMC				\
 	EXTRA_ENV_RPROC_SETTINGS					\
+	EXTRA_ENV_DFUARGS						\
 	DEFAULT_UFS_TI_ARGS
 
 /* Now for the remaining common defines */
include/environment/ti/k3_dfu.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.24.0
#6 lore raw

PATCH 3/4 arm: dts: k3-j721e: Add DT nodes for USB

In reply to Vignesh Raghavendra

J721e has two instances of Cadence USB3 controller. Add DT nodes for the same. USB0 is configured to device mode and USB1 is configured to host mode. For now only high speed mode is supported.

---
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++
 arch/arm/dts/k3-j721e-common-proc-board.dts   | 37 ++++++++++
 arch/arm/dts/k3-j721e-main.dtsi               | 70 +++++++++++++++++++
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |  7 ++
 4 files changed, 128 insertions(+)
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index c4f2dd6b4fb2..c66e029b88ad 100644
@@ -311,6 +311,20 @@
 	u-boot,dm-spl;
 };
 
+&main_usbss0_pins_default {
+	u-boot,dm-spl;
+};
+
+&usbss0 {
+	u-boot,dm-spl;
+	ti,usb2-only;
+};
+
+&usb0 {
+	dr_mode = "peripheral";
+	u-boot,dm-spl;
+};
+
 &mcu_cpsw {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
arch/arm/dts/k3-j721e-common-proc-board.dts +37 -0
index c978cabd1335..137da7e425a1 100644
@@ -77,3 +77,40 @@
 	voltage-ranges = <1800 1800 3300 3300>;
 	ti,driver-strength-ohm = <50>;
 };
+
+&main_pmx0 {
+	main_usbss0_pins_default: main_usbss0_pins_default {
+		pinctrl-single,pins = <
+			J721E_IOPAD(0x290, PIN_OUTPUT, 0) /* (U6) USB0_DRVVBUS */
+			J721E_IOPAD(0x210, PIN_INPUT, 7) /* (W3) MCAN1_RX.GPIO1_3 */
+		>;
+	};
+
+	main_usbss1_pins_default: main_usbss1_pins_default {
+		pinctrl-single,pins = <
+			J721E_IOPAD(0x214, PIN_OUTPUT, 4) /* (V4) MCAN1_TX.USB1_DRVVBUS */
+		>;
+	};
+};
+
+&usbss0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_usbss0_pins_default>;
+	ti,vbus-divider;
+};
+
+&usb0 {
+	dr_mode = "otg";
+	maximum-speed = "super-speed";
+};
+
+&usbss1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_usbss1_pins_default>;
+	ti,usb2-only;
+};
+
+&usb1 {
+	dr_mode = "host";
+	maximum-speed = "high-speed";
+};
arch/arm/dts/k3-j721e-main.dtsi +70 -0

76 lines not on this page · raw message

arch/arm/dts/k3-j721e-r5-common-proc-board.dts +7 -0
index 41af48214f6f..1a8e10786110 100644
@@ -112,6 +112,13 @@
 			J721E_IOPAD(0x1ec, PIN_OUTPUT, 0) /* (AB3) UART0_TXD */
 		>;
 	};
+
+	main_usbss0_pins_default: main_usbss0_pins_default {
+		pinctrl-single,pins = <
+			J721E_IOPAD(0x290, PIN_OUTPUT, 0) /* (U6) USB0_DRVVBUS */
+			J721E_IOPAD(0x210, PIN_INPUT, 7) /* (W3) MCAN1_RX.GPIO1_3 */
+		>;
+	};
 };
 
 &wkup_uart0 {
Signature · 1 line
2.24.0
#7 lore raw

PATCH 4/4 configs: j721e_evm_a72_defconfig: Enable USB related configs

In reply to Vignesh Raghavendra

Enable USB host and device related configs.

---
 configs/j721e_evm_a72_defconfig | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
configs/j721e_evm_a72_defconfig +28 -0
index 748179e82317..0abbfc02e614 100644
@@ -29,6 +29,8 @@ CONFIG_SPL_DM_RESET=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_SPI_LOAD=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPT=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
@@ -37,6 +39,8 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_UFS=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -60,8 +64,17 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_TI_SCI_PROTOCOL=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
@@ -91,6 +104,7 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_RAM=y
 CONFIG_REMOTEPROC_TI_K3_DSP=y
 CONFIG_REMOTEPROC_TI_K3_R5F=y
 CONFIG_DM_RESET=y
@@ -105,7 +119,21 @@ CONFIG_CADENCE_QSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_CDNS3=y
+CONFIG_USB_CDNS3_GADGET=y
+CONFIG_USB_CDNS3_HOST=y
+CONFIG_SPL_USB_CDNS3_GADGET=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0451
+CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_UFS=y
 CONFIG_CADENCE_UFS=y
 CONFIG_TI_J721E_UFS=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.24.0
#8 lore raw

cover J721e: Add USB support

In reply to Vignesh Raghavendra
Quoted 3 lines · Vignesh Raghavendra

Add USB support for J721e SoC.
First patch fixes a compile issue with Cadence USB driver. Rest of the patches add env, DT and configs related to USB.

patches 2,3,4 merged into u-boot-ti.

Thanks and regards,
Lokesh

Quoted 19 lines

Vignesh Raghavendra (4):
usb: cdns3: Fix include file path
environment: ti: Add DFU environment variables k3_dfu.h
arm: dts: k3-j721e: Add DT nodes for USB
configs: j721e_evm_a72_defconfig: Enable USB related configs

 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++
 arch/arm/dts/k3-j721e-common-proc-board.dts   | 37 ++++++++++
 arch/arm/dts/k3-j721e-main.dtsi               | 70 +++++++++++++++++++
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |  7 ++
 configs/j721e_evm_a72_defconfig               | 28 ++++++++
 drivers/usb/cdns3/core.c                      |  2 +-
 drivers/usb/cdns3/host.c                      |  2 +-
 include/configs/j721e_evm.h                   | 10 +++
 include/environment/ti/k3_dfu.h               | 46 ++++++++++++
 9 files changed, 214 insertions(+), 2 deletions(-)
 create mode 100644 include/environment/ti/k3_dfu.h