“LTDC device tree configuration”的版本间的差异
Zhouyuebiao(讨论 | 贡献) |
|||
(未显示2个用户的7个中间版本) | |||
第1行: | 第1行: | ||
− | + | == Article purpose == | |
+ | 本文介绍了如何在将外围设备分配给 Linux<sup>®</sup>时配置“ LTDC” <ref name="LTDC">[[LTDC internal peripheral]]</ref> 操作系统。 | ||
− | [[ | + | 使用'''设备树机制''' <ref> [[Device tree]]</ref>执行配置。 |
− | [[ | + | |
− | + | The [[Device tree]]提供了STM32“ LTDC Linux驱动程序”使用的LTDC <ref name="LTDC"/>的硬件描述。 | |
+ | |||
+ | == DT bindings documentation == | ||
+ | LTDC由STM32 LTDC设备树绑定表示 <ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | Linux kernel STM32 LTDC bindings (st,stm32-ltdc.txt)}}</ref>. | ||
+ | |||
+ | == DT configuration == | ||
+ | 该硬件描述是“''STM32微处理器”''设备树文件(扩展名为.dtsi)和“''板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见[[Device tree]]。 | ||
+ | |||
+ | '''STM32CubeMX'''可用于生成板卡设备树。 有关更多详细信息,请参考[[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]]。 | ||
+ | |||
+ | ===DT configuration (STM32 level) === | ||
+ | LTDC设备树节点在stm32mp157c.dtsi <ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi | Linux kernel STM32MP157C device tree (stm32mp157c.dtsi)}}</ref>. 声明(如下所示)提供了硬件寄存器的基地址,时钟,中断和复位。 | ||
+ | <pre> | ||
+ | ltdc: display-controller@5a001000 { | ||
+ | compatible = "st,stm32-ltdc"; | ||
+ | reg = <0x5a001000 0x400>; | ||
+ | interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, | ||
+ | <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>; | ||
+ | clocks = <&rcc LTDC_PX>; | ||
+ | clock-names = "lcd"; | ||
+ | resets = <&rcc LTDC_R>; | ||
+ | status = "disabled"; | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | {{Warning|该设备树部分与STM32微处理器有关。 它必须保持原样,而不能由最终用户修改。}} | ||
+ | |||
+ | === DT configuration (board level) === | ||
+ | 与特定板卡相关的LTDC设备树可能具有以下节点,具体取决于板卡硬件: | ||
+ | * '''ltdc'''节点:包含输入/输出端口说明。 | ||
+ | *'''panel'''或'''i2cx'''网桥rgb节点(取决于板硬件):包含LTDC Pinctrl和输入/输出端口说明 | ||
+ | * '''panel_backlight'''节点(取决于板硬件):与面板节点有关 | ||
+ | |||
+ | LTDC引脚的完整示例<ref>[[Pinctrl device tree configuration]]</ref> 在stm32mp157-pinctrl.dtsi中提供 <ref name="stm32mp157_pinctrl_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | Linux kernel STM32MP157 pinctrl device tree (stm32mp157-pinctrl.dtsi)}}</ref> | ||
+ | <pre> | ||
+ | ltdc_pins_a: ltdc-a-0 { | ||
+ | pins { | ||
+ | pinmux = <STM32_PINMUX('G', 7, AF14)>, /* LCD_CLK */ | ||
+ | <STM32_PINMUX('I', 10, AF14)>, /* LCD_HSYNC */ | ||
+ | <STM32_PINMUX('I', 9, AF14)>, /* LCD_VSYNC */ | ||
+ | <STM32_PINMUX('F', 10, AF14)>, /* LCD_DE */ | ||
+ | <STM32_PINMUX('H', 2, AF14)>, /* LCD_R0 */ | ||
+ | <STM32_PINMUX('H', 3, AF14)>, /* LCD_R1 */ | ||
+ | <STM32_PINMUX('H', 8, AF14)>, /* LCD_R2 */ | ||
+ | <STM32_PINMUX('H', 9, AF14)>, /* LCD_R3 */ | ||
+ | <STM32_PINMUX('H', 10, AF14)>, /* LCD_R4 */ | ||
+ | <STM32_PINMUX('C', 0, AF14)>, /* LCD_R5 */ | ||
+ | <STM32_PINMUX('H', 12, AF14)>, /* LCD_R6 */ | ||
+ | <STM32_PINMUX('E', 15, AF14)>, /* LCD_R7 */ | ||
+ | <STM32_PINMUX('E', 5, AF14)>, /* LCD_G0 */ | ||
+ | <STM32_PINMUX('E', 6, AF14)>, /* LCD_G1 */ | ||
+ | <STM32_PINMUX('H', 13, AF14)>, /* LCD_G2 */ | ||
+ | <STM32_PINMUX('H', 14, AF14)>, /* LCD_G3 */ | ||
+ | <STM32_PINMUX('H', 15, AF14)>, /* LCD_G4 */ | ||
+ | <STM32_PINMUX('I', 0, AF14)>, /* LCD_G5 */ | ||
+ | <STM32_PINMUX('I', 1, AF14)>, /* LCD_G6 */ | ||
+ | <STM32_PINMUX('I', 2, AF14)>, /* LCD_G7 */ | ||
+ | <STM32_PINMUX('D', 9, AF14)>, /* LCD_B0 */ | ||
+ | <STM32_PINMUX('G', 12, AF14)>, /* LCD_B1 */ | ||
+ | <STM32_PINMUX('G', 10, AF14)>, /* LCD_B2 */ | ||
+ | <STM32_PINMUX('D', 10, AF14)>, /* LCD_B3 */ | ||
+ | <STM32_PINMUX('I', 4, AF14)>, /* LCD_B4 */ | ||
+ | <STM32_PINMUX('A', 3, AF14)>, /* LCD_B5 */ | ||
+ | <STM32_PINMUX('B', 8, AF14)>, /* LCD_B6 */ | ||
+ | <STM32_PINMUX('D', 8, AF14)>; /* LCD_B7 */ | ||
+ | bias-disable; | ||
+ | drive-push-pull; | ||
+ | slew-rate = <2>; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | ltdc_pins_sleep_a: ltdc-a-1 { | ||
+ | pins { | ||
+ | pinmux = <STM32_PINMUX('G', 7, ANALOG)>, /* LCD_CLK */ | ||
+ | <STM32_PINMUX('I', 10, ANALOG)>, /* LCD_HSYNC */ | ||
+ | <STM32_PINMUX('I', 9, ANALOG)>, /* LCD_VSYNC */ | ||
+ | <STM32_PINMUX('F', 10, ANALOG)>, /* LCD_DE */ | ||
+ | <STM32_PINMUX('H', 2, ANALOG)>, /* LCD_R0 */ | ||
+ | <STM32_PINMUX('H', 3, ANALOG)>, /* LCD_R1 */ | ||
+ | <STM32_PINMUX('H', 8, ANALOG)>, /* LCD_R2 */ | ||
+ | <STM32_PINMUX('H', 9, ANALOG)>, /* LCD_R3 */ | ||
+ | <STM32_PINMUX('H', 10, ANALOG)>, /* LCD_R4 */ | ||
+ | <STM32_PINMUX('C', 0, ANALOG)>, /* LCD_R5 */ | ||
+ | <STM32_PINMUX('H', 12, ANALOG)>, /* LCD_R6 */ | ||
+ | <STM32_PINMUX('E', 15, ANALOG)>, /* LCD_R7 */ | ||
+ | <STM32_PINMUX('E', 5, ANALOG)>, /* LCD_G0 */ | ||
+ | <STM32_PINMUX('E', 6, ANALOG)>, /* LCD_G1 */ | ||
+ | <STM32_PINMUX('H', 13, ANALOG)>, /* LCD_G2 */ | ||
+ | <STM32_PINMUX('H', 14, ANALOG)>, /* LCD_G3 */ | ||
+ | <STM32_PINMUX('H', 15, ANALOG)>, /* LCD_G4 */ | ||
+ | <STM32_PINMUX('I', 0, ANALOG)>, /* LCD_G5 */ | ||
+ | <STM32_PINMUX('I', 1, ANALOG)>, /* LCD_G6 */ | ||
+ | <STM32_PINMUX('I', 2, ANALOG)>, /* LCD_G7 */ | ||
+ | <STM32_PINMUX('D', 9, ANALOG)>, /* LCD_B0 */ | ||
+ | <STM32_PINMUX('G', 12, ANALOG)>, /* LCD_B1 */ | ||
+ | <STM32_PINMUX('G', 10, ANALOG)>, /* LCD_B2 */ | ||
+ | <STM32_PINMUX('D', 10, ANALOG)>, /* LCD_B3 */ | ||
+ | <STM32_PINMUX('I', 4, ANALOG)>, /* LCD_B4 */ | ||
+ | <STM32_PINMUX('A', 3, ANALOG)>, /* LCD_B5 */ | ||
+ | <STM32_PINMUX('B', 8, ANALOG)>, /* LCD_B6 */ | ||
+ | <STM32_PINMUX('D', 8, ANALOG)>; /* LCD_B7 */ | ||
+ | }; | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | 一个完整的例子[[STM32MP157X-DKX - hardware description | STM32MP157 Discovery board]] 设备树在stm32mp157a-dk1.dts中可用 <ref name="stm32mp157c_dk1_dts">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157a-dk1.dts | Linux kernel STM32MP157 Discovery board device tree (stm32mp157a-dk1.dts)}}</ref>. | ||
+ | |||
+ | <pre> | ||
+ | <dc { | ||
+ | status = "okay"; | ||
+ | |||
+ | port { | ||
+ | #address-cells = <1>; | ||
+ | #size-cells = <0>; | ||
+ | |||
+ | ltdc_ep0_out: endpoint@0 { | ||
+ | reg = <0>; | ||
+ | remote-endpoint = <&sii9022_in>; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | &i2c1 { | ||
+ | ... | ||
+ | hdmi-transmitter@39 { | ||
+ | compatible = "sil,sii9022"; | ||
+ | reg = <0x39>; | ||
+ | iovcc-supply = <&v3v3_hdmi>; | ||
+ | cvcc12-supply = <&v1v2_hdmi>; | ||
+ | reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>; | ||
+ | interrupts = <1 IRQ_TYPE_EDGE_FALLING>; | ||
+ | interrupt-parent = <&gpiog>; | ||
+ | pinctrl-names = "default", "sleep"; | ||
+ | pinctrl-0 = <<dc_pins_a>; | ||
+ | pinctrl-1 = <<dc_pins_sleep_a>; | ||
+ | status = "okay"; | ||
+ | |||
+ | ports { | ||
+ | #address-cells = <1>; | ||
+ | #size-cells = <0>; | ||
+ | |||
+ | port@0 { | ||
+ | reg = <0>; | ||
+ | sii9022_in: endpoint { | ||
+ | remote-endpoint = <<dc_ep0_out>; | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | port@1 { | ||
+ | reg = <1>; | ||
+ | sii9022_tx_endpoint: endpoint { | ||
+ | remote-endpoint = <&i2s2_endpoint>; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | ==How to configure the DT using STM32CubeMX== | ||
+ | [[STM32CubeMX]] 工具可用于配置STM32MPU设备并获取相应的 [[Device_tree#STM32|platform configuration device tree]] 文件。<br /> | ||
+ | STM32CubeMX可能不支持以上 [[#DT bindings documentation|DT bindings documentation]]段中描述的所有属性。 如果是这样,该工具会在生成的设备树中插入'''用户部分'''。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见[[STM32CubeMX]] 用户手册。 | ||
+ | |||
+ | ==References== | ||
+ | 请参考以下链接以获取更多信息: | ||
+ | <references /> |
2020年11月9日 (一) 17:00的最新版本
目录
Article purpose
本文介绍了如何在将外围设备分配给 Linux®时配置“ LTDC” [1] 操作系统。
使用设备树机制 [2]执行配置。
The Device tree提供了STM32“ LTDC Linux驱动程序”使用的LTDC [1]的硬件描述。
DT bindings documentation
LTDC由STM32 LTDC设备树绑定表示 [3].
DT configuration
该硬件描述是“STM32微处理器”设备树文件(扩展名为.dtsi)和“板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见Device tree。
STM32CubeMX可用于生成板卡设备树。 有关更多详细信息,请参考How to configure the DT using STM32CubeMX。
DT configuration (STM32 level)
LTDC设备树节点在stm32mp157c.dtsi [4]. 声明(如下所示)提供了硬件寄存器的基地址,时钟,中断和复位。
ltdc: display-controller@5a001000 { compatible = "st,stm32-ltdc"; reg = <0x5a001000 0x400>; interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>; clocks = <&rcc LTDC_PX>; clock-names = "lcd"; resets = <&rcc LTDC_R>; status = "disabled"; };
该设备树部分与STM32微处理器有关。 它必须保持原样,而不能由最终用户修改。 |
DT configuration (board level)
与特定板卡相关的LTDC设备树可能具有以下节点,具体取决于板卡硬件:
- ltdc节点:包含输入/输出端口说明。
- panel或i2cx网桥rgb节点(取决于板硬件):包含LTDC Pinctrl和输入/输出端口说明
- panel_backlight节点(取决于板硬件):与面板节点有关
LTDC引脚的完整示例[5] 在stm32mp157-pinctrl.dtsi中提供 [6]
ltdc_pins_a: ltdc-a-0 { pins { pinmux = <STM32_PINMUX('G', 7, AF14)>, /* LCD_CLK */ <STM32_PINMUX('I', 10, AF14)>, /* LCD_HSYNC */ <STM32_PINMUX('I', 9, AF14)>, /* LCD_VSYNC */ <STM32_PINMUX('F', 10, AF14)>, /* LCD_DE */ <STM32_PINMUX('H', 2, AF14)>, /* LCD_R0 */ <STM32_PINMUX('H', 3, AF14)>, /* LCD_R1 */ <STM32_PINMUX('H', 8, AF14)>, /* LCD_R2 */ <STM32_PINMUX('H', 9, AF14)>, /* LCD_R3 */ <STM32_PINMUX('H', 10, AF14)>, /* LCD_R4 */ <STM32_PINMUX('C', 0, AF14)>, /* LCD_R5 */ <STM32_PINMUX('H', 12, AF14)>, /* LCD_R6 */ <STM32_PINMUX('E', 15, AF14)>, /* LCD_R7 */ <STM32_PINMUX('E', 5, AF14)>, /* LCD_G0 */ <STM32_PINMUX('E', 6, AF14)>, /* LCD_G1 */ <STM32_PINMUX('H', 13, AF14)>, /* LCD_G2 */ <STM32_PINMUX('H', 14, AF14)>, /* LCD_G3 */ <STM32_PINMUX('H', 15, AF14)>, /* LCD_G4 */ <STM32_PINMUX('I', 0, AF14)>, /* LCD_G5 */ <STM32_PINMUX('I', 1, AF14)>, /* LCD_G6 */ <STM32_PINMUX('I', 2, AF14)>, /* LCD_G7 */ <STM32_PINMUX('D', 9, AF14)>, /* LCD_B0 */ <STM32_PINMUX('G', 12, AF14)>, /* LCD_B1 */ <STM32_PINMUX('G', 10, AF14)>, /* LCD_B2 */ <STM32_PINMUX('D', 10, AF14)>, /* LCD_B3 */ <STM32_PINMUX('I', 4, AF14)>, /* LCD_B4 */ <STM32_PINMUX('A', 3, AF14)>, /* LCD_B5 */ <STM32_PINMUX('B', 8, AF14)>, /* LCD_B6 */ <STM32_PINMUX('D', 8, AF14)>; /* LCD_B7 */ bias-disable; drive-push-pull; slew-rate = <2>; }; }; ltdc_pins_sleep_a: ltdc-a-1 { pins { pinmux = <STM32_PINMUX('G', 7, ANALOG)>, /* LCD_CLK */ <STM32_PINMUX('I', 10, ANALOG)>, /* LCD_HSYNC */ <STM32_PINMUX('I', 9, ANALOG)>, /* LCD_VSYNC */ <STM32_PINMUX('F', 10, ANALOG)>, /* LCD_DE */ <STM32_PINMUX('H', 2, ANALOG)>, /* LCD_R0 */ <STM32_PINMUX('H', 3, ANALOG)>, /* LCD_R1 */ <STM32_PINMUX('H', 8, ANALOG)>, /* LCD_R2 */ <STM32_PINMUX('H', 9, ANALOG)>, /* LCD_R3 */ <STM32_PINMUX('H', 10, ANALOG)>, /* LCD_R4 */ <STM32_PINMUX('C', 0, ANALOG)>, /* LCD_R5 */ <STM32_PINMUX('H', 12, ANALOG)>, /* LCD_R6 */ <STM32_PINMUX('E', 15, ANALOG)>, /* LCD_R7 */ <STM32_PINMUX('E', 5, ANALOG)>, /* LCD_G0 */ <STM32_PINMUX('E', 6, ANALOG)>, /* LCD_G1 */ <STM32_PINMUX('H', 13, ANALOG)>, /* LCD_G2 */ <STM32_PINMUX('H', 14, ANALOG)>, /* LCD_G3 */ <STM32_PINMUX('H', 15, ANALOG)>, /* LCD_G4 */ <STM32_PINMUX('I', 0, ANALOG)>, /* LCD_G5 */ <STM32_PINMUX('I', 1, ANALOG)>, /* LCD_G6 */ <STM32_PINMUX('I', 2, ANALOG)>, /* LCD_G7 */ <STM32_PINMUX('D', 9, ANALOG)>, /* LCD_B0 */ <STM32_PINMUX('G', 12, ANALOG)>, /* LCD_B1 */ <STM32_PINMUX('G', 10, ANALOG)>, /* LCD_B2 */ <STM32_PINMUX('D', 10, ANALOG)>, /* LCD_B3 */ <STM32_PINMUX('I', 4, ANALOG)>, /* LCD_B4 */ <STM32_PINMUX('A', 3, ANALOG)>, /* LCD_B5 */ <STM32_PINMUX('B', 8, ANALOG)>, /* LCD_B6 */ <STM32_PINMUX('D', 8, ANALOG)>; /* LCD_B7 */ }; };
一个完整的例子 STM32MP157 Discovery board 设备树在stm32mp157a-dk1.dts中可用 [7].
<dc { status = "okay"; port { #address-cells = <1>; #size-cells = <0>; ltdc_ep0_out: endpoint@0 { reg = <0>; remote-endpoint = <&sii9022_in>; }; }; }; &i2c1 { ... hdmi-transmitter@39 { compatible = "sil,sii9022"; reg = <0x39>; iovcc-supply = <&v3v3_hdmi>; cvcc12-supply = <&v1v2_hdmi>; reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>; interrupts = <1 IRQ_TYPE_EDGE_FALLING>; interrupt-parent = <&gpiog>; pinctrl-names = "default", "sleep"; pinctrl-0 = <<dc_pins_a>; pinctrl-1 = <<dc_pins_sleep_a>; status = "okay"; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; sii9022_in: endpoint { remote-endpoint = <<dc_ep0_out>; }; }; port@1 { reg = <1>; sii9022_tx_endpoint: endpoint { remote-endpoint = <&i2s2_endpoint>; }; }; }; }; };
How to configure the DT using STM32CubeMX
STM32CubeMX 工具可用于配置STM32MPU设备并获取相应的 platform configuration device tree 文件。
STM32CubeMX可能不支持以上 DT bindings documentation段中描述的所有属性。 如果是这样,该工具会在生成的设备树中插入用户部分。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见STM32CubeMX 用户手册。
References
请参考以下链接以获取更多信息:
- ↑ 1.01.1 LTDC internal peripheral
- ↑ Device tree
- ↑ Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | |}} Linux kernel STM32 LTDC bindings (st,stm32-ltdc.txt)
- ↑ arch/arm/boot/dts/stm32mp157c.dtsi | |}} Linux kernel STM32MP157C device tree (stm32mp157c.dtsi)
- ↑ Pinctrl device tree configuration
- ↑ arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | |}} Linux kernel STM32MP157 pinctrl device tree (stm32mp157-pinctrl.dtsi)
- ↑ arch/arm/boot/dts/stm32mp157a-dk1.dts | |}} Linux kernel STM32MP157 Discovery board device tree (stm32mp157a-dk1.dts)