All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
	linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/6] usb: mtu3: add reference clock
Date: Thu, 19 Jan 2017 13:22:56 +0100	[thread overview]
Message-ID: <7fc9de99-4bef-ddf2-c5fe-985f8d2348d2@gmail.com> (raw)
In-Reply-To: <1484719707-12107-2-git-send-email-chunfeng.yun@mediatek.com>



On 18/01/17 07:08, Chunfeng Yun wrote:
> usually, the reference clock comes from 26M oscillator directly,
> but some SoCs are not, add it for compatibility.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/mtu3/mtu3.h      |    1 +
>  drivers/usb/mtu3/mtu3_plat.c |   21 +++++++++++++++++++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
> index ba9df71..aa6fd6a 100644
> --- a/drivers/usb/mtu3/mtu3.h
> +++ b/drivers/usb/mtu3/mtu3.h
> @@ -225,6 +225,7 @@ struct ssusb_mtk {
>  	/* common power & clock */
>  	struct regulator *vusb33;
>  	struct clk *sys_clk;
> +	struct clk *ref_clk;
>  	/* otg */
>  	struct otg_switch_mtk otg_switch;
>  	enum usb_dr_mode dr_mode;
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 6344859..19a345d 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -123,7 +123,13 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  	ret = clk_prepare_enable(ssusb->sys_clk);
>  	if (ret) {
>  		dev_err(ssusb->dev, "failed to enable sys_clk\n");
> -		goto clk_err;
> +		goto sys_clk_err;
> +	}
> +
> +	ret = clk_prepare_enable(ssusb->ref_clk);
> +	if (ret) {
> +		dev_err(ssusb->dev, "failed to enable ref_clk\n");
> +		goto ref_clk_err;
>  	}
>
>  	ret = ssusb_phy_init(ssusb);
> @@ -143,8 +149,10 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  phy_err:
>  	ssusb_phy_exit(ssusb);
>  phy_init_err:
> +	clk_disable_unprepare(ssusb->ref_clk);
> +ref_clk_err:
>  	clk_disable_unprepare(ssusb->sys_clk);
> -clk_err:
> +sys_clk_err:
>  	regulator_disable(ssusb->vusb33);
>  vusb33_err:
>
> @@ -154,6 +162,7 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  static void ssusb_rscs_exit(struct ssusb_mtk *ssusb)
>  {
>  	clk_disable_unprepare(ssusb->sys_clk);
> +	clk_disable_unprepare(ssusb->ref_clk);
>  	regulator_disable(ssusb->vusb33);
>  	ssusb_phy_power_off(ssusb);
>  	ssusb_phy_exit(ssusb);
> @@ -216,6 +225,12 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  		return PTR_ERR(ssusb->sys_clk);
>  	}
>
> +	ssusb->ref_clk = devm_clk_get(dev, "ref_ck");
> +	if (IS_ERR(ssusb->ref_clk)) {
> +		dev_err(dev, "failed to get ref clock\n");
> +		return PTR_ERR(ssusb->ref_clk);
> +	}
> +

That would break older dts bindings, right?
ref_ck must be optional for the code.

Regards,
Matthias

WARNING: multiple messages have this Message-ID (diff)
From: matthias.bgg@gmail.com (Matthias Brugger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] usb: mtu3: add reference clock
Date: Thu, 19 Jan 2017 13:22:56 +0100	[thread overview]
Message-ID: <7fc9de99-4bef-ddf2-c5fe-985f8d2348d2@gmail.com> (raw)
In-Reply-To: <1484719707-12107-2-git-send-email-chunfeng.yun@mediatek.com>



On 18/01/17 07:08, Chunfeng Yun wrote:
> usually, the reference clock comes from 26M oscillator directly,
> but some SoCs are not, add it for compatibility.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/mtu3/mtu3.h      |    1 +
>  drivers/usb/mtu3/mtu3_plat.c |   21 +++++++++++++++++++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
> index ba9df71..aa6fd6a 100644
> --- a/drivers/usb/mtu3/mtu3.h
> +++ b/drivers/usb/mtu3/mtu3.h
> @@ -225,6 +225,7 @@ struct ssusb_mtk {
>  	/* common power & clock */
>  	struct regulator *vusb33;
>  	struct clk *sys_clk;
> +	struct clk *ref_clk;
>  	/* otg */
>  	struct otg_switch_mtk otg_switch;
>  	enum usb_dr_mode dr_mode;
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 6344859..19a345d 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -123,7 +123,13 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  	ret = clk_prepare_enable(ssusb->sys_clk);
>  	if (ret) {
>  		dev_err(ssusb->dev, "failed to enable sys_clk\n");
> -		goto clk_err;
> +		goto sys_clk_err;
> +	}
> +
> +	ret = clk_prepare_enable(ssusb->ref_clk);
> +	if (ret) {
> +		dev_err(ssusb->dev, "failed to enable ref_clk\n");
> +		goto ref_clk_err;
>  	}
>
>  	ret = ssusb_phy_init(ssusb);
> @@ -143,8 +149,10 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  phy_err:
>  	ssusb_phy_exit(ssusb);
>  phy_init_err:
> +	clk_disable_unprepare(ssusb->ref_clk);
> +ref_clk_err:
>  	clk_disable_unprepare(ssusb->sys_clk);
> -clk_err:
> +sys_clk_err:
>  	regulator_disable(ssusb->vusb33);
>  vusb33_err:
>
> @@ -154,6 +162,7 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb)
>  static void ssusb_rscs_exit(struct ssusb_mtk *ssusb)
>  {
>  	clk_disable_unprepare(ssusb->sys_clk);
> +	clk_disable_unprepare(ssusb->ref_clk);
>  	regulator_disable(ssusb->vusb33);
>  	ssusb_phy_power_off(ssusb);
>  	ssusb_phy_exit(ssusb);
> @@ -216,6 +225,12 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  		return PTR_ERR(ssusb->sys_clk);
>  	}
>
> +	ssusb->ref_clk = devm_clk_get(dev, "ref_ck");
> +	if (IS_ERR(ssusb->ref_clk)) {
> +		dev_err(dev, "failed to get ref clock\n");
> +		return PTR_ERR(ssusb->ref_clk);
> +	}
> +

That would break older dts bindings, right?
ref_ck must be optional for the code.

Regards,
Matthias

  reply	other threads:[~2017-01-19 12:22 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18  6:08 [PATCH 1/6] usb: mtu3: get resources that cause deferred probe earlier Chunfeng Yun
2017-01-18  6:08 ` Chunfeng Yun
2017-01-18  6:08 ` Chunfeng Yun
     [not found] ` <1484719707-12107-1-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-01-18  6:08   ` [PATCH 2/6] usb: mtu3: add reference clock Chunfeng Yun
2017-01-18  6:08     ` Chunfeng Yun
2017-01-18  6:08     ` Chunfeng Yun
2017-01-19 12:22     ` Matthias Brugger [this message]
2017-01-19 12:22       ` Matthias Brugger
2017-01-20  2:20       ` Chunfeng Yun
2017-01-20  2:20         ` Chunfeng Yun
2017-01-20  2:20         ` Chunfeng Yun
2017-01-24 23:23         ` Matthias Brugger
2017-01-24 23:23           ` Matthias Brugger
2017-02-06  7:03           ` Chunfeng Yun
2017-02-06  7:03             ` Chunfeng Yun
2017-02-06  7:03             ` Chunfeng Yun
2017-01-18  6:08   ` [PATCH 3/6] usb: xhci-mtk: " Chunfeng Yun
2017-01-18  6:08     ` Chunfeng Yun
2017-01-18  6:08     ` Chunfeng Yun
2017-01-18  6:08 ` [PATCH 4/6] arm64: dts: mt8173: add reference clock for usb Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
2017-01-19  9:37   ` Greg Kroah-Hartman
2017-01-19  9:37     ` Greg Kroah-Hartman
2017-01-19  9:37     ` Greg Kroah-Hartman
2017-01-19 12:23     ` Matthias Brugger
2017-01-19 12:23       ` Matthias Brugger
2017-01-18  6:08 ` [PATCH 5/6] dt-bindings: mt8173-xhci: add reference clock Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
     [not found]   ` <1484719707-12107-5-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-01-21 20:10     ` Rob Herring
2017-01-21 20:10       ` Rob Herring
2017-01-21 20:10       ` Rob Herring
2017-01-21 20:12   ` Rob Herring
2017-01-21 20:12     ` Rob Herring
2017-01-22  1:53     ` Chunfeng Yun
2017-01-22  1:53       ` Chunfeng Yun
2017-01-22  1:53       ` Chunfeng Yun
2017-01-18  6:08 ` [PATCH 6/6] dt-bindings: mt8173-mtu3: " Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
2017-01-18  6:08   ` Chunfeng Yun
2017-01-21 20:11   ` Rob Herring
2017-01-21 20:11     ` Rob Herring
2017-01-21 20:11     ` Rob Herring
2017-01-22  1:49     ` Chunfeng Yun
2017-01-22  1:49       ` Chunfeng Yun
2017-01-22  1:49       ` Chunfeng Yun
2017-01-23 14:02       ` Rob Herring
2017-01-23 14:02         ` Rob Herring
2017-01-23 14:02         ` Rob Herring
     [not found]         ` <CAL_JsqJg7=ykNkAbMeLqFT6HK-pK+FQAK7ZS_UMMy8ftrGM-KA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-06  7:06           ` Chunfeng Yun
2017-02-06  7:06             ` Chunfeng Yun
2017-02-06  7:06             ` Chunfeng Yun

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=7fc9de99-4bef-ddf2-c5fe-985f8d2348d2@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathias.nyman@intel.com \
    --cc=robh+dt@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 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.