diff options
Diffstat (limited to 'drivers/video/xilinxfb.c')
-rw-r--r-- | drivers/video/xilinxfb.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 0c9ce88e95e8..77dea015ff69 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
@@ -32,10 +32,14 @@ | |||
32 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/of_device.h> | 33 | #include <linux/of_device.h> |
34 | #include <linux/of_platform.h> | 34 | #include <linux/of_platform.h> |
35 | #include <linux/of_address.h> | ||
35 | #include <linux/io.h> | 36 | #include <linux/io.h> |
36 | #include <linux/xilinxfb.h> | 37 | #include <linux/xilinxfb.h> |
37 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | |||
40 | #ifdef CONFIG_PPC_DCR | ||
38 | #include <asm/dcr.h> | 41 | #include <asm/dcr.h> |
42 | #endif | ||
39 | 43 | ||
40 | #define DRIVER_NAME "xilinxfb" | 44 | #define DRIVER_NAME "xilinxfb" |
41 | 45 | ||
@@ -123,10 +127,10 @@ struct xilinxfb_drvdata { | |||
123 | registers */ | 127 | registers */ |
124 | void __iomem *regs; /* virt. address of the control | 128 | void __iomem *regs; /* virt. address of the control |
125 | registers */ | 129 | registers */ |
126 | 130 | #ifdef CONFIG_PPC_DCR | |
127 | dcr_host_t dcr_host; | 131 | dcr_host_t dcr_host; |
128 | unsigned int dcr_len; | 132 | unsigned int dcr_len; |
129 | 133 | #endif | |
130 | void *fb_virt; /* virt. address of the frame buffer */ | 134 | void *fb_virt; /* virt. address of the frame buffer */ |
131 | dma_addr_t fb_phys; /* phys. address of the frame buffer */ | 135 | dma_addr_t fb_phys; /* phys. address of the frame buffer */ |
132 | int fb_alloced; /* Flag, was the fb memory alloced? */ | 136 | int fb_alloced; /* Flag, was the fb memory alloced? */ |
@@ -152,9 +156,10 @@ static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset, | |||
152 | { | 156 | { |
153 | if (drvdata->flags & PLB_ACCESS_FLAG) | 157 | if (drvdata->flags & PLB_ACCESS_FLAG) |
154 | out_be32(drvdata->regs + (offset << 2), val); | 158 | out_be32(drvdata->regs + (offset << 2), val); |
159 | #ifdef CONFIG_PPC_DCR | ||
155 | else | 160 | else |
156 | dcr_write(drvdata->dcr_host, offset, val); | 161 | dcr_write(drvdata->dcr_host, offset, val); |
157 | 162 | #endif | |
158 | } | 163 | } |
159 | 164 | ||
160 | static int | 165 | static int |
@@ -383,8 +388,11 @@ static int xilinxfb_release(struct device *dev) | |||
383 | if (drvdata->flags & PLB_ACCESS_FLAG) { | 388 | if (drvdata->flags & PLB_ACCESS_FLAG) { |
384 | iounmap(drvdata->regs); | 389 | iounmap(drvdata->regs); |
385 | release_mem_region(drvdata->regs_phys, 8); | 390 | release_mem_region(drvdata->regs_phys, 8); |
386 | } else | 391 | } |
392 | #ifdef CONFIG_PPC_DCR | ||
393 | else | ||
387 | dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); | 394 | dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); |
395 | #endif | ||
388 | 396 | ||
389 | kfree(drvdata); | 397 | kfree(drvdata); |
390 | dev_set_drvdata(dev, NULL); | 398 | dev_set_drvdata(dev, NULL); |
@@ -396,22 +404,19 @@ static int xilinxfb_release(struct device *dev) | |||
396 | * OF bus binding | 404 | * OF bus binding |
397 | */ | 405 | */ |
398 | 406 | ||
399 | static int __devinit | 407 | static int __devinit xilinxfb_of_probe(struct platform_device *op) |
400 | xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match) | ||
401 | { | 408 | { |
402 | const u32 *prop; | 409 | const u32 *prop; |
403 | u32 *p; | 410 | u32 *p; |
404 | u32 tft_access; | 411 | u32 tft_access; |
405 | struct xilinxfb_platform_data pdata; | 412 | struct xilinxfb_platform_data pdata; |
406 | struct resource res; | 413 | struct resource res; |
407 | int size, rc, start; | 414 | int size, rc; |
408 | struct xilinxfb_drvdata *drvdata; | 415 | struct xilinxfb_drvdata *drvdata; |
409 | 416 | ||
410 | /* Copy with the default pdata (not a ptr reference!) */ | 417 | /* Copy with the default pdata (not a ptr reference!) */ |
411 | pdata = xilinx_fb_default_pdata; | 418 | pdata = xilinx_fb_default_pdata; |
412 | 419 | ||
413 | dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); | ||
414 | |||
415 | /* Allocate the driver data region */ | 420 | /* Allocate the driver data region */ |
416 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); | 421 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); |
417 | if (!drvdata) { | 422 | if (!drvdata) { |
@@ -437,7 +442,10 @@ xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match) | |||
437 | dev_err(&op->dev, "invalid address\n"); | 442 | dev_err(&op->dev, "invalid address\n"); |
438 | goto err; | 443 | goto err; |
439 | } | 444 | } |
440 | } else { | 445 | } |
446 | #ifdef CONFIG_PPC_DCR | ||
447 | else { | ||
448 | int start; | ||
441 | res.start = 0; | 449 | res.start = 0; |
442 | start = dcr_resource_start(op->dev.of_node, 0); | 450 | start = dcr_resource_start(op->dev.of_node, 0); |
443 | drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0); | 451 | drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0); |
@@ -447,6 +455,7 @@ xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match) | |||
447 | goto err; | 455 | goto err; |
448 | } | 456 | } |
449 | } | 457 | } |
458 | #endif | ||
450 | 459 | ||
451 | prop = of_get_property(op->dev.of_node, "phys-size", &size); | 460 | prop = of_get_property(op->dev.of_node, "phys-size", &size); |
452 | if ((prop) && (size >= sizeof(u32)*2)) { | 461 | if ((prop) && (size >= sizeof(u32)*2)) { |
@@ -493,7 +502,7 @@ static struct of_device_id xilinxfb_of_match[] __devinitdata = { | |||
493 | }; | 502 | }; |
494 | MODULE_DEVICE_TABLE(of, xilinxfb_of_match); | 503 | MODULE_DEVICE_TABLE(of, xilinxfb_of_match); |
495 | 504 | ||
496 | static struct of_platform_driver xilinxfb_of_driver = { | 505 | static struct platform_driver xilinxfb_of_driver = { |
497 | .probe = xilinxfb_of_probe, | 506 | .probe = xilinxfb_of_probe, |
498 | .remove = __devexit_p(xilinxfb_of_remove), | 507 | .remove = __devexit_p(xilinxfb_of_remove), |
499 | .driver = { | 508 | .driver = { |
@@ -511,13 +520,13 @@ static struct of_platform_driver xilinxfb_of_driver = { | |||
511 | static int __init | 520 | static int __init |
512 | xilinxfb_init(void) | 521 | xilinxfb_init(void) |
513 | { | 522 | { |
514 | return of_register_platform_driver(&xilinxfb_of_driver); | 523 | return platform_driver_register(&xilinxfb_of_driver); |
515 | } | 524 | } |
516 | 525 | ||
517 | static void __exit | 526 | static void __exit |
518 | xilinxfb_cleanup(void) | 527 | xilinxfb_cleanup(void) |
519 | { | 528 | { |
520 | of_unregister_platform_driver(&xilinxfb_of_driver); | 529 | platform_driver_unregister(&xilinxfb_of_driver); |
521 | } | 530 | } |
522 | 531 | ||
523 | module_init(xilinxfb_init); | 532 | module_init(xilinxfb_init); |