Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-at91/board-flexibity.c |
| 3 | * |
Maxim Osipov | 948ce6a | 2011-05-07 12:47:00 +0100 | [diff] [blame] | 4 | * Copyright (C) 2010-2011 Flexibity |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 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-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 40 | static void __init flexibity_init_early(void) |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 41 | { |
| 42 | /* Initialize processor: 18.432 MHz crystal */ |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 43 | at91_initialize(18432000); |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 44 | } |
| 45 | |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 46 | /* USB Host port */ |
| 47 | static struct at91_usbh_data __initdata flexibity_usbh_data = { |
| 48 | .ports = 2, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 49 | .vbus_pin = {-EINVAL, -EINVAL}, |
| 50 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | /* USB Device port */ |
| 54 | static struct at91_udc_data __initdata flexibity_udc_data = { |
| 55 | .vbus_pin = AT91_PIN_PC5, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 56 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 57 | }; |
| 58 | |
Maxim Osipov | 948ce6a | 2011-05-07 12:47:00 +0100 | [diff] [blame] | 59 | /* I2C devices */ |
| 60 | static struct i2c_board_info __initdata flexibity_i2c_devices[] = { |
| 61 | { |
| 62 | I2C_BOARD_INFO("ds1307", 0x68), |
| 63 | }, |
| 64 | }; |
| 65 | |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 66 | /* SPI devices */ |
| 67 | static struct spi_board_info flexibity_spi_devices[] = { |
| 68 | { /* DataFlash chip */ |
| 69 | .modalias = "mtd_dataflash", |
| 70 | .chip_select = 1, |
| 71 | .max_speed_hz = 15 * 1000 * 1000, |
| 72 | .bus_num = 0, |
| 73 | }, |
| 74 | }; |
| 75 | |
| 76 | /* MCI (SD/MMC) */ |
| 77 | static struct at91_mmc_data __initdata flexibity_mmc_data = { |
| 78 | .slot_b = 0, |
| 79 | .wire4 = 1, |
| 80 | .det_pin = AT91_PIN_PC9, |
| 81 | .wp_pin = AT91_PIN_PC4, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 82 | .vcc_pin = -EINVAL, |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | /* LEDs */ |
| 86 | static struct gpio_led flexibity_leds[] = { |
| 87 | { |
| 88 | .name = "usb1:green", |
| 89 | .gpio = AT91_PIN_PA12, |
| 90 | .active_low = 1, |
| 91 | .default_trigger = "default-on", |
| 92 | }, |
| 93 | { |
| 94 | .name = "usb1:red", |
| 95 | .gpio = AT91_PIN_PA13, |
| 96 | .active_low = 1, |
| 97 | .default_trigger = "default-on", |
| 98 | }, |
| 99 | { |
| 100 | .name = "usb2:green", |
| 101 | .gpio = AT91_PIN_PB26, |
| 102 | .active_low = 1, |
| 103 | .default_trigger = "default-on", |
| 104 | }, |
| 105 | { |
| 106 | .name = "usb2:red", |
| 107 | .gpio = AT91_PIN_PB27, |
| 108 | .active_low = 1, |
| 109 | .default_trigger = "default-on", |
| 110 | }, |
| 111 | { |
| 112 | .name = "usb3:green", |
| 113 | .gpio = AT91_PIN_PC8, |
| 114 | .active_low = 1, |
| 115 | .default_trigger = "default-on", |
| 116 | }, |
| 117 | { |
| 118 | .name = "usb3:red", |
| 119 | .gpio = AT91_PIN_PC6, |
| 120 | .active_low = 1, |
| 121 | .default_trigger = "default-on", |
| 122 | }, |
| 123 | { |
| 124 | .name = "usb4:green", |
| 125 | .gpio = AT91_PIN_PB4, |
| 126 | .active_low = 1, |
| 127 | .default_trigger = "default-on", |
| 128 | }, |
| 129 | { |
| 130 | .name = "usb4:red", |
| 131 | .gpio = AT91_PIN_PB5, |
| 132 | .active_low = 1, |
| 133 | .default_trigger = "default-on", |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | static void __init flexibity_board_init(void) |
| 138 | { |
| 139 | /* Serial */ |
Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 140 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 141 | at91_register_uart(0, 0, 0); |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 142 | at91_add_device_serial(); |
| 143 | /* USB Host */ |
| 144 | at91_add_device_usbh(&flexibity_usbh_data); |
| 145 | /* USB Device */ |
| 146 | at91_add_device_udc(&flexibity_udc_data); |
Maxim Osipov | 948ce6a | 2011-05-07 12:47:00 +0100 | [diff] [blame] | 147 | /* I2C */ |
| 148 | at91_add_device_i2c(flexibity_i2c_devices, |
| 149 | ARRAY_SIZE(flexibity_i2c_devices)); |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 150 | /* SPI */ |
| 151 | at91_add_device_spi(flexibity_spi_devices, |
| 152 | ARRAY_SIZE(flexibity_spi_devices)); |
| 153 | /* MMC */ |
| 154 | at91_add_device_mmc(0, &flexibity_mmc_data); |
| 155 | /* LEDs */ |
| 156 | at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); |
| 157 | } |
| 158 | |
| 159 | MACHINE_START(FLEXIBITY, "Flexibity Connect") |
| 160 | /* Maintainer: Maxim Osipov */ |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 161 | .timer = &at91sam926x_timer, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 162 | .map_io = at91_map_io, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 163 | .init_early = flexibity_init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 164 | .init_irq = at91_init_irq_default, |
Maxim Osipov | 8ed9059 | 2010-09-15 11:54:49 +0100 | [diff] [blame] | 165 | .init_machine = flexibity_board_init, |
| 166 | MACHINE_END |