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