2 * Driver for AMBA PrimeCell CLCD
4 * Copyright (C) 2009 Alessandro Rubini
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <amba_clcd.h>
30 /* These variables are required by lcd.c -- although it sets them by itself */
35 void *lcd_console_address;
40 * To use this driver you need to provide the following in board files:
41 * a panel_info definition
42 * an lcd_enable function (can't define a weak default with current code)
45 /* There is nothing to do with color registers, we use true color */
46 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
51 /* Low level initialization of the logic cell: depends on panel_info */
52 void lcd_ctrl_init(void *lcdbase)
54 struct clcd_config *config;
55 struct clcd_registers *regs;
58 config = panel_info.priv;
59 regs = config->address;
60 cntl = config->cntl & ~CNTL_LCDEN;
62 /* Lazily, just copy the registers over: first control with disable */
63 writel(cntl, ®s->cntl);
65 writel(config->tim0, ®s->tim0);
66 writel(config->tim1, ®s->tim1);
67 writel(config->tim2, ®s->tim2);
68 writel(config->tim3, ®s->tim3);
69 writel((u32)lcdbase, ®s->ubas);
71 writel(cntl | CNTL_LCDEN, ®s->cntl);
74 /* This is trivial, and copied from atmel_lcdfb.c */
75 ulong calc_fbsize(void)
77 return ((panel_info.vl_col * panel_info.vl_row *
78 NBITS(panel_info.vl_bpix)) / 8) + PAGE_SIZE;