]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - arch/arm/mach-pxa/xcep.c
Merge remote branch 'jwb/next' into next
[mirror_ubuntu-zesty-kernel.git] / arch / arm / mach-pxa / xcep.c
1 /* linux/arch/arm/mach-pxa/xcep.c
2 *
3 * Support for the Iskratel Electronics XCEP platform as used in
4 * the Libera instruments from Instrumentation Technologies.
5 *
6 * Author: Ales Bardorfer <ales@i-tech.si>
7 * Contributions by: Abbott, MG (Michael) <michael.abbott@diamond.ac.uk>
8 * Contributions by: Matej Kenda <matej.kenda@i-tech.si>
9 * Created: June 2006
10 * Copyright: (C) 2006-2009 Instrumentation Technologies
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17 #include <linux/platform_device.h>
18 #include <linux/i2c.h>
19 #include <linux/smc91x.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/mtd/physmap.h>
23
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/irq.h>
27 #include <asm/mach/map.h>
28
29 #include <plat/i2c.h>
30
31 #include <mach/hardware.h>
32 #include <mach/pxa2xx-regs.h>
33 #include <mach/mfp-pxa25x.h>
34 #include <mach/smemc.h>
35
36 #include "generic.h"
37
38 #define XCEP_ETH_PHYS (PXA_CS3_PHYS + 0x00000300)
39 #define XCEP_ETH_PHYS_END (PXA_CS3_PHYS + 0x000fffff)
40 #define XCEP_ETH_ATTR (PXA_CS3_PHYS + 0x02000000)
41 #define XCEP_ETH_ATTR_END (PXA_CS3_PHYS + 0x020fffff)
42 #define XCEP_ETH_IRQ IRQ_GPIO0
43
44 /* XCEP CPLD base */
45 #define XCEP_CPLD_BASE 0xf0000000
46
47
48 /* Flash partitions. */
49
50 static struct mtd_partition xcep_partitions[] = {
51 {
52 .name = "Bootloader",
53 .size = 0x00040000,
54 .offset = 0,
55 .mask_flags = MTD_WRITEABLE
56 }, {
57 .name = "Bootloader ENV",
58 .size = 0x00040000,
59 .offset = 0x00040000,
60 .mask_flags = MTD_WRITEABLE
61 }, {
62 .name = "Kernel",
63 .size = 0x00100000,
64 .offset = 0x00080000,
65 }, {
66 .name = "Rescue fs",
67 .size = 0x00280000,
68 .offset = 0x00180000,
69 }, {
70 .name = "Filesystem",
71 .size = MTDPART_SIZ_FULL,
72 .offset = 0x00400000
73 }
74 };
75
76 static struct physmap_flash_data xcep_flash_data[] = {
77 {
78 .width = 4, /* bankwidth in bytes */
79 .parts = xcep_partitions,
80 .nr_parts = ARRAY_SIZE(xcep_partitions)
81 }
82 };
83
84 static struct resource flash_resource = {
85 .start = PXA_CS0_PHYS,
86 .end = PXA_CS0_PHYS + SZ_32M - 1,
87 .flags = IORESOURCE_MEM,
88 };
89
90 static struct platform_device flash_device = {
91 .name = "physmap-flash",
92 .id = 0,
93 .dev = {
94 .platform_data = xcep_flash_data,
95 },
96 .resource = &flash_resource,
97 .num_resources = 1,
98 };
99
100
101
102 /* SMC LAN91C111 network controller. */
103
104 static struct resource smc91x_resources[] = {
105 [0] = {
106 .name = "smc91x-regs",
107 .start = XCEP_ETH_PHYS,
108 .end = XCEP_ETH_PHYS_END,
109 .flags = IORESOURCE_MEM,
110 },
111 [1] = {
112 .start = XCEP_ETH_IRQ,
113 .end = XCEP_ETH_IRQ,
114 .flags = IORESOURCE_IRQ,
115 },
116 [2] = {
117 .name = "smc91x-attrib",
118 .start = XCEP_ETH_ATTR,
119 .end = XCEP_ETH_ATTR_END,
120 .flags = IORESOURCE_MEM,
121 },
122 };
123
124 static struct smc91x_platdata xcep_smc91x_info = {
125 .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
126 };
127
128 static struct platform_device smc91x_device = {
129 .name = "smc91x",
130 .id = -1,
131 .num_resources = ARRAY_SIZE(smc91x_resources),
132 .resource = smc91x_resources,
133 .dev = {
134 .platform_data = &xcep_smc91x_info,
135 },
136 };
137
138
139 static struct platform_device *devices[] __initdata = {
140 &flash_device,
141 &smc91x_device,
142 };
143
144
145 /* We have to state that there are HWMON devices on the I2C bus on XCEP.
146 * Drivers for HWMON verify capabilities of the adapter when loading and
147 * refuse to attach if the adapter doesn't support HWMON class of devices.
148 * See also Documentation/i2c/porting-clients. */
149 static struct i2c_pxa_platform_data xcep_i2c_platform_data = {
150 .class = I2C_CLASS_HWMON
151 };
152
153
154 static mfp_cfg_t xcep_pin_config[] __initdata = {
155 GPIO79_nCS_3, /* SMC 91C111 chip select. */
156 GPIO80_nCS_4, /* CPLD chip select. */
157 /* SSP communication to MSP430 */
158 GPIO23_SSP1_SCLK,
159 GPIO24_SSP1_SFRM,
160 GPIO25_SSP1_TXD,
161 GPIO26_SSP1_RXD,
162 GPIO27_SSP1_EXTCLK
163 };
164
165 static void __init xcep_init(void)
166 {
167 pxa2xx_mfp_config(ARRAY_AND_SIZE(xcep_pin_config));
168
169 pxa_set_ffuart_info(NULL);
170 pxa_set_btuart_info(NULL);
171 pxa_set_stuart_info(NULL);
172 pxa_set_hwuart_info(NULL);
173
174 /* See Intel XScale Developer's Guide for details */
175 /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */
176 __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1);
177 /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */
178 __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2);
179
180 platform_add_devices(ARRAY_AND_SIZE(devices));
181 pxa_set_i2c_info(&xcep_i2c_platform_data);
182 }
183
184 MACHINE_START(XCEP, "Iskratel XCEP")
185 .boot_params = 0xa0000100,
186 .init_machine = xcep_init,
187 .map_io = pxa25x_map_io,
188 .init_irq = pxa25x_init_irq,
189 .timer = &pxa_timer,
190 MACHINE_END
191