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