From: Philipp Zabel <philipp.zabel@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Samuel Ortiz <sameo@openedhand.com>,
Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
Matt Reimer <mreimer@vpop.net>,
Philipp Zabel <philipp.zabel@gmail.com>
Subject: [PATCH 5/6] mfd: DS1WM: remove clock handling
Date: Thu, 5 Feb 2009 17:53:39 +0100 [thread overview]
Message-ID: <1233852820-28549-6-git-send-email-philipp.zabel@gmail.com> (raw)
In-Reply-To: <1233852820-28549-1-git-send-email-philipp.zabel@gmail.com>
This driver requests a clock that usually is supplied by the MFD in which
the DS1WM is contained. Currently, it is impossible for a MFD to register
their clocks with the generic clock API due to different implementations
across architectures.
For now, this patch removes the clock handling from DS1WM altogether,
trusting that the MFD enable/disable functions will switch the clock if
needed. The clock rate is obtained from a new parameter in driver_data.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
drivers/w1/masters/ds1wm.c | 22 +++++-----------------
include/linux/mfd/ds1wm.h | 1 +
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index f1e6b3d..b982aa6 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -16,7 +16,6 @@
#include <linux/irq.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
-#include <linux/clk.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/mfd/core.h>
@@ -93,7 +92,6 @@ struct ds1wm_data {
struct mfd_cell *cell;
int irq;
int active_high;
- struct clk *clk;
int slave_present;
void *reset_complete;
void *read_complete;
@@ -216,17 +214,17 @@ static int ds1wm_find_divisor(int gclk)
static void ds1wm_up(struct ds1wm_data *ds1wm_data)
{
- int gclk, divisor;
+ int divisor;
+ struct ds1wm_driver_data *plat = ds1wm_data->cell->driver_data;
if (ds1wm_data->cell->enable)
ds1wm_data->cell->enable(ds1wm_data->pdev);
- gclk = clk_get_rate(ds1wm_data->clk);
- clk_enable(ds1wm_data->clk);
- divisor = ds1wm_find_divisor(gclk);
+ divisor = ds1wm_find_divisor(plat->clock_rate);
if (divisor == 0) {
dev_err(&ds1wm_data->pdev->dev,
- "no suitable divisor for %dHz clock\n", gclk);
+ "no suitable divisor for %dHz clock\n",
+ plat->clock_rate);
return;
}
ds1wm_write_register(ds1wm_data, DS1WM_CLKDIV, divisor);
@@ -247,8 +245,6 @@ static void ds1wm_down(struct ds1wm_data *ds1wm_data)
if (ds1wm_data->cell->disable)
ds1wm_data->cell->disable(ds1wm_data->pdev);
-
- clk_disable(ds1wm_data->clk);
}
/* --------------------------------------------------------------------- */
@@ -385,12 +381,6 @@ static int ds1wm_probe(struct platform_device *pdev)
if (ret)
goto err1;
- ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm");
- if (IS_ERR(ds1wm_data->clk)) {
- ret = PTR_ERR(ds1wm_data->clk);
- goto err2;
- }
-
ds1wm_up(ds1wm_data);
ds1wm_master.data = (void *)ds1wm_data;
@@ -403,7 +393,6 @@ static int ds1wm_probe(struct platform_device *pdev)
err3:
ds1wm_down(ds1wm_data);
- clk_put(ds1wm_data->clk);
err2:
free_irq(ds1wm_data->irq, ds1wm_data);
err1:
@@ -443,7 +432,6 @@ static int ds1wm_remove(struct platform_device *pdev)
w1_remove_master_device(&ds1wm_master);
ds1wm_down(ds1wm_data);
- clk_put(ds1wm_data->clk);
free_irq(ds1wm_data->irq, ds1wm_data);
iounmap(ds1wm_data->map);
kfree(ds1wm_data);
diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h
index d4898ba..be469a3 100644
--- a/include/linux/mfd/ds1wm.h
+++ b/include/linux/mfd/ds1wm.h
@@ -2,4 +2,5 @@
struct ds1wm_driver_data {
int active_high;
+ int clock_rate;
};
--
1.5.6.5
next prev parent reply other threads:[~2009-02-05 16:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 16:53 [PATCH 0/6] fix PASIC3/DS1WM, use MFD core Philipp Zabel
2009-02-05 16:53 ` [PATCH 1/6] mfd: DS1WM: convert to " Philipp Zabel
2009-02-05 16:53 ` [PATCH 2/6] mfd: PASIC3: " Philipp Zabel
2009-02-05 16:53 ` [PATCH 3/6] pxa/magician: remove deprecated .bus_shift from PASIC3 platform_data Philipp Zabel
2009-02-05 16:53 ` [PATCH 4/6] mfd: PASIC3: remove unused bus_shift field Philipp Zabel
2009-02-05 16:53 ` Philipp Zabel [this message]
2009-02-06 16:31 ` [PATCH] mfd: DS1WM: remove warning about unused label err2 Philipp Zabel
2009-02-05 16:53 ` [PATCH 6/6] mfd: PASIC3: supply clock_rate to DS1WM via driver_data Philipp Zabel
2009-02-05 21:14 ` [PATCH 0/6] fix PASIC3/DS1WM, use MFD core Evgeniy Polyakov
2009-02-06 14:16 ` Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233852820-28549-6-git-send-email-philipp.zabel@gmail.com \
--to=philipp.zabel@gmail.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mreimer@vpop.net \
--cc=sameo@openedhand.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome