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> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 14 | #include <linux/interrupt.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 15 | #include <linux/kernel.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 16 | #include <linux/mtd/mtd.h> |
| 17 | #include <linux/mtd/partitions.h> |
| 18 | #include <linux/mtd/physmap.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/sysdev.h> |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame] | 21 | #include <linux/ucb1400.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 22 | |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 23 | #include <asm/mach/arch.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 24 | #include <asm/mach/flash.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/sizes.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 27 | |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame] | 28 | #include <mach/audio.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 29 | #include <mach/colibri.h> |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 30 | #include <mach/pxa27x.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 31 | |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 32 | #include "devices.h" |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 33 | #include "generic.h" |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 34 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 35 | /****************************************************************************** |
| 36 | * Pin configuration |
| 37 | ******************************************************************************/ |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 38 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 39 | /* Ethernet */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 40 | GPIO78_nCS_2, /* Ethernet CS */ |
| 41 | GPIO114_GPIO, /* Ethernet IRQ */ |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 42 | |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame] | 43 | /* AC97 */ |
| 44 | GPIO28_AC97_BITCLK, |
| 45 | GPIO29_AC97_SDATA_IN_0, |
| 46 | GPIO30_AC97_SDATA_OUT, |
| 47 | GPIO31_AC97_SYNC, |
| 48 | GPIO95_AC97_nRESET, |
| 49 | GPIO98_AC97_SYSCLK, |
| 50 | GPIO113_GPIO, /* Touchscreen IRQ */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 51 | }; |
| 52 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 53 | /****************************************************************************** |
| 54 | * NOR Flash |
| 55 | ******************************************************************************/ |
| 56 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 57 | static struct mtd_partition colibri_partitions[] = { |
| 58 | { |
| 59 | .name = "Bootloader", |
| 60 | .offset = 0x00000000, |
| 61 | .size = 0x00040000, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 62 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 63 | }, { |
| 64 | .name = "Kernel", |
| 65 | .offset = 0x00040000, |
| 66 | .size = 0x00400000, |
| 67 | .mask_flags = 0 |
| 68 | }, { |
| 69 | .name = "Rootfs", |
| 70 | .offset = 0x00440000, |
| 71 | .size = MTDPART_SIZ_FULL, |
| 72 | .mask_flags = 0 |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | static struct physmap_flash_data colibri_flash_data[] = { |
| 77 | { |
| 78 | .width = 4, /* bankwidth in bytes */ |
| 79 | .parts = colibri_partitions, |
| 80 | .nr_parts = ARRAY_SIZE(colibri_partitions) |
| 81 | } |
| 82 | }; |
| 83 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 84 | static struct resource colibri_pxa270_flash_resource = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 85 | .start = PXA_CS0_PHYS, |
| 86 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 87 | .flags = IORESOURCE_MEM, |
| 88 | }; |
| 89 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 90 | static struct platform_device colibri_pxa270_flash_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 91 | .name = "physmap-flash", |
| 92 | .id = 0, |
| 93 | .dev = { |
| 94 | .platform_data = colibri_flash_data, |
| 95 | }, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 96 | .resource = &colibri_pxa270_flash_resource, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 97 | .num_resources = 1, |
| 98 | }; |
| 99 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 100 | static void __init colibri_pxa270_nor_init(void) |
| 101 | { |
| 102 | platform_device_register(&colibri_pxa270_flash_device); |
| 103 | } |
| 104 | #else |
| 105 | static inline void colibri_pxa270_nor_init(void) {} |
| 106 | #endif |
| 107 | |
| 108 | /****************************************************************************** |
| 109 | * Ethernet |
| 110 | ******************************************************************************/ |
| 111 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 112 | static struct resource colibri_pxa270_dm9000_resources[] = { |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 113 | { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 114 | .start = PXA_CS2_PHYS, |
| 115 | .end = PXA_CS2_PHYS + 3, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 116 | .flags = IORESOURCE_MEM, |
| 117 | }, |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 118 | { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 119 | .start = PXA_CS2_PHYS + 4, |
| 120 | .end = PXA_CS2_PHYS + 4 + 500, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 121 | .flags = IORESOURCE_MEM, |
| 122 | }, |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 123 | { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 124 | .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
| 125 | .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
Michael Abbott | d0afc85 | 2008-05-14 16:29:24 -0700 | [diff] [blame] | 126 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 127 | }, |
| 128 | }; |
| 129 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 130 | static struct platform_device colibri_pxa270_dm9000_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 131 | .name = "dm9000", |
| 132 | .id = -1, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 133 | .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources), |
| 134 | .resource = colibri_pxa270_dm9000_resources, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 135 | }; |
| 136 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 137 | static void __init colibri_pxa270_eth_init(void) |
| 138 | { |
| 139 | platform_device_register(&colibri_pxa270_dm9000_device); |
| 140 | } |
| 141 | #else |
| 142 | static inline void colibri_pxa270_eth_init(void) {} |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 143 | #endif |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 144 | |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 145 | /****************************************************************************** |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame] | 146 | * Audio and Touchscreen |
| 147 | ******************************************************************************/ |
| 148 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 149 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
| 150 | static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = { |
| 151 | .reset_gpio = 95, |
| 152 | }; |
| 153 | |
| 154 | static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = { |
| 155 | .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ), |
| 156 | }; |
| 157 | |
| 158 | static struct platform_device colibri_pxa270_ucb1400_device = { |
| 159 | .name = "ucb1400_core", |
| 160 | .id = -1, |
| 161 | .dev = { |
| 162 | .platform_data = &colibri_pxa270_ucb1400_pdata, |
| 163 | }, |
| 164 | }; |
| 165 | |
| 166 | static void __init colibri_pxa270_tsc_init(void) |
| 167 | { |
| 168 | pxa_set_ac97_info(&colibri_pxa270_ac97_pdata); |
| 169 | platform_device_register(&colibri_pxa270_ucb1400_device); |
| 170 | } |
| 171 | #else |
| 172 | static inline void colibri_pxa270_tsc_init(void) {} |
| 173 | #endif |
| 174 | |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 175 | static int colibri_pxa270_baseboard; |
| 176 | core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444); |
| 177 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 178 | static void __init colibri_pxa270_init(void) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 179 | { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 180 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 181 | |
| 182 | colibri_pxa270_nor_init(); |
| 183 | colibri_pxa270_eth_init(); |
Marek Vasut | 7cca84a | 2010-05-22 00:29:37 +0200 | [diff] [blame] | 184 | colibri_pxa270_tsc_init(); |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 185 | |
| 186 | switch (colibri_pxa270_baseboard) { |
| 187 | case COLIBRI_PXA270_EVALBOARD: |
| 188 | colibri_pxa270_evalboard_init(); |
| 189 | break; |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 190 | case COLIBRI_PXA270_INCOME: |
| 191 | colibri_pxa270_income_boardinit(); |
| 192 | break; |
Daniel Mack | 4c243c8 | 2010-05-22 00:29:38 +0200 | [diff] [blame] | 193 | default: |
| 194 | printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", |
| 195 | colibri_pxa270_baseboard); |
| 196 | } |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 197 | } |
| 198 | |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 199 | /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either |
| 200 | * with the INCOME mach type or with COLIBRI and the kernel parameter |
| 201 | * "colibri_pxa270_baseboard=1" |
| 202 | */ |
| 203 | static void __init colibri_pxa270_income_init(void) |
| 204 | { |
| 205 | colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME; |
| 206 | colibri_pxa270_init(); |
| 207 | } |
| 208 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 209 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 210 | .phys_io = 0x40000000, |
| 211 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 212 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 213 | .init_machine = colibri_pxa270_init, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 214 | .map_io = pxa_map_io, |
| 215 | .init_irq = pxa27x_init_irq, |
| 216 | .timer = &pxa_timer, |
| 217 | MACHINE_END |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 218 | |
Marek Vasut | 403d297 | 2010-05-22 00:29:39 +0200 | [diff] [blame^] | 219 | MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC") |
| 220 | .phys_io = 0x40000000, |
| 221 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 222 | .boot_params = 0xa0000100, |
| 223 | .init_machine = colibri_pxa270_income_init, |
| 224 | .map_io = pxa_map_io, |
| 225 | .init_irq = pxa27x_init_irq, |
| 226 | .timer = &pxa_timer, |
| 227 | MACHINE_END |
| 228 | |