devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: simon@fire.lp0.eu, jonas.gorski@gmail.com, kishon@ti.com,
	robh+dt@kernel.org, f.fainelli@gmail.com,
	bcm-kernel-feedback-list@broadcom.com, p.zabel@pengutronix.de,
	krzk@kernel.org, gregkh@linuxfoundation.org, alcooperx@gmail.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/2] phy: bcm63xx-usbh: Add BCM63xx USBH driver
Date: Mon, 13 Jul 2020 11:21:22 +0530	[thread overview]
Message-ID: <20200713055122.GA34333@vkoul-mobl> (raw)
In-Reply-To: <20200619100035.4032596-3-noltari@gmail.com>

On 19-06-20, 12:00, Álvaro Fernández Rojas wrote:
> Add BCM63xx USBH PHY driver for BMIPS.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  v5: use devm_reset_control_get_exclusive.
>  v4: several improvements:
>   - Use devm_platform_ioremap_resource.
>   - Code cleanups.
>   - Improve device mode config:
>     - Move USBH_SWAP_CONTROL device mode value to variant variable.
>     - Set USBH_UTMI_CONTROL1 register value (variant variable).
>  v3: introduce changes suggested by Florian:
>   - Add support for device mode.
>  v2: introduce changes suggested by Florian:
>   - Drop OF dependency (use device_get_match_data).
>   - Drop __initconst from variant tables.
>   - Use devm_clk_get_optional.
> 
>  drivers/phy/broadcom/Kconfig            |   9 +
>  drivers/phy/broadcom/Makefile           |   1 +
>  drivers/phy/broadcom/phy-bcm63xx-usbh.c | 457 ++++++++++++++++++++++++
>  3 files changed, 467 insertions(+)
>  create mode 100644 drivers/phy/broadcom/phy-bcm63xx-usbh.c
> 
> diff --git a/drivers/phy/broadcom/Kconfig b/drivers/phy/broadcom/Kconfig
> index b29f11c19155..a7889df8c541 100644
> --- a/drivers/phy/broadcom/Kconfig
> +++ b/drivers/phy/broadcom/Kconfig
> @@ -2,6 +2,15 @@
>  #
>  # Phy drivers for Broadcom platforms
>  #
> +config PHY_BCM63XX_USBH
> +	tristate "BCM63xx USBH PHY driver"
> +	depends on BMIPS_GENERIC || COMPILE_TEST
> +	select GENERIC_PHY
> +	default BMIPS_GENERIC

you depend on BMIPS_GENERIC and also use as default?

> +static int __init bcm63xx_usbh_phy_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct bcm63xx_usbh_phy	*usbh;
> +	const struct bcm63xx_usbh_phy_variant *variant;
> +	struct phy *phy;
> +	struct phy_provider *phy_provider;
> +
> +	usbh = devm_kzalloc(dev, sizeof(*usbh), GFP_KERNEL);
> +	if (!usbh)
> +		return -ENOMEM;
> +
> +	variant = device_get_match_data(dev);
> +	if (!variant)
> +		return -EINVAL;
> +	usbh->variant = variant;
> +
> +	usbh->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(usbh->base))
> +		return PTR_ERR(usbh->base);
> +
> +	usbh->reset = devm_reset_control_get_exclusive(dev, NULL);
> +	if (IS_ERR(usbh->reset)) {
> +		if (PTR_ERR(usbh->reset) != -EPROBE_DEFER)
> +			dev_err(dev, "failed to get reset\n");
> +		return PTR_ERR(usbh->reset);
> +	}
> +
> +	usbh->usbh_clk = devm_clk_get_optional(dev, "usbh");
> +	if (IS_ERR(usbh->usbh_clk))
> +		return PTR_ERR(usbh->usbh_clk);
> +
> +	usbh->usb_ref_clk = devm_clk_get_optional(dev, "usb_ref");
> +	if (IS_ERR(usbh->usb_ref_clk))
> +		return PTR_ERR(usbh->usb_ref_clk);
> +
> +	phy = devm_phy_create(dev, NULL, &bcm63xx_usbh_phy_ops);
> +	if (IS_ERR(phy)) {
> +		dev_err(dev, "failed to create PHY\n");
> +		return PTR_ERR(phy);
> +	}
> +
> +	platform_set_drvdata(pdev, usbh);
> +	phy_set_drvdata(phy, usbh);
> +
> +	phy_provider = devm_of_phy_provider_register(dev,
> +						     bcm63xx_usbh_phy_xlate);
> +	if (IS_ERR(phy_provider)) {
> +		dev_err(dev, "failed to register PHY provider\n");
> +		return PTR_ERR(phy_provider);
> +	}
> +
> +	dev_info(dev, "Registered BCM63xx USB PHY driver\n");

debug level?
-- 
~Vinod

  parent reply	other threads:[~2020-07-13  5:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 10:00 [PATCH v5 0/2] phy: bcm63xx-usbh: Add BCM63xx USBH driver Álvaro Fernández Rojas
2020-06-19 10:00 ` [PATCH v5 1/2] dt-bindings: phy: add bcm63xx-usbh bindings Álvaro Fernández Rojas
2020-07-09 22:11   ` Rob Herring
2020-07-13 13:55     ` Álvaro Fernández Rojas
2020-06-19 10:00 ` [PATCH v5 2/2] phy: bcm63xx-usbh: Add BCM63xx USBH driver Álvaro Fernández Rojas
2020-06-20  4:01   ` Florian Fainelli
2020-07-13  5:51   ` Vinod Koul [this message]
2020-07-13 13:59     ` Álvaro Fernández Rojas

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=20200713055122.GA34333@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=alcooperx@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonas.gorski@gmail.com \
    --cc=kishon@ti.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=simon@fire.lp0.eu \
    /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).