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