Commit | Line | Data |
---|---|---|
147394c8 AK |
1 | /* |
2 | * xilinxfb.c | |
3 | * | |
4 | * Xilinx TFT LCD frame buffer driver | |
5 | * | |
6 | * Author: MontaVista Software, Inc. | |
7 | * source@mvista.com | |
8 | * | |
31e8d460 GL |
9 | * 2002-2007 (c) MontaVista Software, Inc. |
10 | * 2007 (c) Secret Lab Technologies, Ltd. | |
11 | * | |
12 | * This file is licensed under the terms of the GNU General Public License | |
13 | * version 2. This program is licensed "as is" without any warranty of any | |
14 | * kind, whether express or implied. | |
147394c8 AK |
15 | */ |
16 | ||
17 | /* | |
18 | * This driver was based on au1100fb.c by MontaVista rewritten for 2.6 | |
19 | * by Embedded Alley Solutions <source@embeddedalley.com>, which in turn | |
20 | * was based on skeletonfb.c, Skeleton for a frame buffer device by | |
21 | * Geert Uytterhoeven. | |
22 | */ | |
23 | ||
3cb3ec2c | 24 | #include <linux/device.h> |
147394c8 AK |
25 | #include <linux/module.h> |
26 | #include <linux/kernel.h> | |
27 | #include <linux/version.h> | |
28 | #include <linux/errno.h> | |
29 | #include <linux/string.h> | |
30 | #include <linux/mm.h> | |
31 | #include <linux/fb.h> | |
32 | #include <linux/init.h> | |
33 | #include <linux/dma-mapping.h> | |
34 | #include <linux/platform_device.h> | |
31e8d460 GL |
35 | #if defined(CONFIG_OF) |
36 | #include <linux/of_device.h> | |
37 | #include <linux/of_platform.h> | |
38 | #endif | |
147394c8 | 39 | #include <asm/io.h> |
dc8afdc7 | 40 | #include <linux/xilinxfb.h> |
147394c8 AK |
41 | |
42 | #define DRIVER_NAME "xilinxfb" | |
43 | #define DRIVER_DESCRIPTION "Xilinx TFT LCD frame buffer driver" | |
44 | ||
45 | /* | |
46 | * Xilinx calls it "PLB TFT LCD Controller" though it can also be used for | |
47 | * the VGA port on the Xilinx ML40x board. This is a hardware display controller | |
48 | * for a 640x480 resolution TFT or VGA screen. | |
49 | * | |
50 | * The interface to the framebuffer is nice and simple. There are two | |
51 | * control registers. The first tells the LCD interface where in memory | |
52 | * the frame buffer is (only the 11 most significant bits are used, so | |
53 | * don't start thinking about scrolling). The second allows the LCD to | |
54 | * be turned on or off as well as rotated 180 degrees. | |
55 | */ | |
56 | #define NUM_REGS 2 | |
57 | #define REG_FB_ADDR 0 | |
58 | #define REG_CTRL 1 | |
59 | #define REG_CTRL_ENABLE 0x0001 | |
60 | #define REG_CTRL_ROTATE 0x0002 | |
61 | ||
62 | /* | |
63 | * The hardware only handles a single mode: 640x480 24 bit true | |
64 | * color. Each pixel gets a word (32 bits) of memory. Within each word, | |
65 | * the 8 most significant bits are ignored, the next 8 bits are the red | |
66 | * level, the next 8 bits are the green level and the 8 least | |
67 | * significant bits are the blue level. Each row of the LCD uses 1024 | |
68 | * words, but only the first 640 pixels are displayed with the other 384 | |
69 | * words being ignored. There are 480 rows. | |
70 | */ | |
71 | #define BYTES_PER_PIXEL 4 | |
72 | #define BITS_PER_PIXEL (BYTES_PER_PIXEL * 8) | |
147394c8 AK |
73 | |
74 | #define RED_SHIFT 16 | |
75 | #define GREEN_SHIFT 8 | |
76 | #define BLUE_SHIFT 0 | |
77 | ||
78 | #define PALETTE_ENTRIES_NO 16 /* passed to fb_alloc_cmap() */ | |
79 | ||
01ba1e9d GL |
80 | /* |
81 | * Default xilinxfb configuration | |
82 | */ | |
83 | static struct xilinxfb_platform_data xilinx_fb_default_pdata = { | |
b4d6a726 GL |
84 | .xres = 640, |
85 | .yres = 480, | |
86 | .xvirt = 1024, | |
87 | .yvirt = 480; | |
01ba1e9d GL |
88 | }; |
89 | ||
147394c8 AK |
90 | /* |
91 | * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures | |
92 | */ | |
3f5b85d1 | 93 | static struct fb_fix_screeninfo xilinx_fb_fix = { |
147394c8 AK |
94 | .id = "Xilinx", |
95 | .type = FB_TYPE_PACKED_PIXELS, | |
96 | .visual = FB_VISUAL_TRUECOLOR, | |
147394c8 AK |
97 | .accel = FB_ACCEL_NONE |
98 | }; | |
99 | ||
3f5b85d1 | 100 | static struct fb_var_screeninfo xilinx_fb_var = { |
147394c8 AK |
101 | .bits_per_pixel = BITS_PER_PIXEL, |
102 | ||
103 | .red = { RED_SHIFT, 8, 0 }, | |
104 | .green = { GREEN_SHIFT, 8, 0 }, | |
105 | .blue = { BLUE_SHIFT, 8, 0 }, | |
106 | .transp = { 0, 0, 0 }, | |
107 | ||
108 | .activate = FB_ACTIVATE_NOW | |
109 | }; | |
110 | ||
111 | struct xilinxfb_drvdata { | |
112 | ||
113 | struct fb_info info; /* FB driver info record */ | |
114 | ||
115 | u32 regs_phys; /* phys. address of the control registers */ | |
116 | u32 __iomem *regs; /* virt. address of the control registers */ | |
117 | ||
b9a22794 | 118 | void *fb_virt; /* virt. address of the frame buffer */ |
147394c8 AK |
119 | dma_addr_t fb_phys; /* phys. address of the frame buffer */ |
120 | ||
121 | u32 reg_ctrl_default; | |
122 | ||
123 | u32 pseudo_palette[PALETTE_ENTRIES_NO]; | |
124 | /* Fake palette of 16 colors */ | |
125 | }; | |
126 | ||
127 | #define to_xilinxfb_drvdata(_info) \ | |
128 | container_of(_info, struct xilinxfb_drvdata, info) | |
129 | ||
130 | /* | |
131 | * The LCD controller has DCR interface to its registers, but all | |
132 | * the boards and configurations the driver has been tested with | |
133 | * use opb2dcr bridge. So the registers are seen as memory mapped. | |
134 | * This macro is to make it simple to add the direct DCR access | |
135 | * when it's needed. | |
136 | */ | |
137 | #define xilinx_fb_out_be32(driverdata, offset, val) \ | |
138 | out_be32(driverdata->regs + offset, val) | |
139 | ||
140 | static int | |
141 | xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, | |
142 | unsigned transp, struct fb_info *fbi) | |
143 | { | |
144 | u32 *palette = fbi->pseudo_palette; | |
145 | ||
146 | if (regno >= PALETTE_ENTRIES_NO) | |
147 | return -EINVAL; | |
148 | ||
149 | if (fbi->var.grayscale) { | |
150 | /* Convert color to grayscale. | |
151 | * grayscale = 0.30*R + 0.59*G + 0.11*B */ | |
152 | red = green = blue = | |
153 | (red * 77 + green * 151 + blue * 28 + 127) >> 8; | |
154 | } | |
155 | ||
156 | /* fbi->fix.visual is always FB_VISUAL_TRUECOLOR */ | |
157 | ||
158 | /* We only handle 8 bits of each color. */ | |
159 | red >>= 8; | |
160 | green >>= 8; | |
161 | blue >>= 8; | |
162 | palette[regno] = (red << RED_SHIFT) | (green << GREEN_SHIFT) | | |
163 | (blue << BLUE_SHIFT); | |
164 | ||
165 | return 0; | |
166 | } | |
167 | ||
168 | static int | |
169 | xilinx_fb_blank(int blank_mode, struct fb_info *fbi) | |
170 | { | |
171 | struct xilinxfb_drvdata *drvdata = to_xilinxfb_drvdata(fbi); | |
172 | ||
173 | switch (blank_mode) { | |
174 | case FB_BLANK_UNBLANK: | |
175 | /* turn on panel */ | |
176 | xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); | |
177 | break; | |
178 | ||
179 | case FB_BLANK_NORMAL: | |
180 | case FB_BLANK_VSYNC_SUSPEND: | |
181 | case FB_BLANK_HSYNC_SUSPEND: | |
182 | case FB_BLANK_POWERDOWN: | |
183 | /* turn off panel */ | |
184 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); | |
185 | default: | |
186 | break; | |
187 | ||
188 | } | |
189 | return 0; /* success */ | |
190 | } | |
191 | ||
192 | static struct fb_ops xilinxfb_ops = | |
193 | { | |
194 | .owner = THIS_MODULE, | |
195 | .fb_setcolreg = xilinx_fb_setcolreg, | |
196 | .fb_blank = xilinx_fb_blank, | |
197 | .fb_fillrect = cfb_fillrect, | |
198 | .fb_copyarea = cfb_copyarea, | |
199 | .fb_imageblit = cfb_imageblit, | |
200 | }; | |
201 | ||
26477622 GL |
202 | /* --------------------------------------------------------------------- |
203 | * Bus independent setup/teardown | |
204 | */ | |
147394c8 | 205 | |
26477622 | 206 | static int xilinxfb_assign(struct device *dev, unsigned long physaddr, |
01ba1e9d | 207 | struct xilinxfb_platform_data *pdata) |
147394c8 | 208 | { |
147394c8 | 209 | struct xilinxfb_drvdata *drvdata; |
26477622 | 210 | int rc; |
b4d6a726 | 211 | int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL; |
147394c8 | 212 | |
26477622 | 213 | /* Allocate the driver data region */ |
147394c8 AK |
214 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); |
215 | if (!drvdata) { | |
3cb3ec2c | 216 | dev_err(dev, "Couldn't allocate device private record\n"); |
147394c8 AK |
217 | return -ENOMEM; |
218 | } | |
219 | dev_set_drvdata(dev, drvdata); | |
220 | ||
221 | /* Map the control registers in */ | |
26477622 GL |
222 | if (!request_mem_region(physaddr, 8, DRIVER_NAME)) { |
223 | dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", | |
224 | physaddr); | |
225 | rc = -ENODEV; | |
3fb99ce4 | 226 | goto err_region; |
147394c8 | 227 | } |
26477622 GL |
228 | drvdata->regs_phys = physaddr; |
229 | drvdata->regs = ioremap(physaddr, 8); | |
230 | if (!drvdata->regs) { | |
231 | dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", | |
232 | physaddr); | |
233 | rc = -ENODEV; | |
234 | goto err_map; | |
147394c8 | 235 | } |
147394c8 AK |
236 | |
237 | /* Allocate the framebuffer memory */ | |
b4d6a726 | 238 | drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), |
147394c8 AK |
239 | &drvdata->fb_phys, GFP_KERNEL); |
240 | if (!drvdata->fb_virt) { | |
3cb3ec2c | 241 | dev_err(dev, "Could not allocate frame buffer memory\n"); |
26477622 | 242 | rc = -ENOMEM; |
3fb99ce4 | 243 | goto err_fbmem; |
147394c8 AK |
244 | } |
245 | ||
246 | /* Clear (turn to black) the framebuffer */ | |
b4d6a726 | 247 | memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); |
147394c8 AK |
248 | |
249 | /* Tell the hardware where the frame buffer is */ | |
250 | xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); | |
251 | ||
252 | /* Turn on the display */ | |
f53161d1 | 253 | drvdata->reg_ctrl_default = REG_CTRL_ENABLE; |
01ba1e9d | 254 | if (pdata->rotate_screen) |
f53161d1 | 255 | drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; |
147394c8 AK |
256 | xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); |
257 | ||
258 | /* Fill struct fb_info */ | |
259 | drvdata->info.device = dev; | |
b9a22794 | 260 | drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt; |
147394c8 AK |
261 | drvdata->info.fbops = &xilinxfb_ops; |
262 | drvdata->info.fix = xilinx_fb_fix; | |
263 | drvdata->info.fix.smem_start = drvdata->fb_phys; | |
b4d6a726 GL |
264 | drvdata->info.fix.smem_len = fbsize; |
265 | drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL; | |
266 | ||
147394c8 | 267 | drvdata->info.pseudo_palette = drvdata->pseudo_palette; |
26477622 GL |
268 | drvdata->info.flags = FBINFO_DEFAULT; |
269 | drvdata->info.var = xilinx_fb_var; | |
b4d6a726 GL |
270 | drvdata->info.var.height = pdata->screen_height_mm; |
271 | drvdata->info.var.width = pdata->screen_width_mm; | |
272 | drvdata->info.var.xres = pdata->xres; | |
273 | drvdata->info.var.yres = pdata->yres; | |
274 | drvdata->info.var.xres_virtual = pdata->xvirt; | |
275 | drvdata->info.var.yres_virtual = pdata->yvirt; | |
147394c8 | 276 | |
26477622 GL |
277 | /* Allocate a colour map */ |
278 | rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); | |
279 | if (rc) { | |
3cb3ec2c | 280 | dev_err(dev, "Fail to allocate colormap (%d entries)\n", |
147394c8 | 281 | PALETTE_ENTRIES_NO); |
3fb99ce4 | 282 | goto err_cmap; |
147394c8 AK |
283 | } |
284 | ||
147394c8 | 285 | /* Register new frame buffer */ |
26477622 GL |
286 | rc = register_framebuffer(&drvdata->info); |
287 | if (rc) { | |
3cb3ec2c | 288 | dev_err(dev, "Could not register frame buffer\n"); |
3fb99ce4 | 289 | goto err_regfb; |
147394c8 AK |
290 | } |
291 | ||
258de4ba | 292 | /* Put a banner in the log (for DEBUG) */ |
26477622 | 293 | dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs); |
258de4ba | 294 | dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n", |
b4d6a726 GL |
295 | (void*)drvdata->fb_phys, drvdata->fb_virt, fbsize); |
296 | ||
147394c8 AK |
297 | return 0; /* success */ |
298 | ||
3fb99ce4 | 299 | err_regfb: |
147394c8 AK |
300 | fb_dealloc_cmap(&drvdata->info.cmap); |
301 | ||
3fb99ce4 | 302 | err_cmap: |
b4d6a726 | 303 | dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, |
147394c8 | 304 | drvdata->fb_phys); |
147394c8 AK |
305 | /* Turn off the display */ |
306 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); | |
147394c8 | 307 | |
3fb99ce4 | 308 | err_fbmem: |
26477622 GL |
309 | iounmap(drvdata->regs); |
310 | ||
311 | err_map: | |
312 | release_mem_region(physaddr, 8); | |
147394c8 | 313 | |
3fb99ce4 | 314 | err_region: |
147394c8 AK |
315 | kfree(drvdata); |
316 | dev_set_drvdata(dev, NULL); | |
317 | ||
26477622 | 318 | return rc; |
147394c8 AK |
319 | } |
320 | ||
26477622 | 321 | static int xilinxfb_release(struct device *dev) |
147394c8 | 322 | { |
26477622 | 323 | struct xilinxfb_drvdata *drvdata = dev_get_drvdata(dev); |
147394c8 AK |
324 | |
325 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) | |
326 | xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); | |
327 | #endif | |
328 | ||
329 | unregister_framebuffer(&drvdata->info); | |
330 | ||
331 | fb_dealloc_cmap(&drvdata->info.cmap); | |
332 | ||
b4d6a726 GL |
333 | dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), |
334 | drvdata->fb_virt, drvdata->fb_phys); | |
147394c8 AK |
335 | |
336 | /* Turn off the display */ | |
337 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); | |
338 | iounmap(drvdata->regs); | |
339 | ||
340 | release_mem_region(drvdata->regs_phys, 8); | |
341 | ||
342 | kfree(drvdata); | |
343 | dev_set_drvdata(dev, NULL); | |
344 | ||
345 | return 0; | |
346 | } | |
347 | ||
26477622 GL |
348 | /* --------------------------------------------------------------------- |
349 | * Platform bus binding | |
350 | */ | |
351 | ||
352 | static int | |
47473e31 | 353 | xilinxfb_platform_probe(struct platform_device *pdev) |
26477622 | 354 | { |
26477622 GL |
355 | struct xilinxfb_platform_data *pdata; |
356 | struct resource *res; | |
26477622 GL |
357 | |
358 | /* Find the registers address */ | |
359 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | |
360 | if (!res) { | |
47473e31 | 361 | dev_err(&pdev->dev, "Couldn't get registers resource\n"); |
26477622 GL |
362 | return -ENODEV; |
363 | } | |
364 | ||
e3cec003 | 365 | /* If a pdata structure is provided, then extract the parameters */ |
b4d6a726 GL |
366 | pdata = &xilinx_fb_default_pdata; |
367 | if (pdev->dev.platform_data) { | |
01ba1e9d | 368 | pdata = pdev->dev.platform_data; |
b4d6a726 GL |
369 | if (!pdata->xres) |
370 | pdata->xres = xilinx_fb_default_pdata.xres; | |
371 | if (!pdata->yres) | |
372 | pdata->yres = xilinx_fb_default_pdata.yres; | |
373 | if (!pdata->xvirt) | |
374 | pdata->xvirt = xilinx_fb_default_pdata.xvirt; | |
375 | if (!pdata->yvirt) | |
376 | pdata->yvirt = xilinx_fb_default_pdata.yvirt; | |
377 | } | |
26477622 | 378 | |
01ba1e9d | 379 | return xilinxfb_assign(&pdev->dev, res->start, pdata); |
26477622 GL |
380 | } |
381 | ||
382 | static int | |
47473e31 | 383 | xilinxfb_platform_remove(struct platform_device *pdev) |
26477622 | 384 | { |
47473e31 | 385 | return xilinxfb_release(&pdev->dev); |
26477622 GL |
386 | } |
387 | ||
147394c8 | 388 | |
47473e31 GL |
389 | static struct platform_driver xilinxfb_platform_driver = { |
390 | .probe = xilinxfb_platform_probe, | |
391 | .remove = xilinxfb_platform_remove, | |
392 | .driver = { | |
393 | .owner = THIS_MODULE, | |
394 | .name = DRIVER_NAME, | |
395 | }, | |
147394c8 AK |
396 | }; |
397 | ||
31e8d460 GL |
398 | /* --------------------------------------------------------------------- |
399 | * OF bus binding | |
400 | */ | |
401 | ||
402 | #if defined(CONFIG_OF) | |
403 | static int __devinit | |
404 | xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) | |
405 | { | |
406 | struct resource res; | |
407 | const u32 *prop; | |
01ba1e9d | 408 | struct xilinxfb_platform_data pdata; |
31e8d460 GL |
409 | int size, rc; |
410 | ||
01ba1e9d GL |
411 | /* Copy with the default pdata (not a ptr reference!) */ |
412 | pdata = xilinx_fb_default_pdata; | |
413 | ||
31e8d460 GL |
414 | dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); |
415 | ||
416 | rc = of_address_to_resource(op->node, 0, &res); | |
417 | if (rc) { | |
418 | dev_err(&op->dev, "invalid address\n"); | |
419 | return rc; | |
420 | } | |
421 | ||
b4d6a726 | 422 | prop = of_get_property(op->node, "phys-size", &size); |
31e8d460 | 423 | if ((prop) && (size >= sizeof(u32)*2)) { |
01ba1e9d GL |
424 | pdata.screen_width_mm = prop[0]; |
425 | pdata.screen_height_mm = prop[1]; | |
31e8d460 GL |
426 | } |
427 | ||
b4d6a726 GL |
428 | prop = of_get_property(op->node, "resolution", &size); |
429 | if ((prop) && (size >= sizeof(u32)*2)) { | |
430 | pdata.xres = prop[0]; | |
431 | pdata.yres = prop[1]; | |
432 | } | |
433 | ||
434 | prop = of_get_property(op->node, "virtual-resolution", &size); | |
435 | if ((prop) && (size >= sizeof(u32)*2)) { | |
436 | pdata.xvirt = prop[0]; | |
437 | pdata.yvirt = prop[1]; | |
438 | } | |
439 | ||
31e8d460 | 440 | if (of_find_property(op->node, "rotate-display", NULL)) |
01ba1e9d | 441 | pdata.rotate_screen = 1; |
31e8d460 | 442 | |
01ba1e9d | 443 | return xilinxfb_assign(&op->dev, res.start, &pdata); |
31e8d460 GL |
444 | } |
445 | ||
446 | static int __devexit xilinxfb_of_remove(struct of_device *op) | |
447 | { | |
448 | return xilinxfb_release(&op->dev); | |
449 | } | |
450 | ||
451 | /* Match table for of_platform binding */ | |
452 | static struct of_device_id __devinit xilinxfb_of_match[] = { | |
453 | { .compatible = "xilinx,ml300-fb", }, | |
454 | {}, | |
455 | }; | |
456 | MODULE_DEVICE_TABLE(of, xilinxfb_of_match); | |
457 | ||
458 | static struct of_platform_driver xilinxfb_of_driver = { | |
459 | .owner = THIS_MODULE, | |
460 | .name = DRIVER_NAME, | |
461 | .match_table = xilinxfb_of_match, | |
462 | .probe = xilinxfb_of_probe, | |
463 | .remove = __devexit_p(xilinxfb_of_remove), | |
464 | .driver = { | |
465 | .name = DRIVER_NAME, | |
466 | }, | |
467 | }; | |
468 | ||
469 | /* Registration helpers to keep the number of #ifdefs to a minimum */ | |
470 | static inline int __init xilinxfb_of_register(void) | |
471 | { | |
472 | pr_debug("xilinxfb: calling of_register_platform_driver()\n"); | |
473 | return of_register_platform_driver(&xilinxfb_of_driver); | |
474 | } | |
475 | ||
476 | static inline void __exit xilinxfb_of_unregister(void) | |
477 | { | |
478 | of_unregister_platform_driver(&xilinxfb_of_driver); | |
479 | } | |
480 | #else /* CONFIG_OF */ | |
481 | /* CONFIG_OF not enabled; do nothing helpers */ | |
482 | static inline int __init xilinxfb_of_register(void) { return 0; } | |
483 | static inline void __exit xilinxfb_of_unregister(void) { } | |
484 | #endif /* CONFIG_OF */ | |
485 | ||
486 | /* --------------------------------------------------------------------- | |
487 | * Module setup and teardown | |
488 | */ | |
489 | ||
147394c8 AK |
490 | static int __init |
491 | xilinxfb_init(void) | |
492 | { | |
31e8d460 GL |
493 | int rc; |
494 | rc = xilinxfb_of_register(); | |
495 | if (rc) | |
496 | return rc; | |
497 | ||
498 | rc = platform_driver_register(&xilinxfb_platform_driver); | |
499 | if (rc) | |
500 | xilinxfb_of_unregister(); | |
501 | ||
502 | return rc; | |
147394c8 AK |
503 | } |
504 | ||
505 | static void __exit | |
506 | xilinxfb_cleanup(void) | |
507 | { | |
47473e31 | 508 | platform_driver_unregister(&xilinxfb_platform_driver); |
31e8d460 | 509 | xilinxfb_of_unregister(); |
147394c8 AK |
510 | } |
511 | ||
512 | module_init(xilinxfb_init); | |
513 | module_exit(xilinxfb_cleanup); | |
514 | ||
515 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); | |
516 | MODULE_DESCRIPTION(DRIVER_DESCRIPTION); | |
517 | MODULE_LICENSE("GPL"); |