“USBH device tree configuration”的版本间的差异

来自百问网嵌入式Linux wiki
 
(未显示同一用户的7个中间版本)
第7行: 第7行:
  
 
== DT bindings documentation ==
 
== DT bindings documentation ==
[[USBH internal peripheral| STM32 USBH internal peripheral]] is a USB Host device, composed of an '''EHCI''' controller and an '''OHCI''' controller.
+
[[USBH internal peripheral| STM32 USBH internal peripheral]] 是一个USB主机设备,由'''EHCI'''控制器和'''OHCI'''控制器组成。
 +
每个控制器代表一个单独的绑定文档:
 +
* 通用USB EHCI控制器设备树绑定<ref name="ehci_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-ehci.txt}} Generic USB EHCI controller device tree bindings</ref> d文档处理标准EHCI控制器核心资源(例如寄存器,时钟,重置,中断等)。
 +
* 通用USB OHCI控制器设备树绑定<ref name="ohci_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-ohci.txt}} Generic USB OHCI controller device tree bindings</ref> 文档处理标准OHCI控制器核心资源(例如寄存器,时钟,复位,中断等)。
  
Each controller is represented as a separate binding document:
+
每个控制器使用[[USB overview|USB framework]]提出的通用USB主机控制器设备(HCD)属性和通用USB属性:
* The generic USB EHCI controller device tree bindings<ref name="ehci_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-ehci.txt}} Generic USB EHCI controller device tree bindings</ref> document deals with standard EHCI controller core resources (e.g. registers, clock, reset, interrupt, ...).
+
* 通用USB HCD设备树绑定<ref name="hcd_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-hcd.txt}} Generic USB HCD (Host Controller Device) device tree bindings</ref> 文档处理USB主机控制器PHY资源。
* The generic USB OHCI controller device tree bindings<ref name="ohci_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-ohci.txt}} Generic USB OHCI controller device tree bindings</ref> document deals with standard OHCI controller core resources (e.g. registers, clock, reset, interrupt, ...).
+
* 通用USB设备树绑定<ref name="generic_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/generic.txt}} Generic USB device tree bindings</ref> 通用USB设备树绑定文档涉及USB可选属性(例如,最大速度、同伴等)
 
 
Each controller uses the generic USB Host Controller Device (HCD) properties and generic USB properties, proposed by [[USB overview|USB framework]]:
 
* The generic USB HCD device tree bindings<ref name="hcd_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/usb-hcd.txt}} Generic USB HCD (Host Controller Device) device tree bindings</ref> document deals with USB Host Controller PHY resources.
 
* The generic USB device tree bindings<ref name="generic_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/generic.txt}} Generic USB device tree bindings</ref> document deals with USB optional properties (e.g. maximum speed, companion, ...).
 
  
 
== DT configuration ==
 
== DT configuration ==
This hardware description is a combination of the '''STM32 microprocessor''' device tree files (''.dtsi'' extension) and '''board''' device tree files (''.dts'' extension). See the [[Device tree]] for an explanation of the device tree file split.
+
该硬件描述是“''STM32微处理器”''设备树文件(扩展名为.dtsi)和“''板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见 [[Device tree]]
 
 
'''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details.
 
  
 +
'''STM32CubeMX'''可用于生成板卡设备树。 有关更多详细信息,请参考 [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]]。
 
===DT configuration (STM32 level) ===
 
===DT configuration (STM32 level) ===
The '''usbh_ehci''' and '''usbh_ohci''' DT nodes are declared in stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi}}, STM32MP157C device tree file</ref>.
+
在stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi}}, STM32MP157C device tree file</ref>中声明。
  
They are composed of a set of properties, used to describe the [[USBH_internal_peripheral#Features|USBH_EHCI and USBH_OHCI]] controllers: registers address, clocks, resets, interrupts...
+
它们由一组属性组成,用于描述 [[USBH_internal_peripheral#Features|USBH_EHCI and USBH_OHCI]] 控制器:寄存器地址,时钟,复位,中断...
  
 
  '''usbh_ohci''': usbh-ohci@5800c000 { {{Highlight|/* USBH OHCI controller */}}
 
  '''usbh_ohci''': usbh-ohci@5800c000 { {{Highlight|/* USBH OHCI controller */}}
第45行: 第43行:
 
  status = "disabled";  {{Highlight| * that port is switched over to the USBH OHCI '''companion'''<ref name="generic_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/generic.txt}} Generic USB device tree bindings</ref> controller */}}
 
  status = "disabled";  {{Highlight| * that port is switched over to the USBH OHCI '''companion'''<ref name="generic_bindings">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/usb/generic.txt}} Generic USB device tree bindings</ref> controller */}}
 
  };
 
  };
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}}
+
{{Warning|该设备树部分与STM32微处理器有关。 它必须保持原样,而不能由最终用户修改。}}
  
 
=== DT configuration (board level) ===
 
=== DT configuration (board level) ===
Follow the sequences described in the below chapters to configure and enable the USBH on your board.
+
请按照以下章节中描述的顺序在板上配置和启用USBH。
  
[[USBH_internal_peripheral|USBH]] supports up to two physical ports, using on-chip [[USBPHYC_internal_peripheral|USBPHYC]]:
+
[[USBH_internal_peripheral|USBH]] 使用片上[[USBPHYC_internal_peripheral|USBPHYC]]最多支持两个物理端口:
 
* USBPHYC port#1 is assigned to the USBH
 
* USBPHYC port#1 is assigned to the USBH
 
* USBPHYC port#2 can be statically assigned to the USBH or to the [[OTG_internal_peripheral|OTG]]
 
* USBPHYC port#2 can be statically assigned to the USBH or to the [[OTG_internal_peripheral|OTG]]
{{Info|Please refer to [[USBPHYC device tree configuration]] for additional information on the USBPHYC configuration}}
+
{{Info|请参考[[USBPHYC device tree configuration]] for additional information on the USBPHYC configuration}}
[[USBH_internal_peripheral|USBH]] is composed of EHCI and OHCI controllers:
+
[[USBH_internal_peripheral|USBH]]由EHCI和OHCI控制器组成:
* high-speed operation is achieved through the EHCI controller
+
* 通过EHCI控制器实现高速运行
* full-speed and low-speed operation can be achieved by either:
+
* 全速和低速操作可以通过以下任一方式实现:
** a high-speed HUB IC wired to the downstream port
+
** 连接到下游端口的高速HUB IC
** the OHCI controller
+
** OHCI控制器
  
 
==== DT configuration with external high speed-HUB ====
 
==== DT configuration with external high speed-HUB ====
* Enable the '''usbh_ehci''' by setting '''status = "okay"'''
+
* 通过设置'''status =“ okay”'''启用'''usbh_ehci'''
* Configure the PHY(s) through '''phys''' and '''phy-names'''
+
* 通过'''phys''''''phy-names'''配置PHY
{{Info|There's no need to enable '''usbh_ohci''', when all the low-speed and full-speed traffic is managed by the high-speed hub directly connected to the downstream port.}}
+
{{Info|当所有低速和全速流量由直接连接到下游端口的高速集线器管理时,无需启用'''usbh_ohci'''}}
  
 
==== DT configuration with OHCI to achieve full-speed and low-speed ====
 
==== DT configuration with OHCI to achieve full-speed and low-speed ====
* Enable the '''usbh_ehci''' by setting '''status = "okay"'''
+
* 通过设置'''status =“ okay”'''启用'''usbh_ehci'''
* Enable the '''usbh_ohci''' by setting '''status = "okay"'''
+
* 通过设置'''status =“ okay”'''启用'''usbh_ohci'''
For both controllers:
+
对于两个控制器:
* Configure the PHY(s) through '''phys''' and '''phy-names'''
+
* 通过'''phys''''''phy-names'''配置PHY
  
 
=== DT configuration examples ===
 
=== DT configuration examples ===
  
 
==== DT configuration when using port0 with a high-speed hub ====
 
==== DT configuration when using port0 with a high-speed hub ====
Below example shows how to configure the USBH when using the physical port 0 (the second physical port is unused).
+
下例显示了使用物理端口0(未使用第二个物理端口)时如何配置USBH。
  
A high-speed hub controller IC is used on the board: no need to enable usbh_ohci, all low-speed and full-speed traffic is managed by the hub.
+
板上使用了高速集线器控制器IC:无需启用usbh_ohci,所有低速和全速流量都由集线器管理。
 
  &usbh_ehci {
 
  &usbh_ehci {
 
  phys = {{HighlightParam|<&usbphyc_port0>}};          {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
 
  phys = {{HighlightParam|<&usbphyc_port0>}};          {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
第86行: 第84行:
  
 
==== DT configuration when using port0 ====
 
==== DT configuration when using port0 ====
Below example shows how to configure the USBH when using the physical port 0 (the second physical port is unused, or in use by the [[OTG_device_tree_configuration|OTG]] and no high-speed hub is used).
+
下面的示例显示了如何在使用物理端口0(第二个物理端口未使用,或由 [[OTG_device_tree_configuration|OTG]] 使用)并且不使用高速集线器的情况下配置USBH。
 
  &usbh_ehci {
 
  &usbh_ehci {
 
  phys = {{HighlightParam|<&usbphyc_port0>}};          {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
 
  phys = {{HighlightParam|<&usbphyc_port0>}};          {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
第100行: 第98行:
  
 
==== DT configuration when using the two physical ports ====
 
==== DT configuration when using the two physical ports ====
Below example shows how to configure the USBH when using the two physical ports.
+
以下示例显示了使用这两个物理端口时如何配置USBH。
 
  &usbh_ehci {
 
  &usbh_ehci {
 
  phys = {{HighlightParam|<&usbphyc_port0>}}, {{Highlight|<&usbphyc_port1 '''1'''>}};    {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
 
  phys = {{HighlightParam|<&usbphyc_port0>}}, {{Highlight|<&usbphyc_port1 '''1'''>}};    {{HighlightParam|/* Use USBPHYC HS PHY port #1, mapped on USBH controller */}}
第116行: 第114行:
  
 
==How to configure the DT using STM32CubeMX==
 
==How to configure the DT using STM32CubeMX==
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32|platform configuration device tree]] files.<br />
+
[[STM32CubeMX]] 工具可用于配置STM32MPU设备并获取相应的 [[Device_tree#STM32|platform configuration device tree]] 文件。<br />
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information.
+
STM32CubeMX可能不支持以上 [[#DT bindings documentation|DT bindings documentation]] 段中描述的所有属性。如果是这样,该工具会在生成的设备树中插入“''用户部分”''。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见 [[STM32CubeMX]] 用户手册。
  
 
==References==
 
==References==
Please refer to the following links for full description:
+
请参考以下链接以获得完整描述:
  
 
<references />
 
<references />
 
<noinclude>
 
{{ArticleBasedOnModel | Peripheral or framework device tree configuration model}}
 
{{PublicationRequestId | 10337 (AlainF) | 2019-01-16}}
 
[[Category:Device tree configuration]]
 
[[Category:USB|0]]
 
</noinclude>
 

2020年11月11日 (三) 09:10的最新版本

Article purpose

本文介绍如何在将 USBH internal peripheral 分配给 Linux® 操作系统时对其进行配置。 在这种情况下,它由USB framework控制。

使用device tree机制执行配置。

“ USBH Linux驱动程序” (EHCI[1], OHCI[2]) ,它们在USB framework中注册了相关信息。

DT bindings documentation

STM32 USBH internal peripheral 是一个USB主机设备,由EHCI控制器和OHCI控制器组成。 每个控制器代表一个单独的绑定文档:

  • 通用USB EHCI控制器设备树绑定[3] d文档处理标准EHCI控制器核心资源(例如寄存器,时钟,重置,中断等)。
  • 通用USB OHCI控制器设备树绑定[4] 文档处理标准OHCI控制器核心资源(例如寄存器,时钟,复位,中断等)。

每个控制器使用USB framework提出的通用USB主机控制器设备(HCD)属性和通用USB属性:

  • 通用USB HCD设备树绑定[5] 文档处理USB主机控制器PHY资源。
  • 通用USB设备树绑定[6] 通用USB设备树绑定文档涉及USB可选属性(例如,最大速度、同伴等)。

DT configuration

该硬件描述是“STM32微处理器”设备树文件(扩展名为.dtsi)和“板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见 Device tree

STM32CubeMX可用于生成板卡设备树。 有关更多详细信息,请参考 How to configure the DT using STM32CubeMX

DT configuration (STM32 level)

在stm32mp157c.dtsi[7]中声明。

它们由一组属性组成,用于描述 USBH_EHCI and USBH_OHCI 控制器:寄存器地址,时钟,复位,中断...

usbh_ohci: usbh-ohci@5800c000 { 			/* USBH OHCI controller */
	compatible = "generic-ohci";
	reg = <0x5800c000 0x1000>;
	clocks = <&rcc USBH>;
	resets = <&rcc USBH_R>;
	interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
	status = "disabled";
};

usbh_ehci: usbh-ehci@5800d000 { 			/* USBH EHCI controller */
	compatible = "generic-ehci";
	reg = <0x5800d000 0x1000>;
	clocks = <&rcc USBH>;
	resets = <&rcc USBH_R>;
	interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
	companion = <&usbh_ohci>;  			/* When USBH EHCI controller detects a full or low speed device on a port,
	status = "disabled";  				 * that port is switched over to the USBH OHCI companion[6] controller */
};
Warning.png 该设备树部分与STM32微处理器有关。 它必须保持原样,而不能由最终用户修改。

DT configuration (board level)

请按照以下章节中描述的顺序在板上配置和启用USBH。

USBH 使用片上USBPHYC最多支持两个物理端口:

  • USBPHYC port#1 is assigned to the USBH
  • USBPHYC port#2 can be statically assigned to the USBH or to the OTG
Info.png 请参考USBPHYC device tree configuration for additional information on the USBPHYC configuration

USBH由EHCI和OHCI控制器组成:

  • 通过EHCI控制器实现高速运行
  • 全速和低速操作可以通过以下任一方式实现:
    • 连接到下游端口的高速HUB IC
    • OHCI控制器

DT configuration with external high speed-HUB

  • 通过设置status =“ okay”启用usbh_ehci
  • 通过physphy-names配置PHY
Info.png 当所有低速和全速流量由直接连接到下游端口的高速集线器管理时,无需启用usbh_ohci

DT configuration with OHCI to achieve full-speed and low-speed

  • 通过设置status =“ okay”启用usbh_ehci
  • 通过设置status =“ okay”启用usbh_ohci

对于两个控制器:

  • 通过physphy-names配置PHY

DT configuration examples

DT configuration when using port0 with a high-speed hub

下例显示了使用物理端口0(未使用第二个物理端口)时如何配置USBH。

板上使用了高速集线器控制器IC:无需启用usbh_ohci,所有低速和全速流量都由集线器管理。

&usbh_ehci {
	phys = <&usbphyc_port0>;           /* Use USBPHYC HS PHY port #1, mapped on USBH controller */
	phy-names = "usb";
	status = "okay";
};

/* No need to configure and enable usbh_ohci */

DT configuration when using port0

下面的示例显示了如何在使用物理端口0(第二个物理端口未使用,或由 OTG 使用)并且不使用高速集线器的情况下配置USBH。

&usbh_ehci {
	phys = <&usbphyc_port0>;           /* Use USBPHYC HS PHY port #1, mapped on USBH controller */
	phy-names = "usb";
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;           /* Use USBPHYC HS PHY port #1, mapped on USBH controller */
	phy-names = "usb";
	status = "okay";
};

DT configuration when using the two physical ports

以下示例显示了使用这两个物理端口时如何配置USBH。

&usbh_ehci {
	phys = <&usbphyc_port0>, <&usbphyc_port1 1>;     /* Use USBPHYC HS PHY port #1, mapped on USBH controller */
                                                         /* Use USBPHYC HS PHY port #2, configure UTMI switch to select USBH controller */
	phy-names = "usb", "usb";
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>, <&usbphyc_port1 1>;     /* Use USBPHYC HS PHY port #1, mapped on USBH controller */
                                                         /* Use USBPHYC HS PHY port #2, configure UTMI switch to select USBH controller */
	phy-names = "usb", "usb";
	status = "okay";
};

How to configure the DT using STM32CubeMX

STM32CubeMX 工具可用于配置STM32MPU设备并获取相应的 platform configuration device tree 文件。
STM32CubeMX可能不支持以上 DT bindings documentation 段中描述的所有属性。如果是这样,该工具会在生成的设备树中插入“用户部分”。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见 STM32CubeMX 用户手册。