Add support for DM_USB and DM_USB_DEV to TI's am335x and am43xx_evm platforms
Subsystems (6)
v2 cover Add support for DM_USB and DM_USB_DEV to TI's am335x and am43xx_evm platforms
This series applies on top of u-boot-usb/master.
It is available on github:
https://github.com/jjhiblot/u-boot/tree/dm_usb_am335x_am437x_v2_rebased
Travis report is available here:
https://travis-ci.org/jjhiblot/u-boot/builds
The am433x platforms can use the generic DWC3 driver instead of relying on the dwc3-xhci driver.
The am335x platforms use the musb controller. With a bit of work it can be made to support DM as well. This series only enables DM_USB and DM_USB_GADGET on am335x_boneblack_vboot. The changes for the other am335x based platforms will come in a subsequent series that reworks the configs of several TI boards.
This is part of a work to move all TI's platforms to support DM_USB and DM_USB_DEV.
As a side effect it makes it easy to support the full USB RDNIS bootflow (bootrom loads SPL over RNDIS, SPL loads u-boot over RNDIS, u-boot loads the images over RNDIS)
This series is made of 2 parts:
- am437x support for DM_USB and DM_USB_GADGET
- am335x support for DM_USB and DM_USB_GADGET
Tested on:
- am4372 evm
- beaglebone black
- am335x evm (to verify that it doesn't break anything)
Changes in v2:
- use CONFIG_IS_ENABLED(DM_USB_GADGET) instead of CONFIG_DM_USB_GADGET
- use CONFIG_SPL_DM_USB and CONFIG_SPL_DM_USB_GADGET
- don't fail to bind "ti-musb-wrapper" if it is not possible to bind either the host or the gadget driver.
- simplify #ifdef trickery thanks to the new SPL_DM_USB option
Jean-Jacques Hiblot (14):
spl: drivers: Link usb common library to SPL if USB gadget is enabled
spl: net: dm: usb: bind the gadget before attempting to load the image
phy: omap_usb2: Add support for am437x
dwc3-generic: Add support for the am437x
board: ti: am43xx: turn on USB clocks
dts: Add a u-boot specific dtsi file for the am4372
dts: am4372: Enable USB1 in SPL
configs: am43xx_evm: Enable DM_USB and DM_USB_GADGET
configs: am43xx: Enable RNDIS support in SPL
usb: musb-new: Allow the diver not to use the set_phy_power() callback
usb: musb-new: Add support for DM_USB
arm: am33xx: Register USB controllers if DM_USB is used but not
OF_CONTROL
configs: am335x_evm: Do not disable DM_USB in SPL
configs: am335x_boneblack_vboot: enable DM_USB and RNDIS boot in SPl
arch/arm/dts/am4372-generic-u-boot.dtsi | 2 + arch/arm/dts/am4372-u-boot.dtsi | 40 +++++++ arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 2 + arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 2 + arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 2 + arch/arm/include/asm/omap_musb.h | 8 ++ arch/arm/mach-omap2/am33xx/board.c | 58 ++++++++-- board/ti/am43xx/board.c | 22 ++++ common/Makefile | 3 + common/spl/spl_net.c | 4 +- configs/am335x_boneblack_vboot_defconfig | 10 ++ configs/am43xx_evm_defconfig | 19 ++++ drivers/Makefile | 1 + drivers/phy/omap-usb2-phy.c | 45 ++++++-- drivers/usb/dwc3/dwc3-generic.c | 1 + drivers/usb/musb-new/am35x.c | 8 +- drivers/usb/musb-new/musb_dsps.c | 8 +- drivers/usb/musb-new/musb_gadget.c | 11 ++ drivers/usb/musb-new/musb_uboot.c | 4 +- drivers/usb/musb-new/ti-musb.c | 181 +++++++++++++++++++++++-------- include/configs/am335x_evm.h | 1 - 21 files changed, 355 insertions(+), 77 deletions(-) create mode 100644 arch/arm/dts/am4372-u-boot.dtsi
Signature · 1 line
2.7.4
PATCH v2 1/14 spl: drivers: Link usb common library to SPL if USB gadget is enabled
Some drivers might need to access common USB functions such as usb_get_maximum_speed() or usb_get_dr_mode().
---
Changes in v2: None
drivers/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
@@ -47,6 +47,7 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/ obj-$(CONFIG_SPL_USB_ETHER) += net/phy/ obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/ obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/ +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/common/ obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/ obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
Signature · 1 line
2.7.4
PATCH v2 2/14 spl: net: dm: usb: bind the gadget before attempting to load the image
In reply to Jean-Jacques HiblotIf DM_USB_GADGET is used, the usb ethernet gadget driver must be bound to a controller before the image can be downloaded over the network. In u-boot this can be done with the bind command. In SPL it must be done programmatically.
---
Changes in v2:
- use CONFIG_IS_ENABLED(DM_USB_GADGET) instead of CONFIG_DM_USB_GADGET
common/spl/spl_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
common/spl/spl_net.c +3 -1
@@ -85,7 +85,9 @@ int spl_net_load_image_usb(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { bootdev->boot_device_name ="usb_ether" ; - +#if CONFIG_IS_ENABLED (DM_USB_GADGET ) +usb_ether_init (); +#endif return spl_net_load_image (spl_image, bootdev); }SPL_LOAD_IMAGE_METHOD ("USB eth" ,0 ,BOOT_DEVICE_USBETH , spl_net_load_image_usb);
Signature · 1 line
2.7.4
PATCH v2 3/14 phy: omap_usb2: Add support for am437x
In reply to Jean-Jacques Hiblot---
Changes in v2: None
drivers/phy/omap-usb2-phy.c | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-)
drivers/phy/omap-usb2-phy.c +34 -11
@@ -19,6 +19,11 @@#define OMAP_DEV_PHY_PD BIT(0)#define OMAP_USB2_PHY_PD BIT(28) +#define AM437X_USB2_PHY_PD BIT(0) +#define AM437X_USB2_OTG_PD BIT(1) +#define AM437X_USB2_OTGVDET_EN BIT(19) +#define AM437X_USB2_OTGSESSEND_EN BIT(20) +#define USB2PHY_DISCON_BYP_LATCH BIT(31)#define USB2PHY_ANA_CONFIG1 (0x4c)
@@ -60,6 +65,15 @@ static const struct usb_phy_data dra7x_usb2_phy2_data = { .power_off = OMAP_USB2_PHY_PD, }; +static const struct usb_phy_data am437x_usb2_data = { + .label ="am437x_usb2" , + .flags =0 , + .mask =AM437X_USB2_PHY_PD |AM437X_USB2_OTG_PD | +AM437X_USB2_OTGVDET_EN |AM437X_USB2_OTGSESSEND_EN , + .power_on =AM437X_USB2_OTGVDET_EN |AM437X_USB2_OTGSESSEND_EN , + .power_off =AM437X_USB2_PHY_PD |AM437X_USB2_OTG_PD , +}; +static const struct udevice_id omap_usb2_id_table[] = { { .compatible ="ti,omap5-usb2" ,
@@ -73,6 +87,10 @@ static const struct udevice_id omap_usb2_id_table[] = { .compatible = "ti,dra7x-usb2-phy2", .data = (ulong)&dra7x_usb2_phy2_data, }, + { + .compatible = "ti,am437x-usb2", + .data = (ulong)&am437x_usb2_data, + }, {}, };
@@ -170,20 +188,25 @@ int omap_usb2_phy_probe(struct udevice *dev) } regmap =syscon_regmap_lookup_by_phandle (dev,"syscon-phy-power" ); -if (IS_ERR (regmap)) { -printf ("can't get regmap (err %ld)\n" ,PTR_ERR (regmap)); -return PTR_ERR (regmap); +if (!IS_ERR (regmap)) { + priv->pwr_regmap = regmap; + rc =dev_read_u32_array (dev,"syscon-phy-power" , tmp,2 ); +if (rc) { +printf ("couldn't get power reg. offset (err %d)\n" , rc); +return rc; + } + priv->pwr_reg_offset = tmp[1 ]; +return 0 ; } - priv->pwr_regmap = regmap; - - rc =dev_read_u32_array (dev,"syscon-phy-power" , tmp,2 ); -if (rc) { -printf ("couldn't get power reg. offset (err %d)\n" , rc); -return rc; + regmap =syscon_regmap_lookup_by_phandle (dev,"ctrl-module" ); +if (!IS_ERR (regmap)) { + priv->pwr_regmap = regmap; + priv->pwr_reg_offset =0 ; +return 0 ; } - priv->pwr_reg_offset = tmp[1 ]; -return 0 ; +printf ("can't get regmap (err %ld)\n" ,PTR_ERR (regmap)); +return PTR_ERR (regmap); }U_BOOT_DRIVER (omap_usb2_phy) = {
Signature · 1 line
2.7.4
PATCH v2 4/14 dwc3-generic: Add support for the am437x
In reply to Jean-Jacques Hiblot---
Changes in v2: None
drivers/usb/dwc3/dwc3-generic.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-generic.c +1 -0
@@ -344,6 +344,7 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "xlnx,zynqmp-dwc3" }, { .compatible = "ti,keystone-dwc3"}, { .compatible = "ti,dwc3", .data = (ulong)&ti_ops }, + { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops }, { } };
Signature · 1 line
2.7.4
PATCH v2 5/14 board: ti: am43xx: turn on USB clocks
In reply to Jean-Jacques HiblotEnable USB clocks in late init stage to support ports under DM_USB.
---
Changes in v2:
- use CONFIG_IS_ENABLED(DM_USB_GADGET) instead of CONFIG_DM_USB_GADGET
board/ti/am43xx/board.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
board/ti/am43xx/board.c +22 -0
@@ -681,6 +681,19 @@ int board_init(void) }#ifdef CONFIG_BOARD_LATE_INIT +#if CONFIG_IS_ENABLED (DM_USB ) &&CONFIG_IS_ENABLED (OF_CONTROL ) +static int device_okay (const char *path) +{ +int node; + + node =fdt_path_offset (gd->fdt_blob, path); +if (node <0 ) +return 0 ; + +return fdtdec_get_is_enabled (gd->fdt_blob, node); +} +#endif +int board_late_init (void ) {#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -693,10 +706,18 @@ int board_late_init(void)if (get_device_type () ==HS_DEVICE )env_set ("boot_fit" ,"1" );#endif + +#if CONFIG_IS_ENABLED (DM_USB ) &&CONFIG_IS_ENABLED (OF_CONTROL ) +if (device_okay ("/ocp/omap_dwc3 at 48380000" )) +enable_usb_clocks (0 ); +if (device_okay ("/ocp/omap_dwc3 at 483c0000" )) +enable_usb_clocks (1 ); +#endif return 0 ; }#endif +#if !CONFIG_IS_ENABLED (DM_USB_GADGET )#ifdef CONFIG_USB_DWC3 static struct dwc3_device usb_otg_ss1 = { .maximum_speed = USB_SPEED_HIGH,
@@ -799,6 +820,7 @@ int board_usb_cleanup(int index, enum usb_init_type init)return 0 ; }#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */ +#endif /* !CONFIG_IS_ENABLED(DM_USB_GADGET) */ #ifdef CONFIG_DRIVER_TI_CPSW
Signature · 1 line
2.7.4
PATCH v2 6/14 dts: Add a u-boot specific dtsi file for the am4372
In reply to Jean-Jacques HiblotThis file is used to override the values found in am4372.dtsi Use it to fix the "compatible" options for the controllers used to support the USB (parent bus and syscons).
---
Changes in v2: None
arch/arm/dts/am4372-generic-u-boot.dtsi | 2 ++ arch/arm/dts/am4372-u-boot.dtsi | 20 ++++++++++++++++++++ arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 2 ++ arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 2 ++ arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 2 ++ 5 files changed, 28 insertions(+) create mode 100644 arch/arm/dts/am4372-u-boot.dtsi
arch/arm/dts/am4372-generic-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ */ +#include "am4372-u-boot.dtsi" + /{ ocp { u-boot,dm-pre-reloc;
arch/arm/dts/am4372-u-boot.dtsi new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + */ + +&am43xx_control_usb2phy1 { + compatible = "ti,control-phy-usb2-am437", "syscon"; +}; + +&am43xx_control_usb2phy2 { + compatible = "ti,control-phy-usb2-am437", "syscon"; +}; + +&ocp2scp0 { + compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp", "simple-bus"; +}; + +&ocp2scp1 { + compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp", "simple-bus"; +};
arch/arm/dts/am437x-gp-evm-u-boot.dtsi +2 -0
@@ -7,6 +7,8 @@ * Based on "dra7.dtsi" */ +#include "am4372-u-boot.dtsi" + /{ ocp { u-boot,dm-spl;
arch/arm/dts/am437x-idk-evm-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ */ +#include "am4372-u-boot.dtsi" + /{ ocp { u-boot,dm-spl;
arch/arm/dts/am437x-sk-evm-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ */ +#include "am4372-u-boot.dtsi" + /{ ocp { u-boot,dm-spl;
Signature · 1 line
2.7.4
PATCH v2 7/14 dts: am4372: Enable USB1 in SPL
In reply to Jean-Jacques HiblotUSB1 can be used by the romboot on all am4372 platforms to download a firmware (SPL in our case).
It makes sense to enable USB1 in the SPL to download u-boot.
---
Changes in v2: None
arch/arm/dts/am4372-u-boot.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm/dts/am4372-u-boot.dtsi +20 -0
@@ -18,3 +18,23 @@ &ocp2scp1 { compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp", "simple-bus"; }; + +&dwc3_1 { + u-boot,dm-spl; +}; + +&usb1 { + u-boot,dm-spl; +}; + +&usb2_phy1 { + u-boot,dm-spl; +}; + +&am43xx_control_usb2phy1 { + u-boot,dm-spl; +}; + +&ocp2scp0 { + u-boot,dm-spl; +};
Signature · 1 line
2.7.4
PATCH v2 8/14 configs: am43xx_evm: Enable DM_USB and DM_USB_GADGET
In reply to Jean-Jacques HiblotEnable DM_USB and DM_USB_GADGET for AM43xx EVM boards.
---
Changes in v2: None
configs/am43xx_evm_defconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
configs/am43xx_evm_defconfig +8 -0
@@ -27,11 +27,14 @@ CONFIG_DEFAULT_DEVICE_TREE="am437x-gp-evm" CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_DM=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y CONFIG_DM_GPIO=y +CONFIG_MISC=y CONFIG_DM_MMC=y CONFIG_MMC_OMAP_HS=y CONFIG_NAND=y
@@ -40,17 +43,22 @@ CONFIG_SPI_FLASH_MACRONIX=y CONFIG_DRIVER_TI_CPSW=y CONFIG_PHY_GIGE=y CONFIG_MII=y +CONFIG_PHY=y +CONFIG_OMAP_USB2_PHY=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y CONFIG_USB_DWC3_OMAP=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_DWC3_PHY_OMAP=y CONFIG_OMAP_USB_PHY=y CONFIG_USB_STORAGE=y
Signature · 1 line
2.7.4
PATCH v2 9/14 configs: am43xx: Enable RNDIS support in SPL
In reply to Jean-Jacques HiblotThe AM43xx SOCs have the ability to download the SPl through USB (RNDIS). Adding support for RNDIS in SPL allows to also download u-boot through USB.
---
Changes in v2:
- use CONFIG_SPL_DM_USB and CONFIG_SPL_DM_USB_GADGET
configs/am43xx_evm_defconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)
configs/am43xx_evm_defconfig +11 -0
@@ -3,6 +3,7 @@ CONFIG_ARCH_OMAP2PLUS=y CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_AM43XX=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y
@@ -12,7 +13,11 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_MISC_INIT_R is not set CONFIG_VERSION_VARIABLE=y CONFIG_SPL_MTD_SUPPORT=y +CONFIG_SPL_NET_SUPPORT=y +CONFIG_SPL_NET_VCI_STRING="AM43xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_ETHER=y CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x00100000 CONFIG_CMD_SPL_WRITE_SIZE=0x40000
@@ -28,7 +33,9 @@ CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_DM=y CONFIG_REGMAP=y +CONFIG_SPL_REGMAP=y CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y
@@ -44,6 +51,7 @@ CONFIG_DRIVER_TI_CPSW=y CONFIG_PHY_GIGE=y CONFIG_MII=y CONFIG_PHY=y +CONFIG_SPL_PHY=y CONFIG_OMAP_USB2_PHY=y CONFIG_DM_SERIAL=y CONFIG_SPI=y
@@ -52,7 +60,9 @@ CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_SPL_DM_USB=y CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y
@@ -67,3 +77,4 @@ CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0403 CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00 CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_USB_ETHER=y
Signature · 1 line
2.7.4
PATCH v2 10/14 usb: musb-new: Allow the diver not to use the set_phy_power() callback
In reply to Jean-Jacques HiblotThe set_phy_power() callback is part of struct omap_musb_board_data. This structure is part of the platform data passed to the musb-new driver. This does not really fit with the Driver Model, so allow not to use struct omap_musb_board_data to turn the phy on or off.
---
Changes in v2: None
drivers/usb/musb-new/am35x.c | 8 ++++---- drivers/usb/musb-new/musb_dsps.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/usb/musb-new/am35x.c +4 -4
@@ -406,7 +406,7 @@ static int am35x_musb_init(struct musb *musb)musb_writel (reg_base,USB_CTRL_REG ,AM35X_SOFT_RESET_MASK );/* Start the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,1 );msleep (5 );
@@ -437,7 +437,7 @@ static int am35x_musb_exit(struct musb *musb)#endif /* Shutdown the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,0 );#ifndef __UBOOT__
@@ -628,7 +628,7 @@ static int am35x_suspend(struct device *dev)struct omap_musb_board_data *data = plat->board_data;/* Shutdown the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,0 );clk_disable (glue->phy_clk);
@@ -645,7 +645,7 @@ static int am35x_resume(struct device *dev)int ret;/* Start the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,1 ); ret =clk_enable (glue->phy_clk);
drivers/usb/musb-new/musb_dsps.c +4 -4
@@ -450,7 +450,7 @@ static int dsps_musb_init(struct musb *musb)dsps_writel (reg_base, wrp->control, (1 << wrp->reset));/* Start the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,1 ); musb->isr = dsps_interrupt;
@@ -491,7 +491,7 @@ static int dsps_musb_exit(struct musb *musb)#endif /* Shutdown the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,0 );#ifndef __UBOOT__
@@ -691,7 +691,7 @@ static int dsps_suspend(struct device *dev)struct omap_musb_board_data *data = plat->board_data;/* Shutdown the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,0 );return 0 ;
@@ -703,7 +703,7 @@ static int dsps_resume(struct device *dev)struct omap_musb_board_data *data = plat->board_data;/* Start the on-chip PHY and its PLL. */ -if (data->set_phy_power) +if (data && data->set_phy_power) data->set_phy_power (data->dev,1 );return 0 ;
Signature · 1 line
2.7.4
PATCH v2 11/14 usb: musb-new: Add support for DM_USB
In reply to Jean-Jacques HiblotEnable DM for USB peripheral in the musb-new driver. Also make sure that the driver can be used in the SPL. This implies that:
* the driver must work with and without the OF_CONTROL option. That in turn, implies that the platform data can be passed in a struct ti_musb_platdata or be read from the dtb
* usb.o is linked in the SPL if host support is enabled
Another change is that the driver does not fail to bind (and stop the boot process) if one of the child driver does not bind. Reporting the error is enough. This kind of error would appear if the port is configured in the DTS but the driver is not activated in the config.
---
Changes in v2:
- use CONFIG_IS_ENABLED(DM_USB_GADGET) instead of CONFIG_DM_USB_GADGET
- don't fail to bind "ti-musb-wrapper" if it is not possible to bind either the host or the gadget driver.
arch/arm/include/asm/omap_musb.h | 8 ++ common/Makefile | 3 + drivers/usb/musb-new/musb_gadget.c | 11 +++ drivers/usb/musb-new/musb_uboot.c | 4 +- drivers/usb/musb-new/ti-musb.c | 181 +++++++++++++++++++++++++++---------- 5 files changed, 159 insertions(+), 48 deletions(-)
arch/arm/include/asm/omap_musb.h +8 -0
@@ -7,6 +7,7 @@#ifndef __ASM_ARM_OMAP_MUSB_H#define __ASM_ARM_OMAP_MUSB_H +#include <linux/usb/musb.h> extern struct musb_platform_ops musb_dsps_ops;extern const struct musb_platform_ops am35x_ops;
@@ -21,4 +22,11 @@ struct omap_musb_board_data { };enum musb_interface {MUSB_INTERFACE_ULPI ,MUSB_INTERFACE_UTMI }; + +struct ti_musb_platdata { +void *base; +void *ctrl_mod_base; +struct musb_hdrc_platform_data plat; +}; +#endif /* __ASM_ARM_OMAP_MUSB_H */
common/Makefile +3 -0
@@ -74,9 +74,12 @@ obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o + ifdef CONFIG_SPL_USB_HOST_SUPPORT obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o obj-$(CONFIG_USB_STORAGE) += usb_storage.o +else +obj-$(CONFIG_USB_MUSB_HOST) += usb.o endif endif # CONFIG_SPL_BUILD
drivers/usb/musb-new/musb_gadget.c +11 -0
@@ -1775,6 +1775,14 @@ static int musb_gadget_start(struct usb_gadget *g, struct usb_gadget_driver *driver);static int musb_gadget_stop (struct usb_gadget *g,struct usb_gadget_driver *driver); +#else +static int musb_gadget_stop (struct usb_gadget *g) +{ +struct musb *musb =gadget_to_musb (g); + +musb_stop (musb); +return 0 ; +}#endif static const struct usb_gadget_ops musb_gadget_operations = {
@@ -1787,6 +1795,9 @@ static const struct usb_gadget_ops musb_gadget_operations = {#ifndef __UBOOT__ .udc_start = musb_gadget_start, .udc_stop = musb_gadget_stop, +#else + .udc_start = musb_gadget_start, + .udc_stop = musb_gadget_stop,#endif };
drivers/usb/musb-new/musb_uboot.c +2 -2
@@ -367,7 +367,7 @@ struct dm_usb_ops musb_usb_ops = {#endif /* CONFIG_IS_ENABLED(DM_USB) */ #endif /* CONFIG_USB_MUSB_HOST */ -#ifdef CONFIG_USB_MUSB_GADGET +#if defined(CONFIG_USB_MUSB_GADGET ) && !CONFIG_IS_ENABLED (DM_USB_GADGET )static struct musb *gadget;int usb_gadget_handle_interrupts (int index)
@@ -430,7 +430,7 @@ struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata, musbp = &musb_host.host;break ;#endif -#ifdef CONFIG_USB_MUSB_GADGET +#if defined(CONFIG_USB_MUSB_GADGET ) && !CONFIG_IS_ENABLED (DM_USB_GADGET )case MUSB_PERIPHERAL : musbp = &gadget;break ;
drivers/usb/musb-new/ti-musb.c +135 -46
297 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 12/14 arm: am33xx: Register USB controllers if DM_USB is used but not OF_CONTROL
In reply to Jean-Jacques HiblotWhen DM_USB is used, either the USB controllers are bound when the DTB is parsed (when OF_CONTROL is enabled) or they are bound using the U_BOOT_DEVICES() macro.
In the later case, the platform data is passed in a struct ti_musb_platdata because it cannot be read from the DTB.
---
Changes in v2:
- simplify #ifdef trickery thanks to the new SPL_DM_USB option
arch/arm/mach-omap2/am33xx/board.c | 58 ++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/am33xx/board.c +50 -8
@@ -159,7 +159,55 @@ int cpu_mmc_init(bd_t *bis)/* AM33XX has two MUSB controllers which can be host or gadget */ #if (defined(CONFIG_USB_MUSB_GADGET ) || defined(CONFIG_USB_MUSB_HOST )) && \ (defined(CONFIG_AM335X_USB0 ) || defined(CONFIG_AM335X_USB1 )) && \ - (!defined(CONFIG_DM_USB )) + (!CONFIG_IS_ENABLED (DM_USB ) || !CONFIG_IS_ENABLED (OF_CONTROL )) && \ + (!defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_MUSB_NEW_SUPPORT )) + +static struct musb_hdrc_config musb_config = { + .multipoint =1 , + .dyn_fifo =1 , + .num_eps =16 , + .ram_bits =12 , +}; + +#if CONFIG_IS_ENABLED (DM_USB ) && !CONFIG_IS_ENABLED (OF_CONTROL ) +static struct ti_musb_platdata usb0 = { + .base = (void *)USB0_OTG_BASE , + .ctrl_mod_base = &((struct ctrl_dev *)CTRL_DEVICE_BASE )->usb_ctrl0, + .plat = { + .config = &musb_config, + .power =50 , + .platform_ops = &musb_dsps_ops, + }, +}; + +static struct ti_musb_platdata usb1 = { + .base = (void *)USB1_OTG_BASE , + .ctrl_mod_base = &((struct ctrl_dev *)CTRL_DEVICE_BASE )->usb_ctrl1, + .plat = { + .config = &musb_config, + .power =50 , + .platform_ops = &musb_dsps_ops, + }, +}; + +U_BOOT_DEVICES (am33xx_usbs) = { +#if CONFIG_AM335X_USB0_MODE == MUSB_PERIPHERAL + {"ti-musb-peripheral" , &usb0 }, +#elif CONFIG_AM335X_USB0_MODE == MUSB_HOST + {"ti-musb-host" , &usb0 }, +#endif +#if CONFIG_AM335X_USB1_MODE == MUSB_PERIPHERAL + {"ti-musb-peripheral" , &usb1 }, +#elif CONFIG_AM335X_USB1_MODE == MUSB_HOST + {"ti-musb-host" , &usb1 }, +#endif +}; + +int arch_misc_init (void ) +{ +return 0 ; +} +#else static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE ;/* USB 2.0 PHY Control */
@@ -178,13 +226,6 @@ static void am33xx_usb_set_phy_power(u8 on, u32 *reg_addr) } } -static struct musb_hdrc_config musb_config = { - .multipoint =1 , - .dyn_fifo =1 , - .num_eps =16 , - .ram_bits =12 , -}; -#ifdef CONFIG_AM335X_USB0 static void am33xx_otg0_set_phy_power (struct udevice *dev,u8 on) {
@@ -235,6 +276,7 @@ int arch_misc_init(void)#endif return 0; } +#endif #else /* CONFIG_USB_MUSB_* && CONFIG_AM335X_USB* && !CONFIG_DM_USB */
Signature · 1 line
2.7.4
PATCH v2 13/14 configs: am335x_evm: Do not disable DM_USB in SPL
In reply to Jean-Jacques HiblotDM_USB is now supported in the SPL. Do not undef it Besides to support DM_USB in SPL, one now has to use SPL_DM_USB
---
Changes in v2: None
include/configs/am335x_evm.h | 1 - 1 file changed, 1 deletion(-)
include/configs/am335x_evm.h +0 -1
@@ -253,7 +253,6 @@#ifdef CONFIG_SPL_BUILD #undef CONFIG_DM_MMC#undef CONFIG_TIMER -#undef CONFIG_DM_USB#endif #if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_USB_ETHER )
Signature · 1 line
2.7.4
PATCH v2 14/14 configs: am335x_boneblack_vboot: enable DM_USB and RNDIS boot in SPl
In reply to Jean-Jacques HiblotEnable DM_USB and DM_USB_GADGET for this platform. Also enable RNDIS boot support (SPL load u-boot over USB RNDIS).
This is an example of how to use DM_USB on a am335x-based board. A subsequent series will take this a step further and modify more defconfigs.
---
Changes in v2: None
configs/am335x_boneblack_vboot_defconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
configs/am335x_boneblack_vboot_defconfig +10 -0
@@ -13,7 +13,11 @@ CONFIG_VERSION_VARIABLE=y CONFIG_ARCH_MISC_INIT=y CONFIG_SPL_MUSB_NEW_SUPPORT=y # CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_SPL_NET_SUPPORT=y +CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_ETHER=y CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_DELAY_STR="d"
@@ -31,6 +35,7 @@ CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_DM_I2C=y +CONFIG_MISC=y CONFIG_DM_MMC=y CONFIG_MMC_OMAP_HS=y CONFIG_SPI_FLASH=y
@@ -44,8 +49,13 @@ CONFIG_OMAP3_SPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_SPL_DM_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y CONFIG_USB_MUSB_HOST=y CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_MUSB_TI=y CONFIG_USB_MUSB_DSPS=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y
Signature · 1 line
2.7.4
PATCH v2 14/14 configs: am335x_boneblack_vboot: enable DM_USB and RNDIS boot in SPl
Quoted 8 lines · Jean-Jacques Hiblot
Enable
DM_USBandDM_USB_GADGETfor this platform. Also enable RNDIS boot support (SPL load u-boot over USB RNDIS).
This is an example of how to useDM_USBon a am335x-based board. A subsequent series will take this a step further and modify more defconfigs.Signed-off-by Jean-Jacques Hiblot <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181204/0a6a6f18/attachment.sig>