Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'virtex-for-2.6.24' of git://git.secretlab.ca/git/linux-2.6-virtex into for-2.6.24-4xx

+205 -86
+1 -1
MAINTAINERS
··· 2306 2306 LINUX FOR POWERPC EMBEDDED XILINX VIRTEX 2307 2307 P: Grant Likely 2308 2308 M: grant.likely@secretlab.ca 2309 - W: http://www.secretlab.ca/ 2309 + W: http://wiki.secretlab.ca/index.php/Linux_on_Xilinx_Virtex 2310 2310 L: linuxppc-dev@ozlabs.org 2311 2311 S: Maintained 2312 2312
+2 -2
arch/powerpc/boot/uartlite.c
··· 45 45 46 46 static unsigned char uartlite_getc(void) 47 47 { 48 - u32 reg = ULITE_STATUS_RXVALID; 49 - while (reg & ULITE_STATUS_RXVALID) /* spin on RXVALID bit */ 48 + u32 reg = 0; 49 + while (!(reg & ULITE_STATUS_RXVALID)) /* spin waiting for RXVALID bit */ 50 50 reg = in_be32(reg_base + ULITE_STATUS); 51 51 return in_be32(reg_base + ULITE_RX); 52 52 }
+1 -1
arch/powerpc/sysdev/Makefile
··· 6 6 obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) 7 7 8 8 obj-$(CONFIG_PPC_MPC106) += grackle.o 9 - obj-$(CONFIG_PPC_DCR) += dcr.o 10 9 obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o 11 10 obj-$(CONFIG_PPC_PMI) += pmi.o 12 11 obj-$(CONFIG_U3_DART) += dart_iommu.o ··· 32 33 ifeq ($(ARCH),powerpc) 33 34 obj-$(CONFIG_CPM) += cpm_common.o 34 35 obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o 36 + obj-$(CONFIG_PPC_DCR) += dcr.o 35 37 obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o 36 38 obj-$(CONFIG_UCODE_PATCH) += micropatch.o 37 39 endif
+201 -82
drivers/video/xilinxfb.c
··· 6 6 * Author: MontaVista Software, Inc. 7 7 * source@mvista.com 8 8 * 9 - * 2002-2007 (c) MontaVista Software, Inc. This file is licensed under the 10 - * terms of the GNU General Public License version 2. This program is licensed 11 - * "as is" without any warranty of any kind, whether express or implied. 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. 12 15 */ 13 16 14 17 /* ··· 21 18 * Geert Uytterhoeven. 22 19 */ 23 20 21 + #include <linux/device.h> 24 22 #include <linux/module.h> 25 23 #include <linux/kernel.h> 26 24 #include <linux/version.h> ··· 32 28 #include <linux/init.h> 33 29 #include <linux/dma-mapping.h> 34 30 #include <linux/platform_device.h> 35 - 31 + #if defined(CONFIG_OF) 32 + #include <linux/of_device.h> 33 + #include <linux/of_platform.h> 34 + #endif 36 35 #include <asm/io.h> 37 36 #include <linux/xilinxfb.h> 38 37 ··· 118 111 u32 regs_phys; /* phys. address of the control registers */ 119 112 u32 __iomem *regs; /* virt. address of the control registers */ 120 113 121 - unsigned char __iomem *fb_virt; /* virt. address of the frame buffer */ 114 + void *fb_virt; /* virt. address of the frame buffer */ 122 115 dma_addr_t fb_phys; /* phys. address of the frame buffer */ 123 116 124 117 u32 reg_ctrl_default; ··· 202 195 .fb_imageblit = cfb_imageblit, 203 196 }; 204 197 205 - /* === The device driver === */ 198 + /* --------------------------------------------------------------------- 199 + * Bus independent setup/teardown 200 + */ 206 201 207 - static int 208 - xilinxfb_drv_probe(struct device *dev) 202 + static int xilinxfb_assign(struct device *dev, unsigned long physaddr, 203 + int width_mm, int height_mm, int rotate) 209 204 { 210 - struct platform_device *pdev; 211 - struct xilinxfb_platform_data *pdata; 212 205 struct xilinxfb_drvdata *drvdata; 213 - struct resource *regs_res; 214 - int retval; 206 + int rc; 215 207 216 - if (!dev) 217 - return -EINVAL; 218 - 219 - pdev = to_platform_device(dev); 220 - pdata = pdev->dev.platform_data; 221 - 208 + /* Allocate the driver data region */ 222 209 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 223 210 if (!drvdata) { 224 - printk(KERN_ERR "Couldn't allocate device private record\n"); 211 + dev_err(dev, "Couldn't allocate device private record\n"); 225 212 return -ENOMEM; 226 213 } 227 214 dev_set_drvdata(dev, drvdata); 228 215 229 216 /* Map the control registers in */ 230 - regs_res = platform_get_resource(pdev, IORESOURCE_IO, 0); 231 - if (!regs_res || (regs_res->end - regs_res->start + 1 < 8)) { 232 - printk(KERN_ERR "Couldn't get registers resource\n"); 233 - retval = -EFAULT; 234 - goto failed1; 217 + if (!request_mem_region(physaddr, 8, DRIVER_NAME)) { 218 + dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", 219 + physaddr); 220 + rc = -ENODEV; 221 + goto err_region; 235 222 } 236 - 237 - if (!request_mem_region(regs_res->start, 8, DRIVER_NAME)) { 238 - printk(KERN_ERR 239 - "Couldn't lock memory region at 0x%08X\n", 240 - regs_res->start); 241 - retval = -EBUSY; 242 - goto failed1; 223 + drvdata->regs_phys = physaddr; 224 + drvdata->regs = ioremap(physaddr, 8); 225 + if (!drvdata->regs) { 226 + dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", 227 + physaddr); 228 + rc = -ENODEV; 229 + goto err_map; 243 230 } 244 - drvdata->regs = (u32 __iomem*) ioremap(regs_res->start, 8); 245 - drvdata->regs_phys = regs_res->start; 246 231 247 232 /* Allocate the framebuffer memory */ 248 233 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(FB_SIZE), 249 234 &drvdata->fb_phys, GFP_KERNEL); 250 235 if (!drvdata->fb_virt) { 251 - printk(KERN_ERR "Could not allocate frame buffer memory\n"); 252 - retval = -ENOMEM; 253 - goto failed2; 236 + dev_err(dev, "Could not allocate frame buffer memory\n"); 237 + rc = -ENOMEM; 238 + goto err_fbmem; 254 239 } 255 240 256 241 /* Clear (turn to black) the framebuffer */ 257 - memset_io((void *) drvdata->fb_virt, 0, FB_SIZE); 242 + memset_io((void __iomem *)drvdata->fb_virt, 0, FB_SIZE); 258 243 259 244 /* Tell the hardware where the frame buffer is */ 260 245 xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); 261 246 262 247 /* Turn on the display */ 263 248 drvdata->reg_ctrl_default = REG_CTRL_ENABLE; 264 - if (pdata && pdata->rotate_screen) 249 + if (rotate) 265 250 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; 266 251 xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); 267 252 268 253 /* Fill struct fb_info */ 269 254 drvdata->info.device = dev; 270 - drvdata->info.screen_base = drvdata->fb_virt; 255 + drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt; 271 256 drvdata->info.fbops = &xilinxfb_ops; 272 257 drvdata->info.fix = xilinx_fb_fix; 273 258 drvdata->info.fix.smem_start = drvdata->fb_phys; 274 259 drvdata->info.pseudo_palette = drvdata->pseudo_palette; 275 - 276 - if (fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0) < 0) { 277 - printk(KERN_ERR "Fail to allocate colormap (%d entries)\n", 278 - PALETTE_ENTRIES_NO); 279 - retval = -EFAULT; 280 - goto failed3; 281 - } 282 - 283 260 drvdata->info.flags = FBINFO_DEFAULT; 284 - if (pdata) { 285 - xilinx_fb_var.height = pdata->screen_height_mm; 286 - xilinx_fb_var.width = pdata->screen_width_mm; 287 - } 288 261 drvdata->info.var = xilinx_fb_var; 289 262 290 - /* Register new frame buffer */ 291 - if (register_framebuffer(&drvdata->info) < 0) { 292 - printk(KERN_ERR "Could not register frame buffer\n"); 293 - retval = -EINVAL; 294 - goto failed4; 263 + xilinx_fb_var.height = height_mm; 264 + xilinx_fb_var.width = width_mm; 265 + 266 + /* Allocate a colour map */ 267 + rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); 268 + if (rc) { 269 + dev_err(dev, "Fail to allocate colormap (%d entries)\n", 270 + PALETTE_ENTRIES_NO); 271 + goto err_cmap; 295 272 } 296 273 274 + /* Register new frame buffer */ 275 + rc = register_framebuffer(&drvdata->info); 276 + if (rc) { 277 + dev_err(dev, "Could not register frame buffer\n"); 278 + goto err_regfb; 279 + } 280 + 281 + /* Put a banner in the log (for DEBUG) */ 282 + dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs); 283 + dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n", 284 + (void*)drvdata->fb_phys, drvdata->fb_virt, FB_SIZE); 297 285 return 0; /* success */ 298 286 299 - failed4: 287 + err_regfb: 300 288 fb_dealloc_cmap(&drvdata->info.cmap); 301 289 302 - failed3: 290 + err_cmap: 303 291 dma_free_coherent(dev, PAGE_ALIGN(FB_SIZE), drvdata->fb_virt, 304 292 drvdata->fb_phys); 305 - 306 293 /* Turn off the display */ 307 294 xilinx_fb_out_be32(drvdata, REG_CTRL, 0); 295 + 296 + err_fbmem: 308 297 iounmap(drvdata->regs); 309 298 310 - failed2: 311 - release_mem_region(regs_res->start, 8); 299 + err_map: 300 + release_mem_region(physaddr, 8); 312 301 313 - failed1: 302 + err_region: 314 303 kfree(drvdata); 315 304 dev_set_drvdata(dev, NULL); 316 305 317 - return retval; 306 + return rc; 318 307 } 319 308 320 - static int 321 - xilinxfb_drv_remove(struct device *dev) 309 + static int xilinxfb_release(struct device *dev) 322 310 { 323 - struct xilinxfb_drvdata *drvdata; 324 - 325 - if (!dev) 326 - return -ENODEV; 327 - 328 - drvdata = (struct xilinxfb_drvdata *) dev_get_drvdata(dev); 311 + struct xilinxfb_drvdata *drvdata = dev_get_drvdata(dev); 329 312 330 313 #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) 331 314 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); ··· 340 343 return 0; 341 344 } 342 345 346 + /* --------------------------------------------------------------------- 347 + * Platform bus binding 348 + */ 343 349 344 - static struct device_driver xilinxfb_driver = { 345 - .name = DRIVER_NAME, 346 - .bus = &platform_bus_type, 350 + static int 351 + xilinxfb_platform_probe(struct platform_device *pdev) 352 + { 353 + struct xilinxfb_platform_data *pdata; 354 + struct resource *res; 355 + int width_mm = 0; 356 + int height_mm = 0; 357 + int rotate = 0; 347 358 348 - .probe = xilinxfb_drv_probe, 349 - .remove = xilinxfb_drv_remove 359 + /* Find the registers address */ 360 + res = platform_get_resource(pdev, IORESOURCE_IO, 0); 361 + if (!res) { 362 + dev_err(&pdev->dev, "Couldn't get registers resource\n"); 363 + return -ENODEV; 364 + } 365 + 366 + /* If a pdata structure is provided, then extract the parameters */ 367 + pdata = pdev->dev.platform_data; 368 + if (pdata) { 369 + height_mm = pdata->screen_height_mm; 370 + width_mm = pdata->screen_width_mm; 371 + rotate = pdata->rotate_screen ? 1 : 0; 372 + } 373 + 374 + return xilinxfb_assign(&pdev->dev, res->start, width_mm, height_mm, 375 + rotate); 376 + } 377 + 378 + static int 379 + xilinxfb_platform_remove(struct platform_device *pdev) 380 + { 381 + return xilinxfb_release(&pdev->dev); 382 + } 383 + 384 + 385 + static struct platform_driver xilinxfb_platform_driver = { 386 + .probe = xilinxfb_platform_probe, 387 + .remove = xilinxfb_platform_remove, 388 + .driver = { 389 + .owner = THIS_MODULE, 390 + .name = DRIVER_NAME, 391 + }, 350 392 }; 393 + 394 + /* --------------------------------------------------------------------- 395 + * OF bus binding 396 + */ 397 + 398 + #if defined(CONFIG_OF) 399 + static int __devinit 400 + xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) 401 + { 402 + struct resource res; 403 + const u32 *prop; 404 + int width = 0, height = 0, rotate = 0; 405 + int size, rc; 406 + 407 + dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); 408 + 409 + rc = of_address_to_resource(op->node, 0, &res); 410 + if (rc) { 411 + dev_err(&op->dev, "invalid address\n"); 412 + return rc; 413 + } 414 + 415 + prop = of_get_property(op->node, "display-number", &size); 416 + if ((prop) && (size >= sizeof(u32)*2)) { 417 + width = prop[0]; 418 + height = prop[1]; 419 + } 420 + 421 + if (of_find_property(op->node, "rotate-display", NULL)) 422 + rotate = 1; 423 + 424 + return xilinxfb_assign(&op->dev, res.start, width, height, rotate); 425 + } 426 + 427 + static int __devexit xilinxfb_of_remove(struct of_device *op) 428 + { 429 + return xilinxfb_release(&op->dev); 430 + } 431 + 432 + /* Match table for of_platform binding */ 433 + static struct of_device_id __devinit xilinxfb_of_match[] = { 434 + { .compatible = "xilinx,ml300-fb", }, 435 + {}, 436 + }; 437 + MODULE_DEVICE_TABLE(of, xilinxfb_of_match); 438 + 439 + static struct of_platform_driver xilinxfb_of_driver = { 440 + .owner = THIS_MODULE, 441 + .name = DRIVER_NAME, 442 + .match_table = xilinxfb_of_match, 443 + .probe = xilinxfb_of_probe, 444 + .remove = __devexit_p(xilinxfb_of_remove), 445 + .driver = { 446 + .name = DRIVER_NAME, 447 + }, 448 + }; 449 + 450 + /* Registration helpers to keep the number of #ifdefs to a minimum */ 451 + static inline int __init xilinxfb_of_register(void) 452 + { 453 + pr_debug("xilinxfb: calling of_register_platform_driver()\n"); 454 + return of_register_platform_driver(&xilinxfb_of_driver); 455 + } 456 + 457 + static inline void __exit xilinxfb_of_unregister(void) 458 + { 459 + of_unregister_platform_driver(&xilinxfb_of_driver); 460 + } 461 + #else /* CONFIG_OF */ 462 + /* CONFIG_OF not enabled; do nothing helpers */ 463 + static inline int __init xilinxfb_of_register(void) { return 0; } 464 + static inline void __exit xilinxfb_of_unregister(void) { } 465 + #endif /* CONFIG_OF */ 466 + 467 + /* --------------------------------------------------------------------- 468 + * Module setup and teardown 469 + */ 351 470 352 471 static int __init 353 472 xilinxfb_init(void) 354 473 { 355 - /* 356 - * No kernel boot options used, 357 - * so we just need to register the driver 358 - */ 359 - return driver_register(&xilinxfb_driver); 474 + int rc; 475 + rc = xilinxfb_of_register(); 476 + if (rc) 477 + return rc; 478 + 479 + rc = platform_driver_register(&xilinxfb_platform_driver); 480 + if (rc) 481 + xilinxfb_of_unregister(); 482 + 483 + return rc; 360 484 } 361 485 362 486 static void __exit 363 487 xilinxfb_cleanup(void) 364 488 { 365 - driver_unregister(&xilinxfb_driver); 489 + platform_driver_unregister(&xilinxfb_platform_driver); 490 + xilinxfb_of_unregister(); 366 491 } 367 492 368 493 module_init(xilinxfb_init);