Part Number: BEAGLEBK
Tool/software: Linux
Hi
I was trying to enable SPI1 on Beaglebone Black following these two posts:
https://e2e.ti.com/support/processors/f/791/t/737397
https://e2e.ti.com/support/processors/f/791/t/455854
An spidev user space driver will be used to control the device. I was able to see the "spidev1.0" device node in /dev. However, there are two warning/error messages when the Linux boots:
First:
[ 0.931554] spidev spi1.0: buggy DT: spidev listed directly in DT
[ 0.937859] ------------[ cut here ]------------
[ 0.942592] WARNING: CPU: 0 PID: 1 at .../am335x-evm/kernel-source/drivers/spi/spidev.c:730 spidev_probe+0x1a4/0x1d4
[ 0.956056] Modules linked in:
[ 0.959131] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.67... #2
[ 0.967178] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 0.973304] Backtrace:
[ 0.975782] [<c010bcac>] (dump_backtrace) from [<c010bf90>] (show_stack+0x18/0x1c)
[ 0.983397] r7:00000009 r6:00000000 r5:c0af3d2c r4:00000000
[ 0.989090] [<c010bf78>] (show_stack) from [<c0825e24>] (dump_stack+0x24/0x28)
[ 0.996363] [<c0825e00>] (dump_stack) from [<c0128d24>] (__warn+0xe8/0x100)
[ 1.003372] [<c0128c3c>] (__warn) from [<c0128df4>] (warn_slowpath_null+0x28/0x30)
...
[ 1.404855] ---[ end trace dd0b292e7edbf342 ]---
Second:
[ 1.741176] pinctrl-single 44e10800.pinmux: pin PIN103 already requested by 481a0000.spi; cannot claim for 48038000.mcasp
[ 1.752361] pinctrl-single 44e10800.pinmux: pin-103 (48038000.mcasp) status -22
[ 1.759770] pinctrl-single 44e10800.pinmux: could not request pin 103 (PIN103) from group mcasp0_pins on device pinctrl-single
[ 1.771381] davinci-mcasp 48038000.mcasp: Error applying setting, reverse things back
[ 1.779394] davinci-mcasp: probe of 48038000.mcasp failed with error -22
Here are what I did:
1. Enable CONFIG_SPI_SPIDEV in the kernel.
2. Patch Linux kernel in driver/spi/spidev.c:
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv" },
+ { .compatible = "linux,spidev" },
{ .compatible = "lineartechnology,ltc2488" },
{ .compatible = "ge,achc" },
{ .compatible = "semtech,sx1301" },
3. Patch device tree in arch/arm/boot/dts/am335x-boneblack.dts:
+ spi1_pins: spi1_pins {
+ pinctrl-single,pins = <
+ AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLUP | MUX_MODE3) /* spi1_sclk */
+ AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE3) /* spi1_d0 */
+ AM33XX_IOPAD(0x998, PIN_INPUT_PULLUP | MUX_MODE3) /* spi1_d1 */
+ AM33XX_IOPAD(0x99C, PIN_OUTPUT_PULLUP | MUX_MODE3) /* spi1_cs0 */
+ >;
+ };
+
};
+&spi1 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi1_pins>;
+ spidev@0 {
+ spi-max-frequency = <48000000>;
+ reg = <0>;
+ compatible = "linux,spidev";
+ };
+};
+
+
Questions:
1. I suspect there are mistakes in the device tree. What is the proper way to do it? Why?
2. Is the patch in spidev.c also correct?
Thank you!
