]>
Commit | Line | Data |
---|---|---|
4e4fc05a DM |
1 | /* |
2 | * linux/arch/arm/mach-pxa/colibri.c | |
3 | * | |
4 | * Support for Toradex PXA27x based Colibri module | |
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> | |
23 | #include <asm/mach-types.h> | |
a09e64fb | 24 | #include <mach/hardware.h> |
4e4fc05a DM |
25 | #include <asm/irq.h> |
26 | #include <asm/sizes.h> | |
27 | #include <asm/mach/arch.h> | |
28 | #include <asm/mach/map.h> | |
29 | #include <asm/mach/irq.h> | |
30 | #include <asm/mach/flash.h> | |
a09e64fb RK |
31 | #include <mach/pxa-regs.h> |
32 | #include <mach/pxa2xx-gpio.h> | |
33 | #include <mach/colibri.h> | |
4e4fc05a DM |
34 | |
35 | #include "generic.h" | |
36 | #include "devices.h" | |
37 | ||
38 | /* | |
39 | * Flash | |
40 | */ | |
41 | static struct mtd_partition colibri_partitions[] = { | |
42 | { | |
43 | .name = "Bootloader", | |
44 | .offset = 0x00000000, | |
45 | .size = 0x00040000, | |
46 | .mask_flags = MTD_WRITEABLE /* force read-only */ | |
47 | }, { | |
48 | .name = "Kernel", | |
49 | .offset = 0x00040000, | |
50 | .size = 0x00400000, | |
51 | .mask_flags = 0 | |
52 | }, { | |
53 | .name = "Rootfs", | |
54 | .offset = 0x00440000, | |
55 | .size = MTDPART_SIZ_FULL, | |
56 | .mask_flags = 0 | |
57 | } | |
58 | }; | |
59 | ||
60 | static struct physmap_flash_data colibri_flash_data[] = { | |
61 | { | |
62 | .width = 4, /* bankwidth in bytes */ | |
63 | .parts = colibri_partitions, | |
64 | .nr_parts = ARRAY_SIZE(colibri_partitions) | |
65 | } | |
66 | }; | |
67 | ||
68 | static struct resource flash_resource = { | |
69 | .start = PXA_CS0_PHYS, | |
70 | .end = PXA_CS0_PHYS + SZ_32M - 1, | |
71 | .flags = IORESOURCE_MEM, | |
72 | }; | |
73 | ||
74 | static struct platform_device flash_device = { | |
75 | .name = "physmap-flash", | |
76 | .id = 0, | |
77 | .dev = { | |
78 | .platform_data = colibri_flash_data, | |
79 | }, | |
80 | .resource = &flash_resource, | |
81 | .num_resources = 1, | |
82 | }; | |
83 | ||
84 | /* | |
85 | * DM9000 Ethernet | |
86 | */ | |
87 | static struct resource dm9000_resources[] = { | |
88 | [0] = { | |
89 | .start = COLIBRI_ETH_PHYS, | |
90 | .end = COLIBRI_ETH_PHYS + 3, | |
91 | .flags = IORESOURCE_MEM, | |
92 | }, | |
93 | [1] = { | |
94 | .start = COLIBRI_ETH_PHYS + 4, | |
95 | .end = COLIBRI_ETH_PHYS + 4 + 500, | |
96 | .flags = IORESOURCE_MEM, | |
97 | }, | |
98 | [2] = { | |
99 | .start = COLIBRI_ETH_IRQ, | |
100 | .end = COLIBRI_ETH_IRQ, | |
d0afc85f | 101 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
4e4fc05a DM |
102 | }, |
103 | }; | |
104 | ||
105 | static struct platform_device dm9000_device = { | |
106 | .name = "dm9000", | |
107 | .id = -1, | |
108 | .num_resources = ARRAY_SIZE(dm9000_resources), | |
109 | .resource = dm9000_resources, | |
110 | }; | |
111 | ||
112 | static struct platform_device *colibri_devices[] __initdata = { | |
113 | &flash_device, | |
114 | &dm9000_device, | |
115 | }; | |
116 | ||
117 | static void __init colibri_init(void) | |
118 | { | |
119 | /* DM9000 LAN */ | |
120 | pxa_gpio_mode(GPIO78_nCS_2_MD); | |
121 | pxa_gpio_mode(GPIO_DM9000 | GPIO_IN); | |
4e4fc05a DM |
122 | |
123 | platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices)); | |
124 | } | |
125 | ||
126 | MACHINE_START(COLIBRI, "Toradex Colibri PXA27x") | |
127 | .phys_io = 0x40000000, | |
128 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
129 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, | |
130 | .init_machine = colibri_init, | |
131 | .map_io = pxa_map_io, | |
132 | .init_irq = pxa27x_init_irq, | |
133 | .timer = &pxa_timer, | |
134 | MACHINE_END |