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