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> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 25 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/hardware.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 27 | #include <asm/irq.h> |
| 28 | #include <asm/sizes.h> |
| 29 | #include <asm/mach/arch.h> |
| 30 | #include <asm/mach/map.h> |
| 31 | #include <asm/mach/irq.h> |
| 32 | #include <asm/mach/flash.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 33 | |
| 34 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/colibri.h> |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 36 | #include <mach/mmc.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 37 | |
| 38 | #include "generic.h" |
| 39 | #include "devices.h" |
| 40 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 41 | /****************************************************************************** |
| 42 | * Pin configuration |
| 43 | ******************************************************************************/ |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 44 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 45 | /* Ethernet */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 46 | GPIO78_nCS_2, /* Ethernet CS */ |
| 47 | GPIO114_GPIO, /* Ethernet IRQ */ |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 48 | |
| 49 | /* MMC */ |
| 50 | GPIO32_MMC_CLK, |
| 51 | GPIO92_MMC_DAT_0, |
| 52 | GPIO109_MMC_DAT_1, |
| 53 | GPIO110_MMC_DAT_2, |
| 54 | GPIO111_MMC_DAT_3, |
| 55 | GPIO112_MMC_CMD, |
| 56 | GPIO0_GPIO, /* SD detect */ |
Marek Vasut | 12d9420 | 2010-05-22 00:29:35 +0200 | [diff] [blame^] | 57 | |
| 58 | /* FFUART */ |
| 59 | GPIO39_FFUART_TXD, |
| 60 | GPIO34_FFUART_RXD, |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 61 | }; |
| 62 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 63 | /****************************************************************************** |
| 64 | * NOR Flash |
| 65 | ******************************************************************************/ |
| 66 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 67 | static struct mtd_partition colibri_partitions[] = { |
| 68 | { |
| 69 | .name = "Bootloader", |
| 70 | .offset = 0x00000000, |
| 71 | .size = 0x00040000, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 72 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 73 | }, { |
| 74 | .name = "Kernel", |
| 75 | .offset = 0x00040000, |
| 76 | .size = 0x00400000, |
| 77 | .mask_flags = 0 |
| 78 | }, { |
| 79 | .name = "Rootfs", |
| 80 | .offset = 0x00440000, |
| 81 | .size = MTDPART_SIZ_FULL, |
| 82 | .mask_flags = 0 |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | static struct physmap_flash_data colibri_flash_data[] = { |
| 87 | { |
| 88 | .width = 4, /* bankwidth in bytes */ |
| 89 | .parts = colibri_partitions, |
| 90 | .nr_parts = ARRAY_SIZE(colibri_partitions) |
| 91 | } |
| 92 | }; |
| 93 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 94 | static struct resource colibri_pxa270_flash_resource = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 95 | .start = PXA_CS0_PHYS, |
| 96 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 97 | .flags = IORESOURCE_MEM, |
| 98 | }; |
| 99 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 100 | static struct platform_device colibri_pxa270_flash_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 101 | .name = "physmap-flash", |
| 102 | .id = 0, |
| 103 | .dev = { |
| 104 | .platform_data = colibri_flash_data, |
| 105 | }, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 106 | .resource = &colibri_pxa270_flash_resource, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 107 | .num_resources = 1, |
| 108 | }; |
| 109 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 110 | static void __init colibri_pxa270_nor_init(void) |
| 111 | { |
| 112 | platform_device_register(&colibri_pxa270_flash_device); |
| 113 | } |
| 114 | #else |
| 115 | static inline void colibri_pxa270_nor_init(void) {} |
| 116 | #endif |
| 117 | |
| 118 | /****************************************************************************** |
| 119 | * Ethernet |
| 120 | ******************************************************************************/ |
| 121 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 122 | static struct resource colibri_pxa270_dm9000_resources[] = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 123 | [0] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 124 | .start = PXA_CS2_PHYS, |
| 125 | .end = PXA_CS2_PHYS + 3, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 126 | .flags = IORESOURCE_MEM, |
| 127 | }, |
| 128 | [1] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 129 | .start = PXA_CS2_PHYS + 4, |
| 130 | .end = PXA_CS2_PHYS + 4 + 500, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 131 | .flags = IORESOURCE_MEM, |
| 132 | }, |
| 133 | [2] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 134 | .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
| 135 | .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
Michael Abbott | d0afc85 | 2008-05-14 16:29:24 -0700 | [diff] [blame] | 136 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 137 | }, |
| 138 | }; |
| 139 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 140 | static struct platform_device colibri_pxa270_dm9000_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 141 | .name = "dm9000", |
| 142 | .id = -1, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 143 | .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources), |
| 144 | .resource = colibri_pxa270_dm9000_resources, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 145 | }; |
| 146 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame] | 147 | static void __init colibri_pxa270_eth_init(void) |
| 148 | { |
| 149 | platform_device_register(&colibri_pxa270_dm9000_device); |
| 150 | } |
| 151 | #else |
| 152 | static inline void colibri_pxa270_eth_init(void) {} |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 153 | #endif |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 154 | |
Marek Vasut | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 155 | /****************************************************************************** |
| 156 | * SD/MMC card controller |
| 157 | ******************************************************************************/ |
| 158 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 159 | static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { |
| 160 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 161 | .gpio_power = -1, |
| 162 | .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT, |
| 163 | .gpio_card_ro = -1, |
| 164 | .detect_delay_ms = 200, |
| 165 | }; |
| 166 | |
| 167 | static void __init colibri_pxa270_mmc_init(void) |
| 168 | { |
| 169 | pxa_set_mci_info(&colibri_pxa270_mci_platform_data); |
| 170 | } |
| 171 | #else |
| 172 | static inline void colibri_pxa270_mmc_init(void) {} |
| 173 | #endif |
| 174 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 175 | static void __init colibri_pxa270_init(void) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 176 | { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 177 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 178 | pxa_set_ffuart_info(NULL); |
| 179 | pxa_set_btuart_info(NULL); |
| 180 | pxa_set_stuart_info(NULL); |
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 | d01b8d6 | 2010-05-22 00:29:34 +0200 | [diff] [blame] | 184 | colibri_pxa270_mmc_init(); |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 185 | } |
| 186 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 187 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 188 | .phys_io = 0x40000000, |
| 189 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 190 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 191 | .init_machine = colibri_pxa270_init, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 192 | .map_io = pxa_map_io, |
| 193 | .init_irq = pxa27x_init_irq, |
| 194 | .timer = &pxa_timer, |
| 195 | MACHINE_END |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 196 | |