Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1237806

Re: [PATCH 2/5] clk: berlin: add common clk driver for newer SoCs

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/5] clk: berlin: add common clk driver for newer SoCs
Date 2015-10-02 00:40 +0200
Message-ID <qeUG6-1pD-21@gated-at.bofh.it> (permalink)
References <qbwAh-7K8-1@gated-at.bofh.it> <qbwAi-7K8-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/22, Jisheng Zhang wrote:
> +
> +static u8 clk_div[] = {1, 2, 4, 6, 8, 12, 1, 1};
> +
> +static unsigned long berlin_clk_recalc_rate(struct clk_hw *hw,
> +					unsigned long parent_rate)
> +{
> +	u32 val, divider;
> +	struct berlin_clk *clk = to_berlin_clk(hw);
> +
> +	val = readl_relaxed(clk->base);
> +	if (val & CLKD3SWITCH)
> +		divider = 3;
> +	else {
> +		if (val & CLKSWITCH) {
> +			val >>= CLKSEL_SHIFT;
> +			val &= CLKSEL_MASK;
> +			divider = clk_div[val];
> +		} else
> +			divider = 1;
> +	}

How about we drop the clk_div array and use code?

		if (val & CLKSWITCH) {
			val >>= CLKSEL_SHIFT;
			val &= CLKSEL_MASK;
		}

		divider = 1
		if (val < 6)
			divider <<= val;

> +
> +	return parent_rate / divider;
> +}

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Add Marvell berlin4ct clk support Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
  [PATCH 2/5] clk: berlin: add common clk driver for newer SoCs Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
    Re: [PATCH 2/5] clk: berlin: add common clk driver for newer SoCs Stephen Boyd <sboyd@codeaurora.org> - 2015-10-02 00:40 +0200
  [PATCH 1/5] clk: berlin: add common pll driver Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
    Re: [PATCH 1/5] clk: berlin: add common pll driver Stephen Boyd <sboyd@codeaurora.org> - 2015-10-02 00:40 +0200
  [PATCH 3/5] clk: berlin: add clk support for berlin4ct Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
    Re: [PATCH 3/5] clk: berlin: add clk support for berlin4ct Stephen Boyd <sboyd@codeaurora.org> - 2015-10-02 00:50 +0200
  [PATCH 5/5] arm64: dts: berlin4ct: add pll and clock nodes Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
  [PATCH 4/5] dt-bindings: add binding for marvell berlin4ct SoC Jisheng Zhang <jszhang@marvell.com> - 2015-09-22 16:20 +0200
    Re: [PATCH 4/5] dt-bindings: add binding for marvell berlin4ct SoC Stephen Boyd <sboyd@codeaurora.org> - 2015-10-02 01:00 +0200
  Re: [PATCH 0/5] Add Marvell berlin4ct clk support Jisheng Zhang <jszhang@marvell.com> - 2015-09-23 04:00 +0200

csiph-web