dra7xx: am43xx: add dwc3 gadget driver support and enable dfu
Subsystems (9)
PATCH 37/40 include: configs: Enable DWC3 and DFU in DRA7xx
In reply to Kishon Vijay Abraham IEnabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled support for DFU.
--- include/configs/dra7xx_evm.h | 63 +++++++++++++++++++++++++++++++++++++ include/configs/ti_omap5_common.h | 5 +++ 2 files changed, 68 insertions(+)
include/configs/dra7xx_evm.h +63 -0
@@ -43,6 +43,47 @@"uuid_disk=${uuid_gpt_disk};" \ "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}" +#define DFU_ALT_INFO_MMC \ + "dfu_alt_info_mmc=" \ + "boot part 0 1;" \ + "rootfs part 0 2;" \ + "MLO fat 0 1;" \ + "MLO.raw raw 0x100 0x100;" \ + "u-boot.img.raw raw 0x300 0x400;" \ + "spl-os-args.raw raw 0x80 0x80;" \ + "spl-os-image.raw raw 0x900 0x2000;" \ + "spl-os-args fat 0 1;" \ + "spl-os-image fat 0 1;" \ + "u-boot.img fat 0 1;" \ + "uEnv.txt fat 0 1\0" + +#define DFU_ALT_INFO_EMMC \ + "dfu_alt_info_emmc=" \ + "rawemmc raw 0 3751936;" \ + "boot part 1 1;" \ + "rootfs part 1 2;" \ + "MLO fat 1 1;" \ + "MLO.raw raw 0x100 0x100;" \ + "u-boot.img.raw raw 0x300 0x400;" \ + "spl-os-args.raw raw 0x80 0x80;" \ + "spl-os-image.raw raw 0x900 0x2000;" \ + "spl-os-args fat 1 1;" \ + "spl-os-image fat 1 1;" \ + "u-boot.img fat 1 1;" \ + "uEnv.txt fat 1 1\0" + +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" + +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_MMC \ + DFU_ALT_INFO_EMMC \ + DFU_ALT_INFO_RAM +#include <configs/ti_omap5_common.h> /* Enhance our eMMC support / experience. */
@@ -132,6 +173,28 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_OMAP_USB2PHY2_HOST +/* USB GADGET */ +#define CONFIG_USB_DWC3_PHY_OMAP +#define CONFIG_USB_DWC3_OMAP +#define CONFIG_USB_DWC3 +#define CONFIG_USB_DWC3_GADGET + +#define CONFIG_USB_GADGET +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_USB_GADGET_DUALSPEED + +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_RAM +#define CONFIG_CMD_DFU + +#define CONFIG_DFU_MMC +#define CONFIG_DFU_RAM +/* SATA */ #define CONFIG_BOARD_LATE_INIT #define CONFIG_CMD_SCSI
include/configs/ti_omap5_common.h +5 -0
@@ -65,6 +65,10 @@#define PARTS_DEFAULT #endif +#ifndef DFUARGS +#define DFUARGS +#endif +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \
@@ -122,6 +126,7 @@"if test $fdtfile = undefined; then " \"echo WARNING: Could not determine device tree to use; fi; \0" \"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \ +DFUARGS \ #define CONFIG_BOOTCOMMAND \"run findfdt; " \
Signature · 1 line
1.7.9.5
PATCH 37/40 include: configs: Enable DWC3 and DFU in DRA7xx
Hi Kishon,
Quoted 114 lines
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled support for DFU.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- include/configs/dra7xx_evm.h | 63+++++++++++++++++++++++++++++++++++++
include/configs/ti_omap5_common.h| 5 +++ 2 files changed, 68
insertions(+)(quoted diff) +0
-0
b/include/configs/dra7xx_evm.hindex 174a711..75b55d9 100644include/configs/dra7xx_evm.h +63
-0@@ -43,6 +43,47 @@"uuid_disk=${uuid_gpt_disk};" \ "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}" +#define DFU_ALT_INFO_MMC \ + "dfu_alt_info_mmc=" \ + "boot part 0 1;" \ + "rootfs part 0 2;" \ + "MLO fat 0 1;" \ + "MLO.raw raw 0x100 0x100;" \ + "u-boot.img.raw raw 0x300 0x400;" \ + "spl-os-args.raw raw 0x80 0x80;" \ + "spl-os-image.raw raw 0x900 0x2000;" \ + "spl-os-args fat 0 1;" \ + "spl-os-image fat 0 1;" \ + "u-boot.img fat 0 1;" \ + "uEnv.txt fat 0 1\0" + +#define DFU_ALT_INFO_EMMC \ + "dfu_alt_info_emmc=" \ + "rawemmc raw 0 3751936;" \ + "boot part 1 1;" \ + "rootfs part 1 2;" \ + "MLO fat 1 1;" \ + "MLO.raw raw 0x100 0x100;" \ + "u-boot.img.raw raw 0x300 0x400;" \ + "spl-os-args.raw raw 0x80 0x80;" \ + "spl-os-image.raw raw 0x900 0x2000;" \ + "spl-os-args fat 1 1;" \ + "spl-os-image fat 1 1;" \ + "u-boot.img fat 1 1;" \ + "uEnv.txt fat 1 1\0" + +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" + +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_MMC \ + DFU_ALT_INFO_EMMC \ + DFU_ALT_INFO_RAM +#include <configs/ti_omap5_common.h> /* Enhance our eMMC support / experience. */ @@ -132,6 +173,28 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_OMAP_USB2PHY2_HOST +/* USB GADGET */ +#define CONFIG_USB_DWC3_PHY_OMAP +#define CONFIG_USB_DWC3_OMAP +#define CONFIG_USB_DWC3 +#define CONFIG_USB_DWC3_GADGET + +#define CONFIG_USB_GADGET +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_USB_GADGET_DUALSPEED + +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_RAM +#define CONFIG_CMD_DFU + +#define CONFIG_DFU_MMC +#define CONFIG_DFU_RAM +/* SATA */ #define CONFIG_BOARD_LATE_INIT #define CONFIG_CMD_SCSI (quoted diff) +0
-0
b/include/configs/ti_omap5_common.hindex c47651d..cdc539c 100644include/configs/ti_omap5_common.h +5
-0@@ -65,6 +65,10 @@#define PARTS_DEFAULT #endif +#ifndef DFUARGS +#define DFUARGS +#endif +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \@@ -122,6 +126,7 @@"if test $fdtfile = undefined; then " \ "echo WARNING: Could not determine device tree to use; fi; \0" \ "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \ + DFUARGS \ #define CONFIG_BOOTCOMMAND \
Quoted 1 line
"run findfdt; " \
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 38/40 board: ti: AM43xx: added USB initializtion code
In reply to Kishon Vijay Abraham IImplemented board_usb_init(), board_usb_cleanup() and usb_gadget_handle_interrupts() in am43xx board file that can be invoked by various gadget drivers.
--- arch/arm/include/asm/arch-am33xx/hardware_am43xx.h | 9 ++ board/ti/am43xx/board.c | 108 ++++++++++++++++++++ 2 files changed, 117 insertions(+)
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +9 -0
@@ -61,6 +61,15 @@/* RTC base address */ #define RTC_BASE 0x44E3E000 +/* USB OTG */ +#define USB_OTG_SS1_BASE 0x48390000 +#define USB_OTG_SS1_GLUE_BASE 0x48380000 +#define USB2_PHY1_POWER 0x44E10620 + +#define USB_OTG_SS2_BASE 0x483D0000 +#define USB_OTG_SS2_GLUE_BASE 0x483C0000 +#define USB2_PHY2_POWER 0x44E10628 +/* USB Clock Control */ #define PRM_PER_USB_OTG_SS0_CLKCTRL (CM_PER + 0x260)#define PRM_PER_USB_OTG_SS1_CLKCTRL (CM_PER + 0x268)
board/ti/am43xx/board.c +108 -0
126 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 38/40 board: ti: AM43xx: added USB initializtion code
Hi Kishon,
Quoted 157 lines
Implemented
board_usb_init(),board_usb_cleanup()andusb_gadget_handle_interrupts()in am43xx board file that can be invoked by various gadget drivers.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/include/asm/arch-am33xx/hardware_am43xx.h | 9 ++ board/ti/am43xx/board.c | 108++++++++++++++++++++ 2 files changed, 117 insertions(+)
(quoted diff) +0
-0
b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.hindex 5f259da..110f329 100644 ---a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h+++b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h@@ -61,6 +61,15 @@ /* RTC base address */
#defineRTC_BASE0x44E3E000arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +9
-0+/* USB OTG */ +#define USB_OTG_SS1_BASE 0x48390000 +#define USB_OTG_SS1_GLUE_BASE 0x48380000 +#define USB2_PHY1_POWER 0x44E10620 + +#define USB_OTG_SS2_BASE 0x483D0000 +#define USB_OTG_SS2_GLUE_BASE 0x483C0000 +#define USB2_PHY2_POWER 0x44E10628 +/* USB Clock Control */ #define PRM_PER_USB_OTG_SS0_CLKCTRL (CM_PER + 0x260)#define PRM_PER_USB_OTG_SS1_CLKCTRL (CM_PER + 0x268)board/ti/am43xx/board.c +67
-0@@ -12,6 +12,7 @@#include <i2c.h> #include <asm/errno.h> #include <spl.h> +#include <usb.h> #include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mux.h> @@ -23,6 +24,10 @@#include <power/tps65218.h> #include <miiphy.h> #include <cpsw.h> +#include <linux/usb/gadget.h> +#include <dwc3-uboot.h> +#include <dwc3-omap-uboot.h> +#include <ti-usb-phy-uboot.h> DECLARE_GLOBAL_DATA_PTR ;@@ -686,6 +691,109 @@ int board_late_init(void) }#endif +#ifdef CONFIG_USB_DWC3 +static struct dwc3_device usb_otg_ss1 = { + .maximum_speed =USB_SPEED_HIGH , + .base =USB_OTG_SS1_BASE , + .tx_fifo_resize = false, + .index =0 , +}; + +static struct dwc3_omap_device usb_otg_ss1_glue = { + .base = (void *)USB_OTG_SS1_GLUE_BASE , + .utmi_mode =DWC3_OMAP_UTMI_MODE_SW , + .vbus_id_status =OMAP_DWC3_VBUS_VALID , + .index =0 , +}; + +static struct ti_usb_phy_device usb_phy1_device = { + .usb2_phy_power = (void *)USB2_PHY1_POWER , + .index =0 , +}; + +static struct dwc3_device usb_otg_ss2 = { + .maximum_speed =USB_SPEED_HIGH , + .base =USB_OTG_SS2_BASE , + .tx_fifo_resize = false, + .index =1 , +}; + +static struct dwc3_omap_device usb_otg_ss2_glue = { + .base = (void *)USB_OTG_SS2_GLUE_BASE , + .utmi_mode =DWC3_OMAP_UTMI_MODE_SW , + .vbus_id_status =OMAP_DWC3_VBUS_VALID , + .index =1 , +}; + +static struct ti_usb_phy_device usb_phy2_device = { + .usb2_phy_power = (void *)USB2_PHY2_POWER , + .index =1 , +}; + +int board_usb_init (int index,enum usb_init_type init) +{ +switch (index) { +case 0 : +if (init ==USB_INIT_DEVICE ) { + usb_otg_ss1.dr_mode =USB_DR_MODE_PERIPHERAL ; + usb_otg_ss1_glue.vbus_id_status =OMAP_DWC3_VBUS_VALID ; + }else { + usb_otg_ss1.dr_mode =USB_DR_MODE_HOST ; + usb_otg_ss1_glue.vbus_id_status =OMAP_DWC3_ID_GROUND ; + } + +dwc3_omap_uboot_init (&usb_otg_ss1_glue); +ti_usb_phy_uboot_init (&usb_phy1_device); +dwc3_uboot_init (&usb_otg_ss1); +break ; +case 1 : +if (init ==USB_INIT_DEVICE ) { + usb_otg_ss2.dr_mode =USB_DR_MODE_PERIPHERAL ; + usb_otg_ss2_glue.vbus_id_status =OMAP_DWC3_VBUS_VALID ; + }else { + usb_otg_ss2.dr_mode =USB_DR_MODE_HOST ; + usb_otg_ss2_glue.vbus_id_status =
OMAP_DWC3_ID_GROUND;board/ti/am43xx/board.c +34
-0+ } + +ti_usb_phy_uboot_init (&usb_phy2_device); +dwc3_omap_uboot_init (&usb_otg_ss2_glue); +dwc3_uboot_init (&usb_otg_ss2); +break ; +default : +printf ("Invalid Controller Index\n" ); + } + +return 0 ; +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +switch (index) { +case 0 : +case 1 : +ti_usb_phy_uboot_exit (index); +dwc3_uboot_exit (index); +dwc3_omap_uboot_exit (index); +break ; +default : +printf ("Invalid Controller Index\n" ); + } + +return 0 ; +} + +int usb_gadget_handle_interrupts (void ) +{ +u32 status; + + status =dwc3_omap_uboot_interrupt_status (0 );
board/ti/am43xx/board.c int board_late_init(void) · line 799
Quoted 10 lines
board/ti/am43xx/board.c +7
-0+if (status) +dwc3_uboot_handle_interrupt (0 ); + + return 0; +} +#endif +#ifdef CONFIG_DRIVER_TI_CPSW static void cpsw_control (int enabled)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 39/40 include: configs: Enable DWC3 and DFU in AM43xx
In reply to Kishon Vijay Abraham IEnabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled support for DFU.
--- include/configs/am43xx_evm.h | 61 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-)
include/configs/am43xx_evm.h +60 -1
@@ -108,6 +108,64 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_AM437X_USB2PHY2_HOST +/* USB GADGET */ +#if !defined(CONFIG_SPL_BUILD ) || \ + (defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_USBETH_SUPPORT )) +#define CONFIG_USB_DWC3_PHY_OMAP +#define CONFIG_USB_DWC3_OMAP +#define CONFIG_USB_DWC3 +#define CONFIG_USB_DWC3_GADGET + +#define CONFIG_USB_GADGET +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00" +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_USB_GADGET_DUALSPEED +#endif + +#ifndef CONFIG_SPL_BUILD +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_RAM +#define CONFIG_CMD_DFU + +#define CONFIG_DFU_MMC +#define DFU_ALT_INFO_MMC \ + "dfu_alt_info_mmc=" \ + "boot part 0 1;" \ + "rootfs part 0 2;" \ + "MLO fat 0 1;" \ + "spl-os-args fat 0 1;" \ + "spl-os-image fat 0 1;" \ + "u-boot.img fat 0 1;" \ + "uEnv.txt fat 0 1\0" + +#define DFU_ALT_INFO_EMMC \ + "dfu_alt_info_emmc=" \ + "MLO raw 0x100 0x100 mmcpart 0;" \ + "u-boot.img raw 0x300 0x1000 mmcpart 0\0" + +#define CONFIG_DFU_RAM +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" + +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_MMC \ + DFU_ALT_INFO_EMMC \ + DFU_ALT_INFO_RAM +#else +#define DFUARGS +#endif +#ifdef CONFIG_QSPI_BOOT #define CONFIG_SYS_TEXT_BASE 0x30000000#undef CONFIG_ENV_IS_IN_FAT
@@ -238,7 +296,8 @@"if test $board_name = AM43__SK; then " \"setenv fdtfile am437x-sk-evm.dtb; fi; " \"if test $fdtfile = undefined; then " \ -"echo WARNING: Could not determine device tree; fi; \0" +"echo WARNING: Could not determine device tree; fi; \0" \ +DFUARGS \ #define CONFIG_BOOTCOMMAND \"run findfdt; " \
Signature · 1 line
1.7.9.5
PATCH 39/40 include: configs: Enable DWC3 and DFU in AM43xx
Hi Kishon,
Quoted 21 lines
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled support for DFU.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- include/configs/am43xx_evm.h | 61+++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-)
(quoted diff) +0
-0
b/include/configs/am43xx_evm.hindex 4472c3e..3fcd99e 100644include/configs/am43xx_evm.h +3
-0@@ -108,6 +108,64 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_AM437X_USB2PHY2_HOST +/* USB GADGET */ +#if !defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_SPL_BUILD) &&
defined(CONFIG_SPL_USBETH_SUPPORT)) +#defineCONFIG_USB_DWC3_PHY_OMAP
include/configs/am43xx_evm.h line 122
Quoted 8 lines
include/configs/am43xx_evm.h +8
-0+#define CONFIG_USB_DWC3_OMAP +#define CONFIG_USB_DWC3 +#define CONFIG_USB_DWC3_GADGET + +#define CONFIG_USB_GADGET +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
I saw somewhere a discussion which forbidden using hardcoded MAC addresses.
This particular MAC looks like one for debug/development ;-)
Quoted 57 lines
include/configs/am43xx_evm.h +46
-1+#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_USB_GADGET_DUALSPEED +#endif + +#ifndef CONFIG_SPL_BUILD +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_RAM +#define CONFIG_CMD_DFU + +#define CONFIG_DFU_MMC +#define DFU_ALT_INFO_MMC \ + "dfu_alt_info_mmc=" \ + "boot part 0 1;" \ + "rootfs part 0 2;" \ + "MLO fat 0 1;" \ + "spl-os-args fat 0 1;" \ + "spl-os-image fat 0 1;" \ + "u-boot.img fat 0 1;" \ + "uEnv.txt fat 0 1\0" + +#define DFU_ALT_INFO_EMMC \ + "dfu_alt_info_emmc=" \ + "MLO raw 0x100 0x100 mmcpart 0;" \ + "u-boot.img raw 0x300 0x1000 mmcpart 0\0" + +#define CONFIG_DFU_RAM +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" + +#define DFUARGS \ + "dfu_bufsiz=0x10000\0" \ + DFU_ALT_INFO_MMC \ + DFU_ALT_INFO_EMMC \ + DFU_ALT_INFO_RAM +#else +#define DFUARGS +#endif +#ifdef CONFIG_QSPI_BOOT #define CONFIG_SYS_TEXT_BASE 0x30000000#undef CONFIG_ENV_IS_IN_FAT@@ -238,7 +296,8 @@"if test $board_name = AM43__SK; then " \"setenv fdtfile am437x-sk-evm.dtb; fi; " \"if test $fdtfile = undefined; then " \ - "echo WARNING: Could not determine devicetree; fi; \0"
include/configs/am43xx_evm.h +1
-0+ "echo WARNING: Could not determine devicetree; fi; \0" \
include/configs/am43xx_evm.h line 303
Quoted 4 lines
include/configs/am43xx_evm.h +1
-0+ DFUARGS \#define CONFIG_BOOTCOMMAND \ "run findfdt; " \
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 40/40 usb: modify usb_gadget_handle_interrupts to take controller index
In reply to Kishon Vijay Abraham ISince we support multiple dwc3 controllers to be existent at the same time, in order to handle the interrupts of a particular dwc3 controller usb_gadget_handle_interrutps should take controller index as an argument.
Hence the API of usb_gadget_handle_interrupts is modified to take controller index as an argument and made the corresponding changes to all the usb_gadget_handle_interrupts calls.
--- board/ti/am43xx/board.c | 6 +++--- board/ti/dra7xx/evm.c | 6 +++--- common/cmd_dfu.c | 2 +- common/cmd_fastboot.c | 2 +- common/cmd_usb_mass_storage.c | 2 +- drivers/usb/gadget/atmel_usba_udc.c | 2 +- drivers/usb/gadget/ci_udc.c | 2 +- drivers/usb/gadget/ether.c | 10 +++++----- drivers/usb/gadget/f_mass_storage.c | 2 +- drivers/usb/gadget/f_thor.c | 6 +++--- drivers/usb/gadget/fotg210.c | 2 +- drivers/usb/gadget/pxa25x_udc.c | 2 +- drivers/usb/gadget/s3c_udc_otg.c | 2 +- drivers/usb/musb-new/musb_uboot.c | 2 +- include/linux/usb/gadget.h | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-)
board/ti/am43xx/board.c +3 -3
@@ -782,13 +782,13 @@ int board_usb_cleanup(int index, enum usb_init_type init)return 0 ; } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 status; - status =dwc3_omap_uboot_interrupt_status (0 ); + status =dwc3_omap_uboot_interrupt_status (index);if (status) -dwc3_uboot_handle_interrupt (0 ); +dwc3_uboot_handle_interrupt (index);return 0 ; }
board/ti/dra7xx/evm.c +3 -3
@@ -220,13 +220,13 @@ int board_usb_cleanup(int index, enum usb_init_type init)return 0 ; } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 status; - status =dwc3_omap_uboot_interrupt_status (0 ); + status =dwc3_omap_uboot_interrupt_status (index);if (status) -dwc3_uboot_handle_interrupt (0 ); +dwc3_uboot_handle_interrupt (index);return 0 ; }
common/cmd_dfu.c +1 -1
@@ -64,7 +64,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (ctrlc ()) goto exit; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (controller_index); } exit:g_dnl_unregister ();
common/cmd_fastboot.c +1 -1
@@ -25,7 +25,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])break ;if (ctrlc ())break ; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); }g_dnl_unregister ();
common/cmd_usb_mass_storage.c +1 -1
@@ -137,7 +137,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, }while (1 ) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (controller_index); rc =fsg_main_thread (NULL );if (rc) {
drivers/usb/gadget/atmel_usba_udc.c +1 -1
@@ -1199,7 +1199,7 @@ static struct usba_udc controller = { }, }; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {struct usba_udc *udc = &controller;
drivers/usb/gadget/ci_udc.c +1 -1
@@ -741,7 +741,7 @@ void udc_irq(void) } } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 value;struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
drivers/usb/gadget/ether.c +5 -5
@@ -1908,7 +1908,7 @@ static int eth_stop(struct eth_dev *dev)/* Wait until host receives OID_GEN_MEDIA_CONNECT_STATUS */ ts =get_timer (0 );while (get_timer (ts) < timeout) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );#endif rndis_uninit (dev->rndis_config);
@@ -2359,7 +2359,7 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd)error ("The remote end did not respond in time." ); goto fail; } -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); } packet_received =0 ;
@@ -2427,7 +2427,7 @@ static int usb_eth_send(struct eth_device *netdev, void *packet, int length)printf ("timeout sending packets to usb ethernet\n" );return -1 ; } -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); }if (rndis_pkt)free (rndis_pkt);
@@ -2442,7 +2442,7 @@ static int usb_eth_recv(struct eth_device *netdev) {struct eth_dev *dev = &l_ethdev; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );if (packet_received) {debug ("%s: packet received\n" , __func__);
@@ -2487,7 +2487,7 @@ void usb_eth_halt(struct eth_device *netdev)/* Clear pending interrupt */ if (dev->network_started) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); dev->network_started =0 ; }
drivers/usb/gadget/f_mass_storage.c +1 -1
@@ -689,7 +689,7 @@ static int sleep_thread(struct fsg_common *common) k =0 ; } -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); } common->thread_wakeup_needed =0 ;return rc;
drivers/usb/gadget/f_thor.c +3 -3
@@ -543,7 +543,7 @@ static int thor_rx_data(void) }while (!dev->rxdata) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );if (ctrlc ())return -1 ; }
@@ -577,7 +577,7 @@ static void thor_tx_data(unsigned char *data, int len)/* Wait until tx interrupt received */ while (!dev->txdata) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); dev->txdata =0 ; }
@@ -694,7 +694,7 @@ int thor_init(void)/* Wait for a device enumeration and configuration settings */ debug ("THOR enumeration/configuration setting....\n" );while (!dev->configuration_done) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );thor_set_dma (thor_rx_data_buf,strlen ("THOR" ));/* detect the download request from Host PC */
drivers/usb/gadget/fotg210.c +1 -1
@@ -832,7 +832,7 @@ static struct fotg210_chip controller = { }, }; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {struct fotg210_chip *chip = &controller;struct fotg210_regs *regs = chip->regs;
drivers/usb/gadget/pxa25x_udc.c +1 -1
@@ -2041,7 +2041,7 @@ extern void udc_disconnect(void)/*-------------------------------------------------------------------------*/ extern int -usb_gadget_handle_interrupts (void ) +usb_gadget_handle_interrupts (int index) {return pxa25x_udc_irq (); }
drivers/usb/gadget/s3c_udc_otg.c +1 -1
@@ -833,7 +833,7 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata)return retval; } -int usb_gadget_handle_interrupts () +int usb_gadget_handle_interrupts (int index) {u32 intr_status =readl (®->gintsts);u32 gintmsk =readl (®->gintmsk);
drivers/usb/musb-new/musb_uboot.c +1 -1
@@ -162,7 +162,7 @@ int usb_lowlevel_stop(int index)#ifdef CONFIG_MUSB_GADGET static struct musb *gadget; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {WATCHDOG_RESET ();if (!gadget || !gadget->isr)
include/linux/usb/gadget.h +1 -1
@@ -937,6 +937,6 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,extern void usb_ep_autoconfig_reset (struct usb_gadget *); -extern int usb_gadget_handle_interrupts (void ); +extern int usb_gadget_handle_interrupts (int index);#endif /* __LINUX_USB_GADGET_H */
Signature · 1 line
1.7.9.5
PATCH 40/40 usb: modify usb_gadget_handle_interrupts to take controller index
Hi Kishon,
Quoted 285 lines
Since we support multiple dwc3 controllers to be existent at the same time, in order to handle the interrupts of a particular dwc3 controller
usb_gadget_handle_interrutpsshould take controller index as an argument.Hence the API of
usb_gadget_handle_interruptsis modified to take controller index as an argument and made the corresponding changes to all theusb_gadget_handle_interruptscalls.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- board/ti/am43xx/board.c | 6 +++--- board/ti/dra7xx/evm.c | 6 +++--- common/cmd_dfu.c | 2 +- common/cmd_fastboot.c | 2 +- common/cmd_usb_mass_storage.c | 2 +- drivers/usb/gadget/atmel_usba_udc.c | 2 +- drivers/usb/gadget/ci_udc.c | 2 +- drivers/usb/gadget/ether.c | 10 +++++----- drivers/usb/gadget/f_mass_storage.c | 2 +- drivers/usb/gadget/f_thor.c | 6 +++--- drivers/usb/gadget/fotg210.c | 2 +- drivers/usb/gadget/pxa25x_udc.c | 2 +- drivers/usb/gadget/s3c_udc_otg.c | 2 +- drivers/usb/musb-new/musb_uboot.c | 2 +- include/linux/usb/gadget.h | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-)board/ti/am43xx/board.c +3
-3@@ -782,13 +782,13 @@ int board_usb_cleanup(int index, enum usb_init_type init) return 0; } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 status; - status =dwc3_omap_uboot_interrupt_status (0 ); + status =dwc3_omap_uboot_interrupt_status (index);if (status) -dwc3_uboot_handle_interrupt (0 ); +dwc3_uboot_handle_interrupt (index);return 0 ; }board/ti/dra7xx/evm.c +3
-3@@ -220,13 +220,13 @@ int board_usb_cleanup(int index, enum usb_init_type init) return 0; } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 status; - status =dwc3_omap_uboot_interrupt_status (0 ); + status =dwc3_omap_uboot_interrupt_status (index);if (status) -dwc3_uboot_handle_interrupt (0 ); +dwc3_uboot_handle_interrupt (index);return 0 ; }common/cmd_dfu.c +1
-1@@ -64,7 +64,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (controller_index); } exit:g_dnl_unregister ();common/cmd_fastboot.c +1
-1@@ -25,7 +25,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) break;if (ctrlc ())break ; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); }g_dnl_unregister ();(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 2c879ea..c5f909d 100644common/cmd_usb_mass_storage.c +1
-1@@ -137,7 +137,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, }while (1 ) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (controller_index); rc =fsg_main_thread (NULL );if (rc) {(quoted diff) +0
-0
b/drivers/usb/gadget/atmel_usba_udc.cindex fbc74f3..1e23d09 100644drivers/usb/gadget/atmel_usba_udc.c +1
-1@@ -1199,7 +1199,7 @@ static struct usba_udc controller = { }, }; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {struct usba_udc *udc = &controller;drivers/usb/gadget/ci_udc.c +1
-1@@ -741,7 +741,7 @@ void udc_irq(void) } } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {u32 value;struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;drivers/usb/gadget/ether.c +5
-5@@ -1908,7 +1908,7 @@ static int eth_stop(struct eth_dev *dev)/* Wait until host receives OID_GEN_MEDIA_CONNECT_STATUS */ ts =get_timer (0 );while (get_timer (ts) < timeout) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );#endif rndis_uninit (dev->rndis_config);@@ -2359,7 +2359,7 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd) error("The remote end did not respond in time."); goto fail; } -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); } packet_received =0 ;@@ -2427,7 +2427,7 @@ static int usb_eth_send(struct eth_device *netdev, void *packet, int length) printf("timeout sending packets to usb ethernet\n"); return -1; } - usb_gadget_handle_interrupts(); + usb_gadget_handle_interrupts(0); }if (rndis_pkt)free (rndis_pkt);@@ -2442,7 +2442,7 @@ static int usb_eth_recv(struct eth_device *netdev) {struct eth_dev *dev = &l_ethdev; -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );if (packet_received) {debug ("%s: packet received\n" , __func__);@@ -2487,7 +2487,7 @@ void usb_eth_halt(struct eth_device *netdev)/* Clear pending interrupt */ if (dev->network_started) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); dev->network_started =0 ; }(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex e045957..4fab35e 100644drivers/usb/gadget/f_mass_storage.c +1
-1@@ -689,7 +689,7 @@ static int sleep_thread(struct fsg_common *common) k =0 ; } -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); } common->thread_wakeup_needed =0 ;return rc;drivers/usb/gadget/f_thor.c +3
-3@@ -543,7 +543,7 @@ static int thor_rx_data(void) }while (!dev->rxdata) { -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );if (ctrlc ())return -1 ; }@@ -577,7 +577,7 @@ static void thor_tx_data(unsigned char *data, int len)/* Wait until tx interrupt received */ while (!dev->txdata) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 ); dev->txdata =0 ; }@@ -694,7 +694,7 @@ int thor_init(void)/* Wait for a device enumeration and configuration settings */ debug ("THOR enumeration/configuration setting....\n" );while (!dev->configuration_done) -usb_gadget_handle_interrupts (); +usb_gadget_handle_interrupts (0 );thor_set_dma (thor_rx_data_buf,strlen ("THOR" ));/* detect the download request from Host PC */ (quoted diff) +0
-0
b/drivers/usb/gadget/fotg210.cindex 3acf6a1..1d8f58f 100644drivers/usb/gadget/fotg210.c +1
-1@@ -832,7 +832,7 @@ static struct fotg210_chip controller = { }, }; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {struct fotg210_chip *chip = &controller;struct fotg210_regs *regs = chip->regs;(quoted diff) +0
-0
b/drivers/usb/gadget/pxa25x_udc.cindex 8945c5b..1910227 100644drivers/usb/gadget/pxa25x_udc.c +1
-1@@ -2041,7 +2041,7 @@ extern void udc_disconnect(void)/*-------------------------------------------------------------------------*/ extern int -usb_gadget_handle_interrupts (void ) +usb_gadget_handle_interrupts (int index) {return pxa25x_udc_irq (); }(quoted diff) +0
-0
b/drivers/usb/gadget/s3c_udc_otg.cindex 7653f03..7a2d1e7 100644drivers/usb/gadget/s3c_udc_otg.c +1
-1@@ -833,7 +833,7 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata)return retval; } -int usb_gadget_handle_interrupts () +int usb_gadget_handle_interrupts (int index) {u32 intr_status =readl (®->gintsts);u32 gintmsk =readl (®->gintmsk);(quoted diff) +0
-0
b/drivers/usb/musb-new/musb_uboot.cindex 2676f09..79f29fb 100644drivers/usb/musb-new/musb_uboot.c +1
-1@@ -162,7 +162,7 @@ int usb_lowlevel_stop(int index)#ifdef CONFIG_MUSB_GADGET static struct musb *gadget; -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {WATCHDOG_RESET ();if (!gadget || !gadget->isr)include/linux/usb/gadget.h +0
-0
include/linux/usb/gadget.h extern struct usb_ep *usb_ep_autoconfig(struct · line 942
Quoted 7 lines
include/linux/usb/gadget.h +1
-1@@ -937,6 +937,6 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,extern void usb_ep_autoconfig_reset (struct usb_gadget *); -extern int usb_gadget_handle_interrupts (void ); +extern int usb_gadget_handle_interrupts (int index);#endif /* __LINUX_USB_GADGET_H */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
cover dra7xx: am43xx: add dwc3 gadget driver support and enable dfu
In reply to Kishon Vijay Abraham IQuoted 13 lines · Kishon Vijay Abraham I
This patch series ports dwc3 gadget driver from linux kernel (3.19-rc1) to u-boot.
Changes from RFC:
*) A patch has been added to copy the driver from linux kernel to u-boot and then it's modfied to make it work in u-boot. This will help to understand the changes that's been done to make it work in u-boot and will also be easier to review. *) Implemented chained TRB support in dwc3 ep0 so that we need not increase the size of bounce bufferTesting:
*) tested DFU RAM and DFU MMC in dra7xx and am43xx
Quoted 7 lines
TODO:
*) AddKconfigsupport
*) Adapt dwc3 driver to use the driver model.
*) Make composite driver similar to the one in linux kernel.Pushed these patches to
git://git.ti.com/~kishon/ti-u-boot/kishons-ti-u-boot.gitdwc3_upstream_v1
Hi!
I'm fine with this series, maybe just replace "folder" with "directory" in the commit messages ;-) But I can do that myself if you don't mind, no need to repost.
I'd like to hear what Lukasz thinks and then I'll likely just pick it up for this MW.
Thanks!
Best regards,
Marek Vasut
cover dra7xx: am43xx: add dwc3 gadget driver support and enable dfu
Hi,
Quoted 19 lines · Marek Vasut
Quoted 18 lines · Kishon Vijay Abraham I
This patch series ports dwc3 gadget driver from linux kernel (3.19-rc1) to u-boot.
Changes from RFC:
*) A patch has been added to copy the driver from linux kernel to u-boot and then it's modfied to make it work in u-boot. This will help to understand the changes that's been done to make it work in u-boot and will also be easier to review. *) Implemented chained TRB support in dwc3 ep0 so that we need not increase the size of bounce bufferTesting:
*) tested DFU RAM and DFU MMC in dra7xx and am43xxTODO:
*) AddKconfigsupport
*) Adapt dwc3 driver to use the driver model.
*) Make composite driver similar to the one in linux kernel.
Quoted 8 lines
Quoted 2 lines
Pushed these patches to
git://git.ti.com/~kishon/ti-u-boot/kishons-ti-u-boot.gitdwc3_upstream_v1Hi!
I'm fine with this series, maybe just replace "folder" with "directory" in the commit messages ;-) But I can do that myself if you don't mind, no need to repost.
I don't mind :-) Thanks for doing that :-)
Cheers
Kishon