SPI child devices reg property misused?

EXTERNAL Lange Matthias (AA-DGW/ENG1) Matthias.Lange at beissbarth.com
Fri Aug 28 02:53:22 EST 2009


I have a custom spi device connected to a Xilinx spi controller. To map the register space of the controller a reg property is defined in the device tree. Because my custom device also has register space which I want to map in my driver, I also defined a reg property. Because things weren't running smooth I started debugging and found in of_spi.c in the function

void of_register_spi_devices(struct spi_master *master, struct device_node *np)

the following piece of code (2.6.31)

/* Device address */
prop = of_get_property(nc, "reg", &len);
if (!prop || len < sizeof(*prop)) {
        dev_err(&master->dev, "%s has no 'reg' property\n",

spi->chip_select = *prop;

Why does the reg property value of spi child devices is assigned to the chip_select? Is there another way for spi devices to propagate their register space?

The related device tree snippet is as follows

xps-spi at 83440000 {
        compatible = "xlnx,xps-spi-2.00.b";
        interrupt-parent = <&int_ctrl>;
        interrupts = < 1 2 >;
        reg = < 0x83440000 0x10000 >;
        xlnx,family = "virtex4";
        xlnx,fifo-exist = <0x0>;
        xlnx,num-offchip-ss-bits = <0x0>;
        xlnx,num-ss-bits = <0x1>;
        xlnx,sck-ratio = <0x40>;
        #address-cells = <1>;
        #size-cells = <1>;
        device at 0,0 {
                compatible = "beissbarth,orion_cam";
                reg = <0x48 0x8>;
                spi-max-frequency = <25000000>;
                interrupt-parent = <&int_ctrl>;
                interrupts = < 8 2 >;


More information about the Linuxppc-dev mailing list