[U-Boot] [PATCH 1/2] spi: ti_qspi: use 128 bit transfer mode when writing to flash

Vignesh R vigneshr at ti.com
Tue Sep 6 07:09:33 CEST 2016


Hi,

On Sunday 04 September 2016 07:51 PM, Jagan Teki wrote:
> On Thu, Sep 1, 2016 at 1:24 PM, Vignesh R <vigneshr at ti.com> wrote:
[...]
>> @@ -23,6 +23,8 @@ DECLARE_GLOBAL_DATA_PTR;
>>  #define QSPI_TIMEOUT                    2000000
>>  #define QSPI_FCLK                      192000000
>>  #define QSPI_DRA7XX_FCLK                76800000
>> +#define QSPI_WLEN_MAX_BITS             128
>> +#define QSPI_WLEN_MAX_BYTES            (QSPI_WLEN_MAX_BITS >> 3)
>>  /* clock control */
>>  #define QSPI_CLK_EN                     BIT(31)
>>  #define QSPI_CLK_DIV_MAX                0xffff
>> @@ -230,13 +232,33 @@ static int __ti_qspi_xfer(struct ti_qspi_priv *priv, unsigned int bitlen,
>>  #ifdef CONFIG_AM43XX
>>         udelay(100);
>>  #endif
>> -       while (words--) {
>> +       while (words) {
>> +               u8 xfer_len = 0;
>> +
>>                 if (txp) {
>> -                       debug("tx cmd %08x dc %08x data %02x\n",
>> -                             priv->cmd | QSPI_WR_SNGL, priv->dc, *txp);
>> -                       writel(*txp++, &priv->base->data);
>> -                       writel(priv->cmd | QSPI_WR_SNGL,
>> -                              &priv->base->cmd);
>> +                       u32 cmd = priv->cmd;
> 
> Don't we require cmd mask for WLEN_MAX_BITS?
> 

Its not quite necessary. priv->cmd always has WLEN field set to 0x7
(8bit) where as for 128bit write WLEN is to be set to 0x7F. Therefore
the logic

+				cmd |= QSPI_WLEN(QSPI_WLEN_MAX_BITS);

will still work w/o needing to clear WLEN field using a mask. But
anyways, to avoid confusion, I will add a mask for WLEN_MAX_BITS.

-- 
Regards
Vignesh


More information about the U-Boot mailing list