Merge tag 'drm-intel-next-2016-03-30' of git://anongit.freedesktop.org/drm-intel...
[deliverable/linux.git] / arch / arm / mach-netx / fb.c
CommitLineData
3095faf5
SH
1/*
2 * arch/arm/mach-netx/fb.c
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/device.h>
21#include <linux/init.h>
22#include <linux/dma-mapping.h>
23#include <linux/amba/bus.h>
24#include <linux/amba/clcd.h>
eefc842a 25#include <linux/err.h>
5a0e3ad6 26#include <linux/gfp.h>
3095faf5 27
80b02c17
RK
28#include <asm/irq.h>
29
a09e64fb
RK
30#include <mach/netx-regs.h>
31#include <mach/hardware.h>
3095faf5 32
3095faf5
SH
33static struct clcd_panel *netx_panel;
34
35void netx_clcd_enable(struct clcd_fb *fb)
36{
37}
38
39int netx_clcd_setup(struct clcd_fb *fb)
40{
41 dma_addr_t dma;
42
43 fb->panel = netx_panel;
44
f6e45661
LR
45 fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, 1024 * 1024, &dma,
46 GFP_KERNEL);
3095faf5
SH
47 if (!fb->fb.screen_base) {
48 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
49 return -ENOMEM;
50 }
51
52 fb->fb.fix.smem_start = dma;
53 fb->fb.fix.smem_len = 1024*1024;
54
55 return 0;
56}
57
58int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
59{
f6e45661
LR
60 return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
61 fb->fb.fix.smem_start, fb->fb.fix.smem_len);
3095faf5
SH
62}
63
64void netx_clcd_remove(struct clcd_fb *fb)
65{
f6e45661
LR
66 dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
67 fb->fb.fix.smem_start);
3095faf5
SH
68}
69
d948b454 70static AMBA_AHB_DEVICE(fb, "fb", 0, 0x00104000, { NETX_IRQ_LCD }, NULL);
3095faf5
SH
71
72int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel)
73{
74 netx_panel = panel;
75 fb_device.dev.platform_data = board;
76 return amba_device_register(&fb_device, &iomem_resource);
77}
This page took 0.859264 seconds and 5 git commands to generate.