[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <152150786513.254778.147481994658886771@swboyd.mtv.corp.google.com>
Date: Mon, 19 Mar 2018 18:04:25 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
afaerber@...e.de, mark.rutland@....com, mturquette@...libre.com,
robh+dt@...nel.org
Cc: liuwei@...ions-semi.com, mp-cs@...ions-semi.com,
96boards@...obotics.com, devicetree@...r.kernel.org,
davem@...emloft.net, mchehab@...nel.org,
daniel.thompson@...aro.org, amit.kucheria@...aro.org,
viresh.kumar@...aro.org, hzhang@...obotics.com,
bdong@...obotics.com, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
manivannanece23@...il.com,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: Re: [PATCH v5 05/12] clk: actions: Add gate clock support
Quoting Manivannan Sadhasivam (2018-03-17 03:09:45)
> diff --git a/drivers/clk/actions/owl-gate.c b/drivers/clk/actions/owl-gate.c
> new file mode 100644
> index 000000000000..25dd94ac0f35
> --- /dev/null
> +++ b/drivers/clk/actions/owl-gate.c
> @@ -0,0 +1,77 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +//
> +// OWL gate clock driver
> +//
> +// Copyright (c) 2014 Actions Semi Inc.
> +// Author: David Liu <liuwei@...ions-semi.com>
> +//
> +// Copyright (c) 2018 Linaro Ltd.
> +// Author: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> +
> +#include <linux/clk-provider.h>
> +#include <linux/regmap.h>
> +
> +#include "owl-gate.h"
> +
> +void clk_gate_set(const struct owl_clk_common *common,
owl_gate_set?
> + const struct owl_gate_hw *gate_hw, bool enable)
> +{
> + int set = gate_hw->gate_flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0;
> + u32 reg;
> +
> + set ^= enable;
> +
> + regmap_read(common->regmap, gate_hw->reg, ®);
> +
> + if (set)
> + reg |= BIT(gate_hw->bit_idx);
> + else
> + reg &= ~BIT(gate_hw->bit_idx);
> +
> + regmap_write(common->regmap, gate_hw->reg, reg);
> +}
> +
> +static void owl_gate_disable(struct clk_hw *hw)
> +{
> + struct owl_gate *gate = hw_to_owl_gate(hw);
> + struct owl_clk_common *common = &gate->common;
> +
> + clk_gate_set(common, &gate->gate_hw, false);
> +}
> +
> +static int owl_gate_enable(struct clk_hw *hw)
> +{
> + struct owl_gate *gate = hw_to_owl_gate(hw);
> + struct owl_clk_common *common = &gate->common;
> +
> + clk_gate_set(common, &gate->gate_hw, true);
> +
> + return 0;
> +}
> +
> +int clk_is_enabled(const struct owl_clk_common *common,
Can this be called owl_gate_is_enabled?
> + const struct owl_gate_hw *gate_hw)
> +{
> + u32 reg;
> +
> + regmap_read(common->regmap, gate_hw->reg, ®);
> +
> + if (gate_hw->gate_flags & CLK_GATE_SET_TO_DISABLE)
> + reg ^= BIT(gate_hw->bit_idx);
> +
> + return !!(reg & BIT(gate_hw->bit_idx));
> +}
> +
> +static int owl_gate_is_enabled(struct clk_hw *hw)
> +{
> + struct owl_gate *gate = hw_to_owl_gate(hw);
> + struct owl_clk_common *common = &gate->common;
> +
> + return clk_is_enabled(common, &gate->gate_hw);
> +}
> +
> +const struct clk_ops owl_gate_ops = {
Everything going to be builtin? If anything is a module then this needs
to be exported.
> + .disable = owl_gate_disable,
> + .enable = owl_gate_enable,
> + .is_enabled = owl_gate_is_enabled,
> +};
Otherwise looks good.
Powered by blists - more mailing lists