Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 1 | /* |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-pxa/colibri-pxa270.c |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 3 | * |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 4 | * Support for Toradex PXA270 based Colibri module |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 5 | * Daniel Mack <daniel@caiaq.de> |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 6 | * Marek Vasut <marek.vasut@gmail.com> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/sysdev.h> |
| 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/bitops.h> |
| 19 | #include <linux/ioport.h> |
| 20 | #include <linux/delay.h> |
| 21 | #include <linux/mtd/mtd.h> |
| 22 | #include <linux/mtd/partitions.h> |
| 23 | #include <linux/mtd/physmap.h> |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 24 | #include <linux/gpio.h> |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame^] | 25 | #include <linux/ucb1400.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 26 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/hardware.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 28 | #include <asm/irq.h> |
| 29 | #include <asm/sizes.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/map.h> |
| 32 | #include <asm/mach/irq.h> |
| 33 | #include <asm/mach/flash.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 34 | |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame^] | 35 | #include <mach/audio.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 36 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 37 | #include <mach/colibri.h> |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 38 | #include <mach/mmc.h> |
Marek Vasut | 8f14619 | 2010-05-22 00:29:36 +0200 | [diff] [blame] | 39 | #include <mach/ohci.h> |
| 40 | #include <mach/pxa27x-udc.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 41 | |
| 42 | #include "generic.h" |
| 43 | #include "devices.h" |
| 44 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 45 | /****************************************************************************** |
| 46 | * Pin configuration |
| 47 | ******************************************************************************/ |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 48 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 49 | /* Ethernet */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 50 | GPIO78_nCS_2, /* Ethernet CS */ |
| 51 | GPIO114_GPIO, /* Ethernet IRQ */ |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 52 | |
| 53 | /* MMC */ |
| 54 | GPIO32_MMC_CLK, |
| 55 | GPIO92_MMC_DAT_0, |
| 56 | GPIO109_MMC_DAT_1, |
| 57 | GPIO110_MMC_DAT_2, |
| 58 | GPIO111_MMC_DAT_3, |
| 59 | GPIO112_MMC_CMD, |
| 60 | GPIO0_GPIO, /* SD detect */ |
Marek Vasut | 12d9420 | 2010-05-22 00:29:35 +0200 | [diff] [blame] | 61 | |
| 62 | /* FFUART */ |
| 63 | GPIO39_FFUART_TXD, |
| 64 | GPIO34_FFUART_RXD, |
Marek Vasut | 8f14619 | 2010-05-22 00:29:36 +0200 | [diff] [blame] | 65 | |
| 66 | /* UHC */ |
| 67 | GPIO88_USBH1_PWR, |
| 68 | GPIO89_USBH1_PEN, |
| 69 | GPIO119_USBH2_PWR, |
| 70 | GPIO120_USBH2_PEN, |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame^] | 71 | |
| 72 | /* AC97 */ |
| 73 | GPIO28_AC97_BITCLK, |
| 74 | GPIO29_AC97_SDATA_IN_0, |
| 75 | GPIO30_AC97_SDATA_OUT, |
| 76 | GPIO31_AC97_SYNC, |
| 77 | GPIO95_AC97_nRESET, |
| 78 | GPIO98_AC97_SYSCLK, |
| 79 | GPIO113_GPIO, /* Touchscreen IRQ */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 80 | }; |
| 81 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 82 | /****************************************************************************** |
| 83 | * NOR Flash |
| 84 | ******************************************************************************/ |
| 85 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 86 | static struct mtd_partition colibri_partitions[] = { |
| 87 | { |
| 88 | .name = "Bootloader", |
| 89 | .offset = 0x00000000, |
| 90 | .size = 0x00040000, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 91 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 92 | }, { |
| 93 | .name = "Kernel", |
| 94 | .offset = 0x00040000, |
| 95 | .size = 0x00400000, |
| 96 | .mask_flags = 0 |
| 97 | }, { |
| 98 | .name = "Rootfs", |
| 99 | .offset = 0x00440000, |
| 100 | .size = MTDPART_SIZ_FULL, |
| 101 | .mask_flags = 0 |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | static struct physmap_flash_data colibri_flash_data[] = { |
| 106 | { |
| 107 | .width = 4, /* bankwidth in bytes */ |
| 108 | .parts = colibri_partitions, |
| 109 | .nr_parts = ARRAY_SIZE(colibri_partitions) |
| 110 | } |
| 111 | }; |
| 112 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 113 | static struct resource colibri_pxa270_flash_resource = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 114 | .start = PXA_CS0_PHYS, |
| 115 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 116 | .flags = IORESOURCE_MEM, |
| 117 | }; |
| 118 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 119 | static struct platform_device colibri_pxa270_flash_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 120 | .name = "physmap-flash", |
| 121 | .id = 0, |
| 122 | .dev = { |
| 123 | .platform_data = colibri_flash_data, |
| 124 | }, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 125 | .resource = &colibri_pxa270_flash_resource, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 126 | .num_resources = 1, |
| 127 | }; |
| 128 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 129 | static void __init colibri_pxa270_nor_init(void) |
| 130 | { |
| 131 | platform_device_register(&colibri_pxa270_flash_device); |
| 132 | } |
| 133 | #else |
| 134 | static inline void colibri_pxa270_nor_init(void) {} |
| 135 | #endif |
| 136 | |
| 137 | /****************************************************************************** |
| 138 | * Ethernet |
| 139 | ******************************************************************************/ |
| 140 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 141 | static struct resource colibri_pxa270_dm9000_resources[] = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 142 | [0] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 143 | .start = PXA_CS2_PHYS, |
| 144 | .end = PXA_CS2_PHYS + 3, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 145 | .flags = IORESOURCE_MEM, |
| 146 | }, |
| 147 | [1] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 148 | .start = PXA_CS2_PHYS + 4, |
| 149 | .end = PXA_CS2_PHYS + 4 + 500, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 150 | .flags = IORESOURCE_MEM, |
| 151 | }, |
| 152 | [2] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 153 | .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
| 154 | .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
Michael Abbott | d0afc85 | 2008-05-14 16:29:24 -0700 | [diff] [blame] | 155 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 156 | }, |
| 157 | }; |
| 158 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 159 | static struct platform_device colibri_pxa270_dm9000_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 160 | .name = "dm9000", |
| 161 | .id = -1, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 162 | .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources), |
| 163 | .resource = colibri_pxa270_dm9000_resources, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 164 | }; |
| 165 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 166 | static void __init colibri_pxa270_eth_init(void) |
| 167 | { |
| 168 | platform_device_register(&colibri_pxa270_dm9000_device); |
| 169 | } |
| 170 | #else |
| 171 | static inline void colibri_pxa270_eth_init(void) {} |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 172 | #endif |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 173 | |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 174 | /****************************************************************************** |
| 175 | * SD/MMC card controller |
| 176 | ******************************************************************************/ |
| 177 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 178 | static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { |
| 179 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 180 | .gpio_power = -1, |
| 181 | .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT, |
| 182 | .gpio_card_ro = -1, |
| 183 | .detect_delay_ms = 200, |
| 184 | }; |
| 185 | |
| 186 | static void __init colibri_pxa270_mmc_init(void) |
| 187 | { |
| 188 | pxa_set_mci_info(&colibri_pxa270_mci_platform_data); |
| 189 | } |
| 190 | #else |
| 191 | static inline void colibri_pxa270_mmc_init(void) {} |
| 192 | #endif |
| 193 | |
Marek Vasut | 8f14619 | 2010-05-22 00:29:36 +0200 | [diff] [blame] | 194 | /****************************************************************************** |
| 195 | * USB Host |
| 196 | ******************************************************************************/ |
| 197 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
| 198 | static int colibri_pxa270_ohci_init(struct device *dev) |
| 199 | { |
| 200 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 201 | return 0; |
| 202 | } |
| 203 | |
| 204 | static struct pxaohci_platform_data colibri_pxa270_ohci_info = { |
| 205 | .port_mode = PMM_PERPORT_MODE, |
| 206 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | |
| 207 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 208 | .init = colibri_pxa270_ohci_init, |
| 209 | }; |
| 210 | |
| 211 | static void __init colibri_pxa270_uhc_init(void) |
| 212 | { |
| 213 | pxa_set_ohci_info(&colibri_pxa270_ohci_info); |
| 214 | } |
| 215 | #else |
| 216 | static inline void colibri_pxa270_uhc_init(void) {} |
| 217 | #endif |
| 218 | |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame^] | 219 | /****************************************************************************** |
| 220 | * Audio and Touchscreen |
| 221 | ******************************************************************************/ |
| 222 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 223 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
| 224 | static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = { |
| 225 | .reset_gpio = 95, |
| 226 | }; |
| 227 | |
| 228 | static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = { |
| 229 | .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ), |
| 230 | }; |
| 231 | |
| 232 | static struct platform_device colibri_pxa270_ucb1400_device = { |
| 233 | .name = "ucb1400_core", |
| 234 | .id = -1, |
| 235 | .dev = { |
| 236 | .platform_data = &colibri_pxa270_ucb1400_pdata, |
| 237 | }, |
| 238 | }; |
| 239 | |
| 240 | static void __init colibri_pxa270_tsc_init(void) |
| 241 | { |
| 242 | pxa_set_ac97_info(&colibri_pxa270_ac97_pdata); |
| 243 | platform_device_register(&colibri_pxa270_ucb1400_device); |
| 244 | } |
| 245 | #else |
| 246 | static inline void colibri_pxa270_tsc_init(void) {} |
| 247 | #endif |
| 248 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 249 | static void __init colibri_pxa270_init(void) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 250 | { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 251 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 252 | pxa_set_ffuart_info(NULL); |
| 253 | pxa_set_btuart_info(NULL); |
| 254 | pxa_set_stuart_info(NULL); |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 255 | |
| 256 | colibri_pxa270_nor_init(); |
| 257 | colibri_pxa270_eth_init(); |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 258 | colibri_pxa270_mmc_init(); |
Marek Vasut | 8f14619 | 2010-05-22 00:29:36 +0200 | [diff] [blame] | 259 | colibri_pxa270_uhc_init(); |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame^] | 260 | colibri_pxa270_tsc_init(); |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 261 | } |
| 262 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 263 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 264 | .phys_io = 0x40000000, |
| 265 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 266 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 267 | .init_machine = colibri_pxa270_init, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 268 | .map_io = pxa_map_io, |
| 269 | .init_irq = pxa27x_init_irq, |
| 270 | .timer = &pxa_timer, |
| 271 | MACHINE_END |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 272 | |