Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Support for Sharp SL-Cxx00 Series of PDAs |
| 3 | * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi) |
| 4 | * |
| 5 | * Copyright (c) 2005 Richard Purdie |
| 6 | * |
| 7 | * Based on Sharp's 2.4 kernel patches/lubbock.c |
| 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> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 16 | #include <linux/platform_device.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 17 | #include <linux/delay.h> |
Stanislav Brabec | f6919eb | 2009-10-16 20:50:05 +0200 | [diff] [blame] | 18 | #include <linux/gpio_keys.h> |
Eric Miao | dd5980d | 2008-09-02 17:34:33 +0800 | [diff] [blame] | 19 | #include <linux/gpio.h> |
Eric Miao | 4fe3224 | 2008-09-05 22:38:23 +0800 | [diff] [blame] | 20 | #include <linux/leds.h> |
Dmitry Baryshkov | e5d3bf3 | 2008-11-25 00:57:28 +0300 | [diff] [blame] | 21 | #include <linux/mtd/physmap.h> |
Eric Miao | f72de66 | 2008-09-06 08:46:23 +0800 | [diff] [blame] | 22 | #include <linux/i2c.h> |
| 23 | #include <linux/i2c/pca953x.h> |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 24 | #include <linux/spi/spi.h> |
| 25 | #include <linux/spi/ads7846.h> |
| 26 | #include <linux/spi/corgi_lcd.h> |
Dmitry Baryshkov | 6af7a8e | 2008-10-16 19:17:05 +0400 | [diff] [blame] | 27 | #include <linux/mtd/sharpsl.h> |
Eric Miao | 93dd29a | 2009-07-27 16:59:39 +0800 | [diff] [blame] | 28 | #include <linux/input/matrix_keypad.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 29 | |
| 30 | #include <asm/setup.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 31 | #include <asm/mach-types.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 32 | #include <asm/mach/arch.h> |
Dmitry Eremin-Solenikov | f0ba401 | 2009-05-17 17:05:23 +0400 | [diff] [blame] | 33 | #include <asm/mach/sharpsl_param.h> |
| 34 | #include <asm/hardware/scoop.h> |
| 35 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 36 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 37 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 38 | #include <mach/pxa27x-udc.h> |
Russell King | afd2fc0 | 2008-08-07 11:05:25 +0100 | [diff] [blame] | 39 | #include <mach/reset.h> |
Eric Miao | f0a8370 | 2009-04-13 15:03:11 +0800 | [diff] [blame] | 40 | #include <plat/i2c.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | #include <mach/irda.h> |
| 42 | #include <mach/mmc.h> |
| 43 | #include <mach/ohci.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 44 | #include <mach/pxafb.h> |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 45 | #include <mach/pxa2xx_spi.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 46 | #include <mach/spitz.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 47 | |
| 48 | #include "generic.h" |
Russell King | 46c41e6 | 2007-05-15 15:39:36 +0100 | [diff] [blame] | 49 | #include "devices.h" |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 50 | #include "sharpsl.h" |
| 51 | |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 52 | static unsigned long spitz_pin_config[] __initdata = { |
| 53 | /* Chip Selects */ |
| 54 | GPIO78_nCS_2, /* SCOOP #2 */ |
Eric Miao | faf2f0a | 2008-11-16 15:56:58 +0800 | [diff] [blame] | 55 | GPIO79_nCS_3, /* NAND */ |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 56 | GPIO80_nCS_4, /* SCOOP #1 */ |
| 57 | |
| 58 | /* LCD - 16bpp Active TFT */ |
| 59 | GPIO58_LCD_LDD_0, |
| 60 | GPIO59_LCD_LDD_1, |
| 61 | GPIO60_LCD_LDD_2, |
| 62 | GPIO61_LCD_LDD_3, |
| 63 | GPIO62_LCD_LDD_4, |
| 64 | GPIO63_LCD_LDD_5, |
| 65 | GPIO64_LCD_LDD_6, |
| 66 | GPIO65_LCD_LDD_7, |
| 67 | GPIO66_LCD_LDD_8, |
| 68 | GPIO67_LCD_LDD_9, |
| 69 | GPIO68_LCD_LDD_10, |
| 70 | GPIO69_LCD_LDD_11, |
| 71 | GPIO70_LCD_LDD_12, |
| 72 | GPIO71_LCD_LDD_13, |
| 73 | GPIO72_LCD_LDD_14, |
| 74 | GPIO73_LCD_LDD_15, |
| 75 | GPIO74_LCD_FCLK, |
| 76 | GPIO75_LCD_LCLK, |
| 77 | GPIO76_LCD_PCLK, |
| 78 | |
| 79 | /* PC Card */ |
| 80 | GPIO48_nPOE, |
| 81 | GPIO49_nPWE, |
| 82 | GPIO50_nPIOR, |
| 83 | GPIO51_nPIOW, |
| 84 | GPIO85_nPCE_1, |
| 85 | GPIO54_nPCE_2, |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 86 | GPIO55_nPREG, |
| 87 | GPIO56_nPWAIT, |
| 88 | GPIO57_nIOIS16, |
Eric Miao | faf2f0a | 2008-11-16 15:56:58 +0800 | [diff] [blame] | 89 | GPIO104_PSKTSEL, |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 90 | |
Philipp Zabel | 772885c | 2009-02-05 17:48:20 +0100 | [diff] [blame] | 91 | /* I2S */ |
| 92 | GPIO28_I2S_BITCLK_OUT, |
| 93 | GPIO29_I2S_SDATA_IN, |
| 94 | GPIO30_I2S_SDATA_OUT, |
| 95 | GPIO31_I2S_SYNC, |
| 96 | |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 97 | /* MMC */ |
| 98 | GPIO32_MMC_CLK, |
| 99 | GPIO112_MMC_CMD, |
| 100 | GPIO92_MMC_DAT_0, |
| 101 | GPIO109_MMC_DAT_1, |
| 102 | GPIO110_MMC_DAT_2, |
| 103 | GPIO111_MMC_DAT_3, |
| 104 | |
| 105 | /* GPIOs */ |
| 106 | GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */ |
| 107 | GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */ |
| 108 | GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */ |
| 109 | GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */ |
| 110 | GPIO35_GPIO, /* SPITZ_GPIO_USB_DEVICE */ |
| 111 | GPIO22_GPIO, /* SPITZ_GPIO_HSYNC */ |
| 112 | GPIO94_GPIO, /* SPITZ_GPIO_CF_CD */ |
| 113 | GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ |
| 114 | GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ |
| 115 | |
Eric Miao | 93dd29a | 2009-07-27 16:59:39 +0800 | [diff] [blame] | 116 | /* GPIO matrix keypad */ |
| 117 | GPIO88_GPIO, /* column 0 */ |
| 118 | GPIO23_GPIO, /* column 1 */ |
| 119 | GPIO24_GPIO, /* column 2 */ |
| 120 | GPIO25_GPIO, /* column 3 */ |
| 121 | GPIO26_GPIO, /* column 4 */ |
| 122 | GPIO27_GPIO, /* column 5 */ |
| 123 | GPIO52_GPIO, /* column 6 */ |
| 124 | GPIO103_GPIO, /* column 7 */ |
| 125 | GPIO107_GPIO, /* column 8 */ |
| 126 | GPIO108_GPIO, /* column 9 */ |
| 127 | GPIO114_GPIO, /* column 10 */ |
| 128 | GPIO12_GPIO, /* row 0 */ |
| 129 | GPIO17_GPIO, /* row 1 */ |
| 130 | GPIO91_GPIO, /* row 2 */ |
| 131 | GPIO34_GPIO, /* row 3 */ |
| 132 | GPIO36_GPIO, /* row 4 */ |
| 133 | GPIO38_GPIO, /* row 5 */ |
| 134 | GPIO39_GPIO, /* row 6 */ |
| 135 | |
Eric Miao | 6f584cf | 2008-11-28 16:00:24 +0800 | [diff] [blame] | 136 | /* I2C */ |
| 137 | GPIO117_I2C_SCL, |
| 138 | GPIO118_I2C_SDA, |
| 139 | |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 140 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, |
| 141 | }; |
| 142 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 143 | /* |
| 144 | * Spitz SCOOP Device #1 |
| 145 | */ |
| 146 | static struct resource spitz_scoop_resources[] = { |
| 147 | [0] = { |
| 148 | .start = 0x10800000, |
| 149 | .end = 0x10800fff, |
| 150 | .flags = IORESOURCE_MEM, |
| 151 | }, |
| 152 | }; |
| 153 | |
| 154 | static struct scoop_config spitz_scoop_setup = { |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 155 | .io_dir = SPITZ_SCP_IO_DIR, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 156 | .io_out = SPITZ_SCP_IO_OUT, |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 157 | .suspend_clr = SPITZ_SCP_SUS_CLR, |
| 158 | .suspend_set = SPITZ_SCP_SUS_SET, |
| 159 | .gpio_base = SPITZ_SCP_GPIO_BASE, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | struct platform_device spitzscoop_device = { |
| 163 | .name = "sharp-scoop", |
| 164 | .id = 0, |
| 165 | .dev = { |
| 166 | .platform_data = &spitz_scoop_setup, |
| 167 | }, |
| 168 | .num_resources = ARRAY_SIZE(spitz_scoop_resources), |
| 169 | .resource = spitz_scoop_resources, |
| 170 | }; |
| 171 | |
| 172 | /* |
| 173 | * Spitz SCOOP Device #2 |
| 174 | */ |
| 175 | static struct resource spitz_scoop2_resources[] = { |
| 176 | [0] = { |
| 177 | .start = 0x08800040, |
| 178 | .end = 0x08800fff, |
| 179 | .flags = IORESOURCE_MEM, |
| 180 | }, |
| 181 | }; |
| 182 | |
| 183 | static struct scoop_config spitz_scoop2_setup = { |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 184 | .io_dir = SPITZ_SCP2_IO_DIR, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 185 | .io_out = SPITZ_SCP2_IO_OUT, |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 186 | .suspend_clr = SPITZ_SCP2_SUS_CLR, |
| 187 | .suspend_set = SPITZ_SCP2_SUS_SET, |
| 188 | .gpio_base = SPITZ_SCP2_GPIO_BASE, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 189 | }; |
| 190 | |
| 191 | struct platform_device spitzscoop2_device = { |
| 192 | .name = "sharp-scoop", |
| 193 | .id = 1, |
| 194 | .dev = { |
| 195 | .platform_data = &spitz_scoop2_setup, |
| 196 | }, |
| 197 | .num_resources = ARRAY_SIZE(spitz_scoop2_resources), |
| 198 | .resource = spitz_scoop2_resources, |
| 199 | }; |
| 200 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 201 | #define SPITZ_PWR_SD 0x01 |
| 202 | #define SPITZ_PWR_CF 0x02 |
| 203 | |
| 204 | /* Power control is shared with between one of the CF slots and SD */ |
| 205 | static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) |
| 206 | { |
| 207 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); |
| 208 | |
| 209 | if (new_cpr & 0x0007) { |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 210 | gpio_set_value(SPITZ_GPIO_CF_POWER, 1); |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 211 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) |
| 212 | mdelay(5); |
| 213 | if (device == SPITZ_PWR_CF) |
| 214 | cpr |= 0x0002; |
| 215 | if (device == SPITZ_PWR_SD) |
| 216 | cpr |= 0x0004; |
| 217 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); |
| 218 | } else { |
| 219 | if (device == SPITZ_PWR_CF) |
| 220 | cpr &= ~0x0002; |
| 221 | if (device == SPITZ_PWR_SD) |
| 222 | cpr &= ~0x0004; |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 223 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { |
Richard Purdie | 945b957 | 2006-01-05 20:44:57 +0000 | [diff] [blame] | 224 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 225 | mdelay(1); |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 226 | gpio_set_value(SPITZ_GPIO_CF_POWER, 0); |
Richard Purdie | 945b957 | 2006-01-05 20:44:57 +0000 | [diff] [blame] | 227 | } else { |
| 228 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 233 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) |
| 234 | { |
| 235 | /* Only need to override behaviour for slot 0 */ |
| 236 | if (nr == 0) |
| 237 | spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); |
| 238 | else |
| 239 | write_scoop_reg(scoop, SCOOP_CPR, cpr); |
| 240 | } |
| 241 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 242 | static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { |
| 243 | { |
| 244 | .dev = &spitzscoop_device.dev, |
| 245 | .irq = SPITZ_IRQ_GPIO_CF_IRQ, |
| 246 | .cd_irq = SPITZ_IRQ_GPIO_CF_CD, |
| 247 | .cd_irq_str = "PCMCIA0 CD", |
| 248 | },{ |
| 249 | .dev = &spitzscoop2_device.dev, |
| 250 | .irq = SPITZ_IRQ_GPIO_CF2_IRQ, |
| 251 | .cd_irq = -1, |
| 252 | }, |
| 253 | }; |
| 254 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 255 | static struct scoop_pcmcia_config spitz_pcmcia_config = { |
| 256 | .devs = &spitz_pcmcia_scoop[0], |
| 257 | .num_devs = 2, |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 258 | .power_ctrl = spitz_pcmcia_pwr, |
| 259 | }; |
| 260 | |
| 261 | EXPORT_SYMBOL(spitzscoop_device); |
| 262 | EXPORT_SYMBOL(spitzscoop2_device); |
| 263 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 264 | /* |
| 265 | * Spitz Keyboard Device |
| 266 | */ |
Eric Miao | 93dd29a | 2009-07-27 16:59:39 +0800 | [diff] [blame] | 267 | #define SPITZ_KEY_CALENDAR KEY_F1 |
| 268 | #define SPITZ_KEY_ADDRESS KEY_F2 |
| 269 | #define SPITZ_KEY_FN KEY_F3 |
| 270 | #define SPITZ_KEY_CANCEL KEY_F4 |
| 271 | #define SPITZ_KEY_EXOK KEY_F5 |
| 272 | #define SPITZ_KEY_EXCANCEL KEY_F6 |
| 273 | #define SPITZ_KEY_EXJOGDOWN KEY_F7 |
| 274 | #define SPITZ_KEY_EXJOGUP KEY_F8 |
| 275 | #define SPITZ_KEY_JAP1 KEY_LEFTALT |
| 276 | #define SPITZ_KEY_JAP2 KEY_RIGHTCTRL |
| 277 | #define SPITZ_KEY_SYNC KEY_F9 |
| 278 | #define SPITZ_KEY_MAIL KEY_F10 |
| 279 | #define SPITZ_KEY_OK KEY_F11 |
| 280 | #define SPITZ_KEY_MENU KEY_F12 |
| 281 | |
| 282 | static const uint32_t spitzkbd_keymap[] = { |
| 283 | KEY(0, 0, KEY_LEFTCTRL), |
| 284 | KEY(0, 1, KEY_1), |
| 285 | KEY(0, 2, KEY_3), |
| 286 | KEY(0, 3, KEY_5), |
| 287 | KEY(0, 4, KEY_6), |
| 288 | KEY(0, 5, KEY_7), |
| 289 | KEY(0, 6, KEY_9), |
| 290 | KEY(0, 7, KEY_0), |
| 291 | KEY(0, 8, KEY_BACKSPACE), |
| 292 | KEY(0, 9, SPITZ_KEY_EXOK), /* EXOK */ |
| 293 | KEY(0, 10, SPITZ_KEY_EXCANCEL), /* EXCANCEL */ |
| 294 | KEY(1, 1, KEY_2), |
| 295 | KEY(1, 2, KEY_4), |
| 296 | KEY(1, 3, KEY_R), |
| 297 | KEY(1, 4, KEY_Y), |
| 298 | KEY(1, 5, KEY_8), |
| 299 | KEY(1, 6, KEY_I), |
| 300 | KEY(1, 7, KEY_O), |
| 301 | KEY(1, 8, KEY_P), |
| 302 | KEY(1, 9, SPITZ_KEY_EXJOGDOWN), /* EXJOGDOWN */ |
| 303 | KEY(1, 10, SPITZ_KEY_EXJOGUP), /* EXJOGUP */ |
| 304 | KEY(2, 0, KEY_TAB), |
| 305 | KEY(2, 1, KEY_Q), |
| 306 | KEY(2, 2, KEY_E), |
| 307 | KEY(2, 3, KEY_T), |
| 308 | KEY(2, 4, KEY_G), |
| 309 | KEY(2, 5, KEY_U), |
| 310 | KEY(2, 6, KEY_J), |
| 311 | KEY(2, 7, KEY_K), |
| 312 | KEY(3, 0, SPITZ_KEY_ADDRESS), /* ADDRESS */ |
| 313 | KEY(3, 1, KEY_W), |
| 314 | KEY(3, 2, KEY_S), |
| 315 | KEY(3, 3, KEY_F), |
| 316 | KEY(3, 4, KEY_V), |
| 317 | KEY(3, 5, KEY_H), |
| 318 | KEY(3, 6, KEY_M), |
| 319 | KEY(3, 7, KEY_L), |
| 320 | KEY(3, 9, KEY_RIGHTSHIFT), |
| 321 | KEY(4, 0, SPITZ_KEY_CALENDAR), /* CALENDAR */ |
| 322 | KEY(4, 1, KEY_A), |
| 323 | KEY(4, 2, KEY_D), |
| 324 | KEY(4, 3, KEY_C), |
| 325 | KEY(4, 4, KEY_B), |
| 326 | KEY(4, 5, KEY_N), |
| 327 | KEY(4, 6, KEY_DOT), |
| 328 | KEY(4, 8, KEY_ENTER), |
| 329 | KEY(4, 9, KEY_LEFTSHIFT), |
| 330 | KEY(5, 0, SPITZ_KEY_MAIL), /* MAIL */ |
| 331 | KEY(5, 1, KEY_Z), |
| 332 | KEY(5, 2, KEY_X), |
| 333 | KEY(5, 3, KEY_MINUS), |
| 334 | KEY(5, 4, KEY_SPACE), |
| 335 | KEY(5, 5, KEY_COMMA), |
| 336 | KEY(5, 7, KEY_UP), |
| 337 | KEY(5, 10, SPITZ_KEY_FN), /* FN */ |
| 338 | KEY(6, 0, KEY_SYSRQ), |
| 339 | KEY(6, 1, SPITZ_KEY_JAP1), /* JAP1 */ |
| 340 | KEY(6, 2, SPITZ_KEY_JAP2), /* JAP2 */ |
| 341 | KEY(6, 3, SPITZ_KEY_CANCEL), /* CANCEL */ |
| 342 | KEY(6, 4, SPITZ_KEY_OK), /* OK */ |
| 343 | KEY(6, 5, SPITZ_KEY_MENU), /* MENU */ |
| 344 | KEY(6, 6, KEY_LEFT), |
| 345 | KEY(6, 7, KEY_DOWN), |
| 346 | KEY(6, 8, KEY_RIGHT), |
| 347 | }; |
| 348 | |
| 349 | static const struct matrix_keymap_data spitzkbd_keymap_data = { |
| 350 | .keymap = spitzkbd_keymap, |
| 351 | .keymap_size = ARRAY_SIZE(spitzkbd_keymap), |
| 352 | }; |
| 353 | |
| 354 | static const uint32_t spitzkbd_row_gpios[] = |
| 355 | { 12, 17, 91, 34, 36, 38, 39 }; |
| 356 | static const uint32_t spitzkbd_col_gpios[] = |
| 357 | { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 }; |
| 358 | |
| 359 | static struct matrix_keypad_platform_data spitzkbd_pdata = { |
| 360 | .keymap_data = &spitzkbd_keymap_data, |
| 361 | .row_gpios = spitzkbd_row_gpios, |
| 362 | .col_gpios = spitzkbd_col_gpios, |
| 363 | .num_row_gpios = ARRAY_SIZE(spitzkbd_row_gpios), |
| 364 | .num_col_gpios = ARRAY_SIZE(spitzkbd_col_gpios), |
| 365 | .col_scan_delay_us = 10, |
| 366 | .debounce_ms = 10, |
| 367 | .wakeup = 1, |
| 368 | }; |
| 369 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 370 | static struct platform_device spitzkbd_device = { |
Eric Miao | 93dd29a | 2009-07-27 16:59:39 +0800 | [diff] [blame] | 371 | .name = "matrix-keypad", |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 372 | .id = -1, |
Eric Miao | 93dd29a | 2009-07-27 16:59:39 +0800 | [diff] [blame] | 373 | .dev = { |
| 374 | .platform_data = &spitzkbd_pdata, |
| 375 | }, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 376 | }; |
| 377 | |
| 378 | |
Stanislav Brabec | f6919eb | 2009-10-16 20:50:05 +0200 | [diff] [blame] | 379 | static struct gpio_keys_button spitz_gpio_keys[] = { |
| 380 | { |
| 381 | .type = EV_PWR, |
| 382 | .code = KEY_SUSPEND, |
| 383 | .gpio = SPITZ_GPIO_ON_KEY, |
| 384 | .desc = "On/Off", |
| 385 | .wakeup = 1, |
| 386 | }, |
| 387 | /* Two buttons detecting the lid state */ |
| 388 | { |
| 389 | .type = EV_SW, |
| 390 | .code = 0, |
| 391 | .gpio = SPITZ_GPIO_SWA, |
| 392 | .desc = "Display Down", |
| 393 | }, |
| 394 | { |
| 395 | .type = EV_SW, |
| 396 | .code = 1, |
| 397 | .gpio = SPITZ_GPIO_SWB, |
| 398 | .desc = "Lid Closed", |
| 399 | }, |
| 400 | }; |
| 401 | |
| 402 | static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = { |
| 403 | .buttons = spitz_gpio_keys, |
| 404 | .nbuttons = ARRAY_SIZE(spitz_gpio_keys), |
| 405 | }; |
| 406 | |
| 407 | static struct platform_device spitz_gpio_keys_device = { |
| 408 | .name = "gpio-keys", |
| 409 | .id = -1, |
| 410 | .dev = { |
| 411 | .platform_data = &spitz_gpio_keys_platform_data, |
| 412 | }, |
| 413 | }; |
| 414 | |
| 415 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 416 | /* |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 417 | * Spitz LEDs |
| 418 | */ |
Eric Miao | 4fe3224 | 2008-09-05 22:38:23 +0800 | [diff] [blame] | 419 | static struct gpio_led spitz_gpio_leds[] = { |
| 420 | { |
| 421 | .name = "spitz:amber:charge", |
| 422 | .default_trigger = "sharpsl-charge", |
| 423 | .gpio = SPITZ_GPIO_LED_ORANGE, |
| 424 | }, |
| 425 | { |
| 426 | .name = "spitz:green:hddactivity", |
| 427 | .default_trigger = "ide-disk", |
| 428 | .gpio = SPITZ_GPIO_LED_GREEN, |
| 429 | }, |
| 430 | }; |
| 431 | |
| 432 | static struct gpio_led_platform_data spitz_gpio_leds_info = { |
| 433 | .leds = spitz_gpio_leds, |
| 434 | .num_leds = ARRAY_SIZE(spitz_gpio_leds), |
| 435 | }; |
| 436 | |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 437 | static struct platform_device spitzled_device = { |
Eric Miao | 4fe3224 | 2008-09-05 22:38:23 +0800 | [diff] [blame] | 438 | .name = "leds-gpio", |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 439 | .id = -1, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 440 | .dev = { |
Eric Miao | 4fe3224 | 2008-09-05 22:38:23 +0800 | [diff] [blame] | 441 | .platform_data = &spitz_gpio_leds_info, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 442 | }, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 443 | }; |
| 444 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 445 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
| 446 | static struct pxa2xx_spi_master spitz_spi_info = { |
| 447 | .num_chipselect = 3, |
| 448 | }; |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 449 | |
Eric Miao | 3e36c0d | 2009-02-06 16:49:23 +0800 | [diff] [blame] | 450 | static void spitz_wait_for_hsync(void) |
| 451 | { |
| 452 | while (gpio_get_value(SPITZ_GPIO_HSYNC)) |
| 453 | cpu_relax(); |
| 454 | |
| 455 | while (!gpio_get_value(SPITZ_GPIO_HSYNC)) |
| 456 | cpu_relax(); |
| 457 | } |
| 458 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 459 | static struct ads7846_platform_data spitz_ads7846_info = { |
| 460 | .model = 7846, |
| 461 | .vref_delay_usecs = 100, |
| 462 | .x_plate_ohms = 419, |
| 463 | .y_plate_ohms = 486, |
Pavel Machek | 3318c4b | 2009-09-18 12:44:19 -0700 | [diff] [blame] | 464 | .pressure_max = 1024, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 465 | .gpio_pendown = SPITZ_GPIO_TP_INT, |
Eric Miao | 3e36c0d | 2009-02-06 16:49:23 +0800 | [diff] [blame] | 466 | .wait_for_sync = spitz_wait_for_hsync, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 467 | }; |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 468 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 469 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { |
Mike Rapoport | 46580c0 | 2009-04-14 08:33:49 +0300 | [diff] [blame] | 470 | .gpio_cs = SPITZ_GPIO_ADS7846_CS, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 471 | }; |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 472 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 473 | static void spitz_bl_kick_battery(void) |
| 474 | { |
| 475 | void (*kick_batt)(void); |
| 476 | |
| 477 | kick_batt = symbol_get(sharpsl_battery_kick); |
| 478 | if (kick_batt) { |
| 479 | kick_batt(); |
| 480 | symbol_put(sharpsl_battery_kick); |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | static struct corgi_lcd_platform_data spitz_lcdcon_info = { |
| 485 | .init_mode = CORGI_LCD_MODE_VGA, |
| 486 | .max_intensity = 0x2f, |
| 487 | .default_intensity = 0x1f, |
| 488 | .limit_mask = 0x0b, |
Eric Miao | ff7a4c7 | 2008-09-07 11:30:06 +0800 | [diff] [blame] | 489 | .gpio_backlight_cont = SPITZ_GPIO_BACKLIGHT_CONT, |
| 490 | .gpio_backlight_on = SPITZ_GPIO_BACKLIGHT_ON, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 491 | .kick_battery = spitz_bl_kick_battery, |
| 492 | }; |
| 493 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 494 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { |
Mike Rapoport | 46580c0 | 2009-04-14 08:33:49 +0300 | [diff] [blame] | 495 | .gpio_cs = SPITZ_GPIO_LCDCON_CS, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 496 | }; |
| 497 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 498 | static struct pxa2xx_spi_chip spitz_max1111_chip = { |
Mike Rapoport | 46580c0 | 2009-04-14 08:33:49 +0300 | [diff] [blame] | 499 | .gpio_cs = SPITZ_GPIO_MAX1111_CS, |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 500 | }; |
| 501 | |
| 502 | static struct spi_board_info spitz_spi_devices[] = { |
| 503 | { |
| 504 | .modalias = "ads7846", |
| 505 | .max_speed_hz = 1200000, |
| 506 | .bus_num = 2, |
| 507 | .chip_select = 0, |
| 508 | .platform_data = &spitz_ads7846_info, |
| 509 | .controller_data= &spitz_ads7846_chip, |
| 510 | .irq = gpio_to_irq(SPITZ_GPIO_TP_INT), |
| 511 | }, { |
| 512 | .modalias = "corgi-lcd", |
| 513 | .max_speed_hz = 50000, |
| 514 | .bus_num = 2, |
| 515 | .chip_select = 1, |
| 516 | .platform_data = &spitz_lcdcon_info, |
| 517 | .controller_data= &spitz_lcdcon_chip, |
| 518 | }, { |
| 519 | .modalias = "max1111", |
| 520 | .max_speed_hz = 450000, |
| 521 | .bus_num = 2, |
| 522 | .chip_select = 2, |
| 523 | .controller_data= &spitz_max1111_chip, |
| 524 | }, |
| 525 | }; |
| 526 | |
| 527 | static void __init spitz_init_spi(void) |
| 528 | { |
Eric Miao | ff7a4c7 | 2008-09-07 11:30:06 +0800 | [diff] [blame] | 529 | if (machine_is_akita()) { |
| 530 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; |
| 531 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; |
| 532 | } |
| 533 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 534 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
| 535 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 536 | } |
| 537 | #else |
| 538 | static inline void spitz_init_spi(void) {} |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 539 | #endif |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 540 | |
| 541 | /* |
| 542 | * MMC/SD Device |
| 543 | * |
| 544 | * The card detect interrupt isn't debounced so we delay it by 250ms |
| 545 | * to give the card a chance to fully insert/eject. |
| 546 | */ |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 547 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
| 548 | { |
| 549 | struct pxamci_platform_data* p_d = dev->platform_data; |
| 550 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 551 | if (( 1 << vdd) & p_d->ocr_mask) |
| 552 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); |
| 553 | else |
| 554 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 555 | } |
| 556 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 557 | static struct pxamci_platform_data spitz_mci_platform_data = { |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 558 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 559 | .setpower = spitz_mci_setpower, |
| 560 | .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
| 561 | .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
| 562 | .gpio_power = -1, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 563 | }; |
| 564 | |
| 565 | |
| 566 | /* |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 567 | * USB Host (OHCI) |
| 568 | */ |
| 569 | static int spitz_ohci_init(struct device *dev) |
| 570 | { |
Eric Miao | dd5980d | 2008-09-02 17:34:33 +0800 | [diff] [blame] | 571 | int err; |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 572 | |
Eric Miao | dd5980d | 2008-09-02 17:34:33 +0800 | [diff] [blame] | 573 | err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST"); |
| 574 | if (err) |
| 575 | return err; |
| 576 | |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 577 | /* Only Port 2 is connected |
| 578 | * Setup USB Port 2 Output Control Register |
| 579 | */ |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 580 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 581 | |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 582 | return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 583 | } |
| 584 | |
Dmitry Eremin-Solenikov | a81b386 | 2009-05-15 10:11:22 +0400 | [diff] [blame] | 585 | static void spitz_ohci_exit(struct device *dev) |
| 586 | { |
| 587 | gpio_free(SPITZ_GPIO_USB_HOST); |
| 588 | } |
| 589 | |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 590 | static struct pxaohci_platform_data spitz_ohci_platform_data = { |
| 591 | .port_mode = PMM_NPS_MODE, |
| 592 | .init = spitz_ohci_init, |
Dmitry Eremin-Solenikov | a81b386 | 2009-05-15 10:11:22 +0400 | [diff] [blame] | 593 | .exit = spitz_ohci_exit, |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 594 | .flags = ENABLE_PORT_ALL | NO_OC_PROTECTION, |
Richard Purdie | 0c27c5d | 2006-06-08 22:44:07 +0100 | [diff] [blame] | 595 | .power_budget = 150, |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 596 | }; |
| 597 | |
| 598 | |
| 599 | /* |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 600 | * Irda |
| 601 | */ |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 602 | |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 603 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 604 | /* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */ |
Eric Miao | fff1472 | 2008-09-05 22:15:23 +0800 | [diff] [blame] | 605 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 606 | }; |
| 607 | |
| 608 | |
| 609 | /* |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 610 | * Spitz PXA Framebuffer |
| 611 | */ |
Richard Purdie | d14b272 | 2006-09-20 22:54:21 +0100 | [diff] [blame] | 612 | |
| 613 | static struct pxafb_mode_info spitz_pxafb_modes[] = { |
| 614 | { |
| 615 | .pixclock = 19231, |
| 616 | .xres = 480, |
| 617 | .yres = 640, |
| 618 | .bpp = 16, |
| 619 | .hsync_len = 40, |
| 620 | .left_margin = 46, |
| 621 | .right_margin = 125, |
| 622 | .vsync_len = 3, |
| 623 | .upper_margin = 1, |
| 624 | .lower_margin = 0, |
| 625 | .sync = 0, |
| 626 | },{ |
| 627 | .pixclock = 134617, |
| 628 | .xres = 240, |
| 629 | .yres = 320, |
| 630 | .bpp = 16, |
| 631 | .hsync_len = 20, |
| 632 | .left_margin = 20, |
| 633 | .right_margin = 46, |
| 634 | .vsync_len = 2, |
| 635 | .upper_margin = 1, |
| 636 | .lower_margin = 0, |
| 637 | .sync = 0, |
| 638 | }, |
| 639 | }; |
| 640 | |
| 641 | static struct pxafb_mach_info spitz_pxafb_info = { |
| 642 | .modes = &spitz_pxafb_modes[0], |
| 643 | .num_modes = 2, |
| 644 | .fixed_modes = 1, |
Eric Miao | 79009a0 | 2008-09-03 10:00:38 +0800 | [diff] [blame] | 645 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 646 | }; |
| 647 | |
Dmitry Baryshkov | 6af7a8e | 2008-10-16 19:17:05 +0400 | [diff] [blame] | 648 | static struct mtd_partition sharpsl_nand_partitions[] = { |
| 649 | { |
| 650 | .name = "System Area", |
| 651 | .offset = 0, |
| 652 | .size = 7 * 1024 * 1024, |
| 653 | }, |
| 654 | { |
| 655 | .name = "Root Filesystem", |
| 656 | .offset = 7 * 1024 * 1024, |
| 657 | }, |
| 658 | { |
| 659 | .name = "Home Filesystem", |
| 660 | .offset = MTDPART_OFS_APPEND, |
| 661 | .size = MTDPART_SIZ_FULL, |
| 662 | }, |
| 663 | }; |
| 664 | |
| 665 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; |
| 666 | |
| 667 | static struct nand_bbt_descr sharpsl_bbt = { |
| 668 | .options = 0, |
| 669 | .offs = 4, |
| 670 | .len = 2, |
| 671 | .pattern = scan_ff_pattern |
| 672 | }; |
| 673 | |
| 674 | static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = { |
| 675 | .badblock_pattern = &sharpsl_bbt, |
| 676 | .partitions = sharpsl_nand_partitions, |
| 677 | .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions), |
| 678 | }; |
| 679 | |
| 680 | static struct resource sharpsl_nand_resources[] = { |
| 681 | { |
| 682 | .start = 0x0C000000, |
| 683 | .end = 0x0C000FFF, |
| 684 | .flags = IORESOURCE_MEM, |
| 685 | }, |
| 686 | }; |
| 687 | |
| 688 | static struct platform_device sharpsl_nand_device = { |
| 689 | .name = "sharpsl-nand", |
| 690 | .id = -1, |
| 691 | .resource = sharpsl_nand_resources, |
| 692 | .num_resources = ARRAY_SIZE(sharpsl_nand_resources), |
| 693 | .dev.platform_data = &sharpsl_nand_platform_data, |
| 694 | }; |
| 695 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 696 | |
Dmitry Baryshkov | e5d3bf3 | 2008-11-25 00:57:28 +0300 | [diff] [blame] | 697 | static struct mtd_partition sharpsl_rom_parts[] = { |
| 698 | { |
| 699 | .name ="Boot PROM Filesystem", |
| 700 | .offset = 0x00140000, |
| 701 | .size = MTDPART_SIZ_FULL, |
| 702 | }, |
| 703 | }; |
| 704 | |
| 705 | static struct physmap_flash_data sharpsl_rom_data = { |
| 706 | .width = 2, |
| 707 | .nr_parts = ARRAY_SIZE(sharpsl_rom_parts), |
| 708 | .parts = sharpsl_rom_parts, |
| 709 | }; |
| 710 | |
| 711 | static struct resource sharpsl_rom_resources[] = { |
| 712 | { |
| 713 | .start = 0x00000000, |
| 714 | .end = 0x007fffff, |
| 715 | .flags = IORESOURCE_MEM, |
| 716 | }, |
| 717 | }; |
| 718 | |
| 719 | static struct platform_device sharpsl_rom_device = { |
| 720 | .name = "physmap-flash", |
| 721 | .id = -1, |
| 722 | .resource = sharpsl_rom_resources, |
| 723 | .num_resources = ARRAY_SIZE(sharpsl_rom_resources), |
| 724 | .dev.platform_data = &sharpsl_rom_data, |
| 725 | }; |
| 726 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 727 | static struct platform_device *devices[] __initdata = { |
| 728 | &spitzscoop_device, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 729 | &spitzkbd_device, |
Stanislav Brabec | f6919eb | 2009-10-16 20:50:05 +0200 | [diff] [blame] | 730 | &spitz_gpio_keys_device, |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 731 | &spitzled_device, |
Dmitry Baryshkov | 6af7a8e | 2008-10-16 19:17:05 +0400 | [diff] [blame] | 732 | &sharpsl_nand_device, |
Dmitry Baryshkov | e5d3bf3 | 2008-11-25 00:57:28 +0300 | [diff] [blame] | 733 | &sharpsl_rom_device, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 734 | }; |
| 735 | |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 736 | static void spitz_poweroff(void) |
| 737 | { |
Russell King | be093be | 2009-03-19 16:20:24 +0000 | [diff] [blame] | 738 | arm_machine_restart('g', NULL); |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 739 | } |
| 740 | |
Russell King | be093be | 2009-03-19 16:20:24 +0000 | [diff] [blame] | 741 | static void spitz_restart(char mode, const char *cmd) |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 742 | { |
| 743 | /* Bootloader magic for a reboot */ |
| 744 | if((MSC0 & 0xffff0000) == 0x7ff00000) |
| 745 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; |
| 746 | |
| 747 | spitz_poweroff(); |
| 748 | } |
| 749 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 750 | static void __init common_init(void) |
| 751 | { |
Daniel Ribeiro | 216e3b7 | 2009-05-05 22:43:18 -0300 | [diff] [blame] | 752 | init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 753 | pm_power_off = spitz_poweroff; |
| 754 | arm_pm_restart = spitz_restart; |
| 755 | |
Dmitry Baryshkov | 6af7a8e | 2008-10-16 19:17:05 +0400 | [diff] [blame] | 756 | if (machine_is_spitz()) { |
| 757 | sharpsl_nand_partitions[1].size = 5 * 1024 * 1024; |
| 758 | } else if (machine_is_akita()) { |
| 759 | sharpsl_nand_partitions[1].size = 58 * 1024 * 1024; |
| 760 | } else if (machine_is_borzoi()) { |
| 761 | sharpsl_nand_partitions[1].size = 32 * 1024 * 1024; |
| 762 | } |
| 763 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 764 | PMCR = 0x00; |
| 765 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 766 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
| 767 | PCFR |= PCFR_OPDE; |
| 768 | |
Eric Miao | 5e96ade | 2008-09-03 09:47:42 +0800 | [diff] [blame] | 769 | pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config)); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 770 | |
Eric Miao | 859b796 | 2008-09-03 12:09:24 +0800 | [diff] [blame] | 771 | spitz_init_spi(); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 772 | |
| 773 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 774 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 775 | pxa_set_mci_info(&spitz_mci_platform_data); |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 776 | pxa_set_ohci_info(&spitz_ohci_platform_data); |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 777 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 778 | set_pxa_fb_info(&spitz_pxafb_info); |
Mark Brown | f8787fd | 2008-08-26 13:30:03 +0100 | [diff] [blame] | 779 | pxa_set_i2c_info(NULL); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 780 | } |
| 781 | |
Stanislav Brabec | 5e0fa3f | 2009-10-22 23:05:03 +0200 | [diff] [blame] | 782 | #if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI) |
| 783 | static struct nand_bbt_descr sharpsl_akita_bbt = { |
| 784 | .options = 0, |
| 785 | .offs = 4, |
| 786 | .len = 1, |
| 787 | .pattern = scan_ff_pattern |
| 788 | }; |
| 789 | |
| 790 | static struct nand_ecclayout akita_oobinfo = { |
| 791 | .eccbytes = 24, |
| 792 | .eccpos = { |
| 793 | 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11, |
| 794 | 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, |
| 795 | 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37}, |
| 796 | .oobfree = {{0x08, 0x09}} |
| 797 | }; |
| 798 | #endif |
| 799 | |
Richard Purdie | ca4d6cf | 2008-01-02 01:09:54 +0100 | [diff] [blame] | 800 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 801 | static void __init spitz_init(void) |
| 802 | { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 803 | spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON; |
| 804 | |
Pavel Machek | 8106551 | 2009-11-18 10:01:00 +0100 | [diff] [blame] | 805 | #ifdef CONFIG_MACH_BORZOI |
Stanislav Brabec | 5e0fa3f | 2009-10-22 23:05:03 +0200 | [diff] [blame] | 806 | if (machine_is_borzoi()) { |
| 807 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; |
| 808 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; |
| 809 | } |
Pavel Machek | 8106551 | 2009-11-18 10:01:00 +0100 | [diff] [blame] | 810 | #endif |
Stanislav Brabec | 5e0fa3f | 2009-10-22 23:05:03 +0200 | [diff] [blame] | 811 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 812 | platform_scoop_config = &spitz_pcmcia_config; |
| 813 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 814 | common_init(); |
| 815 | |
| 816 | platform_device_register(&spitzscoop2_device); |
| 817 | } |
Richard Purdie | ca4d6cf | 2008-01-02 01:09:54 +0100 | [diff] [blame] | 818 | #endif |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 819 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 820 | #ifdef CONFIG_MACH_AKITA |
| 821 | /* |
| 822 | * Akita IO Expander |
| 823 | */ |
Eric Miao | f72de66 | 2008-09-06 08:46:23 +0800 | [diff] [blame] | 824 | static struct pca953x_platform_data akita_ioexp = { |
| 825 | .gpio_base = AKITA_IOEXP_GPIO_BASE, |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 826 | }; |
| 827 | |
Eric Miao | f72de66 | 2008-09-06 08:46:23 +0800 | [diff] [blame] | 828 | static struct i2c_board_info akita_i2c_board_info[] = { |
| 829 | { |
| 830 | .type = "max7310", |
| 831 | .addr = 0x18, |
| 832 | .platform_data = &akita_ioexp, |
| 833 | }, |
| 834 | }; |
Richard Purdie | ca4d6cf | 2008-01-02 01:09:54 +0100 | [diff] [blame] | 835 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 836 | static void __init akita_init(void) |
| 837 | { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 838 | spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON; |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 839 | |
Dmitry Baryshkov | 6af7a8e | 2008-10-16 19:17:05 +0400 | [diff] [blame] | 840 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; |
| 841 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; |
| 842 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 843 | /* We just pretend the second element of the array doesn't exist */ |
| 844 | spitz_pcmcia_config.num_devs = 1; |
| 845 | platform_scoop_config = &spitz_pcmcia_config; |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 846 | |
Eric Miao | f72de66 | 2008-09-06 08:46:23 +0800 | [diff] [blame] | 847 | i2c_register_board_info(0, ARRAY_AND_SIZE(akita_i2c_board_info)); |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 848 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 849 | common_init(); |
| 850 | } |
| 851 | #endif |
| 852 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 853 | static void __init fixup_spitz(struct machine_desc *desc, |
| 854 | struct tag *tags, char **cmdline, struct meminfo *mi) |
| 855 | { |
| 856 | sharpsl_save_param(); |
| 857 | mi->nr_banks = 1; |
| 858 | mi->bank[0].start = 0xa0000000; |
| 859 | mi->bank[0].node = 0; |
| 860 | mi->bank[0].size = (64*1024*1024); |
| 861 | } |
| 862 | |
| 863 | #ifdef CONFIG_MACH_SPITZ |
| 864 | MACHINE_START(SPITZ, "SHARP Spitz") |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 865 | .phys_io = 0x40000000, |
| 866 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 867 | .fixup = fixup_spitz, |
| 868 | .map_io = pxa_map_io, |
Eric Miao | cd49104 | 2007-06-22 04:14:09 +0100 | [diff] [blame] | 869 | .init_irq = pxa27x_init_irq, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 870 | .init_machine = spitz_init, |
| 871 | .timer = &pxa_timer, |
| 872 | MACHINE_END |
| 873 | #endif |
| 874 | |
| 875 | #ifdef CONFIG_MACH_BORZOI |
| 876 | MACHINE_START(BORZOI, "SHARP Borzoi") |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 877 | .phys_io = 0x40000000, |
| 878 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 879 | .fixup = fixup_spitz, |
| 880 | .map_io = pxa_map_io, |
Eric Miao | cd49104 | 2007-06-22 04:14:09 +0100 | [diff] [blame] | 881 | .init_irq = pxa27x_init_irq, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 882 | .init_machine = spitz_init, |
| 883 | .timer = &pxa_timer, |
| 884 | MACHINE_END |
| 885 | #endif |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 886 | |
| 887 | #ifdef CONFIG_MACH_AKITA |
| 888 | MACHINE_START(AKITA, "SHARP Akita") |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 889 | .phys_io = 0x40000000, |
| 890 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 891 | .fixup = fixup_spitz, |
| 892 | .map_io = pxa_map_io, |
Eric Miao | cd49104 | 2007-06-22 04:14:09 +0100 | [diff] [blame] | 893 | .init_irq = pxa27x_init_irq, |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 894 | .init_machine = akita_init, |
| 895 | .timer = &pxa_timer, |
| 896 | MACHINE_END |
| 897 | #endif |