前面一篇已经简单的介绍了SPI的协议,接下来看一下SPI在kernel中的配置。
路径:/kerner/arch/ARM/boot/dts/qcom/msm8916.dtsi
aliases {
spi0 = &spi_0;
}:
spi_0: spi@78b9000 { /* BLSP1 QUP3 */
compatible = "qcom,spi-qup-v2";
#address-cells = <1>;
#size-cells = <0>;
reg-names = "spi_physical", "spi_bam_physical";
reg = <0x78b9000 0x600>,
<0x7884000 0x23000>;
interrupt-names = "spi_irq", "spi_bam_irq";
interrupts = <0 99 0>, <0 238 0>;
spi-max-frequency = <50000000>;
pinctrl-names = "spi_default", "spi_sleep";
pinctrl-0 = <&spi2_default &spi2_cs2_active>;
pinctrl-1 = <&spi2_sleep &spi2_cs2_sleep>;
clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
<&clock_gcc clk_gcc_blsp1_qup5_spi_apps_clk>;
clock-names = "iface_clk", "core_clk";
qcom,infinite-mode = <0>;
qcom,use-bam;
qcom,use-pinctrl;
qcom,ver-reg-exists;
qcom,bam-consumer-pipe-index = <12>;
qcom,bam-producer-pipe-index = <13>;
qcom,master-id = <86>;
spidev@0 {
compatible = "spidev";
spi-max-frequency = <50000000>;
reg = <0>;
};
};
最后是引脚配置:
路径:/kernel/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi
spi2_active {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 16>, <&gp 17>, <&gp 19>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <1>;
label = "spi2-active";
/* active state */
spi2_default: default {
drive-strength = <12>; /* 12 MA */
bias-disable = <0>; /* No PULL */
};
};
spi2_cs2_active {
/* CS */
qcom,pins = <&gp 18>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <1>;
label = "spi2-cs0-active";
spi2_cs2_active: cs2_active {
drive-strength = <2>;
bias-disable = <0>;
};
};
spi2_suspend {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 16>, <&gp 17>, <&gp 19>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <0>;
label = "spi2-suspend";
/* suspended state */
spi2_sleep: sleep {
drive-strength = <2>; /* 2 MA */
bias-pull-down; /* pull down */
};
};
spi2_cs2_suspend {
/* CS */
qcom,pins = <&gp 18>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <0>;
label = "spi2-cs0-suspend";
spi2_cs2_sleep: cs2_sleep {
drive-strength = <2>;
bias-disable = <0>;
};
};
到这SPI的kernel配置就可以了。
|