diff mbox

ARM: S5P64X0: Add the devname for DMA clock

Message ID 1313649828-27642-1-git-send-email-boojin.kim@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

boojin.kim Aug. 18, 2011, 6:43 a.m. UTC
This patch adds devname for DMA clock.
NOTE: This patch should be added after merging new pl330 driver on dmaengine.

Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
---
 arch/arm/mach-s5p64x0/clock-s5p6440.c |    1 +
 arch/arm/mach-s5p64x0/clock-s5p6450.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

Comments

Kim Kukjin Aug. 19, 2011, 5:24 a.m. UTC | #1
Boojin Kim wrote:
> 
> This patch adds devname for DMA clock.
> NOTE: This patch should be added after merging new pl330 driver on
dmaengine.
> 
> Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
> ---
>  arch/arm/mach-s5p64x0/clock-s5p6440.c |    1 +
>  arch/arm/mach-s5p64x0/clock-s5p6450.c |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-
> s5p64x0/clock-s5p6440.c
> index c1f548f..c54c65d 100644
> --- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
> +++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
> @@ -147,6 +147,7 @@ static struct clk init_clocks_off[] = {
>  		.ctrlbit	= (1 << 8),
>  	}, {
>  		.name		= "dma",
> +		.devname	= "dma-pl330",
>  		.parent		= &clk_hclk_low.clk,
>  		.enable		= s5p64x0_hclk0_ctrl,
>  		.ctrlbit	= (1 << 12),
> diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-
> s5p64x0/clock-s5p6450.c
> index 3d9b609..2d04abf 100644
> --- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
> +++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
> @@ -180,6 +180,7 @@ static struct clk init_clocks_off[] = {
>  		.ctrlbit	= (1 << 3),
>  	}, {
>  		.name		= "dma",
> +		.devname	= "dma-pl330",
>  		.parent		= &clk_hclk_low.clk,
>  		.enable		= s5p64x0_hclk0_ctrl,
>  		.ctrlbit	= (1 << 12),
> --
> 1.7.1

OK, will apply.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
boojin.kim Aug. 22, 2011, 4:41 a.m. UTC | #2
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.
>
> Cc: Kukjin Kim <kgene.kim at samsung.com>
> Cc: Viresh Kumar <viresh.kumar at st.com>
> Acked-by: H Hartley Sweeten <hartleys at visionengravers.com>
> Acked-by: Jassi Brar <jassisinghbrar at gmail.com>
> Acked-by: Boojin Kim <boojin.kim at samsung.com>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> Changes V3->v4:
> - Fix up sparse warning due to inelegant cast to (u32) in vic.c,
>   we cast to (unsigned long) and sparse is happy.
> ---
>  arch/arm/common/pl330.c      |   40
> +++-------------------------------------
>  arch/arm/common/vic.c        |   15 ++++++++-------
>  drivers/amba/bus.c           |   19 +++----------------
>  drivers/dma/ste_dma40.c      |   14 ++++----------
>  drivers/mtd/nand/fsmc_nand.c |   10 +++-------
>  include/linux/amba/bus.h     |   26 ++++++++++++++++++++++++++
>  6 files changed, 47 insertions(+), 77 deletions(-)
>
> diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
> index 97912fa..623ce74 100644
> --- a/arch/arm/common/pl330.c
> +++ b/arch/arm/common/pl330.c
> @@ -27,6 +27,7 @@
>  #include <linux/delay.h>
>  #include <linux/interrupt.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/amba/bus.h>
>
>  #include <asm/hardware/pl330.h>
>
> @@ -111,9 +112,6 @@
>  #define CR4		0xe10
>  #define CRD		0xe14
>
> -#define PERIPH_ID	0xfe0
> -#define PCELL_ID	0xff0
> -
>  #define CR0_PERIPH_REQ_SET	(1 << 0)
>  #define CR0_BOOT_EN_SET		(1 << 1)
>  #define CR0_BOOT_MAN_NS		(1 << 2)
> @@ -142,14 +140,6 @@
>  #define CRD_DATA_BUFF_SHIFT	20
>  #define CRD_DATA_BUFF_MASK	0x3ff
>
> -#define	PART		0x330
> -#define DESIGNER	0x41
> -#define REVISION	0x0
> -#define INTEG_CFG	0x0
> -#define PERIPH_ID_VAL	((PART << 0) | (DESIGNER << 12))
> -
> -#define PCELL_ID_VAL	0xb105f00d
> -
>  #define PL330_STATE_STOPPED		(1 << 0)
>  #define PL330_STATE_EXECUTING		(1 << 1)
>  #define PL330_STATE_WFE			(1 << 2)
> @@ -372,19 +362,6 @@ static inline bool _manager_ns(struct
> pl330_thread
> *thrd)
>  	return (pl330->pinfo->pcfg.mode & DMAC_MODE_NS) ? true : false;
>  }
>
> -static inline u32 get_id(struct pl330_info *pi, u32 off)
> -{
> -	void __iomem *regs = pi->base;
> -	u32 id = 0;
> -
> -	id |= (readb(regs + off + 0x0) << 0);
> -	id |= (readb(regs + off + 0x4) << 8);
> -	id |= (readb(regs + off + 0x8) << 16);
> -	id |= (readb(regs + off + 0xc) << 24);
> -
> -	return id;
> -}
> -
>  static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[],
>  		enum pl330_dst da, u16 val)
>  {
> @@ -1747,8 +1724,8 @@ static void read_dmac_config(struct pl330_info
> *pi)
>
>  	pi->pcfg.irq_ns = readl(regs + CR3);
>
> -	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, PCELL_SIZE);
> +	pi->pcfg.pcell_id = amba_get_cid(pi->base, PCELL_SIZE);
>  }
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

Thanks
Boojin
Linus Walleij Aug. 22, 2011, 7:11 a.m. UTC | #3
On Mon, Aug 22, 2011 at 6:41 AM, Boojin Kim <boojin.kim@samsung.com> 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
Linus Walleij Aug. 22, 2011, 12:20 p.m. UTC | #4
2011/8/22 Boojin Kim <boojin.kim@samsung.com>:

> 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!

This looks like a separate patch to activate the DMA driver,
this should probably go into -rc.

Linus Walleij
diff mbox

Patch

diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index c1f548f..c54c65d 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -147,6 +147,7 @@  static struct clk init_clocks_off[] = {
 		.ctrlbit	= (1 << 8),
 	}, {
 		.name		= "dma",
+		.devname	= "dma-pl330",
 		.parent		= &clk_hclk_low.clk,
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 12),
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index 3d9b609..2d04abf 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -180,6 +180,7 @@  static struct clk init_clocks_off[] = {
 		.ctrlbit	= (1 << 3),
 	}, {
 		.name		= "dma",
+		.devname	= "dma-pl330",
 		.parent		= &clk_hclk_low.clk,
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 12),