From: Baruch Siach <baruch@tkos.co.il> To: Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com> Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>, Gregory Clement <gregory.clement@free-electrons.com>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Miquel Raynal <miquel.raynal@free-electrons.com>, Baruch Siach <baruch@tkos.co.il> Subject: [PATCH 2/3] thermal: armada: add support for AP806 Date: Wed, 22 Nov 2017 16:42:04 +0200 [thread overview] Message-ID: <320800cce532d6ae1927b36f82b007f04c740a15.1511361725.git.baruch@tkos.co.il> (raw) In-Reply-To: <7102bb32704ac9f70ef3ae61682d50de8af61b57.1511361725.git.baruch@tkos.co.il> The AP806 component is integrated in the Armada 8k and 7k lines of processors. Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- drivers/thermal/armada_thermal.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index ae75328945f7..1f7f81628040 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -41,6 +41,10 @@ #define A375_HW_RESETn BIT(8) #define A380_HW_RESET BIT(8) +#define AP806_START BIT(0) +#define AP806_RESET BIT(1) +#define AP806_ENABLE BIT(2) + struct armada_thermal_data; /* Marvell EBU Thermal Sensor Dev Structure */ @@ -147,6 +151,18 @@ static void armada380_init_sensor(struct platform_device *pdev, } } +static void armada_ap806_init_sensor(struct platform_device *pdev, + struct armada_thermal_priv *priv) +{ + u32 reg = readl_relaxed(priv->control); + + reg &= ~AP806_RESET; + reg |= AP806_START; + reg |= AP806_ENABLE; + writel(reg, priv->control); + mdelay(10); +} + static bool armada_is_valid(struct armada_thermal_priv *priv) { unsigned long reg = readl_relaxed(priv->sensor); @@ -230,6 +246,18 @@ static const struct armada_thermal_data armada380_data = { .inverted = true, }; +static const struct armada_thermal_data armada_ap806_data = { + .is_valid = armada_is_valid, + .init_sensor = armada_ap806_init_sensor, + .is_valid_shift = 16, + .temp_shift = 0, + .temp_mask = 0x3ff, + .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", @@ -247,6 +275,10 @@ static const struct of_device_id armada_thermal_id_table[] = { .compatible = "marvell,armada380-thermal", .data = &armada380_data, }, + { + .compatible = "marvell,armada-ap806-thermal", + .data = &armada_ap806_data, + }, { /* sentinel */ }, -- 2.15.0
WARNING: multiple messages have this Message-ID (diff)
From: baruch@tkos.co.il (Baruch Siach) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] thermal: armada: add support for AP806 Date: Wed, 22 Nov 2017 16:42:04 +0200 [thread overview] Message-ID: <320800cce532d6ae1927b36f82b007f04c740a15.1511361725.git.baruch@tkos.co.il> (raw) In-Reply-To: <7102bb32704ac9f70ef3ae61682d50de8af61b57.1511361725.git.baruch@tkos.co.il> The AP806 component is integrated in the Armada 8k and 7k lines of processors. Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- drivers/thermal/armada_thermal.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index ae75328945f7..1f7f81628040 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -41,6 +41,10 @@ #define A375_HW_RESETn BIT(8) #define A380_HW_RESET BIT(8) +#define AP806_START BIT(0) +#define AP806_RESET BIT(1) +#define AP806_ENABLE BIT(2) + struct armada_thermal_data; /* Marvell EBU Thermal Sensor Dev Structure */ @@ -147,6 +151,18 @@ static void armada380_init_sensor(struct platform_device *pdev, } } +static void armada_ap806_init_sensor(struct platform_device *pdev, + struct armada_thermal_priv *priv) +{ + u32 reg = readl_relaxed(priv->control); + + reg &= ~AP806_RESET; + reg |= AP806_START; + reg |= AP806_ENABLE; + writel(reg, priv->control); + mdelay(10); +} + static bool armada_is_valid(struct armada_thermal_priv *priv) { unsigned long reg = readl_relaxed(priv->sensor); @@ -230,6 +246,18 @@ static const struct armada_thermal_data armada380_data = { .inverted = true, }; +static const struct armada_thermal_data armada_ap806_data = { + .is_valid = armada_is_valid, + .init_sensor = armada_ap806_init_sensor, + .is_valid_shift = 16, + .temp_shift = 0, + .temp_mask = 0x3ff, + .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", @@ -247,6 +275,10 @@ static const struct of_device_id armada_thermal_id_table[] = { .compatible = "marvell,armada380-thermal", .data = &armada380_data, }, + { + .compatible = "marvell,armada-ap806-thermal", + .data = &armada_ap806_data, + }, { /* sentinel */ }, -- 2.15.0
next prev parent reply other threads:[~2017-11-22 14:43 UTC|newest] Thread overview: 16+ 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 ` Baruch Siach 2017-11-22 14:42 ` Baruch Siach [this message] 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 15:24 ` Russell King - ARM Linux 2017-11-23 16:35 ` Baruch Siach 2017-11-23 16:35 ` Baruch Siach 2017-11-27 19:21 ` Eduardo Valentin 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 14:42 ` Baruch Siach 2017-11-22 16:23 ` Eduardo Valentin 2017-11-22 16:23 ` Eduardo Valentin 2017-11-22 17:41 ` Baruch Siach 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=320800cce532d6ae1927b36f82b007f04c740a15.1511361725.git.baruch@tkos.co.il \ --to=baruch@tkos.co.il \ --cc=andrew@lunn.ch \ --cc=edubezval@gmail.com \ --cc=gregory.clement@free-electrons.com \ --cc=jason@lakedaemon.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-pm@vger.kernel.org \ --cc=miquel.raynal@free-electrons.com \ --cc=rui.zhang@intel.com \ --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: 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.