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