* [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver
@ 2014-06-11 1:17 Jonghwa Lee
2014-06-11 1:17 ` [PATCH 1/3] devfreq: exynos4_bus: Enable PPMU's source clock before use Jonghwa Lee
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jonghwa Lee @ 2014-06-11 1:17 UTC (permalink / raw)
To: linux-pm; +Cc: myungjoo.ham, kyungmin.park, cw00.choi, Jonghwa Lee
Driver updates including devicetree supporting and some fixes.
Jonghwa Lee (3):
devfreq: exynos4_bus: Enable PPMU's source clock before use.
devfreq: exynos4_bus: Access memory mapped I/O region via dynamic
allocation.
devfreq: exynos4_bus: Support DT in exynos4 busfreq driver.
.../devicetree/bindings/devfreq/exynos4_bus.txt | 19 +++++
drivers/devfreq/exynos/exynos4_bus.c | 77 +++++++++++++++++---
2 files changed, 87 insertions(+), 9 deletions(-)
create mode 100644 Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] devfreq: exynos4_bus: Enable PPMU's source clock before use.
2014-06-11 1:17 [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver Jonghwa Lee
@ 2014-06-11 1:17 ` Jonghwa Lee
2014-06-11 1:17 ` [PATCH 2/3] devfreq: exynos4_bus: Access memory mapped I/O region via dynamic allocation Jonghwa Lee
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jonghwa Lee @ 2014-06-11 1:17 UTC (permalink / raw)
To: linux-pm; +Cc: myungjoo.ham, kyungmin.park, cw00.choi, Jonghwa Lee
Current exynos4_bus driver uses PPMUs for DMC0/1 to gauge bus utilization,
and they has own operation clock. It's needed to be enabled before use.
While it isn't gated by default, we should assure if clock is gated.
It'll find related clocks with given name, and if it fails to find then
assumes that they are enabled and keeps probing. Otherwise, it'll try to
enable them and exit the probing unless clocks are enabled successfully.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
drivers/devfreq/exynos/exynos4_bus.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index d9b08d3..cadad03 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
+#include <linux/clk.h>
#include <mach/map.h>
@@ -79,6 +80,7 @@ struct busfreq_data {
struct regulator *vdd_mif; /* Exynos4412/4212 only */
struct busfreq_opp_info curr_oppinfo;
struct busfreq_ppmu_data ppmu_data;
+ struct clk *clk_ppmu[PPMU_END];
struct notifier_block pm_notifier;
struct mutex lock;
@@ -955,6 +957,28 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
}
}
+ data->clk_ppmu[PPMU_DMC0] = devm_clk_get(dev, "ppmudmc0");
+ if (IS_ERR(data->clk_ppmu[PPMU_DMC0])) {
+ dev_warn(dev, "Cannot get ppmudmc0 clock\n");
+ } else {
+ err = clk_prepare_enable(data->clk_ppmu[PPMU_DMC0]);
+ if (err) {
+ dev_err(dev, "Cannot enable ppmudmc0 clock\n");
+ return err;
+ }
+ }
+
+ data->clk_ppmu[PPMU_DMC1] = devm_clk_get(dev, "ppmudmc1");
+ if (IS_ERR(data->clk_ppmu[PPMU_DMC1])) {
+ dev_warn(dev, "Cannot get ppmudmc1 clock\n");
+ } else {
+ err = clk_prepare_enable(data->clk_ppmu[PPMU_DMC1]);
+ if (err) {
+ dev_err(dev, "Cannot enable ppmudmc0 clock\n");
+ return err;
+ }
+ }
+
rcu_read_lock();
opp = dev_pm_opp_find_freq_floor(dev,
&exynos4_devfreq_profile.initial_freq);
@@ -1001,6 +1025,10 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
static int exynos4_busfreq_remove(struct platform_device *pdev)
{
struct busfreq_data *data = platform_get_drvdata(pdev);
+ int i;
+
+ for (i = 0; i < PPMU_END; i++)
+ clk_disable_unprepare(data->clk_ppmu[i]);
/* Unregister all of notifier chain */
unregister_pm_notifier(&data->pm_notifier);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] devfreq: exynos4_bus: Access memory mapped I/O region via dynamic allocation.
2014-06-11 1:17 [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver Jonghwa Lee
2014-06-11 1:17 ` [PATCH 1/3] devfreq: exynos4_bus: Enable PPMU's source clock before use Jonghwa Lee
@ 2014-06-11 1:17 ` Jonghwa Lee
2014-06-11 1:17 ` [PATCH 3/3] devfreq: exynos4_bus: Support DT in exynos4 busfreq driver Jonghwa Lee
2014-06-11 3:27 ` [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 " Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Jonghwa Lee @ 2014-06-11 1:17 UTC (permalink / raw)
To: linux-pm; +Cc: myungjoo.ham, kyungmin.park, cw00.choi, Jonghwa Lee
Instead of using statically allocated MMIO(Memory Mapped IO) region,
it makes driver to use ioremap() to allocate the SFR region dynamically.
This patch also includes minor code clean.
WARNING: line over 80 characters
907: FILE: drivers/devfreq/exynos/exynos4_bus.c:907:
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
drivers/devfreq/exynos/exynos4_bus.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index cadad03..7c5e940 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -25,8 +25,7 @@
#include <linux/regulator/consumer.h>
#include <linux/module.h>
#include <linux/clk.h>
-
-#include <mach/map.h>
+#include <linux/io.h>
#include "exynos_ppmu.h"
#include "exynos4_bus.h"
@@ -902,9 +901,9 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
struct busfreq_ppmu_data *ppmu_data;
struct dev_pm_opp *opp;
struct device *dev = &pdev->dev;
- int err = 0;
+ int i, err = 0;
- data = devm_kzalloc(&pdev->dev, sizeof(struct busfreq_data), GFP_KERNEL);
+ data = devm_kzalloc(dev, sizeof(struct busfreq_data), GFP_KERNEL);
if (data == NULL) {
dev_err(dev, "Cannot allocate memory.\n");
return -ENOMEM;
@@ -921,8 +920,20 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
}
data->type = pdev->id_entry->driver_data;
- ppmu_data->ppmu[PPMU_DMC0].hw_base = S5P_VA_DMC0;
- ppmu_data->ppmu[PPMU_DMC1].hw_base = S5P_VA_DMC1;
+
+ /* Allocate MMIO region for PPMU SFRs */
+ for (i = 0; i < PPMU_END; i++) {
+ struct resource *res;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+ if (!res) {
+ dev_err(dev, "No mem resource for ppmu[%d]\n", i);
+ return -ENOENT;
+ }
+
+ ppmu_data->ppmu[i].hw_base = devm_ioremap_resource(dev, res);
+ }
+
data->pm_notifier.notifier_call = exynos4_busfreq_pm_notifier_event;
data->dev = dev;
mutex_init(&data->lock);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] devfreq: exynos4_bus: Support DT in exynos4 busfreq driver.
2014-06-11 1:17 [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver Jonghwa Lee
2014-06-11 1:17 ` [PATCH 1/3] devfreq: exynos4_bus: Enable PPMU's source clock before use Jonghwa Lee
2014-06-11 1:17 ` [PATCH 2/3] devfreq: exynos4_bus: Access memory mapped I/O region via dynamic allocation Jonghwa Lee
@ 2014-06-11 1:17 ` Jonghwa Lee
2014-06-11 3:27 ` [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 " Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Jonghwa Lee @ 2014-06-11 1:17 UTC (permalink / raw)
To: linux-pm; +Cc: myungjoo.ham, kyungmin.park, cw00.choi, Jonghwa Lee
This patch makes exynos4 busfreq driver to use DeviceTree.
This patch includes creation of DT binding documentation directory for
devfreq and exynos4_bus driver's description.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
.../devicetree/bindings/devfreq/exynos4_bus.txt | 19 +++++++++++++
drivers/devfreq/exynos/exynos4_bus.c | 30 ++++++++++++++++----
2 files changed, 44 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
diff --git a/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt b/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
new file mode 100644
index 0000000..5a65001
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
@@ -0,0 +1,19 @@
+Exynos4 busfreq bindings
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Require properties:
+- compatible : "samsung,exynos4210-busfreq";
+ "samsung,exynos4x12-busfreq";
+- reg : Memory range for PPMU IP block's SFR region.
+- clocks : Source clocks for PPMU blocks;
+ Currently, driver needs two ppmu clks for dmc0, dmc1.
+- clock-names : PPMU clock's lookup name;
+
+Examples:
+ busfreq@0 {
+ compatible = "samsung,exynos4x12-busfreq";
+ reg = <0x106A0000 0x2000>, <0x106B0000 0x2000>;
+ clocks = <&clock 412>, <&clock 413>;
+ clock-names = "ppmudmc0", "ppmudmc1";
+ };
+ };
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index 7c5e940..e2514b7 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -16,16 +16,13 @@
*/
#include <linux/io.h>
-#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/suspend.h>
-#include <linux/pm_opp.h>
#include <linux/devfreq.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
-#include <linux/clk.h>
-#include <linux/io.h>
+#include <linux/of.h>
#include "exynos_ppmu.h"
#include "exynos4_bus.h"
@@ -895,6 +892,22 @@ unlock:
return NOTIFY_DONE;
}
+#ifdef CONFIG_OF
+static const struct of_device_id exynos4_busfreq_match[] = {
+ {
+ .compatible = "samsung,exynos4210-busfreq",
+ .data = (void *)TYPE_BUSF_EXYNOS4210,
+ },
+ {
+ .compatible = "samsung,exynos4x12-busfreq",
+ .data = (void *)TYPE_BUSF_EXYNOS4x12,
+ },
+};
+MODULE_DEVICE_TABLE(of, exynos4_busfreq_match[]);
+#else
+#define exynos4_busfreq_match NULL
+#endif
+
static int exynos4_busfreq_probe(struct platform_device *pdev)
{
struct busfreq_data *data;
@@ -919,7 +932,13 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
return -ENOMEM;
}
- data->type = pdev->id_entry->driver_data;
+ if (dev->of_node) {
+ const struct of_device_id *match;
+ match = of_match_node(exynos4_busfreq_match, dev->of_node);
+ data->type = (int) match->data;
+ } else {
+ data->type = pdev->id_entry->driver_data;
+ }
/* Allocate MMIO region for PPMU SFRs */
for (i = 0; i < PPMU_END; i++) {
@@ -1075,6 +1094,7 @@ static struct platform_driver exynos4_busfreq_driver = {
.name = "exynos4-busfreq",
.owner = THIS_MODULE,
.pm = &exynos4_busfreq_pm_ops,
+ .of_match_table = of_match_ptr(exynos4_busfreq_match),
},
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver
2014-06-11 1:17 [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver Jonghwa Lee
` (2 preceding siblings ...)
2014-06-11 1:17 ` [PATCH 3/3] devfreq: exynos4_bus: Support DT in exynos4 busfreq driver Jonghwa Lee
@ 2014-06-11 3:27 ` Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-06-11 3:27 UTC (permalink / raw)
To: Jonghwa Lee; +Cc: linux-pm, myungjoo.ham, kyungmin.park
Hi Jonghwa,
I sent already this patchset to support dt for exynos4-busfreq[1].
You can check history of exynos4-busfreq on following patchset[1].
[1] https://lkml.org/lkml/2014/3/13/58
So, I'm preparing to implement common driver to support dt of PPMU.
Thanks,
Chanwoo Choi
On 06/11/2014 10:17 AM, Jonghwa Lee wrote:
> Driver updates including devicetree supporting and some fixes.
>
> Jonghwa Lee (3):
> devfreq: exynos4_bus: Enable PPMU's source clock before use.
> devfreq: exynos4_bus: Access memory mapped I/O region via dynamic
> allocation.
> devfreq: exynos4_bus: Support DT in exynos4 busfreq driver.
>
> .../devicetree/bindings/devfreq/exynos4_bus.txt | 19 +++++
> drivers/devfreq/exynos/exynos4_bus.c | 77 +++++++++++++++++---
> 2 files changed, 87 insertions(+), 9 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-11 3:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-11 1:17 [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 busfreq driver Jonghwa Lee
2014-06-11 1:17 ` [PATCH 1/3] devfreq: exynos4_bus: Enable PPMU's source clock before use Jonghwa Lee
2014-06-11 1:17 ` [PATCH 2/3] devfreq: exynos4_bus: Access memory mapped I/O region via dynamic allocation Jonghwa Lee
2014-06-11 1:17 ` [PATCH 3/3] devfreq: exynos4_bus: Support DT in exynos4 busfreq driver Jonghwa Lee
2014-06-11 3:27 ` [PATCH 0/3] devfreq: exynos4_bus: Update Exynos4 " Chanwoo Choi
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.