U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] sf: ti_qspi: Enable EDMA for reads in SPL
Date: Fri, 16 Jan 2015 11:00:37 -0500	[thread overview]
Message-ID: <20150116160037.GF10826@bill-the-cat> (raw)
In-Reply-To: <20140714203736.GI1847@bill-the-cat>

On Mon, Jul 14, 2014 at 04:37:36PM -0400, Tom Rini wrote:
> On Sat, Jul 12, 2014 at 06:42:31PM +0530, Jagan Teki wrote:
> > On Sat, Jul 12, 2014 at 2:23 AM, Tom Rini <trini@ti.com> wrote:
> > > From: Vinothkumar Rajendran <vinothr@ti.com>
> > >
> > > By default QSPI data through-put in memory mapped mode is ~2.4MB/sec @
> > > 48MHz. Added edma memory copy functionality in spi flash driver to
> > > improve the data through put to 5.1MB/Sec.
> [snip]
> > > +#include <asm/arch/edma.h>
> > > +#include "../dma/ti_edma.h"
> > 
> > This looks odd to me - header inclusion, as .h in drivers even.
> 
> I could shove this under arch/arm/include/asm/ti-common I suppose.
> 
> > >
> > >  /* ti qpsi register bit masks */
> > >  #define QSPI_TIMEOUT                    2000000
> > > @@ -340,3 +342,72 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
> > >
> > >         return 0;
> > >  }
> > > +
> > > +#if defined(CONFIG_SPL_DMA_SUPPORT) && defined(CONFIG_TI_EDMA)
> > > +void spi_flash_copy_mmap(void *data, void *offset, size_t len)
> > > +{
> > > +       struct edma_param_entry edma_param;
> > > +       int           b_cnt_value = 1;
> > > +       int           rem_bytes  = 0;
> > > +       int           a_cnt_value = len;
> > > +       unsigned int          addr      = (unsigned int) (data);
> > > +       unsigned int          max_acnt  = 0x7FFFU;
> > > +       unsigned int edma_ch_num = 1;
> > > +
> > > +       if (len > max_acnt)
> > > +       {
> > > +               b_cnt_value = (len / max_acnt);
> > > +               rem_bytes  = (len % max_acnt);
> > > +               a_cnt_value = max_acnt;
> > > +       }
> > > +
> > > +       /* Compute QSPI address and size */
> > > +       edma_param.opt      = 0;
> > > +       edma_param.src_addr  = ((unsigned int) offset);
> > > +       edma_param.dest_addr = addr;
> > > +       edma_param.a_cnt     = a_cnt_value;
> > > +       edma_param.b_cnt     = b_cnt_value;
> > > +       edma_param.c_cnt     = 1;
> > > +       edma_param.src_bidx  = a_cnt_value;
> > > +       edma_param.dest_bidx = a_cnt_value;
> > > +       edma_param.src_cidx  = 0;
> > > +       edma_param.dest_cidx = 0;
> > > +       edma_param.link_addr = 0xFFFF;
> > > +       edma_param.opt     |=
> > > +               (EDMA_TPCC_OPT_TCINTEN_MASK |
> > > +                ((edma_ch_num <<
> > > +                  EDMA_TPCC_OPT_TCC_SHIFT) &
> > > +                 EDMA_TPCC_OPT_TCC_MASK) | EDMA_TPCC_OPT_SYNCDIM_MASK);
> > > +
> > > +       edma_set_param(edma_ch_num, &edma_param);
> > > +       edma_enable_transfer(edma_ch_num);
> > > +
> > > +       while (!(edma_get_intr_status() & (1 << edma_ch_num))) ;
> > > +       edma_clr_intr(edma_ch_num);
> > > +       if (rem_bytes != 0)
> > > +       {
> > > +               /* Compute QSPI address and size */
> > > +               edma_param.opt     = 0;
> > > +               edma_param.src_addr =
> > > +                       (b_cnt_value * max_acnt) + ((unsigned int) offset);
> > > +               edma_param.dest_addr = (addr + (max_acnt * b_cnt_value));
> > > +               edma_param.a_cnt     = rem_bytes;
> > > +               edma_param.b_cnt     = 1;
> > > +               edma_param.c_cnt     = 1;
> > > +               edma_param.src_bidx  = rem_bytes;
> > > +               edma_param.dest_bidx = rem_bytes;
> > > +               edma_param.src_cidx  = 0;
> > > +               edma_param.dest_cidx = 0;
> > > +               edma_param.link_addr = 0xFFFF;
> > > +               edma_param.opt     |=
> > > +                       (EDMA_TPCC_OPT_TCINTEN_MASK |
> > > +                        ((edma_ch_num << EDMA_TPCC_OPT_TCC_SHIFT) & EDMA_TPCC_OPT_TCC_MASK));
> > > +               edma_set_param(edma_ch_num, &edma_param);
> > > +               edma_enable_transfer(edma_ch_num);
> > > +
> > > +               while (!(edma_get_intr_status() & (1 << edma_ch_num))) ;
> > > +               edma_clr_intr(edma_ch_num);
> > > +       }
> > > +       *((unsigned int *) offset) += len;
> > > +}
> > > +#endif
> > 
> > I'm some how !OK with this memory or flash change in spi driver.
> > Any better approach to move this - may be in DMA driver itself and
> > picking up the
> > memory attributes from sf layer.
> > 
> > I'm not much clear about this now, but will come back again.
> 
> Well, are you happy with how drivers/spi/mxs_spi.c works (search around
> on mxs_dma)?  I can re-jigger things along those lines I suppose.

Ping?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150116/2ef03682/attachment.pgp>

  reply	other threads:[~2015-01-16 16:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 20:53 [U-Boot] [PATCH 1/3] sf: ops: Add spi_flash_copy_mmap function Tom Rini
2014-07-11 20:53 ` [U-Boot] [PATCH 2/3] dma: Add TI EDMA driver Tom Rini
2014-07-11 20:53 ` [U-Boot] [PATCH 3/3] sf: ti_qspi: Enable EDMA for reads in SPL Tom Rini
2014-07-12 13:12   ` Jagan Teki
2014-07-14 20:37     ` Tom Rini
2015-01-16 16:00       ` Tom Rini [this message]
2015-04-22 11:15       ` Jagan Teki
2015-04-22 14:25         ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150116160037.GF10826@bill-the-cat \
    --to=trini@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox