add usb support for hi6220
Subsystems (3)
v3 cover add usb support for hi6220
v3:
fix typo and add -EPROBE_DEFER of regulator, pointed by Peter
v2:
address comments from Sergei and Peter
add hi6220_phy_setup(false) code
v1:
hi6220 usb controller is inherited from dwc2
add phy accordingly
support otg gadget/host
Zhangfei Gao (5):
Documentation: dt-bindings: add dt binding info for hi6220 dwc2
Documentation: dt-bindings: add dt binding info for hi6220
usb: dwc2: platform: add hi6220 support
usb: phy: load usb phy earlier
usb: phy: add phy-hi6220-usb
Documentation/devicetree/bindings/usb/dwc2.txt | 1 + .../devicetree/bindings/usb/hi6220-usb.txt | 49 ++++ drivers/usb/Makefile | 2 +- drivers/usb/dwc2/platform.c | 30 ++ drivers/usb/phy/Kconfig | 9 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-hi6220-usb.c | 308 +++++++++++++++++++++ 7 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/usb/hi6220-usb.txt create mode 100644 drivers/usb/phy/phy-hi6220-usb.c
Signature · 1 line
1.9.1
PATCH v3 1/5 Documentation: dt-bindings: add dt binding info for hi6220 dwc2
Add necessary dwc2 binding documentation for Hisilicon soc: hi6220
--- Documentation/devicetree/bindings/usb/dwc2.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/usb/dwc2.txt +1 -0
@@ -4,6 +4,7 @@ Platform DesignWare HS OTG USB 2.0 controller Required properties: - compatible : One of: - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC. + - hisilicon,hi6220-usb: The DWC2 USB controller instance in the hi6220 SoC. - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc; - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc; - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc;
Signature · 1 line
1.9.1
PATCH v3 2/5 Documentation: dt-bindings: add dt binding info for hi6220
In reply to Zhangfei Gao--- .../devicetree/bindings/usb/hi6220-usb.txt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/hi6220-usb.txt
Documentation/devicetree/bindings/usb/hi6220-usb.txt new file +49 -0
@@ -0,0 +1,49 @@ +Hisilicon hi6220 SoC USB controller +----------------------------- + +usb controller is inherited from dwc2, refer dwc2.txt +----- + +Required properties: +- compatible: "hisilicon,hi6220-usb" +Refer to dwc2.txt for dwc2 usb properties + + +PHY: +----- + +Required properties: +- compatible: "hisilicon,hi6220-usb-phy" +- vcc-supply: phandle to the regulator that provides power to the PHY. +- clocks: phandle and clock specifier of the PHY clock. +- hisilicon,peripheral-syscon: phandle of syscon used to control peripheral. +- hisilicon,gpio-vbus: gpio of detecting vbus. +- hisilicon,gpio-id: gpio of detecting id. + +Example: + + peripheral_ctrl: syscon at f7030000 { + compatible = "syscon"; + reg = <0x0 0xf7030000 0x0 0x1000>; + }; + + usb2_phy: usbphy { + compatible = "hisilicon,hi6220-usb-phy"; + vcc-supply = <&fixed_5v_hub>; + hisilicon,gpio-vbus = <&gpio2 6 0>; + hisilicon,gpio-id = <&gpio2 5 0>; + hisilicon,peripheral-syscon = <&peripheral_ctrl>; + clocks = <&clock_sys HI6220_USBOTG_HCLK>; + }; + + usb: usb at f72c0000 { + compatible = "hisilicon,hi6220-usb"; + reg = <0x0 0xf72c0000 0x0 0x40000>; + phys = <&usb2_phy>; + dr_mode = "otg"; + g-use-dma; + g-rx-fifo-size = <512>; + g-np-tx-fifo-size = <128>; + g-tx-fifo-size = <128>; + interrupts = <0 77 0x4>; + };
Signature · 1 line
1.9.1
PATCH v3 2/5 Documentation: dt-bindings: add dt binding info for hi6220
Quoted 23 lines · Zhangfei Gao
Signed-off-by Zhangfei Gao <[email protected]>--- .../devicetree/bindings/usb/hi6220-usb.txt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/hi6220-usb.txtDocumentation/devicetree/bindings/usb/hi6220-usb.txt new file +11
-0@@ -0,0 +1,49 @@ +Hisilicon hi6220 SoC USB controller +----------------------------- + +usb controller is inherited from dwc2, refer dwc2.txt +----- + +Required properties: +- compatible: "hisilicon,hi6220-usb" +Refer to dwc2.txt for dwc2 usb properties + +
Documentation/devicetree/bindings/usb/hi6220-usb.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/usb/hi6220-usb.txt new file +10
-0+PHY: +----- + +Required properties: +- compatible: "hisilicon,hi6220-usb-phy" +- vcc-supply: phandle to the regulator that provides power to the PHY. +- clocks: phandle and clock specifier of the PHY clock. +- hisilicon,peripheral-syscon: phandle of syscon used to control peripheral. +- hisilicon,gpio-vbus: gpio of detecting vbus. +- hisilicon,gpio-id: gpio of detecting id.
These should be vbus-gpios and id-gpios respectively.
Documentation/devicetree/bindings/usb/hi6220-usb.txt line 28
Quoted 7 lines
Documentation/devicetree/bindings/usb/hi6220-usb.txt new file +7
-0+ +Example: + + peripheral_ctrl: syscon at f7030000 { + compatible = "syscon"; + reg = <0x0 0xf7030000 0x0 0x1000>; + };
We should have a real string for this in addition to "syscon".
Thanks,
Mark.
PATCH v3 3/5 usb: dwc2: platform: add hi6220 support
In reply to Zhangfei Gao--- drivers/usb/dwc2/platform.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/usb/dwc2/platform.c +30 -0
@@ -50,6 +50,35 @@static const char dwc2_driver_name[] ="dwc2" ; +static const struct dwc2_core_params params_hi6220 = { + .otg_cap =2 ,/* No HNP/SRP capable */ + .otg_ver =0 ,/* 1.3 */ + .dma_enable =1 , + .dma_desc_enable =0 , + .speed =0 ,/* High Speed */ + .enable_dynamic_fifo =1 , + .en_multiple_tx_fifo =1 , + .host_rx_fifo_size =512 , + .host_nperio_tx_fifo_size =512 , + .host_perio_tx_fifo_size =512 , + .max_transfer_size =65535 , + .max_packet_count =511 , + .host_channels =16 , + .phy_type =1 ,/* UTMI */ + .phy_utmi_width =8 , + .phy_ulpi_ddr =0 ,/* Single */ + .phy_ulpi_ext_vbus =0 , + .i2c_enable =0 , + .ulpi_fs_ls =0 , + .host_support_fs_ls_low_power =0 , + .host_ls_low_power_phy_clk =0 ,/* 48 MHz */ + .ts_dline =0 , + .reload_ctl =0 , + .ahbcfg =GAHBCFG_HBSTLEN_INCR16 << +GAHBCFG_HBSTLEN_SHIFT , + .uframe_sched =0 , +}; +static const struct dwc2_core_params params_bcm2835 = { .otg_cap =0 ,/* HNP/SRP capable */ .otg_ver =0 ,/* 1.3 */
@@ -129,6 +158,7 @@ static int dwc2_driver_remove(struct platform_device *dev)static const struct of_device_id dwc2_of_match_table[] = { { .compatible ="brcm,bcm2835-usb" , .data = ¶ms_bcm2835 }, + { .compatible ="hisilicon,hi6220-usb" , .data = ¶ms_hi6220 }, { .compatible ="rockchip,rk3066-usb" , .data = ¶ms_rk3066 }, { .compatible ="snps,dwc2" , .data =NULL }, { .compatible ="samsung,s3c6400-hsotg" , .data =NULL },
Signature · 1 line
1.9.1
PATCH v3 4/5 usb: phy: load usb phy earlier
In reply to Zhangfei GaoSince phy is definitely used in usb controller, load the phy earlier to make boot time shorter.
--- drivers/usb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/Makefile +1 -1
@@ -5,6 +5,7 @@ # Object files in subdirectories obj-$(CONFIG_USB) += core/ +obj-$(CONFIG_USB_SUPPORT) += phy/ obj-$(CONFIG_USB_DWC3) += dwc3/ obj-$(CONFIG_USB_DWC2) += dwc2/
@@ -48,7 +49,6 @@ obj-$(CONFIG_USB_MICROTEK) += image/ obj-$(CONFIG_USB_SERIAL) += serial/ obj-$(CONFIG_USB) += misc/ -obj-$(CONFIG_USB_SUPPORT) += phy/ obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ obj-$(CONFIG_USB_ATM) += atm/
Signature · 1 line
1.9.1
PATCH v3 5/5 usb: phy: add phy-hi6220-usb
In reply to Zhangfei GaoAdd usb phy controller for hi6220 platform
--- drivers/usb/phy/Kconfig | 9 ++ drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-hi6220-usb.c | 308 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 318 insertions(+) create mode 100644 drivers/usb/phy/phy-hi6220-usb.c
drivers/usb/phy/Kconfig +9 -0
@@ -173,6 +173,15 @@ config USB_MXS_PHY MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x. +config USB_HI6220_PHY + tristate "hi6220 USB PHY support" + select USB_PHY + select MFD_SYSCON + help + Enable this to support the HISILICON HI6220 USB PHY. + + To compile this driver as a module, choose M here. + config USB_RCAR_PHY tristate "Renesas R-Car USB PHY support" depends on USB || USB_GADGET
drivers/usb/phy/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o obj-$(CONFIG_USB_GPIO_VBUS) += phy-gpio-vbus-usb.o +obj-$(CONFIG_USB_HI6220_PHY) += phy-hi6220-usb.o obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o
drivers/usb/phy/phy-hi6220-usb.c new file +308 -0
308 lines not on this page · raw message
Signature · 1 line
1.9.1