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