Skip to contentSkip to conversation

Convert MSM to common clock framework

PATCH In review Stephen Boyd 4 participants 29 messages Sep 21, 2012 – Sep 26, 2012

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Convert MSM to common clock framework

This patchset moves the existing MSM clock code and affected drivers to the common clock framework. A prerequisite of moving to the common clock framework is to use clk_prepare() and clk_enable() so the first few patches migrate drivers to that call (clk_prepare() is a no-op on MSM right now). It also removes some custom clock APIs that MSM provides and finally moves the proc_comm clock code to the common struct clock.

This patch series will be used as the foundation of the MSM 8660/8960 clock code that I plan to send out soon.

These patches have one dependency on the devm_clk_register() function which I already posted to the list[1]. They're based on linux-next-20120917.

Stephen Boyd (10):
usb: otg: msm: Convert to clk_prepare/unprepare
msm_sdcc: Convert to clk_prepare/unprepare
msm: iommu: Convert to clk_prepare/unprepare
msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()
ARM: msm: Remove custom clk_set_flags() API
ARM: msm: Remove custom clk_set_{max,min}_rate() API
ARM: msm: Remove clock-7x30.h include file
ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver
ARM: msm: Make proc_comm clock control into a platform driver
ARM: msm: Migrate to common clock framework

 arch/arm/Kconfig                       |   1 +
 arch/arm/mach-msm/Makefile             |  10 +-
 arch/arm/mach-msm/board-halibut.c      |   2 +-
 arch/arm/mach-msm/board-msm7x30.c      |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c      |   2 +-
 arch/arm/mach-msm/board-trout-panel.c  |  19 ++--
 arch/arm/mach-msm/board-trout.c        |   3 +-
 arch/arm/mach-msm/clock-7x30.h         | 155 ------------------------------
 arch/arm/mach-msm/clock-debug.c        | 130 --------------------------
 arch/arm/mach-msm/clock-pcom.c         | 149 ++++++++++++++++++-----------
 arch/arm/mach-msm/clock-pcom.h         |  31 +++---
 arch/arm/mach-msm/clock.c              | 166 +--------------------------------
 arch/arm/mach-msm/clock.h              |  51 +++-------
 arch/arm/mach-msm/devices-msm7x00.c    |  12 ++-
 arch/arm/mach-msm/devices-msm7x30.c    |  13 ++-
 arch/arm/mach-msm/devices-qsd8x50.c    |  11 ++-
 arch/arm/mach-msm/devices.h            |  15 +--
 arch/arm/mach-msm/dma.c                |   5 +-
 arch/arm/mach-msm/include/mach/board.h |   5 -
 arch/arm/mach-msm/include/mach/clk.h   |   9 --
 drivers/iommu/msm_iommu_dev.c          |  20 ++--
 drivers/mmc/host/msm_sdcc.c            |  14 ++-
 drivers/usb/otg/msm_otg.c              |  38 ++++----
 23 files changed, 222 insertions(+), 641 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

[1] https://lkml.org/lkml/2012/9/19/28

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH 1/10 usb: otg: msm: Convert to clk_prepare/unprepare

Add calls to clk_prepare and unprepare so that MSM can migrate to the common clock framework.

---
 drivers/usb/otg/msm_otg.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/usb/otg/msm_otg.c +19 -19
index 9f5fc90..2ae0639 100644
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
 			motg->pdata->otg_control == OTG_PMIC_CONTROL)
 		writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-	clk_disable(motg->pclk);
-	clk_disable(motg->clk);
+	clk_disable_unprepare(motg->pclk);
+	clk_disable_unprepare(motg->clk);
 	if (motg->core_clk)
-		clk_disable(motg->core_clk);
+		clk_disable_unprepare(motg->core_clk);
 
 	if (!IS_ERR(motg->pclk_src))
-		clk_disable(motg->pclk_src);
+		clk_disable_unprepare(motg->pclk_src);
 
 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
@@ -552,12 +552,12 @@ static int msm_otg_resume(struct msm_otg *motg)
 		return 0;
 
 	if (!IS_ERR(motg->pclk_src))
-		clk_enable(motg->pclk_src);
+		clk_prepare_enable(motg->pclk_src);
 
-	clk_enable(motg->pclk);
-	clk_enable(motg->clk);
+	clk_prepare_enable(motg->pclk);
+	clk_prepare_enable(motg->clk);
 	if (motg->core_clk)
-		clk_enable(motg->core_clk);
+		clk_prepare_enable(motg->core_clk);
 
 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
@@ -1468,7 +1468,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 		if (IS_ERR(motg->pclk_src))
 			goto put_clk;
 		clk_set_rate(motg->pclk_src, INT_MAX);
-		clk_enable(motg->pclk_src);
+		clk_prepare_enable(motg->pclk_src);
 	} else
 		motg->pclk_src = ERR_PTR(-ENOENT);
 
@@ -1511,8 +1511,8 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 		goto free_regs;
 	}
 
-	clk_enable(motg->clk);
-	clk_enable(motg->pclk);
+	clk_prepare_enable(motg->clk);
+	clk_prepare_enable(motg->pclk);
 
 	ret = msm_hsusb_init_vddcx(motg, 1);
 	if (ret) {
@@ -1532,7 +1532,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 	}
 
 	if (motg->core_clk)
-		clk_enable(motg->core_clk);
+		clk_prepare_enable(motg->core_clk);
 
 	writel(0, USB_USBINTR);
 	writel(0, USB_OTGSC);
@@ -1579,8 +1579,8 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 free_irq:
 	free_irq(motg->irq, motg);
 disable_clks:
-	clk_disable(motg->pclk);
-	clk_disable(motg->clk);
+	clk_disable_unprepare(motg->pclk);
+	clk_disable_unprepare(motg->clk);
 ldo_exit:
 	msm_hsusb_ldo_init(motg, 0);
 vddcx_exit:
@@ -1593,7 +1593,7 @@ put_core_clk:
 	clk_put(motg->pclk);
 put_pclk_src:
 	if (!IS_ERR(motg->pclk_src)) {
-		clk_disable(motg->pclk_src);
+		clk_disable_unprepare(motg->pclk_src);
 		clk_put(motg->pclk_src);
 	}
 put_clk:
@@ -1643,12 +1643,12 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 	if (cnt >= PHY_SUSPEND_TIMEOUT_USEC)
 		dev_err(phy->dev, "Unable to suspend PHY\n");
 
-	clk_disable(motg->pclk);
-	clk_disable(motg->clk);
+	clk_disable_unprepare(motg->pclk);
+	clk_disable_unprepare(motg->clk);
 	if (motg->core_clk)
-		clk_disable(motg->core_clk);
+		clk_disable_unprepare(motg->core_clk);
 	if (!IS_ERR(motg->pclk_src)) {
-		clk_disable(motg->pclk_src);
+		clk_disable_unprepare(motg->pclk_src);
 		clk_put(motg->pclk_src);
 	}
 	msm_hsusb_ldo_init(motg, 0);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#2 lore raw

Re: [PATCH 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

Hi..

Quoted 15 lines · Stephen Boyd

Add calls to clk_prepare and unprepare so that MSM can migrate to the common clock framework.

---
 drivers/usb/otg/msm_otg.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/usb/otg/msm_otg.c +0 -0
index 9f5fc90..2ae0639 100644
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
                        motg->pdata->otg_control == OTG_PMIC_CONTROL)

drivers/usb/otg/msm_otg.c static int msm_otg_suspend(struct msm_otg *motg) · line 521

Quoted 10 lines
drivers/usb/otg/msm_otg.c +3 -3
                writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-       clk_disable(motg->pclk);
-       clk_disable(motg->clk);
+       clk_disable_unprepare(motg->pclk);
+       clk_disable_unprepare(motg->clk);
        if (motg->core_clk)
-               clk_disable(motg->core_clk);
+               clk_disable_unprepare(motg->core_clk);
 

I was under assumption that system suspend/resume might be called from the interrupt context. If that is case then its not appropriate to call clk_prepare/unprepare here right? or my understanding is not correct????

--
Pankaj Jangra

#3 lore raw

Re: [PATCH 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

Quoted 9 lines · Pankaj Jangra
Quoted 8 lines · Stephen Boyd
drivers/usb/otg/msm_otg.c +0 -0
index 9f5fc90..2ae0639 100644
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
                        motg->pdata->otg_control == OTG_PMIC_CONTROL)
                writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
Quoted 11 lines

drivers/usb/otg/msm_otg.c static int msm_otg_suspend(struct msm_otg *motg) · line 521

Quoted 8 lines
drivers/usb/otg/msm_otg.c +3 -3
-       clk_disable(motg->pclk);
-       clk_disable(motg->clk);
+       clk_disable_unprepare(motg->pclk);
+       clk_disable_unprepare(motg->clk);
        if (motg->core_clk)
-               clk_disable(motg->core_clk);
+               clk_disable_unprepare(motg->core_clk);
 

I was under assumption that system suspend/resume might be called from the interrupt context. If that is case then its not appropriate to call clk_prepare/unprepare here right? or my understanding is not correct????

Well we call disable_irq() at the top of this suspend function so I suspect your understanding is incorrect. disable_irq() can call schedule(). There are also a bunch of regulator calls in msm_hsusb_ldo_set_mode() that this suspend function calls (almost all regulator calls grab a mutex).

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#4 lore raw

Re: [PATCH 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

Quoted 22 lines · Stephen Boyd
Quoted 9 lines · Pankaj Jangra
Quoted 8 lines · Stephen Boyd
drivers/usb/otg/msm_otg.c +0 -0
index 9f5fc90..2ae0639 100644
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
                        motg->pdata->otg_control == OTG_PMIC_CONTROL)
                writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
Quoted 11 lines

drivers/usb/otg/msm_otg.c static int msm_otg_suspend(struct msm_otg *motg) · line 521

Quoted 8 lines
drivers/usb/otg/msm_otg.c +3 -3
-       clk_disable(motg->pclk);
-       clk_disable(motg->clk);
+       clk_disable_unprepare(motg->pclk);
+       clk_disable_unprepare(motg->clk);
        if (motg->core_clk)
-               clk_disable(motg->core_clk);
+               clk_disable_unprepare(motg->core_clk);
 

I was under assumption that system suspend/resume might be called from the interrupt context. If that is case then its not appropriate to call clk_prepare/unprepare here right? or my understanding is not correct????

Quoted 5 lines

Well we call disable_irq() at the top of this suspend function so I suspect your understanding is incorrect. disable_irq() can call schedule(). There are also a bunch of regulator calls in msm_hsusb_ldo_set_mode() that this suspend function calls (almost all regulator calls grab a mutex).

Ok, might be i am worng because in acpuclock driver of msm on codeaurora tree, i have seen in commit text saying that it can be called from suspend/resume in interrupt context .
So i was assuming that. Any way thanks.

--
Pankaj Jangra

#5 lore raw

PATCH 2/10 msm_sdcc: Convert to clk_prepare/unprepare

In reply to Stephen Boyd

Add calls to clk_prepare and unprepare so that MSM can migrate to the common clock framework.

---
 drivers/mmc/host/msm_sdcc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/mmc/host/msm_sdcc.c +13 -1
index 1d14cda..10cc05b 100644
@@ -1269,10 +1269,18 @@ msmsdcc_probe(struct platform_device *pdev)
 		goto clk_put;
 	}
 
+	ret = clk_prepare(host->pclk);
+	if (ret)
+		goto clk_put;
+
+	ret = clk_prepare(host->clk);
+	if (ret)
+		goto clk_unprepare_p;
+
 	/* Enable clocks */
 	ret = msmsdcc_enable_clocks(host);
 	if (ret)
-		goto clk_put;
+		goto clk_unprepare;
 
 	host->pclk_rate = clk_get_rate(host->pclk);
 	host->clk_rate = clk_get_rate(host->clk);
@@ -1387,6 +1395,10 @@ msmsdcc_probe(struct platform_device *pdev)
 		free_irq(host->stat_irq, host);
  clk_disable:
 	msmsdcc_disable_clocks(host, 0);
+ clk_unprepare:
+	clk_unprepare(host->clk);
+ clk_unprepare_p:
+	clk_unprepare(host->pclk);
  clk_put:
 	clk_put(host->clk);
  pclk_put:
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

PATCH 3/10 msm: iommu: Convert to clk_prepare/unprepare

In reply to Stephen Boyd

Add calls to clk_prepare and unprepare so that MSM can migrate to the common clock framework. We never unprepare the clocks until driver remove because the clocks are enabled and disabled in irq context. Finer grained power management is possible in the future via runtime power management techniques.

---
 drivers/iommu/msm_iommu_dev.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/iommu/msm_iommu_dev.c +10 -7
index 8e8fb07..d344f6a 100644
@@ -160,7 +160,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
 		goto fail;
 	}
 
-	ret = clk_enable(iommu_pclk);
+	ret = clk_prepare_enable(iommu_pclk);
 	if (ret)
 		goto fail_enable;
 
@@ -170,7 +170,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
 		if (clk_get_rate(iommu_clk) == 0)
 			clk_set_min_rate(iommu_clk, 1);
 
-		ret = clk_enable(iommu_clk);
+		ret = clk_prepare_enable(iommu_clk);
 		if (ret) {
 			clk_put(iommu_clk);
 			goto fail_pclk;
@@ -261,7 +261,7 @@ fail_clk:
 		clk_put(iommu_clk);
 	}
 fail_pclk:
-	clk_disable(iommu_pclk);
+	clk_disable_unprepare(iommu_pclk);
 fail_enable:
 	clk_put(iommu_pclk);
 fail:
@@ -275,8 +275,11 @@ static int msm_iommu_remove(struct platform_device *pdev)
 
 	drv = platform_get_drvdata(pdev);
 	if (drv) {
-		if (drv->clk)
+		if (drv->clk) {
+			clk_unprepare(drv->clk);
 			clk_put(drv->clk);
+		}
+		clk_unprepare(drv->pclk);
 		clk_put(drv->pclk);
 		memset(drv, 0, sizeof(*drv));
 		kfree(drv);
@@ -314,14 +317,14 @@ static int msm_iommu_ctx_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&ctx_drvdata->attached_elm);
 	platform_set_drvdata(pdev, ctx_drvdata);
 
-	ret = clk_enable(drvdata->pclk);
+	ret = clk_prepare_enable(drvdata->pclk);
 	if (ret)
 		goto fail;
 
 	if (drvdata->clk) {
-		ret = clk_enable(drvdata->clk);
+		ret = clk_prepare_enable(drvdata->clk);
 		if (ret) {
-			clk_disable(drvdata->pclk);
+			clk_disable_unprepare(drvdata->pclk);
 			goto fail;
 		}
 	}
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#7 lore raw

Re: [PATCH 03/10] msm: iommu: Convert to clk_prepare/unprepare

Quoted 43 lines · Stephen Boyd

Add calls to clk_prepare and unprepare so that MSM can migrate to the common clock framework. We never unprepare the clocks until driver remove because the clocks are enabled and disabled in irq context. Finer grained power management is possible in the future via runtime power management techniques.

---
  drivers/iommu/msm_iommu_dev.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/iommu/msm_iommu_dev.c +3 -3
index 8e8fb07..d344f6a 100644
@@ -160,7 +160,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
  		goto fail;
  	}
 
-	ret = clk_enable(iommu_pclk);
+	ret = clk_prepare_enable(iommu_pclk);
  	if (ret)
  		goto fail_enable;
 
@@ -170,7 +170,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
  		if (clk_get_rate(iommu_clk) == 0)
  			clk_set_min_rate(iommu_clk, 1);
 
-		ret = clk_enable(iommu_clk);
+		ret = clk_prepare_enable(iommu_clk);
  		if (ret) {
  			clk_put(iommu_clk);
  			goto fail_pclk;
@@ -261,7 +261,7 @@ fail_clk:
  		clk_put(iommu_clk);
  	}
  fail_pclk:
-	clk_disable(iommu_pclk);
+	clk_disable_unprepare(iommu_pclk);
  fail_enable:
  	clk_put(iommu_pclk);
  fail:

drivers/iommu/msm_iommu_dev.c static int msm_iommu_remove(struct platform_device *pdev) · line 282

Quoted 9 lines
drivers/iommu/msm_iommu_dev.c +4 -1
@@ -275,8 +275,11 @@ static int msm_iommu_remove(struct platform_device *pdev)
 
  	drv = platform_get_drvdata(pdev);
  	if (drv) {
-		if (drv->clk)
+		if (drv->clk) {
+			clk_unprepare(drv->clk);
  			clk_put(drv->clk);
+		}
+		clk_unprepare(drv->pclk);

Are these changes right? Every other clk API change in this patch is using the combined prepare_enable/disable_unprepare() calls. So, when would we end up at this location with the clocks prepared but not enabled?

Also, what if the device gets probed and then immediately removed. Will it work correctly?

-Saravana

Quoted 21 lines
drivers/iommu/msm_iommu_dev.c +3 -3
  		clk_put(drv->pclk);
  		memset(drv, 0, sizeof(*drv));
  		kfree(drv);
@@ -314,14 +317,14 @@ static int msm_iommu_ctx_probe(struct platform_device *pdev)
  	INIT_LIST_HEAD(&ctx_drvdata->attached_elm);
  	platform_set_drvdata(pdev, ctx_drvdata);
 
-	ret = clk_enable(drvdata->pclk);
+	ret = clk_prepare_enable(drvdata->pclk);
  	if (ret)
  		goto fail;
 
  	if (drvdata->clk) {
-		ret = clk_enable(drvdata->clk);
+		ret = clk_prepare_enable(drvdata->clk);
  		if (ret) {
-			clk_disable(drvdata->pclk);
+			clk_disable_unprepare(drvdata->pclk);
  			goto fail;
  		}
  	}
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#8 lore raw

Re: [PATCH 03/10] msm: iommu: Convert to clk_prepare/unprepare

Quoted 18 lines · Saravana Kannan

drivers/iommu/msm_iommu_dev.c static int msm_iommu_remove(struct · line 283

Quoted 11 lines
drivers/iommu/msm_iommu_dev.c +4 -1
@@ -275,8 +275,11 @@ static int msm_iommu_remove(struct
 platform_device *pdev)
 
      drv = platform_get_drvdata(pdev);
      if (drv) {
-        if (drv->clk)
+        if (drv->clk) {
+            clk_unprepare(drv->clk);
              clk_put(drv->clk);
+        }
+        clk_unprepare(drv->pclk);

Are these changes right? Every other clk API change in this patch is using the combined prepare_enable/disable_unprepare() calls. So, when would we end up at this location with the clocks prepared but not enabled?

Quoted 3 lines

Also, what if the device gets probed and then immediately removed. Will it work correctly?

It should work correctly. If you look at the bottom of msm_iommu_probe() you see that it call clk_disable() and doesn't unprepare the clock. So if the driver is unbound the clocks should be disabled but still prepared.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#9 lore raw

PATCH 4/10 msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()

In reply to Stephen Boyd

Calling clk_set_min_rate() is no better than just calling clk_set_rate() because MSM clock code already takes care of calling the min_rate ops if the clock really needs clk_set_min_rate() called on it.

---
 drivers/iommu/msm_iommu_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/msm_iommu_dev.c +1 -2
index d344f6a..9144a6b 100644
@@ -29,7 +29,6 @@
 
 #include <mach/iommu_hw-8xxx.h>
 #include <mach/iommu.h>
-#include <mach/clk.h>
 
 struct iommu_ctx_iter_data {
 	/* input */
@@ -168,7 +167,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
 
 	if (!IS_ERR(iommu_clk))	{
 		if (clk_get_rate(iommu_clk) == 0)
-			clk_set_min_rate(iommu_clk, 1);
+			clk_set_rate(iommu_clk, 1);
 
 		ret = clk_prepare_enable(iommu_clk);
 		if (ret) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#10 lore raw

PATCH 5/10 ARM: msm: Remove custom clk_set_flags() API

In reply to Stephen Boyd

Nobody is using this API upstream and it's just contributing cruft. Remove it so the MSM clock API is closer to the generic struct clock API.

Cc Saravana Kannan <[email protected]>
---
 arch/arm/mach-msm/clock-pcom.c       | 10 ----------
 arch/arm/mach-msm/clock.c            |  8 --------
 arch/arm/mach-msm/clock.h            |  6 ------
 arch/arm/mach-msm/include/mach/clk.h |  3 ---
 4 files changed, 27 deletions(-)
arch/arm/mach-msm/clock-pcom.c +0 -10
index a52c970..bb75f8e 100644
@@ -85,15 +85,6 @@ static int pc_clk_set_max_rate(unsigned id, unsigned rate)
 		return (int)id < 0 ? -EINVAL : 0;
 }
 
-static int pc_clk_set_flags(unsigned id, unsigned flags)
-{
-	int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_FLAGS, &id, &flags);
-	if (rc < 0)
-		return rc;
-	else
-		return (int)id < 0 ? -EINVAL : 0;
-}
-
 static unsigned pc_clk_get_rate(unsigned id)
 {
 	if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL))
@@ -130,7 +121,6 @@ struct clk_ops clk_ops_pcom = {
 	.set_rate = pc_clk_set_rate,
 	.set_min_rate = pc_clk_set_min_rate,
 	.set_max_rate = pc_clk_set_max_rate,
-	.set_flags = pc_clk_set_flags,
 	.get_rate = pc_clk_get_rate,
 	.is_enabled = pc_clk_is_enabled,
 	.round_rate = pc_clk_round_rate,
arch/arm/mach-msm/clock.c +0 -8
index d9145df..5fac2df 100644
@@ -121,14 +121,6 @@ struct clk *clk_get_parent(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_parent);
 
-int clk_set_flags(struct clk *clk, unsigned long flags)
-{
-	if (clk == NULL || IS_ERR(clk))
-		return -EINVAL;
-	return clk->ops->set_flags(clk->id, flags);
-}
-EXPORT_SYMBOL(clk_set_flags);
-
 /* EBI1 is the only shared clock that several clients want to vote on as of
  * this commit. If this changes in the future, then it might be better to
  * make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more
arch/arm/mach-msm/clock.h +0 -6
index 2c007f6..a25ff58 100644
@@ -21,11 +21,6 @@
 #include <linux/list.h>
 #include <mach/clk.h>
 
-#define CLKFLAG_INVERT			0x00000001
-#define CLKFLAG_NOINVERT		0x00000002
-#define CLKFLAG_NONEST			0x00000004
-#define CLKFLAG_NORESET			0x00000008
-
 #define CLK_FIRST_AVAILABLE_FLAG	0x00000100
 #define CLKFLAG_AUTO_OFF		0x00000200
 #define CLKFLAG_MIN			0x00000400
@@ -39,7 +34,6 @@ struct clk_ops {
 	int (*set_rate)(unsigned id, unsigned rate);
 	int (*set_min_rate)(unsigned id, unsigned rate);
 	int (*set_max_rate)(unsigned id, unsigned rate);
-	int (*set_flags)(unsigned id, unsigned flags);
 	unsigned (*get_rate)(unsigned id);
 	unsigned (*is_enabled)(unsigned id);
 	long (*round_rate)(unsigned id, unsigned rate);
arch/arm/mach-msm/include/mach/clk.h +0 -3
index e8d3842..5f1c37d 100644
@@ -34,7 +34,4 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate);
 /* Assert/Deassert reset to a hardware block associated with a clock */
 int clk_reset(struct clk *clk, enum clk_reset_action action);
 
-/* Set clock-specific configuration parameters */
-int clk_set_flags(struct clk *clk, unsigned long flags);
-
 #endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Acked-by on v1 5/10
#11 lore raw

Re: [PATCH 05/10] ARM: msm: Remove custom clk_set_flags() API

Quoted 89 lines · Stephen Boyd

Nobody is using this API upstream and it's just contributing cruft. Remove it so the MSM clock API is closer to the generic struct clock API.

Cc Saravana Kannan<[email protected]>
---
  arch/arm/mach-msm/clock-pcom.c       | 10 ----------
  arch/arm/mach-msm/clock.c            |  8 --------
  arch/arm/mach-msm/clock.h            |  6 ------
  arch/arm/mach-msm/include/mach/clk.h |  3 ---
  4 files changed, 27 deletions(-)
arch/arm/mach-msm/clock-pcom.c +0 -10
index a52c970..bb75f8e 100644
@@ -85,15 +85,6 @@ static int pc_clk_set_max_rate(unsigned id, unsigned rate)
  		return (int)id<  0 ? -EINVAL : 0;
  }
 
-static int pc_clk_set_flags(unsigned id, unsigned flags)
-{
-	int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_FLAGS,&id,&flags);
-	if (rc<  0)
-		return rc;
-	else
-		return (int)id<  0 ? -EINVAL : 0;
-}
-
  static unsigned pc_clk_get_rate(unsigned id)
  {
  	if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE,&id, NULL))
@@ -130,7 +121,6 @@ struct clk_ops clk_ops_pcom = {
  	.set_rate = pc_clk_set_rate,
  	.set_min_rate = pc_clk_set_min_rate,
  	.set_max_rate = pc_clk_set_max_rate,
-	.set_flags = pc_clk_set_flags,
  	.get_rate = pc_clk_get_rate,
  	.is_enabled = pc_clk_is_enabled,
  	.round_rate = pc_clk_round_rate,
arch/arm/mach-msm/clock.c +0 -8
index d9145df..5fac2df 100644
@@ -121,14 +121,6 @@ struct clk *clk_get_parent(struct clk *clk)
  }
  EXPORT_SYMBOL(clk_get_parent);
 
-int clk_set_flags(struct clk *clk, unsigned long flags)
-{
-	if (clk == NULL || IS_ERR(clk))
-		return -EINVAL;
-	return clk->ops->set_flags(clk->id, flags);
-}
-EXPORT_SYMBOL(clk_set_flags);
-
  /* EBI1 is the only shared clock that several clients want to vote on as of
   * this commit. If this changes in the future, then it might be better to
   * make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more
arch/arm/mach-msm/clock.h +0 -6
index 2c007f6..a25ff58 100644
@@ -21,11 +21,6 @@
  #include<linux/list.h>
  #include<mach/clk.h>
 
-#define CLKFLAG_INVERT			0x00000001
-#define CLKFLAG_NOINVERT		0x00000002
-#define CLKFLAG_NONEST			0x00000004
-#define CLKFLAG_NORESET			0x00000008
-
  #define CLK_FIRST_AVAILABLE_FLAG	0x00000100
  #define CLKFLAG_AUTO_OFF		0x00000200
  #define CLKFLAG_MIN			0x00000400
@@ -39,7 +34,6 @@ struct clk_ops {
  	int (*set_rate)(unsigned id, unsigned rate);
  	int (*set_min_rate)(unsigned id, unsigned rate);
  	int (*set_max_rate)(unsigned id, unsigned rate);
-	int (*set_flags)(unsigned id, unsigned flags);
  	unsigned (*get_rate)(unsigned id);
  	unsigned (*is_enabled)(unsigned id);
  	long (*round_rate)(unsigned id, unsigned rate);
arch/arm/mach-msm/include/mach/clk.h +0 -0
index e8d3842..5f1c37d 100644

arch/arm/mach-msm/include/mach/clk.h int clk_set_max_rate(struct clk *clk, unsigned long rate); · line 37

Quoted 7 lines
arch/arm/mach-msm/include/mach/clk.h +0 -3
@@ -34,7 +34,4 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate);
  /* Assert/Deassert reset to a hardware block associated with a clock */
  int clk_reset(struct clk *clk, enum clk_reset_action action);
 
-/* Set clock-specific configuration parameters */
-int clk_set_flags(struct clk *clk, unsigned long flags);
-
  #endif
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#12 lore raw

PATCH 6/10 ARM: msm: Remove custom clk_set_{max,min}_rate() API

In reply to Stephen Boyd

There are no users of this API anymore so let's just remove it. If a need arises in the future we can extend the common clock API to handle it.

Cc Saravana Kannan <[email protected]>
---
 arch/arm/mach-msm/clock-debug.c      |  9 +--------
 arch/arm/mach-msm/clock.c            | 12 ------------
 arch/arm/mach-msm/include/mach/clk.h |  6 ------
 3 files changed, 1 insertion(+), 26 deletions(-)
arch/arm/mach-msm/clock-debug.c +1 -8
index 4886404..c4b34d7 100644
@@ -25,14 +25,7 @@ static int clock_debug_rate_set(void *data, u64 val)
 	struct clk *clock = data;
 	int ret;
 
-	/* Only increases to max rate will succeed, but that's actually good
-	 * for debugging purposes so we don't check for error. */
-	if (clock->flags & CLK_MAX)
-		clk_set_max_rate(clock, val);
-	if (clock->flags & CLK_MIN)
-		ret = clk_set_min_rate(clock, val);
-	else
-		ret = clk_set_rate(clock, val);
+	ret = clk_set_rate(clock, val);
 	if (ret != 0)
 		printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
 			(clock->flags & CLK_MIN) ? "_min" : "", ret);
arch/arm/mach-msm/clock.c +0 -12
index 5fac2df..8d07b25 100644
@@ -97,18 +97,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
 }
 EXPORT_SYMBOL(clk_round_rate);
 
-int clk_set_min_rate(struct clk *clk, unsigned long rate)
-{
-	return clk->ops->set_min_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_min_rate);
-
-int clk_set_max_rate(struct clk *clk, unsigned long rate)
-{
-	return clk->ops->set_max_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_max_rate);
-
 int clk_set_parent(struct clk *clk, struct clk *parent)
 {
 	return -ENOSYS;
arch/arm/mach-msm/include/mach/clk.h +0 -6
index 5f1c37d..fd4f4a7 100644
@@ -25,12 +25,6 @@ enum clk_reset_action {
 
 struct clk;
 
-/* Rate is minimum clock rate in Hz */
-int clk_set_min_rate(struct clk *clk, unsigned long rate);
-
-/* Rate is maximum clock rate in Hz */
-int clk_set_max_rate(struct clk *clk, unsigned long rate);
-
 /* Assert/Deassert reset to a hardware block associated with a clock */
 int clk_reset(struct clk *clk, enum clk_reset_action action);
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Acked-by on v1 6/10
#13 lore raw

Re: [PATCH 06/10] ARM: msm: Remove custom clk_set_{max,min}_rate() API

Quoted 19 lines · Stephen Boyd

There are no users of this API anymore so let's just remove it. If a need arises in the future we can extend the common clock API to handle it.

Cc Saravana Kannan<[email protected]>
---
  arch/arm/mach-msm/clock-debug.c      |  9 +--------
  arch/arm/mach-msm/clock.c            | 12 ------------
  arch/arm/mach-msm/include/mach/clk.h |  6 ------
  3 files changed, 1 insertion(+), 26 deletions(-)
arch/arm/mach-msm/clock-debug.c +0 -0
index 4886404..c4b34d7 100644
@@ -25,14 +25,7 @@ static int clock_debug_rate_set(void *data, u64 val)
  	struct clk *clock = data;
  	int ret;

arch/arm/mach-msm/clock-debug.c static int clock_debug_rate_set(void *data, u64 val) · line 28

Quoted 10 lines
arch/arm/mach-msm/clock-debug.c +1 -8
 
-	/* Only increases to max rate will succeed, but that's actually good
-	 * for debugging purposes so we don't check for error. */
-	if (clock->flags&  CLK_MAX)
-		clk_set_max_rate(clock, val);
-	if (clock->flags&  CLK_MIN)
-		ret = clk_set_min_rate(clock, val);
-	else
-		ret = clk_set_rate(clock, val);
+	ret = clk_set_rate(clock, val);

This was done to handle the difference in behavior of the remote processor on a per clock basis, but I agree that it's best to remove it now and added it back later if needed. And even if it's needed, I don't anticipate the need for changes to the common clock framework to deal with this.

-Saravana

Quoted 43 lines
arch/arm/mach-msm/clock-debug.c +0 -0
  	if (ret != 0)
  		printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
  			(clock->flags&  CLK_MIN) ? "_min" : "", ret);
arch/arm/mach-msm/clock.c +0 -12
index 5fac2df..8d07b25 100644
@@ -97,18 +97,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
  }
  EXPORT_SYMBOL(clk_round_rate);
 
-int clk_set_min_rate(struct clk *clk, unsigned long rate)
-{
-	return clk->ops->set_min_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_min_rate);
-
-int clk_set_max_rate(struct clk *clk, unsigned long rate)
-{
-	return clk->ops->set_max_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_max_rate);
-
  int clk_set_parent(struct clk *clk, struct clk *parent)
  {
  	return -ENOSYS;
arch/arm/mach-msm/include/mach/clk.h +0 -6
index 5f1c37d..fd4f4a7 100644
@@ -25,12 +25,6 @@ enum clk_reset_action {
 
  struct clk;
 
-/* Rate is minimum clock rate in Hz */
-int clk_set_min_rate(struct clk *clk, unsigned long rate);
-
-/* Rate is maximum clock rate in Hz */
-int clk_set_max_rate(struct clk *clk, unsigned long rate);
-
  /* Assert/Deassert reset to a hardware block associated with a clock */
  int clk_reset(struct clk *clk, enum clk_reset_action action);
 
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#14 lore raw

PATCH 7/10 ARM: msm: Remove clock-7x30.h include file

In reply to Stephen Boyd

This file is not used outside of the two users in the clock-7x30 array. Those two clocks are virtual "source" clocks that don't really need to exist outside of the clock driver. Let's remove them from the array, since they're not doing anything anyway, and then remove the clock-7x30.h include file along with it.

Cc Saravana Kannan <[email protected]>
---
 arch/arm/mach-msm/clock-7x30.h      | 155 ------------------------------------
 arch/arm/mach-msm/devices-msm7x30.c |   2 -
 2 files changed, 157 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
arch/arm/mach-msm/clock-7x30.h deleted +0 -155
deleted file mode 100644
index 1410445..0000000
@@ -1,155 +0,0 @@
-/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-#define __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-
-enum {
-	L_7X30_NONE_CLK = -1,
-	L_7X30_ADM_CLK,
-	L_7X30_I2C_CLK,
-	L_7X30_I2C_2_CLK,
-	L_7X30_QUP_I2C_CLK,
-	L_7X30_UART1DM_CLK,
-	L_7X30_UART1DM_P_CLK,
-	L_7X30_UART2DM_CLK,
-	L_7X30_UART2DM_P_CLK,
-	L_7X30_EMDH_CLK,
-	L_7X30_EMDH_P_CLK,
-	L_7X30_PMDH_CLK,
-	L_7X30_PMDH_P_CLK,
-	L_7X30_GRP_2D_CLK,
-	L_7X30_GRP_2D_P_CLK,
-	L_7X30_GRP_3D_SRC_CLK,
-	L_7X30_GRP_3D_CLK,
-	L_7X30_GRP_3D_P_CLK,
-	L_7X30_IMEM_CLK,
-	L_7X30_SDC1_CLK,
-	L_7X30_SDC1_P_CLK,
-	L_7X30_SDC2_CLK,
-	L_7X30_SDC2_P_CLK,
-	L_7X30_SDC3_CLK,
-	L_7X30_SDC3_P_CLK,
-	L_7X30_SDC4_CLK,
-	L_7X30_SDC4_P_CLK,
-	L_7X30_MDP_CLK,
-	L_7X30_MDP_P_CLK,
-	L_7X30_MDP_LCDC_PCLK_CLK,
-	L_7X30_MDP_LCDC_PAD_PCLK_CLK,
-	L_7X30_MDP_VSYNC_CLK,
-	L_7X30_MI2S_CODEC_RX_M_CLK,
-	L_7X30_MI2S_CODEC_RX_S_CLK,
-	L_7X30_MI2S_CODEC_TX_M_CLK,
-	L_7X30_MI2S_CODEC_TX_S_CLK,
-	L_7X30_MI2S_M_CLK,
-	L_7X30_MI2S_S_CLK,
-	L_7X30_LPA_CODEC_CLK,
-	L_7X30_LPA_CORE_CLK,
-	L_7X30_LPA_P_CLK,
-	L_7X30_MIDI_CLK,
-	L_7X30_MDC_CLK,
-	L_7X30_ROTATOR_IMEM_CLK,
-	L_7X30_ROTATOR_P_CLK,
-	L_7X30_SDAC_M_CLK,
-	L_7X30_SDAC_CLK,
-	L_7X30_UART1_CLK,
-	L_7X30_UART2_CLK,
-	L_7X30_UART3_CLK,
-	L_7X30_TV_CLK,
-	L_7X30_TV_DAC_CLK,
-	L_7X30_TV_ENC_CLK,
-	L_7X30_HDMI_CLK,
-	L_7X30_TSIF_REF_CLK,
-	L_7X30_TSIF_P_CLK,
-	L_7X30_USB_HS_SRC_CLK,
-	L_7X30_USB_HS_CLK,
-	L_7X30_USB_HS_CORE_CLK,
-	L_7X30_USB_HS_P_CLK,
-	L_7X30_USB_HS2_CLK,
-	L_7X30_USB_HS2_CORE_CLK,
-	L_7X30_USB_HS2_P_CLK,
-	L_7X30_USB_HS3_CLK,
-	L_7X30_USB_HS3_CORE_CLK,
-	L_7X30_USB_HS3_P_CLK,
-	L_7X30_VFE_CLK,
-	L_7X30_VFE_P_CLK,
-	L_7X30_VFE_MDC_CLK,
-	L_7X30_VFE_CAMIF_CLK,
-	L_7X30_CAMIF_PAD_P_CLK,
-	L_7X30_CAM_M_CLK,
-	L_7X30_JPEG_CLK,
-	L_7X30_JPEG_P_CLK,
-	L_7X30_VPE_CLK,
-	L_7X30_MFC_CLK,
-	L_7X30_MFC_DIV2_CLK,
-	L_7X30_MFC_P_CLK,
-	L_7X30_SPI_CLK,
-	L_7X30_SPI_P_CLK,
-	L_7X30_CSI0_CLK,
-	L_7X30_CSI0_VFE_CLK,
-	L_7X30_CSI0_P_CLK,
-	L_7X30_CSI1_CLK,
-	L_7X30_CSI1_VFE_CLK,
-	L_7X30_CSI1_P_CLK,
-	L_7X30_GLBL_ROOT_CLK,
-
-	L_7X30_AXI_LI_VG_CLK,
-	L_7X30_AXI_LI_GRP_CLK,
-	L_7X30_AXI_LI_JPEG_CLK,
-	L_7X30_AXI_GRP_2D_CLK,
-	L_7X30_AXI_MFC_CLK,
-	L_7X30_AXI_VPE_CLK,
-	L_7X30_AXI_LI_VFE_CLK,
-	L_7X30_AXI_LI_APPS_CLK,
-	L_7X30_AXI_MDP_CLK,
-	L_7X30_AXI_IMEM_CLK,
-	L_7X30_AXI_LI_ADSP_A_CLK,
-	L_7X30_AXI_ROTATOR_CLK,
-
-	L_7X30_NR_CLKS
-};
-
-struct clk_ops;
-extern struct clk_ops clk_ops_7x30;
-
-struct clk_ops *clk_7x30_is_local(uint32_t id);
-int clk_7x30_init(void);
-
-void pll_enable(uint32_t pll);
-void pll_disable(uint32_t pll);
-
-extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
-
-#define CLK_7X30(clk_name, clk_id, clk_dev, clk_flags) {	\
-	.con_id = clk_name, \
-	.dev_id = clk_dev, \
-	.clk = &(struct clk){ \
-		.id = L_7X30_##clk_id, \
-		.remote_id = P_##clk_id, \
-		.flags = clk_flags, \
-		.dbg_name = #clk_id, \
-	}, \
-	}
-
-#define CLK_7X30S(clk_name, l_id, r_id, clk_dev, clk_flags) {	\
-	.con_id = clk_name, \
-	.dev_id = clk_dev, \
-	.clk = &(struct clk){ \
-		.id = L_7X30_##l_id, \
-		.remote_id = P_##r_id, \
-		.flags = clk_flags, \
-		.dbg_name = #l_id, \
-		.ops = &clk_ops_pcom, \
-	}, \
-	}
-
-#endif
arch/arm/mach-msm/devices-msm7x30.c +0 -2
index 09b4f14..1597d43 100644
@@ -146,7 +146,6 @@ struct clk_lookup msm_clocks_7x30[] = {
 	CLK_PCOM("grp_2d_pclk",	GRP_2D_P_CLK,	NULL, 0),
 	CLK_PCOM("grp_clk",	GRP_3D_CLK,	NULL, 0),
 	CLK_PCOM("grp_pclk",	GRP_3D_P_CLK,	NULL, 0),
-	CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK,	NULL, 0),
 	CLK_PCOM("hdmi_clk",	HDMI_CLK,	NULL, 0),
 	CLK_PCOM("imem_clk",	IMEM_CLK,	NULL, OFF),
 	CLK_PCOM("jpeg_clk",	JPEG_CLK,	NULL, OFF),
@@ -179,7 +178,6 @@ struct clk_lookup msm_clocks_7x30[] = {
 	CLK_PCOM("sdac_clk",	SDAC_CLK,	NULL, OFF),
 	CLK_PCOM("spi_clk",	SPI_CLK,	NULL, 0),
 	CLK_PCOM("spi_pclk",	SPI_P_CLK,	NULL, 0),
-	CLK_7X30S("tv_src_clk",	TV_CLK, 	TV_ENC_CLK,	NULL, 0),
 	CLK_PCOM("tv_dac_clk",	TV_DAC_CLK,	NULL, 0),
 	CLK_PCOM("tv_enc_clk",	TV_ENC_CLK,	NULL, 0),
 	CLK_PCOM("uart_clk",	UART2_CLK,	"msm_serial.1", 0),
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#15 lore raw

Re: [PATCH 07/10] ARM: msm: Remove clock-7x30.h include file

Hi

Quoted 180 lines · Stephen Boyd

This file is not used outside of the two users in the clock-7x30 array. Those two clocks are virtual "source" clocks that don't really need to exist outside of the clock driver. Let's remove them from the array, since they're not doing anything anyway, and then remove the clock-7x30.h include file along with it.

Cc Saravana Kannan <[email protected]>
---
 arch/arm/mach-msm/clock-7x30.h      | 155 ------------------------------------
 arch/arm/mach-msm/devices-msm7x30.c |   2 -
 2 files changed, 157 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
arch/arm/mach-msm/clock-7x30.h deleted +0 -155
deleted file mode 100644
index 1410445..0000000
@@ -1,155 +0,0 @@
-/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-#define __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-
-enum {
-       L_7X30_NONE_CLK = -1,
-       L_7X30_ADM_CLK,
-       L_7X30_I2C_CLK,
-       L_7X30_I2C_2_CLK,
-       L_7X30_QUP_I2C_CLK,
-       L_7X30_UART1DM_CLK,
-       L_7X30_UART1DM_P_CLK,
-       L_7X30_UART2DM_CLK,
-       L_7X30_UART2DM_P_CLK,
-       L_7X30_EMDH_CLK,
-       L_7X30_EMDH_P_CLK,
-       L_7X30_PMDH_CLK,
-       L_7X30_PMDH_P_CLK,
-       L_7X30_GRP_2D_CLK,
-       L_7X30_GRP_2D_P_CLK,
-       L_7X30_GRP_3D_SRC_CLK,
-       L_7X30_GRP_3D_CLK,
-       L_7X30_GRP_3D_P_CLK,
-       L_7X30_IMEM_CLK,
-       L_7X30_SDC1_CLK,
-       L_7X30_SDC1_P_CLK,
-       L_7X30_SDC2_CLK,
-       L_7X30_SDC2_P_CLK,
-       L_7X30_SDC3_CLK,
-       L_7X30_SDC3_P_CLK,
-       L_7X30_SDC4_CLK,
-       L_7X30_SDC4_P_CLK,
-       L_7X30_MDP_CLK,
-       L_7X30_MDP_P_CLK,
-       L_7X30_MDP_LCDC_PCLK_CLK,
-       L_7X30_MDP_LCDC_PAD_PCLK_CLK,
-       L_7X30_MDP_VSYNC_CLK,
-       L_7X30_MI2S_CODEC_RX_M_CLK,
-       L_7X30_MI2S_CODEC_RX_S_CLK,
-       L_7X30_MI2S_CODEC_TX_M_CLK,
-       L_7X30_MI2S_CODEC_TX_S_CLK,
-       L_7X30_MI2S_M_CLK,
-       L_7X30_MI2S_S_CLK,
-       L_7X30_LPA_CODEC_CLK,
-       L_7X30_LPA_CORE_CLK,
-       L_7X30_LPA_P_CLK,
-       L_7X30_MIDI_CLK,
-       L_7X30_MDC_CLK,
-       L_7X30_ROTATOR_IMEM_CLK,
-       L_7X30_ROTATOR_P_CLK,
-       L_7X30_SDAC_M_CLK,
-       L_7X30_SDAC_CLK,
-       L_7X30_UART1_CLK,
-       L_7X30_UART2_CLK,
-       L_7X30_UART3_CLK,
-       L_7X30_TV_CLK,
-       L_7X30_TV_DAC_CLK,
-       L_7X30_TV_ENC_CLK,
-       L_7X30_HDMI_CLK,
-       L_7X30_TSIF_REF_CLK,
-       L_7X30_TSIF_P_CLK,
-       L_7X30_USB_HS_SRC_CLK,
-       L_7X30_USB_HS_CLK,
-       L_7X30_USB_HS_CORE_CLK,
-       L_7X30_USB_HS_P_CLK,
-       L_7X30_USB_HS2_CLK,
-       L_7X30_USB_HS2_CORE_CLK,
-       L_7X30_USB_HS2_P_CLK,
-       L_7X30_USB_HS3_CLK,
-       L_7X30_USB_HS3_CORE_CLK,
-       L_7X30_USB_HS3_P_CLK,
-       L_7X30_VFE_CLK,
-       L_7X30_VFE_P_CLK,
-       L_7X30_VFE_MDC_CLK,
-       L_7X30_VFE_CAMIF_CLK,
-       L_7X30_CAMIF_PAD_P_CLK,
-       L_7X30_CAM_M_CLK,
-       L_7X30_JPEG_CLK,
-       L_7X30_JPEG_P_CLK,
-       L_7X30_VPE_CLK,
-       L_7X30_MFC_CLK,
-       L_7X30_MFC_DIV2_CLK,
-       L_7X30_MFC_P_CLK,
-       L_7X30_SPI_CLK,
-       L_7X30_SPI_P_CLK,
-       L_7X30_CSI0_CLK,
-       L_7X30_CSI0_VFE_CLK,
-       L_7X30_CSI0_P_CLK,
-       L_7X30_CSI1_CLK,
-       L_7X30_CSI1_VFE_CLK,
-       L_7X30_CSI1_P_CLK,
-       L_7X30_GLBL_ROOT_CLK,
-
-       L_7X30_AXI_LI_VG_CLK,
-       L_7X30_AXI_LI_GRP_CLK,
-       L_7X30_AXI_LI_JPEG_CLK,
-       L_7X30_AXI_GRP_2D_CLK,
-       L_7X30_AXI_MFC_CLK,
-       L_7X30_AXI_VPE_CLK,
-       L_7X30_AXI_LI_VFE_CLK,
-       L_7X30_AXI_LI_APPS_CLK,
-       L_7X30_AXI_MDP_CLK,
-       L_7X30_AXI_IMEM_CLK,
-       L_7X30_AXI_LI_ADSP_A_CLK,
-       L_7X30_AXI_ROTATOR_CLK,
-
-       L_7X30_NR_CLKS
-};
-
-struct clk_ops;
-extern struct clk_ops clk_ops_7x30;
-
-struct clk_ops *clk_7x30_is_local(uint32_t id);
-int clk_7x30_init(void);
-
-void pll_enable(uint32_t pll);
-void pll_disable(uint32_t pll);
-
-extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
-
-#define CLK_7X30(clk_name, clk_id, clk_dev, clk_flags) {       \
-       .con_id = clk_name, \
-       .dev_id = clk_dev, \
-       .clk = &(struct clk){ \
-               .id = L_7X30_##clk_id, \
-               .remote_id = P_##clk_id, \
-               .flags = clk_flags, \
-               .dbg_name = #clk_id, \
-       }, \
-       }
-
-#define CLK_7X30S(clk_name, l_id, r_id, clk_dev, clk_flags) {  \
-       .con_id = clk_name, \
-       .dev_id = clk_dev, \
-       .clk = &(struct clk){ \
-               .id = L_7X30_##l_id, \
-               .remote_id = P_##r_id, \
-               .flags = clk_flags, \
-               .dbg_name = #l_id, \
-               .ops = &clk_ops_pcom, \
-       }, \
-       }
-
-#endif
arch/arm/mach-msm/devices-msm7x30.c +0 -0
index 09b4f14..1597d43 100644

arch/arm/mach-msm/devices-msm7x30.c struct clk_lookup msm_clocks_7x30[] = { · line 150

Quoted 6 lines
arch/arm/mach-msm/devices-msm7x30.c +0 -1
@@ -146,7 +146,6 @@ struct clk_lookup msm_clocks_7x30[] = {
        CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK,   NULL, 0),
        CLK_PCOM("grp_clk",     GRP_3D_CLK,     NULL, 0),
        CLK_PCOM("grp_pclk",    GRP_3D_P_CLK,   NULL, 0),
-       CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK,    NULL, 0),
        CLK_PCOM("hdmi_clk",    HDMI_CLK,       NULL, 0),
        CLK_PCOM("imem_clk",    IMEM_CLK,       NULL, OFF),

I suppose you forget to remove the include header clock-7x30.h from this file. :)

--
Pankaj Kumar

#16 lore raw

Re: [PATCH 07/10] ARM: msm: Remove clock-7x30.h include file

Quoted 14 lines · Pankaj Jangra

arch/arm/mach-msm/devices-msm7x30.c struct clk_lookup msm_clocks_7x30[] = { · line 150

Quoted 11 lines · Stephen Boyd
arch/arm/mach-msm/devices-msm7x30.c +0 -1
index 09b4f14..1597d43 100644
@@ -146,7 +146,6 @@ struct clk_lookup msm_clocks_7x30[] = {
        CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK,   NULL, 0),
        CLK_PCOM("grp_clk",     GRP_3D_CLK,     NULL, 0),
        CLK_PCOM("grp_pclk",    GRP_3D_P_CLK,   NULL, 0),
-       CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK,    NULL, 0),
        CLK_PCOM("hdmi_clk",    HDMI_CLK,       NULL, 0),
        CLK_PCOM("imem_clk",    IMEM_CLK,       NULL, OFF),

I suppose you forget to remove the include header clock-7x30.h from this file. :)

Thanks, fixed. BTW, you could have trimmed this mail down so I didn't have to scroll to the bottom.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#17 lore raw

Re: [PATCH 07/10] ARM: msm: Remove clock-7x30.h include file

Hi,

Quoted 16 lines · Stephen Boyd
Quoted 14 lines · Pankaj Jangra

arch/arm/mach-msm/devices-msm7x30.c struct clk_lookup msm_clocks_7x30[] = { · line 150

Quoted 11 lines · Stephen Boyd
arch/arm/mach-msm/devices-msm7x30.c +0 -1
index 09b4f14..1597d43 100644
@@ -146,7 +146,6 @@ struct clk_lookup msm_clocks_7x30[] = {
        CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK,   NULL, 0),
        CLK_PCOM("grp_clk",     GRP_3D_CLK,     NULL, 0),
        CLK_PCOM("grp_pclk",    GRP_3D_P_CLK,   NULL, 0),
-       CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK,    NULL, 0),
        CLK_PCOM("hdmi_clk",    HDMI_CLK,       NULL, 0),
        CLK_PCOM("imem_clk",    IMEM_CLK,       NULL, OFF),

I suppose you forget to remove the include header clock-7x30.h from this file. :)

Quoted 3 lines

Thanks, fixed. BTW, you could have trimmed this mail down so I didn't have to scroll to the bottom.

ah, i think mistakenly i forgot. Next time will keep in mind..:)

--
Pankaj Jangra

#18 lore raw

PATCH 8/10 ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver

In reply to Stephen Boyd

In the near future we'll be moving clock-pcom to a platform driver, in which case these two users of clk_get() in mach-msm need to be updated. Have board-trout-panel.c make the proc_comm call directly so that we don't have to port this board specific code to the driver right now and reorder the initcall order of dma.c so that it initializes after the clock driver probes but before any drivers use dma APIs.

---
 arch/arm/mach-msm/Makefile            |  9 ++++++---
 arch/arm/mach-msm/board-trout-panel.c | 19 +++++++------------
 arch/arm/mach-msm/dma.c               |  5 ++---
 3 files changed, 15 insertions(+), 18 deletions(-)
arch/arm/mach-msm/Makefile +6 -3
index 17519fa..3dbae74 100644
@@ -5,12 +5,15 @@ obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o
-obj-$(CONFIG_ARCH_MSM7X30) += dma.o
-obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
+obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
+obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
+obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
+obj-$(CONFIG_ARCH_MSM7X30) += dma.o
+obj-$(CONFIG_ARCH_QSD8X50) += dma.o
+
 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
 obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
arch/arm/mach-msm/board-trout-panel.c +7 -12
index 89bf6b4..0be703b 100644
@@ -7,7 +7,6 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/leds.h>
-#include <linux/clk.h>
 #include <linux/err.h>
 
 #include <asm/io.h>
@@ -19,6 +18,7 @@
 
 #include "board-trout.h"
 #include "proc_comm.h"
+#include "clock-pcom.h"
 #include "devices.h"
 
 #define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
@@ -170,7 +170,6 @@ static struct mddi_table mddi_toshiba_init_table[] = {
 #define INTMASK_VWAKEOUT (1U << 0)
 
 
-static struct clk *gp_clk;
 static int trout_new_backlight = 1;
 static struct vreg *vreg_mddi_1v5;
 static struct vreg *vreg_lcm_2v85;
@@ -273,18 +272,14 @@ int __init trout_init_panel(void)
 	} else {
 		uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT,
 						GPIO_NO_PULL, GPIO_8MA);
+		uint32_t id = P_GP_CLK;
+		uint32_t rate = 19200000;
+
 		msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0);
 
-		gp_clk = clk_get(NULL, "gp_clk");
-		if (IS_ERR(gp_clk)) {
-			printk(KERN_ERR "trout_init_panel: could not get gp"
-			       "clock\n");
-			gp_clk = NULL;
-		}
-		rc = clk_set_rate(gp_clk, 19200000);
-		if (rc)
-			printk(KERN_ERR "trout_init_panel: set clock rate "
-			       "failed\n");
+		msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
+		if (id < 0)
+			pr_err("trout_init_panel: set clock rate failed\n");
 	}
 
 	rc = platform_device_register(&msm_device_mdp);
arch/arm/mach-msm/dma.c +2 -3
index 354b91d..37a4ddd 100644
@@ -258,6 +258,7 @@ static int __init msm_init_datamover(void)
 	clk = clk_get(NULL, "adm_clk");
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
+	clk_prepare(clk);
 	msm_dmov_clk = clk;
 	ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
 	if (ret)
@@ -265,6 +266,4 @@ static int __init msm_init_datamover(void)
 	disable_irq(INT_ADM_AARM);
 	return 0;
 }
-
-arch_initcall(msm_init_datamover);
-
+module_init(msm_init_datamover);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#19 lore raw

Re: [PATCH 08/10] ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver

Hi,

Quoted 25 lines · Stephen Boyd

In the near future we'll be moving clock-pcom to a platform driver, in which case these two users of clk_get() in mach-msm need to be updated. Have board-trout-panel.c make the proc_comm call directly so that we don't have to port this board specific code to the driver right now and reorder the initcall order of dma.c so that it initializes after the clock driver probes but before any drivers use dma APIs.

---
 arch/arm/mach-msm/Makefile            |  9 ++++++---
 arch/arm/mach-msm/board-trout-panel.c | 19 +++++++------------
 arch/arm/mach-msm/dma.c               |  5 ++---
 3 files changed, 15 insertions(+), 18 deletions(-)
arch/arm/mach-msm/Makefile +0 -2
index 17519fa..3dbae74 100644
@@ -5,12 +5,15 @@ obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o
-obj-$(CONFIG_ARCH_MSM7X30) += dma.o

arch/arm/mach-msm/Makefile obj-$(CONFIG_DEBUG_FS) += clock-debug.o · line 16

Quoted 10 lines
arch/arm/mach-msm/Makefile +6 -1
-obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
+obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
+obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
+obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
+obj-$(CONFIG_ARCH_MSM7X30) += dma.o
+obj-$(CONFIG_ARCH_QSD8X50) += dma.o
+

I did not understand what is the need of this change in Makefile?

--
Pankaj Jangra

#20 lore raw

Re: [PATCH 08/10] ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver

Quoted 32 lines · Pankaj Jangra

Hi,

Quoted 29 lines · Stephen Boyd

In the near future we'll be moving clock-pcom to a platform driver, in which case these two users of clk_get() in mach-msm need to be updated. Have board-trout-panel.c make the proc_comm call directly so that we don't have to port this board specific code to the driver right now and reorder the initcall order of dma.c so that it initializes after the clock driver probes but before any drivers use dma APIs.

---
 arch/arm/mach-msm/Makefile            |  9 ++++++---
 arch/arm/mach-msm/board-trout-panel.c | 19 +++++++------------
 arch/arm/mach-msm/dma.c               |  5 ++---
 3 files changed, 15 insertions(+), 18 deletions(-)
arch/arm/mach-msm/Makefile +2 -3
index 17519fa..3dbae74 100644
@@ -5,12 +5,15 @@ obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o
-obj-$(CONFIG_ARCH_MSM7X30) += dma.o
-obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
+obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
+obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
Quoted 7 lines

arch/arm/mach-msm/Makefile obj-$(CONFIG_DEBUG_FS) += clock-debug.o · line 16

Quoted 6 lines
arch/arm/mach-msm/Makefile +4 -0
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
+obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
+obj-$(CONFIG_ARCH_MSM7X30) += dma.o
+obj-$(CONFIG_ARCH_QSD8X50) += dma.o
+

I did not understand what is the need of this change in Makefile?

Quoted from commit text:

reorder the initcall order of
dma.c so that it initializes after the clock driver probes but before any drivers use dma APIs.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#21 lore raw

PATCH 9/10 ARM: msm: Make proc_comm clock control into a platform driver

In reply to Stephen Boyd

To move closer to the generic struct clock framework move the proc_comm based clock code to a platform driver. The data describing the struct clks still live in the devices-$ARCH file, but the clock initialization is done at driver binding time.

Cc Saravana Kannan <[email protected]>
---
 arch/arm/mach-msm/board-halibut.c      |  2 +-
 arch/arm/mach-msm/board-msm7x30.c      |  2 +-
 arch/arm/mach-msm/board-qsd8x50.c      |  2 +-
 arch/arm/mach-msm/board-trout.c        |  3 +--
 arch/arm/mach-msm/clock-pcom.c         | 23 +++++++++++++++++++++--
 arch/arm/mach-msm/clock-pcom.h         |  5 +++++
 arch/arm/mach-msm/clock.c              |  2 +-
 arch/arm/mach-msm/clock.h              |  3 +++
 arch/arm/mach-msm/devices-msm7x00.c    | 12 ++++++++++--
 arch/arm/mach-msm/devices-msm7x30.c    | 11 +++++++++--
 arch/arm/mach-msm/devices-qsd8x50.c    | 11 +++++++++--
 arch/arm/mach-msm/devices.h            | 15 +++------------
 arch/arm/mach-msm/include/mach/board.h |  5 -----
 13 files changed, 65 insertions(+), 31 deletions(-)
arch/arm/mach-msm/board-halibut.c +1 -1
index 6ce542e..3c8cfe4 100644
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
 };
 
 static struct platform_device *devices[] __initdata = {
+	&msm_clock_7x01a,
 	&msm_device_uart3,
 	&msm_device_smd,
 	&msm_device_nand,
@@ -90,7 +91,6 @@ static void __init halibut_fixup(struct tag *tags, char **cmdline,
 static void __init halibut_map_io(void)
 {
 	msm_map_common_io();
-	msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
 }
 
 static void __init halibut_init_late(void)
arch/arm/mach-msm/board-msm7x30.c +1 -1
index effa6f4..22e267e 100644
@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
 };
 
 static struct platform_device *devices[] __initdata = {
+	&msm_clock_7x30,
 #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
         &msm_device_uart2,
 #endif
@@ -115,7 +116,6 @@ static void __init msm7x30_init(void)
 static void __init msm7x30_map_io(void)
 {
 	msm_map_msm7x30_io();
-	msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
 }
 
 static void __init msm7x30_init_late(void)
arch/arm/mach-msm/board-qsd8x50.c +1 -1
index b16b71a..4d5d7ef 100644
@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
 };
 
 static struct platform_device *devices[] __initdata = {
+	&msm_clock_8x50,
 	&msm_device_uart3,
 	&msm_device_smd,
 	&msm_device_otg,
@@ -171,7 +172,6 @@ static void __init qsd8x50_init_mmc(void)
 static void __init qsd8x50_map_io(void)
 {
 	msm_map_qsd8x50_io();
-	msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50);
 }
 
 static void __init qsd8x50_init_irq(void)
arch/arm/mach-msm/board-trout.c +1 -2
index 4ba0800..c8352e7 100644
@@ -36,6 +36,7 @@
 extern int trout_init_mmc(unsigned int);
 
 static struct platform_device *devices[] __initdata = {
+	&msm_clock_7x01a,
 	&msm_device_uart3,
 	&msm_device_smd,
 	&msm_device_nand,
@@ -93,8 +94,6 @@ static void __init trout_map_io(void)
 	/* route UART3 to the "H2W" extended usb connector */
 	writeb(0x80, TROUT_CPLD_BASE + 0x00);
 #endif
-
-	msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
 }
 
 static void __init trout_init_late(void)
arch/arm/mach-msm/clock-pcom.c +21 -2
index bb75f8e..7c4c60a 100644
@@ -14,8 +14,9 @@
  */
 
 #include <linux/err.h>
-#include <linux/ctype.h>
-#include <linux/stddef.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+
 #include <mach/clk.h>
 
 #include "proc_comm.h"
@@ -126,3 +127,21 @@ struct clk_ops clk_ops_pcom = {
 	.round_rate = pc_clk_round_rate,
 	.is_local = pc_clk_is_local,
 };
+
+static int __devinit msm_clock_pcom_probe(struct platform_device *pdev)
+{
+	struct pcom_clk_pdata *pdata = pdev->dev.platform_data;
+	msm_clock_init(pdata->lookup, pdata->num_lookups);
+	return 0;
+}
+
+static struct platform_driver msm_clock_pcom_driver = {
+	.probe		= msm_clock_pcom_probe,
+	.driver		= {
+		.name	= "msm-clock-pcom",
+		.owner	= THIS_MODULE,
+	},
+};
+module_platform_driver(msm_clock_pcom_driver);
+
+MODULE_LICENSE("GPL v2");
arch/arm/mach-msm/clock-pcom.h +5 -0
index 974d003..87406a3 100644
@@ -123,6 +123,11 @@
 struct clk_ops;
 extern struct clk_ops clk_ops_pcom;
 
+struct pcom_clk_pdata {
+	struct clk_lookup *lookup;
+	u32 num_lookups;
+};
+
 int pc_clk_reset(unsigned id, enum clk_reset_action action);
 
 #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) {	\
arch/arm/mach-msm/clock.c +1 -1
index 8d07b25..01af7a4 100644
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(clk_get_parent);
  */
 static struct clk *ebi1_clk;
 
-void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)
+void __devinit msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks)
 {
 	unsigned n;
 
arch/arm/mach-msm/clock.h +3 -0
index a25ff58..cc76bfe 100644
@@ -63,4 +63,7 @@ static inline int __init clock_debug_init(void) { return 0; }
 static inline int __init clock_debug_add(struct clk *clock) { return 0; }
 #endif
 
+struct clk_lookup;
+void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks);
+
 #endif
arch/arm/mach-msm/devices-msm7x00.c +10 -2
index 993780f..2e63a19 100644
@@ -394,7 +394,7 @@ struct platform_device msm_device_mdp = {
 	.resource = resources_mdp,
 };
 
-struct clk_lookup msm_clocks_7x01a[] = {
+static struct clk_lookup msm_clocks_7x01a[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("adsp_clk",	ADSP_CLK,	NULL, 0),
 	CLK_PCOM("ebi1_clk",	EBI1_CLK,	NULL, 0),
@@ -438,4 +438,12 @@ struct clk_lookup msm_clocks_7x01a[] = {
 	CLK_PCOM("vfe_mdc_clk",	VFE_MDC_CLK,	NULL, OFF),
 };
 
-unsigned msm_num_clocks_7x01a = ARRAY_SIZE(msm_clocks_7x01a);
+static struct pcom_clk_pdata msm_clock_7x01a_pdata = {
+	.lookup = msm_clocks_7x01a,
+	.num_lookups = ARRAY_SIZE(msm_clocks_7x01a),
+};
+
+struct platform_device msm_clock_7x01a = {
+	.name = "msm-clock-pcom",
+	.dev.platform_data = &msm_clock_7x01a_pdata,
+};
arch/arm/mach-msm/devices-msm7x30.c +9 -2
index 1597d43..a22f067 100644
@@ -130,7 +130,7 @@ struct platform_device msm_device_hsusb_host = {
 	},
 };
 
-struct clk_lookup msm_clocks_7x30[] = {
+static struct clk_lookup msm_clocks_7x30[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("adsp_clk",	ADSP_CLK,	NULL, 0),
 	CLK_PCOM("cam_m_clk",	CAM_M_CLK,	NULL, 0),
@@ -204,5 +204,12 @@ struct clk_lookup msm_clocks_7x30[] = {
 	CLK_PCOM("csi_vfe_clk",	CSI0_VFE_CLK,	NULL, 0),
 };
 
-unsigned msm_num_clocks_7x30 = ARRAY_SIZE(msm_clocks_7x30);
+static struct pcom_clk_pdata msm_clock_7x30_pdata = {
+	.lookup = msm_clocks_7x30,
+	.num_lookups = ARRAY_SIZE(msm_clocks_7x30),
+};
 
+struct platform_device msm_clock_7x30 = {
+	.name = "msm-clock-pcom",
+	.dev.platform_data = &msm_clock_7x30_pdata,
+};
arch/arm/mach-msm/devices-qsd8x50.c +9 -2
index 131633b..b6c788e 100644
@@ -291,7 +291,7 @@ int __init msm_add_sdcc(unsigned int controller,
 	return platform_device_register(pdev);
 }
 
-struct clk_lookup msm_clocks_8x50[] = {
+static struct clk_lookup msm_clocks_8x50[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("ce_clk",	CE_CLK,		NULL, 0),
 	CLK_PCOM("ebi1_clk",	EBI1_CLK,	NULL, CLK_MIN),
@@ -345,5 +345,12 @@ struct clk_lookup msm_clocks_8x50[] = {
 	CLK_PCOM("usb_phy_clk",	USB_PHY_CLK,	NULL, 0),
 };
 
-unsigned msm_num_clocks_8x50 = ARRAY_SIZE(msm_clocks_8x50);
+static struct pcom_clk_pdata msm_clock_8x50_pdata = {
+	.lookup = msm_clocks_8x50,
+	.num_lookups = ARRAY_SIZE(msm_clocks_8x50),
+};
 
+struct platform_device msm_clock_8x50 = {
+	.name = "msm-clock-pcom",
+	.dev.platform_data = &msm_clock_8x50_pdata,
+};
arch/arm/mach-msm/devices.h +3 -12
index 9545c19..b53c96d 100644
@@ -16,10 +16,6 @@
 #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H
 #define __ARCH_ARM_MACH_MSM_DEVICES_H
 
-#include <linux/clkdev.h>
-
-#include "clock.h"
-
 extern struct platform_device msm_device_uart1;
 extern struct platform_device msm_device_uart2;
 extern struct platform_device msm_device_uart3;
@@ -46,13 +42,8 @@ extern struct platform_device msm_device_mddi0;
 extern struct platform_device msm_device_mddi1;
 extern struct platform_device msm_device_mdp;
 
-extern struct clk_lookup msm_clocks_7x01a[];
-extern unsigned msm_num_clocks_7x01a;
-
-extern struct clk_lookup msm_clocks_7x30[];
-extern unsigned msm_num_clocks_7x30;
-
-extern struct clk_lookup msm_clocks_8x50[];
-extern unsigned msm_num_clocks_8x50;
+extern struct platform_device msm_clock_7x01a;
+extern struct platform_device msm_clock_7x30;
+extern struct platform_device msm_clock_8x50;
 
 #endif
arch/arm/mach-msm/include/mach/board.h +0 -5
index 0a0c393..71f19f6 100644
@@ -20,16 +20,11 @@
 #include <linux/types.h>
 #include <mach/mmc.h>
 
-/* platform device data structures */
-
-struct clk_lookup;
-
 /* common init routines for use by arch/arm/mach-msm/board-*.c */
 
 void __init msm_add_devices(void);
 void __init msm_init_irq(void);
 void __init msm_init_gpio(void);
-void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks);
 int __init msm_add_sdcc(unsigned int controller,
 			struct msm_mmc_platform_data *plat,
 			unsigned int stat_irq, unsigned long stat_irq_flags);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Reviewed-by on v1 9/10
#22 lore raw

Re: [PATCH 09/10] ARM: msm: Make proc_comm clock control into a platform driver

Hi Stephen,

Its good you started moving the msm to common clock framework.:) I hope msm's codeaurora tree will also be moved to CCF soon. :)

Quoted 8 lines · Stephen Boyd

To move closer to the generic struct clock framework move the proc_comm based clock code to a platform driver. The data describing the struct clks still live in the devices-$ARCH file, but the clock initialization is done at driver binding time.

Cc Saravana Kannan <[email protected]>

---

Quoted 20 lines
 arch/arm/mach-msm/board-halibut.c      |  2 +-
 arch/arm/mach-msm/board-msm7x30.c      |  2 +-
 arch/arm/mach-msm/board-qsd8x50.c      |  2 +-
 arch/arm/mach-msm/board-trout.c        |  3 +--
 arch/arm/mach-msm/clock-pcom.c         | 23 +++++++++++++++++++++--
 arch/arm/mach-msm/clock-pcom.h         |  5 +++++
 arch/arm/mach-msm/clock.c              |  2 +-
 arch/arm/mach-msm/clock.h              |  3 +++
 arch/arm/mach-msm/devices-msm7x00.c    | 12 ++++++++++--
 arch/arm/mach-msm/devices-msm7x30.c    | 11 +++++++++--
 arch/arm/mach-msm/devices-qsd8x50.c    | 11 +++++++++--
 arch/arm/mach-msm/devices.h            | 15 +++------------
 arch/arm/mach-msm/include/mach/board.h |  5 -----
 13 files changed, 65 insertions(+), 31 deletions(-)
arch/arm/mach-msm/board-halibut.c +0 -0
index 6ce542e..3c8cfe4 100644

arch/arm/mach-msm/board-halibut.c static struct platform_device smc91x_device = { · line 64

Quoted 6 lines
arch/arm/mach-msm/board-halibut.c +4 -0
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
 };
 
+
+static int __devinit msm_clock_pcom_probe(struct platform_device *pdev)
+{
+       struct pcom_clk_pdata *pdata = pdev->dev.platform_data;

Should'nt it be const struct?

arch/arm/mach-msm/board-halibut.c static struct platform_device smc91x_device = {

Quoted 4 lines
arch/arm/mach-msm/board-halibut.c +4 -0
+       msm_clock_init(pdata->lookup, pdata->num_lookups);
+       return 0;
+}
+

--
Pankaj Jangra

#23 lore raw

Re: [PATCH 09/10] ARM: msm: Make proc_comm clock control into a platform driver

Quoted 6 lines · Pankaj Jangra

arch/arm/mach-msm/clock-pcom.c struct clk_ops clk_ops_pcom = { · line 133

Quoted 5 lines
arch/arm/mach-msm/clock-pcom.c +4 -0
+
+static int __devinit msm_clock_pcom_probe(struct platform_device *pdev)
+{
+       struct pcom_clk_pdata *pdata = pdev->dev.platform_data;

Should'nt it be const struct?

Sure. Fixed.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#24 lore raw

PATCH 10/10 ARM: msm: Migrate to common clock framework

In reply to Stephen Boyd

Move the existing clock code in mach-msm to the common clock framework. We lose our capability to set the rate of and enable a clock through debugfs. This is ok though because the debugfs features are mainly used for testing and development of new clock code.

To maintain compatibility with the original MSM clock code we make a wrapper for clk_reset() that calls the struct msm_clk specific reset function. This is necessary for the usb and sdcc devices on MSM until a better suited API is made available.

Cc Saravana Kannan <[email protected]>
Cc Mike Turquette <[email protected]>
---
 arch/arm/Kconfig                    |   1 +
 arch/arm/mach-msm/Makefile          |   1 -
 arch/arm/mach-msm/clock-debug.c     | 123 ------------------------------
 arch/arm/mach-msm/clock-pcom.c      | 118 ++++++++++++++++++-----------
 arch/arm/mach-msm/clock-pcom.h      |  30 ++++----
 arch/arm/mach-msm/clock.c           | 146 ++----------------------------------
 arch/arm/mach-msm/clock.h           |  46 +++---------
 arch/arm/mach-msm/devices-msm7x00.c |   2 +-
 arch/arm/mach-msm/devices-msm7x30.c |   2 +-
 arch/arm/mach-msm/devices-qsd8x50.c |   2 +-
 10 files changed, 108 insertions(+), 363 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-debug.c
arch/arm/Kconfig +1 -0
index 433e9b8..2809213 100644
@@ -727,6 +727,7 @@ config ARCH_MSM
 	select GENERIC_CLOCKEVENTS
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
+	select COMMON_CLK
 	help
 	  Support for Qualcomm MSM/QSD based systems.  This runs on the
 	  apps processor of the MSM/QSD and depends on a shared memory
arch/arm/mach-msm/Makefile +0 -1
index 3dbae74..700d77b 100644
@@ -1,6 +1,5 @@
 obj-y += io.o timer.o
 obj-y += clock.o
-obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
arch/arm/mach-msm/clock-debug.c deleted +0 -123

123 lines not on this page · raw message

arch/arm/mach-msm/clock-pcom.c +74 -44

197 lines not on this page · raw message

arch/arm/mach-msm/clock-pcom.h +15 -15
index 87406a3..5bb164f 100644
@@ -1,4 +1,5 @@
-/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+/*
+ * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -120,26 +121,25 @@
 
 #define P_NR_CLKS		102
 
-struct clk_ops;
-extern struct clk_ops clk_ops_pcom;
+struct clk_pcom_desc {
+	unsigned id;
+	const char *name;
+	const char *con;
+	const char *dev;
+	unsigned long flags;
+};
 
 struct pcom_clk_pdata {
-	struct clk_lookup *lookup;
+	struct clk_pcom_desc *lookup;
 	u32 num_lookups;
 };
 
-int pc_clk_reset(unsigned id, enum clk_reset_action action);
-
 #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) {	\
-	.con_id = clk_name, \
-	.dev_id = clk_dev, \
-	.clk = &(struct clk){ \
-		.id = P_##clk_id, \
-		.remote_id = P_##clk_id, \
-		.ops = &clk_ops_pcom, \
-		.flags = clk_flags, \
-		.dbg_name = #clk_id, \
-	}, \
+	.id = P_##clk_id,					\
+	.name = #clk_id,					\
+	.con = clk_name,					\
+	.dev = clk_dev,						\
+	.flags = clk_flags,					\
 	}
 
 #endif
arch/arm/mach-msm/clock.c +5 -141

163 lines not on this page · raw message

arch/arm/mach-msm/clock.h +10 -36

69 lines not on this page · raw message

arch/arm/mach-msm/devices-msm7x00.c +1 -1
index 2e63a19..bda7ffd 100644
@@ -394,7 +394,7 @@ struct platform_device msm_device_mdp = {
 	.resource = resources_mdp,
 };
 
-static struct clk_lookup msm_clocks_7x01a[] = {
+static struct clk_pcom_desc msm_clocks_7x01a[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("adsp_clk",	ADSP_CLK,	NULL, 0),
 	CLK_PCOM("ebi1_clk",	EBI1_CLK,	NULL, 0),
arch/arm/mach-msm/devices-msm7x30.c +1 -1
index a22f067..1b08f0e 100644
@@ -130,7 +130,7 @@ struct platform_device msm_device_hsusb_host = {
 	},
 };
 
-static struct clk_lookup msm_clocks_7x30[] = {
+static struct clk_pcom_desc msm_clocks_7x30[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("adsp_clk",	ADSP_CLK,	NULL, 0),
 	CLK_PCOM("cam_m_clk",	CAM_M_CLK,	NULL, 0),
arch/arm/mach-msm/devices-qsd8x50.c +1 -1
index b6c788e..0f1dec0 100644
@@ -291,7 +291,7 @@ int __init msm_add_sdcc(unsigned int controller,
 	return platform_device_register(pdev);
 }
 
-static struct clk_lookup msm_clocks_8x50[] = {
+static struct clk_pcom_desc msm_clocks_8x50[] = {
 	CLK_PCOM("adm_clk",	ADM_CLK,	NULL, 0),
 	CLK_PCOM("ce_clk",	CE_CLK,		NULL, 0),
 	CLK_PCOM("ebi1_clk",	EBI1_CLK,	NULL, CLK_MIN),
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#25 lore raw

Re: [PATCH 10/10] ARM: msm: Migrate to common clock framework

Hi Stephen,

Quoted 18 lines · Stephen Boyd
arch/arm/mach-msm/clock-pcom.c +8 -6
-static int pc_clk_set_rate(unsigned id, unsigned rate)
+static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate,
+                          unsigned long p_rate)
 {
-       /* The rate _might_ be rounded off to the nearest KHz value by the
+       struct clk_pcom *p = to_clk_pcom(hw);
+       unsigned id = p->id, rate = new_rate;
+       int rc;
+
+       /*
+        * The rate _might_ be rounded off to the nearest KHz value by the
         * remote function. So a return value of 0 doesn't necessarily mean
         * that the exact rate was set successfully.
         */
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
-       else

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 85

Quoted 10 lines
arch/arm/mach-msm/clock-pcom.c +2 -8
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_min_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
+       if (p->flags & CLKFLAG_MIN)
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);

You are missing if condition here checking the rc ?

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 82

Quoted 7 lines

else

arch/arm/mach-msm/clock-pcom.c +0 -6
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_max_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MAX_RATE, &id, &rate);

and else here i think for the MIN_FLAG if check.

Quoted 7 lines
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
        if (rc < 0)
                return rc;
        else
                return (int)id < 0 ? -EINVAL : 0;

}

--
Pankaj Jangra

#26 lore raw

Re: [PATCH 10/10] ARM: msm: Migrate to common clock framework

Quoted 34 lines · Pankaj Jangra

Hi Stephen,

Quoted 18 lines · Stephen Boyd
arch/arm/mach-msm/clock-pcom.c +8 -6
-static int pc_clk_set_rate(unsigned id, unsigned rate)
+static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate,
+                          unsigned long p_rate)
 {
-       /* The rate _might_ be rounded off to the nearest KHz value by the
+       struct clk_pcom *p = to_clk_pcom(hw);
+       unsigned id = p->id, rate = new_rate;
+       int rc;
+
+       /*
+        * The rate _might_ be rounded off to the nearest KHz value by the
         * remote function. So a return value of 0 doesn't necessarily mean
         * that the exact rate was set successfully.
         */
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
-       else

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 85

Quoted 10 lines
arch/arm/mach-msm/clock-pcom.c +2 -8
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_min_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
+       if (p->flags & CLKFLAG_MIN)
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);

You are missing if condition here checking the rc ?

Quoted 15 lines

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 82

Quoted 7 lines

else

arch/arm/mach-msm/clock-pcom.c +0 -6
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_max_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MAX_RATE, &id, &rate);

and else here i think for the MIN_FLAG if check.

Quoted 6 lines
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
        if (rc < 0)
                return rc;
        else
                return (int)id < 0 ? -EINVAL : 0;

}

This is the resulting code:

        if (p->flags & CLKFLAG_MIN)
                rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
        else
                rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
        if (rc < 0)
                return rc;
        else
                return (int)id < 0 ? -EINVAL : 0;

So we check the rc for both cases in the same if condition. Is there anything wrong?

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#27 lore raw

Re: [PATCH 10/10] ARM: msm: Migrate to common clock framework

Hi,

Quoted 62 lines · Stephen Boyd
Quoted 34 lines · Pankaj Jangra

Hi Stephen,

Quoted 18 lines · Stephen Boyd
arch/arm/mach-msm/clock-pcom.c +8 -6
-static int pc_clk_set_rate(unsigned id, unsigned rate)
+static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate,
+                          unsigned long p_rate)
 {
-       /* The rate _might_ be rounded off to the nearest KHz value by the
+       struct clk_pcom *p = to_clk_pcom(hw);
+       unsigned id = p->id, rate = new_rate;
+       int rc;
+
+       /*
+        * The rate _might_ be rounded off to the nearest KHz value by the
         * remote function. So a return value of 0 doesn't necessarily mean
         * that the exact rate was set successfully.
         */
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
-       else

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 85

Quoted 10 lines
arch/arm/mach-msm/clock-pcom.c +2 -8
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_min_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
-       if (rc < 0)
-               return rc;
+       if (p->flags & CLKFLAG_MIN)
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);

You are missing if condition here checking the rc ?

Quoted 15 lines

arch/arm/mach-msm/clock-pcom.c int pc_clk_reset(unsigned id, enum clk_reset_action action) · line 82

Quoted 7 lines

else

arch/arm/mach-msm/clock-pcom.c +0 -6
-               return (int)id < 0 ? -EINVAL : 0;
-}
-
-static int pc_clk_set_max_rate(unsigned id, unsigned rate)
-{
-       int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MAX_RATE, &id, &rate);

and else here i think for the MIN_FLAG if check.

Quoted 6 lines
+               rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
        if (rc < 0)
                return rc;
        else
                return (int)id < 0 ? -EINVAL : 0;

}

This is the resulting code:

        if (p->flags & CLKFLAG_MIN)
                rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
        else
                rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
        if (rc < 0)
                return rc;
        else
                return (int)id < 0 ? -EINVAL : 0;
Quoted 2 lines

So we check the rc for both cases in the same if condition. Is there anything wrong?

My mistake. I overlooked a line. Sorry for spam. Thanks

--
Pankaj Jangra

#28 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2012-09-20 19:26:48)

Quoted 7 lines

This patchset moves the existing MSM clock code and affected drivers to the common clock framework. A prerequisite of moving to the common clock framework is to use clk_prepare() and clk_enable() so the first few patches migrate drivers to that call (clk_prepare() is a no-op on MSM right now). It also removes some custom clock APIs that MSM provides and finally moves the proc_comm clock code to the common struct clock.

Quoted 6 lines

This patch series will be used as the foundation of the MSM 8660/8960 clock code that I plan to send out soon.

These patches have one dependency on the devm_clk_register() function which I already posted to the list[1]. They're based on linux-next-20120917.

Hi Stephen,

Thanks for sending this! It is too much churn to take in for the 3.7 merge window. As such I'll put reviewing this on my TODO list, but it might wait until after the merge window settles down.

Regards,
Mike

Quoted 50 lines

Stephen Boyd (10):
usb: otg: msm: Convert to clk_prepare/unprepare
msm_sdcc: Convert to clk_prepare/unprepare
msm: iommu: Convert to clk_prepare/unprepare
msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()
ARM: msm: Remove custom clk_set_flags() API
ARM: msm: Remove custom clk_set_{max,min}_rate() API
ARM: msm: Remove clock-7x30.h include file
ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver
ARM: msm: Make proc_comm clock control into a platform driver
ARM: msm: Migrate to common clock framework

 arch/arm/Kconfig                       |   1 +
 arch/arm/mach-msm/Makefile             |  10 +-
 arch/arm/mach-msm/board-halibut.c      |   2 +-
 arch/arm/mach-msm/board-msm7x30.c      |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c      |   2 +-
 arch/arm/mach-msm/board-trout-panel.c  |  19 ++--
 arch/arm/mach-msm/board-trout.c        |   3 +-
 arch/arm/mach-msm/clock-7x30.h         | 155 ------------------------------
 arch/arm/mach-msm/clock-debug.c        | 130 --------------------------
 arch/arm/mach-msm/clock-pcom.c         | 149 ++++++++++++++++++-----------
 arch/arm/mach-msm/clock-pcom.h         |  31 +++---
 arch/arm/mach-msm/clock.c              | 166 +--------------------------------
 arch/arm/mach-msm/clock.h              |  51 +++-------
 arch/arm/mach-msm/devices-msm7x00.c    |  12 ++-
 arch/arm/mach-msm/devices-msm7x30.c    |  13 ++-
 arch/arm/mach-msm/devices-qsd8x50.c    |  11 ++-
 arch/arm/mach-msm/devices.h            |  15 +--
 arch/arm/mach-msm/dma.c                |   5 +-
 arch/arm/mach-msm/include/mach/board.h |   5 -
 arch/arm/mach-msm/include/mach/clk.h   |   9 --
 drivers/iommu/msm_iommu_dev.c          |  20 ++--
 drivers/mmc/host/msm_sdcc.c            |  14 ++-
 drivers/usb/otg/msm_otg.c              |  38 ++++----
 23 files changed, 222 insertions(+), 641 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

[1] https://lkml.org/lkml/2012/9/19/28

Signature · 8 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel