aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/ds1wm.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index 29e144f81cbe..f1e6b3dd1e43 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -19,7 +19,8 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/ds1wm.h> 22#include <linux/mfd/core.h>
23#include <linux/mfd/ds1wm.h>
23 24
24#include <asm/io.h> 25#include <asm/io.h>
25 26
@@ -89,7 +90,7 @@ struct ds1wm_data {
89 void __iomem *map; 90 void __iomem *map;
90 int bus_shift; /* # of shifts to calc register offsets */ 91 int bus_shift; /* # of shifts to calc register offsets */
91 struct platform_device *pdev; 92 struct platform_device *pdev;
92 struct ds1wm_platform_data *pdata; 93 struct mfd_cell *cell;
93 int irq; 94 int irq;
94 int active_high; 95 int active_high;
95 struct clk *clk; 96 struct clk *clk;
@@ -217,8 +218,8 @@ static void ds1wm_up(struct ds1wm_data *ds1wm_data)
217{ 218{
218 int gclk, divisor; 219 int gclk, divisor;
219 220
220 if (ds1wm_data->pdata->enable) 221 if (ds1wm_data->cell->enable)
221 ds1wm_data->pdata->enable(ds1wm_data->pdev); 222 ds1wm_data->cell->enable(ds1wm_data->pdev);
222 223
223 gclk = clk_get_rate(ds1wm_data->clk); 224 gclk = clk_get_rate(ds1wm_data->clk);
224 clk_enable(ds1wm_data->clk); 225 clk_enable(ds1wm_data->clk);
@@ -244,8 +245,8 @@ static void ds1wm_down(struct ds1wm_data *ds1wm_data)
244 ds1wm_write_register(ds1wm_data, DS1WM_INT_EN, 245 ds1wm_write_register(ds1wm_data, DS1WM_INT_EN,
245 ds1wm_data->active_high ? DS1WM_INTEN_IAS : 0); 246 ds1wm_data->active_high ? DS1WM_INTEN_IAS : 0);
246 247
247 if (ds1wm_data->pdata->disable) 248 if (ds1wm_data->cell->disable)
248 ds1wm_data->pdata->disable(ds1wm_data->pdev); 249 ds1wm_data->cell->disable(ds1wm_data->pdev);
249 250
250 clk_disable(ds1wm_data->clk); 251 clk_disable(ds1wm_data->clk);
251} 252}
@@ -330,13 +331,18 @@ static struct w1_bus_master ds1wm_master = {
330static int ds1wm_probe(struct platform_device *pdev) 331static int ds1wm_probe(struct platform_device *pdev)
331{ 332{
332 struct ds1wm_data *ds1wm_data; 333 struct ds1wm_data *ds1wm_data;
333 struct ds1wm_platform_data *plat; 334 struct ds1wm_driver_data *plat;
334 struct resource *res; 335 struct resource *res;
336 struct mfd_cell *cell;
335 int ret; 337 int ret;
336 338
337 if (!pdev) 339 if (!pdev)
338 return -ENODEV; 340 return -ENODEV;
339 341
342 cell = pdev->dev.platform_data;
343 if (!cell)
344 return -ENODEV;
345
340 ds1wm_data = kzalloc(sizeof(*ds1wm_data), GFP_KERNEL); 346 ds1wm_data = kzalloc(sizeof(*ds1wm_data), GFP_KERNEL);
341 if (!ds1wm_data) 347 if (!ds1wm_data)
342 return -ENOMEM; 348 return -ENOMEM;
@@ -348,15 +354,18 @@ static int ds1wm_probe(struct platform_device *pdev)
348 ret = -ENXIO; 354 ret = -ENXIO;
349 goto err0; 355 goto err0;
350 } 356 }
351 ds1wm_data->map = ioremap(res->start, res->end - res->start + 1); 357 ds1wm_data->map = ioremap(res->start, resource_size(res));
352 if (!ds1wm_data->map) { 358 if (!ds1wm_data->map) {
353 ret = -ENOMEM; 359 ret = -ENOMEM;
354 goto err0; 360 goto err0;
355 } 361 }
356 plat = pdev->dev.platform_data; 362 plat = cell->driver_data;
357 ds1wm_data->bus_shift = plat->bus_shift; 363
364 /* calculate bus shift from mem resource */
365 ds1wm_data->bus_shift = resource_size(res) >> 3;
366
358 ds1wm_data->pdev = pdev; 367 ds1wm_data->pdev = pdev;
359 ds1wm_data->pdata = plat; 368 ds1wm_data->cell = cell;
360 369
361 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 370 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
362 if (!res) { 371 if (!res) {