All of lore.kernel.org
 help / color / mirror / Atom feed
From: b.galvani@gmail.com (Beniamino Galvani)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: meson: reset: Add reset controller for MesonX SoCs
Date: Sun, 12 Oct 2014 18:03:39 +0200	[thread overview]
Message-ID: <20141012160339.GA16293@gmail.com> (raw)
In-Reply-To: <1413125679-24443-2-git-send-email-carlo@caione.org>

On Sun, Oct 12, 2014 at 04:54:37PM +0200, Carlo Caione wrote:
> This patch adds support for the reset controller found on the Amlogic
> MesonX SoCs. For several devices in the AO (Always-On) power domain, it
> is possible to reset them by programming a specific bit in a register.

Hi Carlo,

> [...]
> +
> +static int meson_reset_probe(struct platform_device *pdev)
> +{
> +	struct meson_reset_data *data;
> +	struct resource *res;
> +
> +	/*
> +	 * The binding was mainlined without the required property.
> +	 * Do not continue, when we encounter an old DT.
> +	 */
> +	if (!of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) {
> +		dev_err(&pdev->dev, "%s missing #reset-cells property\n",
> +			pdev->dev.of_node->full_name);
> +		return -EINVAL;
> +	}

Probably the above comment was taken from another driver but is not
relevant here.

> +
> +	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	data->membase = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(data->membase))
> +		return PTR_ERR(data->membase);
> +
> +	spin_lock_init(&data->lock);
> +
> +	data->rcdev.owner = THIS_MODULE;
> +	data->rcdev.nr_resets = BITS_PER_LONG;
> +	data->rcdev.ops = &meson_reset_ops;
> +	data->rcdev.of_node = pdev->dev.of_node;
> +	reset_controller_register(&data->rcdev);
> +
> +	return 0;
> +}
> +
> +static int meson_reset_remove(struct platform_device *pdev)
> +{
> +	struct meson_reset_data *data = platform_get_drvdata(pdev);

Don't you need to call platform_set_drvdata() in the probe() function
for this to be valid?

> +
> +	reset_controller_unregister(&data->rcdev);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id meson_reset_dt_ids[] = {
> +	{ .compatible = "amlogic,meson6-rst-mgr-ao", },
> +	{ /* sentinel */ },
> +};
> +
> +static struct platform_driver meson_reset_driver = {
> +	.probe	= meson_reset_probe,
> +	.remove	= meson_reset_remove,
> +	.driver = {
> +		.name		= "meson-reset",
> +		.owner		= THIS_MODULE,

I believe you can drop the owner field.

Beniamino

WARNING: multiple messages have this Message-ID (diff)
From: Beniamino Galvani <b.galvani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Cc: p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jerry.cao-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org,
	victor.wan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org
Subject: Re: [PATCH 1/3] ARM: meson: reset: Add reset controller for MesonX SoCs
Date: Sun, 12 Oct 2014 18:03:39 +0200	[thread overview]
Message-ID: <20141012160339.GA16293@gmail.com> (raw)
In-Reply-To: <1413125679-24443-2-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

On Sun, Oct 12, 2014 at 04:54:37PM +0200, Carlo Caione wrote:
> This patch adds support for the reset controller found on the Amlogic
> MesonX SoCs. For several devices in the AO (Always-On) power domain, it
> is possible to reset them by programming a specific bit in a register.

Hi Carlo,

> [...]
> +
> +static int meson_reset_probe(struct platform_device *pdev)
> +{
> +	struct meson_reset_data *data;
> +	struct resource *res;
> +
> +	/*
> +	 * The binding was mainlined without the required property.
> +	 * Do not continue, when we encounter an old DT.
> +	 */
> +	if (!of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) {
> +		dev_err(&pdev->dev, "%s missing #reset-cells property\n",
> +			pdev->dev.of_node->full_name);
> +		return -EINVAL;
> +	}

Probably the above comment was taken from another driver but is not
relevant here.

> +
> +	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	data->membase = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(data->membase))
> +		return PTR_ERR(data->membase);
> +
> +	spin_lock_init(&data->lock);
> +
> +	data->rcdev.owner = THIS_MODULE;
> +	data->rcdev.nr_resets = BITS_PER_LONG;
> +	data->rcdev.ops = &meson_reset_ops;
> +	data->rcdev.of_node = pdev->dev.of_node;
> +	reset_controller_register(&data->rcdev);
> +
> +	return 0;
> +}
> +
> +static int meson_reset_remove(struct platform_device *pdev)
> +{
> +	struct meson_reset_data *data = platform_get_drvdata(pdev);

Don't you need to call platform_set_drvdata() in the probe() function
for this to be valid?

> +
> +	reset_controller_unregister(&data->rcdev);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id meson_reset_dt_ids[] = {
> +	{ .compatible = "amlogic,meson6-rst-mgr-ao", },
> +	{ /* sentinel */ },
> +};
> +
> +static struct platform_driver meson_reset_driver = {
> +	.probe	= meson_reset_probe,
> +	.remove	= meson_reset_remove,
> +	.driver = {
> +		.name		= "meson-reset",
> +		.owner		= THIS_MODULE,

I believe you can drop the owner field.

Beniamino
--
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

  reply	other threads:[~2014-10-12 16:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 14:54 [PATCH 0/3] ARM: meson: Add reset controller Carlo Caione
2014-10-12 14:54 ` Carlo Caione
2014-10-12 14:54 ` [PATCH 1/3] ARM: meson: reset: Add reset controller for MesonX SoCs Carlo Caione
2014-10-12 14:54   ` Carlo Caione
2014-10-12 16:03   ` Beniamino Galvani [this message]
2014-10-12 16:03     ` Beniamino Galvani
2014-10-12 16:10     ` Carlo Caione
2014-10-12 16:10       ` Carlo Caione
2014-10-12 14:54 ` [PATCH 2/3] ARM: meson: DTSI: Enable reset controller Carlo Caione
2014-10-12 14:54   ` Carlo Caione
2014-10-12 14:54 ` [PATCH 3/3] ARM: meson: docs: Add docs for MesonX " Carlo Caione
2014-10-12 14:54   ` Carlo Caione

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=20141012160339.GA16293@gmail.com \
    --to=b.galvani@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 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.