public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 5/6] drivers: dma: ti-edma3: convert driver to adopt driver model
Date: Fri, 12 Feb 2016 17:02:12 +0530	[thread overview]
Message-ID: <56BDC2BC.5040209@ti.com> (raw)
In-Reply-To: <CAD6G_RTsLG+1Pw0FACQiuwU7PFPn5rRFHs5rpvyRjA-GXeJ9Cg@mail.gmail.com>

On Friday 12 February 2016 02:54 PM, Jagan Teki wrote:
> On 27 January 2016 at 17:27, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> adopt ti-edma3 driver to device driver model
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> ---
>>  drivers/dma/ti-edma3.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 72 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c
>> index d6a427f..5a46442 100644
>> --- a/drivers/dma/ti-edma3.c
>> +++ b/drivers/dma/ti-edma3.c
>> @@ -11,6 +11,9 @@
>>
>>  #include <asm/io.h>
>>  #include <common.h>
>> +#include <dma.h>
>> +#include <dm/device.h>
>> +#include <asm/omap_common.h>
>>  #include <asm/ti-common/ti-edma3.h>
>>
>>  #define EDMA3_SL_BASE(slot)                    (0x4000 + ((slot) << 5))
>> @@ -31,6 +34,10 @@
>>  #define EDMA3_QEESR                            0x108c
>>  #define EDMA3_QSECR                            0x1094
>>
>> +struct ti_edma3_priv {
>> +       u32 base;
>> +};
>> +
>>  /**
>>   * qedma3_start - start qdma on a channel
>>   * @base: base address of edma
>> @@ -383,8 +390,8 @@ void qedma3_stop(u32 base, struct edma3_channel_config *cfg)
>>         __raw_writel(0, base + EDMA3_QCHMAP(cfg->chnum));
>>  }
>>
>> -void edma3_transfer(unsigned long edma3_base_addr, unsigned int
>> -                   edma_slot_num, void *dst, void *src, size_t len)
>> +void __edma3_transfer(unsigned long edma3_base_addr, unsigned int edma_slot_num,
>> +                     void *dst, void *src, size_t len)
>>  {
>>         struct edma3_slot_config        slot;
>>         struct edma3_channel_config     edma_channel;
>> @@ -460,3 +467,66 @@ void edma3_transfer(unsigned long edma3_base_addr, unsigned int
>>                 qedma3_stop(edma3_base_addr, &edma_channel);
>>         }
>>  }
>> +
>> +#ifndef CONFIG_DMA
>> +
>> +void edma3_transfer(unsigned long edma3_base_addr, unsigned int edma_slot_num,
>> +                   void *dst, void *src, size_t len)
>> +{
>> +       __edma3_transfer(edma3_base_addr, edma_slot_num, dst, src, len);
>> +}
>> +
>> +#else
>> +
>> +static int ti_edma3_transfer(struct udevice *dev, int direction, void *dst,
>> +                            void *src, size_t len)
>> +{
>> +       struct ti_edma3_priv *priv = dev_get_priv(dev);
>> +
>> +       /* enable edma3 clocks */
>> +       enable_edma3_clocks();
>> +
>> +       switch (direction) {
>> +       case DMA_MEM_TO_MEM:
>> +               __edma3_transfer(priv->base, 1, dst, src, len);
>> +               break;
>> +       default:
>> +               error("Transfer type not implemented in DMA driver\n");
>> +               break;
>> +       }
>> +
>> +       /* disable edma3 clocks */
>> +       disable_edma3_clocks();
>> +
>> +       return 0;
>> +}
>> +
>> +static int ti_edma3_ofdata_to_platdata(struct udevice *dev)
>> +{
>> +       struct ti_edma3_priv *priv = dev_get_priv(dev);
>> +       struct dma_dev_priv *uc_priv = dev_get_uclass_priv(dev);
>> +
>> +       priv->base = dev_get_addr(dev);
>> +       uc_priv->supported = DMA_SUPPORTS_MEM_TO_MEM;
>> +
> 
> Cant we do this stuff on .probe? usually .ofdata_to_platdata will
> interact with *_platdata structure instead of *_priv
> 

Will fix it in v4

Regards
Mugunthan V N

  reply	other threads:[~2016-02-12 11:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 11:57 [U-Boot] [PATCH v3 0/6] add dma uclass implementation and adopt ti-edma3 to it Mugunthan V N
2016-01-27 11:57 ` [U-Boot] [PATCH v3 1/6] dm: implement a DMA uclass Mugunthan V N
2016-01-27 22:53   ` Simon Glass
2016-01-28 11:36     ` Mugunthan V N
2016-01-29 18:23       ` Simon Glass
2016-01-27 11:57 ` [U-Boot] [PATCH v3 2/6] dma: Kconfig: Add TI_EDMA3 entry Mugunthan V N
2016-01-27 11:57 ` [U-Boot] [PATCH v3 3/6] sf: spi_flash: use dma to copy data from mmap region if platform supports Mugunthan V N
2016-01-27 11:57 ` [U-Boot] [PATCH v3 4/6] spi: ti_qspi: compile out spi_flash_copy_mmap when CONFIG_DMA is defined Mugunthan V N
2016-01-27 11:57 ` [U-Boot] [PATCH v3 5/6] drivers: dma: ti-edma3: convert driver to adopt driver model Mugunthan V N
2016-02-12  9:24   ` Jagan Teki
2016-02-12 11:32     ` Mugunthan V N [this message]
2016-01-27 11:57 ` [U-Boot] [PATCH v3 6/6] defconfig: am437x_sk_evm: enable dma " Mugunthan V N

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=56BDC2BC.5040209@ti.com \
    --to=mugunthanvnm@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