The SPI driver is in the kernel (as a module), but not in the device tree. you will need to rebuild the device tree to get it to work. Additionally if you want hardware chip select to work, you will need to make a small change to the device driver in the kernel. If a proper device driver exists for the device you are attaching to the SPI bus, then you should use it if possible (instead of spidev). This ‘patch’ will enable the generic /dev/spidev0.0 and fix the HW chip select. I have tested this on build #202 this week.
diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index f6d2bcb6dbd1..874150a412a2 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -208,8 +208,14 @@
/* On Low speed expansion */
label = "LS-SPI0";
status = "okay";
+ spidev@0 {
+ compatible = "spidev";
+ spi-max-frequency = <100000>;
+ reg = <0>;
+ };
};
leds {
diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
index 899f2b28a9c9..1c22b4414edf 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
@@ -208,7 +208,7 @@
pins = "gpio16", "gpio17", "gpio19";
};
pinmux_cs {
- function = "gpio";
+ function = "blsp_spi5";
pins = "gpio18";
};
pinconf {
@@ -218,7 +218,7 @@
};
pinconf_cs {
pins = "gpio18";
- drive-strength = <2>;
+ drive-strength = <12>;
bias-disable;
output-high;
};
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 68f95acf7971..aed71ef7e3fd 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -580,6 +580,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
else
control &= ~SPI_IO_C_CLK_IDLE_HIGH;
+ config |= SPI_IO_C_MX_CS_MODE;
writel_relaxed(control, controller->base + SPI_IO_CONTROL);
config = readl_relaxed(controller->base + SPI_CONFIG);
@@ -928,7 +929,7 @@ static int spi_qup_probe(struct platform_device *pdev)
base + QUP_ERROR_FLAGS_EN);
writel_relaxed(0, base + SPI_CONFIG);
- writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL);
+ writel_relaxed(SPI_IO_C_NO_TRI_STATE|SPI_IO_C_MX_CS_MODE, base + SPI_IO_CONTROL);
ret = devm_request_irq(dev, irq, spi_qup_qup_irq,
IRQF_TRIGGER_HIGH, pdev->name, controller);
if you don’t want to use hardware chip select, and would rather use software chip select then you don’t need to patch the drivers/spi/spi-qup.c file, instead, leave pinmux_cs as gpio, and add the line:
cs-gpios = <&msmgpio 18>;
in front of the spidev@0 in the file arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
Instructions for rebuilding the kernel and devicetree are here: http://builds.96boards.org/releases/dragonboard410c/linaro/debian/latest/ although you will need to use a slightly different git checkout command if you want to rebuild #202.
git checkout -b build-202 0ea6924010269ba065848b2e450673e96bceffd9