From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> To: Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, Eduardo Valentin <edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>, Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>, Gregory Clement <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>, Sebastian Hesselbarth <sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>, Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>, linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> Subject: [PATCH v2 3/4] thermal: armada: add support for CP110 Date: Sun, 3 Dec 2017 13:11:23 +0200 [thread overview] Message-ID: <d48c916a2502f9c75e9ea4ba41300e2ffbb254d8.1512299484.git.baruch@tkos.co.il> (raw) In-Reply-To: <f8c589337a4fb78852eadf15058e8f8d132d4dc0.1512299484.git.baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> 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-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> --- v2: No change --- 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 0eb82097571f..59b75f63945d 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -73,6 +73,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, @@ -142,12 +143,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); /* Reset hardware once */ if (!(reg & A380_HW_RESET)) { reg |= A380_HW_RESET; - writel(reg, priv->control); + writel(reg, control_msb); mdelay(10); } } @@ -266,6 +269,19 @@ static const struct armada_thermal_data armada_ap806_data = { .signed_sample = 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", @@ -287,6 +303,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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: baruch@tkos.co.il (Baruch Siach) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] thermal: armada: add support for CP110 Date: Sun, 3 Dec 2017 13:11:23 +0200 [thread overview] Message-ID: <d48c916a2502f9c75e9ea4ba41300e2ffbb254d8.1512299484.git.baruch@tkos.co.il> (raw) In-Reply-To: <f8c589337a4fb78852eadf15058e8f8d132d4dc0.1512299484.git.baruch@tkos.co.il> 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> --- v2: No change --- 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 0eb82097571f..59b75f63945d 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -73,6 +73,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, @@ -142,12 +143,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); /* Reset hardware once */ if (!(reg & A380_HW_RESET)) { reg |= A380_HW_RESET; - writel(reg, priv->control); + writel(reg, control_msb); mdelay(10); } } @@ -266,6 +269,19 @@ static const struct armada_thermal_data armada_ap806_data = { .signed_sample = 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", @@ -287,6 +303,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-12-03 11:11 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-03 11:11 [PATCH v2 1/4] dt-bindings: thermal/armada: describe AP806 and CP110 Baruch Siach 2017-12-03 11:11 ` Baruch Siach 2017-12-03 11:11 ` [PATCH v2 2/4] thermal: armada: add support for AP806 Baruch Siach 2017-12-03 11:11 ` Baruch Siach [not found] ` <f8c589337a4fb78852eadf15058e8f8d132d4dc0.1512299484.git.baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> 2017-12-03 11:11 ` Baruch Siach [this message] 2017-12-03 11:11 ` [PATCH v2 3/4] thermal: armada: add support for CP110 Baruch Siach 2017-12-11 15:09 ` Miquel RAYNAL 2017-12-11 15:09 ` Miquel RAYNAL 2017-12-11 15:27 ` Baruch Siach 2017-12-11 15:27 ` Baruch Siach 2017-12-11 17:02 ` Gregory CLEMENT 2017-12-11 17:02 ` Gregory CLEMENT [not found] ` <87y3m9qjt2.fsf-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2017-12-13 8:38 ` Baruch Siach 2017-12-13 8:38 ` Baruch Siach 2017-12-13 8:55 ` Miquel RAYNAL 2017-12-13 8:55 ` Miquel RAYNAL 2017-12-13 9:10 ` Baruch Siach 2017-12-13 9:10 ` Baruch Siach [not found] ` <20171213091040.jwsphlax4yidm4qp-MwjkAAnuF3khR1HGirfZ1z4kX+cae0hd@public.gmane.org> 2017-12-13 9:21 ` Gregory CLEMENT 2017-12-13 9:21 ` Gregory CLEMENT 2017-12-13 9:13 ` Gregory CLEMENT 2017-12-13 9:13 ` Gregory CLEMENT [not found] ` <874lovq9cx.fsf-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2017-12-13 9:42 ` Baruch Siach 2017-12-13 9:42 ` Baruch Siach 2017-12-03 11:11 ` [PATCH v2 4/4] thermal: armada: use msleep for long delays Baruch Siach 2017-12-03 11:11 ` Baruch Siach 2017-12-04 22:33 ` [PATCH v2 1/4] dt-bindings: thermal/armada: describe AP806 and CP110 Rob Herring 2017-12-04 22:33 ` Rob Herring
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=d48c916a2502f9c75e9ea4ba41300e2ffbb254d8.1512299484.git.baruch@tkos.co.il \ --to=baruch-nswtu9s1w3p6gbpvegmw2w@public.gmane.org \ --cc=andrew-g2DYL2Zd6BY@public.gmane.org \ --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \ --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \ --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \ --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \ --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \ --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.