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> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/sysdev.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/bitops.h> |
| 18 | #include <linux/ioport.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <linux/mtd/mtd.h> |
| 21 | #include <linux/mtd/partitions.h> |
| 22 | #include <linux/mtd/physmap.h> |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 23 | #include <linux/gpio.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 24 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | #include <mach/hardware.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 26 | #include <asm/irq.h> |
| 27 | #include <asm/sizes.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/mach/irq.h> |
| 31 | #include <asm/mach/flash.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 32 | |
| 33 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 34 | #include <mach/colibri.h> |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 35 | |
| 36 | #include "generic.h" |
| 37 | #include "devices.h" |
| 38 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 39 | /* |
| 40 | * GPIO configuration |
| 41 | */ |
| 42 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
Eric Miao | c0b1541 | 2008-08-08 14:59:03 +0800 | [diff] [blame] | 43 | GPIO78_nCS_2, /* Ethernet CS */ |
| 44 | GPIO114_GPIO, /* Ethernet IRQ */ |
| 45 | }; |
| 46 | |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 47 | /* |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 48 | * NOR flash |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 49 | */ |
| 50 | static struct mtd_partition colibri_partitions[] = { |
| 51 | { |
| 52 | .name = "Bootloader", |
| 53 | .offset = 0x00000000, |
| 54 | .size = 0x00040000, |
| 55 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
| 56 | }, { |
| 57 | .name = "Kernel", |
| 58 | .offset = 0x00040000, |
| 59 | .size = 0x00400000, |
| 60 | .mask_flags = 0 |
| 61 | }, { |
| 62 | .name = "Rootfs", |
| 63 | .offset = 0x00440000, |
| 64 | .size = MTDPART_SIZ_FULL, |
| 65 | .mask_flags = 0 |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | static struct physmap_flash_data colibri_flash_data[] = { |
| 70 | { |
| 71 | .width = 4, /* bankwidth in bytes */ |
| 72 | .parts = colibri_partitions, |
| 73 | .nr_parts = ARRAY_SIZE(colibri_partitions) |
| 74 | } |
| 75 | }; |
| 76 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 77 | static struct resource colibri_pxa270_flash_resource = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 78 | .start = PXA_CS0_PHYS, |
| 79 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 80 | .flags = IORESOURCE_MEM, |
| 81 | }; |
| 82 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 83 | static struct platform_device colibri_pxa270_flash_device = { |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 84 | .name = "physmap-flash", |
| 85 | .id = 0, |
| 86 | .dev = { |
| 87 | .platform_data = colibri_flash_data, |
| 88 | }, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 89 | .resource = &colibri_pxa270_flash_resource, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 90 | .num_resources = 1, |
| 91 | }; |
| 92 | |
| 93 | /* |
| 94 | * DM9000 Ethernet |
| 95 | */ |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 96 | #if defined(CONFIG_DM9000) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 97 | static struct resource dm9000_resources[] = { |
| 98 | [0] = { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 99 | .start = COLIBRI_PXA270_ETH_PHYS, |
| 100 | .end = COLIBRI_PXA270_ETH_PHYS + 3, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 101 | .flags = IORESOURCE_MEM, |
| 102 | }, |
| 103 | [1] = { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 104 | .start = COLIBRI_PXA270_ETH_PHYS + 4, |
| 105 | .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 106 | .flags = IORESOURCE_MEM, |
| 107 | }, |
| 108 | [2] = { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 109 | .start = COLIBRI_PXA270_ETH_IRQ, |
| 110 | .end = COLIBRI_PXA270_ETH_IRQ, |
Michael Abbott | d0afc85 | 2008-05-14 16:29:24 -0700 | [diff] [blame] | 111 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 112 | }, |
| 113 | }; |
| 114 | |
| 115 | static struct platform_device dm9000_device = { |
| 116 | .name = "dm9000", |
| 117 | .id = -1, |
| 118 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 119 | .resource = dm9000_resources, |
| 120 | }; |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 121 | #endif /* CONFIG_DM9000 */ |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 122 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 123 | static struct platform_device *colibri_pxa270_devices[] __initdata = { |
| 124 | &colibri_pxa270_flash_device, |
| 125 | #if defined(CONFIG_DM9000) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 126 | &dm9000_device, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 127 | #endif |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 128 | }; |
| 129 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 130 | static void __init colibri_pxa270_init(void) |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 131 | { |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 132 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
| 133 | platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices)); |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 134 | } |
| 135 | |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 136 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 137 | .phys_io = 0x40000000, |
| 138 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 139 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 140 | .init_machine = colibri_pxa270_init, |
Daniel Mack | 4e4fc05 | 2008-01-23 14:54:50 +0100 | [diff] [blame] | 141 | .map_io = pxa_map_io, |
| 142 | .init_irq = pxa27x_init_irq, |
| 143 | .timer = &pxa_timer, |
| 144 | MACHINE_END |
Daniel Mack | 5c0dbb8 | 2009-03-13 16:37:08 +0100 | [diff] [blame] | 145 | |