linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Nava kishore Manne <nava.manne@xilinx.com>,
	robh+dt@kernel.org, mark.rutland@arm.com,
	michal.simek@xilinx.com, rajanv@xilinx.com, jollys@xilinx.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 3/3] nvmem: zynqmp: Added zynqmp nvmem firmware driver
Date: Sun, 16 Sep 2018 15:10:37 +0100	[thread overview]
Message-ID: <d9cab203-9637-3233-4b44-96222ba3551c@linaro.org> (raw)
In-Reply-To: <1536054754-3119-4-git-send-email-nava.manne@xilinx.com>

Few minor Nits...

I remember asking about this in the last review!

On 04/09/18 10:52, Nava kishore Manne wrote:
> This patch adds zynqmp nvmem firmware driver to access the
> SoC revision information from the hardware register.
> 
> Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
> ---
> diff --git a/drivers/nvmem/zynqmp_nvmem.c b/drivers/nvmem/zynqmp_nvmem.c
> new file mode 100644
> index 0000000..e377900
> --- /dev/null
> +++ b/drivers/nvmem/zynqmp_nvmem.c
> @@ -0,0 +1,84 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018 Xilinx, Inc.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/nvmem-provider.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/firmware/xlnx-zynqmp.h>
> +
> +#define SILICON_REVISION_MASK 0xF
> +
> +static int zynqmp_nvmem_read(void *context, unsigned int offset,
> +			     void *val, size_t bytes)
> +{
> +	int ret;
> +	int idcode, version;
> +	const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
> +
> +	if (!eemi_ops || !eemi_ops->get_chipid)
> +		return -ENXIO;
> +
> +	ret = eemi_ops->get_chipid(&idcode, &version);
> +	if (ret < 0)
> +		return ret;
> +
> +	pr_debug("Read chipid val %x %x\n", idcode, version);
> +	*(int *)val = version & SILICON_REVISION_MASK;

Use dev_dbg here.
> +
> +	return 0;
> +}
> +
> +static struct nvmem_config econfig = {
> +	.name = "zynqmp-nvmem",
> +	.owner = THIS_MODULE,
> +	.word_size = 1,
> +	.size = 1,
> +	.read_only = true,
> +};
> +
> +static const struct of_device_id zynqmp_nvmem_match[] = {
> +	{ .compatible = "xlnx,zynqmp-nvmem-fw", },
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, zynqmp_nvmem_match);
> +
> +static int zynqmp_nvmem_probe(struct platform_device *pdev)
> +{
> +	struct nvmem_device *nvmem;
> +
> +	econfig.dev = &pdev->dev;
> +	econfig.reg_read = zynqmp_nvmem_read;
> +
> +	nvmem = nvmem_register(&econfig);
You can use devm_ variant and remove the zynqmp_nvmem_remove() totally

> +	if (IS_ERR(nvmem))
> +		return PTR_ERR(nvmem);
> +
> +	platform_set_drvdata(pdev, nvmem);
> +
> +	return 0;
> +}
> +
> +static int zynqmp_nvmem_remove(struct platform_device *pdev)
> +{
> +	struct nvmem_device *nvmem = platform_get_drvdata(pdev);
> +
> +	return nvmem_unregister(nvmem);
> +}
> +

  reply	other threads:[~2018-09-16 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04  9:52 [RFC PATCH v2 0/3] Add nvmem driver support for ZynqMP Nava kishore Manne
2018-09-04  9:52 ` [RFC PATCH v2 1/3] fairmware: xilinx: Add zynqmp_pm_get_chipid() API Nava kishore Manne
2018-09-04  9:52 ` [RFC PATCH v2 2/3] dt-bindings: fpga: Add bindings for ZynqMP nvmem driver Nava kishore Manne
2018-09-16 14:10   ` Srinivas Kandagatla
2018-09-04  9:52 ` [RFC PATCH v2 3/3] nvmem: zynqmp: Added zynqmp nvmem firmware driver Nava kishore Manne
2018-09-16 14:10   ` Srinivas Kandagatla [this message]
2018-09-17  3:14     ` Nava kishore Manne

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=d9cab203-9637-3233-4b44-96222ba3551c@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jollys@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michal.simek@xilinx.com \
    --cc=nava.manne@xilinx.com \
    --cc=rajanv@xilinx.com \
    --cc=robh+dt@kernel.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).