【发布时间】:2014-06-10 10:33:04
【问题描述】:
我对设备树有一些奇怪的问题。我发现更改 .dtbo 的名称会改变内核的行为!
我已经用 Angstrom 修改了 /lib/firmware 中给出的 BB-SPIDEV1-00A0.dts:
/*
* Copyright (C) 2013 CircuitCo
*
* Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-SPI1-01";
version = "00A0";
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.31", /* spi1_sclk */
"P9.29", /* spi1_d0 */
"P9.30", /* spi1_d1 */
"P9.28", /* spi1_cs0 */
"P9.42", /* spi1_cs1 */
/* the hardware ip uses */
"spi1";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
/* default state has all gpios released and mode set to uart1 */
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x13 /* mcasp0_aclkx.spi1_sclk, OUTPUT_PULLUP | MODE3 */
0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */
0x1A0 0x32 /* Other P42 pin, INPUT_PULLUP */
>;
};
};
};
fragment@1 {
target = <&spi1>; /* spi1 is numbered correctly */
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;
#address-cells = <1>;
#size-cells = <0>;
spi1_0{
#address-cells = <1>;
#size-cells = <0>;
compatible = "spidev";
reg = <0>;
spi-max-frequency = <16000000>;
};
spi1_1{
#address-cells = <1>;
#size-cells = <0>;
compatible = "spidev";
reg = <1>;
spi-max-frequency = <16000000>;
};
};
};
};
我把它编译成两个名字:BB-SPIDEV1-00A0.dtbo 和 BB-SPI1-01-00A0.dtbo
当我在 /sys/devices/bone_capemgr.9/slots 中加载其中一个时,spidev 的行为会有所不同!
使用 BB-SPIDEV1,spidev1.0 运行良好,没有任何问题。但是spidev1.1的片选不行! 42号管脚模式错误,管脚没有分配spi1
另一方面,对于 BB-SPI1-01(这个名字不重要,取另一个名字是一样的,只是必须和 BB-SPIDEV1 不同),引脚 42 分配得当:
root@beaglebone:/sys/kernel/debug/pinctrl/44e10800.pinmux# cat pinmux-pins | grep spi
pin 89 (44e10964): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
pin 100 (44e10990): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
pin 101 (44e10994): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
pin 102 (44e10998): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
pin 103 (44e1099c): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
pin 104 (44e109a0): 481a0000.spi (GPIO UNCLAIMED) function pinctrl_spi1_pins group pinctrl_spi1_pins
并且处于良好模式:
root@beaglebone:/sys/kernel/debug/pinctrl/44e10800.pinmux# cat pins | grep 964
pin 89 (44e10964) 00000012 pinctrl-single
但是这次 spidev1.0 不能正常工作。 MISO 线(因此 BBB 的输入)只看到 0,即使它是假的(我用示波器检查过)。
那么可能是什么问题?
提前致谢
【问题讨论】:
-
您的 dts 看起来与原始 BB-SPIDEV1-00A0 源几乎相同,除了缺少一行:
spi-cpha;位于片段 1,通道 0,spi-max-frequency下,并且有几个引脚复用的差异:SPI1_SCLK 可能是 INPUT_PULLUP,我也看不出 P9_42B (0x1A0) 和 SPI 子系统之间有任何关系 - 你可能将它与具有 SPI1_SCLK (模式 4) 的 P9_42A (0x164) 和SPI1_CS1(模式 2)。 P9_42B 的模式 2 是“MCASPO_AXR2”。 -
我看到 P9_42B 必须设置为 'INPUT' 所以改为尝试模式 4(将其路由到空):0x34 ...或模式 7,即 gpio 0x37
-
没有任何效果...我尝试了模式 4、模式 7,将 SPI1_SCLK 设置为 INPUT_PULLUP,添加 spi-cpha,同样的行为。无论如何,第二个芯片选择在启动时并不高,与第一个相反。
-
感谢您的回复!无论如何,它并没有解决不同的名称问题
-
我相信我可能知道问题出在哪里:作为 BB-BONELT-HDMIN 覆盖的一部分,在启动时引脚 100-103 和 89 都复用到了
multichannel audio serial port subsystem 0[mcasp0]。要移除 HDMI 覆盖层,请按照本页底部的说明进行操作:tekuconcept.blogspot.com/2014/02/gpio-beaglebone-and-bash.html,然后看看会发生什么。
标签: kernel spi beagleboneblack device-tree