| 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/clk.h> | 
|  | 19 | #include <linux/mfd/t7l66xb.h> | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 20 |  | 
|  | 21 | #include <video/w100fb.h> | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 22 |  | 
|  | 23 | #include <asm/setup.h> | 
|  | 24 | #include <asm/mach/arch.h> | 
|  | 25 | #include <asm/mach-types.h> | 
|  | 26 |  | 
| Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 27 | #include <mach/pxa25x.h> | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 28 | #include <mach/eseries-gpio.h> | 
| Ian Molton | ebcce7b | 2008-08-19 13:34:56 +0100 | [diff] [blame] | 29 | #include <mach/udc.h> | 
| Ian Molton | 3603342 | 2008-08-24 19:21:26 +0100 | [diff] [blame] | 30 | #include <mach/irda.h> | 
| Russell King | 80b02c1 | 2009-01-08 10:01:47 +0000 | [diff] [blame] | 31 | #include <mach/irqs.h> | 
| Mark Brown | 80748fb | 2009-04-03 12:45:49 +0100 | [diff] [blame] | 32 | #include <mach/audio.h> | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 33 |  | 
|  | 34 | #include "generic.h" | 
|  | 35 | #include "eseries.h" | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 36 | #include "clock.h" | 
|  | 37 | #include "devices.h" | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 38 |  | 
|  | 39 | /* ------------------------ e740 video support --------------------------- */ | 
|  | 40 |  | 
|  | 41 | static struct w100_gen_regs e740_lcd_regs = { | 
|  | 42 | .lcd_format =            0x00008023, | 
|  | 43 | .lcdd_cntl1 =            0x0f000000, | 
|  | 44 | .lcdd_cntl2 =            0x0003ffff, | 
|  | 45 | .genlcd_cntl1 =          0x00ffff03, | 
|  | 46 | .genlcd_cntl2 =          0x003c0f03, | 
|  | 47 | .genlcd_cntl3 =          0x000143aa, | 
|  | 48 | }; | 
|  | 49 |  | 
|  | 50 | static struct w100_mode e740_lcd_mode = { | 
|  | 51 | .xres            = 240, | 
|  | 52 | .yres            = 320, | 
|  | 53 | .left_margin     = 20, | 
|  | 54 | .right_margin    = 28, | 
|  | 55 | .upper_margin    = 9, | 
|  | 56 | .lower_margin    = 8, | 
|  | 57 | .crtc_ss         = 0x80140013, | 
|  | 58 | .crtc_ls         = 0x81150110, | 
|  | 59 | .crtc_gs         = 0x80050005, | 
|  | 60 | .crtc_vpos_gs    = 0x000a0009, | 
|  | 61 | .crtc_rev        = 0x0040010a, | 
|  | 62 | .crtc_dclk       = 0xa906000a, | 
|  | 63 | .crtc_gclk       = 0x80050108, | 
|  | 64 | .crtc_goe        = 0x80050108, | 
|  | 65 | .pll_freq        = 57, | 
|  | 66 | .pixclk_divider         = 4, | 
|  | 67 | .pixclk_divider_rotated = 4, | 
|  | 68 | .pixclk_src     = CLK_SRC_XTAL, | 
|  | 69 | .sysclk_divider  = 1, | 
|  | 70 | .sysclk_src     = CLK_SRC_PLL, | 
|  | 71 | .crtc_ps1_active =       0x41060010, | 
|  | 72 | }; | 
|  | 73 |  | 
|  | 74 | static struct w100_gpio_regs e740_w100_gpio_info = { | 
|  | 75 | .init_data1 = 0x21002103, | 
|  | 76 | .gpio_dir1  = 0xffffdeff, | 
|  | 77 | .gpio_oe1   = 0x03c00643, | 
|  | 78 | .init_data2 = 0x003f003f, | 
|  | 79 | .gpio_dir2  = 0xffffffff, | 
|  | 80 | .gpio_oe2   = 0x000000ff, | 
|  | 81 | }; | 
|  | 82 |  | 
|  | 83 | static struct w100fb_mach_info e740_fb_info = { | 
|  | 84 | .modelist   = &e740_lcd_mode, | 
|  | 85 | .num_modes  = 1, | 
|  | 86 | .regs       = &e740_lcd_regs, | 
|  | 87 | .gpio       = &e740_w100_gpio_info, | 
|  | 88 | .xtal_freq = 14318000, | 
|  | 89 | .xtal_dbl   = 1, | 
|  | 90 | }; | 
|  | 91 |  | 
|  | 92 | static struct resource e740_fb_resources[] = { | 
|  | 93 | [0] = { | 
|  | 94 | .start          = 0x0c000000, | 
|  | 95 | .end            = 0x0cffffff, | 
|  | 96 | .flags          = IORESOURCE_MEM, | 
|  | 97 | }, | 
|  | 98 | }; | 
|  | 99 |  | 
|  | 100 | static struct platform_device e740_fb_device = { | 
|  | 101 | .name           = "w100fb", | 
|  | 102 | .id             = -1, | 
|  | 103 | .dev            = { | 
|  | 104 | .platform_data  = &e740_fb_info, | 
|  | 105 | }, | 
|  | 106 | .num_resources  = ARRAY_SIZE(e740_fb_resources), | 
|  | 107 | .resource       = e740_fb_resources, | 
|  | 108 | }; | 
|  | 109 |  | 
|  | 110 | /* --------------------------- MFP Pin config -------------------------- */ | 
|  | 111 |  | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 112 | static unsigned long e740_pin_config[] __initdata = { | 
|  | 113 | /* Chip selects */ | 
|  | 114 | GPIO15_nCS_1,   /* CS1 - Flash */ | 
|  | 115 | GPIO79_nCS_3,   /* CS3 - IMAGEON */ | 
|  | 116 | GPIO80_nCS_4,   /* CS4 - TMIO */ | 
|  | 117 |  | 
|  | 118 | /* Clocks */ | 
|  | 119 | GPIO12_32KHz, | 
|  | 120 |  | 
|  | 121 | /* BTUART */ | 
|  | 122 | GPIO42_BTUART_RXD, | 
|  | 123 | GPIO43_BTUART_TXD, | 
|  | 124 | GPIO44_BTUART_CTS, | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 125 |  | 
|  | 126 | /* TMIO controller */ | 
|  | 127 | GPIO19_GPIO, /* t7l66xb #PCLR */ | 
|  | 128 | GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */ | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 129 |  | 
| Ian Molton | f4ad9a9 | 2008-09-26 13:35:28 +0100 | [diff] [blame] | 130 | /* UDC */ | 
|  | 131 | GPIO13_GPIO, | 
|  | 132 | GPIO3_GPIO, | 
|  | 133 |  | 
| Ian Molton | 3603342 | 2008-08-24 19:21:26 +0100 | [diff] [blame] | 134 | /* IrDA */ | 
|  | 135 | GPIO38_GPIO | MFP_LPM_DRIVE_HIGH, | 
|  | 136 |  | 
| Ian Molton | 28796ea | 2009-01-17 15:11:06 +0000 | [diff] [blame] | 137 | /* Audio power control */ | 
|  | 138 | GPIO16_GPIO,  /* AC97 codec AVDD2 supply (analogue power) */ | 
|  | 139 | GPIO40_GPIO,  /* Mic amp power */ | 
|  | 140 | GPIO41_GPIO,  /* Headphone amp power */ | 
|  | 141 |  | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 142 | /* PC Card */ | 
|  | 143 | GPIO8_GPIO,   /* CD0 */ | 
|  | 144 | GPIO44_GPIO,  /* CD1 */ | 
|  | 145 | GPIO11_GPIO,  /* IRQ0 */ | 
|  | 146 | GPIO6_GPIO,   /* IRQ1 */ | 
|  | 147 | GPIO27_GPIO,  /* RST0 */ | 
|  | 148 | GPIO24_GPIO,  /* RST1 */ | 
|  | 149 | GPIO20_GPIO,  /* PWR0 */ | 
|  | 150 | GPIO23_GPIO,  /* PWR1 */ | 
|  | 151 | GPIO48_nPOE, | 
|  | 152 | GPIO49_nPWE, | 
|  | 153 | GPIO50_nPIOR, | 
|  | 154 | GPIO51_nPIOW, | 
|  | 155 | GPIO52_nPCE_1, | 
|  | 156 | GPIO53_nPCE_2, | 
|  | 157 | GPIO54_nPSKTSEL, | 
|  | 158 | GPIO55_nPREG, | 
|  | 159 | GPIO56_nPWAIT, | 
|  | 160 | GPIO57_nIOIS16, | 
|  | 161 |  | 
|  | 162 | /* wakeup */ | 
|  | 163 | GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, | 
|  | 164 | }; | 
|  | 165 |  | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 166 | /* -------------------- e740 t7l66xb parameters -------------------- */ | 
|  | 167 |  | 
|  | 168 | static struct t7l66xb_platform_data e740_t7l66xb_info = { | 
|  | 169 | .irq_base 		= IRQ_BOARD_START, | 
|  | 170 | .enable                 = &eseries_tmio_enable, | 
|  | 171 | .suspend                = &eseries_tmio_suspend, | 
|  | 172 | .resume                 = &eseries_tmio_resume, | 
|  | 173 | }; | 
|  | 174 |  | 
|  | 175 | static struct platform_device e740_t7l66xb_device = { | 
|  | 176 | .name           = "t7l66xb", | 
|  | 177 | .id             = -1, | 
|  | 178 | .dev            = { | 
|  | 179 | .platform_data = &e740_t7l66xb_info, | 
|  | 180 | }, | 
|  | 181 | .num_resources = 2, | 
|  | 182 | .resource      = eseries_tmio_resources, | 
|  | 183 | }; | 
|  | 184 |  | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 185 | /* ----------------------------------------------------------------------- */ | 
|  | 186 |  | 
|  | 187 | static struct platform_device *devices[] __initdata = { | 
|  | 188 | &e740_fb_device, | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 189 | &e740_t7l66xb_device, | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 190 | }; | 
|  | 191 |  | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 192 | static void __init e740_init(void) | 
|  | 193 | { | 
|  | 194 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config)); | 
| Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 195 | pxa_set_ffuart_info(NULL); | 
|  | 196 | pxa_set_btuart_info(NULL); | 
|  | 197 | pxa_set_stuart_info(NULL); | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 198 | eseries_register_clks(); | 
| Dmitry Eremin-Solenikov | c68ffdd | 2009-03-05 18:17:53 +0300 | [diff] [blame] | 199 | clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name, | 
| Ian Molton | b1ae1b7 | 2008-09-26 13:38:59 +0100 | [diff] [blame] | 200 | "UDCCLK", &pxa25x_device_udc.dev), | 
|  | 201 | eseries_get_tmio_gpios(); | 
| Ian Molton | 0ec3cf6 | 2008-08-19 13:01:28 +0100 | [diff] [blame] | 202 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 
| Ian Molton | ebcce7b | 2008-08-19 13:34:56 +0100 | [diff] [blame] | 203 | pxa_set_udc_info(&e7xx_udc_mach_info); | 
| Mark Brown | 80748fb | 2009-04-03 12:45:49 +0100 | [diff] [blame] | 204 | pxa_set_ac97_info(NULL); | 
| Ian Molton | 3603342 | 2008-08-24 19:21:26 +0100 | [diff] [blame] | 205 | pxa_set_ficp_info(&e7xx_ficp_platform_data); | 
| Ian Molton | 7dc9641 | 2008-08-19 12:14:21 +0100 | [diff] [blame] | 206 | } | 
|  | 207 |  | 
|  | 208 | MACHINE_START(E740, "Toshiba e740") | 
|  | 209 | /* Maintainer: Ian Molton (spyro@f2s.com) */ | 
|  | 210 | .phys_io	= 0x40000000, | 
|  | 211 | .io_pg_offst	= (io_p2v(0x40000000) >> 18) & 0xfffc, | 
|  | 212 | .boot_params	= 0xa0000100, | 
|  | 213 | .map_io		= pxa_map_io, | 
|  | 214 | .init_irq	= pxa25x_init_irq, | 
|  | 215 | .fixup		= eseries_fixup, | 
|  | 216 | .init_machine	= e740_init, | 
|  | 217 | .timer		= &pxa_timer, | 
|  | 218 | MACHINE_END | 
|  | 219 |  |