public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: khilman@baylibre•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
Date: Thu, 08 Sep 2016 12:35:32 -0700	[thread overview]
Message-ID: <m260q6jibf.fsf@baylibre.com> (raw)
In-Reply-To: <20160904213152.25837-5-martin.blumenstingl@googlemail.com> (Martin Blumenstingl's message of "Sun, 4 Sep 2016 23:31:49 +0200")

Martin Blumenstingl <martin.blumenstingl@googlemail•com> writes:

> This is a new driver for the USB PHY found in Meson8b and GXBB SoCs.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail•com>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre•com>

I tested this on meson-gxbb-p200 with USB host and a mass storage
device.

Tested-by: Kevin Hilman <khilman@baylibre•com>

A minor question/comment below, for you and for Kishon...

[...]

> +static int phy_meson_usb2_probe(struct platform_device *pdev)
> +{
> +	struct phy_meson_usb2_priv *priv;
> +	struct resource *res;
> +	struct phy *phy;
> +	struct phy_provider *phy_provider;
> +	int ret;
> +
> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	priv->regs = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(priv->regs))
> +		return PTR_ERR(priv->regs);
> +
> +	priv->clk_usb_general = devm_clk_get(&pdev->dev, "usb_general");
> +	if (IS_ERR(priv->clk_usb_general))
> +		return PTR_ERR(priv->clk_usb_general);
> +
> +	priv->clk_usb = devm_clk_get(&pdev->dev, "usb");
> +	if (IS_ERR(priv->clk_usb))
> +		return PTR_ERR(priv->clk_usb);
> +
> +	priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1);
> +	if (priv->dr_mode == USB_DR_MODE_UNKNOWN) {
> +		dev_err(&pdev->dev,
> +			"missing dual role configuration of the controller\n");
> +		return -EINVAL;
> +	}
> +
> +	phy = devm_phy_create(&pdev->dev, NULL, &phy_meson_usb2_ops);
> +	if (IS_ERR(phy)) {
> +		dev_err(&pdev->dev, "failed to create PHY\n");
> +		return PTR_ERR(phy);
> +	}
> +
> +	if (usb_reset_refcnt++ == 0) {
> +		ret = device_reset(&pdev->dev);
> +		if (ret) {
> +			dev_err(&phy->dev, "Failed to reset USB PHY\n");
> +			return ret;
> +		}
> +	}

The ref count + reset here looks like something that could/should be
handled in a runtime PM callback.

IOW, there should be a pm_runtime_get_sync() here, and in the
->runtime_resume() callback, the device_reset() would be called.
Runtime PM does the refcounting, and only calls ->runtime_resume() on
the 0 -> 1 transition.

This isn't a big deal for now, so I'll let Kishon decide, but using
runtime PM from the start will help enabling other PM features later.

Kevin

  reply	other threads:[~2016-09-08 19:35 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 21:31 [PATCH 0/7] usb/phy: Add Amlogic Meson8b and GXBB USB support Martin Blumenstingl
2016-09-04 21:31 ` [PATCH 1/7] clk: gxbb: expose USB clocks Martin Blumenstingl
2016-09-07  0:33   ` Stephen Boyd
2016-09-07 21:32     ` Martin Blumenstingl
2016-09-07 22:14       ` Stephen Boyd
2016-09-08  2:24         ` Kevin Hilman
2016-09-07 21:28   ` Stephen Boyd
2016-09-08 19:24     ` Kevin Hilman
2016-09-04 21:31 ` [PATCH 2/7] usb: dwc2: add support for Meson8b and GXBB SoCs Martin Blumenstingl
2016-09-07 21:04   ` John Youn
2016-09-04 21:31 ` [PATCH 3/7] Documentation: dt-bindings: Add documentation for the Meson USB2 PHYs Martin Blumenstingl
2016-09-04 21:31 ` [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB Martin Blumenstingl
2016-09-08 19:35   ` Kevin Hilman [this message]
2016-09-08 19:40     ` Ben Dooks
2016-09-08 19:52     ` Martin Blumenstingl
2016-09-08 20:20       ` Ben Dooks
2016-09-08 20:42         ` Kevin Hilman
2016-09-08 20:53           ` Ben Dooks
2016-09-08 21:48             ` Martin Blumenstingl
2016-09-09 15:33               ` Kevin Hilman
2016-09-09 16:14                 ` Martin Blumenstingl
2016-09-09 17:04                   ` Kevin Hilman
2016-09-09 17:21                   ` Ben Dooks
2016-09-09 20:37                     ` Martin Blumenstingl
2016-09-16  8:19                   ` Kishon Vijay Abraham I
2016-09-16 13:47                     ` Arnd Bergmann
2016-09-18 19:56                     ` Martin Blumenstingl
2016-09-19  4:59                       ` Kishon Vijay Abraham I
2016-09-19  7:37                         ` Arnd Bergmann
2016-09-09 20:36                 ` Martin Blumenstingl
2016-09-11 13:44                   ` Martin Blumenstingl
2016-09-12 17:32                     ` Kevin Hilman
2016-09-13 15:28                   ` Philipp Zabel
2016-09-13 18:38                     ` Martin Blumenstingl
2016-09-14  0:59                       ` Kevin Hilman
2016-09-14  8:36                         ` Philipp Zabel
2016-09-14  8:37                         ` Philipp Zabel
2016-09-14 21:09                           ` Martin Blumenstingl
2016-09-14  8:37                       ` Philipp Zabel
2016-09-14 21:23                         ` Martin Blumenstingl
2016-09-15 10:30                           ` Philipp Zabel
2016-09-04 21:31 ` [PATCH 5/7] ARM64: meson-gxbb: add USB Nodes Martin Blumenstingl
2016-09-05  0:23   ` Andreas Färber
2016-09-04 21:31 ` [PATCH 6/7] ARM64: meson-gxbb-p20x: Enable " Martin Blumenstingl
2016-09-04 21:31 ` [PATCH 7/7] ARM64: meson-gxbb-vega-s95: " Martin Blumenstingl
2016-09-11 13:41 ` [PATCH v2 0/6] usb/phy: Add Amlogic Meson8b and GXBB USB support Martin Blumenstingl
2016-09-11 13:41   ` [PATCH v2 1/6] usb: dwc2: add support for Meson8b and GXBB SoCs Martin Blumenstingl
2016-09-14 16:11     ` Kevin Hilman
2016-09-14 18:12       ` John Youn
2016-09-14 18:17         ` Kevin Hilman
2016-09-14 18:26           ` John Youn
2016-09-14 18:36             ` Kevin Hilman
2016-09-20 14:27     ` Rob Herring
2016-09-11 13:41   ` [PATCH v2 2/6] Documentation: dt-bindings: Add documentation for the Meson USB2 PHYs Martin Blumenstingl
2016-09-20 14:29     ` Rob Herring
2016-09-21 18:38       ` Kevin Hilman
2016-09-11 13:41   ` [PATCH v2 3/6] phy: meson: add USB2 PHY support for Meson8b and GXBB Martin Blumenstingl
2016-09-14 16:06     ` Kevin Hilman
2016-09-17  4:17       ` Kishon Vijay Abraham I
2016-09-19 16:42         ` Kevin Hilman
2016-09-20  5:01           ` Kishon Vijay Abraham I
2016-09-14 21:30     ` Martin Blumenstingl
2016-09-11 13:41   ` [PATCH v2 4/6] ARM64: meson-gxbb: add USB Nodes Martin Blumenstingl
2016-09-15 22:10     ` Kevin Hilman
2016-09-11 13:41   ` [PATCH v2 5/6] ARM64: meson-gxbb-p20x: Enable " Martin Blumenstingl
2016-09-14 18:05     ` Kevin Hilman
2016-09-15 22:09       ` Kevin Hilman
2016-09-11 13:41   ` [PATCH v2 6/6] ARM64: meson-gxbb-vega-s95: " Martin Blumenstingl
2016-09-15 22:10     ` Kevin Hilman
2016-10-01 12:18 ` [PATCH v3 0/3] usb/phy: Add Amlogic Meson8b and GXBB USB support Martin Blumenstingl
2016-10-01 12:18   ` [PATCH v3 1/3] Documentation: dt-bindings: update the meson-usb2-phy example Martin Blumenstingl
2016-10-09  1:28     ` Rob Herring
2016-10-01 12:18   ` [PATCH v3 2/3] Documentation: dt-bindings: rename meson-usb2-phy to meson8b-usb2-phy Martin Blumenstingl
2016-10-09  1:28     ` Rob Herring
2016-10-01 12:19   ` [PATCH v3 3/3] phy: meson: add USB2 PHY support for Meson8b and GXBB Martin Blumenstingl
2016-10-13 20:27   ` [PATCH v3 0/3] usb/phy: Add Amlogic Meson8b and GXBB USB support Martin Blumenstingl
2016-10-19 10:52     ` Kishon Vijay Abraham I

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=m260q6jibf.fsf@baylibre.com \
    --to=khilman@baylibre$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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