mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master] aiodev: imx_thermal: fix breakage after device tree sync
Date: Mon, 11 Sep 2023 14:35:08 +0200	[thread overview]
Message-ID: <20230911123508.c54vltou62amkg7h@pengutronix.de> (raw)
In-Reply-To: <20230911122204.2698005-1-a.fatoum@pengutronix.de>

On 23-09-11, Ahmad Fatoum wrote:
> fsl,tempmon-data is a deprecated property that has been replaced
> upstream by a NVMEM cell pointing at the calibration value and so
> made it into barebox breaking the driver.
> 
> Switch to using the new property to fix the regression.

The Linux driver code can handle the deprecated binding still, in case
of old DTBs. Since the DTBS are builtin to barebox updating the DTB
without the barebox binary make no sense. Anyway, do we need to take the
deprecated binding into account as well like Linux does?

Regards,
  Marco

> Fixes: abef60363d8e ("dts: update to v5.8-rc1")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/aiodev/imx_thermal.c | 25 ++++---------------------
>  1 file changed, 4 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/aiodev/imx_thermal.c b/drivers/aiodev/imx_thermal.c
> index 3263519cb241..2693ad05e0e5 100644
> --- a/drivers/aiodev/imx_thermal.c
> +++ b/drivers/aiodev/imx_thermal.c
> @@ -22,6 +22,7 @@
>  #include <linux/math64.h>
>  #include <linux/log2.h>
>  #include <linux/clk.h>
> +#include <linux/nvmem-consumer.h>
>  #include <mach/imx/imx6-anadig.h>
>  #include <io.h>
>  #include <aiodev.h>
> @@ -29,7 +30,6 @@
>  
>  #define FACTOR0			10000000
>  #define MEASURE_FREQ		327
> -#define OCOTP_ANA1_OFFSET      (0xE * sizeof(uint32_t))
>  
>  struct imx_thermal_data {
>  	int c1, c2;
> @@ -109,30 +109,13 @@ static int imx_thermal_read(struct aiochannel *chan, int *val)
>  static int imx_thermal_probe(struct device *dev)
>  {
>  	uint32_t ocotp_ana1;
> -	struct device_node *node;
>  	struct imx_thermal_data *imx_thermal;
> -	struct cdev *ocotp;
>  	int t1, n1, t2, n2;
>  	int ret;
>  
> -	node = of_parse_phandle(dev->of_node, "fsl,tempmon-data", 0);
> -	if (!node) {
> -		dev_err(dev, "No calibration data source\n");
> -		return -ENODEV;
> -	}
> -
> -	ocotp = cdev_by_device_node(node);
> -	if (!ocotp) {
> -		dev_err(dev, "No OCOTP character device\n");
> -		return -ENODEV;
> -	}
> -
> -	ret = cdev_read(ocotp, &ocotp_ana1, sizeof(ocotp_ana1),
> -			OCOTP_ANA1_OFFSET, 0);
> -	if (ret != sizeof(ocotp_ana1)) {
> -		dev_err(dev, "Failed to read calibration data\n");
> -		return ret < 0 ? ret : -EIO;
> -	}
> +	ret = nvmem_cell_read_variable_le_u32(dev, "calib", &ocotp_ana1);
> +	if (ret)
> +		return ret;
>  
>  	imx_thermal = xzalloc(sizeof(*imx_thermal));
>  	imx_thermal->base = syscon_base_lookup_by_phandle(dev->of_node,
> -- 
> 2.39.2
> 
> 
> 



  reply	other threads:[~2023-09-11 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 12:22 Ahmad Fatoum
2023-09-11 12:35 ` Marco Felsch [this message]
2023-09-11 12:36   ` Ahmad Fatoum
2023-09-11 12:43     ` Marco Felsch

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=20230911123508.c54vltou62amkg7h@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@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