Board: Beagleboard X15, using AM5728
Using build root to bring up x15 board
Modifying DTS and pinmux to get MCSPI4 master to pins:
/* SCLK N7 gpmc_a8.spi4_sclk --> P16.9 */ /* MISO R4 gpmc_a9.spi4_d1 --> P16.37 */ /* MOSI N9 gpmc_a10.spi4_d0 --> P16.14 */ /* CS0 P9 gpmc_a11.spi4_cs0 --> P16.44 */
Files I'm patching are in kernel/ and uboot:
linux-4.9/arch/arm/boot/dts/am57xx-beagle-x15.dts
+&dra7_pmx_core {
+ mcspi4_pins_default: mcspi4_pins_default {
+ pinctrl-single,pins = <
+ 0x60 (PIN_INPUT_PULLUP | MUX_MODE8) /* gpmc_a8.spi4_sclk --> P16.9 */
+ 0x64 (PIN_INPUT_PULLUP | MUX_MODE8) /* gpmc_a9.spi4_d1 --> P16.37 */
+ 0x68 (PIN_OUTPUT_PULLUP | MUX_MODE8) /* gpmc_a10.spi4_d0 --> P16.14 */
+ 0x6C (PIN_OUTPUT_PULLUP | MUX_MODE8) /* gpmc_a11.spi4_cs0 --> P16.44 */
+ >;
+ };
+};
+
+&mcspi4 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcspi4_pins_default>;
+ spidev@0 {
+ reg = <0>;
+ compatible = "spidev";
+ spi-max-frequency = <1000000>;
+ };
+};
uboot-2016.11/arch/arm/dts/am57xx-beagle-x15.dts
+ mcspi4_pins_default: mcspi4_pins_default {
+ pinctrl-single,pins = <
+ 0x60 (PIN_INPUT_PULLUP | MUX_MODE8) /* gpmc_a8.spi4_sclk --> P16.9 */
+ 0x64 (PIN_INPUT_PULLUP | MUX_MODE8) /* gpmc_a9.spi4_d1 --> P16.37 */
+ 0x68 (PIN_OUTPUT_PULLUP | MUX_MODE8) /* gpmc_a10.spi4_d0 --> P16.14 */
+ 0x6C (PIN_OUTPUT_PULLUP | MUX_MODE8) /* gpmc_a11.spi4_cs0 --> P16.44 */
+ >;
+ };
+
@@ -531,6 +540,17 @@
};
};
+&mcspi4 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcspi4_pins_default>;
+ spidev@0 {
+ reg = <0>;
+ compatible = "spidev";
+ spi-max-frequency = <1000000>;
+ };
+};
+
uboot-2016.11/board/ti/am57xx/mux_data.h
- {GPMC_A8, (M2 | PIN_INPUT_PULLDOWN | MANUAL_MODE)}, /* gpmc_a8.vin3a_hsync0 */
- {GPMC_A9, (M2 | PIN_INPUT_PULLDOWN | MANUAL_MODE)}, /* gpmc_a9.vin3a_vsync0 */
- {GPMC_A10, (M2 | PIN_INPUT_PULLDOWN | MANUAL_MODE)}, /* gpmc_a10.vin3a_de0 */
- {GPMC_A11, (M2 | PIN_INPUT_PULLDOWN | MANUAL_MODE)}, /* gpmc_a11.vin3a_fld0 */
+ #if 1 // SPI 4
+ {GPMC_A8, (M8 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* N7 gpmc_a8.spi4_sclk --> P16.9 */
+ {GPMC_A9, (M8 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* R4 gpmc_a9.spi4_d1 --> P16.37 */
+ {GPMC_A10, (M8 | PIN_OUTPUT_PULLUP | MANUAL_MODE)}, /* N9 gpmc_a10.spi4_d0 --> P16.14 */
+ {GPMC_A11, (M8 | PIN_OUTPUT_PULLUP | MANUAL_MODE)}, /* P9 gpmc_a11.spi4_cs0 --> P16.44 */
+ #endif
After booting a /dev/spi1.0 I'm able to use python spidev or just 'echo '123' > /dev/spi1.0 with feedback:
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.472968] spidev spi1.0: setup: speed 100000, sample leading edge, clk normal
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.472992] spidev spi1.0: setup mode 0, 8 bits/w, 100000 Hz max --> 0
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.473010] spidev spi1.0: setup: speed 1000000, sample leading edge, clk normal
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.473024] spidev spi1.0: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.473031] spidev spi1.0: spi mode 0
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.473095] spidev spi1.0: setup: speed 100000, sample leading edge, clk normal
Jan 1 00:11:06 buildroot kern.debug kernel: [ 666.473447] spidev spi1.0: setup: speed 1000000, sample leading edge, clk normal
And I can see it on the scope.
The mystery is that serial data is coming from the MISO, and MOSI appears to be doing nothing.
The code specifies
spi4_d1 --> MISO,
spi4_d0 ---> MOSI
But data is exiting from spi4_d1, and not spi4_d0.
Even more strange is if I make spi4_d1 as MOSI, and spi4_d0 as MISO I get the same result.
I tried using devmem2, but it crashes on most addresses I tried.
I appreciate any responses! =)
thanks,