Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-at91/board-afeb-9260v1.c |
| 3 | * |
| 4 | * Copyright (C) 2005 SAN People |
| 5 | * Copyright (C) 2006 Atmel |
| 6 | * Copyright (C) 2008 Sergey Lapin |
| 7 | * |
| 8 | * A custom board designed as open hardware; PCBs and various information |
| 9 | * is available at http://groups.google.com/group/arm9fpga-evolution-board/ |
| 10 | * Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | */ |
| 26 | |
| 27 | #include <linux/types.h> |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 28 | #include <linux/gpio.h> |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 29 | #include <linux/init.h> |
| 30 | #include <linux/mm.h> |
| 31 | #include <linux/module.h> |
| 32 | #include <linux/platform_device.h> |
| 33 | #include <linux/spi/spi.h> |
| 34 | #include <linux/clk.h> |
| 35 | #include <linux/dma-mapping.h> |
| 36 | |
| 37 | #include <mach/hardware.h> |
| 38 | #include <asm/setup.h> |
| 39 | #include <asm/mach-types.h> |
| 40 | #include <asm/irq.h> |
| 41 | |
| 42 | #include <asm/mach/arch.h> |
| 43 | #include <asm/mach/map.h> |
| 44 | #include <asm/mach/irq.h> |
| 45 | |
Jean-Christophe PLAGNIOL-VILLARD | a510b9b | 2012-10-30 06:41:28 +0800 | [diff] [blame] | 46 | #include "at91_aic.h" |
Jean-Christophe PLAGNIOL-VILLARD | 43d2f53 | 2012-10-30 05:14:17 +0800 | [diff] [blame] | 47 | #include "board.h" |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 48 | #include "generic.h" |
Linus Walleij | cf2e933 | 2014-03-27 14:18:51 +0100 | [diff] [blame] | 49 | #include "gpio.h" |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 50 | |
| 51 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 52 | static void __init afeb9260_init_early(void) |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 53 | { |
| 54 | /* Initialize processor: 18.432 MHz crystal */ |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 55 | at91_initialize(18432000); |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 56 | } |
| 57 | |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 58 | /* |
| 59 | * USB Host port |
| 60 | */ |
| 61 | static struct at91_usbh_data __initdata afeb9260_usbh_data = { |
| 62 | .ports = 1, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 63 | .vbus_pin = {-EINVAL, -EINVAL}, |
| 64 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | /* |
| 68 | * USB Device port |
| 69 | */ |
| 70 | static struct at91_udc_data __initdata afeb9260_udc_data = { |
| 71 | .vbus_pin = AT91_PIN_PC5, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 72 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | |
| 76 | |
| 77 | /* |
| 78 | * SPI devices. |
| 79 | */ |
| 80 | static struct spi_board_info afeb9260_spi_devices[] = { |
| 81 | { /* DataFlash chip */ |
| 82 | .modalias = "mtd_dataflash", |
| 83 | .chip_select = 1, |
| 84 | .max_speed_hz = 15 * 1000 * 1000, |
| 85 | .bus_num = 0, |
| 86 | }, |
| 87 | }; |
| 88 | |
| 89 | |
Sergey Lapin | 53d4351 | 2008-08-12 13:35:34 +0100 | [diff] [blame] | 90 | /* |
| 91 | * MACB Ethernet device |
| 92 | */ |
Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 93 | static struct macb_platform_data __initdata afeb9260_macb_data = { |
Sergey Lapin | 53d4351 | 2008-08-12 13:35:34 +0100 | [diff] [blame] | 94 | .phy_irq_pin = AT91_PIN_PA9, |
| 95 | .is_rmii = 0, |
| 96 | }; |
| 97 | |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * NAND flash |
| 101 | */ |
| 102 | static struct mtd_partition __initdata afeb9260_nand_partition[] = { |
| 103 | { |
| 104 | .name = "bootloader", |
| 105 | .offset = 0, |
| 106 | .size = (640 * SZ_1K), |
| 107 | }, |
| 108 | { |
| 109 | .name = "kernel", |
| 110 | .offset = MTDPART_OFS_NXTBLK, |
| 111 | .size = SZ_2M, |
| 112 | }, |
| 113 | { |
| 114 | .name = "rootfs", |
| 115 | .offset = MTDPART_OFS_NXTBLK, |
| 116 | .size = MTDPART_SIZ_FULL, |
| 117 | }, |
| 118 | }; |
| 119 | |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 120 | static struct atmel_nand_data __initdata afeb9260_nand_data = { |
| 121 | .ale = 21, |
| 122 | .cle = 22, |
| 123 | .rdy_pin = AT91_PIN_PC13, |
| 124 | .enable_pin = AT91_PIN_PC14, |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 125 | .bus_width_16 = 0, |
Jean-Christophe PLAGNIOL-VILLARD | bf4289c | 2011-12-29 14:43:24 +0800 | [diff] [blame] | 126 | .ecc_mode = NAND_ECC_SOFT, |
Dmitry Eremin-Solenikov | 1754aab | 2011-05-29 17:49:22 +0400 | [diff] [blame] | 127 | .parts = afeb9260_nand_partition, |
| 128 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 129 | .det_pin = -EINVAL, |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | |
| 133 | /* |
| 134 | * MCI (SD/MMC) |
| 135 | */ |
Ludovic Desroches | 4cf3326 | 2012-05-21 12:23:27 +0200 | [diff] [blame] | 136 | static struct mci_platform_data __initdata afeb9260_mci0_data = { |
| 137 | .slot[1] = { |
| 138 | .bus_width = 4, |
| 139 | .detect_pin = AT91_PIN_PC9, |
| 140 | .wp_pin = AT91_PIN_PC4, |
| 141 | }, |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 142 | }; |
| 143 | |
| 144 | |
| 145 | |
| 146 | static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { |
| 147 | { |
Sergey Lapin | 34e559e | 2009-05-08 15:58:57 +0100 | [diff] [blame] | 148 | I2C_BOARD_INFO("tlv320aic23", 0x1a), |
| 149 | }, { |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 150 | I2C_BOARD_INFO("fm3130", 0x68), |
Sergey Lapin | b73b925 | 2008-10-27 07:43:45 +0100 | [diff] [blame] | 151 | }, { |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 152 | I2C_BOARD_INFO("24c64", 0x50), |
| 153 | }, |
| 154 | }; |
| 155 | |
Sergey Matyukevich | 0c30df6 | 2009-07-30 22:29:07 +0100 | [diff] [blame] | 156 | /* |
| 157 | * IDE (CF True IDE mode) |
| 158 | */ |
| 159 | static struct at91_cf_data afeb9260_cf_data = { |
| 160 | .chipselect = 4, |
| 161 | .irq_pin = AT91_PIN_PA6, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 162 | .det_pin = -EINVAL, |
| 163 | .vcc_pin = -EINVAL, |
Sergey Matyukevich | 0c30df6 | 2009-07-30 22:29:07 +0100 | [diff] [blame] | 164 | .rst_pin = AT91_PIN_PA7, |
| 165 | .flags = AT91_CF_TRUE_IDE, |
| 166 | }; |
| 167 | |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 168 | static void __init afeb9260_board_init(void) |
| 169 | { |
Maxime Ripard | e76265c | 2014-07-03 11:55:33 +0200 | [diff] [blame] | 170 | at91_register_devices(); |
| 171 | |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 172 | /* Serial */ |
Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 173 | /* DBGU on ttyS0. (Rx & Tx only) */ |
| 174 | at91_register_uart(0, 0, 0); |
| 175 | |
| 176 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ |
| 177 | at91_register_uart(AT91SAM9260_ID_US0, 1, |
| 178 | ATMEL_UART_CTS | ATMEL_UART_RTS |
| 179 | | ATMEL_UART_DTR | ATMEL_UART_DSR |
| 180 | | ATMEL_UART_DCD | ATMEL_UART_RI); |
| 181 | |
| 182 | /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ |
| 183 | at91_register_uart(AT91SAM9260_ID_US1, 2, |
| 184 | ATMEL_UART_CTS | ATMEL_UART_RTS); |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 185 | at91_add_device_serial(); |
| 186 | /* USB Host */ |
| 187 | at91_add_device_usbh(&afeb9260_usbh_data); |
| 188 | /* USB Device */ |
| 189 | at91_add_device_udc(&afeb9260_udc_data); |
| 190 | /* SPI */ |
| 191 | at91_add_device_spi(afeb9260_spi_devices, |
| 192 | ARRAY_SIZE(afeb9260_spi_devices)); |
| 193 | /* NAND */ |
| 194 | at91_add_device_nand(&afeb9260_nand_data); |
Sergey Lapin | 53d4351 | 2008-08-12 13:35:34 +0100 | [diff] [blame] | 195 | /* Ethernet */ |
| 196 | at91_add_device_eth(&afeb9260_macb_data); |
| 197 | |
| 198 | /* Standard function's pin assignments are not |
| 199 | * appropriate for us and generic code provide |
| 200 | * no API to configure these pins any other way */ |
| 201 | at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ |
| 202 | at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 203 | /* MMC */ |
Ludovic Desroches | 4cf3326 | 2012-05-21 12:23:27 +0200 | [diff] [blame] | 204 | at91_add_device_mci(0, &afeb9260_mci0_data); |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 205 | /* I2C */ |
| 206 | at91_add_device_i2c(afeb9260_i2c_devices, |
| 207 | ARRAY_SIZE(afeb9260_i2c_devices)); |
Sergey Lapin | 34e559e | 2009-05-08 15:58:57 +0100 | [diff] [blame] | 208 | /* Audio */ |
| 209 | at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); |
Sergey Matyukevich | 0c30df6 | 2009-07-30 22:29:07 +0100 | [diff] [blame] | 210 | /* IDE */ |
| 211 | at91_add_device_cf(&afeb9260_cf_data); |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | MACHINE_START(AFEB9260, "Custom afeb9260 board") |
| 215 | /* Maintainer: Sergey Lapin <slapin@ossfans.org> */ |
Maxime Ripard | 0f391f1 | 2014-07-01 11:33:25 +0200 | [diff] [blame] | 216 | .init_time = at91_init_time, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 217 | .map_io = at91_map_io, |
Ludovic Desroches | 3e13546 | 2012-06-11 15:38:03 +0200 | [diff] [blame] | 218 | .handle_irq = at91_aic_handle_irq, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 219 | .init_early = afeb9260_init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c12 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 220 | .init_irq = at91_init_irq_default, |
Sergey Lapin | 9c784f9 | 2008-08-03 02:29:48 +0100 | [diff] [blame] | 221 | .init_machine = afeb9260_board_init, |
| 222 | MACHINE_END |
| 223 | |