Xilinx: ARM: added USB reset via GPIO to zc770 and zc702.
[linux-2.6-xlnx.git] / arch / arm / mach-zynq / board_zc702.c
blobd7a6613dc0d9dce8fe43e6d57fec8582704c4ce4
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/i2c.h>
19 #include <linux/spi/spi.h>
20 #include <linux/spi/eeprom.h>
21 #include <linux/platform_device.h>
22 #include <linux/device.h>
23 #include <linux/spi/spi.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/spi/flash.h>
26 #include <linux/xilinx_devices.h>
27 #include <linux/i2c/pca954x.h>
28 #include <linux/i2c/pca953x.h>
29 #include <linux/i2c/si570.h>
30 #include <linux/gpio.h>
32 #include <mach/slcr.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/hardware/gic.h>
38 #include "common.h"
40 #define IRQ_SPI1 81
41 #define USB_RST_GPIO 7
43 #ifdef CONFIG_SPI_SPIDEV
45 static struct xspi_platform_data spi_0_pdata = {
46 .speed_hz = 75000000,
47 .bus_num = 0,
48 .num_chipselect = 1
51 #endif
53 #ifdef CONFIG_MTD_M25P80
55 static struct mtd_partition spi_flash_partitions[] = {
57 .name = "spi-flash",
58 .size = 0x100000,
59 .offset = 0,
63 static struct flash_platform_data spi_flash_pdata = {
64 .name = "serial_flash",
65 .parts = spi_flash_partitions,
66 .nr_parts = ARRAY_SIZE(spi_flash_partitions),
67 .type = "sst25wf080"
70 #endif
72 #if defined(CONFIG_I2C_XILINX_PS) && defined(CONFIG_I2C_MUX_PCA954x)
74 static struct pca954x_platform_mode pca954x_platform_modes[] = {
76 .adap_id = 1,
77 .deselect_on_exit = 0,
80 .adap_id = 2,
81 .deselect_on_exit = 0,
84 .adap_id = 3,
85 .deselect_on_exit = 0,
88 .adap_id = 4,
89 .deselect_on_exit = 0,
92 .adap_id = 5,
93 .deselect_on_exit = 0,
96 .adap_id = 6,
97 .deselect_on_exit = 0,
100 .adap_id = 7,
101 .deselect_on_exit = 0,
104 .adap_id = 8,
105 .deselect_on_exit = 0,
109 static struct pca954x_platform_data pca954x_i2cmux_adap_data = {
110 .modes = pca954x_platform_modes,
111 .num_modes = 8,
114 static struct i2c_board_info __initdata pca954x_i2c_devices[] = {
116 I2C_BOARD_INFO("pca9548", 0x74),
117 .platform_data = &pca954x_i2cmux_adap_data,
121 #if defined(CONFIG_RTC_DRV_PCF8563)
123 static struct i2c_board_info __initdata rtc8564_board_info[] = {
125 I2C_BOARD_INFO("rtc8564", 0x51),
129 #endif /*CONFIG_RTC_DRV_PCF8563 */
131 #if defined(CONFIG_GPIO_PCA953X)
133 static struct pca953x_platform_data tca6416_0 = {
134 .gpio_base = 256,
137 static struct i2c_board_info __initdata tca6416_board_info[] = {
139 I2C_BOARD_INFO("tca6416", 0x21),
140 .platform_data = &tca6416_0,
144 #endif /* CONFIG_GPIO_PCF8563 */
146 #if defined(CONFIG_SI570)
148 /* Initial FOUT is set per the ADV7511 video clocking requirement */
149 static struct si570_platform_data si570_0 = {
150 .factory_fout = 156250000LL,
151 .initial_fout = 148500000,
154 static struct i2c_board_info __initdata si570_board_info[] = {
156 I2C_BOARD_INFO("si570", 0x5d),
157 .platform_data = &si570_0,
161 #endif /* CONFIG_SI570 */
163 #if defined(CONFIG_EEPROM_AT24)
165 static struct i2c_board_info __initdata m24c08_board_info[] = {
167 I2C_BOARD_INFO("24c08", 0x54),
171 #endif /* CONFIG_EEPROM_AT24 */
173 #endif /* CONFIG_I2C_XILINX_PS && CONFIG_I2C_MUX_PCA954x */
175 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_MTD_M25P80)
177 static struct spi_board_info __initdata xilinx_spipss_0_boardinfo[] = {
179 #ifdef CONFIG_SPI_SPIDEV
180 .modalias = "spidev",
181 .platform_data = &spi_0_pdata,
182 #else
183 .modalias = "m25p80",
184 .platform_data = &spi_flash_pdata,
185 #endif
186 .irq = IRQ_SPI1,
187 .max_speed_hz = 40000000, /* max sample rate at 3V */
188 .bus_num = 0,
189 .chip_select = 1,
193 #endif
195 extern struct sys_timer xttcpss_sys_timer;
197 static void __init board_zc702_init(void)
200 /* initialize the xilinx common code before the board
201 * specific
203 xilinx_init_machine();
205 /* Reset USB by toggling MIO7 */
206 if (gpio_request(USB_RST_GPIO, "USB Reset"))
207 printk(KERN_ERR "ERROR requesting GPIO, USB not reset!");
209 if (gpio_direction_output(USB_RST_GPIO, 1))
210 printk(KERN_ERR "ERROR setting GPIO direction, USB not reset!");
212 gpio_set_value(USB_RST_GPIO, 1);
213 gpio_set_value(USB_RST_GPIO, 0);
214 gpio_set_value(USB_RST_GPIO, 1);
216 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_MTD_M25P80)
217 spi_register_board_info(&xilinx_spipss_0_boardinfo[0],
218 ARRAY_SIZE(xilinx_spipss_0_boardinfo));
219 #endif
221 #if defined(CONFIG_I2C_XILINX_PS) && defined(CONFIG_I2C_MUX_PCA954x)
222 i2c_register_board_info(0, pca954x_i2c_devices,
223 ARRAY_SIZE(pca954x_i2c_devices));
225 #if defined(CONFIG_SI570)
226 i2c_register_board_info(1, si570_board_info,
227 ARRAY_SIZE(si570_board_info));
228 #endif
230 #if defined(CONFIG_EEPROM_AT24)
231 i2c_register_board_info(3, m24c08_board_info,
232 ARRAY_SIZE(m24c08_board_info));
233 #endif
235 #if defined(CONFIG_GPIO_PCA953X)
236 i2c_register_board_info(4, tca6416_board_info,
237 ARRAY_SIZE(tca6416_board_info));
238 #endif
240 #if defined(CONFIG_RTC_DRV_PCF8563)
241 i2c_register_board_info(5, rtc8564_board_info,
242 ARRAY_SIZE(rtc8564_board_info));
243 #endif
246 #endif
249 static const char *xilinx_dt_match[] = {
250 "xlnx,zynq-zc702",
251 "xlnx,zynq-zc706",
252 NULL
255 MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
256 .map_io = xilinx_map_io,
257 .init_irq = xilinx_irq_init,
258 .handle_irq = gic_handle_irq,
259 .init_machine = board_zc702_init,
260 .timer = &xttcpss_sys_timer,
261 .dt_compat = xilinx_dt_match,
262 .reserve = xilinx_memory_init,
263 .restart = xilinx_system_reset,
264 MACHINE_END