[PATCH v4] amba: consolidate PrimeCell magic

Boojin Kim boojin.kim at samsung.com
Mon Aug 22 07:57:51 EDT 2011


Linus Walleij wrote:
> >> From: Linus Walleij <linus.walleij at linaro.org>
>
> >> Since two drivers use the PrimeCell scheme without using the
> >> amba_bus driver logic, let's break the magic lookups out as
> >> static inlines in the <linux/amba/bus.h> header so we get
> >> some consolidation anyway. Delete the primecell ID check in
> >> common/pl330.c since it is only used from the amba_bus driver
> >> in drivers/dma, which is already doing the same check when
> >> probing in drivers/amba/bus.c.
> >
> > I think PCELL_SIZE definition is missed.
> > V1 had the definition of 'PCELL_SIZE' as following. But, it was gone
> from
> > V2.
> > +/* Used as end offset to retrieve PrimeCell ID registers */
> > +#define PCELL_SIZE     0x1000
>
> I must have slipped something :-(
>
> I fixed it by simply switching PCELL_SIZE to SZ_4K in the patch
> like this:
> -       pi->pcfg.periph_id = get_id(pi, PERIPH_ID);
> -       pi->pcfg.pcell_id = get_id(pi, PCELL_ID);
> +       pi->pcfg.periph_id = amba_get_pid(pi->base, SZ_4K);
> +       pi->pcfg.pcell_id = amba_get_cid(pi->base, SZ_4K);
>
> Which defconfig shall I use to regressiontest this actually?
> I was trying to locate one but failed.
>
> I'll update the patch in the patch tracker too.
>
> Yours,
> Linus Walleij

I used 'exynos4_defconfig'. And then enables 'Device Drivers-> DMA Engine
support -> DMA API Driver for PL330' option and modify code as below.

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 2e3b3d3..763e846 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -193,6 +193,7 @@ config ARCH_HAS_ASYNC_TX_FIND_CHANNEL
 config PL330_DMA
 	tristate "DMA API Driver for PL330"
 	select DMA_ENGINE
+	select ARM_AMBA
 	depends on PL330
 	help
 	  Select if your platform has one or more PL330 DMACs.
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 00eee59..fcad90c 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/pl330.h>
+#include <linux/scatterlist.h>

 #define NR_DEFAULT_DESC	16

Thanks
Boojin





More information about the linux-arm-kernel mailing list