All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: pwm: Add MT7628 information
@ 2018-07-25  9:52 John Crispin
       [not found] ` <20180725095209.10641-1-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: John Crispin @ 2018-07-25  9:52 UTC (permalink / raw)
  To: Thierry Reding, Rob Herring
  Cc: Matthias Brugger, linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, John Crispin

Enhance the MediaTek PWM binding with details about the IP found in the
MT7628 SoC.

Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
---
 Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-mediatek.txt b/Documentation/devicetree/bindings/pwm/pwm-mediatek.txt
index ef8bd3cb67ab..991728cb46cb 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-mediatek.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-mediatek.txt
@@ -5,11 +5,13 @@ Required properties:
    - "mediatek,mt2712-pwm": found on mt2712 SoC.
    - "mediatek,mt7622-pwm": found on mt7622 SoC.
    - "mediatek,mt7623-pwm": found on mt7623 SoC.
+   - "mediatek,mt7628-pwm": found on mt7628 SoC.
  - reg: physical base address and length of the controller's registers.
  - #pwm-cells: must be 2. See pwm.txt in this directory for a description of
    the cell format.
  - clocks: phandle and clock specifier of the PWM reference clock.
- - clock-names: must contain the following:
+ - clock-names: must contain the following, except for MT7628 which
+                has no clocks
    - "top": the top clock generator
    - "main": clock used by the PWM core
    - "pwm1-8": the eight per PWM clocks for mt2712
-- 
2.11.0

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

* [PATCH 2/2] pwm: mediatek: Add MT7628 support
       [not found] ` <20180725095209.10641-1-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
@ 2018-07-25  9:52   ` John Crispin
       [not found]     ` <20180725095209.10641-2-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  2018-08-20  9:39   ` [PATCH 1/2] dt-bindings: pwm: Add MT7628 information Thierry Reding
  1 sibling, 1 reply; 6+ messages in thread
From: John Crispin @ 2018-07-25  9:52 UTC (permalink / raw)
  To: Thierry Reding, Rob Herring
  Cc: Matthias Brugger, linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, John Crispin

Add support for MT7628. The SoC is legacy MIPS and hence has no complex
clock tree. This patch add an extra flag to the SoC specific data
indicating, that no clocks are present.

Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
---
 drivers/pwm/Kconfig        |  2 +-
 drivers/pwm/pwm-mediatek.c | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 4635cb35008c..3fae66c692c4 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -286,7 +286,7 @@ config PWM_MTK_DISP
 
 config PWM_MEDIATEK
 	tristate "MediaTek PWM support"
-	depends on ARCH_MEDIATEK || COMPILE_TEST
+	depends on ARCH_MEDIATEK || RALINK || COMPILE_TEST
 	help
 	  Generic PWM framework driver for Mediatek ARM SoC.
 
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 328c124773b2..eb6674ce995f 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -57,6 +57,7 @@ static const char * const mtk_pwm_clk_name[MTK_CLK_MAX] = {
 struct mtk_pwm_platform_data {
 	unsigned int num_pwms;
 	bool pwm45_fixup;
+	bool has_clks;
 };
 
 /**
@@ -86,6 +87,9 @@ static int mtk_pwm_clk_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
 	int ret;
 
+	if (!pc->soc->has_clks)
+		return 0;
+
 	ret = clk_prepare_enable(pc->clks[MTK_CLK_TOP]);
 	if (ret < 0)
 		return ret;
@@ -112,6 +116,9 @@ static void mtk_pwm_clk_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
 	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
 
+	if (!pc->soc->has_clks)
+		return;
+
 	clk_disable_unprepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
 	clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
 	clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
@@ -239,7 +246,7 @@ static int mtk_pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(pc->regs))
 		return PTR_ERR(pc->regs);
 
-	for (i = 0; i < data->num_pwms + 2; i++) {
+	for (i = 0; i < data->num_pwms + 2 && pc->soc->has_clks; i++) {
 		pc->clks[i] = devm_clk_get(&pdev->dev, mtk_pwm_clk_name[i]);
 		if (IS_ERR(pc->clks[i])) {
 			dev_err(&pdev->dev, "clock: %s fail: %ld\n",
@@ -274,22 +281,32 @@ static int mtk_pwm_remove(struct platform_device *pdev)
 static const struct mtk_pwm_platform_data mt2712_pwm_data = {
 	.num_pwms = 8,
 	.pwm45_fixup = false,
+	.has_clks = true,
 };
 
 static const struct mtk_pwm_platform_data mt7622_pwm_data = {
 	.num_pwms = 6,
 	.pwm45_fixup = false,
+	.has_clks = true,
 };
 
 static const struct mtk_pwm_platform_data mt7623_pwm_data = {
 	.num_pwms = 5,
 	.pwm45_fixup = true,
+	.has_clks = true,
+};
+
+static const struct mtk_pwm_platform_data mt7628_pwm_data = {
+	.num_pwms = 4,
+	.pwm45_fixup = true,
+	.has_clks = false,
 };
 
 static const struct of_device_id mtk_pwm_of_match[] = {
 	{ .compatible = "mediatek,mt2712-pwm", .data = &mt2712_pwm_data },
 	{ .compatible = "mediatek,mt7622-pwm", .data = &mt7622_pwm_data },
 	{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
+	{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, mtk_pwm_of_match);
-- 
2.11.0

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

* Re: [PATCH 2/2] pwm: mediatek: Add MT7628 support
       [not found]     ` <20180725095209.10641-2-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
@ 2018-07-25 10:22       ` Matthias Brugger
  2018-07-25 14:36       ` [SPAM][PATCH " Sean Wang
  2018-08-20  9:39       ` [PATCH " Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Matthias Brugger @ 2018-07-25 10:22 UTC (permalink / raw)
  To: John Crispin, Thierry Reding, Rob Herring
  Cc: linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r



On 25/07/18 11:52, John Crispin wrote:
> Add support for MT7628. The SoC is legacy MIPS and hence has no complex
> clock tree. This patch add an extra flag to the SoC specific data
> indicating, that no clocks are present.
> 
> Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>

Reviewed-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> ---
>  drivers/pwm/Kconfig        |  2 +-
>  drivers/pwm/pwm-mediatek.c | 19 ++++++++++++++++++-
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index 4635cb35008c..3fae66c692c4 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -286,7 +286,7 @@ config PWM_MTK_DISP
>  
>  config PWM_MEDIATEK
>  	tristate "MediaTek PWM support"
> -	depends on ARCH_MEDIATEK || COMPILE_TEST
> +	depends on ARCH_MEDIATEK || RALINK || COMPILE_TEST
>  	help
>  	  Generic PWM framework driver for Mediatek ARM SoC.
>  
> diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
> index 328c124773b2..eb6674ce995f 100644
> --- a/drivers/pwm/pwm-mediatek.c
> +++ b/drivers/pwm/pwm-mediatek.c
> @@ -57,6 +57,7 @@ static const char * const mtk_pwm_clk_name[MTK_CLK_MAX] = {
>  struct mtk_pwm_platform_data {
>  	unsigned int num_pwms;
>  	bool pwm45_fixup;
> +	bool has_clks;
>  };
>  
>  /**
> @@ -86,6 +87,9 @@ static int mtk_pwm_clk_enable(struct pwm_chip *chip, struct pwm_device *pwm)
>  	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
>  	int ret;
>  
> +	if (!pc->soc->has_clks)
> +		return 0;
> +
>  	ret = clk_prepare_enable(pc->clks[MTK_CLK_TOP]);
>  	if (ret < 0)
>  		return ret;
> @@ -112,6 +116,9 @@ static void mtk_pwm_clk_disable(struct pwm_chip *chip, struct pwm_device *pwm)
>  {
>  	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
>  
> +	if (!pc->soc->has_clks)
> +		return;
> +
>  	clk_disable_unprepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
>  	clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
>  	clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
> @@ -239,7 +246,7 @@ static int mtk_pwm_probe(struct platform_device *pdev)
>  	if (IS_ERR(pc->regs))
>  		return PTR_ERR(pc->regs);
>  
> -	for (i = 0; i < data->num_pwms + 2; i++) {
> +	for (i = 0; i < data->num_pwms + 2 && pc->soc->has_clks; i++) {
>  		pc->clks[i] = devm_clk_get(&pdev->dev, mtk_pwm_clk_name[i]);
>  		if (IS_ERR(pc->clks[i])) {
>  			dev_err(&pdev->dev, "clock: %s fail: %ld\n",
> @@ -274,22 +281,32 @@ static int mtk_pwm_remove(struct platform_device *pdev)
>  static const struct mtk_pwm_platform_data mt2712_pwm_data = {
>  	.num_pwms = 8,
>  	.pwm45_fixup = false,
> +	.has_clks = true,
>  };
>  
>  static const struct mtk_pwm_platform_data mt7622_pwm_data = {
>  	.num_pwms = 6,
>  	.pwm45_fixup = false,
> +	.has_clks = true,
>  };
>  
>  static const struct mtk_pwm_platform_data mt7623_pwm_data = {
>  	.num_pwms = 5,
>  	.pwm45_fixup = true,
> +	.has_clks = true,
> +};
> +
> +static const struct mtk_pwm_platform_data mt7628_pwm_data = {
> +	.num_pwms = 4,
> +	.pwm45_fixup = true,
> +	.has_clks = false,
>  };
>  
>  static const struct of_device_id mtk_pwm_of_match[] = {
>  	{ .compatible = "mediatek,mt2712-pwm", .data = &mt2712_pwm_data },
>  	{ .compatible = "mediatek,mt7622-pwm", .data = &mt7622_pwm_data },
>  	{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
> +	{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, mtk_pwm_of_match);
> 

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

* Re: [SPAM][PATCH 2/2] pwm: mediatek: Add MT7628 support
       [not found]     ` <20180725095209.10641-2-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  2018-07-25 10:22       ` Matthias Brugger
@ 2018-07-25 14:36       ` Sean Wang
  2018-08-20  9:39       ` [PATCH " Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Sean Wang @ 2018-07-25 14:36 UTC (permalink / raw)
  To: John Crispin
  Cc: Matthias Brugger, linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	Thierry Reding, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Rob Herring

On Wed, 2018-07-25 at 11:52 +0200, John Crispin wrote:
> Add support for MT7628. The SoC is legacy MIPS and hence has no complex
> clock tree. This patch add an extra flag to the SoC specific data
> indicating, that no clocks are present.
> 
> Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>

Acked-by: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>

> ---
>  drivers/pwm/Kconfig        |  2 +-
>  drivers/pwm/pwm-mediatek.c | 19 ++++++++++++++++++-
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index 4635cb35008c..3fae66c692c4 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -286,7 +286,7 @@ config PWM_MTK_DISP
>  
>  config PWM_MEDIATEK
>  	tristate "MediaTek PWM support"
> -	depends on ARCH_MEDIATEK || COMPILE_TEST
> +	depends on ARCH_MEDIATEK || RALINK || COMPILE_TEST
>  	help
>  	  Generic PWM framework driver for Mediatek ARM SoC.
>  
> diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
> index 328c124773b2..eb6674ce995f 100644
> --- a/drivers/pwm/pwm-mediatek.c
> +++ b/drivers/pwm/pwm-mediatek.c
> @@ -57,6 +57,7 @@ static const char * const mtk_pwm_clk_name[MTK_CLK_MAX] = {
>  struct mtk_pwm_platform_data {
>  	unsigned int num_pwms;
>  	bool pwm45_fixup;
> +	bool has_clks;
>  };
>  
>  /**
> @@ -86,6 +87,9 @@ static int mtk_pwm_clk_enable(struct pwm_chip *chip, struct pwm_device *pwm)
>  	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
>  	int ret;
>  
> +	if (!pc->soc->has_clks)
> +		return 0;
> +
>  	ret = clk_prepare_enable(pc->clks[MTK_CLK_TOP]);
>  	if (ret < 0)
>  		return ret;
> @@ -112,6 +116,9 @@ static void mtk_pwm_clk_disable(struct pwm_chip *chip, struct pwm_device *pwm)
>  {
>  	struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
>  
> +	if (!pc->soc->has_clks)
> +		return;
> +
>  	clk_disable_unprepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
>  	clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
>  	clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
> @@ -239,7 +246,7 @@ static int mtk_pwm_probe(struct platform_device *pdev)
>  	if (IS_ERR(pc->regs))
>  		return PTR_ERR(pc->regs);
>  
> -	for (i = 0; i < data->num_pwms + 2; i++) {
> +	for (i = 0; i < data->num_pwms + 2 && pc->soc->has_clks; i++) {
>  		pc->clks[i] = devm_clk_get(&pdev->dev, mtk_pwm_clk_name[i]);
>  		if (IS_ERR(pc->clks[i])) {
>  			dev_err(&pdev->dev, "clock: %s fail: %ld\n",
> @@ -274,22 +281,32 @@ static int mtk_pwm_remove(struct platform_device *pdev)
>  static const struct mtk_pwm_platform_data mt2712_pwm_data = {
>  	.num_pwms = 8,
>  	.pwm45_fixup = false,
> +	.has_clks = true,
>  };
>  
>  static const struct mtk_pwm_platform_data mt7622_pwm_data = {
>  	.num_pwms = 6,
>  	.pwm45_fixup = false,
> +	.has_clks = true,
>  };
>  
>  static const struct mtk_pwm_platform_data mt7623_pwm_data = {
>  	.num_pwms = 5,
>  	.pwm45_fixup = true,
> +	.has_clks = true,
> +};
> +
> +static const struct mtk_pwm_platform_data mt7628_pwm_data = {
> +	.num_pwms = 4,
> +	.pwm45_fixup = true,
> +	.has_clks = false,
>  };
>  
>  static const struct of_device_id mtk_pwm_of_match[] = {
>  	{ .compatible = "mediatek,mt2712-pwm", .data = &mt2712_pwm_data },
>  	{ .compatible = "mediatek,mt7622-pwm", .data = &mt7622_pwm_data },
>  	{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
> +	{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, mtk_pwm_of_match);

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

* Re: [PATCH 2/2] pwm: mediatek: Add MT7628 support
       [not found]     ` <20180725095209.10641-2-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  2018-07-25 10:22       ` Matthias Brugger
  2018-07-25 14:36       ` [SPAM][PATCH " Sean Wang
@ 2018-08-20  9:39       ` Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2018-08-20  9:39 UTC (permalink / raw)
  To: John Crispin
  Cc: Matthias Brugger, linux-pwm-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


[-- Attachment #1.1: Type: text/plain, Size: 633 bytes --]

On Wed, Jul 25, 2018 at 11:52:09AM +0200, John Crispin wrote:
> Add support for MT7628. The SoC is legacy MIPS and hence has no complex
> clock tree. This patch add an extra flag to the SoC specific data
> indicating, that no clocks are present.
> 
> Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
> ---
>  drivers/pwm/Kconfig        |  2 +-
>  drivers/pwm/pwm-mediatek.c | 19 ++++++++++++++++++-
>  2 files changed, 19 insertions(+), 2 deletions(-)

Very odd that they would use the same naming scheme for a chip that is
radically different, but they did, so:

Applied, thanks.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 200 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 1/2] dt-bindings: pwm: Add MT7628 information
       [not found] ` <20180725095209.10641-1-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  2018-07-25  9:52   ` [PATCH 2/2] pwm: mediatek: Add MT7628 support John Crispin
@ 2018-08-20  9:39   ` Thierry Reding
  1 sibling, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2018-08-20  9:39 UTC (permalink / raw)
  To: John Crispin
  Cc: Matthias Brugger, linux-pwm-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


[-- Attachment #1.1: Type: text/plain, Size: 392 bytes --]

On Wed, Jul 25, 2018 at 11:52:08AM +0200, John Crispin wrote:
> Enhance the MediaTek PWM binding with details about the IP found in the
> MT7628 SoC.
> 
> Signed-off-by: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 200 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

end of thread, other threads:[~2018-08-20  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25  9:52 [PATCH 1/2] dt-bindings: pwm: Add MT7628 information John Crispin
     [not found] ` <20180725095209.10641-1-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-07-25  9:52   ` [PATCH 2/2] pwm: mediatek: Add MT7628 support John Crispin
     [not found]     ` <20180725095209.10641-2-john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-07-25 10:22       ` Matthias Brugger
2018-07-25 14:36       ` [SPAM][PATCH " Sean Wang
2018-08-20  9:39       ` [PATCH " Thierry Reding
2018-08-20  9:39   ` [PATCH 1/2] dt-bindings: pwm: Add MT7628 information Thierry Reding

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.