1

I'm trying to unbind SPIDEV from a specific chip-select so I can bind a specific driver to a device on that chip-select instead (without rmmod'ing SPIDEV completely).

I have a board with an AM335X processor, booting a mainline kernel (+Renesas DT overlay configfs patch) with a custom device-tree.

I have SPIDEV built into the kernel to allow some user-space SPI drivers to operate, however I'd like to use a kernel driver for some other devices on the bus.

For now I'm testing (to validate the hardware configuration) on a Beaglebone Green.

  1. Is it possible to have SPIDEV for some chip-selects on a bus while using kernel drivers for other chip-selects?

  2. How would I unbind SPIDEV via a device-tree overlay?

I've been testing the hardware config for now on a somewhat cheaper Beaglebone Green before I eventually move to the custom board.

My base device-tree defines the SPI nodes as: [applied after including the am33xx-bone / bonegreen dts]

&spi1 {
        status = "okay";
        channel@0 {
                #address-cells = <1>;
                #size-cells = <0>;

                compatible = "ti,omap24xx-spi";

                reg = <0>;
                spi-max-frequency = <16000000>;
                spi-cpha;
        };
        channel@1 {
                #address-cells = <1>;
                #size-cells = <0>;

                compatible = "ti,omap24xx-spi";

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

I've been testing with an Adafruit BMP280 board for now, using the following DT overlay:

/dts-v1/;

/plugin/;

/ {
        compatible = "ti,am335x-bone-green", "ti,am335x-bone", "ti,am33xx";

        fragment@0 {
                target-path = "/ocp/spi0/channel@0";

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

                        status = "disabled";
                };
        };

        fragment@1 {
                target = <&spi0>;

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

                        bmp280_spi: bmp280@0 {
                                compatible = "bosch,bmp280", "bosch,bme280";
                                reg = <0>;
                                spi-max-frequency = <500000>;
                                default-oversampling = <1>;
                                status = "okay";
                        };
                };
        };
}; 

I also tried targetting spi0 and overlaying a /delete-node/' forchannel@0`, but both result in the SPI driver complaining about chip-select conflicts when trying to apply the overlay. This suggests to me that I haven't unbound SPIDEV from that chip-select properly.

Apologies if this is on the wrong site, but since Device Tree is OS/platform agnostic, this seemed like the best place.

  • 1
    Actually, this ties into the Linux kernel and SPIDEV driver quite a bit, perhaps a friendly mod would be able to migrate it to the Linux SE site for me? – Mark K Cowan Sep 19 '17 at 16:09

0 Answers0