ARM: meson: Add G12A USB Support
Subsystems (6)
v2 cover ARM: meson: Add G12A USB Support
This patchset adds support for USB on Amlogic G12A SoCs.
This patchset is composed with :
- PHY Drivers
- USB Control Glue driver
- G12A board setup for Device mode
Device Tree nodes will be added in a separate patchset when applied on a tagged Linux tree.
The Amlogic G12A USB Complex is composed of :
- 2 USB Controllers :
* DWC3 for USB2 and USB3 Host functionality
* DWC2 for USB2 Peripheral functionality
- 2 USB2 OTG PHYs, only a single one will be routed to either DWC2 to DWC3
- 1 USB3 PHY shared with PCIE funcionnality
- A Glue to control PHY routing, setup and OTG detection
The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including routing of the OTG PHY between the DWC3 and DWC2 controllers, and setups the on-chip OTG mode selection for this PHY.
This drivers supports the on-probe setup of the OTG mode, and manually via a setup function in the G12A common board code.
Changes since v1:
- switch printf() to debug() in patch 1
Neil Armstrong (3):
usb: dwc3: Add Meson G12A USB Glue
phy: meson: add Amlogic G12A USB2 and USB3+PCIE PHY drivers
mach-meson: g12a: add DWC2 peripheral mode support
arch/arm/include/asm/arch-meson/usb.h | 12 + arch/arm/mach-meson/board-g12a.c | 126 +++++++ drivers/phy/Kconfig | 8 + drivers/phy/Makefile | 1 + drivers/phy/meson-g12a-usb2.c | 216 ++++++++++++ drivers/phy/meson-g12a-usb3-pcie.c | 345 +++++++++++++++++++ drivers/usb/dwc3/Kconfig | 8 + drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-meson-g12a.c | 456 ++++++++++++++++++++++++++ 9 files changed, 1173 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h create mode 100644 drivers/phy/meson-g12a-usb2.c create mode 100644 drivers/phy/meson-g12a-usb3-pcie.c create mode 100644 drivers/usb/dwc3/dwc3-meson-g12a.c
Signature · 1 line
2.21.0
PATCH v2 1/3 usb: dwc3: Add Meson G12A USB Glue
Adds support for Amlogic G12A USB Control Glue HW.
The Amlogic G12A SoC Family embeds 2 USB Controllers :
- a DWC3 IP configured as Host for USB2 and USB3
- a DWC2 IP configured as Peripheral USB2 Only
A glue connects these both controllers to 2 USB2 PHYs, and optionnally to an USB3+PCIE Combo PHY shared with the PCIE controller.
The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including routing of the OTG PHY between the DWC3 and DWC2 controllers, and setups the on-chip OTG mode selection for this PHY.
This driver sets the OTG capable port as Host mode by default, the switch to Device mode is to be done in a separate patch.
--- drivers/usb/dwc3/Kconfig | 8 + drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-meson-g12a.c | 456 +++++++++++++++++++++++++++++ 3 files changed, 465 insertions(+) create mode 100644 drivers/usb/dwc3/dwc3-meson-g12a.c
drivers/usb/dwc3/Kconfig +8 -0
@@ -44,6 +44,14 @@ config USB_DWC3_GENERIC Select this for Xilinx ZynqMP and similar Platforms. This wrapper supports Host and Peripheral operation modes. +config USB_DWC3_MESON_G12A + bool "Amlogic Meson G12A USB wrapper" + depends on DM_USB && USB_DWC3 && ARCH_MESON + imply PHY + help + Select this for Amlogic Meson G12A Platforms. + This wrapper supports Host and Peripheral operation modes. + config USB_DWC3_UNIPHIER bool "DesignWare USB3 Host Support on UniPhier Platforms" depends on ARCH_UNIPHIER && USB_XHCI_DWC3
drivers/usb/dwc3/Makefile +1 -0
@@ -7,6 +7,7 @@ dwc3-y := core.o obj-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o +obj-$(CONFIG_USB_DWC3_MESON_G12A) += dwc3-meson-g12a.o obj-$(CONFIG_USB_DWC3_GENERIC) += dwc3-generic.o obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o
drivers/usb/dwc3/dwc3-meson-g12a.c new file +456 -0
456 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 1/3 usb: dwc3: Add Meson G12A USB Glue
Quoted 9 lines · Neil Armstrong
Adds support for Amlogic G12A USB Control Glue HW.
The Amlogic G12A SoC Family embeds 2 USB Controllers :
- a DWC3 IP configured as Host for USB2 and USB3
- a DWC2 IP configured as Peripheral USB2 OnlyA glue connects these both controllers to 2 USB2 PHYs, and optionnally to an USB3+PCIE Combo PHY shared with the PCIE controller.
Quoted 8 lines
The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including routing of the OTG PHY between the DWC3 and DWC2 controllers, and setups the on-chip OTG mode selection for this PHY.
This driver sets the OTG capable port as Host mode by default, the switch to Device mode is to be done in a separate patch.
Signed-off-by Neil Armstrong <[email protected]>
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 2/3 phy: meson: add Amlogic G12A USB2 and USB3+PCIE PHY drivers
In reply to Neil ArmstrongThis adds support for the USB PHYs found in the Amlogic G12A SoC Family.
The USB2 PHY supports Host and/or Peripheral mode, depending on it's position. The first PHY is only used as Host, but the second supports Dual modes defined by the USB Control Glue HW in front of the USB Controllers.
The second driver supports USB3 Host mode or PCIE 2.0 mode, depending on the layout of the board.
Selection is done by the #phy-cells, making the mode static and exclusive.
--- drivers/phy/Kconfig | 8 + drivers/phy/Makefile | 1 + drivers/phy/meson-g12a-usb2.c | 216 ++++++++++++++++++ drivers/phy/meson-g12a-usb3-pcie.c | 345 +++++++++++++++++++++++++++++ 4 files changed, 570 insertions(+) create mode 100644 drivers/phy/meson-g12a-usb2.c create mode 100644 drivers/phy/meson-g12a-usb3-pcie.c
drivers/phy/Kconfig +8 -0
@@ -147,6 +147,14 @@ config MESON_GXL_USB_PHY This is the generic phy driver for the Amlogic Meson GXL USB2 and USB3 PHYS. +config MESON_G12A_USB_PHY + bool "Amlogic Meson G12A USB PHYs" + depends on PHY && ARCH_MESON && MESON_G12A + imply REGMAP + help + This is the generic phy driver for the Amlogic Meson G12A + USB2 and USB3 PHYS. + config MSM8916_USB_PHY bool "Qualcomm MSM8916 USB PHY support" depends on PHY
drivers/phy/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.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_MESON_G12A_USB_PHY) += meson-g12a-usb2.o meson-g12a-usb3-pcie.o obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o obj-$(CONFIG_OMAP_USB2_PHY) += omap-usb2-phy.o obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o
drivers/phy/meson-g12a-usb2.c new file +216 -0
216 lines not on this page · raw message
drivers/phy/meson-g12a-usb3-pcie.c new file +345 -0
345 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
In reply to Neil ArmstrongAdds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h
arch/arm/include/asm/arch-meson/usb.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode (struct udevice *dev,enum usb_dr_mode mode); + +#endif /* __MESON_USB_H__ */
arch/arm/mach-meson/board-g12a.c +126 -0
136 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
Hi Neil,
Quoted 11 lines
Adds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
Signed-off-by Neil Armstrong <[email protected]>
I wanted to apply this series, but it turned out that it depends on:
[U-Boot] [PATCH v2 0/6] ARM: meson: Add support for G12A based U200 board
Let's wait till the above one is pulled to master.
Quoted 172 lines
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-meson/usb.hnew file mode 100644 index 0000000000..b794b5ce77arch/arm/include/asm/arch-meson/usb.h new file +10
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_modemode); +
arch/arm/include/asm/arch-meson/usb.h new file +1
-0+#endif /* __MESON_USB_H__ */ (quoted diff) +0
-0
b/arch/arm/mach-meson/board-g12a.cindexfc3764b960..1652970fbd100644arch/arm/mach-meson/board-g12a.c +5
-0@@ -12,7 +12,12 @@#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.h> +#include <usb/dwc2_udc.h> #include <phy.h> +#include <clk.h> DECLARE_GLOBAL_DATA_PTR ;@@ -148,3 +153,124 @@ void meson_eth_init(phy_interface_t mode,unsigned int flags) /* Enable power gate */
arch/arm/mach-meson/board-g12a.c +17
-0clrbits_le32 (G12A_MEM_PD_REG_0 ,G12A_MEM_PD_REG_0_ETH_MASK ); } + +#if CONFIG_IS_ENABLED (USB_DWC3_MESON_G12A ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_g12a_dwc2_data; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct fdtdec_phandle_args args; +const void *blob = gd->fdt_blob; +int node, dwc2_node; +struct udevice *dev, *clk_dev; +struct clk clk; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +11
-0+if (node <0 ) { +debug ("Not found usb-control node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, node)) { +debug ("usb is disabled in the device tree\n" ); +return -ENODEV ; + } + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +8
-0+if (ret) { +debug ("Not found usb-control device\n" ); +return ret; + } + +/* find the dwc2 node */ + dwc2_node = fdt_node_offset_by_compatible(blob, node, +"amlogic,meson-g12a-usb");
arch/arm/mach-meson/board-g12a.c +11
-0+if (dwc2_node <0 ) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + + meson_g12a_dwc2_data.regs_otg = fdtdec_get_addr(blob,
dwc2_node, "reg");arch/arm/mach-meson/board-g12a.c +7
-0+if (meson_g12a_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret = fdtdec_parse_phandle_with_args(blob, dwc2_node,"clocks",
arch/arm/mach-meson/board-g12a.c +1
-0+ "#clock-cells", 0, 0,&args);
arch/arm/mach-meson/board-g12a.c +2
-0+if (ret) { + debug("usbotg has no clocks defined in the devicetree\n");
arch/arm/mach-meson/board-g12a.c +4
-0+return ret; + } + + ret = uclass_get_device_by_of_offset(UCLASS_CLK, args.node,
&clk_dev);arch/arm/mach-meson/board-g12a.c +18
-0+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; + } + + meson_g12a_dwc2_data.rx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-rx-fifo-size", 0);arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.np_tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,arch/arm/mach-meson/board-g12a.c +1
-0+ "g-np-tx-fifo-size",0);
arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-tx-fifo-size", 0); +arch/arm/mach-meson/board-g12a.c +2
-0+/* Switch to peripheral mode */ + ret = dwc3_meson_g12a_force_mode(dev,
USB_DR_MODE_PERIPHERAL);arch/arm/mach-meson/board-g12a.c +16
-0+if (ret) +return ret; + +return dwc2_udc_probe (&meson_g12a_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +const void *blob = gd->fdt_blob; +struct udevice *dev; +int node; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +7
-0+if (node <0 ) +return -ENODEV ; + +if (!fdtdec_get_is_enabled (blob, node)) +return -ENODEV ; + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +1
-0+if (ret)
arch/arm/mach-meson/board-g12a.c void meson_eth_init(phy_interface_t mode, unsigned int flags) · line 276
Quoted 10 lines
arch/arm/mach-meson/board-g12a.c +10
-0+return ret; + +/* Switch to OTG mode */ + ret =dwc3_meson_g12a_force_mode (dev,USB_DR_MODE_HOST ); +if (ret) +return ret; + + return 0; +} +#endif
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190419/95a6834b/attachment.sig>
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
Hi Lukasz,
Quoted 12 lines · Lukasz Majewski
Hi Neil,
Quoted 10 lines
Adds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
Quoted 7 lines
Quoted 1 line
Signed-off-by Neil Armstrong <[email protected]>I wanted to apply this series, but it turned out that it depends on:
[U-Boot] [PATCH v2 0/6] ARM: meson: Add support for G12A based U200 boardLet's wait till the above one is pulled to master.
I just sent a PR to Tom, will ping you when pulled to master.
Thanks,
Neil
Quoted 189 lines
Quoted 173 lines
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-meson/usb.hnew file mode 100644 index 0000000000..b794b5ce77arch/arm/include/asm/arch-meson/usb.h new file +10
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_modemode); +
arch/arm/include/asm/arch-meson/usb.h new file +1
-0+#endif /* __MESON_USB_H__ */ (quoted diff) +0
-0
b/arch/arm/mach-meson/board-g12a.cindexfc3764b960..1652970fbd100644arch/arm/mach-meson/board-g12a.c +5
-0@@ -12,7 +12,12 @@#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.h> +#include <usb/dwc2_udc.h> #include <phy.h> +#include <clk.h> DECLARE_GLOBAL_DATA_PTR ;@@ -148,3 +153,124 @@ void meson_eth_init(phy_interface_t mode,unsigned int flags) /* Enable power gate */
arch/arm/mach-meson/board-g12a.c +17
-0clrbits_le32 (G12A_MEM_PD_REG_0 ,G12A_MEM_PD_REG_0_ETH_MASK ); } + +#if CONFIG_IS_ENABLED (USB_DWC3_MESON_G12A ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_g12a_dwc2_data; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct fdtdec_phandle_args args; +const void *blob = gd->fdt_blob; +int node, dwc2_node; +struct udevice *dev, *clk_dev; +struct clk clk; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +11
-0+if (node <0 ) { +debug ("Not found usb-control node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, node)) { +debug ("usb is disabled in the device tree\n" ); +return -ENODEV ; + } + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +8
-0+if (ret) { +debug ("Not found usb-control device\n" ); +return ret; + } + +/* find the dwc2 node */ + dwc2_node = fdt_node_offset_by_compatible(blob, node, +"amlogic,meson-g12a-usb");
arch/arm/mach-meson/board-g12a.c +11
-0+if (dwc2_node <0 ) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + + meson_g12a_dwc2_data.regs_otg = fdtdec_get_addr(blob,
dwc2_node, "reg");arch/arm/mach-meson/board-g12a.c +7
-0+if (meson_g12a_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret = fdtdec_parse_phandle_with_args(blob, dwc2_node,"clocks",
arch/arm/mach-meson/board-g12a.c +1
-0+ "#clock-cells", 0, 0,&args);
arch/arm/mach-meson/board-g12a.c +2
-0+if (ret) { + debug("usbotg has no clocks defined in the devicetree\n");
arch/arm/mach-meson/board-g12a.c +4
-0+return ret; + } + + ret = uclass_get_device_by_of_offset(UCLASS_CLK, args.node,
&clk_dev);arch/arm/mach-meson/board-g12a.c +18
-0+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; + } + + meson_g12a_dwc2_data.rx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-rx-fifo-size", 0);arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.np_tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,arch/arm/mach-meson/board-g12a.c +1
-0+ "g-np-tx-fifo-size",0);
arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-tx-fifo-size", 0); +arch/arm/mach-meson/board-g12a.c +2
-0+/* Switch to peripheral mode */ + ret = dwc3_meson_g12a_force_mode(dev,
USB_DR_MODE_PERIPHERAL);arch/arm/mach-meson/board-g12a.c +16
-0+if (ret) +return ret; + +return dwc2_udc_probe (&meson_g12a_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +const void *blob = gd->fdt_blob; +struct udevice *dev; +int node; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +7
-0+if (node <0 ) +return -ENODEV ; + +if (!fdtdec_get_is_enabled (blob, node)) +return -ENODEV ; + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +1
-0+if (ret)arch/arm/mach-meson/board-g12a.c void meson_eth_init(phy_interface_t mode, unsigned int flags) · line 276
Quoted 10 lines
arch/arm/mach-meson/board-g12a.c +10
-0+return ret; + +/* Switch to OTG mode */ + ret =dwc3_meson_g12a_force_mode (dev,USB_DR_MODE_HOST ); +if (ret) +return ret; + + return 0; +} +#endif Best regards,
Quoted 8 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190423/96c736af/attachment.sig>
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
Hi,
Quoted 17 lines · Neil Armstrong
Hi Lukasz,
Quoted 14 lines · Lukasz Majewski
Hi Neil,
Quoted 11 lines
Adds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
Signed-off-by Neil Armstrong <[email protected]>
Quoted 7 lines
Quoted 5 lines
I wanted to apply this series, but it turned out that it depends on:
[U-Boot] [PATCH v2 0/6] ARM: meson: Add support for G12A based U200 boardLet's wait till the above one is pulled to master.
I just sent a PR to Tom, will ping you when pulled to master.
Tom pulled it to master,
Thanks,
Neil
Quoted 203 lines
Thanks,
NeilQuoted 197 lines
Quoted 173 lines
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-meson/usb.hnew file mode 100644 index 0000000000..b794b5ce77arch/arm/include/asm/arch-meson/usb.h new file +10
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_modemode); +
arch/arm/include/asm/arch-meson/usb.h new file +1
-0+#endif /* __MESON_USB_H__ */ (quoted diff) +0
-0
b/arch/arm/mach-meson/board-g12a.cindexfc3764b960..1652970fbd100644arch/arm/mach-meson/board-g12a.c +5
-0@@ -12,7 +12,12 @@#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.h> +#include <usb/dwc2_udc.h> #include <phy.h> +#include <clk.h> DECLARE_GLOBAL_DATA_PTR ;@@ -148,3 +153,124 @@ void meson_eth_init(phy_interface_t mode,unsigned int flags) /* Enable power gate */
arch/arm/mach-meson/board-g12a.c +17
-0clrbits_le32 (G12A_MEM_PD_REG_0 ,G12A_MEM_PD_REG_0_ETH_MASK ); } + +#if CONFIG_IS_ENABLED (USB_DWC3_MESON_G12A ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_g12a_dwc2_data; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct fdtdec_phandle_args args; +const void *blob = gd->fdt_blob; +int node, dwc2_node; +struct udevice *dev, *clk_dev; +struct clk clk; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +11
-0+if (node <0 ) { +debug ("Not found usb-control node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, node)) { +debug ("usb is disabled in the device tree\n" ); +return -ENODEV ; + } + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +8
-0+if (ret) { +debug ("Not found usb-control device\n" ); +return ret; + } + +/* find the dwc2 node */ + dwc2_node = fdt_node_offset_by_compatible(blob, node, +"amlogic,meson-g12a-usb");
arch/arm/mach-meson/board-g12a.c +11
-0+if (dwc2_node <0 ) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + + meson_g12a_dwc2_data.regs_otg = fdtdec_get_addr(blob,
dwc2_node, "reg");arch/arm/mach-meson/board-g12a.c +7
-0+if (meson_g12a_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret = fdtdec_parse_phandle_with_args(blob, dwc2_node,"clocks",
arch/arm/mach-meson/board-g12a.c +1
-0+ "#clock-cells", 0, 0,&args);
arch/arm/mach-meson/board-g12a.c +2
-0+if (ret) { + debug("usbotg has no clocks defined in the devicetree\n");
arch/arm/mach-meson/board-g12a.c +4
-0+return ret; + } + + ret = uclass_get_device_by_of_offset(UCLASS_CLK, args.node,
&clk_dev);arch/arm/mach-meson/board-g12a.c +18
-0+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; + } + + meson_g12a_dwc2_data.rx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-rx-fifo-size", 0);arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.np_tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,arch/arm/mach-meson/board-g12a.c +1
-0+ "g-np-tx-fifo-size",0);
arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-tx-fifo-size", 0); +arch/arm/mach-meson/board-g12a.c +2
-0+/* Switch to peripheral mode */ + ret = dwc3_meson_g12a_force_mode(dev,
USB_DR_MODE_PERIPHERAL);arch/arm/mach-meson/board-g12a.c +16
-0+if (ret) +return ret; + +return dwc2_udc_probe (&meson_g12a_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +const void *blob = gd->fdt_blob; +struct udevice *dev; +int node; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +7
-0+if (node <0 ) +return -ENODEV ; + +if (!fdtdec_get_is_enabled (blob, node)) +return -ENODEV ; + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +1
-0+if (ret)arch/arm/mach-meson/board-g12a.c void meson_eth_init(phy_interface_t mode, unsigned int flags) · line 276
Quoted 10 lines
arch/arm/mach-meson/board-g12a.c +10
-0+return ret; + +/* Switch to OTG mode */ + ret =dwc3_meson_g12a_force_mode (dev,USB_DR_MODE_HOST ); +if (ret) +return ret; + + return 0; +} +#endif Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190426/96e12690/attachment.sig>
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
In reply to Lukasz Majewski-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi Lukasw,
Le 19/04/2019 08:17, Lukasz Majewski a écrit :
Quoted 12 lines
Hi Neil,
Quoted 10 lines
Adds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
Quoted 7 lines
Quoted 1 line
Signed-off-by Neil Armstrong <[email protected]>I wanted to apply this series, but it turned out that it depends on:
[U-Boot] [PATCH v2 0/6] ARM: meson: Add support for G12A based U200 boardLet's wait till the above one is pulled to master.
Do you want me to resend the serie rebased on master ?
Neil
Quoted 189 lines
Quoted 173 lines
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-meson/usb.hnew file mode 100644 index 0000000000..b794b5ce77arch/arm/include/asm/arch-meson/usb.h new file +10
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_modemode); +
arch/arm/include/asm/arch-meson/usb.h new file +1
-0+#endif /* __MESON_USB_H__ */ (quoted diff) +0
-0
b/arch/arm/mach-meson/board-g12a.cindexfc3764b960..1652970fbd100644arch/arm/mach-meson/board-g12a.c +5
-0@@ -12,7 +12,12 @@#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.h> +#include <usb/dwc2_udc.h> #include <phy.h> +#include <clk.h> DECLARE_GLOBAL_DATA_PTR ;@@ -148,3 +153,124 @@ void meson_eth_init(phy_interface_t mode,unsigned int flags) /* Enable power gate */
arch/arm/mach-meson/board-g12a.c +17
-0clrbits_le32 (G12A_MEM_PD_REG_0 ,G12A_MEM_PD_REG_0_ETH_MASK ); } + +#if CONFIG_IS_ENABLED (USB_DWC3_MESON_G12A ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_g12a_dwc2_data; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct fdtdec_phandle_args args; +const void *blob = gd->fdt_blob; +int node, dwc2_node; +struct udevice *dev, *clk_dev; +struct clk clk; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +11
-0+if (node <0 ) { +debug ("Not found usb-control node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, node)) { +debug ("usb is disabled in the device tree\n" ); +return -ENODEV ; + } + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +8
-0+if (ret) { +debug ("Not found usb-control device\n" ); +return ret; + } + +/* find the dwc2 node */ + dwc2_node = fdt_node_offset_by_compatible(blob, node, +"amlogic,meson-g12a-usb");
arch/arm/mach-meson/board-g12a.c +11
-0+if (dwc2_node <0 ) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + + meson_g12a_dwc2_data.regs_otg = fdtdec_get_addr(blob,
dwc2_node, "reg");arch/arm/mach-meson/board-g12a.c +7
-0+if (meson_g12a_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret = fdtdec_parse_phandle_with_args(blob, dwc2_node,"clocks",
arch/arm/mach-meson/board-g12a.c +1
-0+ "#clock-cells", 0, 0,&args);
arch/arm/mach-meson/board-g12a.c +2
-0+if (ret) { + debug("usbotg has no clocks defined in the devicetree\n");
arch/arm/mach-meson/board-g12a.c +4
-0+return ret; + } + + ret = uclass_get_device_by_of_offset(UCLASS_CLK, args.node,
&clk_dev);arch/arm/mach-meson/board-g12a.c +18
-0+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; + } + + meson_g12a_dwc2_data.rx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-rx-fifo-size", 0);arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.np_tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,arch/arm/mach-meson/board-g12a.c +1
-0+ "g-np-tx-fifo-size",0);
arch/arm/mach-meson/board-g12a.c +1
-0+ meson_g12a_dwc2_data.tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-tx-fifo-size", 0); +arch/arm/mach-meson/board-g12a.c +2
-0+/* Switch to peripheral mode */ + ret = dwc3_meson_g12a_force_mode(dev,
USB_DR_MODE_PERIPHERAL);arch/arm/mach-meson/board-g12a.c +16
-0+if (ret) +return ret; + +return dwc2_udc_probe (&meson_g12a_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +const void *blob = gd->fdt_blob; +struct udevice *dev; +int node; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +7
-0+if (node <0 ) +return -ENODEV ; + +if (!fdtdec_get_is_enabled (blob, node)) +return -ENODEV ; + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +1
-0+if (ret)arch/arm/mach-meson/board-g12a.c void meson_eth_init(phy_interface_t mode, unsigned int flags) · line 276
Quoted 10 lines
arch/arm/mach-meson/board-g12a.c +10
-0+return ret; + +/* Switch to OTG mode */ + ret =dwc3_meson_g12a_force_mode (dev,USB_DR_MODE_HOST ); +if (ret) +return ret; + + return 0; +} +#endif Best regards,
Quoted 8 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEiew9BYRGIXRQ8ihIFpq3saTP+K4FAlzQflgACgkQFpq3saTP +K7JKQgA1+32i8yaRlXm8TizXE5CT9SpGN91mLVzNnPYFCapi/Y/o1pirNDy2lVF tsd13N94+Z8U6cNEnDaaELaM8E+A0phDF3olBvbZ++76kcBcbZtsEb1slxjTyLC2 pEBGRbNrmmUzCS8s0NyrtTeuHhgVLz6F/krGHkrxwak9G4xC/7MK5SyhyDeVGHgu GvAxDUqw204L+2kzGmVmX0/QZEPnpd/pszSlYSXoeNbiBTSNKRI3S4ZVYaI/KWdx kkOaWYq5lrph5TrQmnCPBgegsurjxbRp+WuZciThLxvqXuhI0sA47+2odedxkzVB ST+CG785r/lhIBqAGMA5YxBjMEEdVA==
=iC0M
-----END PGP SIGNATURE-----
PATCH v2 3/3 mach-meson: g12a: add DWC2 peripheral mode support
Hi Neil,
Quoted 20 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512Hi Lukasw,
Le 19/04/2019 08:17, Lukasz Majewski a écrit :
Quoted 14 lines
Hi Neil,
Quoted 11 lines
Adds support for Amlogic G12A USB Device mode.
The DWC2 Controller behind the Glue can be connected to an OTG capable PHY. The Glue setups the PHY mode.
This patch implements Device mode support by adding a board_usb_init/cleanup setting up the DWC2 controller and switch the OTG capable port to Device before starting the DWC2 controller in Device mode.
Signed-off-by Neil Armstrong <[email protected]>
Quoted 7 lines
Quoted 5 lines
I wanted to apply this series, but it turned out that it depends on:
[U-Boot] [PATCH v2 0/6] ARM: meson: Add support for G12A based U200 boardLet's wait till the above one is pulled to master.
Do you want me to resend the serie rebased on master ?
Yes, please. That would speed up the process considerably.
Thanks in advance for help.
Quoted 202 lines
Neil
Quoted 189 lines
Quoted 173 lines
--- arch/arm/include/asm/arch-meson/usb.h | 12 +++ arch/arm/mach-meson/board-g12a.c | 126 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/usb.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-meson/usb.hnew file mode 100644 index 0000000000..b794b5ce77arch/arm/include/asm/arch-meson/usb.h new file +10
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_USB_H__ +#define __MESON_USB_H__ + +int dwc3_meson_g12a_force_mode(struct udevice *dev, enum
usb_dr_modemode); +arch/arm/include/asm/arch-meson/usb.h new file +1
-0+#endif /* __MESON_USB_H__ */ (quoted diff) +0
-0
b/arch/arm/mach-meson/board-g12a.cindexfc3764b960..1652970fbd100644 ---a/arch/arm/mach-meson/board-g12a.c
+++b/arch/arm/mach-meson/board-g12a.carch/arm/mach-meson/board-g12a.c +5
-0@@ -12,7 +12,12 @@#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.h> +#include <usb/dwc2_udc.h> #include <phy.h> +#include <clk.h> DECLARE_GLOBAL_DATA_PTR ;@@ -148,3 +153,124 @@ void meson_eth_init(phy_interface_t mode,unsigned int flags) /* Enable power gate */
clrbits_le32(G12A_MEM_PD_REG_0,G12A_MEM_PD_REG_0_ETH_MASK); }arch/arm/mach-meson/board-g12a.c +17
-0+ +#if CONFIG_IS_ENABLED (USB_DWC3_MESON_G12A ) && \ +CONFIG_IS_ENABLED (USB_GADGET_DWC2_OTG ) +static struct dwc2_plat_otg_data meson_g12a_dwc2_data; + +int board_usb_init (int index,enum usb_init_type init) +{ +struct fdtdec_phandle_args args; +const void *blob = gd->fdt_blob; +int node, dwc2_node; +struct udevice *dev, *clk_dev; +struct clk clk; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +11
-0+if (node <0 ) { +debug ("Not found usb-control node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, node)) { +debug ("usb is disabled in the device tree\n" ); +return -ENODEV ; + } + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +8
-0+if (ret) { +debug ("Not found usb-control device\n" ); +return ret; + } + +/* find the dwc2 node */ + dwc2_node = fdt_node_offset_by_compatible(blob, node, +"amlogic,meson-g12a-usb");
arch/arm/mach-meson/board-g12a.c +11
-0+if (dwc2_node <0 ) { +debug ("Not found dwc2 node\n" ); +return -ENODEV ; + } + +if (!fdtdec_get_is_enabled (blob, dwc2_node)) { +debug ("dwc2 is disabled in the device tree\n" ); +return -ENODEV ; + } + + meson_g12a_dwc2_data.regs_otg = fdtdec_get_addr(blob,
dwc2_node, "reg");arch/arm/mach-meson/board-g12a.c +7
-0+if (meson_g12a_dwc2_data.regs_otg ==FDT_ADDR_T_NONE ) { +debug ("usbotg: can't get base address\n" ); +return -ENODATA ; + } + +/* Enable clock */ + ret = fdtdec_parse_phandle_with_args(blob, dwc2_node,"clocks",
(quoted diff) +1
-0+ "#clock-cells", 0, 0,&args);
(quoted diff) +2
-0+ if (ret) { + debug("usbotg has no clocks defined in the devicetree\n");
arch/arm/mach-meson/board-g12a.c +4
-0+return ret; + } + + ret = uclass_get_device_by_of_offset(UCLASS_CLK,args.node,
&clk_dev);arch/arm/mach-meson/board-g12a.c +18
-0+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; + } + + meson_g12a_dwc2_data.rx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-rx-fifo-size", 0);(quoted diff) +1
-0+ meson_g12a_dwc2_data.np_tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,(quoted diff) +1
-0+ "g-np-tx-fifo-size",0);
(quoted diff) +1
-0+ meson_g12a_dwc2_data.tx_fifo_sz = fdtdec_get_int(blob,
dwc2_node,
+
"g-tx-fifo-size", 0); +(quoted diff) +2
-0+ /* Switch to peripheral mode */ + ret = dwc3_meson_g12a_force_mode(dev,
USB_DR_MODE_PERIPHERAL);arch/arm/mach-meson/board-g12a.c +16
-0+if (ret) +return ret; + +return dwc2_udc_probe (&meson_g12a_dwc2_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +const void *blob = gd->fdt_blob; +struct udevice *dev; +int node; +int ret; + +/* find the usb glue node */ + node = fdt_node_offset_by_compatible(blob, -1, +"amlogic,meson-g12a-usb-ctrl");
arch/arm/mach-meson/board-g12a.c +7
-0+if (node <0 ) +return -ENODEV ; + +if (!fdtdec_get_is_enabled (blob, node)) +return -ENODEV ; + + ret = uclass_get_device_by_of_offset(UCLASS_SIMPLE_BUS,node, &dev);
arch/arm/mach-meson/board-g12a.c +1
-0+if (ret)arch/arm/mach-meson/board-g12a.c void meson_eth_init(phy_interface_t mode, unsigned int flags) · line 276
Quoted 10 lines
arch/arm/mach-meson/board-g12a.c +10
-0+return ret; + +/* Switch to OTG mode */ + ret =dwc3_meson_g12a_force_mode (dev,USB_DR_MODE_HOST ); +if (ret) +return ret; + + return 0; +} +#endif Best regards,
Quoted 8 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de-----BEGIN PGP SIGNATURE-----
Quoted 9 lines
iQEzBAEBCgAdFiEEiew9BYRGIXRQ8ihIFpq3saTP+K4FAlzQflgACgkQFpq3saTP +K7JKQgA1+32i8yaRlXm8TizXE5CT9SpGN91mLVzNnPYFCapi/Y/o1pirNDy2lVF tsd13N94+Z8U6cNEnDaaELaM8E+A0phDF3olBvbZ++76kcBcbZtsEb1slxjTyLC2 pEBGRbNrmmUzCS8s0NyrtTeuHhgVLz6F/krGHkrxwak9G4xC/7MK5SyhyDeVGHgu GvAxDUqw204L+2kzGmVmX0/QZEPnpd/pszSlYSXoeNbiBTSNKRI3S4ZVYaI/KWdx kkOaWYq5lrph5TrQmnCPBgegsurjxbRp+WuZciThLxvqXuhI0sA47+2odedxkzVB ST+CG785r/lhIBqAGMA5YxBjMEEdVA==
=iC0M
-----END PGP SIGNATURE-----
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/5fb00bac/attachment.sig>