From e3806baea288ae34d6062bfae5be2070d5a2c464 Mon Sep 17 00:00:00 2001 From: Qi Duan Date: Thu, 27 Apr 2017 19:49:52 +0800 Subject: [PATCH] usb: usb compile buildin. 1/1 PD#138714: usb compile buildin 1.usb compile buildin 2.otg port mode is host default. 3.Can force device mode by get env. otg_device=1 4.default add config gadget:mtp,ffs,rndis Change-Id: I613da307f904c58fba102d163e97dbaa253fb2a8 Signed-off-by: Qi Duan --- arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts | 2 +- arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts | 2 +- arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts | 2 +- arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts | 2 +- arch/arm64/boot/dts/amlogic/gxl_skt.dts | 2 +- arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts | 2 +- arch/arm64/configs/meson64_defconfig | 5 +++- .../amlogic/usb/dwc_otg/310/dwc_otg_driver.c | 26 ++++++++++++++++--- 8 files changed, 33 insertions(+), 10 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts index 7e3f4a72120a..febfc6b7173b 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts @@ -521,7 +521,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1: host, 2: device*/ + controller-type = <1>; /** 0: normal, 1: host, 2: device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts index a417a97411de..f14202c2fbea 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts @@ -599,7 +599,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1: host, 2: device*/ + controller-type = <1>; /** 0: normal, 1: host, 2: device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts index 71af2230fe9a..b3d5cb9c900c 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts @@ -419,7 +419,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1: host, 2: device*/ + controller-type = <1>; /** 0: normal, 1: host, 2: device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts index 5869480a2a72..a64fd75a5c4a 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts @@ -481,7 +481,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1: host, 2: device*/ + controller-type = <1>; /** 0: normal, 1: host, 2: device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/boot/dts/amlogic/gxl_skt.dts b/arch/arm64/boot/dts/amlogic/gxl_skt.dts index b07f66f58b8d..2bc54abe307c 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_skt.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_skt.dts @@ -515,7 +515,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1: host, 2: device*/ + controller-type = <1>; /** 0: normal, 1: host, 2: device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts index 7893e3b7169f..b943cb0cd266 100644 --- a/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts @@ -611,7 +611,7 @@ port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/ usb-fifo = <728>; cpu-type = "gxl"; - controller-type = <2>; /** 0: normal, 1:host, 2:device*/ + controller-type = <1>; /** 0: normal, 1:host, 2:device*/ phy-reg = <0xd0078000>; phy-reg-size = <0xa0>; clocks = <&clkc CLKID_USB_GENERAL diff --git a/arch/arm64/configs/meson64_defconfig b/arch/arm64/configs/meson64_defconfig index d8849494b8b3..565bd376342f 100644 --- a/arch/arm64/configs/meson64_defconfig +++ b/arch/arm64/configs/meson64_defconfig @@ -163,8 +163,9 @@ CONFIG_AMLOGIC_SERIAL_MESON_CONSOLE=y CONFIG_AMLOGIC_IOMAP=y CONFIG_AMLOGIC_PINCTRL=y CONFIG_AMLOGIC_USB=y -CONFIG_AMLOGIC_USB_DWC_OTG_HCD=m +CONFIG_AMLOGIC_USB_DWC_OTG_HCD=y CONFIG_AMLOGIC_USB_HOST_ELECT_TEST=y +CONFIG_USB_CONFIGFS_UEVENT=y CONFIG_AMLOGIC_USBPHY=y CONFIG_AMLOGIC_USB2PHY=y CONFIG_AMLOGIC_USB3PHY=y @@ -344,7 +345,9 @@ CONFIG_USB_SERIAL=y CONFIG_USB_ISP1301=y CONFIG_USB_GADGET=y CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_RNDIS=y CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_MTP=y CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_ARMMMCI=y diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_driver.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_driver.c index 9bde76d41eb1..6e1399c85771 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_driver.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_driver.c @@ -238,8 +238,18 @@ bool force_device_mode; module_param_named(otg_device, force_device_mode, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(otg_device, "set otg to force device mode" " "); - +static char otg_mode_string[2] = "0"; +static int __init force_otg_mode(char *s) +{ + if (s != NULL) + sprintf(otg_mode_string, "%s", s); + if (strcmp(otg_mode_string, "0") == 0) + force_device_mode = 0; + else + force_device_mode = 1; + return 0; +} +__setup("otg_device=", force_otg_mode); static u64 dwc2_dmamask = DMA_BIT_MASK(32); @@ -898,6 +908,8 @@ static void usb_early_resume(struct early_suspend *h) } #endif static const struct of_device_id dwc_otg_dt_match[] = { + { .compatible = "amlogic, dwc2", + }, { .compatible = "amlogic,dwc2", }, {}, @@ -1438,6 +1450,9 @@ static const struct dev_pm_ops dwc2_dev_pm_ops = { #ifdef CONFIG_OF static const struct of_device_id of_dwc2_match[] = { + { + .compatible = "amlogic, dwc2" + }, { .compatible = "amlogic,dwc2" }, @@ -1457,7 +1472,12 @@ static struct platform_driver dwc_otg_driver = { }, }; -module_platform_driver(dwc_otg_driver); + +static int __init dwc_otg_init(void) +{ + return platform_driver_register(&dwc_otg_driver); +} +late_initcall(dwc_otg_init); MODULE_DESCRIPTION(DWC_DRIVER_DESC); MODULE_AUTHOR("Synopsys Inc.");