
Hi Stefan,
On 29 October 2014 22:38, Stefan Roese sr@denx.de wrote:
Hi Simon,
On 30.10.2014 02:43, Simon Glass wrote:
In my case I'm implementing the Designware master SPI driver for the SoCFPGA. And since its a new driver it really makes sense to use DM directly. I'm starting to get an overview now. One thing though that I noticed is, that the SPI DM implementation seems to be a bit FDT centric. Please see below.
<snip>
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
<snip>
+int spi_post_bind(struct udevice *dev) +{
/* Scan the bus for devices */
return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset,
false); +}
SoCFPGA currently does not support CONFIG_OF_CONTROL (no dtb supplied). So
In the kernel I see these files - are you sure it is not supported?
arch/arm/boot/dts/socfpga_arria5.dtsi arch/arm/boot/dts/socfpga_arria5_socdk.dts arch/arm/boot/dts/socfpga_cyclone5.dtsi arch/arm/boot/dts/socfpga_cyclone5_socdk.dts arch/arm/boot/dts/socfpga_cyclone5_sockit.dts arch/arm/boot/dts/socfpga_cyclone5_socrates.dts arch/arm/boot/dts/socfpga.dtsi arch/arm/boot/dts/socfpga_vt.dts
Sure. In the kernel dts is supported. Only U-Boot for SoCFPGA has no DT support (right now).
I'm planning to use platform_data to instantiate the device. Something like this in the board file:
static const struct dw_spi_platdata spi_platdata = { .base = SOCFPGA_SPIM0_ADDRESS, };
U_BOOT_DEVICE(dw_spi) = { .name = "dw_spi", .platdata = &spi_platdata, };
What would the non-fdt method have to be to bind the device in spi_post_bind() above?
We would have to create a new platform data structure that holds the bus number, CS number and any other information. Then it will need to cause spi_get_bus_and_cs() to locate it and do the right.
But first let's make sure that you really do have the platform that doesn't use device tree... If it is ARM my understanding is that it should.
It does. In the kernel. I think I'll dive into adding DT support for SoCFPGA for a few hours. Perhaps thats even easier than adding platform-data support to the SPI DM. Lets see how this goes...
Good luck. If you use CONFIG_OF_SEPARATE you will get u-boot-dtb.bin and hopefully it will just work. For CONFIG_OF_EMBED I see a bug was introduced so I need to do a patch for that.
Also see the SPI driver spi-howto.txt.
Thanks, Stefan
Regards, Simon