linux-mips
[Top] [All Lists]

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

To: John Crispin <john@phrozen.org>
Subject: Re: [PATCH] MIPS: add proper set_mode() to cevt-r4k
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 1 Aug 2013 16:13:58 +0200
Cc: linux-mips@linux-mips.org, Florian Fainelli <florian@openwrt.org>
In-reply-to: <51F9FD16.4030706@phrozen.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1375091743-20608-1-git-send-email-blogic@openwrt.org> <CAGVrzcYcP8kUueLkDtL+fT9g+HFUKGgdw_hTRXkhA8P+4LbL8A@mail.gmail.com> <51F963E7.50407@gmail.com> <1687511.8JA8mPPmNW@lenovo> <51F9FD16.4030706@phrozen.org>
Sender: linux-mips-bounce@linux-mips.org
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.

  Ralf

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