linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Stefan Agner <stefan@agner.ch>
Cc: dmaengine@vger.kernel.org, linux-m68k@vger.kernel.org,
	vinod.koul@linaro.org, linux-arm-kernel@lists.infradead.org,
	Angelo Dureghello <angelo@sysam.it>
Subject: Re: [PATCH v8 1/3] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)
Date: Tue, 7 Aug 2018 14:14:28 +0200	[thread overview]
Message-ID: <CAJKOXPchX3H9JVf1VyA+m9waLz74DnWRb2xLBg4yp=YbrEGu0Q@mail.gmail.com> (raw)
In-Reply-To: <326d1fd7010c34488af6a874011d5280@agner.ch>

On 7 August 2018 at 10:08, Stefan Agner <stefan@agner.ch> wrote:
> On 03.08.2018 21:32, Angelo Dureghello wrote:
>> This patch adds a new fsl-edma-common module to allow new
>> mcf-edma module code to use most of the fsl-edma code.
>>
>> Signed-off-by: Angelo Dureghello <angelo@sysam.it>
>> ---
>> Changes for v2:
>> - patch splitted into 4
>> - add mcf-edma as minimal different parts from fsl-edma
>>
>> Changes for v3:
>> none
>>
>> Changes for v4:
>> - patch simplified from 4/4 into 2/2
>> - collecting all the mcf-edma-related changes
>>
>> Changes for v5:
>> none
>>
>> Changes for v6:
>> - adjusted comment header
>> - fixed bit shift with BIT()
>> - we need to free the interrupts at remove(), so removed all devm_
>>   interrupt related calls
>>
>> Changes for v7:
>> none
>>
>> Changes for v8:
>> - patch rewritten from scratch, splitted into 3, common code isolated,
>>   minimal changes from the original Freescale code have been done.
>>   The patch has been tested with both Iris + Colibri Vybrid VF50 and
>>   stmark2/mcf54415 Coldfire boards.
>> ---
>>  drivers/dma/Makefile          |   2 +-
>>  drivers/dma/fsl-edma-common.c | 576 ++++++++++++++++++++++++++++
>>  drivers/dma/fsl-edma-common.h | 196 ++++++++++
>>  drivers/dma/fsl-edma.c        | 697 +---------------------------------
>>  4 files changed, 774 insertions(+), 697 deletions(-)
>>  create mode 100644 drivers/dma/fsl-edma-common.c
>>  create mode 100644 drivers/dma/fsl-edma-common.h
>>
>> diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
>> index 203a99d68315..66022f59fca4 100644
>> --- a/drivers/dma/Makefile
>> +++ b/drivers/dma/Makefile
>> @@ -31,7 +31,7 @@ obj-$(CONFIG_DW_AXI_DMAC) += dw-axi-dmac/
>>  obj-$(CONFIG_DW_DMAC_CORE) += dw/
>>  obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
>>  obj-$(CONFIG_FSL_DMA) += fsldma.o
>> -obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
>> +obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o
>>  obj-$(CONFIG_FSL_RAID) += fsl_raid.o
>>  obj-$(CONFIG_HSU_DMA) += hsu/
>>  obj-$(CONFIG_IMG_MDC_DMA) += img-mdc-dma.o
>> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
>> new file mode 100644
>> index 000000000000..0ae7094f477a
>> --- /dev/null
>> +++ b/drivers/dma/fsl-edma-common.c
>> @@ -0,0 +1,576 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +//
>> +// Copyright (c) 2013-2014 Freescale Semiconductor, Inc
>> +// Copyright (c) 2017 Sysam, Angelo Dureghello  <angelo@sysam.it>
>> +
>> +#include <linux/dmapool.h>
>> +#include <linux/module.h>
>> +#include <linux/slab.h>
>> +
>> +#include "fsl-edma-common.h"
>> +
>> +/*
>> + * R/W functions for big- or little-endian registers:
>> + * The eDMA controller's endian is independent of the CPU core's endian.
>> + * For the big-endian IP module, the offset for 8-bit or 16-bit registers
>> + * should also be swapped opposite to that in little-endian IP.
>> + */
>> +u32 edma_readl(struct fsl_edma_engine *edma, void __iomem *addr)
>> +{
>> +     if (edma->big_endian)
>> +             return ioread32be(addr);
>> +     else
>> +             return ioread32(addr);
>> +}
>> +EXPORT_SYMBOL_GPL(edma_readl);
>
> In 3/3 you link the common object into the two modules individually:
>
> obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o
> obj-$(CONFIG_MCF_EDMA) += mcf-edma.o fsl-edma-common.o
>
> Therefor you do not access those functions from another module (they are
> within the module). No exporting should be necessary. Drop all those
> exports.

The fsl-edma-common will be its own module so the exports are
necessary for proper linking/modpost.

Best regards,
Krzysztof

> If possible I would prefer if you start with cleanup/conversions, then
> split-up and finally add functionality.
>
> So ideally:
> 1. Use macros for preprocessor defines (where you move to BIT/GENMASK)
> 2. Split
> 3. Add EDMA macros etc.
> 4. Add ColdFire mcf5441x edma support
>

  reply	other threads:[~2018-08-07 12:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 19:32 [PATCH v8 1/3] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended) Angelo Dureghello
2018-08-03 19:32 ` [PATCH v8 2/3] dmaengine: fsl-edma: add edma version and configurable registers Angelo Dureghello
2018-08-06  7:59   ` Krzysztof Kozlowski
2018-08-06 20:31     ` Angelo Dureghello
2018-08-07  8:01   ` Stefan Agner
2018-08-03 19:32 ` [PATCH v8 3/3] dmaengine: fsl-edma: add ColdFire mcf5441x edma support Angelo Dureghello
2018-08-06  8:09   ` Krzysztof Kozlowski
2018-08-06 12:21     ` Stefan Agner
2018-08-06 20:23       ` Angelo Dureghello
2018-08-06 21:01     ` Angelo Dureghello
2018-08-06  7:43 ` [PATCH v8 1/3] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended) Krzysztof Kozlowski
2018-08-06 20:40   ` Angelo Dureghello
2018-08-07  6:02     ` Krzysztof Kozlowski
2018-08-07  8:08 ` Stefan Agner
2018-08-07 12:14   ` Krzysztof Kozlowski [this message]
2018-08-07 17:47     ` Stefan Agner
2018-08-09 22:37       ` Angelo Dureghello
2018-08-10  8:05         ` Stefan Agner
2018-08-10  8:43           ` Angelo Dureghello

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='CAJKOXPchX3H9JVf1VyA+m9waLz74DnWRb2xLBg4yp=YbrEGu0Q@mail.gmail.com' \
    --to=krzk@kernel.org \
    --cc=angelo@sysam.it \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=stefan@agner.ch \
    --cc=vinod.koul@linaro.org \
    /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).