RE: [PATCHv2 5/13] dmtimer: hwmod: OMAP: conversion to platform driver
Kevin, -Original Message- From: Kevin Hilman [mailto:khil...@deeprootsystems.com] Sent: Tuesday, August 24, 2010 4:59 AM To: DebBarma, Tarun Kanti Cc: linux-omap@vger.kernel.org; Gopinath, Thara; Basak, Partha; Nayak, Rajendra; Paul Walmsley; Tony Lindgren Subject: Re: [PATCHv2 5/13] dmtimer: hwmod: OMAP: conversion to platform driver Tarun Kanti DebBarma tarun.ka...@ti.com writes: From: Thara Gopinath th...@ti.com This essentially involves moving out interrupt and base address related info from plat-omap/dmtimer.c and making certain clock related functions platform data. This patch also initializes dmtimer driver as a earlydriver. This is to enable early timer devices required during system boot initialized early. no need for 'hwmod' in $SUBJECT Will change in the next posts! incorporated comments: (1) use list instead of array to manage timers (2) introduced appropriate cleanup in failure paths of probe function (3) made spinlock a static variable initialized at bootup so that it is available both during early init and later. (4) pm_runtime support (5) corrected un-even number of pm_runtime_enable() associated with early millisecond timers This patch needs to be broken up into more pieces. The conversion to platform_device should be patch on its own. The addition of runtime PM support followed by the addition of the new timer types should also be separate patches. Will organize better in the next posts! Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Thara Gopinath th...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Tony Lindgren t...@atomide.com --- arch/arm/plat-omap/dmtimer.c | 549 +- --- arch/arm/plat-omap/include/plat/dmtimer.h | 10 +- 2 files changed, 255 insertions(+), 304 deletions(-) mode change 100644 = 100755 arch/arm/plat-omap/dmtimer.c diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 44bafda..0915a37 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -10,6 +10,12 @@ * Copyright (C) 2009 Texas Instruments * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com * + * Copyright (C) 2010 Texas Instruments, Inc. + * Thara Gopinath th...@ti.com + * Tarun Kanti DebBarma tarun.ka...@ti.com + * - hwmod support + * - omap4 support + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your @@ -37,9 +43,13 @@ #include linux/delay.h #include linux/io.h #include linux/module.h +#include linux/slab.h #include mach/hardware.h +#include linux/pm_runtime.h #include plat/dmtimer.h +#include plat/omap_device.h #include mach/irqs.h +#include linux/interrupt.h /* register offsets */ #define _OMAP_TIMER_ID_OFFSET 0x00 @@ -151,144 +161,30 @@ (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR WPSHIFT)) struct omap_dm_timer { - unsigned long phys_base; + int id; + unsigned long fclk_rate; int irq; -#ifdef CONFIG_ARCH_OMAP2PLUS - struct clk *iclk, *fclk; -#endif void __iomem *io_base; unsigned reserved:1; unsigned enabled:1; unsigned posted:1; + unsigned is_initialized:1; + struct platform_device *pdev; + struct list_head node; }; -static int dm_timer_count; - -#ifdef CONFIG_ARCH_OMAP1 -static struct omap_dm_timer omap1_dm_timers[] = { - { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, - { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, - { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 }, - { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 }, - { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 }, - { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 }, - { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 }, - { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, -}; - -static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers); - -#else -#define omap1_dm_timersNULL -#define omap1_dm_timer_count 0 -#endif /* CONFIG_ARCH_OMAP1 */ - -#ifdef CONFIG_ARCH_OMAP2 -static struct omap_dm_timer omap2_dm_timers[] = { - { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, - { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, - { .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 }, - { .phys_base = 0x4807a000, .irq = INT_24XX_GPTIMER4 }, - { .phys_base = 0x4807c000, .irq = INT_24XX_GPTIMER5 }, - { .phys_base = 0x4807e000, .irq = INT_24XX_GPTIMER6 }, - { .phys_base = 0x4808, .irq
Re: [PATCHv2 5/13] dmtimer: hwmod: OMAP: conversion to platform driver
Tarun Kanti DebBarma tarun.ka...@ti.com writes: From: Thara Gopinath th...@ti.com This essentially involves moving out interrupt and base address related info from plat-omap/dmtimer.c and making certain clock related functions platform data. This patch also initializes dmtimer driver as a earlydriver. This is to enable early timer devices required during system boot initialized early. no need for 'hwmod' in $SUBJECT incorporated comments: (1) use list instead of array to manage timers (2) introduced appropriate cleanup in failure paths of probe function (3) made spinlock a static variable initialized at bootup so that it is available both during early init and later. (4) pm_runtime support (5) corrected un-even number of pm_runtime_enable() associated with early millisecond timers This patch needs to be broken up into more pieces. The conversion to platform_device should be patch on its own. The addition of runtime PM support followed by the addition of the new timer types should also be separate patches. Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Thara Gopinath th...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Tony Lindgren t...@atomide.com --- arch/arm/plat-omap/dmtimer.c | 549 + arch/arm/plat-omap/include/plat/dmtimer.h | 10 +- 2 files changed, 255 insertions(+), 304 deletions(-) mode change 100644 = 100755 arch/arm/plat-omap/dmtimer.c diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 44bafda..0915a37 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -10,6 +10,12 @@ * Copyright (C) 2009 Texas Instruments * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com * + * Copyright (C) 2010 Texas Instruments, Inc. + * Thara Gopinath th...@ti.com + * Tarun Kanti DebBarma tarun.ka...@ti.com + * - hwmod support + * - omap4 support + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your @@ -37,9 +43,13 @@ #include linux/delay.h #include linux/io.h #include linux/module.h +#include linux/slab.h #include mach/hardware.h +#include linux/pm_runtime.h #include plat/dmtimer.h +#include plat/omap_device.h #include mach/irqs.h +#include linux/interrupt.h /* register offsets */ #define _OMAP_TIMER_ID_OFFSET0x00 @@ -151,144 +161,30 @@ (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR WPSHIFT)) struct omap_dm_timer { - unsigned long phys_base; + int id; + unsigned long fclk_rate; int irq; -#ifdef CONFIG_ARCH_OMAP2PLUS - struct clk *iclk, *fclk; -#endif void __iomem *io_base; unsigned reserved:1; unsigned enabled:1; unsigned posted:1; + unsigned is_initialized:1; + struct platform_device *pdev; + struct list_head node; }; -static int dm_timer_count; - -#ifdef CONFIG_ARCH_OMAP1 -static struct omap_dm_timer omap1_dm_timers[] = { - { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, - { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, - { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 }, - { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 }, - { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 }, - { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 }, - { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 }, - { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, -}; - -static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers); - -#else -#define omap1_dm_timers NULL -#define omap1_dm_timer_count 0 -#endif /* CONFIG_ARCH_OMAP1 */ - -#ifdef CONFIG_ARCH_OMAP2 -static struct omap_dm_timer omap2_dm_timers[] = { - { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, - { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, - { .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 }, - { .phys_base = 0x4807a000, .irq = INT_24XX_GPTIMER4 }, - { .phys_base = 0x4807c000, .irq = INT_24XX_GPTIMER5 }, - { .phys_base = 0x4807e000, .irq = INT_24XX_GPTIMER6 }, - { .phys_base = 0x4808, .irq = INT_24XX_GPTIMER7 }, - { .phys_base = 0x48082000, .irq = INT_24XX_GPTIMER8 }, - { .phys_base = 0x48084000, .irq = INT_24XX_GPTIMER9 }, - { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 }, - { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 }, - { .phys_base = 0x4808a000, .irq = INT_24XX_GPTIMER12 }, -}; - -static const char *omap2_dm_source_names[] __initdata = { - sys_ck, - func_32k_ck, - alt_ck, - NULL -}; - -static
[PATCHv2 5/13] dmtimer: hwmod: OMAP: conversion to platform driver
From: Thara Gopinath th...@ti.com This essentially involves moving out interrupt and base address related info from plat-omap/dmtimer.c and making certain clock related functions platform data. This patch also initializes dmtimer driver as a earlydriver. This is to enable early timer devices required during system boot initialized early. incorporated comments: (1) use list instead of array to manage timers (2) introduced appropriate cleanup in failure paths of probe function (3) made spinlock a static variable initialized at bootup so that it is available both during early init and later. (4) pm_runtime support (5) corrected un-even number of pm_runtime_enable() associated with early millisecond timers Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Thara Gopinath th...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Tony Lindgren t...@atomide.com --- arch/arm/plat-omap/dmtimer.c | 549 + arch/arm/plat-omap/include/plat/dmtimer.h | 10 +- 2 files changed, 255 insertions(+), 304 deletions(-) mode change 100644 = 100755 arch/arm/plat-omap/dmtimer.c diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 44bafda..0915a37 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -10,6 +10,12 @@ * Copyright (C) 2009 Texas Instruments * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com * + * Copyright (C) 2010 Texas Instruments, Inc. + * Thara Gopinath th...@ti.com + * Tarun Kanti DebBarma tarun.ka...@ti.com + * - hwmod support + * - omap4 support + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your @@ -37,9 +43,13 @@ #include linux/delay.h #include linux/io.h #include linux/module.h +#include linux/slab.h #include mach/hardware.h +#include linux/pm_runtime.h #include plat/dmtimer.h +#include plat/omap_device.h #include mach/irqs.h +#include linux/interrupt.h /* register offsets */ #define _OMAP_TIMER_ID_OFFSET 0x00 @@ -151,144 +161,30 @@ (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR WPSHIFT)) struct omap_dm_timer { - unsigned long phys_base; + int id; + unsigned long fclk_rate; int irq; -#ifdef CONFIG_ARCH_OMAP2PLUS - struct clk *iclk, *fclk; -#endif void __iomem *io_base; unsigned reserved:1; unsigned enabled:1; unsigned posted:1; + unsigned is_initialized:1; + struct platform_device *pdev; + struct list_head node; }; -static int dm_timer_count; - -#ifdef CONFIG_ARCH_OMAP1 -static struct omap_dm_timer omap1_dm_timers[] = { - { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, - { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, - { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 }, - { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 }, - { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 }, - { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 }, - { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 }, - { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, -}; - -static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers); - -#else -#define omap1_dm_timersNULL -#define omap1_dm_timer_count 0 -#endif /* CONFIG_ARCH_OMAP1 */ - -#ifdef CONFIG_ARCH_OMAP2 -static struct omap_dm_timer omap2_dm_timers[] = { - { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, - { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, - { .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 }, - { .phys_base = 0x4807a000, .irq = INT_24XX_GPTIMER4 }, - { .phys_base = 0x4807c000, .irq = INT_24XX_GPTIMER5 }, - { .phys_base = 0x4807e000, .irq = INT_24XX_GPTIMER6 }, - { .phys_base = 0x4808, .irq = INT_24XX_GPTIMER7 }, - { .phys_base = 0x48082000, .irq = INT_24XX_GPTIMER8 }, - { .phys_base = 0x48084000, .irq = INT_24XX_GPTIMER9 }, - { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 }, - { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 }, - { .phys_base = 0x4808a000, .irq = INT_24XX_GPTIMER12 }, -}; - -static const char *omap2_dm_source_names[] __initdata = { - sys_ck, - func_32k_ck, - alt_ck, - NULL -}; - -static struct clk *omap2_dm_source_clocks[3]; -static const int omap2_dm_timer_count = ARRAY_SIZE(omap2_dm_timers); - -#else -#define omap2_dm_timersNULL -#define omap2_dm_timer_count 0 -#define omap2_dm_source_names NULL -#define omap2_dm_source_clocks NULL -#endif /* CONFIG_ARCH_OMAP2 */ - -#ifdef CONFIG_ARCH_OMAP3 -static