CaryStudio

 找回密码
 立即注册
搜索
查看: 1900|回复: 0

【转】OpenWrt使能mt7620a第二个uart

[复制链接]
发表于 2017-12-7 13:59:18 | 显示全部楼层 |阅读模式

请先登录

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 yuki 于 2017-12-7 13:59 编辑

OpenWrt使能mt7620a第二个uart
转载出自:http://blog.csdn.net/wwx0715/article/details/53217697

需要配置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. };
复制代码

以下是需要在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. /dts-v1/;
  2. /include/ "mt7620a.dtsi"
  3. / {
  4.         compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
  5.         model = "Ralink MT7620a + MT7610e evaluation board";
  6.         chosen {
  7.                 bootargs = "console=ttyS1,57600";
  8.         };
  9.         palmbus@10000000 {
  10.                 spi@b00 {
  11.                         status = "okay";
  12.                         m25p80@0 {
  13.                                 #address-cells = <1>;
  14.                                 #size-cells = <1>;
  15.                                 compatible = "en25q64";
  16.                                 reg = <0 0>;
  17.                                 linux,modalias = "m25p80", "en25q64";
  18.                                 spi-max-frequency = <10000000>;
  19.                                 partition@0 {
  20.                                         label = "u-boot";
  21.                                         reg = <0x0 0x30000>;
  22.                                         read-only;
  23.                                 };
  24.                                 partition@30000 {
  25.                                         label = "u-boot-env";
  26.                                         reg = <0x30000 0x10000>;
  27.                                         read-only;
  28.                                 };

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







回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|CaryStudio ( 粤ICP备16022806号 )

GMT+8, 2023-6-8 10:50 , Processed in 0.095898 second(s), 12 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表