我正在使用SPI连接Raspberry Pi3中的AD4351评估板。
我已使用sudo make menuconfig
启用了IIO设备并重建了内核
和命令的输出
cat /lib/modules/$(uname -r)/modules.builtin | grep adf
给出了kernel/drivers/iio/frequency/adf4350.ko
,因此我相信已经安装了IIO驱动程序。但是我无法在/sys/bus/iio
文件夹中找到设备。
经过研究,我发现我必须为要识别的设备创建一个设备树覆盖。
这是我写的设备树。
/dts-v1/;
/plugin/;
/ {
clocks {
adf4351_clkin: clock {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <25000000>;
clock-output-names = "refclk";
};
};
};
/ {
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&spidev0>;
__overlay__ {
status = "disabled";
};
};
fragment@1 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
adf4351: adf4351@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
compatible = "adi,adf4351";
spi-max-frequency = <10000000>;
clocks = <&adf4351_clkin>;
clock-names = "clkin";
adi,channel-spacing = <1000000>;
adi,power-up-frequency = <370000000>;
adi,phase-detector-polarity-positive-enable;
adi,charge-pump-current = <2500>;
adi,output-power = <3>;
adi,mute-till-lock-enable;
adi,muxout-select = <6>;
};
};
};
};
我使用
进行了编译dtc -@ -I dts -O dtb -o adf4351.dtbo adf4351.dts
我收到警告并且无法检测到我的设备,而且我在PI中启用了SPI
adf4351.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
adf4351.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
重新启动dmesg
命令时会给出
[ 3.567457] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.567472] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 3.567844] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.567855] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 3.674079] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 3.677797] bcm2835_alsa bcm2835_alsa: card created with 8 channels
[ 3.678049] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.678071] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 3.742816] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.742879] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 3.820187] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.820205] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 3.824333] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[ 3.831610] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[ 3.831928] usbcore: registered new interface driver brcmfmac
[ 3.832312] OF: /soc/spi@7e204000/adf4351@0: could not find phandle
[ 3.832322] ERROR: could not get clock /soc/spi@7e204000/adf4351@0:clkin(0)
[ 4.082761] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[ 4.083612] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14
请有人帮我解决这个问题,我是设备树的新手。我也对我定义的时钟是否正确感到困惑,因为该设备当前使用的是板载内部VCO,并且没有外部源。 谢谢