18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * linux/drivers/video/sa1100fb.h
38c2ecf20Sopenharmony_ci *    -- StrongARM 1100 LCD Controller Frame Buffer Device
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 1999 Eric A. Thomas
68c2ecf20Sopenharmony_ci *   Based on acornfb.c Copyright (C) Russell King.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
98c2ecf20Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
108c2ecf20Sopenharmony_ci * for more details.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct gpio_desc;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define LCCR0           0x0000          /* LCD Control Reg. 0 */
168c2ecf20Sopenharmony_ci#define LCSR            0x0004          /* LCD Status Reg. */
178c2ecf20Sopenharmony_ci#define DBAR1           0x0010          /* LCD DMA Base Address Reg. channel 1 */
188c2ecf20Sopenharmony_ci#define DCAR1           0x0014          /* LCD DMA Current Address Reg. channel 1 */
198c2ecf20Sopenharmony_ci#define DBAR2           0x0018          /* LCD DMA Base Address Reg.  channel 2 */
208c2ecf20Sopenharmony_ci#define DCAR2           0x001C          /* LCD DMA Current Address Reg. channel 2 */
218c2ecf20Sopenharmony_ci#define LCCR1           0x0020          /* LCD Control Reg. 1 */
228c2ecf20Sopenharmony_ci#define LCCR2           0x0024          /* LCD Control Reg. 2 */
238c2ecf20Sopenharmony_ci#define LCCR3           0x0028          /* LCD Control Reg. 3 */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Shadows for LCD controller registers */
268c2ecf20Sopenharmony_cistruct sa1100fb_lcd_reg {
278c2ecf20Sopenharmony_ci	unsigned long lccr0;
288c2ecf20Sopenharmony_ci	unsigned long lccr1;
298c2ecf20Sopenharmony_ci	unsigned long lccr2;
308c2ecf20Sopenharmony_ci	unsigned long lccr3;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct sa1100fb_info {
348c2ecf20Sopenharmony_ci	struct fb_info		fb;
358c2ecf20Sopenharmony_ci	struct device		*dev;
368c2ecf20Sopenharmony_ci	const struct sa1100fb_rgb *rgb[NR_RGB];
378c2ecf20Sopenharmony_ci	void __iomem		*base;
388c2ecf20Sopenharmony_ci	struct gpio_desc	*shannon_lcden;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	/*
418c2ecf20Sopenharmony_ci	 * These are the addresses we mapped
428c2ecf20Sopenharmony_ci	 * the framebuffer memory region to.
438c2ecf20Sopenharmony_ci	 */
448c2ecf20Sopenharmony_ci	dma_addr_t		map_dma;
458c2ecf20Sopenharmony_ci	u_char *		map_cpu;
468c2ecf20Sopenharmony_ci	u_int			map_size;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	u_char *		screen_cpu;
498c2ecf20Sopenharmony_ci	dma_addr_t		screen_dma;
508c2ecf20Sopenharmony_ci	u16 *			palette_cpu;
518c2ecf20Sopenharmony_ci	dma_addr_t		palette_dma;
528c2ecf20Sopenharmony_ci	u_int			palette_size;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	dma_addr_t		dbar1;
558c2ecf20Sopenharmony_ci	dma_addr_t		dbar2;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	u_int			reg_lccr0;
588c2ecf20Sopenharmony_ci	u_int			reg_lccr1;
598c2ecf20Sopenharmony_ci	u_int			reg_lccr2;
608c2ecf20Sopenharmony_ci	u_int			reg_lccr3;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	volatile u_char		state;
638c2ecf20Sopenharmony_ci	volatile u_char		task_state;
648c2ecf20Sopenharmony_ci	struct mutex		ctrlr_lock;
658c2ecf20Sopenharmony_ci	wait_queue_head_t	ctrlr_wait;
668c2ecf20Sopenharmony_ci	struct work_struct	task;
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_FREQ
698c2ecf20Sopenharmony_ci	struct notifier_block	freq_transition;
708c2ecf20Sopenharmony_ci#endif
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	const struct sa1100fb_mach_info *inf;
738c2ecf20Sopenharmony_ci	struct clk *clk;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	u32 pseudo_palette[16];
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define TO_INF(ptr,member)	container_of(ptr,struct sa1100fb_info,member)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define SA1100_PALETTE_MODE_VAL(bpp)    (((bpp) & 0x018) << 9)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/*
838c2ecf20Sopenharmony_ci * These are the actions for set_ctrlr_state
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci#define C_DISABLE		(0)
868c2ecf20Sopenharmony_ci#define C_ENABLE		(1)
878c2ecf20Sopenharmony_ci#define C_DISABLE_CLKCHANGE	(2)
888c2ecf20Sopenharmony_ci#define C_ENABLE_CLKCHANGE	(3)
898c2ecf20Sopenharmony_ci#define C_REENABLE		(4)
908c2ecf20Sopenharmony_ci#define C_DISABLE_PM		(5)
918c2ecf20Sopenharmony_ci#define C_ENABLE_PM		(6)
928c2ecf20Sopenharmony_ci#define C_STARTUP		(7)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define SA1100_NAME	"SA1100"
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/*
978c2ecf20Sopenharmony_ci * Minimum X and Y resolutions
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_ci#define MIN_XRES	64
1008c2ecf20Sopenharmony_ci#define MIN_YRES	64
1018c2ecf20Sopenharmony_ci
102