spi-gpio+mcp2510驱动移植
来源:互联网 发布:三知四会一联通 编辑:程序博客网 时间:2024/06/17 14:06
不啰嗦,上设备树代码:
spi { compatible = "spi-gpio"; #address-cells = <0x1>; //ranges; #size-cells = <0>; gpio-sck = <&gpio2 18 0>; gpio-miso = <&gpio2 17 0>; gpio-mosi = <&gpio2 1 0>; cs-gpios = <&gpio7 12 0>; num-chipselects = <1>; /* clients */ can0: can@1 { compatible = "microchip,mcp2515"; reg = <0>; //clocks = <&clks 24>; clocks = <&clk16m>; interrupt-parent = <&gpio1>; interrupts = <30 0x2>; spi-max-frequency = <10000000>; status = "okay"; //vdd-supply = <®5v0>; //xceiver-supply = <®5v0>; }; };
内核设备树文档内容为:
SPI-GPIO devicetree bindingsRequired properties: - compatible: should be set to "spi-gpio" - #address-cells: should be set to <0x1> - ranges - gpio-sck: GPIO spec for the SCK line to use - gpio-miso: GPIO spec for the MISO line to use - gpio-mosi: GPIO spec for the MOSI line to use - cs-gpios: GPIOs to use for chipselect lines. Not needed if num-chipselects = <0>. - num-chipselects: Number of chipselect lines. Should be <0> if a single device with no chip select is connected.Example: spi { compatible = "spi-gpio"; #address-cells = <0x1>; ranges; gpio-sck = <&gpio 95 0>; gpio-miso = <&gpio 98 0>; gpio-mosi = <&gpio 97 0>; cs-gpios = <&gpio 125 0>; num-chipselects = <1>; /* clients */ };
注释了ranges;
选项,并没了解深层次原因,待补充,我也是参考设备树里面别的厂家写的代码改的,慢慢再深入吧。
然后,配置内核,选上spi-gpio驱动选项即可。
mcp2510驱动类似,主要是clocks这一项不会写,还是参考了别人写的,添加了一个时钟,成功运行。
clocks { /* Fixed crystal dedicated to mcp251x */ clk16m: clk@1 { compatible = "fixed-clock"; reg = <1>; #clock-cells = <0>; clock-frequency = <16000000>; clock-output-names = "clk16m"; }; };
阅读全文
0 0
- spi-gpio+mcp2510驱动移植
- mcp2510驱动备份
- linux SPI驱动 - 模拟gpio
- S3C6410 SPI驱动移植
- mini2440 SPI驱动移植
- mini2440 SPI驱动移植
- SPI驱动移植
- mini2440 SPI驱动移植
- mini2440 SPI驱动移植
- mini2440 SPI驱动移植
- uboot移植spi驱动
- mtk spi驱动移植
- uboot下gpio驱动移植
- GPIO口模拟SPI - 驱动W25Qxx
- mt7628 gpio模拟spi驱动si32171
- 【转载】mini2440 SPI驱动移植
- mini2440移植之SPI驱动
- SylixOS SPI Flash驱动移植
- Base封装之我的最简MVP架构
- Oracle 查询对应表所有字段名称,可排除不想要的字段
- MyBatis传多个参数的方法
- JSON.NET对象序列化示例教程
- 行人检测(Pedestrian Detection)资源
- spi-gpio+mcp2510驱动移植
- Spark性能优化指南——基础篇
- 容器集群管理平台的比较
- java父类和子类的相互访问
- 【2017/6】《流畅的Python》 (fluent python) 笔记
- ~Linux下crond服务与crontab命令的调研~
- list与数组的互相转换
- 如何巧用谷歌浏览器避免重复清理缓存
- 表单改变回车键/submit功能不自动提交表单(AJAX内容一闪而过)