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