Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Support for Sharp SL-C6000x PDAs |
| 3 | * Model: (Tosa) |
| 4 | * |
| 5 | * Copyright (c) 2005 Dirk Opfer |
| 6 | * |
| 7 | * Based on code written by Sharp/Lineo for 2.4 kernels |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/init.h> |
Dirk Opfer | 067c904 | 2005-11-21 15:17:06 +0000 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 18 | #include <linux/major.h> |
| 19 | #include <linux/fs.h> |
| 20 | #include <linux/interrupt.h> |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 21 | #include <linux/delay.h> |
| 22 | #include <linux/fb.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 23 | #include <linux/mmc/host.h> |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 24 | #include <linux/mfd/tc6393xb.h> |
Dmitry Baryshkov | 5289fec | 2008-06-27 10:38:44 +0100 | [diff] [blame] | 25 | #include <linux/mfd/tmio.h> |
| 26 | #include <linux/mtd/nand.h> |
| 27 | #include <linux/mtd/partitions.h> |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 28 | #include <linux/pm.h> |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 29 | #include <linux/gpio_keys.h> |
| 30 | #include <linux/input.h> |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 31 | #include <linux/gpio.h> |
Dmitry Baryshkov | 53b14ea | 2008-06-14 11:43:36 +0100 | [diff] [blame] | 32 | #include <linux/pda_power.h> |
Dmitry Baryshkov | 16b32fd | 2008-07-05 09:02:48 +0100 | [diff] [blame] | 33 | #include <linux/rfkill.h> |
Dmitry Baryshkov | 14b7b40 | 2008-09-13 21:06:41 +0400 | [diff] [blame] | 34 | #include <linux/spi/spi.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 35 | |
| 36 | #include <asm/setup.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 37 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 38 | #include <mach/pxa2xx-regs.h> |
| 39 | #include <mach/mfp-pxa25x.h> |
Russell King | afd2fc0 | 2008-08-07 11:05:25 +0100 | [diff] [blame] | 40 | #include <mach/reset.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | #include <mach/irda.h> |
| 42 | #include <mach/i2c.h> |
| 43 | #include <mach/mmc.h> |
| 44 | #include <mach/udc.h> |
| 45 | #include <mach/tosa_bt.h> |
Dmitry Baryshkov | 14b7b40 | 2008-09-13 21:06:41 +0400 | [diff] [blame] | 46 | #include <mach/pxa2xx_spi.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 47 | |
| 48 | #include <asm/mach/arch.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 49 | #include <mach/tosa.h> |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 50 | |
| 51 | #include <asm/hardware/scoop.h> |
| 52 | #include <asm/mach/sharpsl_param.h> |
| 53 | |
| 54 | #include "generic.h" |
Dmitry Baryshkov | 7bdb22c | 2008-09-10 10:30:37 +0100 | [diff] [blame] | 55 | #include "clock.h" |
Russell King | 46c41e6 | 2007-05-15 15:39:36 +0100 | [diff] [blame] | 56 | #include "devices.h" |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 57 | |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 58 | static unsigned long tosa_pin_config[] = { |
| 59 | GPIO78_nCS_2, /* Scoop */ |
| 60 | GPIO80_nCS_4, /* tg6393xb */ |
| 61 | GPIO33_nCS_5, /* Scoop */ |
| 62 | |
| 63 | // GPIO76 CARD_VCC_ON1 |
| 64 | |
| 65 | GPIO19_GPIO, /* Reset out */ |
| 66 | GPIO1_RST | WAKEUP_ON_EDGE_FALL, |
| 67 | |
| 68 | GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */ |
| 69 | GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */ |
| 70 | GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */ |
| 71 | GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */ |
| 72 | GPIO20_GPIO, /* EAR_IN */ |
| 73 | GPIO22_GPIO, /* On */ |
| 74 | |
| 75 | GPIO5_GPIO, /* USB_IN */ |
| 76 | GPIO32_GPIO, /* Pen IRQ */ |
| 77 | |
| 78 | GPIO7_GPIO, /* Jacket Detect */ |
| 79 | GPIO14_GPIO, /* BAT0_CRG */ |
| 80 | GPIO12_GPIO, /* BAT1_CRG */ |
| 81 | GPIO17_GPIO, /* BAT0_LOW */ |
| 82 | GPIO84_GPIO, /* BAT1_LOW */ |
| 83 | GPIO38_GPIO, /* BAT_LOCK */ |
| 84 | |
| 85 | GPIO11_3_6MHz, |
| 86 | GPIO15_GPIO, /* TC6393XB IRQ */ |
| 87 | GPIO18_RDY, |
| 88 | GPIO27_GPIO, /* LCD Sync */ |
| 89 | |
| 90 | /* MMC */ |
| 91 | GPIO6_MMC_CLK, |
| 92 | GPIO8_MMC_CS0, |
| 93 | GPIO9_GPIO, /* Detect */ |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 94 | GPIO10_GPIO, /* nSD_INT */ |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 95 | |
| 96 | /* CF */ |
| 97 | GPIO13_GPIO, /* CD_IRQ */ |
| 98 | GPIO21_GPIO, /* Main Slot IRQ */ |
| 99 | GPIO36_GPIO, /* Jacket Slot IRQ */ |
| 100 | GPIO48_nPOE, |
| 101 | GPIO49_nPWE, |
| 102 | GPIO50_nPIOR, |
| 103 | GPIO51_nPIOW, |
| 104 | GPIO52_nPCE_1, |
| 105 | GPIO53_nPCE_2, |
| 106 | GPIO54_nPSKTSEL, |
| 107 | GPIO55_nPREG, |
| 108 | GPIO56_nPWAIT, |
| 109 | GPIO57_nIOIS16, |
| 110 | |
| 111 | /* AC97 */ |
| 112 | GPIO31_AC97_SYNC, |
| 113 | GPIO30_AC97_SDATA_OUT, |
| 114 | GPIO28_AC97_BITCLK, |
| 115 | GPIO29_AC97_SDATA_IN_0, |
| 116 | // GPIO79 nAUD_IRQ |
| 117 | |
| 118 | /* FFUART */ |
| 119 | GPIO34_FFUART_RXD, |
| 120 | GPIO35_FFUART_CTS, |
| 121 | GPIO37_FFUART_DSR, |
| 122 | GPIO39_FFUART_TXD, |
| 123 | GPIO40_FFUART_DTR, |
| 124 | GPIO41_FFUART_RTS, |
| 125 | |
| 126 | /* BTUART */ |
| 127 | GPIO42_BTUART_RXD, |
| 128 | GPIO43_BTUART_TXD, |
| 129 | GPIO44_BTUART_CTS, |
| 130 | GPIO45_BTUART_RTS, |
| 131 | |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 132 | /* Keybd */ |
eric miao | c867155 | 2008-05-26 03:28:50 +0100 | [diff] [blame] | 133 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, |
| 134 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, |
| 135 | GPIO60_GPIO | MFP_LPM_DRIVE_LOW, |
| 136 | GPIO61_GPIO | MFP_LPM_DRIVE_LOW, |
| 137 | GPIO62_GPIO | MFP_LPM_DRIVE_LOW, |
| 138 | GPIO63_GPIO | MFP_LPM_DRIVE_LOW, |
| 139 | GPIO64_GPIO | MFP_LPM_DRIVE_LOW, |
| 140 | GPIO65_GPIO | MFP_LPM_DRIVE_LOW, |
| 141 | GPIO66_GPIO | MFP_LPM_DRIVE_LOW, |
| 142 | GPIO67_GPIO | MFP_LPM_DRIVE_LOW, |
| 143 | GPIO68_GPIO | MFP_LPM_DRIVE_LOW, |
| 144 | GPIO69_GPIO | MFP_LPM_DRIVE_LOW, |
| 145 | GPIO70_GPIO | MFP_LPM_DRIVE_LOW, |
| 146 | GPIO71_GPIO | MFP_LPM_DRIVE_LOW, |
| 147 | GPIO72_GPIO | MFP_LPM_DRIVE_LOW, |
| 148 | GPIO73_GPIO | MFP_LPM_DRIVE_LOW, |
| 149 | GPIO74_GPIO | MFP_LPM_DRIVE_LOW, |
| 150 | GPIO75_GPIO | MFP_LPM_DRIVE_LOW, |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 151 | |
| 152 | /* SPI */ |
| 153 | GPIO81_SSP2_CLK_OUT, |
| 154 | GPIO82_SSP2_FRM_OUT, |
| 155 | GPIO83_SSP2_TXD, |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 156 | |
Dmitry Baryshkov | 0fc3ff3 | 2008-07-02 13:54:46 +0100 | [diff] [blame] | 157 | /* IrDA is managed in other way */ |
| 158 | GPIO46_GPIO, |
| 159 | GPIO47_GPIO, |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 160 | }; |
| 161 | |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 162 | /* |
| 163 | * SCOOP Device |
| 164 | */ |
| 165 | static struct resource tosa_scoop_resources[] = { |
| 166 | [0] = { |
| 167 | .start = TOSA_CF_PHYS, |
| 168 | .end = TOSA_CF_PHYS + 0xfff, |
| 169 | .flags = IORESOURCE_MEM, |
| 170 | }, |
| 171 | }; |
| 172 | |
| 173 | static struct scoop_config tosa_scoop_setup = { |
| 174 | .io_dir = TOSA_SCOOP_IO_DIR, |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 175 | .gpio_base = TOSA_SCOOP_GPIO_BASE, |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 176 | }; |
| 177 | |
Dmitry Baryshkov | ba4eb7e | 2008-04-19 10:42:25 +0100 | [diff] [blame] | 178 | static struct platform_device tosascoop_device = { |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 179 | .name = "sharp-scoop", |
| 180 | .id = 0, |
| 181 | .dev = { |
| 182 | .platform_data = &tosa_scoop_setup, |
| 183 | }, |
| 184 | .num_resources = ARRAY_SIZE(tosa_scoop_resources), |
| 185 | .resource = tosa_scoop_resources, |
| 186 | }; |
| 187 | |
| 188 | |
| 189 | /* |
| 190 | * SCOOP Device Jacket |
| 191 | */ |
| 192 | static struct resource tosa_scoop_jc_resources[] = { |
| 193 | [0] = { |
| 194 | .start = TOSA_SCOOP_PHYS + 0x40, |
| 195 | .end = TOSA_SCOOP_PHYS + 0xfff, |
| 196 | .flags = IORESOURCE_MEM, |
| 197 | }, |
| 198 | }; |
| 199 | |
| 200 | static struct scoop_config tosa_scoop_jc_setup = { |
| 201 | .io_dir = TOSA_SCOOP_JC_IO_DIR, |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 202 | .gpio_base = TOSA_SCOOP_JC_GPIO_BASE, |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 203 | }; |
| 204 | |
Dmitry Baryshkov | ba4eb7e | 2008-04-19 10:42:25 +0100 | [diff] [blame] | 205 | static struct platform_device tosascoop_jc_device = { |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 206 | .name = "sharp-scoop", |
| 207 | .id = 1, |
| 208 | .dev = { |
| 209 | .platform_data = &tosa_scoop_jc_setup, |
| 210 | .parent = &tosascoop_device.dev, |
| 211 | }, |
| 212 | .num_resources = ARRAY_SIZE(tosa_scoop_jc_resources), |
| 213 | .resource = tosa_scoop_jc_resources, |
| 214 | }; |
| 215 | |
Dirk Opfer | 4c18ad2 | 2005-11-08 19:15:50 +0000 | [diff] [blame] | 216 | /* |
| 217 | * PCMCIA |
| 218 | */ |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 219 | static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { |
| 220 | { |
| 221 | .dev = &tosascoop_device.dev, |
| 222 | .irq = TOSA_IRQ_GPIO_CF_IRQ, |
| 223 | .cd_irq = TOSA_IRQ_GPIO_CF_CD, |
| 224 | .cd_irq_str = "PCMCIA0 CD", |
| 225 | },{ |
| 226 | .dev = &tosascoop_jc_device.dev, |
| 227 | .irq = TOSA_IRQ_GPIO_JC_CF_IRQ, |
| 228 | .cd_irq = -1, |
| 229 | }, |
| 230 | }; |
| 231 | |
Dirk Opfer | 4c18ad2 | 2005-11-08 19:15:50 +0000 | [diff] [blame] | 232 | static struct scoop_pcmcia_config tosa_pcmcia_config = { |
| 233 | .devs = &tosa_pcmcia_scoop[0], |
| 234 | .num_devs = 2, |
Dirk Opfer | 4c18ad2 | 2005-11-08 19:15:50 +0000 | [diff] [blame] | 235 | }; |
| 236 | |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 237 | /* |
| 238 | * USB Device Controller |
| 239 | */ |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 240 | static struct pxa2xx_udc_mach_info udc_info __initdata = { |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 241 | .gpio_pullup = TOSA_GPIO_USB_PULLUP, |
Dmitry Baryshkov | 487dc92 | 2007-12-21 12:18:01 +0300 | [diff] [blame] | 242 | .gpio_vbus = TOSA_GPIO_USB_IN, |
| 243 | .gpio_vbus_inverted = 1, |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 244 | }; |
| 245 | |
| 246 | /* |
| 247 | * MMC/SD Device |
| 248 | */ |
| 249 | static struct pxamci_platform_data tosa_mci_platform_data; |
| 250 | |
David Howells | 40220c1 | 2006-10-09 12:19:47 +0100 | [diff] [blame] | 251 | static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data) |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 252 | { |
| 253 | int err; |
| 254 | |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 255 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
| 256 | |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 257 | err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect"); |
| 258 | if (err) { |
| 259 | printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n"); |
| 260 | goto err_gpio_detect; |
| 261 | } |
| 262 | err = gpio_direction_input(TOSA_GPIO_nSD_DETECT); |
| 263 | if (err) |
| 264 | goto err_gpio_detect_dir; |
| 265 | |
Russell King | 2687bd3 | 2008-01-23 14:05:58 +0000 | [diff] [blame] | 266 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, |
| 267 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 268 | "MMC/SD card detect", data); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 269 | if (err) { |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 270 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 271 | goto err_irq; |
| 272 | } |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 273 | |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 274 | err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect"); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 275 | if (err) { |
| 276 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); |
| 277 | goto err_gpio_wp; |
| 278 | } |
| 279 | err = gpio_direction_input(TOSA_GPIO_SD_WP); |
| 280 | if (err) |
| 281 | goto err_gpio_wp_dir; |
| 282 | |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 283 | err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power"); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 284 | if (err) { |
| 285 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); |
| 286 | goto err_gpio_pwr; |
| 287 | } |
| 288 | err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0); |
| 289 | if (err) |
| 290 | goto err_gpio_pwr_dir; |
| 291 | |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 292 | err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int"); |
| 293 | if (err) { |
| 294 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); |
| 295 | goto err_gpio_int; |
| 296 | } |
| 297 | err = gpio_direction_input(TOSA_GPIO_nSD_INT); |
| 298 | if (err) |
| 299 | goto err_gpio_int_dir; |
| 300 | |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 301 | return 0; |
| 302 | |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 303 | err_gpio_int_dir: |
| 304 | gpio_free(TOSA_GPIO_nSD_INT); |
| 305 | err_gpio_int: |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 306 | err_gpio_pwr_dir: |
| 307 | gpio_free(TOSA_GPIO_PWR_ON); |
| 308 | err_gpio_pwr: |
| 309 | err_gpio_wp_dir: |
| 310 | gpio_free(TOSA_GPIO_SD_WP); |
| 311 | err_gpio_wp: |
| 312 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
| 313 | err_irq: |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 314 | err_gpio_detect_dir: |
| 315 | gpio_free(TOSA_GPIO_nSD_DETECT); |
| 316 | err_gpio_detect: |
Russell King | 2687bd3 | 2008-01-23 14:05:58 +0000 | [diff] [blame] | 317 | return err; |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | static void tosa_mci_setpower(struct device *dev, unsigned int vdd) |
| 321 | { |
| 322 | struct pxamci_platform_data* p_d = dev->platform_data; |
| 323 | |
| 324 | if (( 1 << vdd) & p_d->ocr_mask) { |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 325 | gpio_set_value(TOSA_GPIO_PWR_ON, 1); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 326 | } else { |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 327 | gpio_set_value(TOSA_GPIO_PWR_ON, 0); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 328 | } |
| 329 | } |
| 330 | |
| 331 | static int tosa_mci_get_ro(struct device *dev) |
| 332 | { |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 333 | return gpio_get_value(TOSA_GPIO_SD_WP); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | static void tosa_mci_exit(struct device *dev, void *data) |
| 337 | { |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 338 | gpio_free(TOSA_GPIO_nSD_INT); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 339 | gpio_free(TOSA_GPIO_PWR_ON); |
| 340 | gpio_free(TOSA_GPIO_SD_WP); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 341 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
Dmitry Baryshkov | c4d5f8d | 2008-06-09 13:23:50 +0100 | [diff] [blame] | 342 | gpio_free(TOSA_GPIO_nSD_DETECT); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | static struct pxamci_platform_data tosa_mci_platform_data = { |
| 346 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 347 | .init = tosa_mci_init, |
| 348 | .get_ro = tosa_mci_get_ro, |
| 349 | .setpower = tosa_mci_setpower, |
| 350 | .exit = tosa_mci_exit, |
| 351 | }; |
| 352 | |
| 353 | /* |
| 354 | * Irda |
| 355 | */ |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 356 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) |
| 357 | { |
| 358 | if (mode & IR_OFF) { |
| 359 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0); |
Dmitry Baryshkov | 0fc3ff3 | 2008-07-02 13:54:46 +0100 | [diff] [blame] | 360 | pxa2xx_transceiver_mode(dev, mode); |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 361 | gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); |
| 362 | } else { |
Dmitry Baryshkov | 0fc3ff3 | 2008-07-02 13:54:46 +0100 | [diff] [blame] | 363 | pxa2xx_transceiver_mode(dev, mode); |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 364 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1); |
| 365 | } |
| 366 | } |
| 367 | |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 368 | static int tosa_irda_startup(struct device *dev) |
| 369 | { |
| 370 | int ret; |
| 371 | |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 372 | ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX"); |
| 373 | if (ret) |
| 374 | goto err_tx; |
| 375 | ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); |
| 376 | if (ret) |
| 377 | goto err_tx_dir; |
| 378 | |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 379 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); |
| 380 | if (ret) |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 381 | goto err_pwr; |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 382 | |
| 383 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); |
| 384 | if (ret) |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 385 | goto err_pwr_dir; |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 386 | |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 387 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
| 388 | |
| 389 | return 0; |
| 390 | |
| 391 | err_pwr_dir: |
| 392 | gpio_free(TOSA_GPIO_IR_POWERDWN); |
| 393 | err_pwr: |
| 394 | err_tx_dir: |
| 395 | gpio_free(TOSA_GPIO_IRDA_TX); |
| 396 | err_tx: |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 397 | return ret; |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 398 | } |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 399 | |
| 400 | static void tosa_irda_shutdown(struct device *dev) |
| 401 | { |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 402 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 403 | gpio_free(TOSA_GPIO_IR_POWERDWN); |
Dmitry Baryshkov | b032fcc | 2008-06-12 11:42:07 +0100 | [diff] [blame] | 404 | gpio_free(TOSA_GPIO_IRDA_TX); |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | static struct pxaficp_platform_data tosa_ficp_platform_data = { |
| 408 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
| 409 | .transceiver_mode = tosa_irda_transceiver_mode, |
Dmitry Baryshkov | d4e7d09 | 2008-04-12 20:16:16 +0100 | [diff] [blame] | 410 | .startup = tosa_irda_startup, |
| 411 | .shutdown = tosa_irda_shutdown, |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 412 | }; |
| 413 | |
| 414 | /* |
Dmitry Baryshkov | 53b14ea | 2008-06-14 11:43:36 +0100 | [diff] [blame] | 415 | * Tosa AC IN |
| 416 | */ |
| 417 | static int tosa_power_init(struct device *dev) |
| 418 | { |
| 419 | int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in"); |
| 420 | if (ret) |
| 421 | goto err_gpio_req; |
| 422 | |
| 423 | ret = gpio_direction_input(TOSA_GPIO_AC_IN); |
| 424 | if (ret) |
| 425 | goto err_gpio_in; |
| 426 | |
| 427 | return 0; |
| 428 | |
| 429 | err_gpio_in: |
| 430 | gpio_free(TOSA_GPIO_AC_IN); |
| 431 | err_gpio_req: |
| 432 | return ret; |
| 433 | } |
| 434 | |
| 435 | static void tosa_power_exit(struct device *dev) |
| 436 | { |
| 437 | gpio_free(TOSA_GPIO_AC_IN); |
| 438 | } |
| 439 | |
| 440 | static int tosa_power_ac_online(void) |
| 441 | { |
| 442 | return gpio_get_value(TOSA_GPIO_AC_IN) == 0; |
| 443 | } |
| 444 | |
| 445 | static char *tosa_ac_supplied_to[] = { |
| 446 | "main-battery", |
| 447 | "backup-battery", |
| 448 | "jacket-battery", |
| 449 | }; |
| 450 | |
| 451 | static struct pda_power_pdata tosa_power_data = { |
| 452 | .init = tosa_power_init, |
| 453 | .is_ac_online = tosa_power_ac_online, |
| 454 | .exit = tosa_power_exit, |
| 455 | .supplied_to = tosa_ac_supplied_to, |
| 456 | .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to), |
| 457 | }; |
| 458 | |
| 459 | static struct resource tosa_power_resource[] = { |
| 460 | { |
| 461 | .name = "ac", |
| 462 | .start = gpio_to_irq(TOSA_GPIO_AC_IN), |
| 463 | .end = gpio_to_irq(TOSA_GPIO_AC_IN), |
| 464 | .flags = IORESOURCE_IRQ | |
| 465 | IORESOURCE_IRQ_HIGHEDGE | |
| 466 | IORESOURCE_IRQ_LOWEDGE, |
| 467 | }, |
| 468 | }; |
| 469 | |
| 470 | static struct platform_device tosa_power_device = { |
| 471 | .name = "pda-power", |
| 472 | .id = -1, |
| 473 | .dev.platform_data = &tosa_power_data, |
| 474 | .resource = tosa_power_resource, |
| 475 | .num_resources = ARRAY_SIZE(tosa_power_resource), |
| 476 | }; |
| 477 | |
| 478 | /* |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 479 | * Tosa Keyboard |
| 480 | */ |
| 481 | static struct platform_device tosakbd_device = { |
| 482 | .name = "tosa-keyboard", |
| 483 | .id = -1, |
| 484 | }; |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 485 | |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 486 | static struct gpio_keys_button tosa_gpio_keys[] = { |
Dmitry Baryshkov | 0aa9756 | 2008-04-12 20:02:50 +0100 | [diff] [blame] | 487 | /* |
| 488 | * Two following keys are directly tied to "ON" button of tosa. Why? |
| 489 | * The first one can be used as a wakeup source, the second can't; |
| 490 | * also the first one is OR of ac_powered and on_button. |
| 491 | */ |
| 492 | { |
| 493 | .type = EV_PWR, |
| 494 | .code = KEY_RESERVED, |
| 495 | .gpio = TOSA_GPIO_POWERON, |
| 496 | .desc = "Poweron", |
| 497 | .wakeup = 1, |
| 498 | .active_low = 1, |
| 499 | }, |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 500 | { |
| 501 | .type = EV_PWR, |
| 502 | .code = KEY_SUSPEND, |
| 503 | .gpio = TOSA_GPIO_ON_KEY, |
| 504 | .desc = "On key", |
Dmitry Baryshkov | 0aa9756 | 2008-04-12 20:02:50 +0100 | [diff] [blame] | 505 | /* |
| 506 | * can't be used as wakeup |
| 507 | * .wakeup = 1, |
| 508 | */ |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 509 | .active_low = 1, |
| 510 | }, |
| 511 | { |
| 512 | .type = EV_KEY, |
| 513 | .code = TOSA_KEY_RECORD, |
| 514 | .gpio = TOSA_GPIO_RECORD_BTN, |
| 515 | .desc = "Record Button", |
| 516 | .wakeup = 1, |
| 517 | .active_low = 1, |
| 518 | }, |
| 519 | { |
| 520 | .type = EV_KEY, |
| 521 | .code = TOSA_KEY_SYNC, |
| 522 | .gpio = TOSA_GPIO_SYNC, |
| 523 | .desc = "Sync Button", |
| 524 | .wakeup = 1, |
| 525 | .active_low = 1, |
| 526 | }, |
Dmitry Baryshkov | c33de47 | 2008-09-11 01:28:51 +0100 | [diff] [blame] | 527 | { |
| 528 | .type = EV_SW, |
| 529 | .code = SW_HEADPHONE_INSERT, |
| 530 | .gpio = TOSA_GPIO_EAR_IN, |
| 531 | .desc = "HeadPhone insert", |
| 532 | .active_low = 1, |
| 533 | .debounce_interval = 300, |
| 534 | }, |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 535 | }; |
| 536 | |
| 537 | static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = { |
| 538 | .buttons = tosa_gpio_keys, |
| 539 | .nbuttons = ARRAY_SIZE(tosa_gpio_keys), |
| 540 | }; |
| 541 | |
| 542 | static struct platform_device tosa_gpio_keys_device = { |
| 543 | .name = "gpio-keys", |
| 544 | .id = -1, |
| 545 | .dev = { |
| 546 | .platform_data = &tosa_gpio_keys_platform_data, |
| 547 | }, |
| 548 | }; |
| 549 | |
Dirk Opfer | 6d0cf3e | 2006-03-31 02:31:12 -0800 | [diff] [blame] | 550 | /* |
| 551 | * Tosa LEDs |
| 552 | */ |
Dmitry Baryshkov | ba4eb7e | 2008-04-19 10:42:25 +0100 | [diff] [blame] | 553 | static struct gpio_led tosa_gpio_leds[] = { |
Dmitry Baryshkov | 311c736 | 2008-04-12 20:17:02 +0100 | [diff] [blame] | 554 | { |
| 555 | .name = "tosa:amber:charge", |
| 556 | .default_trigger = "main-battery-charging", |
| 557 | .gpio = TOSA_GPIO_CHRG_ERR_LED, |
| 558 | }, |
| 559 | { |
| 560 | .name = "tosa:green:mail", |
| 561 | .default_trigger = "nand-disk", |
| 562 | .gpio = TOSA_GPIO_NOTE_LED, |
| 563 | }, |
Dmitry Baryshkov | c546106 | 2008-04-19 10:42:06 +0100 | [diff] [blame] | 564 | { |
| 565 | .name = "tosa:dual:wlan", |
| 566 | .default_trigger = "none", |
| 567 | .gpio = TOSA_GPIO_WLAN_LED, |
| 568 | }, |
| 569 | { |
| 570 | .name = "tosa:blue:bluetooth", |
Dmitry Baryshkov | 16b32fd | 2008-07-05 09:02:48 +0100 | [diff] [blame] | 571 | .default_trigger = "tosa-bt", |
Dmitry Baryshkov | c546106 | 2008-04-19 10:42:06 +0100 | [diff] [blame] | 572 | .gpio = TOSA_GPIO_BT_LED, |
| 573 | }, |
Dmitry Baryshkov | 311c736 | 2008-04-12 20:17:02 +0100 | [diff] [blame] | 574 | }; |
| 575 | |
Dmitry Baryshkov | ba4eb7e | 2008-04-19 10:42:25 +0100 | [diff] [blame] | 576 | static struct gpio_led_platform_data tosa_gpio_leds_platform_data = { |
Dmitry Baryshkov | 311c736 | 2008-04-12 20:17:02 +0100 | [diff] [blame] | 577 | .leds = tosa_gpio_leds, |
| 578 | .num_leds = ARRAY_SIZE(tosa_gpio_leds), |
| 579 | }; |
| 580 | |
Dirk Opfer | 6d0cf3e | 2006-03-31 02:31:12 -0800 | [diff] [blame] | 581 | static struct platform_device tosaled_device = { |
Dmitry Baryshkov | 311c736 | 2008-04-12 20:17:02 +0100 | [diff] [blame] | 582 | .name = "leds-gpio", |
| 583 | .id = -1, |
| 584 | .dev = { |
| 585 | .platform_data = &tosa_gpio_leds_platform_data, |
| 586 | }, |
Dirk Opfer | 6d0cf3e | 2006-03-31 02:31:12 -0800 | [diff] [blame] | 587 | }; |
| 588 | |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 589 | /* |
| 590 | * Toshiba Mobile IO Controller |
| 591 | */ |
| 592 | static struct resource tc6393xb_resources[] = { |
| 593 | [0] = { |
| 594 | .start = TOSA_LCDC_PHYS, |
| 595 | .end = TOSA_LCDC_PHYS + 0x3ffffff, |
| 596 | .flags = IORESOURCE_MEM, |
| 597 | }, |
| 598 | |
| 599 | [1] = { |
| 600 | .start = TOSA_IRQ_GPIO_TC6393XB_INT, |
| 601 | .end = TOSA_IRQ_GPIO_TC6393XB_INT, |
| 602 | .flags = IORESOURCE_IRQ, |
| 603 | }, |
| 604 | }; |
| 605 | |
| 606 | |
| 607 | static int tosa_tc6393xb_enable(struct platform_device *dev) |
| 608 | { |
| 609 | int rc; |
| 610 | |
| 611 | rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr"); |
| 612 | if (rc) |
| 613 | goto err_req_pclr; |
| 614 | rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend"); |
| 615 | if (rc) |
| 616 | goto err_req_suspend; |
Dmitry Baryshkov | 14b7b40 | 2008-09-13 21:06:41 +0400 | [diff] [blame] | 617 | rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "tc6393xb l3v"); |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 618 | if (rc) |
| 619 | goto err_req_l3v; |
| 620 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0); |
| 621 | if (rc) |
| 622 | goto err_dir_l3v; |
| 623 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0); |
| 624 | if (rc) |
| 625 | goto err_dir_suspend; |
| 626 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0); |
| 627 | if (rc) |
| 628 | goto err_dir_pclr; |
| 629 | |
| 630 | mdelay(1); |
| 631 | |
| 632 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); |
| 633 | |
| 634 | mdelay(10); |
| 635 | |
| 636 | gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1); |
| 637 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); |
| 638 | |
| 639 | return 0; |
| 640 | err_dir_pclr: |
| 641 | err_dir_suspend: |
| 642 | err_dir_l3v: |
| 643 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); |
| 644 | err_req_l3v: |
| 645 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); |
| 646 | err_req_suspend: |
| 647 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); |
| 648 | err_req_pclr: |
| 649 | return rc; |
| 650 | } |
| 651 | |
| 652 | static int tosa_tc6393xb_disable(struct platform_device *dev) |
| 653 | { |
| 654 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); |
| 655 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); |
| 656 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); |
| 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | static int tosa_tc6393xb_resume(struct platform_device *dev) |
| 662 | { |
| 663 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); |
| 664 | mdelay(10); |
| 665 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); |
| 666 | mdelay(10); |
| 667 | |
| 668 | return 0; |
| 669 | } |
| 670 | |
| 671 | static int tosa_tc6393xb_suspend(struct platform_device *dev) |
| 672 | { |
| 673 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0); |
| 674 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0); |
| 675 | return 0; |
| 676 | } |
| 677 | |
Dmitry Baryshkov | 5289fec | 2008-06-27 10:38:44 +0100 | [diff] [blame] | 678 | static struct mtd_partition tosa_nand_partition[] = { |
| 679 | { |
| 680 | .name = "smf", |
| 681 | .offset = 0, |
| 682 | .size = 7 * 1024 * 1024, |
| 683 | }, |
| 684 | { |
| 685 | .name = "root", |
| 686 | .offset = MTDPART_OFS_APPEND, |
| 687 | .size = 28 * 1024 * 1024, |
| 688 | }, |
| 689 | { |
| 690 | .name = "home", |
| 691 | .offset = MTDPART_OFS_APPEND, |
| 692 | .size = MTDPART_SIZ_FULL, |
| 693 | }, |
| 694 | }; |
| 695 | |
| 696 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; |
| 697 | |
| 698 | static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = { |
| 699 | .options = 0, |
| 700 | .offs = 4, |
| 701 | .len = 2, |
| 702 | .pattern = scan_ff_pattern |
| 703 | }; |
| 704 | |
| 705 | static struct tmio_nand_data tosa_tc6393xb_nand_config = { |
| 706 | .num_partitions = ARRAY_SIZE(tosa_nand_partition), |
| 707 | .partition = tosa_nand_partition, |
| 708 | .badblock_pattern = &tosa_tc6393xb_nand_bbt, |
| 709 | }; |
| 710 | |
Dmitry Baryshkov | 1c1b6ff | 2008-09-24 23:36:23 +0200 | [diff] [blame] | 711 | static int tosa_tc6393xb_setup(struct platform_device *dev) |
| 712 | { |
| 713 | int rc; |
| 714 | |
| 715 | rc = gpio_request(TOSA_GPIO_CARD_VCC_ON, "CARD_VCC_ON"); |
| 716 | if (rc) |
| 717 | goto err_req; |
| 718 | |
| 719 | rc = gpio_direction_output(TOSA_GPIO_CARD_VCC_ON, 1); |
| 720 | if (rc) |
| 721 | goto err_dir; |
| 722 | |
| 723 | return rc; |
| 724 | |
| 725 | err_dir: |
| 726 | gpio_free(TOSA_GPIO_CARD_VCC_ON); |
| 727 | err_req: |
| 728 | return rc; |
| 729 | } |
| 730 | |
| 731 | static void tosa_tc6393xb_teardown(struct platform_device *dev) |
| 732 | { |
| 733 | gpio_free(TOSA_GPIO_CARD_VCC_ON); |
| 734 | } |
| 735 | |
Dmitry Baryshkov | 31c9b28 | 2008-10-28 18:40:37 +0300 | [diff] [blame^] | 736 | static struct fb_videomode tosa_tc6393xb_lcd_mode[] = { |
| 737 | { |
| 738 | .xres = 480, |
| 739 | .yres = 640, |
| 740 | .pixclock = 0x002cdf00,/* PLL divisor */ |
| 741 | .left_margin = 0x004c, |
| 742 | .right_margin = 0x005b, |
| 743 | .upper_margin = 0x0001, |
| 744 | .lower_margin = 0x000d, |
| 745 | .hsync_len = 0x0002, |
| 746 | .vsync_len = 0x0001, |
| 747 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 748 | .vmode = FB_VMODE_NONINTERLACED, |
| 749 | },{ |
| 750 | .xres = 240, |
| 751 | .yres = 320, |
| 752 | .pixclock = 0x00e7f203,/* PLL divisor */ |
| 753 | .left_margin = 0x0024, |
| 754 | .right_margin = 0x002f, |
| 755 | .upper_margin = 0x0001, |
| 756 | .lower_margin = 0x000d, |
| 757 | .hsync_len = 0x0002, |
| 758 | .vsync_len = 0x0001, |
| 759 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 760 | .vmode = FB_VMODE_NONINTERLACED, |
| 761 | } |
| 762 | }; |
| 763 | |
| 764 | static struct tmio_fb_data tosa_tc6393xb_fb_config = { |
| 765 | .lcd_set_power = tc6393xb_lcd_set_power, |
| 766 | .lcd_mode = tc6393xb_lcd_mode, |
| 767 | .num_modes = ARRAY_SIZE(tosa_tc6393xb_lcd_mode), |
| 768 | .modes = &tosa_tc6393xb_lcd_mode[0], |
| 769 | .height = 82, |
| 770 | .width = 60, |
| 771 | }; |
| 772 | |
Dmitry Baryshkov | 1c1b6ff | 2008-09-24 23:36:23 +0200 | [diff] [blame] | 773 | static struct tc6393xb_platform_data tosa_tc6393xb_data = { |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 774 | .scr_pll2cr = 0x0cc1, |
| 775 | .scr_gper = 0x3300, |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 776 | |
| 777 | .irq_base = IRQ_BOARD_START, |
| 778 | .gpio_base = TOSA_TC6393XB_GPIO_BASE, |
Dmitry Baryshkov | 1c1b6ff | 2008-09-24 23:36:23 +0200 | [diff] [blame] | 779 | .setup = tosa_tc6393xb_setup, |
| 780 | .teardown = tosa_tc6393xb_teardown, |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 781 | |
| 782 | .enable = tosa_tc6393xb_enable, |
| 783 | .disable = tosa_tc6393xb_disable, |
| 784 | .suspend = tosa_tc6393xb_suspend, |
| 785 | .resume = tosa_tc6393xb_resume, |
Dmitry Baryshkov | 5289fec | 2008-06-27 10:38:44 +0100 | [diff] [blame] | 786 | |
| 787 | .nand_data = &tosa_tc6393xb_nand_config, |
Dmitry Baryshkov | 31c9b28 | 2008-10-28 18:40:37 +0300 | [diff] [blame^] | 788 | .fb_data = &tosa_tc6393xb_fb_config, |
Dmitry Baryshkov | f98a0bd | 2008-09-24 23:46:10 +0200 | [diff] [blame] | 789 | |
| 790 | .resume_restore = 1, |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 791 | }; |
| 792 | |
| 793 | |
| 794 | static struct platform_device tc6393xb_device = { |
| 795 | .name = "tc6393xb", |
| 796 | .id = -1, |
| 797 | .dev = { |
Dmitry Baryshkov | 1c1b6ff | 2008-09-24 23:36:23 +0200 | [diff] [blame] | 798 | .platform_data = &tosa_tc6393xb_data, |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 799 | }, |
| 800 | .num_resources = ARRAY_SIZE(tc6393xb_resources), |
| 801 | .resource = tc6393xb_resources, |
| 802 | }; |
| 803 | |
Dmitry Baryshkov | 16b32fd | 2008-07-05 09:02:48 +0100 | [diff] [blame] | 804 | static struct tosa_bt_data tosa_bt_data = { |
| 805 | .gpio_pwr = TOSA_GPIO_BT_PWR_EN, |
| 806 | .gpio_reset = TOSA_GPIO_BT_RESET, |
| 807 | }; |
| 808 | |
| 809 | static struct platform_device tosa_bt_device = { |
| 810 | .name = "tosa-bt", |
| 811 | .id = -1, |
| 812 | .dev.platform_data = &tosa_bt_data, |
| 813 | }; |
| 814 | |
Dmitry Baryshkov | 14b7b40 | 2008-09-13 21:06:41 +0400 | [diff] [blame] | 815 | static struct pxa2xx_spi_master pxa_ssp_master_info = { |
| 816 | .num_chipselect = 1, |
| 817 | }; |
| 818 | |
| 819 | static struct spi_board_info spi_board_info[] __initdata = { |
| 820 | { |
| 821 | .modalias = "tosa-lcd", |
| 822 | // .platform_data |
| 823 | .max_speed_hz = 28750, |
| 824 | .bus_num = 2, |
| 825 | .chip_select = 0, |
| 826 | .mode = SPI_MODE_0, |
| 827 | }, |
| 828 | }; |
Dmitry Baryshkov | 16b32fd | 2008-07-05 09:02:48 +0100 | [diff] [blame] | 829 | |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 830 | static struct platform_device *devices[] __initdata = { |
| 831 | &tosascoop_device, |
| 832 | &tosascoop_jc_device, |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 833 | &tc6393xb_device, |
Dmitry Baryshkov | 53b14ea | 2008-06-14 11:43:36 +0100 | [diff] [blame] | 834 | &tosa_power_device, |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 835 | &tosakbd_device, |
Dmitry Baryshkov | 93e9012 | 2008-01-21 01:04:20 -0500 | [diff] [blame] | 836 | &tosa_gpio_keys_device, |
Dirk Opfer | 6d0cf3e | 2006-03-31 02:31:12 -0800 | [diff] [blame] | 837 | &tosaled_device, |
Dmitry Baryshkov | 16b32fd | 2008-07-05 09:02:48 +0100 | [diff] [blame] | 838 | &tosa_bt_device, |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 839 | }; |
| 840 | |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 841 | static void tosa_poweroff(void) |
| 842 | { |
Dmitry Baryshkov | 86159a9 | 2008-05-22 16:21:48 +0100 | [diff] [blame] | 843 | arm_machine_restart('g'); |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 844 | } |
| 845 | |
| 846 | static void tosa_restart(char mode) |
| 847 | { |
| 848 | /* Bootloader magic for a reboot */ |
| 849 | if((MSC0 & 0xffff0000) == 0x7ff00000) |
| 850 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; |
| 851 | |
| 852 | tosa_poweroff(); |
| 853 | } |
| 854 | |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 855 | static void __init tosa_init(void) |
| 856 | { |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 857 | int dummy; |
| 858 | |
Dmitry Baryshkov | 2cb4734 | 2008-04-10 11:00:32 +0100 | [diff] [blame] | 859 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); |
| 860 | gpio_set_wake(MFP_PIN_GPIO1, 1); |
| 861 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ |
| 862 | |
Dmitry Baryshkov | 69fc7ee | 2008-10-09 16:58:13 +0100 | [diff] [blame] | 863 | init_gpio_reset(TOSA_GPIO_ON_RESET, 0); |
Dmitry Baryshkov | 86159a9 | 2008-05-22 16:21:48 +0100 | [diff] [blame] | 864 | |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 865 | pm_power_off = tosa_poweroff; |
| 866 | arm_pm_restart = tosa_restart; |
| 867 | |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 868 | PCFR |= PCFR_OPDE; |
| 869 | |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 870 | /* enable batt_fault */ |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 871 | PMCR = 0x01; |
| 872 | |
Dmitry Baryshkov | bf0116e | 2008-06-14 11:42:02 +0100 | [diff] [blame] | 873 | dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12); |
| 874 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); |
| 875 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); |
| 876 | |
Dirk Opfer | a93876c | 2005-11-08 19:15:30 +0000 | [diff] [blame] | 877 | pxa_set_mci_info(&tosa_mci_platform_data); |
| 878 | pxa_set_udc_info(&udc_info); |
| 879 | pxa_set_ficp_info(&tosa_ficp_platform_data); |
Dmitry Baryshkov | 481ea5a | 2008-04-10 15:43:18 +0100 | [diff] [blame] | 880 | pxa_set_i2c_info(NULL); |
Dirk Opfer | 4c18ad2 | 2005-11-08 19:15:50 +0000 | [diff] [blame] | 881 | platform_scoop_config = &tosa_pcmcia_config; |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 882 | |
Dmitry Baryshkov | 14b7b40 | 2008-09-13 21:06:41 +0400 | [diff] [blame] | 883 | pxa2xx_set_spi_info(2, &pxa_ssp_master_info); |
| 884 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 885 | |
Dmitry Baryshkov | 7bdb22c | 2008-09-10 10:30:37 +0100 | [diff] [blame] | 886 | clk_add_alias("CLK_CK3P6MI", &tc6393xb_device.dev, "GPIO11_CLK", NULL); |
| 887 | |
Dirk Opfer | 4c18ad2 | 2005-11-08 19:15:50 +0000 | [diff] [blame] | 888 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | static void __init fixup_tosa(struct machine_desc *desc, |
| 892 | struct tag *tags, char **cmdline, struct meminfo *mi) |
| 893 | { |
| 894 | sharpsl_save_param(); |
| 895 | mi->nr_banks=1; |
| 896 | mi->bank[0].start = 0xa0000000; |
| 897 | mi->bank[0].node = 0; |
| 898 | mi->bank[0].size = (64*1024*1024); |
| 899 | } |
| 900 | |
| 901 | MACHINE_START(TOSA, "SHARP Tosa") |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 902 | .phys_io = 0x40000000, |
| 903 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 904 | .fixup = fixup_tosa, |
| 905 | .map_io = pxa_map_io, |
Eric Miao | cd49104 | 2007-06-22 04:14:09 +0100 | [diff] [blame] | 906 | .init_irq = pxa25x_init_irq, |
Dirk Opfer | 8459c15 | 2005-11-06 14:27:52 +0000 | [diff] [blame] | 907 | .init_machine = tosa_init, |
| 908 | .timer = &pxa_timer, |
| 909 | MACHINE_END |