ee23cc8c5c10a83ffe5807ed5d9f3be42b99877b
[openwrt.git] / target / linux / at91 / patches-2.6.25 / 001-vlink-machine.patch
1 --- a/arch/arm/mach-at91/Kconfig
2 +++ b/arch/arm/mach-at91/Kconfig
3 @@ -151,6 +151,12 @@
4         help
5           Select this if you are using Toptech's TT9200 board.
6  
7 +config MACH_VLINK
8 +       bool "Figment Design Labs VersaLink"
9 +       depends on ARCH_AT91RM9200
10 +       help
11 +         Select this if you are using FDL's VersaLink board
12 +
13  endif
14  
15  # ----------------------------------------------------------
16 --- a/arch/arm/mach-at91/Makefile
17 +++ b/arch/arm/mach-at91/Makefile
18 @@ -29,6 +29,7 @@
19  obj-$(CONFIG_MACH_ATEB9200)    += board-eb9200.o
20  obj-$(CONFIG_MACH_KAFA)                += board-kafa.o
21  obj-$(CONFIG_MACH_CHUB)                += board-chub.o
22 +obj-$(CONFIG_MACH_VLINK)       += board-vlink.o
23  obj-$(CONFIG_MACH_PICOTUX2XX)  += board-picotux200.o
24  obj-$(CONFIG_MACH_HOMEMATIC)   += board-homematic.o
25  obj-$(CONFIG_MACH_ECBAT91)     += board-ecbat91.o
26 --- /dev/null
27 +++ b/arch/arm/mach-at91/board-vlink.c
28 @@ -0,0 +1,201 @@
29 +/*
30 + * linux/arch/arm/mach-at91/board-vlink.c
31 + *
32 + *  Copyright (C) 2005 SAN People
33 + *  Copyright (C) 2006,2007 Guthrie Consulting
34 + *
35 + *
36 + * This program is free software; you can redistribute it and/or modify
37 + * it under the terms of the GNU General Public License as published by
38 + * the Free Software Foundation; either version 2 of the License, or
39 + * (at your option) any later version.
40 + *
41 + * This program is distributed in the hope that it will be useful,
42 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44 + * GNU General Public License for more details.
45 + *
46 + * You should have received a copy of the GNU General Public License
47 + * along with this program; if not, write to the Free Software
48 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
49 + */
50 +
51 +#include <linux/types.h>
52 +#include <linux/init.h>
53 +#include <linux/mm.h>
54 +#include <linux/module.h>
55 +#include <linux/platform_device.h>
56 +#include <linux/spi/spi.h>
57 +#include <linux/mtd/physmap.h>
58 +
59 +#include <asm/hardware.h>
60 +#include <asm/setup.h>
61 +#include <asm/mach-types.h>
62 +#include <asm/irq.h>
63 +
64 +#include <asm/mach/arch.h>
65 +#include <asm/mach/map.h>
66 +#include <asm/mach/irq.h>
67 +
68 +#include <asm/arch/board.h>
69 +#include <asm/arch/gpio.h>
70 +#include <asm/arch/at91rm9200_mc.h>
71 +
72 +#include "generic.h"
73 +
74 +
75 +static void __init vlink_map_io(void)
76 +{
77 +       /* Initialize processor: 18.432 MHz crystal */
78 +       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
79 +
80 +       /* Setup the LEDs */
81 +       at91_init_leds(AT91_PIN_PC14, AT91_PIN_PC15);
82 +
83 +       /* Setup serial ports */
84 +       
85 +       /* DBGU on ttyS0. (RX and TX only) */
86 +       at91_register_uart(0, 0, 0);
87 +
88 +       /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DSR, DTR, DCD, RI) */
89 +       at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS 
90 +                       | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR
91 +                       | ATMEL_UART_DCD | ATMEL_UART_RI);
92 +
93 +       /* USART0 on ttys2. (Rx, Tx, CTS, RTS, DTR, DCD, RI) */
94 +       at91_register_uart(AT91RM9200_ID_US0, 2, ATMEL_UART_CTS
95 +                       | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI);
96 +
97 +       /* USART3 on ttyS3. (Rx, Tx, CTS, RTS, DTR, DCD, RI) */
98 +       at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS
99 +                       | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI);
100 +
101 +       /* USART2 on ttyS4. (Rx and Tx only) */
102 +       at91_register_uart(AT91RM9200_ID_US2, 4, 0);
103 +
104 +       /* Console on ttyS0 (ie DBGU) */
105 +       at91_set_serial_console(0);
106 +}
107 +
108 +static void __init vlink_init_irq(void)
109 +{
110 +       at91rm9200_init_interrupts(NULL);
111 +}
112 +
113 +static struct at91_eth_data __initdata vlink_eth_data = {
114 +       .phy_irq_pin    = AT91_PIN_PC4,
115 +       .is_rmii        = 1,
116 +};
117 +
118 +static struct at91_usbh_data __initdata vlink_usbh_data = {
119 +       .ports          = 1,
120 +};
121 +
122 +/*
123 +static struct at91_udc_data __initdata vlink_udc_data = {
124 +       .vbus_pin       = AT91_PIN_PD4,
125 +       .pullup_pin     = AT91_PIN_PD5,
126 +};
127 +*/
128 +
129 +static struct at91_mmc_data __initdata vlink_mmc_data = {
130 +//     .det_pin        = AT91_PIN_PB27,
131 +       .slot_b         = 0,
132 +       .wire4          = 1,
133 +//     .wp_pin         = AT91_PIN_PA17,
134 +};
135 +
136 +static struct spi_board_info vlink_spi_devices[] = {
137 +       {       /* DataFlash chip */
138 +               .modalias       = "mtd_dataflash",
139 +               .chip_select    = 0,
140 +               .max_speed_hz   = 15 * 1000 * 1000,
141 +       },
142 +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
143 +       {       /* DataFlash card */
144 +               .modalias       = "mtd_dataflash",
145 +               .chip_select    = 3,
146 +               .max_speed_hz   = 15 * 1000 * 1000,
147 +       },
148 +#endif
149 +};
150 +
151 +/*static struct at91_gpio_led vlink_leds[] = {
152 +       {
153 +               .name           = "led0",
154 +               .gpio           = AT91_PIN_PC14,
155 +               .trigger        = "heartbeat",
156 +       },
157 +       {
158 +               .name           = "led1",
159 +               .gpio           = AT91_PIN_PC15,
160 +               .trigger        = "timer",
161 +       }
162 +};
163 +*/
164 +
165 +static void __init vlink_board_init(void)
166 +{
167 +       /* Serial */
168 +       at91_add_device_serial();
169 +       /* Ethernet */
170 +       at91_add_device_eth(&vlink_eth_data);
171 +       /* USB Host */
172 +       at91_add_device_usbh(&vlink_usbh_data);
173 +       /* USB Device */
174 +//     at91_add_device_udc(&vlink_udc_data);
175 +//     at91_set_multi_drive(vlink_udc_data.pullup_pin, 1);     /* pullup_pin is connected to reset */
176 +       /* I2C */
177 +//     at91_add_device_i2c();
178 +       /* SPI */
179 +       at91_add_device_spi(vlink_spi_devices, ARRAY_SIZE(vlink_spi_devices));
180 +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
181 +       /* DataFlash card */
182 +//     at91_set_gpio_output(AT91_PIN_PB22, 0);
183 +#else
184 +       /* MMC */
185 +//     at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
186 +       at91_add_device_mmc(0, &vlink_mmc_data);
187 +#endif
188 +       /* LEDs */
189 +//     at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
190 +
191 +/* Other LED's */
192 +       at91_set_gpio_output(AT91_PIN_PC7, 1);  // LED FRONT AP1
193 +       at91_set_gpio_output(AT91_PIN_PC8, 1);  // LED FRONT BP1
194 +       at91_set_gpio_output(AT91_PIN_PB14, 1); // LED BACK AP1
195 +       at91_set_gpio_output(AT91_PIN_PB15, 1); // LED BACK BP1
196 +       at91_set_gpio_output(AT91_PIN_PB16, 1); // LED BACK AP2
197 +       at91_set_gpio_output(AT91_PIN_PB17, 1); // LED BACK BP2
198 +
199 +/* SIM Cards */
200 +       at91_set_gpio_output(AT91_PIN_PB9, 1);  // ENBSC3
201 +       at91_set_gpio_output(AT91_PIN_PB10, 1); // ENBSC2
202 +       at91_set_gpio_output(AT91_PIN_PB11, 1); // ENBSC1
203 +
204 +/* GSM Module Control */
205 +       at91_set_gpio_output(AT91_PIN_PB12, 1); // GSMONOFF
206 +
207 +/* Test jig presence detection */
208 +       at91_set_gpio_input(AT91_PIN_PB8, 1);   // JIGPRESENT
209 +
210 +/* Power indicator */
211 +       at91_set_gpio_input(AT91_PIN_PB22, 1);  // PWR_IND
212 +
213 +/* USB Device control */
214 +       at91_set_gpio_input(AT91_PIN_PB27, 1);  // UDB_CNX
215 +       at91_set_gpio_output(AT91_PIN_PB28, 1); // UDB_PUP
216 +                        at91_set_multi_drive(AT91_PIN_PB28, 1); // Set to multi-drive
217 +
218 +}
219 +
220 +MACHINE_START(VLINK, "FDL VersaLink")
221 +       /* Maintainer: Guthrie Consulting */
222 +       .phys_io        = AT91_BASE_SYS,
223 +       .io_pg_offst    = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
224 +       .boot_params    = AT91_SDRAM_BASE + 0x100,
225 +       .timer          = &at91rm9200_timer,
226 +       .map_io         = vlink_map_io,
227 +       .init_irq       = vlink_init_irq,
228 +       .init_machine   = vlink_board_init,
229 +MACHINE_END