2 * stmark2.c -- Support for Sysam AMCORE open board
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
11 #include <linux/platform_device.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/spi/spi.h>
14 #include <linux/spi/spi-fsl-dspi.h>
15 #include <linux/spi/flash.h>
16 #include <asm/mcfsim.h>
19 * Partitioning of parallel NOR flash (39VF3201B)
21 static struct mtd_partition stmark2_partitions[] = {
23 .name = "U-Boot (1024K)",
27 .name = "Kernel+initramfs (7168K)",
29 .offset = MTDPART_OFS_APPEND
31 .name = "Flash Free Space (8192K)",
32 .size = MTDPART_SIZ_FULL,
33 .offset = MTDPART_OFS_APPEND
37 static struct flash_platform_data stmark2_spi_flash_data = {
39 .parts = stmark2_partitions,
40 .nr_parts = ARRAY_SIZE(stmark2_partitions),
44 static struct spi_board_info stmark2_board_info[] __initdata = {
47 .max_speed_hz = 5000000,
50 .platform_data = &stmark2_spi_flash_data,
55 /* SPI controller data, SPI (0) */
56 static struct fsl_dspi_platform_data dspi_spi0_info = {
63 static struct resource dspi_spi0_resource[] = {
65 .start = MCFDSPI_BASE0,
66 .end = MCFDSPI_BASE0 + 0xFF,
67 .flags = IORESOURCE_MEM,
72 .flags = IORESOURCE_DMA,
75 .start = MCF_IRQ_DSPI0,
77 .flags = IORESOURCE_IRQ,
81 /* SPI controller, id = bus number */
82 static struct platform_device dspi_spi0_device = {
85 .num_resources = ARRAY_SIZE(dspi_spi0_resource),
86 .resource = dspi_spi0_resource,
88 .platform_data = &dspi_spi0_info,
92 static struct platform_device *stmark2_devices[] __initdata = {
97 * Note: proper pin-mux setup is mandatory for proper SPI functionality.
99 static int __init init_stmark2(void)
101 /* DSPI0, all pins as DSPI, and using CS1 */
102 __raw_writeb(0x80, MCFGPIO_PAR_DSPIOWL);
103 __raw_writeb(0xfc, MCFGPIO_PAR_DSPIOWH);
105 /* Board gpio setup */
106 __raw_writeb(0x00, MCFGPIO_PAR_BE);
107 __raw_writeb(0x00, MCFGPIO_PAR_FBCTL);
108 __raw_writeb(0x00, MCFGPIO_PAR_CS);
109 __raw_writeb(0x00, MCFGPIO_PAR_CANI2C);
111 platform_add_devices(stmark2_devices, ARRAY_SIZE(stmark2_devices));
113 spi_register_board_info(stmark2_board_info,
114 ARRAY_SIZE(stmark2_board_info));
119 late_initcall(init_stmark2);