ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree
Subsystems (6)
v2 cover ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree
In order to migrate the dmtimer driver to support device-tree I found that it was first necessary to clean-up the timer platform data. The goal of this series is to simplify the timer platform data structure from ...
struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source);
int timer_ip_version;
u32 needs_manual_reset:1;
bool reserved;
bool loses_context;
int (*get_context_loss_count)(struct device *dev);
};to ...
struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source);
u32 timer_capability;
};... where timer_capability is a bit mask that indicates the timer features supported and uses the HWMOD timer capabilities flags described in plat/dmtimer.h. For OMAP2+ devices this allows us to read the timer capabilities from the HWMOD data and for OMAP1 devices the flags are simply populated by the timer initialisation code. Eventually, the aim is to read the timer capabilities from the device tree blob.
This series includes some fixes as well as clean-up. For instance OMAP1 dmtimer support is currently completely broken and so I have included a fix for this. If it is preferred to split the series into fixes and clean-up I can do that.
This series is based upon the current linux-omap master branch (3.5-rc1). I have built both omap1 and omap2plus configurations as well as booted the respective kernels on the omap5912 OSK (omap1), OMAP3430 Beagle and OMAP4460 PANDA.
Jon Hunter (11):
ARM: OMAP: Remove unnecessary clk structure
ARM: OMAP2+: Remove unused max number of timers definition
ARM: OMAP2+: Add dmtimer platform function to reserve systimers
ARM: OMAP: Add DMTIMER capability variable to represent timer
features
ARM: OMAP2+: HWMOD: Correct timer device attributes
ARM: OMAP1: Fix dmtimer support
ARM: OMAP2+: Fix external clock support for dmtimers
ARM: OMAP: Remove loses_context variable from timer platform data
ARM: OMAP: Remove timer function pointer for context loss counter
ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver
ARM: OMAP2+: Simplify dmtimer clock aliases
arch/arm/mach-omap1/timer.c | 3 +- arch/arm/mach-omap2/clock2420_data.c | 39 +------ arch/arm/mach-omap2/clock2430_data.c | 39 +------ arch/arm/mach-omap2/clock3xxx_data.c | 26 +---- arch/arm/mach-omap2/clock44xx_data.c | 34 +++--- arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c | 8 -- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 10 +- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 6 -- arch/arm/mach-omap2/timer.c | 82 +-------------- arch/arm/plat-omap/dmtimer.c | 111 +++++++++++++++----- arch/arm/plat-omap/include/plat/dmtimer.h | 21 +--- 11 files changed, 118 insertions(+), 261 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/11 ARM: OMAP: Remove unnecessary clk structure
In the plat/dmtimer.h there is a structure named "clk" declared. This structure is not used and appears to be left over from previous code. Hence, remove this unused structure.
Verified that both omap1 and omap2plus kernel configurations build with this change.
--- arch/arm/plat-omap/include/plat/dmtimer.h | 1 - 1 file changed, 1 deletion(-)
arch/arm/plat-omap/include/plat/dmtimer.h +0 -1
@@ -71,7 +71,6 @@ struct omap_timer_capability_dev_attr { };struct omap_dm_timer ; -struct clk ;struct timer_regs {u32 tidr;
Signature · 1 line
1.7.9.5
PATCH v2 2/11 ARM: OMAP2+: Remove unused max number of timers definition
In reply to Jon HunterThe OMAP2+ timer code has a definition for the maximum number of timers that OMAP2+ devices have. This defintion is not used anywhere in the code and appears to be left over. Furthermore the definition is not accurate for OMAP4 devices that only have 11 timers available because the 12th timer is reserved as a secure timer. Therefore, remove this definition.
--- arch/arm/mach-omap2/timer.c | 3 --- 1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
@@ -69,9 +69,6 @@#define OMAP3_SECURE_TIMER 1#endif -/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ -#define MAX_GPTIMER_ID 12 -static u32 sys_timer_reserved;/* Clockevent code */
Signature · 1 line
1.7.9.5
PATCH v2 4/11 ARM: OMAP: Add DMTIMER capability variable to represent timer features
In reply to Jon HunterAlthough the OMAP timers share a common hardware design, there are some differences between the timer instances in a given device. For example, a timer maybe in a power domain that can be powered-of, so can lose its logic state and need restoring where as another may be in power domain that is always be on. Another example, is a timer may support different clock sources to drive the timer. This information is passed to the dmtimer via the following platform data structure.
struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source);
int timer_ip_version;
u32 needs_manual_reset:1;
bool loses_context;
int (*get_context_loss_count)(struct device *dev);
};The above structure uses multiple variables to represent the timer features. HWMOD also stores the timer capabilities using a bit-mask that represents the features supported. By using the same format for representing the timer features in the platform data as used by HWMOD, we can ...
1. Use the flags defined in the plat/dmtimer.h to represent the features supported.
2. For devices using HWMOD, we can retrieve the features supported from HWMOD.
3. Eventually, simplify the platform data structure to be ...
struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source);
u32 timer_capability;
}Another benefit from doing this, is that it will simplify the migration of the dmtimer driver to device-tree. For example, in the current OMAP2+ timer code the "loses_context" variable is configured at runtime by calling an architecture specific function. For device tree this creates a problem, because we would need to call the architecture specific function from within the dmtimer driver. However, such attributes do not need to be queried at runtime and we can look up the attributes via HWMOD or device-tree.
This changes a new "capability" variable to the platform data and timer structure so we can start removing and simplifying the platform data structure.
--- arch/arm/mach-omap2/timer.c | 3 +++ arch/arm/plat-omap/dmtimer.c | 1 + arch/arm/plat-omap/include/plat/dmtimer.h | 2 ++ 3 files changed, 6 insertions(+)
arch/arm/mach-omap2/timer.c +3 -0
@@ -500,6 +500,9 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) pdata->set_timer_src = omap2_dm_timer_set_src; pdata->timer_ip_version = oh->class->rev; +if (timer_dev_attr) + pdata->timer_capability = timer_dev_attr->timer_capability; + pwrdm =omap_hwmod_get_pwrdm (oh); pdata->loses_context =pwrdm_can_ever_lose_context (pwrdm);#ifdef CONFIG_PM
arch/arm/plat-omap/dmtimer.c +1 -0
@@ -694,6 +694,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->pdev = pdev; timer->loses_context = pdata->loses_context; timer->get_context_loss_count = pdata->get_context_loss_count; + timer->capability = pdata->timer_capability;/* Skip pm_runtime_enable for OMAP1 */ if (!pdata->needs_manual_reset) {
arch/arm/plat-omap/include/plat/dmtimer.h +2 -0
@@ -101,6 +101,7 @@ struct dmtimer_platform_data {bool loses_context;int (*get_context_loss_count)(struct device *dev); +u32 timer_capability; };int omap_dm_timer_reserve_systimer (int id);
@@ -273,6 +274,7 @@ struct omap_dm_timer {bool loses_context;int ctx_loss_count;int revision; +u32 capability;struct platform_device *pdev;struct list_head node;
Signature · 1 line
1.7.9.5
PATCH v2 3/11 ARM: OMAP2+: Add dmtimer platform function to reserve systimers
In reply to Jon HunterDuring early boot, two timers are reserved by the kernel as system timers (for clocksource and clockevents). These timers are marked as reserved and the dmtimer driver is notified which timers have been reserved via the platform data information.
For OMAP2+ devices the timers reserved may vary depending on device and compile flags. Therefore, it is not easy to assume which timers we be reserved for the system timers. In order to migrate the dmtimer driver to support device-tree we need a way to pass the timers reserved for system timers to the dmtimer driver. Using the platform data structure will not work in the same way as it is currently used because the platform data structure will be stored statically in the dmtimer itself and the platform data will be selected via the device-tree match device function (of_match_device).
There are a couple ways to workaround this. One option is to store the system timers reserved for the kernel in the device-tree and query them on boot. The downside of this approach is that it adds some delay to parse the DT blob to search for the system timers. Secondly, for OMAP3 devices we have a dependency on compile time flags and the device-tree would not be aware of that kernel compile flags and so we would need to address that.
The second option is to add a function to the dmtimer code to reserved the system timers during boot and so the dmtimer knows exactly which timers are being used for system timers. This also allows us to remove the "reserved" member from the timer platform data. This seemed like the simpler approach and so was implemented here.
--- arch/arm/mach-omap2/timer.c | 9 ++------- arch/arm/plat-omap/dmtimer.c | 18 +++++++++++++++++- arch/arm/plat-omap/include/plat/dmtimer.h | 3 +-- 3 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/timer.c +2 -7
@@ -69,8 +69,6 @@#define OMAP3_SECURE_TIMER 1#endif -static u32 sys_timer_reserved; -/* Clockevent code */ static struct omap_dm_timer clkev;
@@ -177,7 +175,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,omap_hwmod_enable (oh); - sys_timer_reserved |= (1 << (gptimer_id -1 )); +if (omap_dm_timer_reserve_systimer (gptimer_id)) +return -ENODEV ;if (gptimer_id !=12 ) {struct clk *src;
@@ -501,10 +500,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) pdata->set_timer_src = omap2_dm_timer_set_src; pdata->timer_ip_version = oh->class->rev; -/* Mark clocksource and clockevent timers as reserved */ -if ((sys_timer_reserved >> (id -1 )) &0x1 ) - pdata->reserved =1 ; - pwrdm =omap_hwmod_get_pwrdm (oh); pdata->loses_context =pwrdm_can_ever_lose_context (pwrdm);#ifdef CONFIG_PM
arch/arm/plat-omap/dmtimer.c +17 -1
@@ -45,6 +45,7 @@#include <mach/hardware.h> +static u32 omap_reserved_systimers;static LIST_HEAD (omap_timer_list);static DEFINE_SPINLOCK (dm_timer_lock);
@@ -152,6 +153,21 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)return ret; } +static inline u32 omap_dm_timer_reserved_systimer (int id) +{ +return (omap_reserved_systimers & (1 << (id -1 ))) ?1 :0 ; +} + +int omap_dm_timer_reserve_systimer (int id) +{ +if (omap_dm_timer_reserved_systimer (id)) +return -ENODEV ; + + omap_reserved_systimers |= (1 << (id -1 )); + +return 0 ; +} +struct omap_dm_timer *omap_dm_timer_request (void ) {struct omap_dm_timer *timer =NULL , *t;
@@ -674,7 +690,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->id = pdev->id; timer->irq = irq->start; - timer->reserved = pdata->reserved; + timer->reserved =omap_dm_timer_reserved_systimer (timer->id); timer->pdev = pdev; timer->loses_context = pdata->loses_context; timer->get_context_loss_count = pdata->get_context_loss_count;
arch/arm/plat-omap/include/plat/dmtimer.h +1 -2
@@ -98,13 +98,12 @@ struct dmtimer_platform_data {int (*set_timer_src)(struct platform_device *pdev,int source);int timer_ip_version; u32 needs_manual_reset:1; -bool reserved; -bool loses_context;int (*get_context_loss_count)(struct device *dev); }; +int omap_dm_timer_reserve_systimer (int id);struct omap_dm_timer *omap_dm_timer_request (void );struct omap_dm_timer *omap_dm_timer_request_specific (int timer_id);int omap_dm_timer_free (struct omap_dm_timer *timer);
Signature · 1 line
1.7.9.5
PATCH v2 5/11 ARM: OMAP2+: HWMOD: Correct timer device attributes
In reply to Jon HunterFix the following issues with the timer device attributes for OMAP2+ devices:
1. For OMAP24xx devices, timers 2-8 have the ALWAYS-ON attribute indicating that these timers are in an ALWAYS-ON power domain. This is not the case only timer1 is in an ALWAYS-ON power domain.
2. For OMAP3xxx devices, timers 2-7 have the ALWAYS-ON attribute indicating that these timers are in an ALWAYS-ON power domain. This is not the case only timer1 and timer12 are in an ALWAYS-ON power domain.
3. For OMAP3xxx devices, timer12 does not have the ALWAYS-ON but is in an always-on power domain.
--- arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c | 7 ------- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 8 +------- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 6 ------ 3 files changed, 1 insertion(+), 20 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +0 -7
@@ -257,7 +257,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -276,7 +275,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -295,7 +293,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -314,7 +311,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -333,7 +329,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -352,7 +347,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
@@ -371,7 +365,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = { .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap2xxx_timer_hwmod_class, };
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -7
@@ -150,7 +150,7 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {/* secure timers dev attribute */ static struct omap_timer_capability_dev_attr capability_secure_dev_attr = { - .timer_capability =OMAP_TIMER_SECURE , + .timer_capability =OMAP_TIMER_ALWON |OMAP_TIMER_SECURE , };/* always-on timers dev attribute */
@@ -195,7 +195,6 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_1ms_hwmod_class, };
@@ -213,7 +212,6 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_hwmod_class, };
@@ -231,7 +229,6 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_hwmod_class, };
@@ -249,7 +246,6 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_hwmod_class, };
@@ -267,7 +263,6 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_hwmod_class, };
@@ -285,7 +280,6 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = { .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT, }, }, - .dev_attr = &capability_alwon_dev_attr, .class = &omap3xxx_timer_hwmod_class, };
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -6
@@ -2943,7 +2943,6 @@ static struct omap_hwmod omap44xx_timer2_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer3 */
@@ -2965,7 +2964,6 @@ static struct omap_hwmod omap44xx_timer3_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer4 */
@@ -2987,7 +2985,6 @@ static struct omap_hwmod omap44xx_timer4_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer5 */
@@ -3009,7 +3006,6 @@ static struct omap_hwmod omap44xx_timer5_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer6 */
@@ -3032,7 +3028,6 @@ static struct omap_hwmod omap44xx_timer6_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer7 */
@@ -3054,7 +3049,6 @@ static struct omap_hwmod omap44xx_timer7_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .dev_attr = &capability_alwon_dev_attr, };/* timer8 */
Signature · 1 line
1.7.9.5
PATCH v2 6/11 ARM: OMAP1: Fix dmtimer support
In reply to Jon HunterOMAP1 dmtimer support is currently broken. When a dmtimer is requested by the omap_dm_timer_request() function fails to allocate a dmtimer because the call to clk_get() inside omap_dm_timer_prepare fails. The clk_get() fails simply because the clock data for the OMAP1 dmtimers is not present.
Ideally this should be fixed by moving OMAP1 dmtimers to use the clock framework. For now simply fix this by using the "TIMER_NEEDS_RESET" flag to identify an OMAP1 device and avoid calling clk_get(). Although this is not the ideal fix and should be corrected, this flag has already been use for the same purpose in omap_dm_timer_stop().
--- arch/arm/plat-omap/dmtimer.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/arm/plat-omap/dmtimer.c +11 -5
@@ -137,11 +137,17 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;int ret; - timer->fclk =clk_get (&timer->pdev->dev,"fck" ); -if (WARN_ON_ONCE (IS_ERR_OR_NULL (timer->fclk))) { - timer->fclk =NULL ; -dev_err (&timer->pdev->dev,": No fclk handle.\n" ); -return -EINVAL ; +/* +* FIXME: OMAP1 devices do not use the clock framework for dmtimers so +* do not call clk_get() for these devices. +*/ +if (!(timer->capability &OMAP_TIMER_NEEDS_RESET )) { + timer->fclk =clk_get (&timer->pdev->dev,"fck" ); +if (WARN_ON_ONCE (IS_ERR_OR_NULL (timer->fclk))) { + timer->fclk =NULL ; +dev_err (&timer->pdev->dev,": No fclk handle.\n" ); +return -EINVAL ; + } }if (pdata->needs_manual_reset)
Signature · 1 line
1.7.9.5
PATCH v2 7/11 ARM: OMAP2+: Fix external clock support for dmtimers
In reply to Jon HunterCurrently, the dmtimer determines whether an timer can support an external clock source (sys_altclk) for driving the timer by the IP version. Only OMAP24xx devices can support an external clock source, but the IP version between OMAP24xx and OMAP3xxx is common and so this incorrectly indicates that OMAP3 devices can use an external clock source.
Rather than use the IP version, just let the clock framework handle this. If the "alt_ck" does not exist for a timer then the clock framework will fail to find the clock and hence will return an error. By doing this we can eliminate the "timer_ip_version" variable passed as part of the platform data and simplify the code.
We can also remove the timer IP version from the HWMOD data because the dmtimer driver uses the TIDR register to determine the IP version.
--- arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c | 1 - arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 2 -- arch/arm/mach-omap2/timer.c | 11 ++--------- arch/arm/plat-omap/include/plat/dmtimer.h | 7 ------- 4 files changed, 2 insertions(+), 19 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +0 -1
@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = {struct omap_hwmod_class omap2xxx_timer_hwmod_class = { .name ="timer" , .sysc = &omap2xxx_timer_sysc, - .rev =OMAP_TIMER_IP_VERSION_1 , };/*
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +0 -2
@@ -129,7 +129,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = { .name ="timer" , .sysc = &omap3xxx_timer_1ms_sysc, - .rev =OMAP_TIMER_IP_VERSION_1 , };static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
@@ -145,7 +144,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {static struct omap_hwmod_class omap3xxx_timer_hwmod_class = { .name ="timer" , .sysc = &omap3xxx_timer_sysc, - .rev =OMAP_TIMER_IP_VERSION_1 , };/* secure timers dev attribute */
arch/arm/mach-omap2/timer.c +2 -9
@@ -418,14 +418,8 @@ static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)break ;case OMAP_TIMER_SRC_EXT_CLK : -if (pdata->timer_ip_version ==OMAP_TIMER_IP_VERSION_1 ) { - parent_name ="alt_ck" ; -break ; - } -dev_err (&pdev->dev,"%s: %d: invalid clk src.\n" , - __func__, __LINE__); -clk_put (fclk); -return -EINVAL ; + parent_name ="alt_ck" ; +break ; } parent =clk_get (&pdev->dev, parent_name);
@@ -498,7 +492,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)sscanf (oh->name,"timer%2d" , &id); pdata->set_timer_src = omap2_dm_timer_set_src; - pdata->timer_ip_version = oh->class->rev;if (timer_dev_attr) pdata->timer_capability = timer_dev_attr->timer_capability;
arch/arm/plat-omap/include/plat/dmtimer.h +0 -7
@@ -55,12 +55,6 @@#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 -/* -* IP revision identifier so that Highlander IP -* in OMAP4 can be distinguished. -*/ -#define OMAP_TIMER_IP_VERSION_1 0x1 -/* timer capabilities used in hwmod database */ #define OMAP_TIMER_SECURE 0x80000000#define OMAP_TIMER_ALWON 0x40000000
@@ -96,7 +90,6 @@ struct timer_regs {struct dmtimer_platform_data {int (*set_timer_src)(struct platform_device *pdev,int source); -int timer_ip_version;u32 needs_manual_reset:1 ;bool loses_context;
Signature · 1 line
1.7.9.5
PATCH v2 8/11 ARM: OMAP: Remove loses_context variable from timer platform data
In reply to Jon HunterThe platform data variable loses_context is used to determine if the timer may lose its logic state during power transitions and so needs to be restored. This information is also provided in the HWMOD device attributes for OMAP2+ devices via the OMAP_TIMER_ALWON flag. When this flag is set the timer will not lose context. So use the HWMOD device attributes to determine this.
For OMAP1 devices, loses_context is never set and so set the OMAP_TIMER_ALWON flag for OMAP1 timers to ensure that code is equivalent.
--- arch/arm/mach-omap1/timer.c | 1 + arch/arm/mach-omap2/timer.c | 3 --- arch/arm/plat-omap/dmtimer.c | 8 ++++---- arch/arm/plat-omap/include/plat/dmtimer.h | 3 --- 4 files changed, 5 insertions(+), 10 deletions(-)
arch/arm/mach-omap1/timer.c +1 -0
@@ -141,6 +141,7 @@ static int __init omap1_dm_timer_init(void) pdata->set_timer_src = omap1_dm_timer_set_src; pdata->needs_manual_reset =1 ; + pdata->timer_capability =OMAP_TIMER_ALWON ; ret =platform_device_add_data (pdev, pdata,sizeof (*pdata));if (ret) {
arch/arm/mach-omap2/timer.c +0 -3
@@ -463,7 +463,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)struct dmtimer_platform_data *pdata;struct platform_device *pdev;struct omap_timer_capability_dev_attr *timer_dev_attr; -struct powerdomain *pwrdm;pr_debug ("%s: %s\n" , __func__, oh->name);
@@ -496,8 +495,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)if (timer_dev_attr) pdata->timer_capability = timer_dev_attr->timer_capability; - pwrdm =omap_hwmod_get_pwrdm (oh); - pdata->loses_context =pwrdm_can_ever_lose_context (pwrdm);#ifdef CONFIG_PM pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;#endif
arch/arm/plat-omap/dmtimer.c +4 -4
@@ -347,7 +347,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)omap_dm_timer_enable (timer); -if (timer->loses_context) { +if (!(timer->capability &OMAP_TIMER_ALWON )) {u32 ctx_loss_cnt_after = timer->get_context_loss_count (&timer->pdev->dev);if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -380,7 +380,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)__omap_dm_timer_stop (timer, timer->posted, rate); -if (timer->loses_context && timer->get_context_loss_count) +if (!(timer->capability &OMAP_TIMER_ALWON ) && + timer->get_context_loss_count) timer->ctx_loss_count = timer->get_context_loss_count (&timer->pdev->dev);
@@ -453,7 +454,7 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,omap_dm_timer_enable (timer); -if (timer->loses_context) { +if (!(timer->capability &OMAP_TIMER_ALWON )) {u32 ctx_loss_cnt_after = timer->get_context_loss_count (&timer->pdev->dev);if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -698,7 +699,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->irq = irq->start; timer->reserved =omap_dm_timer_reserved_systimer (timer->id); timer->pdev = pdev; - timer->loses_context = pdata->loses_context; timer->get_context_loss_count = pdata->get_context_loss_count; timer->capability = pdata->timer_capability;
arch/arm/plat-omap/include/plat/dmtimer.h +0 -3
@@ -91,8 +91,6 @@ struct timer_regs {struct dmtimer_platform_data {int (*set_timer_src)(struct platform_device *pdev,int source);u32 needs_manual_reset:1 ; -bool loses_context; -int (*get_context_loss_count)(struct device *dev);u32 timer_capability; };
@@ -264,7 +262,6 @@ struct omap_dm_timer { unsigned reserved:1; unsigned posted:1;struct timer_regs context; -bool loses_context;int ctx_loss_count;int revision;u32 capability;
Signature · 1 line
1.7.9.5
PATCH v2 9/11 ARM: OMAP: Remove timer function pointer for context loss counter
In reply to Jon HunterFor OMAP2+ devices, a function pointer that returns the number of times a timer power domain has lost context is passed to the dmtimer driver. This function pointer is only populated for OMAP2+ devices and it is pointing to a platform function. Given that this is a platform function, we can simplify the code by removing the function pointer and referencing the function directly. We can use the OMAP_TIMER_ALWON flag to determine if we need to call this function for OMAP1 and OMAP2+ devices.
The benefit of this change is the we can remove the function pointer from the platform data and simplifies the dmtimer migration to device-tree.
--- arch/arm/mach-omap1/timer.c | 4 ++-- arch/arm/mach-omap2/timer.c | 3 --- arch/arm/plat-omap/dmtimer.c | 26 ++++++++++---------------- arch/arm/plat-omap/include/plat/dmtimer.h | 4 +--- 4 files changed, 13 insertions(+), 24 deletions(-)
arch/arm/mach-omap1/timer.c +2 -2
@@ -140,8 +140,8 @@ static int __init omap1_dm_timer_init(void) } pdata->set_timer_src = omap1_dm_timer_set_src; - pdata->needs_manual_reset =1 ; - pdata->timer_capability =OMAP_TIMER_ALWON ; + pdata->timer_capability =OMAP_TIMER_ALWON | +OMAP_TIMER_NEEDS_RESET ; ret =platform_device_add_data (pdev, pdata,sizeof (*pdata));if (ret) {
arch/arm/mach-omap2/timer.c +0 -3
@@ -495,9 +495,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)if (timer_dev_attr) pdata->timer_capability = timer_dev_attr->timer_capability; -#ifdef CONFIG_PM - pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; -#endif pdev =omap_device_build (name, id, oh, pdata,sizeof (*pdata),NULL ,0 ,0 );
arch/arm/plat-omap/dmtimer.c +10 -16
@@ -42,6 +42,7 @@#include <linux/pm_runtime.h> #include <plat/dmtimer.h> +#include <plat/omap-pm.h> #include <mach/hardware.h>
@@ -134,7 +135,6 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)int omap_dm_timer_prepare (struct omap_dm_timer *timer) { -struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;int ret;/*
@@ -150,7 +150,7 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer) } } -if (pdata->needs_manual_reset) +if (timer->capability &OMAP_TIMER_NEEDS_RESET )omap_dm_timer_reset (timer); ret =omap_dm_timer_set_source (timer,OMAP_TIMER_SRC_32_KHZ );
@@ -348,9 +348,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)omap_dm_timer_enable (timer);if (!(timer->capability &OMAP_TIMER_ALWON )) { -u32 ctx_loss_cnt_after = - timer->get_context_loss_count (&timer->pdev->dev); -if (ctx_loss_cnt_after != timer->ctx_loss_count) +if (omap_pm_get_dev_context_loss_count (&timer->pdev->dev) != + timer->ctx_loss_count)omap_timer_restore_context (timer); }
@@ -369,21 +368,18 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_start);int omap_dm_timer_stop (struct omap_dm_timer *timer) {unsigned long rate =0 ; -struct dmtimer_platform_data *pdata;if (unlikely (!timer))return -EINVAL ; - pdata = timer->pdev->dev.platform_data; -if (!pdata->needs_manual_reset) +if (!(timer->capability &OMAP_TIMER_NEEDS_RESET )) rate =clk_get_rate (timer->fclk);__omap_dm_timer_stop (timer, timer->posted, rate); -if (!(timer->capability &OMAP_TIMER_ALWON ) && - timer->get_context_loss_count) +if (!(timer->capability &OMAP_TIMER_ALWON )) timer->ctx_loss_count = - timer->get_context_loss_count (&timer->pdev->dev); +omap_pm_get_dev_context_loss_count (&timer->pdev->dev);/* * Since the register values are computed and written within
@@ -455,9 +451,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,omap_dm_timer_enable (timer);if (!(timer->capability &OMAP_TIMER_ALWON )) { -u32 ctx_loss_cnt_after = - timer->get_context_loss_count (&timer->pdev->dev); -if (ctx_loss_cnt_after != timer->ctx_loss_count) +if (omap_pm_get_dev_context_loss_count (&timer->pdev->dev) != + timer->ctx_loss_count)omap_timer_restore_context (timer); }
@@ -699,11 +694,10 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->irq = irq->start; timer->reserved =omap_dm_timer_reserved_systimer (timer->id); timer->pdev = pdev; - timer->get_context_loss_count = pdata->get_context_loss_count; timer->capability = pdata->timer_capability;/* Skip pm_runtime_enable for OMAP1 */ -if (!pdata->needs_manual_reset) { +if (!(timer->capability &OMAP_TIMER_NEEDS_RESET )) {pm_runtime_enable (&pdev->dev);pm_runtime_irq_safe (&pdev->dev); }
arch/arm/plat-omap/include/plat/dmtimer.h +1 -3
@@ -59,6 +59,7 @@#define OMAP_TIMER_SECURE 0x80000000#define OMAP_TIMER_ALWON 0x40000000#define OMAP_TIMER_HAS_PWM 0x20000000 +#define OMAP_TIMER_NEEDS_RESET 0x10000000struct omap_timer_capability_dev_attr {u32 timer_capability;
@@ -91,7 +92,6 @@ struct timer_regs {struct dmtimer_platform_data {int (*set_timer_src)(struct platform_device *pdev,int source);u32 needs_manual_reset:1 ; -int (*get_context_loss_count)(struct device *dev);u32 timer_capability; };
@@ -267,8 +267,6 @@ struct omap_dm_timer {u32 capability;struct platform_device *pdev;struct list_head node; - -int (*get_context_loss_count)(struct device *dev); };int omap_dm_timer_prepare (struct omap_dm_timer *timer);
Signature · 1 line
1.7.9.5
PATCH v2 10/11 ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver
In reply to Jon HunterOMAP1 uses an architecture specific function for setting the dmtimer clock source, where as the OMAP2+ devices use the clock framework. Eventually OMAP1 device should also use the clock framework and hence we should not any architecture specific functions.
For now move the OMAP2+ function for configuring the clock source into the dmtimer driver. Therefore, we do no longer need to specify an architecture specific function for setting the clock source for OMAP2+ devices. This will simplify device tree migration of the dmtimers for OMAP2+ devices.
Quoted 1 line
From now on, only OMAP1 devices should specify an architecture specific
function for setting the clock source via the platform data set_dmtimer_src() function pointer.
--- arch/arm/mach-omap2/timer.c | 56 ----------------------------- arch/arm/plat-omap/dmtimer.c | 46 +++++++++++++++++++++++- arch/arm/plat-omap/include/plat/dmtimer.h | 1 + 3 files changed, 46 insertions(+), 57 deletions(-)
arch/arm/mach-omap2/timer.c +0 -56
@@ -390,60 +390,6 @@ OMAP_SYS_TIMER(4)#endif /** -* omap2_dm_timer_set_src - change the timer input clock source -* @pdev: timer platform device pointer -* @source: array index of parent clock source -*/ -static int omap2_dm_timer_set_src (struct platform_device *pdev,int source) -{ -int ret; -struct dmtimer_platform_data *pdata = pdev->dev.platform_data; -struct clk *fclk, *parent; -char *parent_name =NULL ; - - fclk =clk_get (&pdev->dev,"fck" ); -if (IS_ERR_OR_NULL (fclk)) { -dev_err (&pdev->dev,"%s: %d: clk_get() FAILED\n" , - __func__, __LINE__); -return -EINVAL ; - } - -switch (source) { -case OMAP_TIMER_SRC_SYS_CLK : - parent_name ="sys_ck" ; -break ; - -case OMAP_TIMER_SRC_32_KHZ : - parent_name ="32k_ck" ; -break ; - -case OMAP_TIMER_SRC_EXT_CLK : - parent_name ="alt_ck" ; -break ; - } - - parent =clk_get (&pdev->dev, parent_name); -if (IS_ERR_OR_NULL (parent)) { -dev_err (&pdev->dev,"%s: %d: clk_get() %s FAILED\n" , - __func__, __LINE__, parent_name); -clk_put (fclk); -return -EINVAL ; - } - - ret =clk_set_parent (fclk, parent); -if (IS_ERR_VALUE (ret)) { -dev_err (&pdev->dev,"%s: clk_set_parent() to %s FAILED\n" , - __func__, parent_name); - ret = -EINVAL ; - } - -clk_put (parent); -clk_put (fclk); - -return ret; -} - -/** * omap_timer_init - build and register timer device with an * associated timer hwmod * @oh: timer hwmod pointer to be used to build timer device
@@ -490,8 +436,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)*/ sscanf (oh->name,"timer%2d" , &id); - pdata->set_timer_src = omap2_dm_timer_set_src; -if (timer_dev_attr) pdata->timer_capability = timer_dev_attr->timer_capability;
arch/arm/plat-omap/dmtimer.c +45 -1
58 lines not on this page · raw message
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
@@ -90,6 +90,7 @@ struct timer_regs { };struct dmtimer_platform_data { +/* set_timer_src - Only used for OMAP1 devices */ int (*set_timer_src)(struct platform_device *pdev,int source);u32 needs_manual_reset:1 ;u32 timer_capability;
Signature · 1 line
1.7.9.5
PATCH v2 11/11 ARM: OMAP2+: Simplify dmtimer clock aliases
In reply to Jon HunterThe OMAP dmtimer driver allows you to dynamically configure the functional clock that drives the timer logic. The dmtimer driver uses the device name and a "con-id" string to search for the appropriate functional clock.
Currently, we define a clock alias for each functional clock source each timer supports. Some functional clock sources are common to all of the timers on a device and so for these clock sources we can use a single alias with a unique con-id string.
The possible functional clock sources for an OMAP device are a 32kHz clock, a system (MHz range) clock and (for OMAP2 only) an external clock. By defining a unique con-id name for each of these (timer_32k_ck, timer_sys_ck and timer_ext_ck) we can eliminate a lot of the clock aliases for timers. This reduces code, speeds-up searches and clock initialisation time.
--- arch/arm/mach-omap2/clock2420_data.c | 39 +++------------------------------- arch/arm/mach-omap2/clock2430_data.c | 39 +++------------------------------- arch/arm/mach-omap2/clock3xxx_data.c | 26 ++--------------------- arch/arm/mach-omap2/clock44xx_data.c | 34 +++++++++++------------------ arch/arm/plat-omap/dmtimer.c | 6 +++--- 5 files changed, 23 insertions(+), 121 deletions(-)
arch/arm/mach-omap2/clock2420_data.c +3 -36
@@ -1901,42 +1901,9 @@ static struct omap_clk omap2420_clks[] = {CLK (NULL ,"pka_ick" , &pka_ick,CK_242X ),CLK (NULL ,"usb_fck" , &usb_fck,CK_242X ),CLK ("musb-hdrc" ,"fck" , &osc_ck,CK_242X ), -CLK ("omap_timer.1" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.2" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.3" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.4" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.5" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.6" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.7" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.8" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.9" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.10" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.11" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.12" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.1" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.2" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.3" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.4" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.5" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.6" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.7" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.8" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.9" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.10" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.11" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.12" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.1" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.2" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.3" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.4" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.5" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.6" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.7" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.8" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.9" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.10" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.11" ,"alt_ck" , &alt_ck,CK_243X ), - CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X), +CLK (NULL ,"timer_32k_ck" , &func_32k_ck,CK_243X ), +CLK (NULL ,"timer_sys_ck" , &sys_ck,CK_243X ), + CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X), };/*
arch/arm/mach-omap2/clock2430_data.c +3 -36
@@ -2000,42 +2000,9 @@ static struct omap_clk omap2430_clks[] = {CLK (NULL ,"mdm_intc_ick" , &mdm_intc_ick,CK_243X ),CLK ("omap_hsmmc.0" ,"mmchsdb_fck" , &mmchsdb1_fck,CK_243X ),CLK ("omap_hsmmc.1" ,"mmchsdb_fck" , &mmchsdb2_fck,CK_243X ), -CLK ("omap_timer.1" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.2" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.3" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.4" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.5" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.6" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.7" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.8" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.9" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.10" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.11" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.12" ,"32k_ck" , &func_32k_ck,CK_243X ), -CLK ("omap_timer.1" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.2" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.3" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.4" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.5" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.6" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.7" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.8" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.9" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.10" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.11" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.12" ,"sys_ck" , &sys_ck,CK_243X ), -CLK ("omap_timer.1" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.2" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.3" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.4" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.5" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.6" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.7" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.8" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.9" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.10" ,"alt_ck" , &alt_ck,CK_243X ), -CLK ("omap_timer.11" ,"alt_ck" , &alt_ck,CK_243X ), - CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X), +CLK (NULL ,"timer_32k_ck" , &func_32k_ck,CK_243X ), +CLK (NULL ,"timer_sys_ck" , &sys_ck,CK_243X ), + CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X), };/*
arch/arm/mach-omap2/clock3xxx_data.c +2 -24
@@ -3482,30 +3482,8 @@ static struct omap_clk omap3xxx_clks[] = {CLK ("musb-am35x" ,"fck" , &hsotgusb_fck_am35xx,CK_AM35XX ),CLK (NULL ,"hecc_ck" , &hecc_ck,CK_AM35XX ),CLK (NULL ,"uart4_ick" , &uart4_ick_am35xx,CK_AM35XX ), -CLK ("omap_timer.1" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.2" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.3" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.4" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.5" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.6" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.7" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.8" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.9" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.10" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.11" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.12" ,"32k_ck" , &omap_32k_fck,CK_3XXX ), -CLK ("omap_timer.1" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.2" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.3" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.4" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.5" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.6" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.7" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.8" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.9" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.10" ,"sys_ck" , &sys_ck,CK_3XXX ), -CLK ("omap_timer.11" ,"sys_ck" , &sys_ck,CK_3XXX ), - CLK("omap_timer.12", "sys_ck", &sys_ck, CK_3XXX), +CLK (NULL ,"timer_32k_ck" , &omap_32k_fck,CK_3XXX ), + CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX), };
arch/arm/mach-omap2/clock44xx_data.c +12 -22
@@ -3380,28 +3380,18 @@ static struct omap_clk omap44xx_clks[] = {CLK ("usbhs_omap" ,"usbhost_ick" , &dummy_ck,CK_443X ),CLK ("usbhs_omap" ,"usbtll_fck" , &dummy_ck,CK_443X ),CLK ("omap_wdt" ,"ick" , &dummy_ck,CK_443X ), -CLK ("omap_timer.1" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.2" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.3" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.4" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.5" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.6" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.7" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.8" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.9" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.10" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.11" ,"32k_ck" , &sys_32k_ck,CK_443X ), -CLK ("omap_timer.1" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.2" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.3" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.4" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.9" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.10" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.11" ,"sys_ck" , &sys_clkin_ck,CK_443X ), -CLK ("omap_timer.5" ,"sys_ck" , &syc_clk_div_ck,CK_443X ), -CLK ("omap_timer.6" ,"sys_ck" , &syc_clk_div_ck,CK_443X ), -CLK ("omap_timer.7" ,"sys_ck" , &syc_clk_div_ck,CK_443X ), - CLK("omap_timer.8", "sys_ck", &syc_clk_div_ck, CK_443X), +CLK (NULL ,"timer_32k_ck" , &sys_32k_ck,CK_443X ), +CLK ("omap_timer.1" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.2" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.3" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.4" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.9" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.10" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.11" ,"timer_sys_ck" , &sys_clkin_ck,CK_443X ), +CLK ("omap_timer.5" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("omap_timer.6" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), +CLK ("omap_timer.7" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ), + CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X), };int __init omap4xxx_clk_init (void )
arch/arm/plat-omap/dmtimer.c +3 -3
@@ -425,15 +425,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)switch (source) {case OMAP_TIMER_SRC_SYS_CLK : - parent_name ="sys_ck" ; + parent_name ="timer_sys_ck" ;break ;case OMAP_TIMER_SRC_32_KHZ : - parent_name ="32k_ck" ; + parent_name ="timer_32k_ck" ;break ;case OMAP_TIMER_SRC_EXT_CLK : - parent_name ="alt_ck" ; + parent_name ="timer_ext_ck" ;break ; }
Signature · 1 line
1.7.9.5
Quoted 27 lines · Jon Hunter
In order to migrate the dmtimer driver to support device-tree I found that it was first necessary to clean-up the timer platform data. The goal of this series is to simplify the timer platform data structure from ...
struct dmtimer_platform_data { int (*set_timer_src)(struct platform_device *pdev, int source); int timer_ip_version; u32 needs_manual_reset:1; bool reserved; bool loses_context; int (*get_context_loss_count)(struct device *dev); };to ...
struct dmtimer_platform_data { int (*set_timer_src)(struct platform_device *pdev, int source); u32 timer_capability; };... where
timer_capabilityis a bit mask that indicates the timer features supported and uses the HWMOD timer capabilities flags described inplat/dmtimer.h. For OMAP2+ devices this allows us to read the timer capabilities from the HWMOD data and for OMAP1 devices the flags are simply populated by the timer initialisation code. Eventually, the aim is to read the timer capabilities from the device tree blob.
Quoted 7 lines
This series includes some fixes as well as clean-up. For instance OMAP1 dmtimer support is currently completely broken and so I have included a fix for this. If it is preferred to split the series into fixes and clean-up I can do that.
This series is based upon the current linux-omap master branch (3.5-rc1). I have built both omap1 and omap2plus configurations as well as booted the respective kernels on the omap5912 OSK (omap1), OMAP3430 Beagle and OMAP4460 PANDA.
Forgot to add high-level changes for V2:
V2:
- Fix OMAP1 dmtimer support which currently broken. Requesting a timer fails because clk_get() is called and this is not support for OMAP1 devices.
- Only use "set_timer_src" function pointer for OMAP1 devices.
Testing:
- On the above boards I have tested that I can request a timer and set the parent clock.
Cheers
Jon
Re: [PATCH V2 09/11] ARM: OMAP: Remove timer function pointer for context loss counter
In reply to Jon HunterQuoted 24 lines · Jon Hunter
For OMAP2+ devices, a function pointer that returns the number of times a timer power domain has lost context is passed to the dmtimer driver. This function pointer is only populated for OMAP2+ devices and it is pointing to a platform function. Given that this is a platform function, we can simplify the code by removing the function pointer and referencing the function directly. We can use the
OMAP_TIMER_ALWONflag to determine if we need to call this function for OMAP1 and OMAP2+ devices.The benefit of this change is the we can remove the function pointer from the platform data and simplifies the dmtimer migration to device-tree.
Signed-off-by Jon Hunter <[email protected]>--- arch/arm/mach-omap1/timer.c | 4 ++-- arch/arm/mach-omap2/timer.c | 3 --- arch/arm/plat-omap/dmtimer.c | 26 ++++++++++---------------- arch/arm/plat-omap/include/plat/dmtimer.h | 4 +--- 4 files changed, 13 insertions(+), 24 deletions(-)arch/arm/mach-omap1/timer.c +0
-0
arch/arm/mach-omap1/timer.c static int __init omap1_dm_timer_init(void) · line 144
Quoted 7 lines
arch/arm/mach-omap1/timer.c +2
-2@@ -140,8 +140,8 @@ static int __init omap1_dm_timer_init(void) } pdata->set_timer_src = omap1_dm_timer_set_src; - pdata->needs_manual_reset =1 ; - pdata->timer_capability =OMAP_TIMER_ALWON ; + pdata->timer_capability =OMAP_TIMER_ALWON | +OMAP_TIMER_NEEDS_RESET ;
Some how I have managed to squash 2 patches together here when rebasing to 3.5-rc1, ugh! I will re-send this series. Sorry for the noise.
Jon