| .. | .. |
|---|
| 147 | 147 | struct au1200fb_device { |
|---|
| 148 | 148 | struct fb_info *fb_info; /* FB driver info record */ |
|---|
| 149 | 149 | struct au1200fb_platdata *pd; |
|---|
| 150 | + struct device *dev; |
|---|
| 150 | 151 | |
|---|
| 151 | 152 | int plane; |
|---|
| 152 | 153 | unsigned char* fb_mem; /* FrameBuffer memory map */ |
|---|
| .. | .. |
|---|
| 1039 | 1040 | u32 pixclock; |
|---|
| 1040 | 1041 | int screen_size, plane; |
|---|
| 1041 | 1042 | |
|---|
| 1043 | + if (!var->pixclock) |
|---|
| 1044 | + return -EINVAL; |
|---|
| 1045 | + |
|---|
| 1042 | 1046 | plane = fbdev->plane; |
|---|
| 1043 | 1047 | |
|---|
| 1044 | 1048 | /* Make sure that the mode respect all LCD controller and |
|---|
| .. | .. |
|---|
| 1232 | 1236 | { |
|---|
| 1233 | 1237 | struct au1200fb_device *fbdev = info->par; |
|---|
| 1234 | 1238 | |
|---|
| 1235 | | - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
|---|
| 1236 | | - pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ |
|---|
| 1237 | | - |
|---|
| 1238 | | - return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
|---|
| 1239 | + return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys, |
|---|
| 1240 | + fbdev->fb_len, 0); |
|---|
| 1239 | 1241 | } |
|---|
| 1240 | 1242 | |
|---|
| 1241 | 1243 | static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) |
|---|
| .. | .. |
|---|
| 1484 | 1486 | } |
|---|
| 1485 | 1487 | |
|---|
| 1486 | 1488 | |
|---|
| 1487 | | -static struct fb_ops au1200fb_fb_ops = { |
|---|
| 1489 | +static const struct fb_ops au1200fb_fb_ops = { |
|---|
| 1488 | 1490 | .owner = THIS_MODULE, |
|---|
| 1489 | 1491 | .fb_check_var = au1200fb_fb_check_var, |
|---|
| 1490 | 1492 | .fb_set_par = au1200fb_fb_set_par, |
|---|
| .. | .. |
|---|
| 1647 | 1649 | struct au1200fb_device *fbdev; |
|---|
| 1648 | 1650 | struct au1200fb_platdata *pd; |
|---|
| 1649 | 1651 | struct fb_info *fbi = NULL; |
|---|
| 1650 | | - unsigned long page; |
|---|
| 1651 | 1652 | int bpp, plane, ret, irq; |
|---|
| 1652 | 1653 | |
|---|
| 1653 | 1654 | print_info("" DRIVER_DESC ""); |
|---|
| .. | .. |
|---|
| 1685 | 1686 | fbdev = fbi->par; |
|---|
| 1686 | 1687 | fbdev->fb_info = fbi; |
|---|
| 1687 | 1688 | fbdev->pd = pd; |
|---|
| 1689 | + fbdev->dev = &dev->dev; |
|---|
| 1688 | 1690 | |
|---|
| 1689 | 1691 | fbdev->plane = plane; |
|---|
| 1690 | 1692 | |
|---|
| .. | .. |
|---|
| 1693 | 1695 | |
|---|
| 1694 | 1696 | fbdev->fb_mem = dmam_alloc_attrs(&dev->dev, |
|---|
| 1695 | 1697 | PAGE_ALIGN(fbdev->fb_len), |
|---|
| 1696 | | - &fbdev->fb_phys, GFP_KERNEL, |
|---|
| 1697 | | - DMA_ATTR_NON_CONSISTENT); |
|---|
| 1698 | + &fbdev->fb_phys, GFP_KERNEL, 0); |
|---|
| 1698 | 1699 | if (!fbdev->fb_mem) { |
|---|
| 1699 | 1700 | print_err("fail to allocate framebuffer (size: %dK))", |
|---|
| 1700 | 1701 | fbdev->fb_len / 1024); |
|---|
| .. | .. |
|---|
| 1702 | 1703 | goto failed; |
|---|
| 1703 | 1704 | } |
|---|
| 1704 | 1705 | |
|---|
| 1705 | | - /* |
|---|
| 1706 | | - * Set page reserved so that mmap will work. This is necessary |
|---|
| 1707 | | - * since we'll be remapping normal memory. |
|---|
| 1708 | | - */ |
|---|
| 1709 | | - for (page = (unsigned long)fbdev->fb_phys; |
|---|
| 1710 | | - page < PAGE_ALIGN((unsigned long)fbdev->fb_phys + |
|---|
| 1711 | | - fbdev->fb_len); |
|---|
| 1712 | | - page += PAGE_SIZE) { |
|---|
| 1713 | | - SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */ |
|---|
| 1714 | | - } |
|---|
| 1715 | 1706 | print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); |
|---|
| 1716 | 1707 | print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); |
|---|
| 1717 | 1708 | |
|---|
| .. | .. |
|---|
| 1741 | 1732 | |
|---|
| 1742 | 1733 | /* Now hook interrupt too */ |
|---|
| 1743 | 1734 | irq = platform_get_irq(dev, 0); |
|---|
| 1735 | + if (irq < 0) |
|---|
| 1736 | + return irq; |
|---|
| 1737 | + |
|---|
| 1744 | 1738 | ret = request_irq(irq, au1200fb_handle_irq, |
|---|
| 1745 | 1739 | IRQF_SHARED, "lcd", (void *)dev); |
|---|
| 1746 | 1740 | if (ret) { |
|---|