blob: 737c08563628ef40ce68020b8f2f9d56ba8e918a [file] [log] [blame]
Maxim Osipov8ed90592010-09-15 11:54:49 +01001/*
2 * linux/arch/arm/mach-at91/board-flexibity.c
3 *
Maxim Osipov948ce6a2011-05-07 12:47:00 +01004 * Copyright (C) 2010-2011 Flexibity
Maxim Osipov8ed90592010-09-15 11:54:49 +01005 * 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>
Maxim Osipov8ed90592010-09-15 11:54:49 +010036
Jean-Christophe PLAGNIOL-VILLARDa510b9b2012-10-30 06:41:28 +080037#include "at91_aic.h"
Jean-Christophe PLAGNIOL-VILLARD43d2f532012-10-30 05:14:17 +080038#include "board.h"
Maxim Osipov8ed90592010-09-15 11:54:49 +010039#include "generic.h"
40
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080041static void __init flexibity_init_early(void)
Maxim Osipov8ed90592010-09-15 11:54:49 +010042{
43 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080044 at91_initialize(18432000);
Maxim Osipov8ed90592010-09-15 11:54:49 +010045}
46
Maxim Osipov8ed90592010-09-15 11:54:49 +010047/* USB Host port */
48static struct at91_usbh_data __initdata flexibity_usbh_data = {
49 .ports = 2,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080050 .vbus_pin = {-EINVAL, -EINVAL},
51 .overcurrent_pin= {-EINVAL, -EINVAL},
Maxim Osipov8ed90592010-09-15 11:54:49 +010052};
53
54/* USB Device port */
55static struct at91_udc_data __initdata flexibity_udc_data = {
56 .vbus_pin = AT91_PIN_PC5,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080057 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
Maxim Osipov8ed90592010-09-15 11:54:49 +010058};
59
Maxim Osipov948ce6a2011-05-07 12:47:00 +010060/* I2C devices */
61static struct i2c_board_info __initdata flexibity_i2c_devices[] = {
62 {
63 I2C_BOARD_INFO("ds1307", 0x68),
64 },
65};
66
Maxim Osipov8ed90592010-09-15 11:54:49 +010067/* SPI devices */
68static struct spi_board_info flexibity_spi_devices[] = {
69 { /* DataFlash chip */
70 .modalias = "mtd_dataflash",
71 .chip_select = 1,
72 .max_speed_hz = 15 * 1000 * 1000,
73 .bus_num = 0,
74 },
75};
76
77/* MCI (SD/MMC) */
Ludovic Desroches4cf33262012-05-21 12:23:27 +020078static struct mci_platform_data __initdata flexibity_mci0_data = {
79 .slot[0] = {
80 .bus_width = 4,
81 .detect_pin = AT91_PIN_PC9,
82 .wp_pin = AT91_PIN_PC4,
83 },
Maxim Osipov8ed90592010-09-15 11:54:49 +010084};
85
86/* LEDs */
87static struct gpio_led flexibity_leds[] = {
88 {
89 .name = "usb1:green",
90 .gpio = AT91_PIN_PA12,
91 .active_low = 1,
92 .default_trigger = "default-on",
93 },
94 {
95 .name = "usb1:red",
96 .gpio = AT91_PIN_PA13,
97 .active_low = 1,
98 .default_trigger = "default-on",
99 },
100 {
101 .name = "usb2:green",
102 .gpio = AT91_PIN_PB26,
103 .active_low = 1,
104 .default_trigger = "default-on",
105 },
106 {
107 .name = "usb2:red",
108 .gpio = AT91_PIN_PB27,
109 .active_low = 1,
110 .default_trigger = "default-on",
111 },
112 {
113 .name = "usb3:green",
114 .gpio = AT91_PIN_PC8,
115 .active_low = 1,
116 .default_trigger = "default-on",
117 },
118 {
119 .name = "usb3:red",
120 .gpio = AT91_PIN_PC6,
121 .active_low = 1,
122 .default_trigger = "default-on",
123 },
124 {
125 .name = "usb4:green",
126 .gpio = AT91_PIN_PB4,
127 .active_low = 1,
128 .default_trigger = "default-on",
129 },
130 {
131 .name = "usb4:red",
132 .gpio = AT91_PIN_PB5,
133 .active_low = 1,
134 .default_trigger = "default-on",
135 }
136};
137
138static void __init flexibity_board_init(void)
139{
140 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800141 /* DBGU on ttyS0. (Rx & Tx only) */
142 at91_register_uart(0, 0, 0);
Maxim Osipov8ed90592010-09-15 11:54:49 +0100143 at91_add_device_serial();
144 /* USB Host */
145 at91_add_device_usbh(&flexibity_usbh_data);
146 /* USB Device */
147 at91_add_device_udc(&flexibity_udc_data);
Maxim Osipov948ce6a2011-05-07 12:47:00 +0100148 /* I2C */
149 at91_add_device_i2c(flexibity_i2c_devices,
150 ARRAY_SIZE(flexibity_i2c_devices));
Maxim Osipov8ed90592010-09-15 11:54:49 +0100151 /* SPI */
152 at91_add_device_spi(flexibity_spi_devices,
153 ARRAY_SIZE(flexibity_spi_devices));
154 /* MMC */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200155 at91_add_device_mci(0, &flexibity_mci0_data);
Maxim Osipov8ed90592010-09-15 11:54:49 +0100156 /* LEDs */
157 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
158}
159
160MACHINE_START(FLEXIBITY, "Flexibity Connect")
161 /* Maintainer: Maxim Osipov */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700162 .init_time = at91sam926x_pit_init,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800163 .map_io = at91_map_io,
Ludovic Desroches3e135462012-06-11 15:38:03 +0200164 .handle_irq = at91_aic_handle_irq,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800165 .init_early = flexibity_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800166 .init_irq = at91_init_irq_default,
Maxim Osipov8ed90592010-09-15 11:54:49 +0100167 .init_machine = flexibity_board_init,
168MACHINE_END