public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: devicetree@vger.kernel.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	gregkh@linuxfoundation.org, simon@fire.lp0.eu,
	alcooperx@gmail.com, linux-kernel@vger.kernel.org,
	krzk@kernel.org, kishon@ti.com, robh+dt@kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Jonas Gorski <jonas.gorski@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/2] phy: bcm63xx-usbh: Add BCM63xx USBH driver
Date: Mon, 13 Jul 2020 15:59:59 +0200	[thread overview]
Message-ID: <A0B096B5-A130-44AA-8CC3-6AD136B5107F@gmail.com> (raw)
In-Reply-To: <20200713055122.GA34333@vkoul-mobl>

Hi Vinod,

> El 13 jul 2020, a las 7:51, Vinod Koul <vkoul@kernel.org> escribió:
> 
> 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?

PHY_CYGNUS_PCIE, PHY_BCM_SR_USB, PHY_NS2_USB_DRD, PHY_BRCM_USB and PHY_BCM_SR_PCIE are doing that, so I just copied it ¯\_(ツ)_/¯.
I will remove the default since there are other SoCs in BMIPS_GENERIC that won’t need this.

> 
>> +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?

Yeah, I will change it.

> -- 
> ~Vinod


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2020-07-13 14:01 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
2020-07-13 13:59     ` Álvaro Fernández Rojas [this message]

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=A0B096B5-A130-44AA-8CC3-6AD136B5107F@gmail.com \
    --to=noltari@gmail.com \
    --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=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=simon@fire.lp0.eu \
    --cc=vkoul@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