Re: [PATCH v8 1/3] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)

2018-08-09 Thread Angelo Dureghello
Hi Stefan,

i am about to post a v9 in short.

On Tue, Aug 07, 2018 at 07:47:19PM +0200, Stefan Agner wrote:
> On 07.08.2018 14:14, Krzysztof Kozlowski wrote:
> > On 7 August 2018 at 10:08, Stefan Agner  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 
> >>> ---
> >>> 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 ..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  
> >>> +
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +
> >>> +#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.
> 
> Hm, oh I see, I got that wrong.
> 
> We could use
> fsl-edma-all-y = fsl-edma.o fsl-edma-common.o
> obj-$(CONFIG_FSL_EDMA) += fsl-edma-all.o
> mcf-edma-all-y = mcf-edma.o fsl-edma-common.o
> obj-$(CONFIG_MCF_EDMA) += mcf-edma-all.o
> 
> to create two modules but that duplicates some code. It probably
> wouldn't matter in practise since the two IPs are used on different
> architecture...
> 
> However, if we stay with the three modules approach, we should introduce
> a hidden config symbol, e.g.
> 
> config FSL_EDMA_COMMON
>   tristate
> 
> In FSL_EDMA/MCF_EDMA use
>   select FSL_EDMA_COMMON
> 
> And in the Makefile
> obj-$(CONFIG_FSL_EDMA_COMMON) += fsl-edma-common.o
> obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
> obj-$(CONFIG_MCF_EDMA) += mcf-edma.o
> 
> 
There was already a discussion with Vinod and Geert on this, and i 
finally previously changed things in this way 

obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o

The idea was to simplify things avoiding to use an additional
config symbol, as i did initially. It's a common pattern in 
several 

Re: [PATCH 2/4] m68k: Replace NR_syscalls macro from asm/unistd.h

2018-08-09 Thread Geert Uytterhoeven
Hi Firoz,

One first comment below...

On Thu, Aug 9, 2018 at 7:16 AM Firoz Khan  wrote:
> NR_syscalls macro holds the number of system call exist in m68k
> architecture. This macro is currently the part of asm/unistd.h file.
> We have to change the value of NR_syscalls, if we add or delete a
> system call.
>
> One of patch in this patch series has a script which will generate
> a uapi header based on syscall.tbl file. The syscall.tbl file
> contains the number of system call information. So we have two
> option to update NR_syscalls value.
>
> 1. Update NR_syscalls in asm/unistd.h manually by counting the
>no.of system calls. No need to update NR_syscalls untill
>we either add a new system call or delete an existing system
>call.
>
> 2. We can keep this feature it above mentioned script, that'll
>count the number of syscalls and keep it in a generated file.
>In this case we don't need to explicitly update NR_syscalls
>in asm/unistd.h file.
>
> The 2nd option will be the recommended one. For that, I moved the
> NR_syscalls macro from asm/unistd.h to uapi/asm/unistd.h. The macro
> name also changed form NR_syscalls to __NR_syscalls for making the
> name convention same across all architecture. While __NR_syscalls
> isn't strictly part of the uapi, having it as part of the generated
> header to simplifies the implementation.

It can indeed not be part of the UAPI, as UAPI definitions can never change,
while new syscalls will be added in the future, increasing the number ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] m68k: Added system call table generation support

2018-08-09 Thread Andreas Schwab
On Aug 09 2018, Firoz Khan  wrote:

> +_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
> +   $(shell [ -d '$(out)' ] || mkdir -p '$(out)')

mkdir -p is a no-op if the directory exits.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html