您尚未登录。

楼主 #1 2019-06-11 21:11:29

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

全志 GPIO 驱动能力设置

https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/sun8i-v3s.dtsi


mmc0_pins: mmc0-pins {
                pins = "PF0", "PF1", "PF2", "PF3",
                       "PF4", "PF5";
                function = "mmc0";
                drive-strength = <30>;  /*10, 20, 30, 40mA 四个档次*/
                bias-pull-up;
            };



代码实现:
https://github.com/torvalds/linux/blob/master/drivers/pinctrl/sunxi/pinctrl-sunxi.c

static int sunxi_pctrl_parse_drive_prop(struct device_node *node)
{
	u32 val;

	/* Try the new style binding */
	if (!of_property_read_u32(node, "drive-strength", &val)) {
		/* We can't go below 10mA ... */
		if (val < 10)
			return -EINVAL;

		/* ... and only up to 40 mA ... */
		if (val > 40)
			val = 40;

		/* by steps of 10 mA */
		return rounddown(val, 10);
	}

	/* And then fall back to the old binding */
	if (of_property_read_u32(node, "allwinner,drive", &val))
		return -EINVAL;

	return (val + 1) * 10;
}




离线

#2 2019-06-11 21:28:37

zhenfanhei
会员
注册时间: 2018-01-18
已发帖子: 296
积分: 251
个人网站

Re: 全志 GPIO 驱动能力设置

不是写0,1,2,3吗,哦,可能内核不一样有区别,我看的一个devicetree文档里面是写这个

最近编辑记录 zhenfanhei (2019-06-11 21:29:49)





离线

楼主 #3 2019-06-11 21:29:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: 全志 GPIO 驱动能力设置

zhenfanhei 说:

不是写0,1,2,3吗,

不是 10, 20, 30, 40,

看实现代码和 dts 样例得出的结论.





离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn