linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Jamie Lentin <jm@lentin.co.uk>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Imre Kaloz <kaloz@openwrt.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v0 03/10] arm: orion5x: Add clk support for mv88f5181
Date: Sat, 16 Jul 2016 20:34:43 +0300	[thread overview]
Message-ID: <ed490090-c127-3f4f-d923-2d04918d00cb@cogentembedded.com> (raw)
In-Reply-To: <1468679348-10522-4-git-send-email-jm@lentin.co.uk>

Hello.

On 7/16/2016 5:29 PM, Jamie Lentin wrote:

> Referring to values in the u-boot port, add support for the mv88f5181
>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

[...]
> diff --git a/drivers/clk/mvebu/orion.c b/drivers/clk/mvebu/orion.c
> index fd12956..a6e5bee 100644
> --- a/drivers/clk/mvebu/orion.c
> +++ b/drivers/clk/mvebu/orion.c
> @@ -21,6 +21,76 @@ static const struct coreclk_ratio orion_coreclk_ratios[] __initconst = {
>  };
>
>  /*
> + * Orion 5181
> + */
> +
> +#define SAR_MV88F5181_TCLK_FREQ      8
> +#define SAR_MV88F5181_TCLK_FREQ_MASK 0x3
> +
> +static u32 __init mv88f5181_get_tclk_freq(void __iomem *sar)
> +{
> +	u32 opt = (readl(sar) >> SAR_MV88F5181_TCLK_FREQ) &
> +		SAR_MV88F5181_TCLK_FREQ_MASK;
> +	if (opt == 0)
> +		return 133333333;
> +	else if (opt == 1)
> +		return 150000000;
> +	else if (opt == 2)
> +		return 166666667;

    Do you know about the *switch* statement? :-)

> +	else
> +		return 0;
> +}
> +
> +#define SAR_MV88F5181_CPU_FREQ       4
> +#define SAR_MV88F5181_CPU_FREQ_MASK  0xf
> +
> +static u32 __init mv88f5181_get_cpu_freq(void __iomem *sar)
> +{
> +	u32 opt = (readl(sar) >> SAR_MV88F5181_CPU_FREQ) &
> +		SAR_MV88F5181_CPU_FREQ_MASK;
> +	if (opt == 0)
> +		return 333333333;
> +	else if (opt == 1 || opt == 2)
> +		return 400000000;
> +	else if (opt == 3)
> +		return 500000000;

    Asks to be a *switch* as well...

> +	else
> +		return 0;
> +}
> +
> +static void __init mv88f5181_get_clk_ratio(void __iomem *sar, int id,
> +					   int *mult, int *div)
> +{
> +	u32 opt = (readl(sar) >> SAR_MV88F5181_CPU_FREQ) &
> +		SAR_MV88F5181_CPU_FREQ_MASK;
> +	if (opt == 0 || opt == 1) {
> +		*mult = 1;
> +		*div  = 2;
> +	} else if (opt == 2 || opt == 3) {
> +		*mult = 1;
> +		*div  = 3;
> +	} else {
> +		*mult = 0;
> +		*div  = 1;
> +	}

     This one too...

[...]

MBR, Sergei

  parent reply	other threads:[~2016-07-16 17:34 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-16 14:28 [PATCH v0 00/10] Convert Netgear WNR854T to devicetree Jamie Lentin
2016-07-16 14:28 ` [PATCH v0 01/10] arm: orion5x: Add required properties for orion-wdt to DT node Jamie Lentin
2016-07-16 16:03   ` Andrew Lunn
2016-07-16 14:29 ` [PATCH v0 02/10] arm: orion5x: Add documentation for SoC and board bindings Jamie Lentin
2016-07-16 16:05   ` Andrew Lunn
2016-07-17 20:35   ` Rob Herring
2016-07-16 14:29 ` [PATCH v0 03/10] arm: orion5x: Add clk support for mv88f5181 Jamie Lentin
2016-07-16 16:10   ` Andrew Lunn
2016-07-16 17:34   ` Sergei Shtylyov [this message]
2016-07-17 20:36   ` Rob Herring
2016-07-16 14:29 ` [PATCH v0 04/10] arm: orion5x: Generalise mv88f5181l pinctrl support for 88f5181 Jamie Lentin
2016-07-16 16:15   ` Andrew Lunn
2016-07-17 20:40   ` Rob Herring
2016-07-16 14:29 ` [PATCH v0 05/10] arm: orion5x: Add DT include for mv88f5181 Jamie Lentin
2016-07-16 16:17   ` Andrew Lunn
2016-07-17 20:41   ` Rob Herring
2016-07-16 14:29 ` [PATCH v0 06/10] arm: orion5x: Add DT-based support for Netgear WNR854T Jamie Lentin
2016-07-16 16:34   ` Andrew Lunn
2016-07-16 16:39   ` Andrew Lunn
2016-07-16 19:10   ` Arnd Bergmann
2016-07-17  9:39     ` Jamie Lentin
2016-07-17 20:41       ` Arnd Bergmann
2016-07-18  9:44         ` Thomas Petazzoni
2016-07-18 10:06           ` Arnd Bergmann
2016-07-19  9:40             ` Jamie Lentin
2016-07-19  9:46               ` Arnd Bergmann
2016-07-17 20:51   ` Rob Herring
2016-07-19  9:46     ` Jamie Lentin
2016-07-16 14:29 ` [PATCH v0 07/10] arm: orion5x: Remove old non-DT-based WNR854T support Jamie Lentin
2016-07-16 16:36   ` Andrew Lunn
2016-07-16 14:29 ` [PATCH v0 08/10] net: phy: Try looking for a phy-handle property to find the OF node Jamie Lentin
2016-07-16 16:44   ` Andrew Lunn
2016-07-16 14:29 ` [PATCH v0 09/10] net: phy: Re-attempt custom DT configuration after configuration Jamie Lentin
2016-07-16 16:44   ` Andrew Lunn
2016-07-16 14:29 ` [PATCH v0 10/10] arm: orion5x: Configure Netgear WNR854T network port LEDs Jamie Lentin

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=ed490090-c127-3f4f-d923-2d04918d00cb@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=jm@lentin.co.uk \
    --cc=kaloz@openwrt.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@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;
as well as URLs for NNTP newsgroup(s).