linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Youlin Wang <wwx575822@notesmail.huawei.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Zhuangluan Su <suzhuangluan@hisilicon.com>,
	Ryan Grachek <ryan@edited.us>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" 
	<dmaengine@vger.kernel.org>, Tanglei Han <hantanglei@huawei.com>
Subject: Re: [PATCH 3/8 v4] dma: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware
Date: Wed, 23 Jan 2019 18:25:33 +0530	[thread overview]
Message-ID: <20190123125533.GP4635@vkoul-mobl> (raw)
In-Reply-To: <CALAqxLXauR4guYMtCYK-wnAqcZCkLY7-vWQ5U-knvHQt1twG4A@mail.gmail.com>

On 22-01-19, 15:48, John Stultz wrote:
> On Sun, Jan 20, 2019 at 3:12 AM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 16-01-19, 09:10, John Stultz wrote:
> > > From: Youlin Wang <wwx575822@notesmail.huawei.com>
> > >
> > > On the hi3660 hardware there are two (at least) DMA controllers,
> > > the DMA-P (Peripherial DMA) and the DMA-A (Audio DMA). The
> >                     ^^^
> > typo
> 
> Thanks so much for the review!
> 
> Fixed!
> 
> > > +
> > > +#define K3_FLAG_NOCLK  (1<<0)
> >
> > why not use BIT()
> >
> > space between two please
> 
> Fixed.
> 
> > > +static const struct k3dma_soc_data k3_v1_dma_data = {
> > > +     .flags = 0,
> > > +};
> >
> > So basically this is default right, do we need to set dma_data and not
> > assume default..
> 
> I'm not sure I fully understand you here. Basically I'm just creating
> a per-variant data structure. The k3_v1_dma_data isn't really the
> default, but is the first variant supported. There may be future
> variants that cause some new flag that the k3_v3_dma_data may need to
> set. But for now that variant doesn't have any flags set.

So my point was we can skip this and treat driver data NULL as default
i.e. no flags, no big deal though, saves you dummy k3_v1_dma_data.

> 
> 
> > > +
> > > +static const struct k3dma_soc_data asp_v1_dma_data = {
> > > +     .flags = K3_FLAG_NOCLK,
> > > +};
> > > +
> > >  static const struct of_device_id k3_pdma_dt_ids[] = {
> > > -     { .compatible = "hisilicon,k3-dma-1.0", },
> > > +     { .compatible = "hisilicon,k3-dma-1.0",
> > > +       .data = &k3_v1_dma_data
> > > +     },
> > > +     { .compatible = "hisilicon,hisi-pcm-asp-dma-1.0",
> > > +       .data = &asp_v1_dma_data
> > > +     },
> > >       {}
> > >  };
> > >  MODULE_DEVICE_TABLE(of, k3_pdma_dt_ids);
> > > @@ -810,6 +830,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> > >
> > >  static int k3_dma_probe(struct platform_device *op)
> > >  {
> > > +     const struct k3dma_soc_data *soc_data;
> > >       struct k3_dma_dev *d;
> > >       const struct of_device_id *of_id;
> > >       struct resource *iores;
> > > @@ -823,6 +844,10 @@ static int k3_dma_probe(struct platform_device *op)
> > >       if (!d)
> > >               return -ENOMEM;
> > >
> > > +     soc_data = device_get_match_data(&op->dev);
> > > +     if (!soc_data)
> > > +             return -EINVAL;
> >
> > So this is not optional, either ways fine by me :)
> 
> I think this way makes sense, but maybe I'm missing a better alternative?
> 
> Do let me know if there's an example you'd rather I follow.

To elaborate I was thinking of alternate scheme with:

        compatible = "hisilicon,k3-dma-1.0", NULL
        compatible = "hisilicon,hisi-pcm-asp-dma-1.0", .data = &asp_v1_dma_data

and

        soc_data = device_get_match_data(&op->dev);
        if (!soc_data) {
                /* no data so flags are null */
                dev_warn(... "no driver data specified, assuming  no flags\n"
                k3_dma->flags = 0;
        }

-- 
~Vinod

  reply	other threads:[~2019-01-23 12:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 17:10 [PATCH 0/8 v4] k3dma patches to add support for hi3660/HiKey960 John Stultz
2019-01-16 17:10 ` [PATCH 1/8 v4] Documentation: bindings: k3dma: Extend the k3dma driver binding to support hisi-asp John Stultz
2019-01-16 17:10 ` [PATCH 2/8 v4] Documentation: bindings: dma: Add binding for dma-channel-mask John Stultz
2019-01-17 17:08   ` Manivannan Sadhasivam
2019-01-17 17:43     ` John Stultz
2019-01-20 11:06       ` Vinod Koul
2019-01-22  1:13   ` Rob Herring
2019-01-16 17:10 ` [PATCH 3/8 v4] dma: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware John Stultz
2019-01-20 11:11   ` Vinod Koul
2019-01-22 23:48     ` John Stultz
2019-01-23 12:55       ` Vinod Koul [this message]
2019-01-24  4:32         ` John Stultz
2019-01-16 17:10 ` [PATCH 4/8 v4] dma: k3dma: Delete axi_config John Stultz
2019-01-16 17:10 ` [PATCH 5/8 v4] dma: k3dma: Add support for dma-channel-mask John Stultz
2019-01-17 17:14   ` Manivannan Sadhasivam
2019-01-23  0:27     ` John Stultz
2019-01-16 17:10 ` [PATCH 6/8 v4] arm64: dts: hi3660: Add dma to uart nodes John Stultz
2019-01-16 17:10 ` [PATCH 7/8 v4] arm64: dts: hi3660: Add hisi asp dma device John Stultz
2019-01-16 17:10 ` [PATCH 8/8 v4] arm64: dts: hi3660: Fixup unofficial dma-min-chan to dma-channel-mask John Stultz

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=20190123125533.GP4635@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=hantanglei@huawei.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=ryan@edited.us \
    --cc=suzhuangluan@hisilicon.com \
    --cc=wwx575822@notesmail.huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).