[U-Boot] [PATCH] spi: xilinx_spi: Add support for Quad mode

Jagan Teki jagannadh.teki at gmail.com
Wed Jul 27 09:44:14 CEST 2016


On 27 July 2016 at 12:54, Siva Durga Prasad Paladugu
<siva.durga.paladugu at xilinx.com> wrote:
> Hi Jagan,
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagannadh.teki at gmail.com]
>> Sent: Tuesday, July 26, 2016 11:16 AM
>> To: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
>> Cc: u-boot at lists.denx.de; Michal Simek <michals at xilinx.com>; Siva Durga
>> Prasad Paladugu <sivadur at xilinx.com>; Michal Simek <michals at xilinx.com>
>> Subject: Re: [PATCH] spi: xilinx_spi: Add support for Quad mode
>>
>> On 26 July 2016 at 10:44, Siva Durga Prasad Paladugu
>> <siva.durga.paladugu at xilinx.com> wrote:
>> > From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
>> >
>> > Add Quad mode support for xilinx spi driver Inform the spi framework
>> > about quad mode capability by reading it from devicetree.
>> >
>> > Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
>> > Signed-off-by: Michal Simek <michal.simek at xilinx.com>
>> > ---
>> >  drivers/spi/xilinx_spi.c | 21 +++++++++++++++++++++
>> >  1 file changed, 21 insertions(+)
>> >
>> > diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index
>> > a951a77..3e01c66 100644
>> > --- a/drivers/spi/xilinx_spi.c
>> > +++ b/drivers/spi/xilinx_spi.c
>> > @@ -21,6 +21,8 @@
>> >  #include <spi.h>
>> >  #include <asm/io.h>
>> >
>> > +DECLARE_GLOBAL_DATA_PTR;
>> > +
>> >  /*
>> >   * [0]: http://www.xilinx.com/support/documentation
>> >   *
>> > @@ -82,6 +84,8 @@
>> >  #define CONFIG_SYS_XILINX_SPI_LIST     { CONFIG_SYS_SPI_BASE }
>> >  #endif
>> >
>> > +#define XILINX_SPI_QUAD_MODE   2
>> > +
>> >  /* xilinx spi register set */
>> >  struct xilinx_spi_regs {
>> >         u32 __space0__[7];
>> > @@ -109,6 +113,22 @@ struct xilinx_spi_priv {  };
>> >
>> >  static unsigned long xilinx_spi_base_list[] =
>> > CONFIG_SYS_XILINX_SPI_LIST;
>> > +
>> > +static int xilinx_spi_child_pre_probe(struct udevice *bus) {
>> > +       struct spi_slave *slave = dev_get_parent_priv(bus);
>> > +       struct udevice *dev = dev_get_parent(bus);
>> > +       int spimode;
>> > +
>> > +       spimode = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "xlnx,spi-mode",
>> > +                                -1);
>> > +
>> > +       if (spimode == XILINX_SPI_QUAD_MODE)
>> > +               slave->op_mode_rx = SPI_OPM_RX_QOF;
>>
>> This is wrong, use platdata in spi-uclass that in-turn detect the mode from dt and
>> SPI_OPM_RX_QOF is never exit.
> Do you mean to fill mode_rx of dm_spi_slave_platdata from device tree in xilinx_spi_ofdata_to_platdata(this will be defined in xilinx_spi.c).
> The ofdata_to_platdata is anyway required in xilinx_spi.c to get the regs address frequency.(this is with reference to your comment on other two recent patches).
> Please let me know if anything else is required.

If you add spi-rx-bus-width = <4>; on dt the core will detect quad
read, no need to add RX_QUAD assignment on driver.

-- 
Jagan.


More information about the U-Boot mailing list