Hikey960 Spi 调试进阶之番外篇(GPIO 设置)  

分享到:

DragonCat
Level 2Admin
注册时间:7年 前
帖子数: 42
2017年7月3日 上午9:47  

在编写设备驱动中,我们经常会遇到GPIO操作,在hikey960 中会有什么不同呢?

 

我在check spi 控制器代码时有关注SPI_CS信号的获取以及操作,如下代码:

SPI_CS信号是从dts cs_gpios获取的,如下代码:

 

spi4: spi@fdf06000 {

 

compatible = "arm,pl022", "arm,primecell";

 

reg = <0x0 0xfdf06000 0x0 0x1000>;

 

#address-cells = <1>;

 

#size-cells = <0>;

 

interrupts = <0 313 4>;

 

clocks = <&crg_ctrl HI3660_CLK_GATE_SPI4>;

 

clock-names = "apb_pclk";

 

pinctrl-names = "default";

 

pinctrl-0 = <&spi4_pmx_func &spi4_cfg_func>;

 

num-cs = <1>;

 

cs-gpios = <&gpio27 2 0>; /*cs : 218*/

 

//status = "disabled";

 

status = "ok";

 

};

cs_gpios 对应的gpio 编号为218。然而,我们从dts上面获取的cs_gpio = 290,很诡异呀。

 

所以就催生了我研究hikey960 gpio子系统,代码架构后续再更新,先解决下上面看到的疑惑呀。

gpio27: gpio@fff10000 {

 

compatible = "arm,pl061", "arm,primecell", "arm,primecell27";

 

reg = <0 0xfff10000 0 0x1000>;

 

interrupts = <0 111 0x4>;

 

gpio-controller;

 

#gpio-cells = <2>;

 

/* GPIO216 */

 

gpio-ranges = <&pmx4 0 36 6>;

 

interrupt-controller;

 

#interrupt-cells = <2>;

 

clocks = <&sctrl HI3660_PCLK_AO_GPIO5>;

 

clock-names = "apb_pclk";

 

status = "ok";

 

};

 

 

 

218在上述gpio27这个分组里面,看来gpiochip288 对应gpio@fff10000 控制器。在我验证后,得出结论,给出如下对应表格:

 

 

 

 


wolfkin liked
回复引用
hackergin
Level 0
注册时间:7年 前
帖子数: 4
2017年8月24日 下午5:48  

如果需要使用UART6串口的话,需要在源码里面配置不?


回复引用
嘿嘿嘿
Level 1Admin
注册时间:7年 前
帖子数: 16
2017年8月24日 下午5:51  

不需要 


回复引用
hackergin
Level 0
注册时间:7年 前
帖子数: 4
2017年8月24日 下午6:02  

那uart6对应的串口设备是什么呢, 但是我试了dev下的相关的串口设备,好像都不起作用。


回复引用
嘿嘿嘿
Level 1Admin
注册时间:7年 前
帖子数: 16
2017年8月24日 下午6:04  

你直接使用usb转串口线就可以了,1.8v的那种。 波特率是115200。


回复引用
hackergin
Level 0
注册时间:7年 前
帖子数: 4
2017年8月24日 下午6:06  

我插了那个dev下也没有生成新的结点


回复引用
  
Working

登陆 或者 注册