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> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 36 | |
| 37 | #include "generic.h" |
| 38 | #include "devices.h" |
| 39 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 40 | /****************************************************************************** |
| 41 | * Pin configuration |
| 42 | ******************************************************************************/ |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 43 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 44 | /* Ethernet */ |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 45 | GPIO78_nCS_2, /* Ethernet CS */ |
| 46 | GPIO114_GPIO, /* Ethernet IRQ */ |
| 47 | }; |
| 48 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 49 | /****************************************************************************** |
| 50 | * NOR Flash |
| 51 | ******************************************************************************/ |
| 52 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 53 | static struct mtd_partition colibri_partitions[] = { |
| 54 | { |
| 55 | .name = "Bootloader", |
| 56 | .offset = 0x00000000, |
| 57 | .size = 0x00040000, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 58 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 59 | }, { |
| 60 | .name = "Kernel", |
| 61 | .offset = 0x00040000, |
| 62 | .size = 0x00400000, |
| 63 | .mask_flags = 0 |
| 64 | }, { |
| 65 | .name = "Rootfs", |
| 66 | .offset = 0x00440000, |
| 67 | .size = MTDPART_SIZ_FULL, |
| 68 | .mask_flags = 0 |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | static struct physmap_flash_data colibri_flash_data[] = { |
| 73 | { |
| 74 | .width = 4, /* bankwidth in bytes */ |
| 75 | .parts = colibri_partitions, |
| 76 | .nr_parts = ARRAY_SIZE(colibri_partitions) |
| 77 | } |
| 78 | }; |
| 79 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 80 | static struct resource colibri_pxa270_flash_resource = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 81 | .start = PXA_CS0_PHYS, |
| 82 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | }; |
| 85 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 86 | static struct platform_device colibri_pxa270_flash_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 87 | .name = "physmap-flash", |
| 88 | .id = 0, |
| 89 | .dev = { |
| 90 | .platform_data = colibri_flash_data, |
| 91 | }, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 92 | .resource = &colibri_pxa270_flash_resource, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 93 | .num_resources = 1, |
| 94 | }; |
| 95 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 96 | static void __init colibri_pxa270_nor_init(void) |
| 97 | { |
| 98 | platform_device_register(&colibri_pxa270_flash_device); |
| 99 | } |
| 100 | #else |
| 101 | static inline void colibri_pxa270_nor_init(void) {} |
| 102 | #endif |
| 103 | |
| 104 | /****************************************************************************** |
| 105 | * Ethernet |
| 106 | ******************************************************************************/ |
| 107 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 108 | static struct resource colibri_pxa270_dm9000_resources[] = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 109 | [0] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 110 | .start = PXA_CS2_PHYS, |
| 111 | .end = PXA_CS2_PHYS + 3, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 112 | .flags = IORESOURCE_MEM, |
| 113 | }, |
| 114 | [1] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 115 | .start = PXA_CS2_PHYS + 4, |
| 116 | .end = PXA_CS2_PHYS + 4 + 500, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 117 | .flags = IORESOURCE_MEM, |
| 118 | }, |
| 119 | [2] = { |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 120 | .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
| 121 | .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
Michael Abbott | d0afc85 | 2008-05-14 16:29:24 -0700 | [diff] [blame] | 122 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 123 | }, |
| 124 | }; |
| 125 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 126 | static struct platform_device colibri_pxa270_dm9000_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 127 | .name = "dm9000", |
| 128 | .id = -1, |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 129 | .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources), |
| 130 | .resource = colibri_pxa270_dm9000_resources, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 131 | }; |
| 132 | |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 133 | static void __init colibri_pxa270_eth_init(void) |
| 134 | { |
| 135 | platform_device_register(&colibri_pxa270_dm9000_device); |
| 136 | } |
| 137 | #else |
| 138 | static inline void colibri_pxa270_eth_init(void) {} |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 139 | #endif |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 140 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 141 | static void __init colibri_pxa270_init(void) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 142 | { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 143 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 144 | pxa_set_ffuart_info(NULL); |
| 145 | pxa_set_btuart_info(NULL); |
| 146 | pxa_set_stuart_info(NULL); |
Marek Vasut | f95bb54 | 2010-05-22 00:29:33 +0200 | [diff] [blame^] | 147 | |
| 148 | colibri_pxa270_nor_init(); |
| 149 | colibri_pxa270_eth_init(); |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 150 | } |
| 151 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 152 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 153 | .phys_io = 0x40000000, |
| 154 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 155 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 156 | .init_machine = colibri_pxa270_init, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 157 | .map_io = pxa_map_io, |
| 158 | .init_irq = pxa27x_init_irq, |
| 159 | .timer = &pxa_timer, |
| 160 | MACHINE_END |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 161 | |