Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-at91/board-snapper9260.c |
| 3 | * |
| 4 | * Copyright (C) 2010 Bluewater System Ltd |
| 5 | * |
| 6 | * Author: Andre Renaud <andre@bluewatersys.com> |
Ryan Mallon | 1c5454e | 2011-06-15 14:45:36 +1000 | [diff] [blame] | 7 | * Author: Ryan Mallon |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/gpio.h> |
| 27 | #include <linux/platform_device.h> |
| 28 | #include <linux/spi/spi.h> |
| 29 | #include <linux/i2c/pca953x.h> |
| 30 | |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | |
| 34 | #include <mach/hardware.h> |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 35 | #include <mach/at91sam9_smc.h> |
| 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" |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 39 | #include "sam9_smc.h" |
| 40 | #include "generic.h" |
| 41 | |
| 42 | #define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x)) |
| 43 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 44 | static void __init snapper9260_init_early(void) |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 45 | { |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 46 | at91_initialize(18432000); |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 47 | } |
| 48 | |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 49 | static struct at91_usbh_data __initdata snapper9260_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}, |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | static struct at91_udc_data __initdata snapper9260_udc_data = { |
| 56 | .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5), |
| 57 | .vbus_active_low = 1, |
| 58 | .vbus_polled = 1, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 59 | .pullup_pin = -EINVAL, |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
Jamie Iles | 84e0cdb | 2011-03-08 20:17:06 +0000 | [diff] [blame] | 62 | static struct macb_platform_data snapper9260_macb_data = { |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 63 | .phy_irq_pin = -EINVAL, |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 64 | .is_rmii = 1, |
| 65 | }; |
| 66 | |
| 67 | static struct mtd_partition __initdata snapper9260_nand_partitions[] = { |
| 68 | { |
| 69 | .name = "Preboot", |
| 70 | .offset = 0, |
| 71 | .size = SZ_128K, |
| 72 | }, |
| 73 | { |
| 74 | .name = "Bootloader", |
| 75 | .offset = MTDPART_OFS_APPEND, |
| 76 | .size = SZ_256K, |
| 77 | }, |
| 78 | { |
| 79 | .name = "Environment", |
| 80 | .offset = MTDPART_OFS_APPEND, |
| 81 | .size = SZ_128K, |
| 82 | }, |
| 83 | { |
| 84 | .name = "Kernel", |
| 85 | .offset = MTDPART_OFS_APPEND, |
| 86 | .size = SZ_4M, |
| 87 | }, |
| 88 | { |
| 89 | .name = "Filesystem", |
| 90 | .offset = MTDPART_OFS_APPEND, |
| 91 | .size = MTDPART_SIZ_FULL, |
| 92 | }, |
| 93 | }; |
| 94 | |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 95 | static struct atmel_nand_data __initdata snapper9260_nand_data = { |
| 96 | .ale = 21, |
| 97 | .cle = 22, |
| 98 | .rdy_pin = AT91_PIN_PC13, |
Dmitry Eremin-Solenikov | 1754aab | 2011-05-29 17:49:22 +0400 | [diff] [blame] | 99 | .parts = snapper9260_nand_partitions, |
| 100 | .num_parts = ARRAY_SIZE(snapper9260_nand_partitions), |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 101 | .bus_width_16 = 0, |
Jean-Christophe PLAGNIOL-VILLARD | 63b4c29 | 2011-11-25 01:51:06 +0800 | [diff] [blame] | 102 | .enable_pin = -EINVAL, |
| 103 | .det_pin = -EINVAL, |
Jean-Christophe PLAGNIOL-VILLARD | bf4289c | 2011-12-29 14:43:24 +0800 | [diff] [blame] | 104 | .ecc_mode = NAND_ECC_SOFT, |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { |
| 108 | .ncs_read_setup = 0, |
| 109 | .nrd_setup = 0, |
| 110 | .ncs_write_setup = 0, |
| 111 | .nwe_setup = 0, |
| 112 | |
| 113 | .ncs_read_pulse = 5, |
| 114 | .nrd_pulse = 2, |
| 115 | .ncs_write_pulse = 5, |
| 116 | .nwe_pulse = 2, |
| 117 | |
| 118 | .read_cycle = 7, |
| 119 | .write_cycle = 7, |
| 120 | |
| 121 | .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE | |
| 122 | AT91_SMC_EXNWMODE_DISABLE), |
| 123 | .tdf_cycles = 1, |
| 124 | }; |
| 125 | |
| 126 | static struct pca953x_platform_data snapper9260_io_expander_data = { |
| 127 | .gpio_base = SNAPPER9260_IO_EXP_GPIO(0), |
| 128 | }; |
| 129 | |
| 130 | static struct i2c_board_info __initdata snapper9260_i2c_devices[] = { |
| 131 | { |
| 132 | /* IO expander */ |
| 133 | I2C_BOARD_INFO("max7312", 0x28), |
| 134 | .platform_data = &snapper9260_io_expander_data, |
| 135 | }, |
| 136 | { |
| 137 | /* Audio codec */ |
| 138 | I2C_BOARD_INFO("tlv320aic23", 0x1a), |
| 139 | }, |
Nicolas Ferre | fe5e079 | 2012-02-11 20:48:52 +0100 | [diff] [blame] | 140 | }; |
| 141 | |
| 142 | static struct i2c_board_info __initdata snapper9260_i2c_isl1208 = { |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 143 | /* RTC */ |
| 144 | I2C_BOARD_INFO("isl1208", 0x6f), |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | static void __init snapper9260_add_device_nand(void) |
| 148 | { |
| 149 | at91_set_A_periph(AT91_PIN_PC14, 0); |
Jean-Christophe PLAGNIOL-VILLARD | faee0cc | 2011-10-14 01:37:09 +0800 | [diff] [blame] | 150 | sam9_smc_configure(0, 3, &snapper9260_nand_smc_config); |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 151 | at91_add_device_nand(&snapper9260_nand_data); |
| 152 | } |
| 153 | |
| 154 | static void __init snapper9260_board_init(void) |
| 155 | { |
| 156 | at91_add_device_i2c(snapper9260_i2c_devices, |
| 157 | ARRAY_SIZE(snapper9260_i2c_devices)); |
Nicolas Ferre | fe5e079 | 2012-02-11 20:48:52 +0100 | [diff] [blame] | 158 | |
| 159 | snapper9260_i2c_isl1208.irq = gpio_to_irq(AT91_PIN_PA31); |
| 160 | i2c_register_board_info(0, &snapper9260_i2c_isl1208, 1); |
| 161 | |
Jean-Christophe PLAGNIOL-VILLARD | 71b149b | 2012-04-05 14:14:28 +0800 | [diff] [blame] | 162 | /* Debug on ttyS0 */ |
| 163 | at91_register_uart(0, 0, 0); |
| 164 | |
| 165 | at91_register_uart(AT91SAM9260_ID_US0, 1, |
| 166 | ATMEL_UART_CTS | ATMEL_UART_RTS); |
| 167 | at91_register_uart(AT91SAM9260_ID_US1, 2, |
| 168 | ATMEL_UART_CTS | ATMEL_UART_RTS); |
| 169 | at91_register_uart(AT91SAM9260_ID_US2, 3, 0); |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 170 | at91_add_device_serial(); |
| 171 | at91_add_device_usbh(&snapper9260_usbh_data); |
| 172 | at91_add_device_udc(&snapper9260_udc_data); |
| 173 | at91_add_device_eth(&snapper9260_macb_data); |
| 174 | at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK | |
| 175 | ATMEL_SSC_TD | ATMEL_SSC_RD)); |
| 176 | snapper9260_add_device_nand(); |
| 177 | } |
| 178 | |
| 179 | MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module") |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 180 | .init_time = at91sam926x_pit_init, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 181 | .map_io = at91_map_io, |
Ludovic Desroches | 3e13546 | 2012-06-11 15:38:03 +0200 | [diff] [blame] | 182 | .handle_irq = at91_aic_handle_irq, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 183 | .init_early = snapper9260_init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 184 | .init_irq = at91_init_irq_default, |
Ryan Mallon | 064baac | 2010-07-06 21:48:53 +0100 | [diff] [blame] | 185 | .init_machine = snapper9260_board_init, |
| 186 | MACHINE_END |
| 187 | |
| 188 | |