Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Hardware definitions for the Toshiba eseries PDAs |
| 3 | * |
| 4 | * Copyright (c) 2003 Ian Molton <spyro@f2s.com> |
| 5 | * |
| 6 | * This file is licensed under |
| 7 | * the terms of the GNU General Public License version 2. This program |
| 8 | * is licensed "as is" without any warranty of any kind, whether express |
| 9 | * or implied. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame^] | 15 | #include <linux/device.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/fb.h> |
| 18 | |
| 19 | #include <video/w100fb.h> |
Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 20 | |
| 21 | #include <asm/setup.h> |
| 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach-types.h> |
| 24 | |
| 25 | #include <mach/mfp-pxa25x.h> |
| 26 | #include <mach/hardware.h> |
| 27 | |
| 28 | #include "generic.h" |
| 29 | #include "eseries.h" |
| 30 | |
Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame^] | 31 | /* ------------------------ e800 LCD definitions ------------------------- */ |
| 32 | |
| 33 | static struct w100_gen_regs e800_lcd_regs = { |
| 34 | .lcd_format = 0x00008003, |
| 35 | .lcdd_cntl1 = 0x02a00000, |
| 36 | .lcdd_cntl2 = 0x0003ffff, |
| 37 | .genlcd_cntl1 = 0x000ff2a3, |
| 38 | .genlcd_cntl2 = 0x000002a3, |
| 39 | .genlcd_cntl3 = 0x000102aa, |
| 40 | }; |
| 41 | |
| 42 | static struct w100_mode e800_lcd_mode[2] = { |
| 43 | [0] = { |
| 44 | .xres = 480, |
| 45 | .yres = 640, |
| 46 | .left_margin = 52, |
| 47 | .right_margin = 148, |
| 48 | .upper_margin = 2, |
| 49 | .lower_margin = 6, |
| 50 | .crtc_ss = 0x80350034, |
| 51 | .crtc_ls = 0x802b0026, |
| 52 | .crtc_gs = 0x80160016, |
| 53 | .crtc_vpos_gs = 0x00020003, |
| 54 | .crtc_rev = 0x0040001d, |
| 55 | .crtc_dclk = 0xe0000000, |
| 56 | .crtc_gclk = 0x82a50049, |
| 57 | .crtc_goe = 0x80ee001c, |
| 58 | .crtc_ps1_active = 0x00000000, |
| 59 | .pll_freq = 128, |
| 60 | .pixclk_divider = 4, |
| 61 | .pixclk_divider_rotated = 6, |
| 62 | .pixclk_src = CLK_SRC_PLL, |
| 63 | .sysclk_divider = 0, |
| 64 | .sysclk_src = CLK_SRC_PLL, |
| 65 | }, |
| 66 | [1] = { |
| 67 | .xres = 240, |
| 68 | .yres = 320, |
| 69 | .left_margin = 15, |
| 70 | .right_margin = 88, |
| 71 | .upper_margin = 0, |
| 72 | .lower_margin = 7, |
| 73 | .crtc_ss = 0xd010000f, |
| 74 | .crtc_ls = 0x80070003, |
| 75 | .crtc_gs = 0x80000000, |
| 76 | .crtc_vpos_gs = 0x01460147, |
| 77 | .crtc_rev = 0x00400003, |
| 78 | .crtc_dclk = 0xa1700030, |
| 79 | .crtc_gclk = 0x814b0008, |
| 80 | .crtc_goe = 0x80cc0015, |
| 81 | .crtc_ps1_active = 0x00000000, |
| 82 | .pll_freq = 100, |
| 83 | .pixclk_divider = 6, /* Wince uses 14 which gives a */ |
| 84 | .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */ |
| 85 | .pixclk_src = CLK_SRC_PLL, |
| 86 | .sysclk_divider = 0, |
| 87 | .sysclk_src = CLK_SRC_PLL, |
| 88 | } |
| 89 | }; |
| 90 | |
| 91 | |
| 92 | static struct w100_gpio_regs e800_w100_gpio_info = { |
| 93 | .init_data1 = 0xc13fc019, |
| 94 | .gpio_dir1 = 0x3e40df7f, |
| 95 | .gpio_oe1 = 0x003c3000, |
| 96 | .init_data2 = 0x00000000, |
| 97 | .gpio_dir2 = 0x00000000, |
| 98 | .gpio_oe2 = 0x00000000, |
| 99 | }; |
| 100 | |
| 101 | static struct w100_mem_info e800_w100_mem_info = { |
| 102 | .ext_cntl = 0x09640011, |
| 103 | .sdram_mode_reg = 0x00600021, |
| 104 | .ext_timing_cntl = 0x10001545, |
| 105 | .io_cntl = 0x7ddd7333, |
| 106 | .size = 0x1fffff, |
| 107 | }; |
| 108 | |
| 109 | static void e800_tg_change(struct w100fb_par *par) |
| 110 | { |
| 111 | unsigned long tmp; |
| 112 | |
| 113 | tmp = w100fb_gpio_read(W100_GPIO_PORT_A); |
| 114 | if (par->mode->xres == 480) |
| 115 | tmp |= 0x100; |
| 116 | else |
| 117 | tmp &= ~0x100; |
| 118 | w100fb_gpio_write(W100_GPIO_PORT_A, tmp); |
| 119 | } |
| 120 | |
| 121 | static struct w100_tg_info e800_tg_info = { |
| 122 | .change = e800_tg_change, |
| 123 | }; |
| 124 | |
| 125 | static struct w100fb_mach_info e800_fb_info = { |
| 126 | .modelist = e800_lcd_mode, |
| 127 | .num_modes = 2, |
| 128 | .regs = &e800_lcd_regs, |
| 129 | .gpio = &e800_w100_gpio_info, |
| 130 | .mem = &e800_w100_mem_info, |
| 131 | .tg = &e800_tg_info, |
| 132 | .xtal_freq = 16000000, |
| 133 | }; |
| 134 | |
| 135 | static struct resource e800_fb_resources[] = { |
| 136 | [0] = { |
| 137 | .start = 0x0c000000, |
| 138 | .end = 0x0cffffff, |
| 139 | .flags = IORESOURCE_MEM, |
| 140 | }, |
| 141 | }; |
| 142 | |
| 143 | static struct platform_device e800_fb_device = { |
| 144 | .name = "w100fb", |
| 145 | .id = -1, |
| 146 | .dev = { |
| 147 | .platform_data = &e800_fb_info, |
| 148 | }, |
| 149 | .num_resources = ARRAY_SIZE(e800_fb_resources), |
| 150 | .resource = e800_fb_resources, |
| 151 | }; |
| 152 | |
| 153 | /* ----------------------------------------------------------------------- */ |
| 154 | |
| 155 | static struct platform_device *devices[] __initdata = { |
| 156 | &e800_fb_device, |
| 157 | }; |
| 158 | |
| 159 | static void __init e800_init(void) |
| 160 | { |
| 161 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 162 | } |
| 163 | |
Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 164 | MACHINE_START(E800, "Toshiba e800") |
| 165 | /* Maintainer: Ian Molton (spyro@f2s.com) */ |
| 166 | .phys_io = 0x40000000, |
| 167 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 168 | .boot_params = 0xa0000100, |
| 169 | .map_io = pxa_map_io, |
| 170 | .init_irq = pxa25x_init_irq, |
| 171 | .fixup = eseries_fixup, |
Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame^] | 172 | .init_machine = e800_init, |
Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 173 | .timer = &pxa_timer, |
| 174 | MACHINE_END |
| 175 | |