Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/trizeps4.c |
| 3 | * |
| 4 | * Support for the Keith und Koep Trizeps4 Module Platform. |
| 5 | * |
| 6 | * Author: Jürgen Schindele |
| 7 | * Created: 20 02, 2006 |
| 8 | * Copyright: Jürgen Schindele |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/sysdev.h> |
| 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/sched.h> |
| 21 | #include <linux/bitops.h> |
| 22 | #include <linux/fb.h> |
| 23 | #include <linux/ioport.h> |
| 24 | #include <linux/delay.h> |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 25 | #include <linux/gpio.h> |
| 26 | #include <linux/dm9000.h> |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 27 | #include <linux/mtd/physmap.h> |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 28 | #include <linux/mtd/partitions.h> |
| 29 | |
| 30 | #include <asm/types.h> |
| 31 | #include <asm/setup.h> |
| 32 | #include <asm/memory.h> |
| 33 | #include <asm/mach-types.h> |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 34 | #include <asm/irq.h> |
| 35 | #include <asm/sizes.h> |
| 36 | |
| 37 | #include <asm/mach/arch.h> |
| 38 | #include <asm/mach/map.h> |
| 39 | #include <asm/mach/irq.h> |
| 40 | #include <asm/mach/flash.h> |
| 41 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 42 | #include <mach/pxa27x.h> |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 43 | #include <mach/pxa2xx_spi.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 44 | #include <mach/trizeps4.h> |
| 45 | #include <mach/audio.h> |
| 46 | #include <mach/pxafb.h> |
| 47 | #include <mach/mmc.h> |
| 48 | #include <mach/irda.h> |
| 49 | #include <mach/ohci.h> |
Eric Miao | f0a8370 | 2009-04-13 15:03:11 +0800 | [diff] [blame] | 50 | #include <plat/i2c.h> |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 51 | |
| 52 | #include "generic.h" |
Russell King | 46c41e6 | 2007-05-15 15:39:36 +0100 | [diff] [blame] | 53 | #include "devices.h" |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 54 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 55 | /* comment out the following line if you want to use the |
| 56 | * Standard UART from PXA for serial / irda transmission |
| 57 | * and acivate it if you have status leds connected */ |
| 58 | #define STATUS_LEDS_ON_STUART_PINS 1 |
| 59 | |
| 60 | /***************************************************************************** |
| 61 | * MultiFunctionPins of CPU |
| 62 | *****************************************************************************/ |
| 63 | static unsigned long trizeps4_pin_config[] __initdata = { |
| 64 | /* Chip Selects */ |
| 65 | GPIO15_nCS_1, /* DiskOnChip CS */ |
| 66 | GPIO93_GPIO, /* TRIZEPS4_DOC_IRQ */ |
| 67 | GPIO94_GPIO, /* DOC lock */ |
| 68 | |
| 69 | GPIO78_nCS_2, /* DM9000 CS */ |
| 70 | GPIO101_GPIO, /* TRIZEPS4_ETH_IRQ */ |
| 71 | |
| 72 | GPIO79_nCS_3, /* Logic CS */ |
| 73 | GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* Logic irq */ |
| 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 | GPIO77_LCD_BIAS, |
| 96 | |
| 97 | /* UART */ |
| 98 | GPIO9_FFUART_CTS, |
| 99 | GPIO10_FFUART_DCD, |
| 100 | GPIO16_FFUART_TXD, |
| 101 | GPIO33_FFUART_DSR, |
| 102 | GPIO38_FFUART_RI, |
| 103 | GPIO82_FFUART_DTR, |
| 104 | GPIO83_FFUART_RTS, |
| 105 | GPIO96_FFUART_RXD, |
| 106 | |
| 107 | GPIO42_BTUART_RXD, |
| 108 | GPIO43_BTUART_TXD, |
| 109 | GPIO44_BTUART_CTS, |
| 110 | GPIO45_BTUART_RTS, |
| 111 | #ifdef STATUS_LEDS_ON_STUART_PINS |
| 112 | GPIO46_GPIO, |
| 113 | GPIO47_GPIO, |
| 114 | #else |
| 115 | GPIO46_STUART_RXD, |
| 116 | GPIO47_STUART_TXD, |
| 117 | #endif |
| 118 | /* PCMCIA */ |
| 119 | GPIO11_GPIO, /* TRIZEPS4_CD_IRQ */ |
| 120 | GPIO13_GPIO, /* TRIZEPS4_READY_NINT */ |
| 121 | GPIO48_nPOE, |
| 122 | GPIO49_nPWE, |
| 123 | GPIO50_nPIOR, |
| 124 | GPIO51_nPIOW, |
| 125 | GPIO54_nPCE_2, |
| 126 | GPIO55_nPREG, |
| 127 | GPIO56_nPWAIT, |
| 128 | GPIO57_nIOIS16, |
| 129 | GPIO102_nPCE_1, |
| 130 | GPIO104_PSKTSEL, |
| 131 | |
| 132 | /* MultiMediaCard */ |
| 133 | GPIO32_MMC_CLK, |
| 134 | GPIO92_MMC_DAT_0, |
| 135 | GPIO109_MMC_DAT_1, |
| 136 | GPIO110_MMC_DAT_2, |
| 137 | GPIO111_MMC_DAT_3, |
| 138 | GPIO112_MMC_CMD, |
| 139 | GPIO12_GPIO, /* TRIZEPS4_MMC_IRQ */ |
| 140 | |
| 141 | /* USB OHCI */ |
| 142 | GPIO88_USBH1_PWR, /* USBHPWR1 */ |
| 143 | GPIO89_USBH1_PEN, /* USBHPEN1 */ |
| 144 | |
| 145 | /* I2C */ |
| 146 | GPIO117_I2C_SCL, |
| 147 | GPIO118_I2C_SDA, |
| 148 | }; |
| 149 | |
| 150 | static unsigned long trizeps4wl_pin_config[] __initdata = { |
| 151 | /* SSP 2 */ |
| 152 | GPIO14_SSP2_SFRM, |
| 153 | GPIO19_SSP2_SCLK, |
| 154 | GPIO53_GPIO, /* TRIZEPS4_SPI_IRQ */ |
| 155 | GPIO86_SSP2_RXD, |
| 156 | GPIO87_SSP2_TXD, |
| 157 | }; |
| 158 | |
| 159 | /**************************************************************************** |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 160 | * ONBOARD FLASH |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 161 | ****************************************************************************/ |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 162 | static struct mtd_partition trizeps4_partitions[] = { |
| 163 | { |
| 164 | .name = "Bootloader", |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 165 | .offset = 0x00000000, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 166 | .size = 0x00040000, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 167 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 168 | }, { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 169 | .name = "Backup", |
| 170 | .offset = 0x00040000, |
| 171 | .size = 0x00040000, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 172 | }, { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 173 | .name = "Image", |
| 174 | .offset = 0x00080000, |
| 175 | .size = 0x01080000, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 176 | }, { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 177 | .name = "IPSM", |
| 178 | .offset = 0x01100000, |
| 179 | .size = 0x00e00000, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 180 | }, { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 181 | .name = "Registry", |
| 182 | .offset = 0x01f00000, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 183 | .size = MTDPART_SIZ_FULL, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 184 | } |
| 185 | }; |
| 186 | |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 187 | static struct physmap_flash_data trizeps4_flash_data[] = { |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 188 | { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 189 | .width = 4, /* bankwidth in bytes */ |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 190 | .parts = trizeps4_partitions, |
| 191 | .nr_parts = ARRAY_SIZE(trizeps4_partitions) |
| 192 | } |
| 193 | }; |
| 194 | |
| 195 | static struct resource flash_resource = { |
| 196 | .start = PXA_CS0_PHYS, |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 197 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 198 | .flags = IORESOURCE_MEM, |
| 199 | }; |
| 200 | |
| 201 | static struct platform_device flash_device = { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 202 | .name = "physmap-flash", |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 203 | .id = 0, |
| 204 | .dev = { |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 205 | .platform_data = trizeps4_flash_data, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 206 | }, |
| 207 | .resource = &flash_resource, |
| 208 | .num_resources = 1, |
| 209 | }; |
| 210 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 211 | /**************************************************************************** |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 212 | * DAVICOM DM9000 Ethernet |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 213 | ****************************************************************************/ |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 214 | static struct resource dm9000_resources[] = { |
| 215 | [0] = { |
| 216 | .start = TRIZEPS4_ETH_PHYS+0x300, |
| 217 | .end = TRIZEPS4_ETH_PHYS+0x400-1, |
| 218 | .flags = IORESOURCE_MEM, |
| 219 | }, |
| 220 | [1] = { |
| 221 | .start = TRIZEPS4_ETH_PHYS+0x8300, |
| 222 | .end = TRIZEPS4_ETH_PHYS+0x8400-1, |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }, |
| 225 | [2] = { |
| 226 | .start = TRIZEPS4_ETH_IRQ, |
| 227 | .end = TRIZEPS4_ETH_IRQ, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 228 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 229 | }, |
| 230 | }; |
| 231 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 232 | static struct dm9000_plat_data tri_dm9000_platdata = { |
| 233 | .flags = DM9000_PLATF_32BITONLY, |
| 234 | }; |
| 235 | |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 236 | static struct platform_device dm9000_device = { |
| 237 | .name = "dm9000", |
| 238 | .id = -1, |
| 239 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 240 | .resource = dm9000_resources, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 241 | .dev = { |
| 242 | .platform_data = &tri_dm9000_platdata, |
| 243 | } |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 244 | }; |
| 245 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 246 | /**************************************************************************** |
| 247 | * LED's on GPIO pins of PXA |
| 248 | ****************************************************************************/ |
| 249 | static struct gpio_led trizeps4_led[] = { |
| 250 | #ifdef STATUS_LEDS_ON_STUART_PINS |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 251 | { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 252 | .name = "led0:orange:heartbeat", /* */ |
| 253 | .default_trigger = "heartbeat", |
| 254 | .gpio = GPIO_HEARTBEAT_LED, |
| 255 | .active_low = 1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 256 | }, |
| 257 | { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 258 | .name = "led1:yellow:cpubusy", /* */ |
| 259 | .default_trigger = "cpu-busy", |
| 260 | .gpio = GPIO_SYS_BUSY_LED, |
| 261 | .active_low = 1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 262 | }, |
| 263 | #endif |
| 264 | }; |
| 265 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 266 | static struct gpio_led_platform_data trizeps4_led_data = { |
| 267 | .leds = trizeps4_led, |
| 268 | .num_leds = ARRAY_SIZE(trizeps4_led), |
| 269 | }; |
| 270 | |
| 271 | static struct platform_device leds_devices = { |
| 272 | .name = "leds-gpio", |
| 273 | .id = -1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 274 | .dev = { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 275 | .platform_data = &trizeps4_led_data, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 276 | }, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 277 | }; |
| 278 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 279 | static struct platform_device *trizeps4_devices[] __initdata = { |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 280 | &flash_device, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 281 | &dm9000_device, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 282 | &leds_devices, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 283 | }; |
| 284 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 285 | static struct platform_device *trizeps4wl_devices[] __initdata = { |
| 286 | &flash_device, |
| 287 | &leds_devices, |
| 288 | }; |
| 289 | |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 290 | static short trizeps_conxs_bcr; |
| 291 | |
| 292 | /* PCCARD power switching supports only 3,3V */ |
| 293 | void board_pcmcia_power(int power) |
| 294 | { |
| 295 | if (power) { |
| 296 | /* switch power on, put in reset and enable buffers */ |
| 297 | trizeps_conxs_bcr |= power; |
| 298 | trizeps_conxs_bcr |= ConXS_BCR_CF_RESET; |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 299 | trizeps_conxs_bcr &= ~ConXS_BCR_CF_BUF_EN; |
| 300 | BCR_writew(trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 301 | /* wait a little */ |
| 302 | udelay(2000); |
| 303 | /* take reset away */ |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 304 | trizeps_conxs_bcr &= ~ConXS_BCR_CF_RESET; |
| 305 | BCR_writew(trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 306 | udelay(2000); |
| 307 | } else { |
| 308 | /* put in reset */ |
| 309 | trizeps_conxs_bcr |= ConXS_BCR_CF_RESET; |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 310 | BCR_writew(trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 311 | udelay(1000); |
| 312 | /* switch power off */ |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 313 | trizeps_conxs_bcr &= ~0xf; |
| 314 | BCR_writew(trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 315 | } |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 316 | pr_debug("%s: o%s 0x%x\n", __func__, power ? "n" : "ff", |
| 317 | trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 318 | } |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 319 | EXPORT_SYMBOL(board_pcmcia_power); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 320 | |
| 321 | /* backlight power switching for LCD panel */ |
| 322 | static void board_backlight_power(int on) |
| 323 | { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 324 | if (on) |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 325 | trizeps_conxs_bcr |= ConXS_BCR_L_DISP; |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 326 | else |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 327 | trizeps_conxs_bcr &= ~ConXS_BCR_L_DISP; |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 328 | |
| 329 | pr_debug("%s: o%s 0x%x\n", __func__, on ? "n" : "ff", |
| 330 | trizeps_conxs_bcr); |
| 331 | BCR_writew(trizeps_conxs_bcr); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 332 | } |
| 333 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 334 | /* a I2C based RTC is known on CONXS board */ |
| 335 | static struct i2c_board_info trizeps4_i2c_devices[] __initdata = { |
| 336 | { I2C_BOARD_INFO("rtc-pcf8593", 0x51) } |
| 337 | }; |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 338 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 339 | /**************************************************************************** |
| 340 | * MMC card slot external to module |
| 341 | ****************************************************************************/ |
| 342 | static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int, |
| 343 | void *data) |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 344 | { |
| 345 | int err; |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 346 | |
Thomas Gleixner | 52e405e | 2006-07-03 02:20:05 +0200 | [diff] [blame] | 347 | err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 348 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_SAMPLE_RANDOM, |
| 349 | "MMC card detect", data); |
| 350 | if (err) { |
| 351 | printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request" |
| 352 | "MMC card detect IRQ\n"); |
| 353 | return -1; |
| 354 | } |
| 355 | return 0; |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | static void trizeps4_mci_exit(struct device *dev, void *data) |
| 359 | { |
| 360 | free_irq(TRIZEPS4_MMC_IRQ, data); |
| 361 | } |
| 362 | |
| 363 | static struct pxamci_platform_data trizeps4_mci_platform_data = { |
| 364 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 365 | .detect_delay = 1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 366 | .init = trizeps4_mci_init, |
| 367 | .exit = trizeps4_mci_exit, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 368 | .get_ro = NULL, /* write-protection not supported */ |
| 369 | .setpower = NULL, /* power-switching not supported */ |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 370 | .gpio_card_detect = -1, |
| 371 | .gpio_card_ro = -1, |
| 372 | .gpio_power = -1, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 373 | }; |
| 374 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 375 | /**************************************************************************** |
| 376 | * IRDA mode switching on stuart |
| 377 | ****************************************************************************/ |
| 378 | #ifndef STATUS_LEDS_ON_STUART_PINS |
| 379 | static short trizeps_conxs_ircr; |
| 380 | |
| 381 | static int trizeps4_irda_startup(struct device *dev) |
| 382 | { |
| 383 | trizeps_conxs_ircr &= ~ConXS_IRCR_SD; |
| 384 | IRCR_writew(trizeps_conxs_ircr); |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | static void trizeps4_irda_shutdown(struct device *dev) |
| 389 | { |
| 390 | trizeps_conxs_ircr |= ConXS_IRCR_SD; |
| 391 | IRCR_writew(trizeps_conxs_ircr); |
| 392 | } |
| 393 | |
| 394 | static void trizeps4_irda_transceiver_mode(struct device *dev, int mode) |
| 395 | { |
| 396 | unsigned long flags; |
| 397 | |
| 398 | local_irq_save(flags); |
| 399 | /* Switch mode */ |
| 400 | if (mode & IR_SIRMODE) |
| 401 | trizeps_conxs_ircr &= ~ConXS_IRCR_MODE; /* Slow mode */ |
Mariusz Kozlowski | 778c4c8 | 2008-10-18 15:15:16 +0200 | [diff] [blame] | 402 | else if (mode & IR_FIRMODE) |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 403 | trizeps_conxs_ircr |= ConXS_IRCR_MODE; /* Fast mode */ |
| 404 | |
| 405 | /* Switch power */ |
| 406 | if (mode & IR_OFF) |
| 407 | trizeps_conxs_ircr |= ConXS_IRCR_SD; |
| 408 | else |
| 409 | trizeps_conxs_ircr &= ~ConXS_IRCR_SD; |
| 410 | |
| 411 | IRCR_writew(trizeps_conxs_ircr); |
| 412 | local_irq_restore(flags); |
| 413 | |
| 414 | pxa2xx_transceiver_mode(dev, mode); |
| 415 | } |
| 416 | |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 417 | static struct pxaficp_platform_data trizeps4_ficp_platform_data = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 418 | .gpio_pwdown = -1, |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 419 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, |
| 420 | .transceiver_mode = trizeps4_irda_transceiver_mode, |
| 421 | .startup = trizeps4_irda_startup, |
| 422 | .shutdown = trizeps4_irda_shutdown, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 423 | }; |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 424 | #endif |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 425 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 426 | /**************************************************************************** |
| 427 | * OHCI USB port |
| 428 | ****************************************************************************/ |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 429 | static struct pxaohci_platform_data trizeps4_ohci_platform_data = { |
| 430 | .port_mode = PMM_PERPORT_MODE, |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 431 | .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | static struct map_desc trizeps4_io_desc[] __initdata = { |
| 435 | { /* ConXS CFSR */ |
| 436 | .virtual = TRIZEPS4_CFSR_VIRT, |
| 437 | .pfn = __phys_to_pfn(TRIZEPS4_CFSR_PHYS), |
| 438 | .length = 0x00001000, |
| 439 | .type = MT_DEVICE |
| 440 | }, |
| 441 | { /* ConXS BCR */ |
| 442 | .virtual = TRIZEPS4_BOCR_VIRT, |
| 443 | .pfn = __phys_to_pfn(TRIZEPS4_BOCR_PHYS), |
| 444 | .length = 0x00001000, |
| 445 | .type = MT_DEVICE |
| 446 | }, |
| 447 | { /* ConXS IRCR */ |
| 448 | .virtual = TRIZEPS4_IRCR_VIRT, |
| 449 | .pfn = __phys_to_pfn(TRIZEPS4_IRCR_PHYS), |
| 450 | .length = 0x00001000, |
| 451 | .type = MT_DEVICE |
| 452 | }, |
| 453 | { /* ConXS DCR */ |
| 454 | .virtual = TRIZEPS4_DICR_VIRT, |
| 455 | .pfn = __phys_to_pfn(TRIZEPS4_DICR_PHYS), |
| 456 | .length = 0x00001000, |
| 457 | .type = MT_DEVICE |
| 458 | }, |
| 459 | { /* ConXS UPSR */ |
| 460 | .virtual = TRIZEPS4_UPSR_VIRT, |
| 461 | .pfn = __phys_to_pfn(TRIZEPS4_UPSR_PHYS), |
| 462 | .length = 0x00001000, |
| 463 | .type = MT_DEVICE |
| 464 | } |
| 465 | }; |
| 466 | |
Richard Purdie | d14b272 | 2006-09-20 22:54:21 +0100 | [diff] [blame] | 467 | static struct pxafb_mode_info sharp_lcd_mode = { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 468 | .pixclock = 78000, |
| 469 | .xres = 640, |
| 470 | .yres = 480, |
| 471 | .bpp = 8, |
| 472 | .hsync_len = 4, |
| 473 | .left_margin = 4, |
| 474 | .right_margin = 4, |
| 475 | .vsync_len = 2, |
| 476 | .upper_margin = 0, |
| 477 | .lower_margin = 0, |
| 478 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 479 | .cmap_greyscale = 0, |
Richard Purdie | d14b272 | 2006-09-20 22:54:21 +0100 | [diff] [blame] | 480 | }; |
| 481 | |
| 482 | static struct pxafb_mach_info sharp_lcd = { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 483 | .modes = &sharp_lcd_mode, |
| 484 | .num_modes = 1, |
| 485 | .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL, |
| 486 | .cmap_inverse = 0, |
| 487 | .cmap_static = 0, |
| 488 | .pxafb_backlight_power = board_backlight_power, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 489 | }; |
| 490 | |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 491 | static struct pxafb_mode_info toshiba_lcd_mode = { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 492 | .pixclock = 39720, |
| 493 | .xres = 640, |
| 494 | .yres = 480, |
| 495 | .bpp = 8, |
| 496 | .hsync_len = 63, |
| 497 | .left_margin = 12, |
| 498 | .right_margin = 12, |
| 499 | .vsync_len = 4, |
| 500 | .upper_margin = 32, |
| 501 | .lower_margin = 10, |
| 502 | .sync = 0, |
| 503 | .cmap_greyscale = 0, |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 504 | }; |
| 505 | |
| 506 | static struct pxafb_mach_info toshiba_lcd = { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 507 | .modes = &toshiba_lcd_mode, |
| 508 | .num_modes = 1, |
| 509 | .lcd_conn = (LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL), |
| 510 | .cmap_inverse = 0, |
| 511 | .cmap_static = 0, |
| 512 | .pxafb_backlight_power = board_backlight_power, |
Jürgen Schindele | c9184f5 | 2007-05-07 19:48:44 +0100 | [diff] [blame] | 513 | }; |
| 514 | |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 515 | static void __init trizeps4_init(void) |
| 516 | { |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 517 | pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4_pin_config)); |
| 518 | if (machine_is_trizeps4wl()) { |
| 519 | pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4wl_pin_config)); |
| 520 | platform_add_devices(trizeps4wl_devices, |
| 521 | ARRAY_SIZE(trizeps4wl_devices)); |
| 522 | } else { |
| 523 | platform_add_devices(trizeps4_devices, |
| 524 | ARRAY_SIZE(trizeps4_devices)); |
| 525 | } |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 526 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 527 | pxa_set_ffuart_info(NULL); |
| 528 | pxa_set_btuart_info(NULL); |
| 529 | pxa_set_stuart_info(NULL); |
| 530 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 531 | if (0) /* dont know how to determine LCD */ |
| 532 | set_pxa_fb_info(&sharp_lcd); |
| 533 | else |
| 534 | set_pxa_fb_info(&toshiba_lcd); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 535 | |
| 536 | pxa_set_mci_info(&trizeps4_mci_platform_data); |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 537 | #ifndef STATUS_LEDS_ON_STUART_PINS |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 538 | pxa_set_ficp_info(&trizeps4_ficp_platform_data); |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 539 | #endif |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 540 | pxa_set_ohci_info(&trizeps4_ohci_platform_data); |
Mark Brown | 9f19d63 | 2008-06-10 12:30:05 +0100 | [diff] [blame] | 541 | pxa_set_ac97_info(NULL); |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 542 | pxa_set_i2c_info(NULL); |
| 543 | i2c_register_board_info(0, trizeps4_i2c_devices, |
| 544 | ARRAY_SIZE(trizeps4_i2c_devices)); |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 545 | |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 546 | #ifdef CONFIG_IDE_PXA_CF |
| 547 | /* if boot direct from compact flash dont disable power */ |
| 548 | trizeps_conxs_bcr = 0x0009; |
| 549 | #else |
| 550 | /* this is the reset value */ |
| 551 | trizeps_conxs_bcr = 0x00A0; |
| 552 | #endif |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 553 | BCR_writew(trizeps_conxs_bcr); |
| 554 | board_backlight_power(1); |
| 555 | } |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 556 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 557 | static void __init trizeps4_map_io(void) |
| 558 | { |
| 559 | pxa_map_io(); |
| 560 | iotable_init(trizeps4_io_desc, ARRAY_SIZE(trizeps4_io_desc)); |
| 561 | |
| 562 | if ((MSC0 & 0x8) && (BOOT_DEF & 0x1)) { |
| 563 | /* if flash is 16 bit wide its a Trizeps4 WL */ |
| 564 | __machine_arch_type = MACH_TYPE_TRIZEPS4WL; |
| 565 | trizeps4_flash_data[0].width = 2; |
| 566 | } else { |
| 567 | /* if flash is 32 bit wide its a Trizeps4 */ |
| 568 | __machine_arch_type = MACH_TYPE_TRIZEPS4; |
| 569 | trizeps4_flash_data[0].width = 4; |
| 570 | } |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module") |
| 574 | /* MAINTAINER("Jürgen Schindele") */ |
| 575 | .phys_io = 0x40000000, |
| 576 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 577 | .boot_params = TRIZEPS4_SDRAM_BASE + 0x100, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 578 | .init_machine = trizeps4_init, |
| 579 | .map_io = trizeps4_map_io, |
Eric Miao | cd49104 | 2007-06-22 04:14:09 +0100 | [diff] [blame] | 580 | .init_irq = pxa27x_init_irq, |
Jürgen Schindele | 326764a | 2006-06-29 16:01:43 +0100 | [diff] [blame] | 581 | .timer = &pxa_timer, |
| 582 | MACHINE_END |
| 583 | |
Jürgen Schindele | 642aa66 | 2008-08-18 21:45:03 +0100 | [diff] [blame] | 584 | MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module") |
| 585 | /* MAINTAINER("Jürgen Schindele") */ |
| 586 | .phys_io = 0x40000000, |
| 587 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 588 | .boot_params = TRIZEPS4_SDRAM_BASE + 0x100, |
| 589 | .init_machine = trizeps4_init, |
| 590 | .map_io = trizeps4_map_io, |
| 591 | .init_irq = pxa27x_init_irq, |
| 592 | .timer = &pxa_timer, |
| 593 | MACHINE_END |