Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Vitaly Wool <vitalywool@gmail.com>
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: pnx8xxx: move to clocksource
Date: Thu, 10 Jan 2008 19:21:17 +0300	[thread overview]
Message-ID: <478645FD.2090708@ru.mvista.com> (raw)
In-Reply-To: <4786273D.7010006@gmail.com>

Hello.

Vitaly Wool wrote:

> This patch converts PNX8XXX system timer to clocksource.

    Well, this patch has been already committed but nevertheless...

> arch/mips/philips/pnx8550/common/time.c |  109 
> +++++++++++++++++++++-----------
> 1 files changed, 72 insertions(+), 37 deletions(-)

> Signed-off-by: Vitaly Wool <vitalywool@gmail.com>

> Index: linux-2.6/arch/mips/philips/pnx8550/common/time.c
> ===================================================================
> --- linux-2.6.orig/arch/mips/philips/pnx8550/common/time.c
> +++ linux-2.6/arch/mips/philips/pnx8550/common/time.c
> @@ -22,7 +22,6 @@
> #include <linux/kernel_stat.h>
> #include <linux/spinlock.h>
> #include <linux/interrupt.h>
> -#include <linux/module.h>
> 
> #include <asm/bootinfo.h>
> #include <asm/cpu.h>
> @@ -41,11 +40,60 @@ static cycle_t hpt_read(void)
>     return read_c0_count2();
> }

> +static struct clocksource pnx_clocksource = {
> +    .name        = "pnx8xxx",
> +    .rating        = 200,
> +    .read        = hpt_read,
> +    .flags        = CLOCK_SOURCE_IS_CONTINUOUS,
> +};

    Something probably have converted tabs to 8 spaces...
    I would have done it otherwise -- using timer 1 as a generic MIPS 
clocksource (just hooking the IRQ to reload the comparator to all ones), and 
timer 2 as clockevent...

> static void timer_ack(void)
> {
>     write_c0_compare(cpj);
> }

    Do we still need this function? I don't think so -- mips_timer_ack() is 
dead...

[...]

> +static struct clock_event_device pnx8xxx_clockevent = {
> +    .name        = "pnx8xxx_clockevent",
> +    .features    = CLOCK_EVT_FEAT_ONESHOT,

    Aren't PNX8550 timers actually periodic in nature?

> +    .set_next_event = pnx8xxx_set_next_event,
> +};
> +
> /*
>  * plat_time_init() - it does the following things:
>  *
> @@ -58,11 +106,34 @@ static void timer_ack(void)
> 
> __init void plat_time_init(void)
> {
> +    unsigned int             configPR;

   Something has definitely spoilt all the tabs in the patch...

>     unsigned int             n;
>     unsigned int             m;
>     unsigned int             p;
>     unsigned int             pow2p;
> 
> +    clockevents_register_device(&pnx8xxx_clockevent);
> +    clocksource_register(&pnx_clocksource);
> +
> +    setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq);
> +    setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
> +
> +    /* Timer 1 start */
> +    configPR = read_c0_config7();
> +    configPR &= ~0x00000008;
> +    write_c0_config7(configPR);
> +
> +    /* Timer 2 start */
> +    configPR = read_c0_config7();
> +    configPR &= ~0x00000010;
> +    write_c0_config7(configPR);
> +
> +    /* Timer 3 stop */
> +    configPR = read_c0_config7();
> +    configPR |= 0x00000020;
> +    write_c0_config7(configPR);

    Enabling timers before they are actually set up? :-|

> +
> +
>         /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> 
> mem) */
>         /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1:  
> FIXME) */
> 

WBR, Sergei

  parent reply	other threads:[~2008-01-10 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 14:10 pnx8xxx: move to clocksource Vitaly Wool
2008-01-10 14:37 ` Ralf Baechle
2008-01-10 16:21 ` Sergei Shtylyov [this message]
2008-01-10 16:27   ` Ralf Baechle
2008-01-10 16:48     ` Vitaly Wool
2008-01-10 21:50       ` Ralf Baechle
2008-01-10 17:05     ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=478645FD.2090708@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=vitalywool@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox