[U-Boot] dm-spi: spi_chip_select value
Jagan Teki
jteki at openedev.com
Fri Jun 26 21:07:10 CEST 2015
Hi Simon,
On 26 June 2015 at 21:23, Simon Glass <sjg at chromium.org> wrote:
> Hi Jagan,
>
> On 23 June 2015 at 15:03, Jagan Teki <jteki at openedev.com> wrote:
>> Hi Simon,
>>
>> I'm calling spi_chip_select(bus) from set_speed or claim_bus
>> to get the cs value from sf probe.
>>
>> Seems like it returns the maximum number as 254, when I debug
>> further seems like slave_platdata returns NULL
>>
>> int spi_chip_select(struct udevice *dev)
>> {
>> struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
>> / * this plat data returns NULL */
>>
>> return plat ? plat->cs : -ENOENT;
>> }
>>
>
> /**
> * spi_chip_select() - Get the chip select for a slave
> *
> * @return the chip select this slave is attached to
> */
> int spi_chip_select(struct udevice *slave);
>
> This function takes a slave device as a parameter, not a bus. Are you
> passing it a bus?
So as it's a struct udevice - I have passed it from probe and store my cs.
Seems like if you get the cs only if we call it from spi_xfer as it's slave
is it right?
>
>> log:
>> zynq-uboot> sf probe 1:0
>> zynq_spi_ofdata_to_platdata: regs=e0007000 max-frequency=166666700
>> zynq_spi_set_speed: cs 254
>> zynq_spi_set_speed: regs=e0007000, mode=1000000
>> zynq_spi_set_mode: regs=e0007000, mode=3
>> zynq_spi_claim_bus: cs 254
>> spi_xfer: bus:1 cs:254 bitlen:8 len:1 flags:1
>> spi_xfer: Timeout! TX FIFO not full
>> SF: Failed to get idcodes
>> Failed to initialize SPI flash at 1:0 (error -1)
thanks!
--
Jagan | openedev.
More information about the U-Boot
mailing list