From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 30 Oct 2014 05:38:21 +0100 Subject: [U-Boot] [PATCH v4 05/29] dm: spi: Add a uclass for SPI In-Reply-To: References: <1413265336-9571-1-git-send-email-sjg@chromium.org> <1413265336-9571-6-git-send-email-sjg@chromium.org> <5450E573.50705@denx.de> Message-ID: <5451C0BD.2020401@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. >> >> >> >>> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c >> >> >> >>> +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... > Also see the SPI driver spi-howto.txt. Thanks, Stefan