2 * arch/arm/mach-netx/fb.c
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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.
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.
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
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>
26 #include <asm/arch/netx-regs.h>
27 #include <asm/hardware.h>
31 static struct clk fb_clk
;
33 static struct clcd_panel
*netx_panel
;
35 void netx_clcd_enable(struct clcd_fb
*fb
)
39 int netx_clcd_setup(struct clcd_fb
*fb
)
43 fb
->panel
= netx_panel
;
45 fb
->fb
.screen_base
= dma_alloc_writecombine(&fb
->dev
->dev
, 1024*1024,
47 if (!fb
->fb
.screen_base
) {
48 printk(KERN_ERR
"CLCD: unable to map framebuffer\n");
52 fb
->fb
.fix
.smem_start
= dma
;
53 fb
->fb
.fix
.smem_len
= 1024*1024;
58 int netx_clcd_mmap(struct clcd_fb
*fb
, struct vm_area_struct
*vma
)
60 return dma_mmap_writecombine(&fb
->dev
->dev
, vma
,
62 fb
->fb
.fix
.smem_start
,
66 void netx_clcd_remove(struct clcd_fb
*fb
)
68 dma_free_writecombine(&fb
->dev
->dev
, fb
->fb
.fix
.smem_len
,
69 fb
->fb
.screen_base
, fb
->fb
.fix
.smem_start
);
72 void clk_disable(struct clk
*clk
)
76 int clk_set_rate(struct clk
*clk
, unsigned long rate
)
81 int clk_enable(struct clk
*clk
)
86 struct clk
*clk_get(struct device
*dev
, const char *id
)
91 void clk_put(struct clk
*clk
)
95 static struct amba_device fb_device
= {
98 .coherent_dma_mask
= ~0,
103 .flags
= IORESOURCE_MEM
,
105 .irq
= { NETX_IRQ_LCD
, NO_IRQ
},
106 .periphid
= 0x10112400,
109 int netx_fb_init(struct clcd_board
*board
, struct clcd_panel
*panel
)
112 fb_device
.dev
.platform_data
= board
;
113 return amba_device_register(&fb_device
, &iomem_resource
);