Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: add an optional xhci_ck clock
@ 2019-08-23  6:40 Chunfeng Yun
  2019-08-23  6:40 ` [RESEND PATCH v2 2/2] usb: xhci-mtk: " Chunfeng Yun
  2019-08-27 22:27 ` [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: " Rob Herring
  0 siblings, 2 replies; 5+ messages in thread
From: Chunfeng Yun @ 2019-08-23  6:40 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, Rob Herring
  Cc: Matthias Brugger, Mark Rutland, Ian Campbell, Chunfeng Yun,
	linux-kernel, linux-arm-kernel, linux-usb, linux-mediatek,
	devicetree

Add a new optional clock xhci_ck

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2 changes:
  1. add the new clock at the end, suggested by Rob
---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
index 266c2d917a28..f3e4acecabe8 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
@@ -30,7 +30,8 @@ Required properties:
 	the following ones are optional:
 	"ref_ck": reference clock used by low power mode etc,
 	"mcu_ck": mcu_bus clock for register access,
-	"dma_ck": dma_bus clock for data transfer by DMA
+	"dma_ck": dma_bus clock for data transfer by DMA,
+	"xhci_ck": controller clock
 
  - phys : see usb-hcd.txt in the current directory
 
@@ -100,7 +101,7 @@ Required properties:
  - clocks : a list of phandle + clock-specifier pairs, one for each
 	entry in clock-names
  - clock-names : must contain "sys_ck", and the following ones are optional:
-	"ref_ck", "mcu_ck" and "dma_ck"
+	"ref_ck", "mcu_ck" and "dma_ck", "xhci_ck"
 
 Optional properties:
  - vbus-supply : reference to the VBUS regulator;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RESEND PATCH v2 2/2] usb: xhci-mtk: add an optional xhci_ck clock
  2019-08-23  6:40 [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: add an optional xhci_ck clock Chunfeng Yun
@ 2019-08-23  6:40 ` " Chunfeng Yun
  2019-08-23  7:43   ` Matthias Brugger
  2019-08-23  8:28   ` Mathias Nyman
  2019-08-27 22:27 ` [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: " Rob Herring
  1 sibling, 2 replies; 5+ messages in thread
From: Chunfeng Yun @ 2019-08-23  6:40 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, Rob Herring
  Cc: Matthias Brugger, Mark Rutland, Ian Campbell, Chunfeng Yun,
	linux-kernel, linux-arm-kernel, linux-usb, linux-mediatek,
	devicetree

Some SoCs may have an optional clock xhci_ck (125M or 200M), it
usually uses the same PLL as sys_ck, so support it.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2 no changes
---
 drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
 drivers/usb/host/xhci-mtk.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 026fe18972d3..b18a6baef204 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -216,6 +216,10 @@ static int xhci_mtk_clks_get(struct xhci_hcd_mtk *mtk)
 		return PTR_ERR(mtk->sys_clk);
 	}
 
+	mtk->xhci_clk = devm_clk_get_optional(dev, "xhci_ck");
+	if (IS_ERR(mtk->xhci_clk))
+		return PTR_ERR(mtk->xhci_clk);
+
 	mtk->ref_clk = devm_clk_get_optional(dev, "ref_ck");
 	if (IS_ERR(mtk->ref_clk))
 		return PTR_ERR(mtk->ref_clk);
@@ -244,6 +248,12 @@ static int xhci_mtk_clks_enable(struct xhci_hcd_mtk *mtk)
 		goto sys_clk_err;
 	}
 
+	ret = clk_prepare_enable(mtk->xhci_clk);
+	if (ret) {
+		dev_err(mtk->dev, "failed to enable xhci_clk\n");
+		goto xhci_clk_err;
+	}
+
 	ret = clk_prepare_enable(mtk->mcu_clk);
 	if (ret) {
 		dev_err(mtk->dev, "failed to enable mcu_clk\n");
@@ -261,6 +271,8 @@ static int xhci_mtk_clks_enable(struct xhci_hcd_mtk *mtk)
 dma_clk_err:
 	clk_disable_unprepare(mtk->mcu_clk);
 mcu_clk_err:
+	clk_disable_unprepare(mtk->xhci_clk);
+xhci_clk_err:
 	clk_disable_unprepare(mtk->sys_clk);
 sys_clk_err:
 	clk_disable_unprepare(mtk->ref_clk);
@@ -272,6 +284,7 @@ static void xhci_mtk_clks_disable(struct xhci_hcd_mtk *mtk)
 {
 	clk_disable_unprepare(mtk->dma_clk);
 	clk_disable_unprepare(mtk->mcu_clk);
+	clk_disable_unprepare(mtk->xhci_clk);
 	clk_disable_unprepare(mtk->sys_clk);
 	clk_disable_unprepare(mtk->ref_clk);
 }
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index 8be8c5f7ff62..5ac458b7d2e0 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -139,6 +139,7 @@ struct xhci_hcd_mtk {
 	struct regulator *vusb33;
 	struct regulator *vbus;
 	struct clk *sys_clk;	/* sys and mac clock */
+	struct clk *xhci_clk;
 	struct clk *ref_clk;
 	struct clk *mcu_clk;
 	struct clk *dma_clk;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2 2/2] usb: xhci-mtk: add an optional xhci_ck clock
  2019-08-23  6:40 ` [RESEND PATCH v2 2/2] usb: xhci-mtk: " Chunfeng Yun
@ 2019-08-23  7:43   ` Matthias Brugger
  2019-08-23  8:28   ` Mathias Nyman
  1 sibling, 0 replies; 5+ messages in thread
From: Matthias Brugger @ 2019-08-23  7:43 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman, Rob Herring
  Cc: Mark Rutland, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek, devicetree



On 23/08/2019 08:40, Chunfeng Yun wrote:
> Some SoCs may have an optional clock xhci_ck (125M or 200M), it
> usually uses the same PLL as sys_ck, so support it.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> v2 no changes
> ---
>  drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
>  drivers/usb/host/xhci-mtk.h |  1 +
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 026fe18972d3..b18a6baef204 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -216,6 +216,10 @@ static int xhci_mtk_clks_get(struct xhci_hcd_mtk *mtk)
>  		return PTR_ERR(mtk->sys_clk);
>  	}
>  
> +	mtk->xhci_clk = devm_clk_get_optional(dev, "xhci_ck");
> +	if (IS_ERR(mtk->xhci_clk))
> +		return PTR_ERR(mtk->xhci_clk);
> +
>  	mtk->ref_clk = devm_clk_get_optional(dev, "ref_ck");
>  	if (IS_ERR(mtk->ref_clk))
>  		return PTR_ERR(mtk->ref_clk);
> @@ -244,6 +248,12 @@ static int xhci_mtk_clks_enable(struct xhci_hcd_mtk *mtk)
>  		goto sys_clk_err;
>  	}
>  
> +	ret = clk_prepare_enable(mtk->xhci_clk);
> +	if (ret) {
> +		dev_err(mtk->dev, "failed to enable xhci_clk\n");
> +		goto xhci_clk_err;
> +	}
> +
>  	ret = clk_prepare_enable(mtk->mcu_clk);
>  	if (ret) {
>  		dev_err(mtk->dev, "failed to enable mcu_clk\n");
> @@ -261,6 +271,8 @@ static int xhci_mtk_clks_enable(struct xhci_hcd_mtk *mtk)
>  dma_clk_err:
>  	clk_disable_unprepare(mtk->mcu_clk);
>  mcu_clk_err:
> +	clk_disable_unprepare(mtk->xhci_clk);
> +xhci_clk_err:
>  	clk_disable_unprepare(mtk->sys_clk);
>  sys_clk_err:
>  	clk_disable_unprepare(mtk->ref_clk);
> @@ -272,6 +284,7 @@ static void xhci_mtk_clks_disable(struct xhci_hcd_mtk *mtk)
>  {
>  	clk_disable_unprepare(mtk->dma_clk);
>  	clk_disable_unprepare(mtk->mcu_clk);
> +	clk_disable_unprepare(mtk->xhci_clk);
>  	clk_disable_unprepare(mtk->sys_clk);
>  	clk_disable_unprepare(mtk->ref_clk);
>  }
> diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
> index 8be8c5f7ff62..5ac458b7d2e0 100644
> --- a/drivers/usb/host/xhci-mtk.h
> +++ b/drivers/usb/host/xhci-mtk.h
> @@ -139,6 +139,7 @@ struct xhci_hcd_mtk {
>  	struct regulator *vusb33;
>  	struct regulator *vbus;
>  	struct clk *sys_clk;	/* sys and mac clock */
> +	struct clk *xhci_clk;
>  	struct clk *ref_clk;
>  	struct clk *mcu_clk;
>  	struct clk *dma_clk;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2 2/2] usb: xhci-mtk: add an optional xhci_ck clock
  2019-08-23  6:40 ` [RESEND PATCH v2 2/2] usb: xhci-mtk: " Chunfeng Yun
  2019-08-23  7:43   ` Matthias Brugger
@ 2019-08-23  8:28   ` Mathias Nyman
  1 sibling, 0 replies; 5+ messages in thread
From: Mathias Nyman @ 2019-08-23  8:28 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman, Rob Herring
  Cc: Matthias Brugger, Mark Rutland, Ian Campbell, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek, devicetree

On 23.8.2019 9.40, Chunfeng Yun wrote:
> Some SoCs may have an optional clock xhci_ck (125M or 200M), it
> usually uses the same PLL as sys_ck, so support it.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: add an optional xhci_ck clock
  2019-08-23  6:40 [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: add an optional xhci_ck clock Chunfeng Yun
  2019-08-23  6:40 ` [RESEND PATCH v2 2/2] usb: xhci-mtk: " Chunfeng Yun
@ 2019-08-27 22:27 ` " Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2019-08-27 22:27 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger,
	Mark Rutland, Ian Campbell, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek, devicetree

On Fri, 23 Aug 2019 14:40:24 +0800, Chunfeng Yun wrote:
> Add a new optional clock xhci_ck
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> v2 changes:
>   1. add the new clock at the end, suggested by Rob
> ---
>  Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23  6:40 [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: add an optional xhci_ck clock Chunfeng Yun
2019-08-23  6:40 ` [RESEND PATCH v2 2/2] usb: xhci-mtk: " Chunfeng Yun
2019-08-23  7:43   ` Matthias Brugger
2019-08-23  8:28   ` Mathias Nyman
2019-08-27 22:27 ` [RESEND PATCH v2 1/2] dt-bindings: usb: mtk-xhci: " Rob Herring

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org linux-usb@archiver.kernel.org
	public-inbox-index linux-usb


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/ public-inbox