Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enabling MCP251x SPI CAN Controller Driver in Jetson TX1 (J21 SPI1)
/*this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Valid for Linux4Tegra v28.1
*
* J21 Header SPI1 == bus_num 0
* Expansion SPI0 == bus_num 3
* Expansion SPI2 == bus_num 1
*/
/ {
clocks {
/* 16MHz external crystal oscillator */
clk16m: mcp251x_osc {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <16000000>;
};
};
//https://youtu.be/_36yNWw_07g?t=5
gpio@6000d000 {
spi_enable {
gpio-hog;
function;
// gpios = <TEGRA_GPIO(C, 0) 0 TEGRA_GPIO(C, 1) 0 TEGRA_GPIO(C, 2) 0 TEGRA_GPIO(C, 3) TEGRA_GPIO(C, 4) 0>;
gpios = <0x10 0x0 0x11 0x0 0x12 0x0 0x13 00 0x14 0x0>;
};
};
pinmux@700008d4 {
common {
motion_int_px2 {
nvidia,pins = "motion_int_px2";
nvidia,function = "rsvd0";
nvidia,pull = <0x2>;
nvidia,tristate = <0x0>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
};
};
/* J21 Header SPI1 */
/* Note the difference in numbering between the connector and device */
spi@7000d400 {
status = "okay";
spi-max-frequency = <2000000>;
can@0 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "microchip,mcp2515";
reg = <0x0>;
clocks = <&clk16m>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(X, 2) IRQ_TYPE_EDGE_FALLING>;
spi-max-frequency = <2000000>;
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.