HiKey970 - SPI not getting Enabled because which CAN0 interface is not getting enabled

We are trying to include CAN interface to the AOSP build but it is observed that SPI interface is not register in /dev/*

Need support in-order to get SPI interface for HiKey970. As per information available in the forum updated the kirin970-hikey970.dts.

Kernel Version : 4.9

spi0 {
label = “LS-SPI0”;
status = “okay”;
spidev@0 {
compatible = “spidev”;
spi-max-frequency = <20000000>;
reg = <0>;
};
};

hikey970_defconfig:
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_MCP251X=y
CONFIG_CAN_DEBUG_DEVICES=y

CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_SPIDEV=y

overlay_mgr.overlay_dt_entry=hardware_cfg_spidev0 is added to the bootargs.

Please let me know if you have any suggestion.

Can you attach the patch/diff you applied.

Thank you for responding. kirin970_defconfig was modified as shared in the earlier post.

Other changes adapted are kirin970-hikey970.dts and Kirin970.dtsi file.

Please find the diff:

git diff boot/dts/hisilicon/kirin970-hikey970.dts
diff --git a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts
index c5fc05e839e1…6b467c05cad0 100755
— a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts
+++ b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts
@@ -267,6 +267,18 @@
btwilink {
compatible = “btwilink”;
};
+

  • spi0 {
  •   label = "LS-SPI0";
    
  •   status = "okay";
    
  •   spidev@0 {
    
  •         compatible = "spidev";
    
  •         spi-max-frequency = <500000>;
    
  •         reg = <0>;
    
  •   };
    
  • };

};

&dwmmc1 {
@@ -308,3 +320,4 @@
max-speed = <921600>;
};
};
+
git diff boot/dts/hisilicon/kirin970.dtsi
diff --git a/arch/arm64/boot/dts/hisilicon/kirin970.dtsi b/arch/arm64/boot/dts/hisilicon/kirin970.dtsi
index 5d655c0a4fa8…97f8cc7e0bf5 100755
— a/arch/arm64/boot/dts/hisilicon/kirin970.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/kirin970.dtsi
@@ -1176,7 +1176,7 @@
clocks = <&can_clk>;
interrupt-parent = <&gpio18>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;

  •                           spi-max-frequency = <10000000>;
    
  •                           spi-max-frequency = <500000>;
                              can-rst = <&gpio6 2 0>;
                              status = "ok";
                      };
    

Please let me know if any other changes are required.

If you want to override the spi0 node in the dts, you need to override it by reference &spi0 {... (not spi0 {).

Next look like the the kirin970 dtsi already defines a CAN subnode: https://github.com/96boards-hikey/linux/blob/hikey970-v4.9/arch/arm64/boot/dts/hisilicon/kirin970.dtsi#L1159, so the device should already be managed by the microchip mcp2515 kernel driver (and so exposed as a CAN interface to the user), so not sure why you want to direclty access it from userspace via its spi interface.

Thank you for your feedback. I have migrated to the latest AOSP the issue is resolved CAN0 interface issue is resolved.