blob: 1d844e228ea92e6a674e92a6b0fcb3e2cb3eef42 [file] [log] [blame]
Sascha Hauer3095faf2006-06-19 13:30:58 +01001/*
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>
Russell Kingeefc8422008-11-30 17:17:25 +000025#include <linux/err.h>
Sascha Hauer3095faf2006-06-19 13:30:58 +010026
Russell King80b02c12009-01-08 10:01:47 +000027#include <asm/irq.h>
28
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/netx-regs.h>
30#include <mach/hardware.h>
Sascha Hauer3095faf2006-06-19 13:30:58 +010031
Sascha Hauer3095faf2006-06-19 13:30:58 +010032static struct clcd_panel *netx_panel;
33
34void netx_clcd_enable(struct clcd_fb *fb)
35{
36}
37
38int netx_clcd_setup(struct clcd_fb *fb)
39{
40 dma_addr_t dma;
41
42 fb->panel = netx_panel;
43
44 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, 1024*1024,
45 &dma, GFP_KERNEL);
46 if (!fb->fb.screen_base) {
47 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
48 return -ENOMEM;
49 }
50
51 fb->fb.fix.smem_start = dma;
52 fb->fb.fix.smem_len = 1024*1024;
53
54 return 0;
55}
56
57int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
58{
59 return dma_mmap_writecombine(&fb->dev->dev, vma,
60 fb->fb.screen_base,
61 fb->fb.fix.smem_start,
62 fb->fb.fix.smem_len);
63}
64
65void netx_clcd_remove(struct clcd_fb *fb)
66{
67 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
68 fb->fb.screen_base, fb->fb.fix.smem_start);
69}
70
71void clk_disable(struct clk *clk)
72{
73}
74
75int clk_set_rate(struct clk *clk, unsigned long rate)
76{
77 return 0;
78}
79
80int clk_enable(struct clk *clk)
81{
82 return 0;
83}
84
85struct clk *clk_get(struct device *dev, const char *id)
86{
Russell Kingeefc8422008-11-30 17:17:25 +000087 return dev && strcmp(dev_name(dev), "fb") == 0 ? NULL : ERR_PTR(-ENOENT);
Sascha Hauer3095faf2006-06-19 13:30:58 +010088}
89
90void clk_put(struct clk *clk)
91{
92}
93
94static struct amba_device fb_device = {
95 .dev = {
Kay Sievers1d559e22009-01-06 10:44:43 -080096 .init_name = "fb",
Sascha Hauer3095faf2006-06-19 13:30:58 +010097 .coherent_dma_mask = ~0,
98 },
99 .res = {
100 .start = 0x00104000,
101 .end = 0x00104fff,
102 .flags = IORESOURCE_MEM,
103 },
104 .irq = { NETX_IRQ_LCD, NO_IRQ },
105 .periphid = 0x10112400,
106};
107
108int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel)
109{
110 netx_panel = panel;
111 fb_device.dev.platform_data = board;
112 return amba_device_register(&fb_device, &iomem_resource);
113}