blob: e8473624427eed4ad613466b20398c14fcf062a0 [file] [log] [blame]
Daniel Mack4e4fc052008-01-23 14:54:50 +01001/*
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>
Russell Kinga09e64f2008-08-05 16:14:15 +010024#include <mach/hardware.h>
Daniel Mack4e4fc052008-01-23 14:54:50 +010025#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>
Russell Kinga09e64f2008-08-05 16:14:15 +010031#include <mach/pxa-regs.h>
Eric Miaoc0b15412008-08-08 14:59:03 +080032#include <mach/mfp-pxa27x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/colibri.h>
Daniel Mack4e4fc052008-01-23 14:54:50 +010034
35#include "generic.h"
36#include "devices.h"
37
Eric Miaoc0b15412008-08-08 14:59:03 +080038static unsigned long colibri_pin_config[] __initdata = {
39 GPIO78_nCS_2, /* Ethernet CS */
40 GPIO114_GPIO, /* Ethernet IRQ */
41};
42
Daniel Mack4e4fc052008-01-23 14:54:50 +010043/*
44 * Flash
45 */
46static struct mtd_partition colibri_partitions[] = {
47 {
48 .name = "Bootloader",
49 .offset = 0x00000000,
50 .size = 0x00040000,
51 .mask_flags = MTD_WRITEABLE /* force read-only */
52 }, {
53 .name = "Kernel",
54 .offset = 0x00040000,
55 .size = 0x00400000,
56 .mask_flags = 0
57 }, {
58 .name = "Rootfs",
59 .offset = 0x00440000,
60 .size = MTDPART_SIZ_FULL,
61 .mask_flags = 0
62 }
63};
64
65static struct physmap_flash_data colibri_flash_data[] = {
66 {
67 .width = 4, /* bankwidth in bytes */
68 .parts = colibri_partitions,
69 .nr_parts = ARRAY_SIZE(colibri_partitions)
70 }
71};
72
73static struct resource flash_resource = {
74 .start = PXA_CS0_PHYS,
75 .end = PXA_CS0_PHYS + SZ_32M - 1,
76 .flags = IORESOURCE_MEM,
77};
78
79static struct platform_device flash_device = {
80 .name = "physmap-flash",
81 .id = 0,
82 .dev = {
83 .platform_data = colibri_flash_data,
84 },
85 .resource = &flash_resource,
86 .num_resources = 1,
87};
88
89/*
90 * DM9000 Ethernet
91 */
92static struct resource dm9000_resources[] = {
93 [0] = {
94 .start = COLIBRI_ETH_PHYS,
95 .end = COLIBRI_ETH_PHYS + 3,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = COLIBRI_ETH_PHYS + 4,
100 .end = COLIBRI_ETH_PHYS + 4 + 500,
101 .flags = IORESOURCE_MEM,
102 },
103 [2] = {
104 .start = COLIBRI_ETH_IRQ,
105 .end = COLIBRI_ETH_IRQ,
Michael Abbottd0afc852008-05-14 16:29:24 -0700106 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100107 },
108};
109
110static struct platform_device dm9000_device = {
111 .name = "dm9000",
112 .id = -1,
113 .num_resources = ARRAY_SIZE(dm9000_resources),
114 .resource = dm9000_resources,
115};
116
117static struct platform_device *colibri_devices[] __initdata = {
118 &flash_device,
119 &dm9000_device,
120};
121
122static void __init colibri_init(void)
123{
Eric Miaoc0b15412008-08-08 14:59:03 +0800124 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pin_config));
Daniel Mack4e4fc052008-01-23 14:54:50 +0100125
126 platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices));
127}
128
129MACHINE_START(COLIBRI, "Toradex Colibri PXA27x")
130 .phys_io = 0x40000000,
131 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
132 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
133 .init_machine = colibri_init,
134 .map_io = pxa_map_io,
135 .init_irq = pxa27x_init_irq,
136 .timer = &pxa_timer,
137MACHINE_END