public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: chunfeng.yun@mediatek.com (Chunfeng Yun)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/RFT usb-next v1 1/6] usb: mtu3: remove custom USB PHY handling
Date: Thu, 25 Jan 2018 10:47:05 +0800	[thread overview]
Message-ID: <1516848425.3717.12.camel@mhfsdcap03> (raw)
In-Reply-To: <20180125001639.14681-2-martin.blumenstingl@googlemail.com>

Hi,

On Thu, 2018-01-25 at 01:16 +0100, Martin Blumenstingl wrote:
> The new PHY wrapper is now wired up in the core HCD code. This means
> that PHYs are now controlled (initialized, enabled, disabled, exited)
> without requiring any host-driver specific code.
> Remove the custom USB PHY handling from the mtu3 driver as the core HCD
> code now handles this.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  drivers/usb/mtu3/mtu3_plat.c | 101 -------------------------------------------
>  1 file changed, 101 deletions(-)
> 
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 628d5ce356ca..a894ddf25bcd 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -44,62 +44,6 @@ int ssusb_check_clocks(struct ssusb_mtk *ssusb, u32 ex_clks)
>  	return 0;
>  }
>  
> -static int ssusb_phy_init(struct ssusb_mtk *ssusb)
> -{
> -	int i;
> -	int ret;
> -
> -	for (i = 0; i < ssusb->num_phys; i++) {
> -		ret = phy_init(ssusb->phys[i]);
> -		if (ret)
> -			goto exit_phy;
> -	}
> -	return 0;
> -
> -exit_phy:
> -	for (; i > 0; i--)
> -		phy_exit(ssusb->phys[i - 1]);
> -
> -	return ret;
> -}
> -
> -static int ssusb_phy_exit(struct ssusb_mtk *ssusb)
> -{
> -	int i;
> -
> -	for (i = 0; i < ssusb->num_phys; i++)
> -		phy_exit(ssusb->phys[i]);
> -
> -	return 0;
> -}
> -
> -static int ssusb_phy_power_on(struct ssusb_mtk *ssusb)
> -{
> -	int i;
> -	int ret;
> -
> -	for (i = 0; i < ssusb->num_phys; i++) {
> -		ret = phy_power_on(ssusb->phys[i]);
> -		if (ret)
> -			goto power_off_phy;
> -	}
> -	return 0;
> -
> -power_off_phy:
> -	for (; i > 0; i--)
> -		phy_power_off(ssusb->phys[i - 1]);
> -
> -	return ret;
> -}
> -
> -static void ssusb_phy_power_off(struct ssusb_mtk *ssusb)
> -{
> -	unsigned int i;
> -
> -	for (i = 0; i < ssusb->num_phys; i++)
> -		phy_power_off(ssusb->phys[i]);
> -}
> -
>  static int ssusb_clks_enable(struct ssusb_mtk *ssusb)
>  {
>  	int ret;
> @@ -162,24 +106,8 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  	if (ret)
>  		goto clks_err;
>  
> -	ret = ssusb_phy_init(ssusb);
> -	if (ret) {
> -		dev_err(ssusb->dev, "failed to init phy\n");
> -		goto phy_init_err;
> -	}
> -
> -	ret = ssusb_phy_power_on(ssusb);
> -	if (ret) {
> -		dev_err(ssusb->dev, "failed to power on phy\n");
> -		goto phy_err;
> -	}
> -
>  	return 0;
>  
> -phy_err:
> -	ssusb_phy_exit(ssusb);
> -phy_init_err:
> -	ssusb_clks_disable(ssusb);
>  clks_err:
>  	regulator_disable(ssusb->vusb33);
>  vusb33_err:
> @@ -190,8 +118,6 @@ static void ssusb_rscs_exit(struct ssusb_mtk *ssusb)
>  {
>  	ssusb_clks_disable(ssusb);
>  	regulator_disable(ssusb->vusb33);
> -	ssusb_phy_power_off(ssusb);
> -	ssusb_phy_exit(ssusb);
>  }
>  
>  static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
> @@ -222,7 +148,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  	struct device *dev = &pdev->dev;
>  	struct regulator *vbus;
>  	struct resource *res;
> -	int i;
>  	int ret;
>  
>  	ssusb->vusb33 = devm_regulator_get(&pdev->dev, "vusb33");
> @@ -249,25 +174,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  	if (IS_ERR(ssusb->dma_clk))
>  		return PTR_ERR(ssusb->dma_clk);
>  
> -	ssusb->num_phys = of_count_phandle_with_args(node,
> -			"phys", "#phy-cells");
> -	if (ssusb->num_phys > 0) {
> -		ssusb->phys = devm_kcalloc(dev, ssusb->num_phys,
> -					sizeof(*ssusb->phys), GFP_KERNEL);
> -		if (!ssusb->phys)
> -			return -ENOMEM;
> -	} else {
> -		ssusb->num_phys = 0;
> -	}
> -
> -	for (i = 0; i < ssusb->num_phys; i++) {
> -		ssusb->phys[i] = devm_of_phy_get_by_index(dev, node, i);
> -		if (IS_ERR(ssusb->phys[i])) {
> -			dev_err(dev, "failed to get phy-%d\n", i);
> -			return PTR_ERR(ssusb->phys[i]);
> -		}
> -	}
> -
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ippc");
>  	ssusb->ippc_base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(ssusb->ippc_base))
> @@ -457,7 +363,6 @@ static int __maybe_unused mtu3_suspend(struct device *dev)
>  		return 0;
>  
>  	ssusb_host_disable(ssusb, true);
> -	ssusb_phy_power_off(ssusb);
>  	ssusb_clks_disable(ssusb);
>  	ssusb_wakeup_set(ssusb, true);
>  
> @@ -480,16 +385,10 @@ static int __maybe_unused mtu3_resume(struct device *dev)
>  	if (ret)
>  		goto clks_err;
>  
> -	ret = ssusb_phy_power_on(ssusb);
> -	if (ret)
> -		goto phy_err;
> -
>  	ssusb_host_enable(ssusb);
>  
>  	return 0;
>  
> -phy_err:
> -	ssusb_clks_disable(ssusb);
>  clks_err:
>  	return ret;
>  }
This patch will affect device function when works as device only mode.
Please abandon it, and I will modify it if need after the patch series
of "initialize (multiple) PHYs for a HCD" are picked up.

Thanks a lot

  reply	other threads:[~2018-01-25  2:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  0:16 [RFC/RFT usb-next v1 0/6] remove driver-specific "multiple PHY" handling Martin Blumenstingl
2018-01-25  0:16 ` [RFC/RFT usb-next v1 1/6] usb: mtu3: remove custom USB PHY handling Martin Blumenstingl
2018-01-25  2:47   ` Chunfeng Yun [this message]
2018-01-25 20:03     ` Martin Blumenstingl
2018-01-25  0:16 ` [RFC/RFT usb-next v1 2/6] usb: host: xhci-mtk: " Martin Blumenstingl
2018-01-25  0:16 ` [RFC/RFT usb-next v1 3/6] usb: host: ehci-platform: " Martin Blumenstingl
2018-01-25 15:55   ` Alan Stern
2018-01-25  0:16 ` [RFC/RFT usb-next v1 4/6] usb: host: ohci-platform: " Martin Blumenstingl
2018-01-25  0:16 ` [RFC/RFT usb-next v1 5/6] usb: chipidea: do not set the "phy" field in struct usb_hcd Martin Blumenstingl
2018-01-26  9:06   ` Peter Chen
2018-01-26 21:05     ` Martin Blumenstingl
2018-01-29  3:30       ` Peter Chen
2018-02-04 21:39         ` Martin Blumenstingl
2018-02-05  7:25           ` Peter Chen
2018-01-25  0:16 ` [RFC/RFT usb-next v1 6/6] usb: core: hcd: remove support for initializing a single PHY Martin Blumenstingl

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=1516848425.3717.12.camel@mhfsdcap03 \
    --to=chunfeng.yun@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox