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