Introduce fastboot support for dragonboard410c
Subsystems (5)
cover Introduce fastboot support for dragonboard410c
This set of patches introduce fastboot support for Qualcomm db410c.
As part of the patch, a small quirk is added to ci_udc through a weaklly linked function.
Ramon Fried (13):
ehci: Replace board_prepare_usb with board_usb_init
ehci: msm: Add missing platdata
dts: db410c: add alias for USB
db410c: serial# env using msm board serial
phy: db410c: Add MSM USB PHY driver
dts: db410c: Add bindings for MSM USB phy
configs: db410c: Enable USB PHY
ehci: msm: switch to generic PHY uclass
ehci: msm: use init_type in probe usb:ci_udc: Introduce init_after_reset phy function
usb: ehci-msm: Add init_after_reset for CI_UDC
DB410c: Enable fastboot support
db410c: automatically launch fastboot
MAINTAINERS | 1 + arch/arm/dts/dragonboard410c.dts | 11 ++ arch/arm/mach-snapdragon/Kconfig | 1 + .../dragonboard410c/dragonboard410c.c | 17 ++- configs/dragonboard410c_defconfig | 11 ++ drivers/phy/Kconfig | 8 ++ drivers/phy/Makefile | 1 + drivers/phy/msm8916-usbh-phy.c | 109 ++++++++++++++++++ drivers/usb/gadget/ci_udc.c | 6 + drivers/usb/host/Kconfig | 3 +- drivers/usb/host/ehci-msm.c | 78 +++++-------- 11 files changed, 190 insertions(+), 56 deletions(-) create mode 100644 drivers/phy/msm8916-usbh-phy.c
Signature · 1 line
2.18.0
PATCH 1/13 ehci: Replace board_prepare_usb with board_usb_init
Use standard board_usb_init() instead of the specific board_prepare_usb.
---
board/qualcomm/dragonboard410c/dragonboard410c.c | 4 ++-- drivers/usb/host/ehci-msm.c | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +2 -2
@@ -44,7 +44,7 @@ int dram_init_banksize(void)return 0 ; } -int board_prepare_usb (enum usb_init_type type) +int board_usb_init (int index,enum usb_init_type init) {static struct udevice *pmic_gpio;static struct gpio_desc hub_reset, usb_sel;
@@ -93,7 +93,7 @@ int board_prepare_usb(enum usb_init_type type) } } -if (type ==USB_INIT_HOST ) { +if (init ==USB_INIT_HOST ) {/* Start USB Hub */ dm_gpio_set_dir_flags (&hub_reset,GPIOD_IS_OUT |GPIOD_IS_OUT_ACTIVE );
drivers/usb/host/ehci-msm.c +2 -7
@@ -38,11 +38,6 @@ struct msm_ehci_priv {struct ulpi_viewport ulpi_vp;/* ULPI Viewport */ }; -int __weak board_prepare_usb (enum usb_init_type type) -{ -return 0 ; -} -static void setup_usb_phy (struct msm_ehci_priv *priv) {/* Select and enable external configuration with USB PHY */
@@ -102,7 +97,7 @@ static int ehci_usb_probe(struct udevice *dev) hcor = (struct ehci_hcor *)((phys_addr_t )hccr +HC_LENGTH (ehci_readl (&(hccr)->cr_capbase))); - ret =board_prepare_usb (USB_INIT_HOST ); + ret =board_usb_init (0 ,USB_INIT_HOST );if (ret <0 )return ret;
@@ -124,7 +119,7 @@ static int ehci_usb_remove(struct udevice *dev)reset_usb_phy (p); - ret =board_prepare_usb (USB_INIT_DEVICE );/* Board specific hook */ + ret =board_usb_init (0 ,USB_INIT_DEVICE );/* Board specific hook */ if (ret <0 )return ret;
Signature · 1 line
2.18.0
PATCH 2/13 ehci: msm: Add missing platdata
In reply to Ramon Friedplatdata_auto_alloc_size was not initialized in structure. Caused null pointer dereference when configuring device as gadget.
---
drivers/usb/host/ehci-msm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-msm.c +1 -0
@@ -167,5 +167,6 @@ U_BOOT_DRIVER(usb_ehci) = { .remove = ehci_usb_remove, .ops = &ehci_usb_ops, .priv_auto_alloc_size = sizeof(struct msm_ehci_priv), + .platdata_auto_alloc_size = sizeof(struct usb_platdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, };
Signature · 1 line
2.18.0
PATCH 3/13 dts: db410c: add alias for USB
In reply to Ramon FriedAlias is required so req-seq will be filled.
---
arch/arm/dts/dragonboard410c.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/dts/dragonboard410c.dts +4 -0
@@ -18,6 +18,10 @@ #address-cells = <0x2>; #size-cells = <0x2>; + aliases { + usb0 = "/soc/ehci at 78d9000"; + }; + memory { device_type = "memory"; reg = <0 0x80000000 0 0x3da00000>;
Signature · 1 line
2.18.0
PATCH 3/13 dts: db410c: add alias for USB
This should go into a -u-boot.dtsi file so that the dragonboard410c.dts can be synced from the linux kernel without change.
Peter
Quoted 31 lines · Ramon Fried
Alias is required so req-seq will be filled.
Signed-off-by Ramon Fried <[email protected]>---
arch/arm/dts/dragonboard410c.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/dragonboard410c.dts +4
-1@@ -18,6 +18,10 @@ #address-cells = <0x2>; #size-cells = <0x2>; + aliases { + usb0 = "/soc/ehci at 78d9000"; + }; + memory { device_type = "memory"; reg = <0 0x80000000 0 0x3da00000>; --2.18.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 3/13 dts: db410c: add alias for USB
Quoted 5 lines · Peter Robinson
This should go into a
-u-boot.dtsifile so that thedragonboard410c.dtscan be synced from the linux kernel without change.
Hi Peter.
I thought that -u-boot.dtsi is only for u-boot specific stuff, The alias is not specific to u-boot AFAIK.
I'll look how other boards handle that.
Thanks,
Ramon.
Quoted 34 lines
Peter
Quoted 31 lines · Ramon Fried
Alias is required so req-seq will be filled.
Signed-off-by Ramon Fried <[email protected]>---
arch/arm/dts/dragonboard410c.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/dragonboard410c.dts +4
-1@@ -18,6 +18,10 @@ #address-cells = <0x2>; #size-cells = <0x2>; + aliases { + usb0 = "/soc/ehci at 78d9000"; + }; + memory { device_type = "memory"; reg = <0 0x80000000 0 0x3da00000>; --2.18.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 3/13 dts: db410c: add alias for USB
Quoted 7 lines
Quoted 4 lines
This should go into a
-u-boot.dtsifile so that thedragonboard410c.dtscan be synced from the linux kernel without change.Hi Peter.
I thought that-u-boot.dtsiis only for u-boot specific stuff, The alias is not specific to u-boot AFAIK.
Yes, I did wonder if some of these changes should also into linux.
Peter
Quoted 37 lines
I'll look how other boards handle that.
Thanks,
Ramon.Quoted 34 lines
Peter
Quoted 31 lines · Ramon Fried
Alias is required so req-seq will be filled.
Signed-off-by Ramon Fried <[email protected]>---
arch/arm/dts/dragonboard410c.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/dragonboard410c.dts +4
-1@@ -18,6 +18,10 @@ #address-cells = <0x2>; #size-cells = <0x2>; + aliases { + usb0 = "/soc/ehci at 78d9000"; + }; + memory { device_type = "memory"; reg = <0 0x80000000 0 0x3da00000>; --2.18.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 4/13 db410c: serial# env using msm board serial
In reply to Ramon FriedThe serial# environment variable needs to be
defined so it will be used by fastboot as serial
for the endpoint descriptor.
---
arch/arm/mach-snapdragon/Kconfig | 1 + board/qualcomm/dragonboard410c/dragonboard410c.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
arch/arm/mach-snapdragon/Kconfig +1 -0
@@ -14,6 +14,7 @@ choice config TARGET_DRAGONBOARD410C bool "96Boards Dragonboard 410C" + select BOARD_LATE_INIT help Support for 96Boards Dragonboard 410C. This board complies with 96Board Open Platform Specifications. Features:
board/qualcomm/dragonboard410c/dragonboard410c.c +10 -0
@@ -151,6 +151,16 @@ int board_init(void)return 0 ; } +int board_late_init (void ) +{ +char serial[16 ]; + +memset (serial,0 ,16 ); +snprintf (serial,13 ,"%x" ,msm_board_serial ()); +env_set ("serial#" , serial); +return 0 ; +} +/* Fixup of DTB for Linux Kernel * 1. Fixup installed DRAM. * 2. Fixup WLAN/BT Mac address:
Signature · 1 line
2.18.0
PATCH 5/13 phy: db410c: Add MSM USB PHY driver
In reply to Ramon FriedAdd a PHY driver for the Qualcomm dragonboard 410c which allows switching on/off and resetting the phy connected to the EHCI controllers and USBHS controller.
---
MAINTAINERS | 1 + drivers/phy/Kconfig | 8 +++ drivers/phy/Makefile | 1 + drivers/phy/msm8916-usbh-phy.c | 109 +++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 drivers/phy/msm8916-usbh-phy.c
MAINTAINERS +1 -0
@@ -209,6 +209,7 @@ S: Maintained F: arch/arm/mach-snapdragon/ F: drivers/gpio/msm_gpio.c F: drivers/mmc/msm_sdhci.c +F: drivers/phy/msm8916-usbh-phy.c F: drivers/serial/serial_msm.c F: drivers/smem/msm_smem.c F: drivers/usb/host/ehci-msm.c
drivers/phy/Kconfig +8 -0
@@ -139,4 +139,12 @@ config MESON_GXL_USB_PHY This is the generic phy driver for the Amlogic Meson GXL USB2 and USB3 PHYS. +config MSM8916_USB_PHY + bool "Qualcomm MSM8916 USB PHY support" + depends on PHY + help + Support the USB PHY in msm8916 + + This PHY is found on qualcomm dragonboard410c development board. + endmenu
drivers/phy/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o meson-gxl-usb3.o +obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
drivers/phy/msm8916-usbh-phy.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH 6/13 dts: db410c: Add bindings for MSM USB phy
In reply to Ramon Fried---
arch/arm/dts/dragonboard410c.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/dts/dragonboard410c.dts +7 -0
@@ -97,6 +97,13 @@ ehci at 78d9000 { compatible = "qcom,ehci-host"; reg = <0x78d9000 0x400>; + phys = <&ehci_phy>; + }; + + ehci_phy: ehci_phy at 78d9000 { + compatible = "qcom,apq8016-usbphy"; + reg = <0x78d9000 0x400>; + #phy-cells = <0>; }; sdhci at 07824000 {
Signature · 1 line
2.18.0
PATCH 7/13 configs: db410c: Enable USB PHY
In reply to Ramon FriedEnable USB PHY driver.
Also fixed the alphabetically ordering of the config.
---
configs/dragonboard410c_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/dragonboard410c_defconfig +1 -0
@@ -29,6 +29,7 @@ CONFIG_LED_GPIO=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MSM=y +CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_DM_PMIC=y
Signature · 1 line
2.18.0
PATCH 8/13 ehci: msm: switch to generic PHY uclass
In reply to Ramon FriedAll the underlying USB PHY was handled in the ehci driver. Use the generic phy API instead.
---
drivers/usb/host/Kconfig | 3 +-- drivers/usb/host/ehci-msm.c | 52 +++++++------------------------------ 2 files changed, 10 insertions(+), 45 deletions(-)
drivers/usb/host/Kconfig +1 -2
@@ -167,12 +167,11 @@ config USB_EHCI_MSM bool "Support for Qualcomm on-chip EHCI USB controller" depends on DM_USB select USB_ULPI_VIEWPORT + select MSM8916_USB_PHY default n ---help--- Enables support for the on-chip EHCI controller on Qualcomm Snapdragon SoCs. - This driver supports combination of Chipidea USB controller - and Synapsys USB PHY in host mode only. config USB_EHCI_PCI bool "Support for PCI-based EHCI USB controller"
drivers/usb/host/ehci-msm.c +9 -43
81 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH 9/13 ehci: msm: use init_type in probe
In reply to Ramon FriedChange ehci_usb_probe() function to initialize the USB according to the init_type provided.
---
drivers/usb/host/ehci-msm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-msm.c +4 -2
@@ -49,6 +49,7 @@ static int ehci_usb_probe(struct udevice *dev) {struct msm_ehci_priv *p =dev_get_priv (dev);struct usb_ehci *ehci = p->ehci; +struct usb_platdata *plat =dev_get_platdata (dev);struct ehci_hccr *hccr;struct ehci_hcor *hcor;int ret;
@@ -61,11 +62,12 @@ static int ehci_usb_probe(struct udevice *dev)if (ret)return ret; - ret =board_usb_init (0 ,USB_INIT_HOST ); + ret =board_usb_init (0 , plat->init_type);if (ret <0 )return ret; -return ehci_register (dev, hccr, hcor, &msm_ehci_ops,0 ,USB_INIT_HOST ); +return ehci_register (dev, hccr, hcor, &msm_ehci_ops,0 , + plat->init_type); }static int ehci_usb_remove (struct udevice *dev)
Signature · 1 line
2.18.0
PATCH 10/13 usb:ci_udc: Introduce init_after_reset phy function
In reply to Ramon FriedMSM variant of Chipidea must reinitalize the phy after controller reset.
Introduce ci_init_after_reset() weak function that can be used to achieve the above init.
---
drivers/usb/gadget/ci_udc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/gadget/ci_udc.c +6 -0
@@ -104,6 +104,10 @@ static struct usb_ep_ops ci_ep_ops = { .free_request = ci_ep_free_request, }; +__weak void ci_init_after_reset (struct ehci_ctrl *ctrl) +{ +} +/* Init values for USB endpoints. */ static const struct usb_ep ci_ep_init[5 ] = { [0 ] = {/* EP 0 */
@@ -887,6 +891,8 @@ static int ci_pullup(struct usb_gadget *gadget, int is_on)writel (USBCMD_ITC (MICRO_8FRAME ) |USBCMD_RST , &udc->usbcmd);udelay (200 ); +ci_init_after_reset (controller.ctrl); +writel ((unsigned long )controller.epts, &udc->epinitaddr);/* select DEVICE mode */
Signature · 1 line
2.18.0
PATCH 11/13 usb: ehci-msm: Add init_after_reset for CI_UDC
In reply to Ramon FriedMSM uses the chipidea controller IP, however it requires to reinit the phy after controller reset. in EHCI mode there's a dedicated callback for it.
In device mode however there's no such callback.
Add implementaion of ci_init_after_reset() to implement the above requirement in case CI_UDC driver is used.
---
drivers/usb/host/ehci-msm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/host/ehci-msm.c +12 -0
@@ -121,6 +121,18 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)return 0 ; } +#if defined(CONFIG_CI_UDC ) +/* Little quirk that MSM needs with Chipidea controller +* Must reinit phy after reset +*/ +void ci_init_after_reset (struct ehci_ctrl *ctrl) +{ +struct msm_ehci_priv *p = ctrl->priv; + +generic_phy_reset (&p->phy); +} +#endif +static const struct udevice_id ehci_usb_ids[] = { { .compatible ="qcom,ehci-host" , }, { }
Signature · 1 line
2.18.0
PATCH 12/13 DB410c: Enable fastboot support
In reply to Ramon Fried---
configs/dragonboard410c_defconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
configs/dragonboard410c_defconfig +10 -0
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x80080000 CONFIG_IDENT_STRING="\nQualcomm-DragonBoard 410C" CONFIG_DISTRO_DEFAULTS=y CONFIG_NR_DRAM_BANKS=1 +# CONFIG_ANDROID_BOOT_IMAGE is not set CONFIG_FIT=y CONFIG_OF_BOARD_SETUP=y CONFIG_MISC_INIT_R=y
@@ -22,6 +23,10 @@ CONFIG_CMD_TIMER=y CONFIG_DEFAULT_DEVICE_TREE="dragonboard410c" CONFIG_ENV_IS_IN_MMC=y CONFIG_CLK=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x91000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_MSM_GPIO=y CONFIG_PM8916_GPIO=y CONFIG_LED=y
@@ -43,6 +48,11 @@ CONFIG_USB_EHCI_MSM=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x18d1 +CONFIG_USB_GADGET_PRODUCT_NUM=0xd00d +CONFIG_CI_UDC=y +CONFIG_USB_GADGET_DUALSPEED=n CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_ASIX88179=y
Signature · 1 line
2.18.0
PATCH 13/13 db410c: automatically launch fastboot
In reply to Ramon FriedIf during boot the key-vol-down press is detected
we'll fall back to fastboot.
---
board/qualcomm/dragonboard410c/dragonboard410c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +2 -1
@@ -140,7 +140,8 @@ int misc_init_r(void)if (dm_gpio_get_value (&resin)) {env_set ("bootdelay" ,"-1" ); -printf ("Power button pressed - dropping to console.\n" ); +env_set ("bootcmd" ,"fastboot 0" ); +printf ("key_vol_down pressed - Starting fastboot.\n" ); }return 0 ;
Signature · 1 line
2.18.0