blob: eec02cd57ced7fe60291f8938a64259f61b0f22a [file] [log] [blame]
Maxim Osipov8ed90592010-09-15 11:54:49 +01001/*
2 * linux/arch/arm/mach-at91/board-flexibity.c
3 *
4 * Copyright (C) 2010 Flexibity
5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2006 Atmel
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/input.h>
27#include <linux/gpio.h>
28
29#include <asm/mach-types.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/irq.h>
34
35#include <mach/hardware.h>
36#include <mach/board.h>
37
38#include "generic.h"
39
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080040static void __init flexibity_init_early(void)
Maxim Osipov8ed90592010-09-15 11:54:49 +010041{
42 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080043 at91_initialize(18432000);
Maxim Osipov8ed90592010-09-15 11:54:49 +010044
45 /* DBGU on ttyS0. (Rx & Tx only) */
46 at91_register_uart(0, 0, 0);
47
48 /* set serial console to ttyS0 (ie, DBGU) */
49 at91_set_serial_console(0);
50}
51
Maxim Osipov8ed90592010-09-15 11:54:49 +010052/* USB Host port */
53static struct at91_usbh_data __initdata flexibity_usbh_data = {
54 .ports = 2,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080055 .vbus_pin = {-EINVAL, -EINVAL},
56 .overcurrent_pin= {-EINVAL, -EINVAL},
Maxim Osipov8ed90592010-09-15 11:54:49 +010057};
58
59/* USB Device port */
60static struct at91_udc_data __initdata flexibity_udc_data = {
61 .vbus_pin = AT91_PIN_PC5,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080062 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
Maxim Osipov8ed90592010-09-15 11:54:49 +010063};
64
65/* SPI devices */
66static struct spi_board_info flexibity_spi_devices[] = {
67 { /* DataFlash chip */
68 .modalias = "mtd_dataflash",
69 .chip_select = 1,
70 .max_speed_hz = 15 * 1000 * 1000,
71 .bus_num = 0,
72 },
73};
74
75/* MCI (SD/MMC) */
76static struct at91_mmc_data __initdata flexibity_mmc_data = {
77 .slot_b = 0,
78 .wire4 = 1,
79 .det_pin = AT91_PIN_PC9,
80 .wp_pin = AT91_PIN_PC4,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080081 .vcc_pin = -EINVAL,
Maxim Osipov8ed90592010-09-15 11:54:49 +010082};
83
84/* LEDs */
85static struct gpio_led flexibity_leds[] = {
86 {
87 .name = "usb1:green",
88 .gpio = AT91_PIN_PA12,
89 .active_low = 1,
90 .default_trigger = "default-on",
91 },
92 {
93 .name = "usb1:red",
94 .gpio = AT91_PIN_PA13,
95 .active_low = 1,
96 .default_trigger = "default-on",
97 },
98 {
99 .name = "usb2:green",
100 .gpio = AT91_PIN_PB26,
101 .active_low = 1,
102 .default_trigger = "default-on",
103 },
104 {
105 .name = "usb2:red",
106 .gpio = AT91_PIN_PB27,
107 .active_low = 1,
108 .default_trigger = "default-on",
109 },
110 {
111 .name = "usb3:green",
112 .gpio = AT91_PIN_PC8,
113 .active_low = 1,
114 .default_trigger = "default-on",
115 },
116 {
117 .name = "usb3:red",
118 .gpio = AT91_PIN_PC6,
119 .active_low = 1,
120 .default_trigger = "default-on",
121 },
122 {
123 .name = "usb4:green",
124 .gpio = AT91_PIN_PB4,
125 .active_low = 1,
126 .default_trigger = "default-on",
127 },
128 {
129 .name = "usb4:red",
130 .gpio = AT91_PIN_PB5,
131 .active_low = 1,
132 .default_trigger = "default-on",
133 }
134};
135
136static void __init flexibity_board_init(void)
137{
138 /* Serial */
139 at91_add_device_serial();
140 /* USB Host */
141 at91_add_device_usbh(&flexibity_usbh_data);
142 /* USB Device */
143 at91_add_device_udc(&flexibity_udc_data);
144 /* SPI */
145 at91_add_device_spi(flexibity_spi_devices,
146 ARRAY_SIZE(flexibity_spi_devices));
147 /* MMC */
148 at91_add_device_mmc(0, &flexibity_mmc_data);
149 /* LEDs */
150 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
151}
152
153MACHINE_START(FLEXIBITY, "Flexibity Connect")
154 /* Maintainer: Maxim Osipov */
Maxim Osipov8ed90592010-09-15 11:54:49 +0100155 .timer = &at91sam926x_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800156 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800157 .init_early = flexibity_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800158 .init_irq = at91_init_irq_default,
Maxim Osipov8ed90592010-09-15 11:54:49 +0100159 .init_machine = flexibity_board_init,
160MACHINE_END