Hi everybody,
I have SPI up and running, using spidev.ko and spidev_test.c, on HS Expansion Connector but not on LS Expansion Conector.
I use linux_android_board_support_package_vla.br_.1.2.4-01810-8x16.0-3.zip code to build Android system. I have recompiled it adding on kernel/arch/arm/boot/dts/qcom/msm8916.dtsi the node to spidev kernel module.
spi_0: spi@78b7000 { /* BLSP1 QUP3 */
compatible = "qcom,spi-qup-v2";
#address-cells = <1>;
#size-cells = <0>;
reg-names = "spi_physical", "spi_bam_physical";
reg = <0x78b7000 0x600>,
<0x7884000 0x23000>;
interrupt-names = "spi_irq", "spi_bam_irq";
interrupts = <0 97 0>, <0 238 0>;
spi-max-frequency = <50000000>;
pinctrl-names = "spi_default", "spi_sleep";
pinctrl-0 = <&spi0_default &spi0_cs0_active>;
pinctrl-1 = <&spi0_sleep &spi0_cs0_sleep>;
clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
<&clock_gcc clk_gcc_blsp1_qup3_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 = <8>;
qcom,bam-producer-pipe-index = <9>;
qcom,master-id = <86>;
spidev@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <1000000>;
};
};
On kernel/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi
spi0_active {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 8>, <&gp 9>, <&gp 11>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <1>;
label = "spi0-active";
/* active state */
spi0_default: spi0_default {
drive-strength = <12>; /* 12 MA */
bias-disable = <0>; /* No PULL */
};
};
spi0_suspend {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 8>, <&gp 9>, <&gp 11>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <0>;
label = "spi0-suspend";
/* suspended state */
spi0_sleep: spi0_sleep {
drive-strength = <2>; /* 2 MA */
bias-pull-down; /* pull down */
};
};
spi0_cs0_active {
/* CS */
qcom,pins = <&gp 10>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <1>;
label = "spi0-cs0-active";
spi0_cs0_active: cs0_active {
drive-strength = <2>;
bias-disable = <0>;
};
};
spi0_cs0_suspend {
/* CS */
qcom,pins = <&gp 10>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <0>;
label = "spi0-cs0-suspend";
spi0_cs0_sleep: cs0_sleep {
drive-strength = <2>;
bias-disable = <0>;
};
};
As It can be seen,
/* MOSI, MISO, CLK */
qcom,pins = <&gp 8>, <&gp 9>, <&gp 11>;
MOSI, MISO and CLK are located at HS Expansion board. After reflashing, everything goes fine in this scenario, I can see:
root@msm8916_64:/ # ls /dev | grep spi
spidev0.0
And running spidev_test y see the signal of CLK in the scope at pin9, connector J9 (HS Expansion Board).
My goal is to have this interface spidev0.0 on J8 (LS Expansion Connector), in orther to achieve this I have modified kernel/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi, replacing the location of MOSI, MISO and CLK to:
/* MOSI, MISO, CLK */
qcom,pins = <&gp 16>, <&gp 17>, <&gp 19>;
Everything else is not modified. I recompile & reflash boot image. I get again:
root@msm8916_64:/ # ls /dev | grep spi
spidev0.0
But, when try to run spidev_test, it fails with the following output:
root@msm8916_64:/ # ./spidev_test_00
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
can’t send spi message: I/O error
Aborted
I have checked with the scope the new assigned pins and there is no activity on CLK line.
Am I missing anything if I just want to change the gpios used by a driver on this chip ? Is there any limitation on LS expansion connector for SPI ?
Any idea is more than welcome
Thanks,
Gerardo