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> |
| 16 | #include <linux/init.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 18 | #include <linux/delay.h> |
| 19 | #include <linux/major.h> |
| 20 | #include <linux/fs.h> |
| 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/mmc/host.h> |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 23 | #include <linux/pm.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 24 | |
| 25 | #include <asm/setup.h> |
| 26 | #include <asm/memory.h> |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/hardware.h> |
| 29 | #include <asm/irq.h> |
| 30 | #include <asm/io.h> |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 31 | #include <asm/system.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 32 | |
| 33 | #include <asm/mach/arch.h> |
| 34 | #include <asm/mach/map.h> |
| 35 | #include <asm/mach/irq.h> |
| 36 | |
| 37 | #include <asm/arch/pxa-regs.h> |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 38 | #include <asm/arch/irda.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 39 | #include <asm/arch/mmc.h> |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 40 | #include <asm/arch/ohci.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 41 | #include <asm/arch/udc.h> |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 42 | #include <asm/arch/pxafb.h> |
| 43 | #include <asm/arch/akita.h> |
| 44 | #include <asm/arch/spitz.h> |
| 45 | #include <asm/arch/sharpsl.h> |
| 46 | |
| 47 | #include <asm/mach/sharpsl_param.h> |
| 48 | #include <asm/hardware/scoop.h> |
| 49 | |
| 50 | #include "generic.h" |
| 51 | #include "sharpsl.h" |
| 52 | |
| 53 | /* |
| 54 | * Spitz SCOOP Device #1 |
| 55 | */ |
| 56 | static struct resource spitz_scoop_resources[] = { |
| 57 | [0] = { |
| 58 | .start = 0x10800000, |
| 59 | .end = 0x10800fff, |
| 60 | .flags = IORESOURCE_MEM, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static struct scoop_config spitz_scoop_setup = { |
| 65 | .io_dir = SPITZ_SCP_IO_DIR, |
| 66 | .io_out = SPITZ_SCP_IO_OUT, |
| 67 | .suspend_clr = SPITZ_SCP_SUS_CLR, |
| 68 | .suspend_set = SPITZ_SCP_SUS_SET, |
| 69 | }; |
| 70 | |
| 71 | struct platform_device spitzscoop_device = { |
| 72 | .name = "sharp-scoop", |
| 73 | .id = 0, |
| 74 | .dev = { |
| 75 | .platform_data = &spitz_scoop_setup, |
| 76 | }, |
| 77 | .num_resources = ARRAY_SIZE(spitz_scoop_resources), |
| 78 | .resource = spitz_scoop_resources, |
| 79 | }; |
| 80 | |
| 81 | /* |
| 82 | * Spitz SCOOP Device #2 |
| 83 | */ |
| 84 | static struct resource spitz_scoop2_resources[] = { |
| 85 | [0] = { |
| 86 | .start = 0x08800040, |
| 87 | .end = 0x08800fff, |
| 88 | .flags = IORESOURCE_MEM, |
| 89 | }, |
| 90 | }; |
| 91 | |
| 92 | static struct scoop_config spitz_scoop2_setup = { |
| 93 | .io_dir = SPITZ_SCP2_IO_DIR, |
| 94 | .io_out = SPITZ_SCP2_IO_OUT, |
| 95 | .suspend_clr = SPITZ_SCP2_SUS_CLR, |
| 96 | .suspend_set = SPITZ_SCP2_SUS_SET, |
| 97 | }; |
| 98 | |
| 99 | struct platform_device spitzscoop2_device = { |
| 100 | .name = "sharp-scoop", |
| 101 | .id = 1, |
| 102 | .dev = { |
| 103 | .platform_data = &spitz_scoop2_setup, |
| 104 | }, |
| 105 | .num_resources = ARRAY_SIZE(spitz_scoop2_resources), |
| 106 | .resource = spitz_scoop2_resources, |
| 107 | }; |
| 108 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 109 | #define SPITZ_PWR_SD 0x01 |
| 110 | #define SPITZ_PWR_CF 0x02 |
| 111 | |
| 112 | /* Power control is shared with between one of the CF slots and SD */ |
| 113 | static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) |
| 114 | { |
| 115 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); |
| 116 | |
| 117 | if (new_cpr & 0x0007) { |
| 118 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); |
| 119 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) |
| 120 | mdelay(5); |
| 121 | if (device == SPITZ_PWR_CF) |
| 122 | cpr |= 0x0002; |
| 123 | if (device == SPITZ_PWR_SD) |
| 124 | cpr |= 0x0004; |
| 125 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); |
| 126 | } else { |
| 127 | if (device == SPITZ_PWR_CF) |
| 128 | cpr &= ~0x0002; |
| 129 | if (device == SPITZ_PWR_SD) |
| 130 | cpr &= ~0x0004; |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 131 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { |
Richard Purdie | 945b957 | 2006-01-05 20:44:57 +0000 | [diff] [blame] | 132 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 133 | mdelay(1); |
| 134 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); |
Richard Purdie | 945b957 | 2006-01-05 20:44:57 +0000 | [diff] [blame] | 135 | } else { |
| 136 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | static void spitz_pcmcia_init(void) |
| 142 | { |
| 143 | /* Setup default state of GPIO outputs |
| 144 | before we enable them as outputs. */ |
| 145 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | |
| 146 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | |
| 147 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2); |
| 148 | GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1); |
| 149 | |
| 150 | pxa_gpio_mode(GPIO48_nPOE_MD); |
| 151 | pxa_gpio_mode(GPIO49_nPWE_MD); |
| 152 | pxa_gpio_mode(GPIO50_nPIOR_MD); |
| 153 | pxa_gpio_mode(GPIO51_nPIOW_MD); |
| 154 | pxa_gpio_mode(GPIO55_nPREG_MD); |
| 155 | pxa_gpio_mode(GPIO56_nPWAIT_MD); |
| 156 | pxa_gpio_mode(GPIO57_nIOIS16_MD); |
| 157 | pxa_gpio_mode(GPIO85_nPCE_1_MD); |
| 158 | pxa_gpio_mode(GPIO54_nPCE_2_MD); |
| 159 | pxa_gpio_mode(GPIO104_pSKTSEL_MD); |
| 160 | } |
| 161 | |
| 162 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) |
| 163 | { |
| 164 | /* Only need to override behaviour for slot 0 */ |
| 165 | if (nr == 0) |
| 166 | spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); |
| 167 | else |
| 168 | write_scoop_reg(scoop, SCOOP_CPR, cpr); |
| 169 | } |
| 170 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 171 | static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { |
| 172 | { |
| 173 | .dev = &spitzscoop_device.dev, |
| 174 | .irq = SPITZ_IRQ_GPIO_CF_IRQ, |
| 175 | .cd_irq = SPITZ_IRQ_GPIO_CF_CD, |
| 176 | .cd_irq_str = "PCMCIA0 CD", |
| 177 | },{ |
| 178 | .dev = &spitzscoop2_device.dev, |
| 179 | .irq = SPITZ_IRQ_GPIO_CF2_IRQ, |
| 180 | .cd_irq = -1, |
| 181 | }, |
| 182 | }; |
| 183 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 184 | static struct scoop_pcmcia_config spitz_pcmcia_config = { |
| 185 | .devs = &spitz_pcmcia_scoop[0], |
| 186 | .num_devs = 2, |
| 187 | .pcmcia_init = spitz_pcmcia_init, |
| 188 | .power_ctrl = spitz_pcmcia_pwr, |
| 189 | }; |
| 190 | |
| 191 | EXPORT_SYMBOL(spitzscoop_device); |
| 192 | EXPORT_SYMBOL(spitzscoop2_device); |
| 193 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 194 | |
| 195 | /* |
| 196 | * Spitz SSP Device |
| 197 | * |
| 198 | * Set the parent as the scoop device because a lot of SSP devices |
| 199 | * also use scoop functions and this makes the power up/down order |
| 200 | * work correctly. |
| 201 | */ |
| 202 | struct platform_device spitzssp_device = { |
| 203 | .name = "corgi-ssp", |
| 204 | .dev = { |
| 205 | .parent = &spitzscoop_device.dev, |
| 206 | }, |
| 207 | .id = -1, |
| 208 | }; |
| 209 | |
| 210 | struct corgissp_machinfo spitz_ssp_machinfo = { |
| 211 | .port = 2, |
| 212 | .cs_lcdcon = SPITZ_GPIO_LCDCON_CS, |
| 213 | .cs_ads7846 = SPITZ_GPIO_ADS7846_CS, |
| 214 | .cs_max1111 = SPITZ_GPIO_MAX1111_CS, |
| 215 | .clk_lcdcon = 520, |
| 216 | .clk_ads7846 = 14, |
| 217 | .clk_max1111 = 56, |
| 218 | }; |
| 219 | |
| 220 | |
| 221 | /* |
| 222 | * Spitz Backlight Device |
| 223 | */ |
| 224 | static struct corgibl_machinfo spitz_bl_machinfo = { |
Richard Purdie | 2c0f5fb | 2006-03-31 02:31:51 -0800 | [diff] [blame] | 225 | .default_intensity = 0x1f, |
| 226 | .limit_mask = 0x0b, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 227 | .max_intensity = 0x2f, |
| 228 | }; |
| 229 | |
| 230 | static struct platform_device spitzbl_device = { |
| 231 | .name = "corgi-bl", |
| 232 | .dev = { |
| 233 | .platform_data = &spitz_bl_machinfo, |
| 234 | }, |
| 235 | .id = -1, |
| 236 | }; |
| 237 | |
| 238 | |
| 239 | /* |
| 240 | * Spitz Keyboard Device |
| 241 | */ |
| 242 | static struct platform_device spitzkbd_device = { |
| 243 | .name = "spitz-keyboard", |
| 244 | .id = -1, |
| 245 | }; |
| 246 | |
| 247 | |
| 248 | /* |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 249 | * Spitz LEDs |
| 250 | */ |
| 251 | static struct platform_device spitzled_device = { |
| 252 | .name = "spitz-led", |
| 253 | .id = -1, |
| 254 | }; |
| 255 | |
| 256 | /* |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 257 | * Spitz Touch Screen Device |
| 258 | */ |
| 259 | static struct resource spitzts_resources[] = { |
| 260 | [0] = { |
| 261 | .start = SPITZ_IRQ_GPIO_TP_INT, |
| 262 | .end = SPITZ_IRQ_GPIO_TP_INT, |
| 263 | .flags = IORESOURCE_IRQ, |
| 264 | }, |
| 265 | }; |
| 266 | |
| 267 | static struct corgits_machinfo spitz_ts_machinfo = { |
| 268 | .get_hsync_len = spitz_get_hsync_len, |
| 269 | .put_hsync = spitz_put_hsync, |
| 270 | .wait_hsync = spitz_wait_hsync, |
| 271 | }; |
| 272 | |
| 273 | static struct platform_device spitzts_device = { |
| 274 | .name = "corgi-ts", |
| 275 | .dev = { |
| 276 | .parent = &spitzssp_device.dev, |
| 277 | .platform_data = &spitz_ts_machinfo, |
| 278 | }, |
| 279 | .id = -1, |
| 280 | .num_resources = ARRAY_SIZE(spitzts_resources), |
| 281 | .resource = spitzts_resources, |
| 282 | }; |
| 283 | |
| 284 | |
| 285 | /* |
| 286 | * MMC/SD Device |
| 287 | * |
| 288 | * The card detect interrupt isn't debounced so we delay it by 250ms |
| 289 | * to give the card a chance to fully insert/eject. |
| 290 | */ |
| 291 | |
| 292 | static struct pxamci_platform_data spitz_mci_platform_data; |
| 293 | |
| 294 | static int spitz_mci_init(struct device *dev, irqreturn_t (*spitz_detect_int)(int, void *, struct pt_regs *), void *data) |
| 295 | { |
| 296 | int err; |
| 297 | |
| 298 | /* setup GPIO for PXA27x MMC controller */ |
| 299 | pxa_gpio_mode(GPIO32_MMCCLK_MD); |
| 300 | pxa_gpio_mode(GPIO112_MMCCMD_MD); |
| 301 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); |
| 302 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); |
| 303 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); |
| 304 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); |
| 305 | pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN); |
| 306 | pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN); |
| 307 | |
| 308 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
| 309 | |
Russell King | 9ded96f | 2006-01-08 01:02:07 -0800 | [diff] [blame] | 310 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, |
Thomas Gleixner | 52e405e | 2006-07-03 02:20:05 +0200 | [diff] [blame] | 311 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
Russell King | 9ded96f | 2006-01-08 01:02:07 -0800 | [diff] [blame] | 312 | "MMC card detect", data); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 313 | if (err) { |
| 314 | printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
| 315 | return -1; |
| 316 | } |
| 317 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 318 | return 0; |
| 319 | } |
| 320 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 321 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
| 322 | { |
| 323 | struct pxamci_platform_data* p_d = dev->platform_data; |
| 324 | |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 325 | if (( 1 << vdd) & p_d->ocr_mask) |
| 326 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); |
| 327 | else |
| 328 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | static int spitz_mci_get_ro(struct device *dev) |
| 332 | { |
| 333 | return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP); |
| 334 | } |
| 335 | |
| 336 | static void spitz_mci_exit(struct device *dev, void *data) |
| 337 | { |
| 338 | free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data); |
| 339 | } |
| 340 | |
| 341 | static struct pxamci_platform_data spitz_mci_platform_data = { |
| 342 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 343 | .init = spitz_mci_init, |
| 344 | .get_ro = spitz_mci_get_ro, |
| 345 | .setpower = spitz_mci_setpower, |
| 346 | .exit = spitz_mci_exit, |
| 347 | }; |
| 348 | |
| 349 | |
| 350 | /* |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 351 | * USB Host (OHCI) |
| 352 | */ |
| 353 | static int spitz_ohci_init(struct device *dev) |
| 354 | { |
| 355 | /* Only Port 2 is connected */ |
| 356 | pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN); |
| 357 | pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT); |
| 358 | pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN); |
| 359 | |
| 360 | /* Setup USB Port 2 Output Control Register */ |
| 361 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 362 | |
| 363 | GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST); |
| 364 | |
| 365 | UHCHR = (UHCHR) & |
| 366 | ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); |
| 367 | |
| 368 | UHCRHDA |= UHCRHDA_NOCP; |
| 369 | |
| 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | static struct pxaohci_platform_data spitz_ohci_platform_data = { |
| 374 | .port_mode = PMM_NPS_MODE, |
| 375 | .init = spitz_ohci_init, |
Richard Purdie | 0c27c5d | 2006-06-08 22:44:07 +0100 | [diff] [blame] | 376 | .power_budget = 150, |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 377 | }; |
| 378 | |
| 379 | |
| 380 | /* |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 381 | * Irda |
| 382 | */ |
| 383 | static void spitz_irda_transceiver_mode(struct device *dev, int mode) |
| 384 | { |
| 385 | if (mode & IR_OFF) |
| 386 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); |
| 387 | else |
| 388 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); |
| 389 | } |
| 390 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 391 | #ifdef CONFIG_MACH_AKITA |
| 392 | static void akita_irda_transceiver_mode(struct device *dev, int mode) |
| 393 | { |
| 394 | if (mode & IR_OFF) |
| 395 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); |
| 396 | else |
| 397 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); |
| 398 | } |
| 399 | #endif |
| 400 | |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 401 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
| 402 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
| 403 | .transceiver_mode = spitz_irda_transceiver_mode, |
| 404 | }; |
| 405 | |
| 406 | |
| 407 | /* |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 408 | * Spitz PXA Framebuffer |
| 409 | */ |
| 410 | static struct pxafb_mach_info spitz_pxafb_info __initdata = { |
| 411 | .pixclock = 19231, |
| 412 | .xres = 480, |
| 413 | .yres = 640, |
| 414 | .bpp = 16, |
| 415 | .hsync_len = 40, |
| 416 | .left_margin = 46, |
| 417 | .right_margin = 125, |
| 418 | .vsync_len = 3, |
| 419 | .upper_margin = 1, |
| 420 | .lower_margin = 0, |
| 421 | .sync = 0, |
| 422 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act | LCCR0_LDDALT | LCCR0_OUC | LCCR0_CMDIM | LCCR0_RDSTM, |
| 423 | .lccr3 = LCCR3_PixRsEdg | LCCR3_OutEnH, |
| 424 | .pxafb_lcd_power = spitz_lcd_power, |
| 425 | }; |
| 426 | |
| 427 | |
| 428 | static struct platform_device *devices[] __initdata = { |
| 429 | &spitzscoop_device, |
| 430 | &spitzssp_device, |
| 431 | &spitzkbd_device, |
| 432 | &spitzts_device, |
| 433 | &spitzbl_device, |
Richard Purdie | 3179108 | 2006-03-31 02:31:09 -0800 | [diff] [blame] | 434 | &spitzled_device, |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 435 | }; |
| 436 | |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 437 | static void spitz_poweroff(void) |
| 438 | { |
| 439 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; |
| 440 | |
| 441 | pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT); |
| 442 | GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET); |
| 443 | |
| 444 | mdelay(1000); |
| 445 | arm_machine_restart('h'); |
| 446 | } |
| 447 | |
| 448 | static void spitz_restart(char mode) |
| 449 | { |
| 450 | /* Bootloader magic for a reboot */ |
| 451 | if((MSC0 & 0xffff0000) == 0x7ff00000) |
| 452 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; |
| 453 | |
| 454 | spitz_poweroff(); |
| 455 | } |
| 456 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 457 | static void __init common_init(void) |
| 458 | { |
Richard Purdie | 74617fb | 2006-06-19 19:57:12 +0100 | [diff] [blame] | 459 | pm_power_off = spitz_poweroff; |
| 460 | arm_pm_restart = spitz_restart; |
| 461 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 462 | PMCR = 0x00; |
| 463 | |
| 464 | /* setup sleep mode values */ |
| 465 | PWER = 0x00000002; |
| 466 | PFER = 0x00000000; |
| 467 | PRER = 0x00000002; |
| 468 | PGSR0 = 0x0158C000; |
| 469 | PGSR1 = 0x00FF0080; |
| 470 | PGSR2 = 0x0001C004; |
| 471 | |
| 472 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
| 473 | PCFR |= PCFR_OPDE; |
| 474 | |
| 475 | corgi_ssp_set_machinfo(&spitz_ssp_machinfo); |
| 476 | |
| 477 | pxa_gpio_mode(SPITZ_GPIO_HSYNC | GPIO_IN); |
| 478 | |
| 479 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 480 | pxa_set_mci_info(&spitz_mci_platform_data); |
Richard Purdie | 3125c68 | 2006-01-05 20:44:52 +0000 | [diff] [blame] | 481 | pxa_set_ohci_info(&spitz_ohci_platform_data); |
Richard Purdie | dc07845 | 2005-10-30 14:50:25 +0000 | [diff] [blame] | 482 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
Richard Purdie | cb38c56 | 2005-10-14 16:07:25 +0100 | [diff] [blame] | 483 | set_pxa_fb_parent(&spitzssp_device.dev); |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 484 | set_pxa_fb_info(&spitz_pxafb_info); |
| 485 | } |
| 486 | |
| 487 | static void __init spitz_init(void) |
| 488 | { |
Richard Purdie | a63ae44 | 2005-11-08 19:15:43 +0000 | [diff] [blame] | 489 | platform_scoop_config = &spitz_pcmcia_config; |
| 490 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 491 | spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity; |
| 492 | |
| 493 | common_init(); |
| 494 | |
| 495 | platform_device_register(&spitzscoop2_device); |
| 496 | } |
| 497 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 498 | #ifdef CONFIG_MACH_AKITA |
| 499 | /* |
| 500 | * Akita IO Expander |
| 501 | */ |
| 502 | struct platform_device akitaioexp_device = { |
| 503 | .name = "akita-ioexp", |
| 504 | .id = -1, |
| 505 | }; |
| 506 | |
Richard Purdie | bd8f103 | 2006-03-26 21:40:27 +0100 | [diff] [blame] | 507 | EXPORT_SYMBOL_GPL(akitaioexp_device); |
| 508 | |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 509 | static void __init akita_init(void) |
| 510 | { |
| 511 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; |
| 512 | |
| 513 | /* We just pretend the second element of the array doesn't exist */ |
| 514 | spitz_pcmcia_config.num_devs = 1; |
| 515 | platform_scoop_config = &spitz_pcmcia_config; |
| 516 | spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity; |
| 517 | |
| 518 | platform_device_register(&akitaioexp_device); |
| 519 | |
| 520 | spitzscoop_device.dev.parent = &akitaioexp_device.dev; |
| 521 | common_init(); |
| 522 | } |
| 523 | #endif |
| 524 | |
| 525 | |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 526 | static void __init fixup_spitz(struct machine_desc *desc, |
| 527 | struct tag *tags, char **cmdline, struct meminfo *mi) |
| 528 | { |
| 529 | sharpsl_save_param(); |
| 530 | mi->nr_banks = 1; |
| 531 | mi->bank[0].start = 0xa0000000; |
| 532 | mi->bank[0].node = 0; |
| 533 | mi->bank[0].size = (64*1024*1024); |
| 534 | } |
| 535 | |
| 536 | #ifdef CONFIG_MACH_SPITZ |
| 537 | MACHINE_START(SPITZ, "SHARP Spitz") |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 538 | .phys_io = 0x40000000, |
| 539 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 540 | .fixup = fixup_spitz, |
| 541 | .map_io = pxa_map_io, |
| 542 | .init_irq = pxa_init_irq, |
| 543 | .init_machine = spitz_init, |
| 544 | .timer = &pxa_timer, |
| 545 | MACHINE_END |
| 546 | #endif |
| 547 | |
| 548 | #ifdef CONFIG_MACH_BORZOI |
| 549 | MACHINE_START(BORZOI, "SHARP Borzoi") |
Richard Purdie | 0dd28f1 | 2005-09-13 01:25:34 -0700 | [diff] [blame] | 550 | .phys_io = 0x40000000, |
| 551 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 552 | .fixup = fixup_spitz, |
| 553 | .map_io = pxa_map_io, |
| 554 | .init_irq = pxa_init_irq, |
| 555 | .init_machine = spitz_init, |
| 556 | .timer = &pxa_timer, |
| 557 | MACHINE_END |
| 558 | #endif |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 559 | |
| 560 | #ifdef CONFIG_MACH_AKITA |
| 561 | MACHINE_START(AKITA, "SHARP Akita") |
Richard Purdie | 94cabd0 | 2005-11-12 18:53:48 +0000 | [diff] [blame] | 562 | .phys_io = 0x40000000, |
| 563 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 564 | .fixup = fixup_spitz, |
| 565 | .map_io = pxa_map_io, |
| 566 | .init_irq = pxa_init_irq, |
| 567 | .init_machine = akita_init, |
| 568 | .timer = &pxa_timer, |
| 569 | MACHINE_END |
| 570 | #endif |