All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: "Pali Rohár" <pali@kernel.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Gregory CLEMENT <gregory.clement@bootlin.com>,
	Tomasz Maciej Nowak <tmn505@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Chen <peter.chen@nxp.com>
Subject: Re: [PATCH] usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720
Date: Mon, 28 Dec 2020 13:11:49 +0100	[thread overview]
Message-ID: <20201228131149.30907b44@nic.cz> (raw)
In-Reply-To: <20201223162403.10897-1-pali@kernel.org>

Hi Pali and Miquel,

On Wed, 23 Dec 2020 17:24:03 +0100
Pali Rohár <pali@kernel.org> wrote:

>  int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
>  {
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
> +	struct device *dev = hcd->self.controller;
> +	struct phy *phy;
> +	int ret;
>  
>  	/* Without reset on resume, the HC won't work at all */
>  	xhci->quirks |= XHCI_RESET_ON_RESUME;
>  
> +	/* Old bindings miss the PHY handle */
> +	phy = of_phy_get(dev->of_node, "usb3-phy");
> +	if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
> +		return -EPROBE_DEFER;
> +	else if (IS_ERR(phy))
> +		goto phy_out;
> +
> +	ret = phy_init(phy);
> +	if (ret)
> +		goto phy_put;
> +
> +	ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
> +	if (ret)
> +		goto phy_exit;
> +
> +	ret = phy_power_on(phy);
> +	if (ret == -EOPNOTSUPP) {
> +		/* Skip initializatin of XHCI PHY when it is unsupported by firmware */
> +		dev_warn(dev, "PHY unsupported by firmware\n");
> +		xhci->quirks |= XHCI_SKIP_PHY_INIT;
> +	}
> +	if (ret)
> +		goto phy_exit;

I am not sure if this is the correct way to check whether PHY_INIT
should be skipped.

Moreover the subsequent phy_power_off:

> +
> +	phy_power_off(phy);

won't power off the PHY, because the corresponding handler in ATF is
currently empty. 

I guess the patch needs to be in kernel if users are unwilling to upgrade
ATF firmware.

The SMC calls for Marvell's comphy are designed to be generic for
several Marvell platforms (the constants are the same and so one), but
we still have different drivers for them anyway.

Maybe it would be better to just not use the ATF implementation at all,
and implement the comphy driver for A3720 entirely in kernel...

Miquel, what do you think?

Marek

  parent reply	other threads:[~2020-12-28 12:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 16:24 [PATCH] usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720 Pali Rohár
2020-12-24  5:54 ` Peter Chen
2020-12-24 12:53   ` Pali Rohár
2020-12-24 13:15     ` Peter Chen
2020-12-24 13:24       ` Pali Rohár
2020-12-24 13:29         ` Pali Rohár
2020-12-25  0:16           ` Peter Chen
2020-12-28 12:11 ` Marek Behun [this message]
2020-12-28 13:22   ` Pali Rohár
2021-01-30 16:31 ` Tomasz Maciej Nowak
2021-01-30 16:35   ` Pali Rohár
2021-01-30 16:37     ` Tomasz Maciej Nowak
2021-02-01 15:08 ` [PATCH v2] " Pali Rohár
2021-02-02  1:53   ` Yoshihiro Shimoda
2021-02-02 18:41   ` Greg Kroah-Hartman
2021-02-03  9:46     ` Mathias Nyman

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=20201228131149.30907b44@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=pali@kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=tmn505@gmail.com \
    /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.