[Top] [All Lists]

Re: [PATCH] MIPS: add proper set_mode() to cevt-r4k

To: John Crispin <>
Subject: Re: [PATCH] MIPS: add proper set_mode() to cevt-r4k
From: Ralf Baechle <>
Date: Thu, 1 Aug 2013 16:13:58 +0200
Cc:, Florian Fainelli <>
In-reply-to: <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
References: <> <> <> <1687511.8JA8mPPmNW@lenovo> <>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Aug 01, 2013 at 08:15:50AM +0200, John Crispin wrote:

> >Whatever works for you. I still would like to understand why plat_time_init()
> >is not suitable for John's specific use case.
> Hi Florian,
> the reason is that fixing it in plat_time_init() works around the
> real problem. the double request of the irq is a symptom of the
> actual problem, which is, that the cevt-r4k sets up the timer during
> init and not during setup. additionally, plat_time_init is used to
> probe the cevt drivers from OF already. currently the mips code just
> assumes that on a r4k we always have and want to run the cevt-r4k.
> this assumption is wrong and can quickly be fixed by making the
> cevt-r4k use the correct api.
> also fixing it this way allows the user to control the clocksource
> and change it at runtime via sysfs, a feature als not working
> currently on r4k as the cevt driver did not implement the set_mode()
> handler correctly. to be quite honest, i cannot think of a single
> way in which this can be fixed cleanly in the ralink
> plat_time_init() without using some weird heuristic. also if i fix
> this inside ralink plat_time_init() it is fixed only on ralink SoC
> and not on any other platform.

setup_irq() may fail but set_mode doesn't have a way to communicate an
error - other than leaving back a half-wrecked system so set_mode is not
a good place to do that kind of job.

How about using get_c0_compare_int() for a solution?  Currently
get_c0_compare_int() can not return an error.  If it could return a
negative value to indicate the unavailability of an interrupt for
cevt-r4k's use, that interrupt would be available for alternative use.


<Prev in Thread] Current Thread [Next in Thread>