Xilinx: ARM: BSP: update DC4 (XM013) SPI eeprom
[linux-2.6-xlnx.git] / arch / arm / mach-zynq / board_zc770_xm013.c
blob17767de61a750cd8fbdefb2d5db9a6950fd8e652
1 /*
2 * Copyright (C) 2011 Xilinx
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * You should have received a copy of the GNU General Public License
10 * along with this program; if not, write to the Free Software
11 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 #include <linux/types.h>
15 #include <linux/init.h>
16 #include <linux/of_platform.h>
18 #include <linux/spi/spi.h>
19 #include <linux/spi/eeprom.h>
20 #include <linux/platform_device.h>
21 #include <linux/device.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/spi/flash.h>
24 #include <linux/xilinx_devices.h>
25 #include <linux/i2c.h>
26 #include <linux/i2c/si570.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
31 #include <asm/hardware/gic.h>
32 #include "common.h"
34 #define IRQ_QSPI0 51
35 #define IRQ_SPI1 58
37 #ifdef CONFIG_SPI_SPIDEV
39 static struct xspi_platform_data spi_0_pdata = {
40 .speed_hz = 10000000,
41 .bus_num = 0,
42 .num_chipselect = 1
45 #else
47 static struct spi_eeprom at25640_0 = {
48 .name = "at25LC640",
49 .byte_len = 8*1024,
50 .page_size = 32,
51 .flags = EE_ADDR2,
54 static struct spi_board_info spi_devs[] __initdata = {
56 .modalias = "at25",
57 .max_speed_hz = 1000000,
58 .bus_num = 0,
59 .chip_select = 2,
60 .platform_data = &at25640_0,
64 #endif
66 #if defined(CONFIG_SI570)
68 static struct si570_platform_data si570_0 = {
69 .factory_fout = 10000000LL,
70 .initial_fout = 133000000,
73 static struct i2c_board_info __initdata si570_board_info[] = {
75 I2C_BOARD_INFO("si570", 0x55),
76 .platform_data = &si570_0,
80 #endif /* CONFIG_SI570 */
82 extern struct sys_timer xttcpss_sys_timer;
84 static void __init board_zc770_xm013_init(void)
87 /* initialize the xilinx common code before the board
88 * specific
90 xilinx_init_machine();
92 #ifndef CONFIG_SPI_SPIDEV
93 spi_register_board_info(&spi_devs[0],
94 ARRAY_SIZE(spi_devs));
95 #endif
97 #if defined(CONFIG_SI570)
98 i2c_register_board_info(0, si570_board_info,
99 ARRAY_SIZE(si570_board_info));
100 #endif
104 static const char *xilinx_dt_match[] = {
105 "xlnx,zynq-zc770-xm013",
106 NULL
109 MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
110 .map_io = xilinx_map_io,
111 .init_irq = xilinx_irq_init,
112 .handle_irq = gic_handle_irq,
113 .init_machine = board_zc770_xm013_init,
114 .timer = &xttcpss_sys_timer,
115 .dt_compat = xilinx_dt_match,
116 .reserve = xilinx_memory_init,
117 MACHINE_END