[U-Boot] [PATCH v2 1/2] spi: zynqmp_qspi: Add support for ZynqMP qspi driver

Jagan Teki jagannadh.teki at gmail.com
Tue May 8 05:57:05 UTC 2018


On Wed, May 2, 2018 at 2:49 PM, Siva Durga Prasad Paladugu
<sivadur at xilinx.com> wrote:
> Hi,
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagan at amarulasolutions.com]
>> Sent: Wednesday, April 25, 2018 10:47 AM
>> To: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
>> Cc: U-Boot-Denx <u-boot at lists.denx.de>
>> Subject: Re: [U-Boot] [PATCH v2 1/2] spi: zynqmp_qspi: Add support for
>> ZynqMP qspi driver

[snip]

>> >>
>> >> > +
>> >> > +       plat->regs = (struct zynqmp_qspi_regs *)(devfdt_get_addr(bus) +
>> >> > +                                                ZYNQMP_GQSPI_REG_OFFSET);
>> >> > +       plat->dma_regs = (struct zynqmp_qspi_dma_regs *)
>> >> > +                         (devfdt_get_addr(bus) +
>> >> > + ZYNQMP_GQSPI_DMA_REG_OFFSET);
>> >> > +
>> >> > +       ret = clk_get_by_index(bus, 0, &clk);
>> >> > +       if (ret < 0) {
>> >> > +               dev_err(dev, "failed to get clock\n");
>> >> > +               return ret;
>> >> > +       }
>> >> > +
>> >> > +       clock = clk_get_rate(&clk);
>> >> > +       if (IS_ERR_VALUE(clock)) {
>> >> > +               dev_err(dev, "failed to get rate\n");
>> >> > +               return clock;
>> >> > +       }
>> >> > +       debug("%s: CLK %ld\n", __func__, clock);
>> >> > +
>> >> > +       ret = clk_enable(&clk);
>> >> > +       if (ret && ret != -ENOSYS) {
>> >> > +               dev_err(dev, "failed to enable clock\n");
>> >> > +               return ret;
>> >> > +       }
>> >> > +
>> >> > +       value = dev_read_u32_default(bus, "spi-rx-bus-width", 1);
>> >> > +       switch (value) {
>> >> > +       case 1:
>> >> > +               break;
>> >> > +       case 2:
>> >> > +               mode |= SPI_RX_DUAL;
>> >> > +               break;
>> >> > +       case 4:
>> >> > +               mode |= SPI_RX_QUAD;
>> >> > +               break;
>> >> > +       default:
>> >> > +               printf("Invalid spi-rx-bus-width %d\n", value);
>> >> > +               break;
>> >> > +       }
>> >> > +
>> >> > +       value = dev_read_u32_default(bus, "spi-tx-bus-width", 1);
>> >> > +       switch (value) {
>> >> > +       case 1:
>> >> > +               break;
>> >> > +       case 2:
>> >> > +               mode |= SPI_TX_DUAL;
>> >> > +               break;
>> >> > +       case 4:
>> >> > +               mode |= SPI_TX_QUAD;
>> >> > +               break;
>> >> > +       default:
>> >> > +               printf("Invalid spi-tx-bus-width %d\n", value);
>> >> > +               break;
>> >> > +       }
>> >> > +
>> >> > +       plat->tx_rx_mode = mode;
>> >> > +
>> >> > +       plat->frequency = clock;
>> >> > +       plat->speed_hz = plat->frequency;
>> >>
>> >> why we need this? all these are generic stuff which is available at
>> >> spi- uclass.c
>> >
>> > Somehow I am not able to get these from spi-uclass.c , the routine which
>> reads all these info from dt in spi-uclass.c is never getting invoked in my
>> flow.
>> > I checked other driver as well,. Do you have an idea on why is it so?
>>
>> All these attributes are from platdata which were initialized by spi-uclass.c
>> so if you need any of these we can get the dm_spi_slave_platdata from
>> your driver using dev_get_parent_platdata() function.
>
> Looks like you didn’t get my point, in my flow the routine spi_slave_ofdata_to_platdata() in spi-uclass.c is
> not getting invoked at all that’s why I am not getting this data from spi-uclass.c. do you have an idea on
> what could be the issue that spi_slave_ofdata_to_platdata() is not getting invoked.
> I will anyway debug it but, if you already encountered this and aware of any reason for this , please let me know, that really helps me.

Fix the rest and keep this as it is we will discuss on next version.

Jagan.


More information about the U-Boot mailing list