meson: enable USB Gadget support fot GXL/GXM SoCs
Subsystems (4)
cover meson: enable USB Gadget support fot GXL/GXM SoCs
Thit patchset adds support for OTG Gadget mode on the GXL/GXM SoCs.
It adds a new API generic_phy_get_by_node() to get the PHY by it's node.
It enabled Gadget and USB Mass Storage for libretech-cc, libretech-ac, khadas-vim, khadas-vim2, libretech-s905d-pc and libretech-s912-pc boards.
Neil Armstrong (10):
generic-phy: add generic_phy_get_by_node()
phy: meson-gxl-usb: add set_mode call to force switch to peripheral
mode
arm: meson-gx: add board_usb_init()/cleanup() for USB gadget
arm: dts: meson-gxl: Add USB Gadget nodes for U-Boot
configs: libretech-cc: Enable USB gadget with Mass Storage function
configs: libretech-ac: Enable USB gadget with Mass Storage function
configs: khadas-vim2: Enable USB gadget with Mass Storage function
configs: khadas-vim: Enable USB gadget with Mass Storage function
configs: libretech-s905d-pc: Enable USB gadget with Mass Storage
function
configs: libretech-s912-pc: Enable USB gadget with Mass Storage
function
.../meson-gxl-s905x-khadas-vim-u-boot.dtsi | 2 +- .../meson-gxl-s905x-libretech-cc-u-boot.dtsi | 6 +- arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi | 2 +- arch/arm/dts/meson-gxl-u-boot.dtsi | 23 ++++ arch/arm/include/asm/arch-meson/usb-gx.h | 16 +++ arch/arm/mach-meson/board-gx.c | 118 ++++++++++++++++++ configs/khadas-vim2_defconfig | 7 ++ configs/khadas-vim_defconfig | 7 ++ configs/libretech-ac_defconfig | 7 ++ configs/libretech-cc_defconfig | 7 ++ configs/libretech-s905d-pc_defconfig | 7 ++ configs/libretech-s912-pc_defconfig | 7 ++ drivers/phy/meson-gxl-usb2.c | 30 ++++- drivers/phy/meson-gxl-usb3.c | 44 +++++-- drivers/phy/phy-uclass.c | 17 ++- include/generic-phy.h | 27 ++++ 16 files changed, 301 insertions(+), 26 deletions(-) create mode 100644 arch/arm/dts/meson-gxl-u-boot.dtsi create mode 100644 arch/arm/include/asm/arch-meson/usb-gx.h
Signature · 1 line
2.22.0
PATCH 1/10 generic-phy: add generic_phy_get_by_node()
Add generic_phy_get_by_node() to get a PHY phandle from a node instead of a udevice.
--- drivers/phy/phy-uclass.c | 17 ++++++++++++----- include/generic-phy.h | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-)
drivers/phy/phy-uclass.c +11 -5
@@ -31,20 +31,20 @@ static int generic_phy_xlate_offs_flags(struct phy *phy,return 0 ; } -int generic_phy_get_by_index (struct udevice *dev,int index, -struct phy *phy) +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy) {struct ofnode_phandle_args args;struct phy_ops *ops;struct udevice *phydev;int i, ret; -debug ("%s(dev=%p, index=%d, phy=%p)\n" , __func__, dev, index, phy); +debug ("%s(node=%s, index=%d, phy=%p)\n" , + __func__,ofnode_get_name (node), index, phy);assert (phy); phy->dev =NULL ; - ret =dev_read_phandle_with_args (dev,"phys" ,"#phy-cells" ,0 , index, - &args); + ret =ofnode_parse_phandle_with_args (node,"phys" ,"#phy-cells" ,0 , + index, &args);if (ret) {debug ("%s: dev_read_phandle_with_args failed: err=%d\n" , __func__, ret);
@@ -88,6 +88,12 @@ int generic_phy_get_by_index(struct udevice *dev, int index, err:return ret; +} + +int generic_phy_get_by_index (struct udevice *dev,int index, +struct phy *phy) +{ +return generic_phy_get_by_node (dev_ofnode (dev), index, phy); } int generic_phy_get_by_name(struct udevice *dev, const char *phy_name,
include/generic-phy.h +27 -0
@@ -193,6 +193,33 @@ int generic_phy_power_off(struct phy *phy);int generic_phy_get_by_index (struct udevice *user,int index,struct phy *phy); +/** +* generic_phy_get_by_node() - Get a PHY device by integer index on ofnode +* +* @node: the device node +* @index: The index in the list of available PHYs +* @phy: A pointer to the PHY port +* +* This looks up a PHY device for a client device based on its ofnode and on +* its position in the list of the possible PHYs. +* +* example: +* usb1: usb_otg_ss at xxx { +* compatible = "xxx"; +* reg = <xxx>; +* . +* . +* phys = <&usb2_phy>, <&usb3_phy>; +* . +* . +* }; +* the USB2 phy can be accessed by passing index '0' and the USB3 phy can +* be accessed by passing index '1' +* +* @return 0 if OK, or a negative error code +*/ +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy); +/** * generic_phy_get_by_name() - Get a PHY device by its name. *
Signature · 1 line
2.22.0
PATCH 1/10 generic-phy: add generic_phy_get_by_node()
Tom, Marek,
Quoted 8 lines · Neil Armstrong
Add
generic_phy_get_by_node()to get a PHY phandle from a node instead of a udevice.Signed-off-by Neil Armstrong <[email protected]>--- drivers/phy/phy-uclass.c | 17 ++++++++++++----- include/generic-phy.h | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-)
Are you ok with this change ?
Neil
Quoted 83 lines
drivers/phy/phy-uclass.c +11
-5@@ -31,20 +31,20 @@ static int generic_phy_xlate_offs_flags(struct phy *phy,return 0 ; } -int generic_phy_get_by_index (struct udevice *dev,int index, -struct phy *phy) +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy) {struct ofnode_phandle_args args;struct phy_ops *ops;struct udevice *phydev;int i, ret; -debug ("%s(dev=%p, index=%d, phy=%p)\n" , __func__, dev, index, phy); +debug ("%s(node=%s, index=%d, phy=%p)\n" , + __func__,ofnode_get_name (node), index, phy);assert (phy); phy->dev =NULL ; - ret =dev_read_phandle_with_args (dev,"phys" ,"#phy-cells" ,0 , index, - &args); + ret =ofnode_parse_phandle_with_args (node,"phys" ,"#phy-cells" ,0 , + index, &args);if (ret) {debug ("%s: dev_read_phandle_with_args failed: err=%d\n" , __func__, ret);@@ -88,6 +88,12 @@ int generic_phy_get_by_index(struct udevice *dev, int index, err:return ret; +} + +int generic_phy_get_by_index (struct udevice *dev,int index, +struct phy *phy) +{ +return generic_phy_get_by_node (dev_ofnode (dev), index, phy); } int generic_phy_get_by_name(struct udevice *dev, const char *phy_name,include/generic-phy.h +27
-0@@ -193,6 +193,33 @@ int generic_phy_power_off(struct phy *phy);int generic_phy_get_by_index (struct udevice *user,int index,struct phy *phy); +/** +* generic_phy_get_by_node() - Get a PHY device by integer index on ofnode +* +* @node: the device node +* @index: The index in the list of available PHYs +* @phy: A pointer to the PHY port +* +* This looks up a PHY device for a client device based on its ofnode and on +* its position in the list of the possible PHYs. +* +* example: +* usb1: usb_otg_ss at xxx { +* compatible = "xxx"; +* reg = <xxx>; +* . +* . +* phys = <&usb2_phy>, <&usb3_phy>; +* . +* . +* }; +* the USB2 phy can be accessed by passing index '0' and the USB3 phy can +* be accessed by passing index '1' +* +* @return 0 if OK, or a negative error code +*/ +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy); +/** * generic_phy_get_by_name() - Get a PHY device by its name. *
PATCH 1/10 generic-phy: add generic_phy_get_by_node()
Quoted 6 lines · Neil Armstrong
Tom, Marek,
Quoted 3 lines · Neil Armstrong
Add
generic_phy_get_by_node()to get a PHY phandle from a node instead of a udevice.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Neil Armstrong <[email protected]>--- drivers/phy/phy-uclass.c | 17 ++++++++++++----- include/generic-phy.h | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-)Are you ok with this change ?
Quoted 87 lines
Neil
Quoted 83 lines
drivers/phy/phy-uclass.c +11
-5@@ -31,20 +31,20 @@ static int generic_phy_xlate_offs_flags(struct phy *phy,return 0 ; } -int generic_phy_get_by_index (struct udevice *dev,int index, -struct phy *phy) +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy) {struct ofnode_phandle_args args;struct phy_ops *ops;struct udevice *phydev;int i, ret; -debug ("%s(dev=%p, index=%d, phy=%p)\n" , __func__, dev, index, phy); +debug ("%s(node=%s, index=%d, phy=%p)\n" , + __func__,ofnode_get_name (node), index, phy);assert (phy); phy->dev =NULL ; - ret =dev_read_phandle_with_args (dev,"phys" ,"#phy-cells" ,0 , index, - &args); + ret =ofnode_parse_phandle_with_args (node,"phys" ,"#phy-cells" ,0 , + index, &args);if (ret) {debug ("%s: dev_read_phandle_with_args failed: err=%d\n" , __func__, ret);@@ -88,6 +88,12 @@ int generic_phy_get_by_index(struct udevice *dev, int index, err:return ret; +} + +int generic_phy_get_by_index (struct udevice *dev,int index, +struct phy *phy) +{ +return generic_phy_get_by_node (dev_ofnode (dev), index, phy); } int generic_phy_get_by_name(struct udevice *dev, const char *phy_name,include/generic-phy.h +27
-0@@ -193,6 +193,33 @@ int generic_phy_power_off(struct phy *phy);int generic_phy_get_by_index (struct udevice *user,int index,struct phy *phy); +/** +* generic_phy_get_by_node() - Get a PHY device by integer index on ofnode +* +* @node: the device node +* @index: The index in the list of available PHYs +* @phy: A pointer to the PHY port +* +* This looks up a PHY device for a client device based on its ofnode and on +* its position in the list of the possible PHYs. +* +* example: +* usb1: usb_otg_ss at xxx { +* compatible = "xxx"; +* reg = <xxx>; +* . +* . +* phys = <&usb2_phy>, <&usb3_phy>; +* . +* . +* }; +* the USB2 phy can be accessed by passing index '0' and the USB3 phy can +* be accessed by passing index '1' +* +* @return 0 if OK, or a negative error code +*/ +int generic_phy_get_by_node (ofnode node,int index,struct phy *phy); +/** * generic_phy_get_by_name() - Get a PHY device by its name. *
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200416/ada5ed4c/attachment.sig>
PATCH 2/10 phy: meson-gxl-usb: add set_mode call to force switch to peripheral mode
In reply to Neil ArmstrongAdd set_mode function in the Amlogic GXL PHYs that will be called by the arch code to switch PHYs from/to gadget mode.
--- arch/arm/include/asm/arch-meson/usb-gx.h | 16 +++++++++ drivers/phy/meson-gxl-usb2.c | 30 ++++++++++++---- drivers/phy/meson-gxl-usb3.c | 44 +++++++++++++++++------- 3 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 arch/arm/include/asm/arch-meson/usb-gx.h
arch/arm/include/asm/arch-meson/usb-gx.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2019 BayLibre SAS +* Author: Neil Armstrong <[email protected]> +*/ +#ifndef _ARCH_MESON_USB_GX_H_ +#define _ARCH_MESON_USB_GX_H_ + +#include <generic-phy.h> +#include <linux/usb/otg.h> + +/* TOFIX add set_mode to struct phy_ops */ +void phy_meson_gxl_usb2_set_mode (struct phy *phy,enum usb_dr_mode mode); +void phy_meson_gxl_usb3_set_mode (struct phy *phy,enum usb_dr_mode mode); + +#endif
drivers/phy/meson-gxl-usb2.c +24 -6
@@ -17,6 +17,9 @@#include <regmap.h> #include <power/regulator.h> #include <clk.h> +#include <linux/usb/otg.h> + +#include <asm/arch/usb-gx.h> #include <linux/bitops.h> #include <linux/compat.h>
@@ -121,15 +124,30 @@ static void phy_meson_gxl_usb2_reset(struct phy_meson_gxl_usb2_priv *priv)udelay (RESET_COMPLETE_TIME ); } -static void -phy_meson_gxl_usb2_set_host_mode (struct phy_meson_gxl_usb2_priv *priv) +void phy_meson_gxl_usb2_set_mode (struct phy *phy,enum usb_dr_mode mode) { +struct udevice *dev = phy->dev; +struct phy_meson_gxl_usb2_priv *priv =dev_get_priv (dev);uint val;regmap_read (priv->regmap,U2P_R0 , &val); - val |=U2P_R0_DM_PULLDOWN ; - val |=U2P_R0_DP_PULLDOWN ; - val &= ~U2P_R0_ID_PULLUP ; + +switch (mode) { +case USB_DR_MODE_UNKNOWN : +case USB_DR_MODE_HOST : +case USB_DR_MODE_OTG : + val |=U2P_R0_DM_PULLDOWN ; + val |=U2P_R0_DP_PULLDOWN ; + val &= ~U2P_R0_ID_PULLUP ; +break ; + +case USB_DR_MODE_PERIPHERAL : + val &= ~U2P_R0_DM_PULLDOWN ; + val &= ~U2P_R0_DP_PULLDOWN ; + val |=U2P_R0_ID_PULLUP ; +break ; + } +regmap_write (priv->regmap,U2P_R0 , val);phy_meson_gxl_usb2_reset (priv);
@@ -146,7 +164,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy) val &= ~U2P_R0_POWER_ON_RESET ;regmap_write (priv->regmap,U2P_R0 , val); -phy_meson_gxl_usb2_set_host_mode (priv); +phy_meson_gxl_usb2_set_mode (phy,USB_DR_MODE_HOST );#if CONFIG_IS_ENABLED (DM_REGULATOR )if (priv->phy_supply) {
drivers/phy/meson-gxl-usb3.c +32 -12
65 lines not on this page · raw message
Signature · 1 line
2.22.0
PATCH 3/10 arm: meson-gx: add board_usb_init()/cleanup() for USB gadget
In reply to Neil ArmstrongAdd arch code to initialize USB Gadget mode using the DWC2 controller, and using the previously added set_mode() phy functions.
--- arch/arm/mach-meson/board-gx.c | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
arch/arm/mach-meson/board-gx.c +118 -0
@@ -14,6 +14,11 @@#include <asm/io.h> #include <asm/armv8/mmu.h> #include <linux/sizes.h> +#include <usb.h> +#include <linux/usb/otg.h> +#include <asm/arch/usb-gx.h> +#include <usb/dwc2_udc.h> +#include <clk.h> #include <phy.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -149,3 +154,116 @@ void meson_eth_init(phy_interface_t mode, unsigned int flags)/* Enable power gate */ clrbits_le32 (GX_MEM_PD_REG_0 ,GX_MEM_PD_REG_0_ETH_MASK ); } + +#if CONFIG_IS_ENABLED (USB_XHCI_DWC3_OF_SIMPLE ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_gx_dwc2_data; +static struct phy usb_phys[2 ]; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct ofnode_phandle_args args; +struct udevice *clk_dev; +ofnode dwc2_node; +struct clk clk; +int ret, i; +u32 val; + +/* find the dwc2 node */ + dwc2_node =ofnode_by_compatible (ofnode_null (),"snps,dwc2" ); +if (!ofnode_valid (dwc2_node)) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!ofnode_is_available (dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + +/* get the PHYs */ +for (i =0 ; i <2 ; i++) { + ret =generic_phy_get_by_node (dwc2_node, i, &usb_phys[i]); +if (ret && ret != -ENOENT ) { +pr_err ("Failed to get USB PHY%d for %s\n" , + i,ofnode_get_name (dwc2_node)); +return ret; + } + } + +for (i =0 ; i <2 ; i++) { + ret =generic_phy_init (&usb_phys[i]); +if (ret) { +pr_err ("Can't init USB PHY%d for %s\n" , + i,ofnode_get_name (dwc2_node)); +return ret; + } + } + +for (i =0 ; i <2 ; i++) { + ret =generic_phy_power_on (&usb_phys[i]); +if (ret) { +pr_err ("Can't power USB PHY%d for %s\n" , + i,ofnode_get_name (dwc2_node)); +return ret; + } + } + +phy_meson_gxl_usb3_set_mode (&usb_phys[0 ],USB_DR_MODE_PERIPHERAL ); +phy_meson_gxl_usb2_set_mode (&usb_phys[1 ],USB_DR_MODE_PERIPHERAL ); + + meson_gx_dwc2_data.regs_otg =ofnode_get_addr (dwc2_node); +if (meson_gx_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret =ofnode_parse_phandle_with_args (dwc2_node,"clocks" , +"#clock-cells" ,0 ,0 , &args); +if (ret) { +debug ("usbotg has no clocks defined in the device tree\n" ); +return ret; + } + + ret =uclass_get_device_by_ofnode (UCLASS_CLK , args.node, &clk_dev); +if (ret) +return ret; + +if (args.args_count !=1 ) { +debug ("Can't find clock ID in the device tree\n" ); +return -ENODATA ; + } + + clk.dev = clk_dev; + clk.id = args.args[0 ]; + + ret =clk_enable (&clk); +if (ret) { +debug ("Failed to enable usbotg clock\n" ); +return ret; + } + +ofnode_read_u32 (dwc2_node,"g-rx-fifo-size" , &val); + meson_gx_dwc2_data.rx_fifo_sz = val; +ofnode_read_u32 (dwc2_node,"g-np-tx-fifo-size" , &val); + meson_gx_dwc2_data.np_tx_fifo_sz = val; +ofnode_read_u32 (dwc2_node,"g-tx-fifo-size" , &val); + meson_gx_dwc2_data.tx_fifo_sz = val; + +return dwc2_udc_probe (&meson_gx_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +int i; + +phy_meson_gxl_usb3_set_mode (&usb_phys[0 ],USB_DR_MODE_HOST ); +phy_meson_gxl_usb3_set_mode (&usb_phys[1 ],USB_DR_MODE_HOST ); + +for (i =0 ; i <2 ; i++) + usb_phys[i].dev =NULL ; + +return 0 ; +} +#endif
Signature · 1 line
2.22.0
PATCH 4/10 arm: dts: meson-gxl: Add USB Gadget nodes for U-Boot
In reply to Neil ArmstrongAdd the USB DWC2 node to u-boot specific dtsi files since Gadget support is not (yet) available in upstream Linux yet.
--- .../meson-gxl-s905x-khadas-vim-u-boot.dtsi | 2 +- .../meson-gxl-s905x-libretech-cc-u-boot.dtsi | 6 ++++- arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi | 2 +- arch/arm/dts/meson-gxl-u-boot.dtsi | 23 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/meson-gxl-u-boot.dtsi
arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi +1 -1
@@ -4,4 +4,4 @@ * Author: Neil Armstrong <[email protected]> */ -#include "meson-gx-u-boot.dtsi" +#include "meson-gxl-u-boot.dtsi"
arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi +5 -1
@@ -4,4 +4,8 @@ * Author: Neil Armstrong <[email protected]> */ -#include "meson-gx-u-boot.dtsi" +#include "meson-gxl-u-boot.dtsi" + +&dwc2 { + status = "okay"; +};
arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi +1 -1
@@ -4,4 +4,4 @@ * Author: Neil Armstrong <[email protected]> */ -#include "meson-gx-u-boot.dtsi" +#include "meson-gxl-u-boot.dtsi"
arch/arm/dts/meson-gxl-u-boot.dtsi new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS. + * Author: Neil Armstrong <[email protected]> + */ + +#include "meson-gx-u-boot.dtsi" + +&usb0 { + dwc2: usb at c9100000 { + compatible = "snps,dwc2"; + reg = <0x0 0xc9100000 0x0 0x40000>; + interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; + clock-names = "ddr"; + phys = <&usb3_phy>, <&usb2_phy1>; + dr_mode = "peripheral"; + g-rx-fifo-size = <192>; + g-np-tx-fifo-size = <128>; + g-tx-fifo-size = <128 128 16 16 16>; + status = "disabled"; + }; +};
Signature · 1 line
2.22.0
PATCH 5/10 configs: libretech-cc: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/libretech-cc_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/libretech-cc_defconfig +7 -0
@@ -19,6 +19,7 @@ CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -51,6 +52,12 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set # CONFIG_VIDEO_BPP16 is not set
Signature · 1 line
2.22.0
PATCH 6/10 configs: libretech-ac: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/libretech-ac_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/libretech-ac_defconfig +7 -0
@@ -27,6 +27,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -69,6 +70,12 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y CONFIG_USB_KEYBOARD=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set # CONFIG_VIDEO_BPP16 is not set
Signature · 1 line
2.22.0
PATCH 7/10 configs: khadas-vim2: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/khadas-vim2_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/khadas-vim2_defconfig +7 -0
@@ -20,6 +20,7 @@ CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -49,4 +50,10 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.22.0
PATCH 8/10 configs: khadas-vim: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/khadas-vim_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/khadas-vim_defconfig +7 -0
@@ -20,6 +20,7 @@ CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -50,4 +51,10 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.22.0
PATCH 9/10 configs: libretech-s905d-pc: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/libretech-s905d-pc_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/libretech-s905d-pc_defconfig +7 -0
@@ -26,6 +26,7 @@ CONFIG_CMD_SF=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -65,6 +66,12 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_KEYBOARD=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y
Signature · 1 line
2.22.0
PATCH 10/10 configs: libretech-s912-pc: Enable USB gadget with Mass Storage function
In reply to Neil ArmstrongEnable configs to support USB gadget and Mass Storage
--- configs/libretech-s912-pc_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/libretech-s912-pc_defconfig +7 -0
@@ -26,6 +26,7 @@ CONFIG_CMD_SF=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y
@@ -65,6 +66,12 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_KEYBOARD=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y
Signature · 1 line
2.22.0
cover meson: enable USB Gadget support fot GXL/GXM SoCs
In reply to Neil ArmstrongQuoted 33 lines · Neil Armstrong
Thit patchset adds support for OTG Gadget mode on the GXL/GXM SoCs.
It adds a new API
generic_phy_get_by_node()to get the PHY by it's node.It enabled Gadget and USB Mass Storage for libretech-cc, libretech-ac, khadas-vim, khadas-vim2, libretech-s905d-pc and libretech-s912-pc boards.
Neil Armstrong (10):
generic-phy: addgeneric_phy_get_by_node()
phy: meson-gxl-usb: addset_modecall to force switch to peripheral
mode
arm: meson-gx: add board_usb_init()/cleanup() for USB gadget
arm: dts: meson-gxl: Add USB Gadget nodes for U-Boot
configs: libretech-cc: Enable USB gadget with Mass Storage function
configs: libretech-ac: Enable USB gadget with Mass Storage function
configs: khadas-vim2: Enable USB gadget with Mass Storage function
configs: khadas-vim: Enable USB gadget with Mass Storage function
configs: libretech-s905d-pc: Enable USB gadget with Mass Storage
function
configs: libretech-s912-pc: Enable USB gadget with Mass Storage
function.../meson-gxl-s905x-khadas-vim-u-boot.dtsi | 2 +- .../meson-gxl-s905x-libretech-cc-u-boot.dtsi | 6 +- arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi | 2 +- arch/arm/dts/meson-gxl-u-boot.dtsi | 23 ++++ arch/arm/include/asm/arch-meson/usb-gx.h | 16 +++ arch/arm/mach-meson/board-gx.c | 118 ++++++++++++++++++ configs/khadas-vim2_defconfig | 7 ++ configs/khadas-vim_defconfig | 7 ++ configs/libretech-ac_defconfig | 7 ++ configs/libretech-cc_defconfig | 7 ++ configs/libretech-s905d-pc_defconfig | 7 ++
Quoted 9 lines
configs/libretech-s912-pc_defconfig | 7 ++ drivers/phy/meson-gxl-usb2.c | 30 ++++- drivers/phy/meson-gxl-usb3.c | 44 +++++-- drivers/phy/phy-uclass.c | 17 ++- include/generic-phy.h | 27 ++++ 16 files changed, 301 insertions(+), 26 deletions(-) create mode 100644 arch/arm/dts/meson-gxl-u-boot.dtsi create mode 100644 arch/arm/include/asm/arch-meson/usb-gx.h
Applied to u-boot-amlogic with tom's review tag on patch 1