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