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