查看: 4172|回复: 0

OpenWrt使能mt7620a第二个uart

[复制链接]
  • TA的每日心情
    开心
    2016-8-15 09:30
  • 签到天数: 162 天

    连续签到: 1 天

    [LV.7]常住居民III

    发表于 2017-7-27 18:45:18 | 显示全部楼层 |阅读模式
    分享到:
    OpenWrt使能mt7620a第二个uart

    本文系转载,原文作者wwx0715

    需要配置target/linux/ramips/dts/下相关文件(mt7620a.dtsi,MT7620a.dts)。
    在mt7620a.dtsi中,palmbus@10000000下已经定义好了uart和uartlite,但是uart的status是disabled:
    1. uart@500 {
    2.     compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
    3.     reg = <0x500 0x100>;
    4.     resets = <&rstctrl 12>;
    5.     reset-names = "uart";
    6.     interrupt-parent = <&intc>;
    7.     interrupts = <5>;
    8.     reg-shift = <2>;
    9.     status = "disabled";
    10. };
    复制代码
    在 pinctrl {中定义了uart各种复用的功能,但具体使用哪一种功能没有定义:
    1. pcm_i2s_pins: pcm_i2s {
    2.     pcm_i2s {
    3.         ralink,group = "uartf";
    4.         ralink,function = "pcm i2s";
    5.     };
    6. };
    7. uartf_gpio_pins: uartf_gpio {
    8.     uartf_gpio {
    9.         ralink,group = "uartf";
    10.         ralink,function = "gpio uartf";
    11.     };
    12. };
    13.   
    复制代码
    以下是需要在MT7620a.dts修改的地方,MT7620a.dts中include了mt7620a.dtsi,因为要使能uartf,console如果仍然使用uartlite,需要修改
    1. chosen {
    2.      bootargs = "console=ttyS1,57600";
    3. };
    复制代码
    在 palmbus@10000000 {中添加uart enable
    1. uart@500 {
    2.     status = "okay";
    3. };
    复制代码
    在pinctrl {中配置uartf复用的功能
    1. pinctrl {
    2.     state_default: pinctrl0 {
    3.         gpio {
    4.             ralink,group = "i2c";
    5.             ralink,function = "gpio";
    6.         };
    7.         uartf_gpio {
    8.             ralink,group = "uartf";
    9.             ralink,function = "gpio uartf";
    10.         };
    11.     };
    12. };
    复制代码
    完整的MT7620a.dts内容如下:
    1. /include/ "mt7620a.dtsi"
    2. / {
    3.         compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
    4.         model = "Ralink MT7620a + MT7610e evaluation board";
    5.         chosen {
    6.                 bootargs = "console=ttyS1,57600";
    7.         };
    8.         palmbus@10000000 {
    9.                 spi@b00 {
    10.                         status = "okay";
    11.                         m25p80@0 {
    12.                                 #address-cells = <1>;
    13.                                 #size-cells = <1>;
    14.                                 compatible = "en25q64";
    15.                                 reg = <0 0>;
    16.                                 linux,modalias = "m25p80", "en25q64";
    17.                                 spi-max-frequency = <10000000>;
    18.                                 partition@0 {
    19.                                         label = "u-boot";
    20.                                         reg = <0x0 0x30000>;
    21.                                         read-only;
    22.                                 };
    23.                                 partition@30000 {
    24.                                         label = "u-boot-env";
    25.                                         reg = <0x30000 0x10000>;
    26.                                         read-only;
    27.                                 };

    28.                                 factory: partition@40000 {
    29.                                         label = "factory";
    30.                                         reg = <0x40000 0x10000>;
    31.                                         read-only;
    32.                                 };
    33.                                 partition@50000 {
    34.                                         label = "firmware";
    35.                                         reg = <0x50000 0x1fb0000>;
    36.                                 };
    37.                         };
    38.                 };
    39.                 uart@500 {
    40.                         status = "okay";
    41.                 };
    42.         };
    43.         pinctrl {
    44.                 state_default: pinctrl0 {
    45.                         gpio {
    46.                                 ralink,group = "i2c";
    47.                                 ralink,function = "gpio";
    48.                         };
    49.                         uartf_gpio {
    50.                                 ralink,group = "uartf";
    51.                                 ralink,function = "gpio uartf";
    52.                         };
    53.                 };
    54.         };
    55.         ethernet@10100000 {
    56.                 status = "okay";
    57.                 mtd-mac-address = <&factory 0x4>;
    58.                 pinctrl-names = "default";
    59.                 pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
    60.                 ralink,port-map = "llllw";
    61. //              port@4 {
    62. //                      status = "okay";
    63. //                      phy-mode = "rgmii";
    64. //                      phy-handle = <&phy4>;
    65. //              };
    66. //              port@5 {
    67. //                      status = "okay";
    68. //                      phy-mode = "rgmii";
    69. //                      phy-handle = <&phy5>;
    70. //              };
    71. //              mdio-bus {
    72. //                      status = "okay";
    73. //
    74. //                      phy4: ethernet-phy@4 {
    75. //                              reg = <4>;
    76. //                              phy-mode = "rgmii";
    77. //                      };
    78. //
    79. //                      phy5: ethernet-phy@5 {
    80. //                              reg = <5>;
    81. //                              phy-mode = "rgmii";
    82. //                      };
    83. //              };
    84.         };
    85.         wmac@10180000 {
    86.                 ralink,mtd-eeprom = <&factory 0>;
    87.         };
    88.         gsw@10110000 {
    89.                 ralink,port4 = "gmac";
    90.         };
    91.         sdhci@10130000 {
    92.                 status = "okay";
    93.         };
    94.         pcie@10140000 {
    95.                 status = "okay";
    96.         };
    97.         gpio-keys-polled {
    98.                 compatible = "gpio-keys";
    99.                 #address-cells = <1>;
    100.                 #size-cells = <0>;
    101.                 poll-interval = <20>;
    102.                 s2 {
    103.                         label = "S2";
    104.                         gpios = <&gpio0 1 1>;
    105.                         linux,code = <0x100>;
    106.                 };
    107.                 s3 {
    108.                         label = "S3";
    109.                         gpios = <&gpio0 2 1>;
    110.                         linux,code = <0x101>;
    111.                 };
    112.         };
    113.         ehci@101c0000 {
    114.                 status = "okay";
    115.         };
    116.         ohci@101c1000 {
    117.                 status = "okay";
    118.         };
    119. };
    复制代码
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-26 12:53 , Processed in 0.123450 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.