-
-
Save pdp7/5741ff33c899f877ea22343980124849 to your computer and use it in GitHub Desktop.
/dts-v1/; | |
/plugin/; | |
#include <dt-bindings/gpio/gpio.h> | |
#include <dt-bindings/pinctrl/am33xx.h> | |
#include <dt-bindings/interrupt-controller/irq.h> | |
/* | |
Macchina SPI0 for SWCAN MCP2515 is PocketBeagle SPI1 | |
Macchina PB adapter J3 is PB P1 | |
Macchina PB adapter J2 is next to J3 / PB P1 | |
Macchina PB adapter J4 is PB P2 | |
Macchina PB adapter J1 is next to J4 / PB P2 | |
https://github.com/macchina/pocketbeagle-adapter-hardware/blob/master/SCH-01010%20R0%20SCHEM_RELEASE.PDF | |
https://github.com/macchina/m2-hardware/tree/master/M2-B | |
https://github.com/macchina/m2-hardware/blob/master/M2-B/Interface%20Board%20PCB.pdf | |
M2 J3 is plugs into PB adapter J2, next to PB P1 (which is PB adapter J3) | |
M2 J4 is plugs into PB adapter J1, next to PB P2 (which is PB adapter J4) | |
M2 J4.20: SWC nINT <-> P2.8 | |
M2 J3.6 : SWC_nRESET <-> P2.32 | |
M2 J4.9 : SWC_M0 <-> P2.6 | |
M2 J4.28: SWC_M1 <-> P2.18 | |
M2 J3.30: SWC_CLK <-> NC | |
M2 J4.25: SWC_SOF <-> NC | |
M2 J4.29: SWC_nRX0BF <-> NC | |
M2 J4.30: SWC_nRX1BF <-> NC | |
M2 J4.27: SPI0_CLK <-> PB adapter J2.27: SPI1_CLK | |
M2 J4.24: SPI0_MISO <-> PB adapter J2.24: SPI1_MISO | |
M2 J4.26: SPI0_MOSI <-> PB adapter J2.26: SPI1_MOSI | |
M2 J3.25: SPI0_nCS3 <-> PB adapter J1.25: SPI1_CS | |
PB adapter J4.25: SPI1_MOSI <-> PB 2.25: SPI1_MOSI | |
PB adapter J4.27: SPI1_MISO <-> PB 2.27: SPI1_MISO | |
PB adapter J4.29: SPI1_CLK <-> PB 2.29: SPI1_CLK | |
PB adapter J4.31: SPI1_CS <-> PB 2.31: SPI1_CS | |
1006 Signals 1006 headers2 1010/PB header | |
SWC nRESET J3P6 P2-32 | |
SPI0_nCS3 J3P25 P2-31 | |
SPI0 MISO J4P24 P2-27 | |
SPI0 MOSI J4P26 P2-25 | |
SPI0 CLK J4P27 P2-29 | |
SWC nINT J4P20 P2-8 | |
SWC nRX0BF J4P29 NC | |
SWC nRX1BF J4P30 NC | |
SWC SOF J4P25 NC | |
SWC CLK J3P30 NC | |
SWC M0 J4P9 P2-6 | |
SWC M1 J4P28 P2-18 | |
*/ | |
/ { | |
fragment@0 { | |
target = <&ocp>; | |
__overlay__ { | |
/* | |
M2 J4.20: SWC nINT <-> P2.8 <&gpio1 28 0>, needs GPIO input | |
M2 J3.6 : SWC_nRESET <-> P2.32 GPIO 112 / PRU0.2, <&gpio3 16 0>, needs GPIO OUTPUT | |
M2 J4.9 : SWC_M0 <-> P2.6 | |
M2 J4.28: SWC_M1 <-> P2.18 | |
*/ | |
P2_08_pinmux { status = "disabled"; }; /* SWC nINT */ | |
P2_32_pinmux { status = "disabled"; }; /* SWC nRESET */ | |
P2_25_pinmux { status = "disabled"; }; /* MOSI - gpio1_9 */ | |
P2_27_pinmux { status = "disabled"; }; /* MISO - gpio1_8 */ | |
P2_29_pinmux { status = "disabled"; }; /* CLK - gpio0_7 */ | |
P2_31_pinmux { status = "disabled"; }; /* CS - gpio0_19 */ | |
}; | |
}; | |
fragment@1 { | |
target = <&spi1>; | |
__overlay__ { | |
status = "okay"; | |
pinctrl-names = "default"; | |
/* | |
M2 J4.20: SWC nINT <-> P2.8 <&gpio1 28 0>, needs GPIO input | |
M2 J3.6 : SWC_nRESET <-> P2.32 GPIO 112 / PRU0.2, <&gpio3 16 0>, needs GPIO OUTPUT | |
M2 J4.9 : SWC_M0 <-> P2.6 GPIO 57, needs GPIO OUTPUT | |
M2 J4.28: SWC_M1 <-> P2.18 GPIO 47, needs GPIO OUTPUT | |
*/ | |
pinctrl-0 = < | |
/* connected to MCP2515 pin 19 _RESET | |
hopefully pullup will enable the chip */ | |
&P2_32_gpio_pu_pin | |
/* SWC nINT */ | |
/* &P2_08_gpio_input_pin is not mode 0x37, so wrong? */ | |
&P2_08_default_pin /* this should be mode 0x37 */ | |
/* SPI1 */ | |
&P2_31_spi_cs_pin | |
&P2_29_spi_sclk_pin | |
&P2_27_spi_pin | |
&P2_25_spi_pin | |
>; | |
channel@0{ status = "disabled"; }; | |
channel@1{ status = "disabled"; }; | |
}; | |
}; | |
fragment@2 { | |
target = <&am33xx_pinmux>; | |
__overlay__ { | |
/* | |
this was originally for BeagleBone Black and used P8.06 | |
from http://exploringbeaglebone.com/wp-content/uploads/resources/BBBP8Header.pdf | |
P8_06 3 0x80c/00c 35 GPIO1_3 gpio1[3] | |
pinctrl-single,pins = < 0x00c 0x37 >; | |
#0x37 : PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7 | |
for PocketBeagle, Macchina puts nINT on P2.08 (ZCZ ball U18) gpio1_28 | |
P2_08_default_pin: pinmux_P2_08_default_pin { pinctrl-single,pins = < | |
AM33XX_IOPAD(0x0878, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7) >; }; gpmc_be1n.gpio1_28 | |
where 0x0878 = PB_P2_08 | |
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/dt-bindings/pinctrl/omap.h#n57 | |
https://github.com/beagleboard/bb.org-overlays/blob/master/tools/pinmux-generator/PocketBeagle.dts#L465-L467 | |
https://github.com/beagleboard/bb.org-overlays/blob/master/tools/pinmux-generator/lib/pinmux.sh#L631 | |
so let's try giving pincntrl-single 0x087 which should be the offset from the 0x0800 base | |
*/ | |
mcp2515_int: mcp2515_int { | |
pinctrl-single,pins = < 0x087 0x37 >; | |
}; | |
}; | |
}; | |
fragment@3 { | |
target-path = "/"; | |
__overlay__ { | |
mcp2515_clock: mcp2515_clock { | |
compatible = "fixed-clock"; | |
#clock-cells = <0>; | |
clock-frequency = <8000000>; | |
}; | |
}; | |
}; | |
fragment@4 { | |
target = <&spi1>; | |
__overlay__ { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
can0: mcp2515@0 { | |
status = "okay"; | |
reg = <0>; | |
compatible = "microchip,mcp2515"; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&mcp2515_int>; | |
spi-max-frequency = <10000000>; | |
interrupt-parent = <&gpio1>; | |
interrupts = <3 2>; | |
clocks = <&mcp2515_clock>; | |
mcp251x,oscillator-frequency = <8000000>; | |
mcp251x,irq-gpios = <&gpio1 28 0>; | |
mcp251x,stay-awake = <1>; | |
mcp251x,enable-clkout = <1>; | |
}; | |
}; | |
}; | |
__overrides__ { | |
oscillator = <&mcp2515_clock>,"clock-frequency:0"; | |
spimaxfrequency = <&can0>,"spi-max-frequency:0"; | |
interrupt = <&mcp2515_int>,"pinctrl-single,pins:0",<&can0>,"interrupts:0"; | |
}; | |
}; |
does that seem correct?
- P2_31_spi_cs_pin
- P2_29_spi_sclk_pin
- P2_27_spi_pin
- P2_25_spi_pin
jkridner [11:01 PM]
dang PRU path changes SOOO much.
rcn-ee [11:01 PM]
each one is different... it's annoying...
@fustini i think P2_29_spi_sclk_pin is wrong, based of a post on beagleboard group..
fustini [11:02 PM]
@jkridner is the pins you use for SPI1: P2.29, P2.31, P2.27, P2.25 ?
oh (edited)
@rcn-ee interesting, which post?
jkridner [11:03 PM]
yeah
rcn-ee [11:04 PM]
@fustini https://groups.google.com/d/msg/beagleboard/SFsmDpdTz-Q/ZIZo9uvIEgAJ
jkridner [11:06 PM]
the extra on techlab is a buzzer on the PRU.
also, the potentiometer is gone and a light sensor is there instead.
fustini [11:06 PM]
@rcn-ee so this is correct?
P2_29_spi_cs_pin: pinmux_P2_29_spi_cs_pin { pinctrl-single,pins = < AM33XX_IOPAD(0x0964, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE2) >; }; /* eCAP0_in_PWM0_out.spi1_cs1 */
https://github.com/jadonk/linux-1/blob/add-mcp23s08/arch/arm/boot/dts/am335x-pocketbeagle-common.dtsi#L829
GitHub
jadonk/linux-1
Contribute to jadonk/linux-1 development by creating an account on GitHub.
rcn-ee [11:09 PM]
@fustini i think we need to change PIN_OUTPUT_PULLUP to PIN_INPUT_PULLUP to be 100% correct, i think we are sometimes saved by "INPUT_EN"...
@fustini ti's pinmux say:
pinctrl-single,pins = <
AM33XX_IOPAD(0x108, PIN_INPUT_PULLUP | MUX_MODE2) /* (H16) gmii1_col.spi1_sclk */
AM33XX_IOPAD(0x10c, PIN_INPUT_PULLUP | MUX_MODE2) /* (H17) gmii1_crs.spi1_d0 */
AM33XX_IOPAD(0x110, PIN_INPUT_PULLUP | MUX_MODE2) /* (J15) gmii1_rxer.spi1_d1 */
AM33XX_IOPAD(0x144, PIN_INPUT_PULLUP | MUX_MODE2) /* (H18) rmii1_refclk.spi1_cs0 */
>;
};```
fustini [11:15 PM]
thanks
pocketbeagle with mcp2515 on SPI0:
create CAN interface