From: edubezval@gmail.com (Eduardo Valentin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] thermal: armada: add support for CP110
Date: Wed, 22 Nov 2017 08:23:36 -0800 [thread overview]
Message-ID: <20171122162335.GA25339@localhost.localdomain> (raw)
In-Reply-To: <adccb0e7b20cc128663701eadcf6ebce412dfe5e.1511361725.git.baruch@tkos.co.il>
On Wed, Nov 22, 2017 at 04:42:05PM +0200, Baruch Siach wrote:
> The CP110 component is integrated in the Armada 8k and 7k lines of processors.
>
> This patch also adds an option of offset to the MSB of the control
> register. The existing DT binding for Armada 38x refers to a single 32 bit
> control register. It turns out that this is actually only the MSB of the
> control area. Changing the binding to fix that would break existing DT files,
> so the Armada 38x binding is left as is.
>
> The new CP110 binding increases the size of the control area to 64 bits, thus
> moving the MSB to offset 4.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> drivers/thermal/armada_thermal.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 1f7f81628040..542db578ce36 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -72,6 +72,7 @@ struct armada_thermal_data {
> unsigned int temp_shift;
> unsigned int temp_mask;
> unsigned int is_valid_shift;
> + unsigned int control_msb_offset;
> };
>
> static void armadaxp_init_sensor(struct platform_device *pdev,
> @@ -141,12 +142,14 @@ static void armada375_init_sensor(struct platform_device *pdev,
> static void armada380_init_sensor(struct platform_device *pdev,
> struct armada_thermal_priv *priv)
> {
> - unsigned long reg = readl_relaxed(priv->control);
> + void __iomem *control_msb =
> + priv->control + priv->data->control_msb_offset;
> + unsigned long reg = readl_relaxed(control_msb);
Will existing users of this function work with default
control_msb_offset? presumably 0, right?
>
> /* Reset hardware once */
> if (!(reg & A380_HW_RESET)) {
> reg |= A380_HW_RESET;
> - writel(reg, priv->control);
> + writel(reg, control_msb);
> mdelay(10);
> }
> }
> @@ -258,6 +261,19 @@ static const struct armada_thermal_data armada_ap806_data = {
> .inverted = true,
> };
>
> +static const struct armada_thermal_data armada_cp110_data = {
> + .is_valid = armada_is_valid,
> + .init_sensor = armada380_init_sensor,
> + .is_valid_shift = 10,
> + .temp_shift = 0,
> + .temp_mask = 0x3ff,
> + .control_msb_offset = 4,
> + .coef_b = 1172499100UL,
> + .coef_m = 2000096UL,
> + .coef_div = 4201,
> + .inverted = true,
> +};
> +
> static const struct of_device_id armada_thermal_id_table[] = {
> {
> .compatible = "marvell,armadaxp-thermal",
> @@ -279,6 +295,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
> .compatible = "marvell,armada-ap806-thermal",
> .data = &armada_ap806_data,
> },
> + {
> + .compatible = "marvell,armada-cp110-thermal",
> + .data = &armada_cp110_data,
> + },
> {
> /* sentinel */
> },
> --
> 2.15.0
>
next prev parent reply other threads:[~2017-11-22 16:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 14:42 [PATCH 1/3] dt-bindings: thermal/armada: describe AP806 and CP110 Baruch Siach
2017-11-22 14:42 ` [PATCH 2/3] thermal: armada: add support for AP806 Baruch Siach
2017-11-23 15:24 ` Russell King - ARM Linux
2017-11-23 16:35 ` Baruch Siach
2017-11-27 19:21 ` Eduardo Valentin
2017-11-22 14:42 ` [PATCH 3/3] thermal: armada: add support for CP110 Baruch Siach
2017-11-22 16:23 ` Eduardo Valentin [this message]
2017-11-22 17:41 ` Baruch Siach
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=20171122162335.GA25339@localhost.localdomain \
--to=edubezval@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).