Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Support for the w100 frame buffer. |
| 3 | * |
Richard Purdie | aac51f0 | 2005-09-06 15:19:03 -0700 | [diff] [blame] | 4 | * Copyright (c) 2004-2005 Richard Purdie |
| 5 | * Copyright (c) 2005 Ian Molton |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
Richard Purdie | aac51f0 | 2005-09-06 15:19:03 -0700 | [diff] [blame] | 12 | #define W100_GPIO_PORT_A 0 |
| 13 | #define W100_GPIO_PORT_B 1 |
| 14 | |
| 15 | #define CLK_SRC_XTAL 0 |
| 16 | #define CLK_SRC_PLL 1 |
| 17 | |
| 18 | struct w100fb_par; |
| 19 | |
| 20 | unsigned long w100fb_gpio_read(int port); |
| 21 | void w100fb_gpio_write(int port, unsigned long value); |
Richard Purdie | 513b6e1 | 2005-09-13 01:25:33 -0700 | [diff] [blame] | 22 | unsigned long w100fb_get_hsynclen(struct device *dev); |
Richard Purdie | aac51f0 | 2005-09-06 15:19:03 -0700 | [diff] [blame] | 23 | |
| 24 | /* LCD Specific Routines and Config */ |
| 25 | struct w100_tg_info { |
| 26 | void (*change)(struct w100fb_par*); |
| 27 | void (*suspend)(struct w100fb_par*); |
| 28 | void (*resume)(struct w100fb_par*); |
| 29 | }; |
| 30 | |
| 31 | /* General Platform Specific w100 Register Values */ |
| 32 | struct w100_gen_regs { |
| 33 | unsigned long lcd_format; |
| 34 | unsigned long lcdd_cntl1; |
| 35 | unsigned long lcdd_cntl2; |
| 36 | unsigned long genlcd_cntl1; |
| 37 | unsigned long genlcd_cntl2; |
| 38 | unsigned long genlcd_cntl3; |
| 39 | }; |
| 40 | |
| 41 | struct w100_gpio_regs { |
| 42 | unsigned long init_data1; |
| 43 | unsigned long init_data2; |
| 44 | unsigned long gpio_dir1; |
| 45 | unsigned long gpio_oe1; |
| 46 | unsigned long gpio_dir2; |
| 47 | unsigned long gpio_oe2; |
| 48 | }; |
| 49 | |
| 50 | /* Optional External Memory Configuration */ |
| 51 | struct w100_mem_info { |
| 52 | unsigned long ext_cntl; |
| 53 | unsigned long sdram_mode_reg; |
| 54 | unsigned long ext_timing_cntl; |
| 55 | unsigned long io_cntl; |
| 56 | unsigned int size; |
| 57 | }; |
| 58 | |
| 59 | struct w100_bm_mem_info { |
| 60 | unsigned long ext_mem_bw; |
| 61 | unsigned long offset; |
| 62 | unsigned long ext_timing_ctl; |
| 63 | unsigned long ext_cntl; |
| 64 | unsigned long mode_reg; |
| 65 | unsigned long io_cntl; |
| 66 | unsigned long config; |
| 67 | }; |
| 68 | |
| 69 | /* LCD Mode definition */ |
| 70 | struct w100_mode { |
| 71 | unsigned int xres; |
| 72 | unsigned int yres; |
| 73 | unsigned short left_margin; |
| 74 | unsigned short right_margin; |
| 75 | unsigned short upper_margin; |
| 76 | unsigned short lower_margin; |
| 77 | unsigned long crtc_ss; |
| 78 | unsigned long crtc_ls; |
| 79 | unsigned long crtc_gs; |
| 80 | unsigned long crtc_vpos_gs; |
| 81 | unsigned long crtc_rev; |
| 82 | unsigned long crtc_dclk; |
| 83 | unsigned long crtc_gclk; |
| 84 | unsigned long crtc_goe; |
| 85 | unsigned long crtc_ps1_active; |
| 86 | char pll_freq; |
| 87 | char fast_pll_freq; |
| 88 | int sysclk_src; |
| 89 | int sysclk_divider; |
| 90 | int pixclk_src; |
| 91 | int pixclk_divider; |
| 92 | int pixclk_divider_rotated; |
| 93 | }; |
| 94 | |
| 95 | struct w100_pll_info { |
| 96 | uint16_t freq; /* desired Fout for PLL (Mhz) */ |
| 97 | uint8_t M; /* input divider */ |
| 98 | uint8_t N_int; /* VCO multiplier */ |
| 99 | uint8_t N_fac; /* VCO multiplier fractional part */ |
| 100 | uint8_t tfgoal; |
| 101 | uint8_t lock_time; |
| 102 | }; |
| 103 | |
| 104 | /* Initial Video mode orientation flags */ |
| 105 | #define INIT_MODE_ROTATED 0x1 |
| 106 | #define INIT_MODE_FLIPPED 0x2 |
| 107 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | /* |
| 109 | * This structure describes the machine which we are running on. |
| 110 | * It is set by machine specific code and used in the probe routine |
| 111 | * of drivers/video/w100fb.c |
| 112 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | struct w100fb_mach_info { |
Richard Purdie | aac51f0 | 2005-09-06 15:19:03 -0700 | [diff] [blame] | 114 | /* General Platform Specific Registers */ |
| 115 | struct w100_gen_regs *regs; |
| 116 | /* Table of modes the LCD is capable of */ |
| 117 | struct w100_mode *modelist; |
| 118 | unsigned int num_modes; |
| 119 | /* Hooks for any platform specific tg/lcd code (optional) */ |
| 120 | struct w100_tg_info *tg; |
| 121 | /* External memory definition (if present) */ |
| 122 | struct w100_mem_info *mem; |
| 123 | /* Additional External memory definition (if present) */ |
| 124 | struct w100_bm_mem_info *bm_mem; |
| 125 | /* GPIO definitions (optional) */ |
| 126 | struct w100_gpio_regs *gpio; |
| 127 | /* Initial Mode flags */ |
| 128 | unsigned int init_mode; |
| 129 | /* Xtal Frequency */ |
| 130 | unsigned int xtal_freq; |
| 131 | /* Enable Xtal input doubler (1 == enable) */ |
| 132 | unsigned int xtal_dbl; |
| 133 | }; |
| 134 | |
| 135 | /* General frame buffer data structure */ |
| 136 | struct w100fb_par { |
| 137 | unsigned int chip_id; |
| 138 | unsigned int xres; |
| 139 | unsigned int yres; |
| 140 | unsigned int extmem_active; |
| 141 | unsigned int flip; |
| 142 | unsigned int blanked; |
| 143 | unsigned int fastpll_mode; |
| 144 | unsigned long hsync_len; |
| 145 | struct w100_mode *mode; |
| 146 | struct w100_pll_info *pll_table; |
| 147 | struct w100fb_mach_info *mach; |
| 148 | uint32_t *saved_intmem; |
| 149 | uint32_t *saved_extmem; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | }; |