打印

BB Black 入门基础之 Device Tree 常用target(转)

[复制链接]
702|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
Roses|  楼主 | 2017-10-2 10:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
BB Black 入门基础之 Device Tree 常用target


最近正学习Device Tree,过了这么长一段时间,进展也不是很大。总结下,主要原因还是基础比较薄弱,不太明白DTS这个文件的写法,不清楚哪里去找一些常用的属性值。

补充几个缩写 (AM335x TRM Page 1972)
OMAP       Open Multimedia Application Platform
PWMSS       Pulse-Width Modulation Subsystem  
ePWM           enhanced PWM
eHRPWM  enhanced high resolution PWM
eCAP              enhanced Capture
eQEP              enhanced Quadrature Encode Pulse

其中PWMSS 包括了 eHRPWM  eCAP   eQEP 几个功能模块。所以要使用ehrpwm1 那就必须先使能epwmss1。



  • fragment@0 {

  •                 target = <&am33xx_pinmux>;
    ...
    }


[color=rgb(51, 102, 153) !important]复制代码

以及下面这种
  • fragment@1 {
  •                 target = <&epwmss1>;
  •                 __overlay__ {
  •                         status = "okay";
  •                 };
  •         };

[color=rgb(51, 102, 153) !important]复制代码

  • fragment@2 {
  •                 target = <&ehrpwm1>;
  •                 __overlay__ {
  •                         status = "okay";
  •                 };
  •         };

[color=rgb(51, 102, 153) !important]复制代码


看到了这里target = <&am33xx_pinmux>; 很多时候我们都不知道 am33xx_pinmux 这个东西它究竟是怎么来的。

这里大胆揣测一下,咱们平时常用的target就在下面包括了。
  •                 am33xx_pinmux = "/pinmux@44e10800";
  •                 user_leds_s0 = "/pinmux@44e10800/user_leds_s0";
  •                 i2c0_pins = "/pinmux@44e10800/pinmux_i2c0_pins";
  •                 uart0_pins = "/pinmux@44e10800/pinmux_uart0_pins";
  •                 clkout2_pin = "/pinmux@44e10800/pinmux_clkout2_pin";
  •                 cpsw_default = "/pinmux@44e10800/cpsw_default";
  •                 cpsw_sleep = "/pinmux@44e10800/cpsw_sleep";
  •                 davinci_mdio_default = "/pinmux@44e10800/davinci_mdio_default";
  •                 davinci_mdio_sleep = "/pinmux@44e10800/davinci_mdio_sleep";
  •                 i2c2_pins = "/pinmux@44e10800/pinmux_i2c2_pins";
  •                 mmc1_pins = "/pinmux@44e10800/pinmux_mmc1_pins";
  •                 nxp_hdmi_bonelt_pins = "/pinmux@44e10800/nxp_hdmi_bonelt_pins";
  •                 intc = "/ocp/interrupt-controller@48200000";
  •                 edma = "/ocp/edma@49000000";
  •                 gpio0 = "/ocp/gpio@44e07000";
  •                 gpio1 = "/ocp/gpio@4804c000";
  •                 gpio2 = "/ocp/gpio@481ac000";
  •                 gpio3 = "/ocp/gpio@481ae000";
  •                 uart0 = "/ocp/serial@44e09000";
  •                 uart1 = "/ocp/serial@48022000";
  •                 uart2 = "/ocp/serial@48024000";
  •                 uart3 = "/ocp/serial@481a6000";
  •                 uart4 = "/ocp/serial@481a8000";
  •                 uart5 = "/ocp/serial@481aa000";
  •                 i2c0 = "/ocp/i2c@44e0b000";
  •                 tps = "/ocp/i2c@44e0b000/tps@24";
  •                 dcdc1_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@0";
  •                 dcdc2_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@1";
  •                 dcdc3_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@2";
  •                 ldo1_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@3";
  •                 ldo2_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@4";
  •                 ldo3_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@5";
  •                 ldo4_reg = "/ocp/i2c@44e0b000/tps@24/regulators/regulator@6";
  •                 vmmcsd_fixed = "/ocp/i2c@44e0b000/tps@24/fixedregulator@0";
  •                 baseboard_eeprom = "/ocp/i2c@44e0b000/baseboard_eeprom@50";
  •                 i2c1 = "/ocp/i2c@4802a000";
  •                 i2c2 = "/ocp/i2c@4819c000";
  •                 cape_eeprom0 = "/ocp/i2c@4819c000/cape_eeprom0@54";
  •                 cape_eeprom1 = "/ocp/i2c@4819c000/cape_eeprom1@55";
  •                 cape_eeprom2 = "/ocp/i2c@4819c000/cape_eeprom2@56";
  •                 cape_eeprom3 = "/ocp/i2c@4819c000/cape_eeprom3@57";
  •                 mmc1 = "/ocp/mmc@48060000";
  •                 mmc2 = "/ocp/mmc@481d8000";
  •                 mmc3 = "/ocp/mmc@47810000";
  •                 wdt2 = "/ocp/wdt@44e35000";
  •                 dcan0 = "/ocp/d_can@481cc000";
  •                 dcan1 = "/ocp/d_can@481d0000";
  •                 timer1 = "/ocp/timer@44e31000";
  •                 timer2 = "/ocp/timer@48040000";
  •                 timer3 = "/ocp/timer@48042000";
  •                 timer4 = "/ocp/timer@48044000";
  •                 timer5 = "/ocp/timer@48046000";
  •                 timer6 = "/ocp/timer@48048000";
  •                 timer7 = "/ocp/timer@4804a000";
  •                 spi0 = "/ocp/spi@48030000";
  •                 spi1 = "/ocp/spi@481a0000";
  •                 musb = "/ocp/usb@47400000";
  •                 usb = "/ocp/usb@47400000";
  •                 ctrl_mod = "/ocp/usb@47400000/control@44e10000";
  •                 usb0_phy = "/ocp/usb@47400000/usb-phy@47401300";
  •                 usb0 = "/ocp/usb@47400000/usb@47401000";
  •                 usb1_phy = "/ocp/usb@47400000/usb-phy@47401b00";
  •                 usb1 = "/ocp/usb@47400000/usb@47401800";
  •                 cppi41dma = "/ocp/usb@47400000/dma-controller@07402000";
  •                 epwmss0 = "/ocp/epwmss@48300000";
  •                 ecap0 = "/ocp/epwmss@48300000/ecap@48300100";
  •                 ehrpwm0 = "/ocp/epwmss@48300000/ehrpwm@48300200";
  •                 epwmss1 = "/ocp/epwmss@48302000";
  •                 ecap1 = "/ocp/epwmss@48302000/ecap@48302100";
  •                 ehrpwm1 = "/ocp/epwmss@48302000/ehrpwm@48302200";
  •                 epwmss2 = "/ocp/epwmss@48304000";
  •                 ecap2 = "/ocp/epwmss@48304000/ecap@48304100";
  •                 ehrpwm2 = "/ocp/epwmss@48304000/ehrpwm@48304200";
  •                 mac = "/ocp/ethernet@4a100000";
  •                 davinci_mdio = "/ocp/ethernet@4a100000/mdio@4a101000";
  •                 cpsw_emac0 = "/ocp/ethernet@4a100000/slave@4a100200";
  •                 cpsw_emac1 = "/ocp/ethernet@4a100000/slave@4a100300";
  •                 ocmcram = "/ocp/ocmcram@40300000";
  •                 wkup_m3 = "/ocp/wkup_m3@44d00000";
  •                 elm = "/ocp/elm@48080000";
  •                 tscadc = "/ocp/tscadc@44e0d000";
  •                 am335x_adc = "/ocp/tscadc@44e0d000/adc";
  •                 gpmc = "/ocp/gpmc@50000000";
  •                 baseboard_beaglebone = "/bone_capemgr/baseboardmaps/board@0";
  •                 baseboard_beaglebone_black = "/bone_capemgr/baseboardmaps/board@1";
  •                 fb = "/fb@4830e000";
  •                 hdmi = "/hdmi";

[color=rgb(51, 102, 153) !important]复制代码

这个能解释得了许多我们已经看到的dts文件的target写法。
但同时,还会遇到如

[color=rgb(51, 102, 153) !important]复制代码


这类的target。这里不妨再大胆假设下,OCP即片上外设,如果需要自己定义target,那么就在这个片段里边进行引脚等数据的定义。
  • gpio-leds-cape-lcd7 {
  •                                 compatible = "gpio-leds";
  •                                 pinctrl-names = "default";

  •                                 pinctrl-0 = <&bone_lcd7_cape_led_00A3_pins>;

  •                                 lcd7-led0 {
  •                                         label = "lcd7:green:usr0";
  •                                         gpios = <&gpio2 28 0>;
  •                                         linux,default-trigger = "heartbeat";
  •                                         default-state = "off";
  •                                 };

[color=rgb(51, 102, 153) !important]复制代码



总结起来就是:
1 常用的target都可用上表给出的 am33xx_pinmux  epwmss1  i2c0 这些表示。
2 自定义引脚的意义及配置,通过新建一个包含target = <&ocp> 的节点来实现。


相关帖子

沙发
pixhw| | 2017-10-2 22:33 | 只看该作者
这个beaglebone功能怎么样?

使用特权

评论回复
板凳
pixhw| | 2017-10-2 22:53 | 只看该作者
嵌入式开发需要准备什么材料?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

709

主题

1023

帖子

7

粉丝