请先登录
您需要 登录 才可以下载或查看,没有帐号?立即注册
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:
- uart@500 {
- compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
- reg = <0x500 0x100>;
- resets = <&rstctrl 12>;
- reset-names = "uart";
- interrupt-parent = <&intc>;
- interrupts = <5>;
- reg-shift = <2>;
- status = "disabled";
- };
复制代码
在 pinctrl {中定义了uart各种复用的功能,但具体使用哪一种功能没有定义:
- pcm_i2s_pins: pcm_i2s {
- pcm_i2s {
- ralink,group = "uartf";
- ralink,function = "pcm i2s";
- };
- };
- uartf_gpio_pins: uartf_gpio {
- uartf_gpio {
- ralink,group = "uartf";
- ralink,function = "gpio uartf";
- };
- };
复制代码
以下是需要在MT7620a.dts修改的地方,MT7620a.dts中include了mt7620a.dtsi,因为要使能uartf,console如果仍然使用uartlite,需要修改
- chosen {
- bootargs = "console=ttyS1,57600";
- };
复制代码
在 palmbus@10000000 {中添加uart enable
- uart@500 {
- status = "okay";
- };
复制代码
在pinctrl {中配置uartf复用的功能
- pinctrl {
- state_default: pinctrl0 {
- gpio {
- ralink,group = "i2c";
- ralink,function = "gpio";
- };
- uartf_gpio {
- ralink,group = "uartf";
- ralink,function = "gpio uartf";
- };
- };
- };
复制代码
完整的MT7620a.dts内容如下:
- /dts-v1/;
- /include/ "mt7620a.dtsi"
- / {
- compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
- model = "Ralink MT7620a + MT7610e evaluation board";
- chosen {
- bootargs = "console=ttyS1,57600";
- };
- palmbus@10000000 {
- spi@b00 {
- status = "okay";
- m25p80@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "en25q64";
- reg = <0 0>;
- linux,modalias = "m25p80", "en25q64";
- spi-max-frequency = <10000000>;
- partition@0 {
- label = "u-boot";
- reg = <0x0 0x30000>;
- read-only;
- };
- partition@30000 {
- label = "u-boot-env";
- reg = <0x30000 0x10000>;
- read-only;
- };
- factory: partition@40000 {
- label = "factory";
- reg = <0x40000 0x10000>;
- read-only;
- };
- partition@50000 {
- label = "firmware";
- reg = <0x50000 0x1fb0000>;
- };
- };
- };
- uart@500 {
- status = "okay";
- };
- };
- pinctrl {
- state_default: pinctrl0 {
- gpio {
- ralink,group = "i2c";
- ralink,function = "gpio";
- };
- uartf_gpio {
- ralink,group = "uartf";
- ralink,function = "gpio uartf";
- };
- };
- };
- ethernet@10100000 {
- status = "okay";
- mtd-mac-address = <&factory 0x4>;
- pinctrl-names = "default";
- pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
- ralink,port-map = "llllw";
- // port@4 {
- // status = "okay";
- // phy-mode = "rgmii";
- // phy-handle = <&phy4>;
- // };
- // port@5 {
- // status = "okay";
- // phy-mode = "rgmii";
- // phy-handle = <&phy5>;
- // };
- // mdio-bus {
- // status = "okay";
- //
- // phy4: ethernet-phy@4 {
- // reg = <4>;
- // phy-mode = "rgmii";
- // };
- //
- // phy5: ethernet-phy@5 {
- // reg = <5>;
- // phy-mode = "rgmii";
- // };
- // };
- };
- wmac@10180000 {
- ralink,mtd-eeprom = <&factory 0>;
- };
- gsw@10110000 {
- ralink,port4 = "gmac";
- };
- sdhci@10130000 {
- status = "okay";
- };
- pcie@10140000 {
- status = "okay";
- };
- gpio-keys-polled {
- compatible = "gpio-keys";
- #address-cells = <1>;
- #size-cells = <0>;
- poll-interval = <20>;
- s2 {
- label = "S2";
- gpios = <&gpio0 1 1>;
- linux,code = <0x100>;
- };
- s3 {
- label = "S3";
- gpios = <&gpio0 2 1>;
- linux,code = <0x101>;
- };
- };
- ehci@101c0000 {
- status = "okay";
- };
- ohci@101c1000 {
- status = "okay";
- };
- };
复制代码
|