| Andrew Victor | 35131fb | 2008-04-15 21:05:03 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * KwikByte CAM60 (KB9260) | 
 | 3 |  * | 
 | 4 |  * based on board-sam9260ek.c | 
 | 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/types.h> | 
 | 24 | #include <linux/init.h> | 
 | 25 | #include <linux/mm.h> | 
 | 26 | #include <linux/module.h> | 
 | 27 | #include <linux/platform_device.h> | 
 | 28 | #include <linux/spi/spi.h> | 
 | 29 | #include <linux/spi/flash.h> | 
 | 30 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | #include <mach/hardware.h> | 
| Andrew Victor | 35131fb | 2008-04-15 21:05:03 +0100 | [diff] [blame] | 32 | #include <asm/setup.h> | 
 | 33 | #include <asm/mach-types.h> | 
 | 34 | #include <asm/irq.h> | 
 | 35 |  | 
 | 36 | #include <asm/mach/arch.h> | 
 | 37 | #include <asm/mach/map.h> | 
 | 38 | #include <asm/mach/irq.h> | 
 | 39 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 40 | #include <mach/board.h> | 
 | 41 | #include <mach/gpio.h> | 
| Andrew Victor | 35131fb | 2008-04-15 21:05:03 +0100 | [diff] [blame] | 42 |  | 
 | 43 | #include "generic.h" | 
 | 44 |  | 
 | 45 |  | 
 | 46 | static void __init cam60_map_io(void) | 
 | 47 | { | 
 | 48 | 	/* Initialize processor: 10 MHz crystal */ | 
 | 49 | 	at91sam9260_initialize(10000000); | 
 | 50 |  | 
 | 51 | 	/* DGBU on ttyS0. (Rx & Tx only) */ | 
 | 52 | 	at91_register_uart(0, 0, 0); | 
 | 53 |  | 
 | 54 | 	/* set serial console to ttyS0 (ie, DBGU) */ | 
 | 55 | 	at91_set_serial_console(0); | 
 | 56 | } | 
 | 57 |  | 
 | 58 | static void __init cam60_init_irq(void) | 
 | 59 | { | 
 | 60 | 	at91sam9260_init_interrupts(NULL); | 
 | 61 | } | 
 | 62 |  | 
 | 63 |  | 
 | 64 | /* | 
 | 65 |  * USB Host | 
 | 66 |  */ | 
 | 67 | static struct at91_usbh_data __initdata cam60_usbh_data = { | 
 | 68 | 	.ports		= 1, | 
 | 69 | }; | 
 | 70 |  | 
 | 71 |  | 
 | 72 | /* | 
 | 73 |  * SPI devices. | 
 | 74 |  */ | 
 | 75 | #if defined(CONFIG_MTD_DATAFLASH) | 
 | 76 | static struct mtd_partition __initdata cam60_spi_partitions[] = { | 
 | 77 | 	{ | 
 | 78 | 		.name	= "BOOT1", | 
 | 79 | 		.offset	= 0, | 
 | 80 | 		.size	= 4 * 1056, | 
 | 81 | 	}, | 
 | 82 | 	{ | 
 | 83 | 		.name	= "BOOT2", | 
 | 84 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 85 | 		.size	= 256 * 1056, | 
 | 86 | 	}, | 
 | 87 | 	{ | 
 | 88 | 		.name	= "kernel", | 
 | 89 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 90 | 		.size	= 2222 * 1056, | 
 | 91 | 	}, | 
 | 92 | 	{ | 
 | 93 | 		.name	= "file system", | 
 | 94 | 		.offset	= MTDPART_OFS_NXTBLK, | 
 | 95 | 		.size	= MTDPART_SIZ_FULL, | 
 | 96 | 	}, | 
 | 97 | }; | 
 | 98 |  | 
 | 99 | static struct flash_platform_data __initdata cam60_spi_flash_platform_data = { | 
 | 100 | 	.name		= "spi_flash", | 
 | 101 | 	.parts		= cam60_spi_partitions, | 
 | 102 | 	.nr_parts	= ARRAY_SIZE(cam60_spi_partitions) | 
 | 103 | }; | 
 | 104 | #endif | 
 | 105 |  | 
 | 106 | static struct spi_board_info cam60_spi_devices[] = { | 
 | 107 | #if defined(CONFIG_MTD_DATAFLASH) | 
 | 108 | 	{	/* DataFlash chip */ | 
 | 109 | 		.modalias	= "mtd_dataflash", | 
 | 110 | 		.chip_select	= 0, | 
 | 111 | 		.max_speed_hz	= 15 * 1000 * 1000, | 
 | 112 | 		.bus_num	= 0, | 
 | 113 | 		.platform_data	= &cam60_spi_flash_platform_data | 
 | 114 | 	}, | 
 | 115 | #endif | 
 | 116 | }; | 
 | 117 |  | 
 | 118 |  | 
 | 119 | /* | 
 | 120 |  * MACB Ethernet device | 
 | 121 |  */ | 
 | 122 | static struct __initdata at91_eth_data cam60_macb_data = { | 
 | 123 | 	.phy_irq_pin	= AT91_PIN_PB5, | 
 | 124 | 	.is_rmii	= 0, | 
 | 125 | }; | 
 | 126 |  | 
 | 127 |  | 
 | 128 | /* | 
 | 129 |  * NAND Flash | 
 | 130 |  */ | 
 | 131 | static struct mtd_partition __initdata cam60_nand_partition[] = { | 
 | 132 | 	{ | 
 | 133 | 		.name	= "nand_fs", | 
 | 134 | 		.offset	= 0, | 
 | 135 | 		.size	= MTDPART_SIZ_FULL, | 
 | 136 | 	}, | 
 | 137 | }; | 
 | 138 |  | 
 | 139 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) | 
 | 140 | { | 
 | 141 | 	*num_partitions = ARRAY_SIZE(cam60_nand_partition); | 
 | 142 | 	return cam60_nand_partition; | 
 | 143 | } | 
 | 144 |  | 
| HÃ¥vard Skinnemoen | 3c3796c | 2008-06-06 18:04:53 +0200 | [diff] [blame] | 145 | static struct atmel_nand_data __initdata cam60_nand_data = { | 
| Andrew Victor | 35131fb | 2008-04-15 21:05:03 +0100 | [diff] [blame] | 146 | 	.ale		= 21, | 
 | 147 | 	.cle		= 22, | 
 | 148 | 	// .det_pin	= ... not there | 
 | 149 | 	.rdy_pin	= AT91_PIN_PA9, | 
 | 150 | 	.enable_pin	= AT91_PIN_PA7, | 
 | 151 | 	.partition_info	= nand_partitions, | 
 | 152 | }; | 
 | 153 |  | 
 | 154 |  | 
 | 155 | static void __init cam60_board_init(void) | 
 | 156 | { | 
 | 157 | 	/* Serial */ | 
 | 158 | 	at91_add_device_serial(); | 
 | 159 | 	/* SPI */ | 
 | 160 | 	at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices)); | 
 | 161 | 	/* Ethernet */ | 
 | 162 | 	at91_add_device_eth(&cam60_macb_data); | 
 | 163 | 	/* USB Host */ | 
 | 164 | 	/* enable USB power supply circuit */ | 
 | 165 | 	at91_set_gpio_output(AT91_PIN_PB18, 1); | 
 | 166 | 	at91_add_device_usbh(&cam60_usbh_data); | 
 | 167 | 	/* NAND */ | 
 | 168 | 	at91_add_device_nand(&cam60_nand_data); | 
 | 169 | } | 
 | 170 |  | 
 | 171 | MACHINE_START(CAM60, "KwikByte CAM60") | 
 | 172 | 	/* Maintainer: KwikByte */ | 
 | 173 | 	.phys_io	= AT91_BASE_SYS, | 
 | 174 | 	.io_pg_offst	= (AT91_VA_BASE_SYS >> 18) & 0xfffc, | 
 | 175 | 	.boot_params	= AT91_SDRAM_BASE + 0x100, | 
 | 176 | 	.timer		= &at91sam926x_timer, | 
 | 177 | 	.map_io		= cam60_map_io, | 
 | 178 | 	.init_irq	= cam60_init_irq, | 
 | 179 | 	.init_machine	= cam60_board_init, | 
 | 180 | MACHINE_END |