SPI child devices reg property misused?
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) <hidden>
Date: 2009-08-27 16:53:28
Hi,
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 t=
ree. Because my custom device also has register space which I want to map i=
n 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 =3D of_get_property(nc, "reg", &len);
if (!prop || len < sizeof(*prop)) {
dev_err(&master->dev, "%s has no 'reg' property\n",
nc->full_name);
spi_dev_put(spi);
continue;
}
spi->chip_select =3D *prop;
Why does the reg property value of spi child devices is assigned to the chi=
p_select? Is there another way for spi devices to propagate their register =
space?
The related device tree snippet is as follows
xps-spi@83440000 {
compatible =3D "xlnx,xps-spi-2.00.b";
interrupt-parent =3D <&int_ctrl>;
interrupts =3D < 1 2 >;
reg =3D < 0x83440000 0x10000 >;
xlnx,family =3D "virtex4";
xlnx,fifo-exist =3D <0x0>;
xlnx,num-offchip-ss-bits =3D <0x0>;
xlnx,num-ss-bits =3D <0x1>;
xlnx,sck-ratio =3D <0x40>;
#address-cells =3D <1>;
#size-cells =3D <1>;
device@0,0 {
compatible =3D "beissbarth,orion_cam";
reg =3D <0x48 0x8>;
spi-max-frequency =3D <25000000>;
interrupt-parent =3D <&int_ctrl>;
interrupts =3D < 8 2 >;
};
};
Cheers,
Matthias.