Hello JerryChang,
My L4T version on the Nano is 32.1, and I’ve already enabled SPI0_0 using the script from the previously-mentioned GitHub repository. SPI0.0 is set up under spi@7000d400, as seen in the updated DTS file from that repository: https://github.com/rt-net/JetsonNano_DT_SPI/blob/master/tegra210-p3448-0000-p3449-0000-a02.dts
I am able to access SPI on the Jetson Nano under /dev/spidev0.0 after compiling and copying the updated DTB file before running the following scripts:
sudo ./apply_binaries.sh
sudo ./flash.sh --no-systemimg -k DTB jetson-nano-qspi-sd mmcblk0p1
My current goal is set up the MCP2517FD device by modifying the DTS file… except that I’m totally new to it, so I don’t quite know what are the right values to put in for the fields.
I’m trying to refer to this DTS for setting up the MCP2517FD driver on the OrangePi, from that ARMBIAN forum link:
/dts-v1/;
/plugin/;
//#include <dt-bindings/interrupt-controller/irq.h>
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
spi1 = "/soc/spi@01c69000";
};
};
/* the interrupt pin of the can-controller */
fragment@1 {
target = <&pio>;
__overlay__ {
can0_pin_irq: can0_pin_irq {
allwinner,pins = "PA2";
allwinner,function = "irq";
allwinner,drive = <0x0>;
allwinner,pull = <0x1>;
linux,phandle = <0x1>;
phandle = <0x1>;
};
};
};
/* the clock/oscillator of the can-controller */
fragment@2 {
target-path = "/";
__overlay__ {
/* external 20M oscillator of mcp2517fd on SPI0.0 */
mcp2517fd_osc: mcp2517fd_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <40000000>;
linux,phandle = <0x2>;
phandle = <0x2>;
};
};
};
/* the spi config of the can-controller itself binding everything together */
fragment@3 {
//target = <0xffffffff>;
target = <&spi1>;
can_overlay:__overlay__ {
status = "okay";
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
mcp2517fd: mcp2517fd@0 {
reg = <0>;
compatible = "microchip,mcp2517fd";
pinctrl-names = "default";
pinctrl-0 = <&can0_pin_irq>;
spi-max-frequency = <10000000>;
interrupt-parent = <&pio>;
interrupts = <0 2 8>; /* PA2 / IRQ_TYPE_LEVEL_LOW */
clocks = <&mcp2517fd_osc>;
};
};
};
};
This is my attempt at trying to modify it for tegra210-p3448-0000-p3449-0000-a02.dts, but I honestly have no idea if what I put in is correct for can@1, especially for the fields regarding interrupt and pin-ctrl. Would I also have to remove the entry for spi0_0 as well, if I insert can@1?
spi@7000d400 {
compatible = "nvidia,tegra210-spi";
reg = <0x0 0x7000d400 0x0 0x200>;
interrupts = <0x0 0x3b 0x4>;
iommus = <0x32 0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
dmas = <0x53 0xf 0x53 0xf>;
dma-names = "rx", "tx";
nvidia,clk-parents = "pll_p", "clk_m";
clocks = <0x27 0x29 0x27 0xf3 0x27 0xe9>;
clock-names = "spi", "pll_p", "clk_m";
resets = <0x27 0x29>;
reset-names = "spi";
status = "okay";
linux,phandle = <0xef>;
phandle = <0xef>;
prod-settings {
#prod-cells = <0x3>;
prod {
prod = <0x4 0xfff 0x0>;
};
prod_c_flash {
status = "disabled";
prod = <0x4 0x3f 0x7>;
};
prod_c_loop {
status = "disabled";
prod = <0x4 0xfff 0x44b>;
};
};
spi0_0 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "spidev";
reg = <0x0>;
spi-max-frequency = <40000000>;
nvidia,enable-hw-based-cs;
nvidia,cs-setup-clk-count = <0x1e>;
nvidia,cs-hold-clk-count = <0x1e>;
nvidia,rx-clk-tap-delay = <0x1f>;
nvidia,tx-clk-tap-delay = <0x0>;
};
can@1 {
compatible = "microchip,mcp2517fd";
reg = <0x0>;
spi-max-frequency = <10000000>;
clocks {
mcp2517fd_osc: mcp2517fd_osc {
compatible = "fixed-clock";
clock-frequency = <40000000>;
};
};
interrupt-parent = <0x3b>;
interrupts = <0x0 0x3b 0x4>;
pinctrl-names = "default";
pinctrl-0 = <0x3b>;
};
};