SPI + DMA support

Hi,

I’m using an imu connected to the spi port of a beaglebone black and using a customized dtb.
I’,m using the kernel 5.10.140-ti-rt-r52 and I’m facing a lag and a high load average in the linux reading this sensor - is a high number of readins - around 400 reading per second, and I can see a high load average - around 6 in the processor.
My question is, is the spi using the dma - for a better performance ? How can I check this or how can I enable this?
There is something I can enable to increase the performance of the reading and decrease this load average ?

This is how I’m enabling the SPI
&spi1 {
pinctrl-names = “default”;
pinctrl-0 = <&spi1_pins>;
status = “okay”;

    spi1_0 {
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <0>;
            spi-max-frequency = <24000000>;
            compatible = "linux,spidev";
            symlink = "spi/1.0";
    };

    spi1_1 {
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <1>;
            spi-max-frequency = <24000000>;
            compatible = "linux,spidev";
            symlink = "spi/1.1";
    };

};

Hello,

I noticed w/ the newer kernel, the 5.10.x, at the git repo, there may be no spidevN devices available so far.

I looked in /src/arm/overlays/. I have not found them yet in that directory. Something has changed.

Seth

P.S. I would guess here, since I cannot track it down myself right now, there is some SPI changes in the newer kernel for am335x that is offered by beagleboard.org. Hmm. This could be why I could not get my SPI camera to show up on the LCD. Going into the Linux kernel may provide some sort of support…

&gpio0 {
	gpio-line-names =
		"[mdio_data]",
		"[mdio_clk]",
		"P9_22 [spi0_sclk]",
		"P9_21 [spi0_d0]",
		"P9_18 [spi0_d1]",
		"P9_17 [spi0_cs0]",

It seems that spi0 is listed. I have not checked the rest of the file(s). Did you make your own kernel and image? If that is so, things may be too complicated for just me to pitch in.

Up at it in the morning!

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2013 CircuitCo
 * Virtual cape for SPI0 on connector pins P9.22 P9.21 P9.18 P9.17
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
	overlays {
		BB-SPIDEV0-00A0.kernel = __TIMESTAMP__;
	};
};

/*
 * Free up the pins used by the cape from the pinmux helpers.
 */
&ocp {
	P9_17_pinmux { status = "disabled"; };	/* P9_17 (A16) spi0_cs0.spi0_cs0 */
	P9_18_pinmux { status = "disabled"; };	/* P9_18 (B16) spi0_d1.spi0_d1 */
	P9_21_pinmux { status = "disabled"; };	/* P9_21 (B17) spi0_d0.spi0_d0 */
	P9_22_pinmux { status = "disabled"; };	/* P9_22 (A17) spi0_sclk.spi0_sclk */
};

&am33xx_pinmux {
	bb_spi0_pins: pinmux_bb_spi0_pins {
		pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0)	/* P9_22 (A17) spi0_sclk.spi0_sclk */
			AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT, MUX_MODE0)	/* P9_21 (B17) spi0_d0.spi0_d0 */
			AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0)	/* P9_18 (B16) spi0_d1.spi0_d1 */
			AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE0)	/* P9_17 (A16) spi0_cs0.spi0_cs0 */
		>;
	};
};

&spi0 {
	#address-cells = <1>;
	#size-cells = <0>;

	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&bb_spi0_pins>;

	/*
	 * Select the D0 pin as output and D1 as
	 * input. The default is D0 as input and
	 * D1 as output.
	 */
	//ti,pindir-d0-out-d1-in;

	channel@0 {
		#address-cells = <1>;
		#size-cells = <0>;

		compatible = "rohm,dh2228fv";
		symlink = "bone/spi/0.0";

		reg = <0>;
		spi-max-frequency = <16000000>;
		spi-cpha;
	};

	channel@1 {
		#address-cells = <1>;
		#size-cells = <0>;

		compatible = "rohm,dh2228fv";
		symlink = "bone/spi/0.1";

		reg = <1>;
		spi-max-frequency = <16000000>;
	};
};

I found this idea. The kernel is v5.10.x-ti-unified

Hi Seth,

after some research and tests the problem is the 5.10.x just accept the compatible tag:
try change
compatible = “rohm,dh2228fv”;
to
compatible = “spidev”;
or
compatible = “linux,spidev”;
Then recompile, install and use :slight_smile:
I believe with that the dma is enabled, I just don’t know if is been used by the spidev framework.

1 Like

Nice!