找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 908|回复: 4

只有大神才能解答之Openwrt GPIO LED适配方法请教!

[复制链接]
发表于 2022-4-3 10:19 | 显示全部楼层 |阅读模式
本帖最后由 xiaole51 于 2022-4-3 10:22 编辑

最近疫情在家无聊给自己找点事干, 翻出古董路由器研究.
适配OP固件中遇到GPIO LED控制问题.
在此贴中找到最可行的方法.https://www.right.com.cn/forum/thread-343049-1-1.html
恰好也是7620N的机型.


按照贴里教程做完后, 大部分GPIO端口还是无法开启,开启事出现ash: write error: Invalid argument 错误.
root@OpenWrt:~# echo 10 > /sys/class/gpio/export
ash: write error: Invalid argument

能开启的脚位如下:感觉还是源码中定义过的脚位.



在源码的dts文件中已开启全部端口后编译.
原机型中定义的LED端口也已全部删除.
为何还不能全部开启GPIO百思不得其解.
望坛里大神告知一二.

多谢!

本帖子中包含更多资源

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

×
发表于 2022-4-3 10:59 | 显示全部楼层
已经被占用的gpio是你不能使用的,比如按钮的,pcie的等等

点评

可以看到这些端口并未使用, 应该还是源码中解锁全部端口的方法有问题. 原帖中关键图片已不显示,或许即使那里错了.  详情 回复 发表于 2022-4-3 11:12
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-4-3 11:12 | 显示全部楼层
paldier 发表于 2022-4-3 10:59
已经被占用的gpio是你不能使用的,比如按钮的,pcie的等等

可以看到这些端口并未使用, 应该还是源码中解锁全部端口的方法有问题.
原帖中关键图片已不显示,或许即使那里错了.
回复 支持 反对

使用道具 举报

发表于 2022-4-3 12:14 | 显示全部楼层
很显然是io复用部分不对(dts中的iomux),剩下的端口肯定有许多都复用成其他功能了

点评

dts中根本没有iomux部分. #include "mt7620n.dtsi" #include #include / { compatible = "asus,rt-n14u", "ralink,mt7620n-soc"; model = "Asus RT-N14U"; }; &gpio0 { status = "okay";  详情 回复 发表于 2022-4-3 18:11
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-4-3 18:11 | 显示全部楼层
simon_plz 发表于 2022-4-3 12:14
很显然是io复用部分不对(dts中的iomux),剩下的端口肯定有许多都复用成其他功能了

dts中根本没有iomux部分.
#include "mt7620n.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
        compatible = "asus,rt-n14u", "ralink,mt7620n-soc";
        model = "Asus RT-N14U";

       
};

&gpio0 {
        status = "okay";
};
&gpio1 {
        status = "okay";
};

&gpio2 {
        status = "okay";
};

&gpio3 {
        status = "okay";
};


&spi0 {
        status = "okay";

        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        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 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x50000 0xfb0000>;
                        };
                };
        };
};

&ehci {
        status = "okay";
};

&ohci {
        status = "okay";
};

&ethernet {
        mtd-mac-address = <&factory 0x4>;

        mediatek,portmap = "wllll";
};

&wmac {
        ralink,mtd-eeprom = <&factory 0x0>;
};

&state_default {
        default {
                groups = "ephy", "wled", "i2c";
                function = "gpio";
        };
};
回复 支持 反对

使用道具 举报

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

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-6-14 06:27

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com

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