| 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> | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 18 | #include <linux/mfd/tc6393xb.h> | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 19 |  | 
|  | 20 | #include <video/w100fb.h> | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 21 |  | 
|  | 22 | #include <asm/setup.h> | 
|  | 23 | #include <asm/mach/arch.h> | 
|  | 24 | #include <asm/mach-types.h> | 
|  | 25 |  | 
| Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 26 | #include <mach/pxa25x.h> | 
| Ian Molton | ebcce7b | 2008-08-19 13:34:56 +0100 | [diff] [blame] | 27 | #include <mach/eseries-gpio.h> | 
|  | 28 | #include <mach/udc.h> | 
| Russell King | 80b02c1 | 2009-01-08 10:01:47 +0000 | [diff] [blame] | 29 | #include <mach/irqs.h> | 
| Mark Brown | 80748fb | 2009-04-03 12:45:49 +0100 | [diff] [blame] | 30 | #include <mach/audio.h> | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 31 |  | 
|  | 32 | #include "generic.h" | 
|  | 33 | #include "eseries.h" | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 34 | #include "clock.h" | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 35 |  | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 36 | /* ------------------------ e800 LCD definitions ------------------------- */ | 
|  | 37 |  | 
|  | 38 | static struct w100_gen_regs e800_lcd_regs = { | 
|  | 39 | .lcd_format =            0x00008003, | 
|  | 40 | .lcdd_cntl1 =            0x02a00000, | 
|  | 41 | .lcdd_cntl2 =            0x0003ffff, | 
|  | 42 | .genlcd_cntl1 =          0x000ff2a3, | 
|  | 43 | .genlcd_cntl2 =          0x000002a3, | 
|  | 44 | .genlcd_cntl3 =          0x000102aa, | 
|  | 45 | }; | 
|  | 46 |  | 
|  | 47 | static struct w100_mode e800_lcd_mode[2] = { | 
|  | 48 | [0] = { | 
|  | 49 | .xres            = 480, | 
|  | 50 | .yres            = 640, | 
|  | 51 | .left_margin     = 52, | 
|  | 52 | .right_margin    = 148, | 
|  | 53 | .upper_margin    = 2, | 
|  | 54 | .lower_margin    = 6, | 
|  | 55 | .crtc_ss         = 0x80350034, | 
|  | 56 | .crtc_ls         = 0x802b0026, | 
|  | 57 | .crtc_gs         = 0x80160016, | 
|  | 58 | .crtc_vpos_gs    = 0x00020003, | 
|  | 59 | .crtc_rev        = 0x0040001d, | 
|  | 60 | .crtc_dclk       = 0xe0000000, | 
|  | 61 | .crtc_gclk       = 0x82a50049, | 
|  | 62 | .crtc_goe        = 0x80ee001c, | 
|  | 63 | .crtc_ps1_active = 0x00000000, | 
|  | 64 | .pll_freq        = 128, | 
|  | 65 | .pixclk_divider         = 4, | 
|  | 66 | .pixclk_divider_rotated = 6, | 
|  | 67 | .pixclk_src     = CLK_SRC_PLL, | 
|  | 68 | .sysclk_divider  = 0, | 
|  | 69 | .sysclk_src     = CLK_SRC_PLL, | 
|  | 70 | }, | 
|  | 71 | [1] = { | 
|  | 72 | .xres            = 240, | 
|  | 73 | .yres            = 320, | 
|  | 74 | .left_margin     = 15, | 
|  | 75 | .right_margin    = 88, | 
|  | 76 | .upper_margin    = 0, | 
|  | 77 | .lower_margin    = 7, | 
|  | 78 | .crtc_ss         = 0xd010000f, | 
|  | 79 | .crtc_ls         = 0x80070003, | 
|  | 80 | .crtc_gs         = 0x80000000, | 
|  | 81 | .crtc_vpos_gs    = 0x01460147, | 
|  | 82 | .crtc_rev        = 0x00400003, | 
|  | 83 | .crtc_dclk       = 0xa1700030, | 
|  | 84 | .crtc_gclk       = 0x814b0008, | 
|  | 85 | .crtc_goe        = 0x80cc0015, | 
|  | 86 | .crtc_ps1_active = 0x00000000, | 
|  | 87 | .pll_freq        = 100, | 
|  | 88 | .pixclk_divider         = 6, /* Wince uses 14 which gives a */ | 
|  | 89 | .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */ | 
|  | 90 | .pixclk_src     = CLK_SRC_PLL, | 
|  | 91 | .sysclk_divider  = 0, | 
|  | 92 | .sysclk_src     = CLK_SRC_PLL, | 
|  | 93 | } | 
|  | 94 | }; | 
|  | 95 |  | 
|  | 96 |  | 
|  | 97 | static struct w100_gpio_regs e800_w100_gpio_info = { | 
|  | 98 | .init_data1 = 0xc13fc019, | 
|  | 99 | .gpio_dir1  = 0x3e40df7f, | 
|  | 100 | .gpio_oe1   = 0x003c3000, | 
|  | 101 | .init_data2 = 0x00000000, | 
|  | 102 | .gpio_dir2  = 0x00000000, | 
|  | 103 | .gpio_oe2   = 0x00000000, | 
|  | 104 | }; | 
|  | 105 |  | 
|  | 106 | static struct w100_mem_info e800_w100_mem_info = { | 
|  | 107 | .ext_cntl        = 0x09640011, | 
|  | 108 | .sdram_mode_reg  = 0x00600021, | 
|  | 109 | .ext_timing_cntl = 0x10001545, | 
|  | 110 | .io_cntl         = 0x7ddd7333, | 
|  | 111 | .size            = 0x1fffff, | 
|  | 112 | }; | 
|  | 113 |  | 
|  | 114 | static void e800_tg_change(struct w100fb_par *par) | 
|  | 115 | { | 
|  | 116 | unsigned long tmp; | 
|  | 117 |  | 
|  | 118 | tmp = w100fb_gpio_read(W100_GPIO_PORT_A); | 
|  | 119 | if (par->mode->xres == 480) | 
|  | 120 | tmp |= 0x100; | 
|  | 121 | else | 
|  | 122 | tmp &= ~0x100; | 
|  | 123 | w100fb_gpio_write(W100_GPIO_PORT_A, tmp); | 
|  | 124 | } | 
|  | 125 |  | 
|  | 126 | static struct w100_tg_info e800_tg_info = { | 
|  | 127 | .change = e800_tg_change, | 
|  | 128 | }; | 
|  | 129 |  | 
|  | 130 | static struct w100fb_mach_info e800_fb_info = { | 
|  | 131 | .modelist   = e800_lcd_mode, | 
|  | 132 | .num_modes  = 2, | 
|  | 133 | .regs       = &e800_lcd_regs, | 
|  | 134 | .gpio       = &e800_w100_gpio_info, | 
|  | 135 | .mem        = &e800_w100_mem_info, | 
|  | 136 | .tg         = &e800_tg_info, | 
|  | 137 | .xtal_freq  = 16000000, | 
|  | 138 | }; | 
|  | 139 |  | 
|  | 140 | static struct resource e800_fb_resources[] = { | 
|  | 141 | [0] = { | 
|  | 142 | .start          = 0x0c000000, | 
|  | 143 | .end            = 0x0cffffff, | 
|  | 144 | .flags          = IORESOURCE_MEM, | 
|  | 145 | }, | 
|  | 146 | }; | 
|  | 147 |  | 
|  | 148 | static struct platform_device e800_fb_device = { | 
|  | 149 | .name           = "w100fb", | 
|  | 150 | .id             = -1, | 
|  | 151 | .dev            = { | 
|  | 152 | .platform_data  = &e800_fb_info, | 
|  | 153 | }, | 
|  | 154 | .num_resources  = ARRAY_SIZE(e800_fb_resources), | 
|  | 155 | .resource       = e800_fb_resources, | 
|  | 156 | }; | 
|  | 157 |  | 
| Ian Molton | ebcce7b | 2008-08-19 13:34:56 +0100 | [diff] [blame] | 158 | /* --------------------------- UDC definitions --------------------------- */ | 
|  | 159 |  | 
|  | 160 | static struct pxa2xx_udc_mach_info e800_udc_mach_info = { | 
|  | 161 | .gpio_vbus   = GPIO_E800_USB_DISC, | 
|  | 162 | .gpio_pullup = GPIO_E800_USB_PULLUP, | 
|  | 163 | .gpio_pullup_inverted = 1 | 
|  | 164 | }; | 
|  | 165 |  | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 166 | /* ----------------- e800 tc6393xb parameters ------------------ */ | 
|  | 167 |  | 
|  | 168 | static struct tc6393xb_platform_data e800_tc6393xb_info = { | 
|  | 169 | .irq_base       = IRQ_BOARD_START, | 
|  | 170 | .scr_pll2cr     = 0x0cc1, | 
|  | 171 | .scr_gper       = 0, | 
|  | 172 | .gpio_base      = -1, | 
|  | 173 | .suspend        = &eseries_tmio_suspend, | 
|  | 174 | .resume         = &eseries_tmio_resume, | 
|  | 175 | .enable         = &eseries_tmio_enable, | 
|  | 176 | .disable        = &eseries_tmio_disable, | 
|  | 177 | }; | 
|  | 178 |  | 
|  | 179 | static struct platform_device e800_tc6393xb_device = { | 
|  | 180 | .name           = "tc6393xb", | 
|  | 181 | .id             = -1, | 
|  | 182 | .dev            = { | 
|  | 183 | .platform_data = &e800_tc6393xb_info, | 
|  | 184 | }, | 
|  | 185 | .num_resources = 2, | 
|  | 186 | .resource      = eseries_tmio_resources, | 
|  | 187 | }; | 
|  | 188 |  | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 189 | /* ----------------------------------------------------------------------- */ | 
|  | 190 |  | 
|  | 191 | static struct platform_device *devices[] __initdata = { | 
|  | 192 | &e800_fb_device, | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 193 | &e800_tc6393xb_device, | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 194 | }; | 
|  | 195 |  | 
|  | 196 | static void __init e800_init(void) | 
|  | 197 | { | 
| Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 198 | pxa_set_ffuart_info(NULL); | 
|  | 199 | pxa_set_btuart_info(NULL); | 
|  | 200 | pxa_set_stuart_info(NULL); | 
| Dmitry Eremin-Solenikov | c68ffdd | 2009-03-05 18:17:53 +0300 | [diff] [blame] | 201 | clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name, | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 202 | "GPIO11_CLK", NULL), | 
|  | 203 | eseries_get_tmio_gpios(); | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 204 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 
| Ian Molton | ebcce7b | 2008-08-19 13:34:56 +0100 | [diff] [blame] | 205 | pxa_set_udc_info(&e800_udc_mach_info); | 
| Mark Brown | 80748fb | 2009-04-03 12:45:49 +0100 | [diff] [blame] | 206 | pxa_set_ac97_info(NULL); | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 207 | } | 
|  | 208 |  | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 209 | MACHINE_START(E800, "Toshiba e800") | 
|  | 210 | /* Maintainer: Ian Molton (spyro@f2s.com) */ | 
|  | 211 | .phys_io	= 0x40000000, | 
|  | 212 | .io_pg_offst	= (io_p2v(0x40000000) >> 18) & 0xfffc, | 
|  | 213 | .boot_params	= 0xa0000100, | 
|  | 214 | .map_io		= pxa_map_io, | 
|  | 215 | .init_irq	= pxa25x_init_irq, | 
|  | 216 | .fixup		= eseries_fixup, | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 217 | .init_machine	= e800_init, | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 218 | .timer		= &pxa_timer, | 
|  | 219 | MACHINE_END | 
|  | 220 |  |